mirror of
https://github.com/Maschell/controller_patcher.git
synced 2024-11-22 12:09:16 +01:00
Fix the search for the sampling callback
This commit is contained in:
parent
ec2e5dd8e3
commit
03d827c436
@ -467,10 +467,15 @@ void ControllerPatcher::ResetConfig(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ControllerPatcher::Init(const char * pathToConfig) {
|
bool ControllerPatcher::Init(const char * pathToConfig) {
|
||||||
gSamplingCallback = (wpad_sampling_callback_t)((u32)KPADRead + 0x1F0);
|
OSDynLoad_Module handle;
|
||||||
|
void* kpad_ptr;
|
||||||
|
OSDynLoad_Acquire("padscore",&handle);
|
||||||
|
OSDynLoad_FindExport(handle, 0 ,"KPADRead",&kpad_ptr);
|
||||||
|
|
||||||
|
gSamplingCallback = (WPADSamplingCallback)((u32)kpad_ptr + 0x1F0);
|
||||||
if(*(u32*)gSamplingCallback != FIRST_INSTRUCTION_IN_SAMPLING_CALLBACK) {
|
if(*(u32*)gSamplingCallback != FIRST_INSTRUCTION_IN_SAMPLING_CALLBACK) {
|
||||||
//In Firmware <= 5.1.2 the offset changes
|
//In Firmware <= 5.1.2 the offset changes
|
||||||
gSamplingCallback = (wpad_sampling_callback_t)((u32)KPADRead + 0x1F8);
|
gSamplingCallback = (WPADSamplingCallback)((u32)kpad_ptr + 0x1F8);
|
||||||
if(*(u32*)gSamplingCallback != FIRST_INSTRUCTION_IN_SAMPLING_CALLBACK) {
|
if(*(u32*)gSamplingCallback != FIRST_INSTRUCTION_IN_SAMPLING_CALLBACK) {
|
||||||
//Should never happen. I looked into the padscore.rpl of ALL firmwares.
|
//Should never happen. I looked into the padscore.rpl of ALL firmwares.
|
||||||
gSamplingCallback = NULL;
|
gSamplingCallback = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user