Preserve cheats when OS_ResetSystem is used, move temporary save buffer to main memory

This commit is contained in:
Gericom
2026-03-07 13:49:51 +01:00
parent 1038a3d9cf
commit 8c8f36f5c6
14 changed files with 153 additions and 96 deletions

View File

@@ -47,6 +47,7 @@ static u32 sRomDirSector;
static u32 sRomDirSectorOffset;
static u16 sIsCloneBootRom;
static loader_info_t sLoaderInfo;
static void** sSoftResetCheatsPointer = nullptr;
u16 gIsDsiMode;
@@ -147,11 +148,12 @@ static void handleClearMainMemCommand()
static void handleApplyArm9PatchesCommand()
{
Arm9Patcher().ApplyPatches(
auto result = Arm9Patcher().ApplyPatches(
sLoaderPlatform,
sApListEntry.GetGameCode() == 0 ? nullptr : &sApListEntry,
sIsCloneBootRom,
&sLoaderInfo);
sSoftResetCheatsPointer = result.softResetCheatsPointer;
ipc_sendWordDirect(1);
}
@@ -159,6 +161,10 @@ static void handleApplyArm7PatchesCommand(u32 cheatsLength)
{
void* cheats = nullptr;
void* patchSpaceStart = Arm7Patcher().ApplyPatches(sLoaderPlatform, cheatsLength, cheats);
if (sSoftResetCheatsPointer != nullptr)
{
*sSoftResetCheatsPointer = cheats;
}
ipc_sendWordDirect((u32)patchSpaceStart);
ipc_sendWordDirect((u32)cheats);
}