diff --git a/kernel.py b/kernel.py index e65e570..c857484 100644 --- a/kernel.py +++ b/kernel.py @@ -53,7 +53,7 @@ class GCT: codelist = b'' codetype = b'temp' skipcodes = 0 - + while codetype: codetype = self.codeList.read(4) info = self.codeList.read(4) @@ -268,11 +268,11 @@ class CodeHandler: self._rawData.seek(0) sample = self._rawData.read(4) - if sample == b'\x00\xDE\xDE\xDE': + if sample == b'\x60\x00\x00\x00': return self._rawData.tell() - 4 while sample: - if sample == b'\x00\xDE\xDE\xDE': + if sample == b'\x60\x00\x00\x00': return self._rawData.tell() - 4 sample = self._rawData.read(4) diff --git a/loader.cpp b/loader.cpp index 9ed31ec..fed6cd0 100644 --- a/loader.cpp +++ b/loader.cpp @@ -198,6 +198,21 @@ namespace Memory { } } + static void storeAddr(void* addr) + { + dcbst(addr); + icbi(addr); + } + + static void storeRange(u8* addr, s32 size) + { + size += 31 + (((u32)addr & 31) > 0); + + for (u32 i = 0; i < (size >> 5); ++i) { + storeAddr((void*)(addr + (i << 5))); + } + } + } namespace Direct { @@ -330,7 +345,7 @@ static void initMods() } /*Get codehandler hook resources*/ - auto fillInField = Memory::Search::single((u32*)sDisc.sMetaData.mOSArenaHi, (u32*)(sDisc.sMetaData.mOSArenaHi + 0x600), 0x00DEDEDE); + auto fillInField = Memory::Search::single((u32*)sDisc.sMetaData.mOSArenaHi, (u32*)(sDisc.sMetaData.mOSArenaHi + 0x600), 0x60000000); auto returnAddress = extractBranchAddr((u32*)gpModInfo.codehandlerHook); auto ppc = *gpModInfo.codehandlerHook;