Further work on implementing support for cheats

This commit is contained in:
Gericom
2026-02-21 19:30:03 +01:00
parent 3300c5277c
commit 83046e2cc2
11 changed files with 286 additions and 15 deletions

View File

@@ -522,7 +522,13 @@ void NdsLoader::HandleHomebrewPatching()
void NdsLoader::ApplyArm7Patches()
{
sendToArm9(IPC_COMMAND_ARM9_APPLY_ARM7_PATCHES);
sendToArm9(_cheats ? _cheats->length : 0);
void* patchSpaceStart = (void*)receiveFromArm9();
void* cheatsPtr = (void*)receiveFromArm9();
if (cheatsPtr != nullptr && _cheats != nullptr)
{
memcpy(cheatsPtr, _cheats, _cheats->length);
}
if (patchSpaceStart)
{
u32 mbk6 = 0;

View File

@@ -42,6 +42,13 @@ public:
_argumentsLength = argumentsLength;
}
/// @brief Sets the cheats to apply to the rom.
/// @param cheats The cheats.
void SetCheats(const pload_cheats_t* cheats)
{
_cheats = cheats;
}
/// @brief Loads the rom according to the specified \p bootMode.
/// @param bootMode The boot mode.
void Load(BootMode bootMode);
@@ -53,6 +60,7 @@ private:
const TCHAR* _launcherPath = nullptr;
u32 _argumentsLength = 0;
const char* _arguments = nullptr;
const pload_cheats_t* _cheats = nullptr;
nds_header_twl_t _romHeader;
DsiWareSaveResult _dsiwareSaveResult;