This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uint32_t GetCurrentToc() | |
{ | |
uint32_t* entry_point = *reinterpret_cast<uint32_t**>(0x1001C); // ElfHeader->e_entry | |
return entry_point[1]; | |
} | |
template <typename R, typename... TArgs> | |
inline R GameCall(std::uint32_t addr, TArgs... args) | |
{ | |
volatile opd_s opd = { addr, GetCurrentToc() }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "DetourHook.hpp" | |
#define POWERPC_REGISTERINDEX_R0 0 | |
#define POWERPC_REGISTERINDEX_R1 1 | |
#define POWERPC_REGISTERINDEX_R2 2 | |
#define POWERPC_REGISTERINDEX_R3 3 | |
#define POWERPC_REGISTERINDEX_R4 4 | |
#define POWERPC_REGISTERINDEX_R5 5 | |
#define POWERPC_REGISTERINDEX_R6 6 | |
#define POWERPC_REGISTERINDEX_R7 7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Initial Commit by gopro2027 **/ | |
/** Revision #2 by gopro2027 **/ | |
/** | |
* Added "original" into function hook | |
* Fixed branch instruction | |
*/ | |
/** Revision #3 by TheRouLetteBoi **/ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://pastebin.com/yezsesij | |
static uint32_t GetFunctionBranch(uint32_t address) | |
{ | |
uint32_t dest, temp; | |
dest = *(uint32_t*)address; | |
temp = dest; | |
dest = temp & 0x03FFFFFC; | |
if (temp & 0x02000000) dest |= 0xFC000000; | |
dest = address + dest; |