Cpasjuste wrote:No i'm not sure, but since i can hook it from a kernel module does it mean it's a kernel function?
The hook is successfull, when the hooked function is called, the sound is off because i'm returning 0. The only problem is when i try to call the original function in my hooked function :/
if your hooked function has an address like 0x8XXXXXXX, it's a kernel function and probably points out on the real function or on the stub function "J real_function; NOP". If not, it may indeed point on the sycall stub (but i won't see why).
Now, what does sctrlHENPatchSyscall ?
- tries to find the syscall entry referencing the old function address and patches it so it can call the new function instead ? if so, trying the first sctrlHENPatchSyscall on sceAudioOutputPannedBlocking_orig cannot work.
- replaces the two first instructions of sceAudioOutputPannedBlocking with "SYSCALL ID; JR $RA" ? it makes no sense.
- replaces the two first instructions of sceAudioOutputPannedBlocking syscall stub with "J new_func; NOP" ? if so, you need a function address which has a syscall stub to patch it : patching sceAudioOutputPannedBlocking_orig cannot work.
maybe it's something else...
First, be sure sctrlHENFindFunction returns the real address of the function (kernel address). If so, just use sctrlHENPatchSyscall to patch its stub entry with sceAudioOutputPannedBlocking_patched. If you want sceAudioOutputPannedBlocking_orig to call the real function :
Code: Select all
typdef int (*sceAudioOutputPannedBlocking_orig_t)(int channel, int leftvol, int rightvol, void *buf);
static sceAudioOutputPannedBlocking_orig_t sceAudioOutputPannedBlocking_orig;
int sceAudioOutputPannedBlocking_patched(int channel, int leftvol, int rightvol, void *buf)
{
return sceAudioOutputPannedBlocking_orig(channel, leftvol, rightvol, buf);
}
...
sceAudioOutputPannedBlocking_orig = (sceAudioOutputPannedBlocking_orig_t)sctrlHENFindFunction("sceAudio_Driver", "sceAudio", 0x13F592BC);
sctrlHENPatchSyscall((u32)sceAudioOutputPannedBlocking_orig, sceAudioOutputPannedBlocking_patched);
if sctrlHENFindFunction returns a stub entry like "J real_func; NOP", you need to extract real_func this way :
Code: Select all
typdef int (*sceAudioOutputPannedBlocking_orig_t)(int channel, int leftvol, int rightvol, void *buf);
static sceAudioOutputPannedBlocking_orig_t sceAudioOutputPannedBlocking_orig;
int sceAudioOutputPannedBlocking_patched(int channel, int leftvol, int rightvol, void *buf)
{
return sceAudioOutputPannedBlocking_orig(channel, leftvol, rightvol, buf);
}
...
int *stub = (int *)sctrlHENFindFunction("sceAudio_Driver", "sceAudio", 0x13F592BC);
sceAudioOutputPannedBlocking_orig = (sceAudioOutputPannedBlocking_orig *)(0x80000000|((*stub << 2) & 0x0FFFFFFF));
sctrlHENPatchSyscall((u32)stub, sceAudioOutputPannedBlocking_patched);
well, I guess you need to be creative :)