disable buttons in XMB menu
Wow, you're very nice. Thank you very much Torch.Torch wrote:You're not calling the previous startmodulehandler in your code. You haven't assigned the previous function pointer when setting startmodulehandler.
I got it ~!
Code: Select all
previous = sctrlHENSetStartModuleHandler(OnModuleStart);
Can you use the oldButtons (or paddata_old) method to avoid the psp executing the thread faster ? I can use it, but in this case of hooking it isnt working. I tried to use this (but it crashes and shutdown):
Btw, i found that method on MDL Sample Kernel.
Code: Select all
int vshReadButtons(SceCtrlData *pad_data, int count)
{
int ret, intc;
ret = vshCtrlReadBufferPositive(pad_data, count);
if(ret <= 0)
{
return ret;
}
intc = pspSdkDisableInterrupts();
if( pad_data[0].Buttons & PSP_CTRL_NOTE )
{
//my menu on/off
if(a == 0) a = 1;
else a = 0;
}
while (pad_data[0].Buttons & PSP_CTRL_NOTE) vshCtrlReadBufferPositive(pad_data, count);
//if my menu on block buttons
if(a == 1) pad_data[0].Buttons = 0;
pspSdkEnableInterrupts(intc);
return ret;
}
I think your problem is Note button presses repeatedly not slow thread.zydeoN wrote:Can you use the oldButtons (or paddata_old) method to avoid the psp executing the thread faster ? I can use it, but in this case of hooking it isnt working. I tried to use this (but it crashes and shutdown):
Btw, i found that method on MDL Sample Kernel.
This is a interrupt hooking method so it's fast enough.
Use above my post. That's fully working. See paddata_old.
Why are you calling the original function twice???zydeoN wrote:Can you use the oldButtons (or paddata_old) method to avoid the psp executing the thread faster ? I can use it, but in this case of hooking it isnt working. I tried to use this (but it crashes and shutdown):
Btw, i found that method on MDL Sample Kernel.
AKAIK the correct method to hook the ctrl function is like this:
Code: Select all
int vshCtrlReadBufferPositive_Patched(SceCtrlData *pad_data, int count)
{
int ret,i,intc;
ret = vshCtrlReadBufferPositive(pad_data, count);
if(ret <= 0)
{
return ret;
}
intc = pspSdkDisableInterrupts();
for(i = 0; i < count; i++)
{
if (pad_data[i].Buttons & PSP_CTRL_UP)
{
pad_data[i].Buttons = pad_data[i].Buttons ^ PSP_CTRL_UP; //modify your buttons here
}
}
pspSdkEnableInterrupts(intc);
return(ret);
}
For getting old buttons declare a static variable pad_dataold and store the current pad_data in it. Then in the next function call you can compare with the old buttons to see whats changed.