While patching syscall to vshCtrlReadBufferPositive, the M33 VSHMenu doesn't work anymore, obviously.
I see this function in vshctrl.h
int vctrlVSHRegisterVshMenu(int (* ctrl)(SceCtrlData *, int));
Is this useful to have menu working while calling your own patched function or what? I don't understand how to use it.
I just need to modify the original pad_data.
vshctrl (vshmenu) + hooking vshCtrlReadBufferPositive
That function is to register a VSH menu, it is not useful for anything else.
Basically satelite.prx (vshmenu) needs to register itself using that function.
Your patch destroys M33 one
Well, you could still do something, patch sceCtrlReadBufferPostive function directly by getting his address using sctrlHENFindFunction, and patching two first instructions to cause a jump+nop to your function. Once in your function, you would have to restore original two insturctions to call it, and then patch it again.
Since that aproach is very innefeicient, the best is to have a third function written in asm that has as two first instructions the same two first instructions as sceCtrlReadBufferPositive, and as third/four instructionsa jump to sceCtrlReadBufferPositive+8. In this way you would call that third function each time you want to call original sceCtrlReadBufferPositive.
Basically satelite.prx (vshmenu) needs to register itself using that function.
Your patch destroys M33 one
Code: Select all
SceModule2 *mod = sceKernelFindModuleByName("sceVshBridge_Driver");
if (!config.novshmenu)
{
MAKE_CALL(mod->text_addr+0x264, sceCtrlReadBufferPositivePatched);
PatchSyscall(FindProc("sceController_Service", "sceCtrl", 0x1F803938), sceCtrlReadBufferPositivePatched);
}
Since that aproach is very innefeicient, the best is to have a third function written in asm that has as two first instructions the same two first instructions as sceCtrlReadBufferPositive, and as third/four instructionsa jump to sceCtrlReadBufferPositive+8. In this way you would call that third function each time you want to call original sceCtrlReadBufferPositive.
Since the M33 one hooks sceCtrl function, I just changed my module to call original vshCtrl function from my patched function to get the original pad_data instead of calling original sceCtrl one, now VSHMenu is working.moonlight wrote: Your patch destroys M33 one
Code: Select all
SceModule2 *mod = sceKernelFindModuleByName("sceVshBridge_Driver"); if (!config.novshmenu) { MAKE_CALL(mod->text_addr+0x264, sceCtrlReadBufferPositivePatched); PatchSyscall(FindProc("sceController_Service", "sceCtrl", 0x1F803938), sceCtrlReadBufferPositivePatched); }
How ever I'd like to know about the ASM patch. Do I just declare the function like this and call it or what?
Code: Select all
int sceCtrlReadBufferPositive_Loader(SceCtrlData *pad_data, int count)
{
asm("original 2 instructions here
jump to +8");
}
Code: Select all
void * addr = sctrlHENFindFunction(....)
addr[0] = 0xXX; (hex bytes here)
addr[1] = 0xXX;
addr[2] = 0xXX;
addr[3] = 0xXX;
....