[Cheats] Add boilerplate

This commit is contained in:
wheremyfoodat 2023-07-19 20:51:45 +03:00
parent 5b4f6ef46c
commit 0904638df0
5 changed files with 42 additions and 2 deletions

5
src/core/cheats.cpp Normal file
View file

@ -0,0 +1,5 @@
#include "cheats.hpp"
ActionReplay::ActionReplay() { reset(); }
void ActionReplay::reset() { cheats.clear(); }

View file

@ -76,6 +76,12 @@ void Emulator::reset(ReloadOption reload) {
// Otherwise resetting the kernel or cpu might nuke them
cpu.setReg(13, VirtualAddrs::StackTop); // Set initial SP
// We're resetting without reloading the ROM, so yeet cheats
if (reload == ReloadOption::NoReload) {
haveCheats = false;
cheats.reset();
}
// If a ROM is active and we reset, with the reload option enabled then reload it.
// This is necessary to set up stack, executable memory, .data/.rodata/.bss all over again
if (reload == ReloadOption::Reload && romType != ROMType::None && romPath.has_value()) {