@@ -347,7 +347,7 @@ uint8_t BaseMapper::GetPowerOnByte(uint8_t defaultValue)
347347
348348bool BaseMapper::HasBattery ()
349349{
350- return _hasBattery ;
350+ return _romInfo. HasBattery ;
351351}
352352
353353void BaseMapper::LoadBattery ()
@@ -384,7 +384,7 @@ uint32_t BaseMapper::GetCHRPageCount()
384384
385385string BaseMapper::GetBatteryFilename ()
386386{
387- return FolderUtilities::CombinePath (FolderUtilities::GetSaveFolder (), FolderUtilities::GetFilename (_romName , false ) + " .sav" );
387+ return FolderUtilities::CombinePath (FolderUtilities::GetSaveFolder (), FolderUtilities::GetFilename (_romInfo. RomName , false ) + " .sav" );
388388}
389389
390390void BaseMapper::RestoreOriginalPrgRam ()
@@ -493,17 +493,10 @@ void BaseMapper::StreamState(bool saving)
493493
494494void BaseMapper::Initialize (RomData &romData)
495495{
496- _mapperID = romData.MapperID ;
497- _subMapperID = romData.SubMapperID ;
496+ _romInfo = romData.Info ;
498497
499- _databaseInfo = romData.DatabaseInfo ;
500-
501- _romName = romData.RomName ;
502- _romFilename = romData.Filename ;
503498 _batteryFilename = GetBatteryFilename ();
504499
505- _hasBattery = romData.HasBattery ;
506-
507500 if (romData.SaveRamSize == -1 || ForceSaveRamSize ()) {
508501 _saveRamSize = GetSaveRamSize ();
509502 } else {
@@ -522,10 +515,7 @@ void BaseMapper::Initialize(RomData &romData)
522515 memset (_isWriteRegisterAddr, 0 , sizeof (_isWriteRegisterAddr));
523516 AddRegisterRange (RegisterStartAddress (), RegisterEndAddress (), MemoryOperation::Any);
524517
525- _nesHeader = romData.NesHeader ;
526- _romFormat = romData.Format ;
527-
528- _mirroringType = romData.Mirroring ;
518+ _mirroringType = romData.Info .Mirroring ;
529519
530520 _prgSize = (uint32_t )romData.PrgRom .size ();
531521 _chrRomSize = (uint32_t )romData.ChrRom .size ();
@@ -541,13 +531,7 @@ void BaseMapper::Initialize(RomData &romData)
541531
542532 _hasChrBattery = romData.SaveChrRamSize > 0 || ForceChrBattery ();
543533
544- _gameSystem = romData.System ;
545- _hashInfo.Crc32Hash = romData.Crc32 ;
546- _hashInfo.PrgCrc32Hash = romData.PrgCrc32 ;
547- _hashInfo.PrgChrCrc32Hash = romData.PrgChrCrc32 ;
548- _hashInfo.Sha1Hash = romData.Sha1 ;
549- _hashInfo.PrgChrMd5Hash = romData.PrgChrMd5 ;
550- switch (romData.BusConflicts ) {
534+ switch (romData.Info .BusConflicts ) {
551535 case BusConflictType::Default: _hasBusConflicts = HasBusConflicts (); break ;
552536 case BusConflictType::Yes: _hasBusConflicts = true ; break ;
553537 case BusConflictType::No: _hasBusConflicts = false ; break ;
@@ -590,7 +574,7 @@ void BaseMapper::Initialize(RomData &romData)
590574 // Load battery data if present
591575 LoadBattery ();
592576
593- if (romData.HasTrainer ) {
577+ if (romData.Info . HasTrainer ) {
594578 if (_workRamSize >= 0x2000 ) {
595579 memcpy (_workRam + 0x1000 , romData.TrainerData .data (), 512 );
596580 } else if (_saveRamSize >= 0x2000 ) {
@@ -604,6 +588,8 @@ void BaseMapper::Initialize(RomData &romData)
604588 InitMapper (romData);
605589
606590 ApplyCheats ();
591+
592+ _romInfo.HasChrRam = HasChrRam ();
607593}
608594
609595BaseMapper::~BaseMapper ()
@@ -643,7 +629,7 @@ void BaseMapper::ApplyCheats()
643629
644630void BaseMapper::GetMemoryRanges (MemoryRanges &ranges)
645631{
646- if (_gameSystem == GameSystem::VsUniSystem || _gameSystem == GameSystem::VsDualSystem ) {
632+ if (_romInfo. System == GameSystem::VsSystem ) {
647633 ranges.AddHandler (MemoryOperation::Read, 0x6000 , 0xFFFF );
648634 ranges.AddHandler (MemoryOperation::Write, 0x6000 , 0xFFFF );
649635 } else {
@@ -730,17 +716,9 @@ shared_ptr<BaseControlDevice> BaseMapper::GetMapperControlDevice()
730716 return _mapperControlDevice;
731717}
732718
733- MapperInfo BaseMapper::GetMapperInfo ()
719+ RomInfo BaseMapper::GetRomInfo ()
734720{
735- return {
736- _romName,
737- _romFormat,
738- _gameSystem,
739- _mapperID,
740- _subMapperID,
741- _hashInfo,
742- HasChrRam ()
743- };
721+ return _romInfo;
744722}
745723
746724MirroringType BaseMapper::GetMirroringType ()
@@ -859,7 +837,7 @@ void BaseMapper::WriteVRAM(uint16_t addr, uint8_t value)
859837
860838bool BaseMapper::IsNes20 ()
861839{
862- return _nesHeader .GetRomHeaderVersion () == RomHeaderVersion::Nes2_0;
840+ return _romInfo. NesHeader .GetRomHeaderVersion () == RomHeaderVersion::Nes2_0;
863841}
864842
865843// Debugger Helper Functions
@@ -1131,11 +1109,6 @@ CartridgeState BaseMapper::GetState()
11311109 return state;
11321110}
11331111
1134- NESHeader BaseMapper::GetNesHeader ()
1135- {
1136- return _nesHeader;
1137- }
1138-
11391112void BaseMapper::GetRomFileData (vector<uint8_t > &out, bool asIpsFile, uint8_t * header)
11401113{
11411114 if (header) {
@@ -1147,7 +1120,7 @@ void BaseMapper::GetRomFileData(vector<uint8_t> &out, bool asIpsFile, uint8_t* h
11471120 out.insert (out.end (), originalFile.begin ()+sizeof (NESHeader), originalFile.end ());
11481121 } else {
11491122 vector<uint8_t > newFile;
1150- newFile.insert (newFile.end (), (uint8_t *)&_nesHeader , ((uint8_t *)&_nesHeader ) + sizeof (NESHeader));
1123+ newFile.insert (newFile.end (), (uint8_t *)&_romInfo. NesHeader , ((uint8_t *)&_romInfo. NesHeader ) + sizeof (NESHeader));
11511124 newFile.insert (newFile.end (), _prgRom, _prgRom + _prgSize);
11521125 if (HasChrRom ()) {
11531126 newFile.insert (newFile.end (), _chrRom, _chrRom + _chrRomSize);
0 commit comments