| View previous topic :: View next topic |
| Author |
Message |
Torch

Joined: 28 May 2008 Posts: 842
|
Posted: Tue Aug 04, 2009 11:10 pm Post subject: |
|
|
| You're not calling the previous startmodulehandler in your code. You haven't assigned the previous function pointer when setting startmodulehandler. |
|
| Back to top |
|
 |
hyeokje
Joined: 04 Aug 2009 Posts: 3
|
Posted: Wed Aug 05, 2009 2:40 am Post subject: |
|
|
| Torch wrote: | | You're not calling the previous startmodulehandler in your code. You haven't assigned the previous function pointer when setting startmodulehandler. |
Wow, you're very nice. Thank you very much Torch.
I got it ~!
| Code: | | previous = sctrlHENSetStartModuleHandler(OnModuleStart); |
|
|
| Back to top |
|
 |
zydeoN
Joined: 09 May 2009 Posts: 45
|
Posted: Sat Aug 08, 2009 10:27 am Post subject: |
|
|
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):
| Code: | 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;
} |
Btw, i found that method on MDL Sample Kernel. |
|
| Back to top |
|
 |
hyeokje
Joined: 04 Aug 2009 Posts: 3
|
Posted: Sat Aug 08, 2009 1:45 pm Post subject: |
|
|
| 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. |
I think your problem is Note button presses repeatedly not slow thread.
This is a interrupt hooking method so it's fast enough.
Use above my post. That's fully working. See paddata_old. |
|
| Back to top |
|
 |
Torch

Joined: 28 May 2008 Posts: 842
|
Posted: Sat Aug 08, 2009 1:57 pm Post subject: |
|
|
| 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. |
Why are you calling the original function twice???
AKAIK the correct method to hook the ctrl function is like this:
| Code: | 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);
} |
You're supposed to loop though the pad_data array for the value of count. Though generally the value used is only 1, but you should hook safely.
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. |
|
| Back to top |
|
 |
|