mirror of
https://github.com/wiiu-env/FunctionPatcherModule.git
synced 2024-11-16 06:49:23 +01:00
Fix some jumps to original functions by placing the replaced intruction after setting CTR
This commit is contained in:
parent
597788ff96
commit
bf943a466a
@ -232,15 +232,15 @@ void PatchedFunctionData::generateJumpToOriginal() {
|
||||
|
||||
uint32_t jumpToAddress = this->realEffectiveFunctionAddress + 4;
|
||||
|
||||
this->jumpToOriginal[0] = this->replacedInstruction;
|
||||
|
||||
if (((uint32_t) jumpToAddress & 0x01FFFFFC) != (uint32_t) jumpToAddress) {
|
||||
// We need to do a long jump
|
||||
this->jumpToOriginal[1] = 0x3d600000 | ((jumpToAddress >> 16) & 0x0000FFFF); // lis r11 ,0x1234
|
||||
this->jumpToOriginal[2] = 0x616b0000 | (jumpToAddress & 0x0000ffff); // ori r11 ,r11 ,0x5678
|
||||
this->jumpToOriginal[3] = 0x7d6903a6; // mtspr CTR ,r11
|
||||
this->jumpToOriginal[4] = 0x4e800420; // bctr
|
||||
this->jumpToOriginal[0] = 0x3d600000 | ((jumpToAddress >> 16) & 0x0000FFFF); // lis r11 ,0x1234
|
||||
this->jumpToOriginal[1] = 0x616b0000 | (jumpToAddress & 0x0000ffff); // ori r11 ,r11 ,0x5678
|
||||
this->jumpToOriginal[2] = 0x7d6903a6; // mtspr CTR ,r11
|
||||
this->jumpToOriginal[3] = this->replacedInstruction;
|
||||
this->jumpToOriginal[4] = 0x4e800420; // bctr
|
||||
} else {
|
||||
this->jumpToOriginal[0] = this->replacedInstruction;
|
||||
this->jumpToOriginal[1] = 0x48000002 | (jumpToAddress & 0x01FFFFFC);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user