Mappers: Stricter rules for work/save ram definitions (Fixes Cosmo Police Galivan without patching, but breaks save state compatibility)
This commit is contained in:
parent
f979a0679c
commit
842bd14c17
3 changed files with 28 additions and 13 deletions
|
@ -37,14 +37,29 @@ void BaseMapper::SetCpuMemoryMapping(uint16_t startAddr, uint16_t endAddr, int16
|
|||
break;
|
||||
case PrgMemoryType::SaveRam:
|
||||
source = _saveRam;
|
||||
pageCount = _saveRamSize / InternalGetSaveRamPageSize();
|
||||
pageSize = InternalGetSaveRamPageSize();
|
||||
if(pageSize == 0) {
|
||||
#ifdef _DEBUG
|
||||
MessageManager::DisplayMessage("Debug", "Tried to map undefined save ram.");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
pageCount = _saveRamSize / pageSize;
|
||||
|
||||
defaultAccessType |= MemoryAccessType::Write;
|
||||
break;
|
||||
case PrgMemoryType::WorkRam:
|
||||
source = _workRam;
|
||||
pageCount = _workRamSize / InternalGetWorkRamPageSize();
|
||||
pageSize = InternalGetWorkRamPageSize();
|
||||
if(pageSize == 0) {
|
||||
#ifdef _DEBUG
|
||||
MessageManager::DisplayMessage("Debug", "Tried to map undefined work ram.");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
pageCount = _workRamSize / pageSize;
|
||||
|
||||
defaultAccessType |= MemoryAccessType::Write;
|
||||
break;
|
||||
default:
|
||||
|
@ -128,6 +143,12 @@ void BaseMapper::SetPpuMemoryMapping(uint16_t startAddr, uint16_t endAddr, uint1
|
|||
|
||||
case ChrMemoryType::ChrRam:
|
||||
pageSize = InternalGetChrRamPageSize();
|
||||
if(pageSize == 0) {
|
||||
#ifdef _DEBUG
|
||||
MessageManager::DisplayMessage("Debug", "Tried to map undefined chr ram.");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
pageCount = _chrRamSize / pageSize;
|
||||
sourceMemory = _chrRam;
|
||||
defaultAccessType |= MemoryAccessType::Write;
|
||||
|
|
|
@ -110,7 +110,7 @@ protected:
|
|||
virtual uint16_t GetChrRamPageSize() { return 0x2000; }
|
||||
|
||||
//Save ram is battery backed and saved to disk
|
||||
virtual uint32_t GetSaveRamSize() { return 0x2000; }
|
||||
virtual uint32_t GetSaveRamSize() { return HasBattery() ? 0x2000 : 0; }
|
||||
virtual uint32_t GetSaveRamPageSize() { return 0x2000; }
|
||||
virtual bool ForceBattery() { return false; }
|
||||
virtual bool ForceChrBattery() { return false; }
|
||||
|
@ -118,7 +118,7 @@ protected:
|
|||
virtual uint32_t GetChrRamSize() { return 0x0000; }
|
||||
|
||||
//Work ram is NOT saved - aka Expansion ram, etc.
|
||||
virtual uint32_t GetWorkRamPageSize() { return 0x2000; }
|
||||
virtual uint32_t GetWorkRamPageSize() { return HasBattery() ? 0 : 0x2000; }
|
||||
virtual uint32_t GetWorkRamSize() { return 0x2000; }
|
||||
|
||||
virtual uint16_t RegisterStartAddress() { return 0x8000; }
|
||||
|
|
|
@ -279,15 +279,9 @@ void GameDatabase::UpdateRomData(GameInfo &info, RomData &romData)
|
|||
romData.MapperID = info.MapperID;
|
||||
romData.System = GetGameSystem(info.System);
|
||||
romData.SubMapperID = GetSubMapper(info);
|
||||
if(info.ChrRamSize > 0) {
|
||||
romData.ChrRamSize = info.ChrRamSize * 1024;
|
||||
}
|
||||
if(info.WorkRamSize > 0) {
|
||||
romData.WorkRamSize = info.WorkRamSize * 1024;
|
||||
}
|
||||
if(info.SaveRamSize > 0) {
|
||||
romData.SaveRamSize = info.SaveRamSize * 1024;
|
||||
}
|
||||
romData.ChrRamSize = info.ChrRamSize * 1024;
|
||||
romData.WorkRamSize = info.WorkRamSize * 1024;
|
||||
romData.SaveRamSize = info.SaveRamSize * 1024;
|
||||
romData.HasBattery |= info.HasBattery;
|
||||
|
||||
if(!info.Mirroring.empty()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue