mirror of
https://github.com/LNH-team/pico-loader.git
synced 2026-06-02 09:16:49 +02:00
Preprocess cheats to get rid of hacks that try to modify the cheat engine, add support for C2 cheat opcode
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include "DSMode.h"
|
||||
#include "Arm7IoRegisterClearer.h"
|
||||
#include "PatchListFactory.h"
|
||||
#include "CheatPreprocessor.h"
|
||||
#include "NdsLoader.h"
|
||||
|
||||
#define AP_LIST_PATH "/_pico/aplist.bin"
|
||||
@@ -523,6 +524,7 @@ void NdsLoader::ApplyArm7Patches()
|
||||
{
|
||||
sendToArm9(IPC_COMMAND_ARM9_APPLY_ARM7_PATCHES);
|
||||
sendToArm9(_cheats ? _cheats->length : 0);
|
||||
PreprocessCheats();
|
||||
void* patchSpaceStart = (void*)receiveFromArm9();
|
||||
void* cheatsPtr = (void*)receiveFromArm9();
|
||||
if (cheatsPtr != nullptr && _cheats != nullptr)
|
||||
@@ -569,6 +571,20 @@ void NdsLoader::ApplyArm7Patches()
|
||||
}
|
||||
}
|
||||
|
||||
void NdsLoader::PreprocessCheats()
|
||||
{
|
||||
if (_cheats != nullptr)
|
||||
{
|
||||
CheatPreprocessor cheatPreprocessor;
|
||||
auto cheat = &_cheats->firstCheat;
|
||||
for (u32 i = 0; i < _cheats->numberOfCheats; i++)
|
||||
{
|
||||
cheatPreprocessor.PreprocessCheat(cheat);
|
||||
cheat = (pload_cheat_t*)((u8*)cheat + cheat->length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NdsLoader::SetupSharedMemory(u32 cardId, u32 agbMem, u32 resetParam, u32 romOffset, u32 bootType)
|
||||
{
|
||||
memcpy(TWL_SHARED_MEMORY->ntrSharedMem.cardRomHeader, &_romHeader, sizeof(nds_header_ntr_t) - 0x10);
|
||||
|
||||
Reference in New Issue
Block a user