Guard against cheat codes in RetroAchievements' hardcore mode

originally I thought just blocking the cheat window would be enough, but autoloaded cheat codes could sneak through. An actual check for cheat codes being active prevents this being an issue.
This commit is contained in:
CasualPokePlayer 2024-08-20 15:21:05 -07:00
parent beab2b141b
commit 02acd542c2
3 changed files with 9 additions and 0 deletions

View File

@ -15,6 +15,8 @@ namespace BizHawk.Client.EmuHawk
GameInfo Game { get; } GameInfo Game { get; }
public CheatCollection CheatList { get; }
IMovieSession MovieSession { get; } IMovieSession MovieSession { get; }
FirmwareManager FirmwareManager { get; } FirmwareManager FirmwareManager { get; }

View File

@ -77,6 +77,12 @@ namespace BizHawk.Client.EmuHawk
return; return;
} }
if (CheatList.AnyActive)
{
HandleHardcoreModeDisable("Using cheat codes while in hardcore mode is not allowed.");
return;
}
// suppress rewind and frame advance hotkeys // suppress rewind and frame advance hotkeys
_hardcoreHotkeyOverrides.FrameTick(); _hardcoreHotkeyOverrides.FrameTick();
_hardcoreHotkeyOverrides.SetButton("Frame Advance", false); _hardcoreHotkeyOverrides.SetButton("Frame Advance", false);

View File

@ -22,6 +22,7 @@ namespace BizHawk.Client.EmuHawk
protected IMemoryDomains Domains => Emu.AsMemoryDomains(); protected IMemoryDomains Domains => Emu.AsMemoryDomains();
protected IGameInfo Game => _mainForm.Game; protected IGameInfo Game => _mainForm.Game;
protected IMovieSession MovieSession => _mainForm.MovieSession; protected IMovieSession MovieSession => _mainForm.MovieSession;
protected CheatCollection CheatList => _mainForm.CheatList;
protected IReadOnlyList<MemFunctions> _memFunctions; protected IReadOnlyList<MemFunctions> _memFunctions;