NES: Disable Game Genie bus conflicts emulation when running an unknown iNES 1.0 ROM

Otherwise, Game Genie codes that could have worked on hardware did not work as expected because of the bus conflicts. This could occur when e.g trying to use cheats on a romhack, etc.
This commit is contained in:
Sour 2024-07-20 21:39:16 +09:00
parent 485c20492b
commit c77415581f
4 changed files with 11 additions and 7 deletions

View file

@ -478,6 +478,11 @@ void BaseMapper::InitializeChrRam(int32_t chrRamSize)
}
}
bool BaseMapper::HasDefaultWorkRam()
{
return _hasDefaultWorkRam;
}
void BaseMapper::SetupDefaultWorkRam()
{
//Setup a default work/save ram in 0x6000-0x7FFF space
@ -576,6 +581,7 @@ void BaseMapper::Initialize(NesConsole* console, RomData& romData)
if(romData.SaveRamSize == -1) {
_saveRamSize = HasBattery() ? GetSaveRamSize() : 0;
_hasDefaultWorkRam = _saveRamSize > 0;
} else if(ForceSaveRamSize()) {
_saveRamSize = GetSaveRamSize();
} else {
@ -584,6 +590,7 @@ void BaseMapper::Initialize(NesConsole* console, RomData& romData)
if(romData.WorkRamSize == -1) {
_workRamSize = HasBattery() ? 0 : GetWorkRamSize();
_hasDefaultWorkRam = _workRamSize > 0;
} else if(ForceWorkRamSize()) {
_workRamSize = GetWorkRamSize();
} else {

View file

@ -33,6 +33,7 @@ private:
uint32_t _internalRamMask = 0x7FF;
bool _hasBusConflicts = false;
bool _hasDefaultWorkRam = false;
bool _allowRegisterRead = false;
bool _isReadRegisterAddr[0x10000] = {};
@ -170,6 +171,8 @@ public:
GameSystem GetGameSystem();
PpuModel GetPpuModel();
bool HasDefaultWorkRam();
virtual void SetRegion(ConsoleRegion region) { }
virtual void ProcessCpuClock() { }

View file

@ -217,12 +217,6 @@ void GameDatabase::SetGameInfo(uint32_t romCrc, RomData &romData, bool updateRom
bool foundInDatabase = result != _gameDatabase.end();
if(foundInDatabase) {
info = result->second;
if(!forHeaderlessRom && info.Board == "UNK") {
//Boards marked as UNK should only be used for headerless roms (since their data is unverified)
romData.Info.DatabaseInfo = {};
return;
}
MessageManager::Log("[DB] Game found in database");
MessageManager::Log("[DB] Mapper: " + std::to_string(info.MapperID) + " Sub: " + std::to_string(GetSubMapper(info)));

View file

@ -616,7 +616,7 @@ void NesConsole::InitializeInputDevices(GameInputType inputType, GameSystem syst
void NesConsole::ProcessCheatCode(InternalCheatCode& code, uint32_t addr, uint8_t& value)
{
if(code.Type == CheatType::NesGameGenie && addr >= 0xC020) {
if(GetNesConfig().DisableGameGenieBusConflicts) {
if(GetNesConfig().DisableGameGenieBusConflicts || _mapper->HasDefaultWorkRam()) {
return;
}