1 #pragma once 2 #include "stdafx.h" 3 #include <cmath> 4 #include "Types.h" 5 #include "NESHeader.h" 6 7 enum class RomHeaderVersion 8 { 9 iNes = 0, 10 Nes2_0 = 1, 11 OldiNes = 2 12 }; 13 14 struct NsfHeader 15 { 16 char Header[5]; 17 uint8_t Version; 18 uint8_t TotalSongs; 19 uint8_t StartingSong; 20 uint16_t LoadAddress; 21 uint16_t InitAddress; 22 uint16_t PlayAddress; 23 char SongName[256]; 24 char ArtistName[256]; 25 char CopyrightHolder[256]; 26 uint16_t PlaySpeedNtsc; 27 uint8_t BankSetup[8]; 28 uint16_t PlaySpeedPal; 29 uint8_t Flags; 30 uint8_t SoundChips; 31 uint8_t Padding[4]; 32 33 //NSFe extensions 34 char RipperName[256]; 35 char TrackName[20000]; 36 int32_t TrackLength[256]; 37 int32_t TrackFade[256]; 38 }; 39 40 struct GameInfo 41 { 42 uint32_t Crc; 43 string System; 44 string Board; 45 string Pcb; 46 string Chip; 47 uint16_t MapperID; 48 uint32_t PrgRomSize; 49 uint32_t ChrRomSize; 50 uint32_t ChrRamSize; 51 uint32_t WorkRamSize; 52 uint32_t SaveRamSize; 53 bool HasBattery; 54 string Mirroring; 55 string InputType; 56 string BusConflicts; 57 string SubmapperID; 58 string VsSystemType; 59 string PpuModel; 60 }; 61 62 struct RomInfo 63 { 64 string RomName; 65 string Filename; 66 RomFormat Format; 67 68 bool IsNes20Header = false; 69 bool IsInDatabase = false; 70 bool IsHeaderlessRom = false; 71 72 uint32_t FilePrgOffset = 0; 73 74 uint16_t MapperID = 0; 75 uint8_t SubMapperID = 0; 76 77 GameSystem System = GameSystem::Unknown; 78 VsSystemType VsType = VsSystemType::Default; 79 GameInputType InputType = GameInputType::Unspecified; 80 PpuModel VsPpuModel = PpuModel::Ppu2C02; 81 82 bool HasChrRam = false; 83 bool HasBattery = false; 84 bool HasTrainer = false; 85 MirroringType Mirroring = MirroringType::Horizontal; 86 BusConflictType BusConflicts = BusConflictType::Default; 87 88 HashInfo Hash; 89 90 NESHeader NesHeader; 91 NsfHeader NsfInfo; 92 GameInfo DatabaseInfo; 93 }; 94 95 struct RomData 96 { 97 RomInfo Info; 98 99 int32_t ChrRamSize = -1; 100 int32_t SaveChrRamSize = -1; 101 int32_t SaveRamSize = -1; 102 int32_t WorkRamSize = -1; 103 104 vector<uint8_t> PrgRom; 105 vector<uint8_t> ChrRom; 106 vector<uint8_t> TrainerData; 107 vector<vector<uint8_t>> FdsDiskData; 108 vector<vector<uint8_t>> FdsDiskHeaders; 109 110 vector<uint8_t> RawData; 111 112 bool Error = false; 113 bool BiosMissing = false; 114 115 }; 116