Skip to content

Commit

Permalink
- Change hook type to VBI.
Browse files Browse the repository at this point in the history
  • Loading branch information
Extrems committed Jan 30, 2024
1 parent f8ecbba commit 503186b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
3 changes: 1 addition & 2 deletions cube/patches/cheats/codehandler.s
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ _start:
ori r26,r20,0x2000 #enable floating point ?
andi. r26,r26,0xF9FF
mtmsr r26
isync

stfd f2,152(r1) # stores f2
stfd f3,160(r1) # stores f3
Expand Down Expand Up @@ -728,8 +729,6 @@ resumegame:

addi r1,r1,168

isync

blr # return back to game

#***************************************************************************
Expand Down
3 changes: 1 addition & 2 deletions cube/patches/cheats/codehandleronly.s
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ _start:
ori r26,r20,0x2000 #enable floating point ?
andi. r26,r26,0xF9FF
mtmsr r26
isync

stfd f2,152(r1) # stores f2
stfd f3,160(r1) # stores f3
Expand Down Expand Up @@ -103,8 +104,6 @@ resumegame:

addi r1,r1,168

isync

blr # return back to game

_readcodes:
Expand Down
15 changes: 10 additions & 5 deletions cube/swiss/source/patcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -8931,7 +8931,7 @@ void Patch_Video(u32 *data, u32 length, int dataType)

if (j < sizeof(__VIRetraceHandlerSigs) / sizeof(FuncPattern) && (i = __VIRetraceHandlerSigs[j].offsetFoundAt)) {
u32 *__VIRetraceHandler = Calc_ProperAddress(data, dataType, i * sizeof(u32));
u32 *__VIRetraceHandlerHook;
u32 *__VIRetraceHandlerHook = NULL;

if (__VIRetraceHandler && getCurrentFieldEvenOdd) {
switch (j) {
Expand Down Expand Up @@ -9074,6 +9074,12 @@ void Patch_Video(u32 *data, u32 length, int dataType)
}
data[i + __VIRetraceHandlerSigs[j].Length - 1] = branch(__VIRetraceHandlerHook, __VIRetraceHandler + __VIRetraceHandlerSigs[j].Length - 1);
}
if (swissSettings.wiirdEngine && !in_range(dataType, PATCH_APPLOADER, PATCH_EXEC)) {
if (__VIRetraceHandlerHook)
__VIRetraceHandlerHook[5] = branch(CHEATS_ENGINE_START, __VIRetraceHandlerHook + 5);
else
data[i + __VIRetraceHandlerSigs[j].Length - 1] = branch(CHEATS_ENGINE_START, __VIRetraceHandler + __VIRetraceHandlerSigs[j].Length - 1);
}
print_gecko("Found:[%s$%i] @ %08X\n", __VIRetraceHandlerSigs[j].Name, j, __VIRetraceHandler);
}
}
Expand Down Expand Up @@ -16687,6 +16693,9 @@ int Patch_ExecutableFile(void **buffer, u32 *sizeToRead, const char *gameID, int
Patch_GameSpecificVideo(buffer, sizeToRead, gameID, type);
Patch_Video(buffer, sizeToRead, type);
}
// Cheats
else if (swissSettings.wiirdEngine)
Patch_CheatsHook(buffer, sizeToRead, type);

// Force Widescreen
if (swissSettings.forceWidescreen)
Expand All @@ -16699,10 +16708,6 @@ int Patch_ExecutableFile(void **buffer, u32 *sizeToRead, const char *gameID, int
// Force Text Encoding
patched += Patch_FontEncode(buffer, sizeToRead);

// Cheats
if (swissSettings.wiirdEngine)
Patch_CheatsHook(buffer, sizeToRead, type);

return patched;
}

Expand Down

0 comments on commit 503186b

Please sign in to comment.