| View previous topic :: View next topic |
| Author |
Message |
zealot0630
Joined: 12 Nov 2006 Posts: 1
|
Posted: Tue Nov 14, 2006 7:22 pm Post subject: How to regist a callback of control pad button event |
|
|
It seem that call sceCtrlReadBufferPositive is insufficient and waste a lot of battery.
It is better to regist a callback function like sceKernelRegisterExitCallback, and once pad button is pressed, kernel calls the function which registed before |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Tue Nov 14, 2006 8:27 pm Post subject: Re: How to regist a callback of control pad button event |
|
|
| zealot0630 wrote: | It seem that call sceCtrlReadBufferPositive is insufficient and waste a lot of battery.
It is better to regist a callback function like sceKernelRegisterExitCallback, and once pad button is pressed, kernel calls the function which registed before |
oh i see your point you would like to catch a new buttons state when there IS a change. I presume this would only happen at each vsync since pad is read at this pace and so a callback would be called only at a VSYNC pace but only if there is a real change.
I dunno if we can register and use those callbacks in user mode but there is something which sounds promising in pspsdk\ctrl\pspctrl_kernel.h :
| Code: |
#define sceCtrlSetButtonMasks sceCtrl_driver_7CA723DC
#define sceCtrlGetButtonMask sceCtrl_driver_5E77BC8A
#define sceCtrlRegisterButtonCallback sceCtrl_driver_5C56C779
|
Interesting, without your post, i would have never seen thoses functions.
thx for your post.
Last edited by hlide on Tue Nov 14, 2006 11:56 pm; edited 1 time in total |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Tue Nov 14, 2006 8:37 pm Post subject: |
|
|
| However i'm still unsure whether that callback system can handle analogic pad. |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Tue Nov 14, 2006 8:50 pm Post subject: |
|
|
a question for MrBrown or Tyranid :
| Code: |
/**
* Get button mask mode
*
* @mask - The bitmask to check
*
* @return 0 no setting, 1 set in button mask, 2 set in button set
*/
|
when you pass the "bitmask" as argument, does it mean a bitmask compatible with the enumerated values of PspCtrlButtons with the only difference that only one bit in bitmask should be set ? this isn't the bit number, is this ?
Are there any other sceCtrl_driver_XXXXX functions not dicovered ? so far as I can guess, we cannot handle analogic pad with this callback system. |
|
| Back to top |
|
 |
adrahil
Joined: 16 Mar 2006 Posts: 277
|
Posted: Wed Nov 15, 2006 7:29 am Post subject: |
|
|
1) mask is of form "BUTTON1 | BUTTON2 | BUTTON3 ...." with standard key names like in the .Buttons
2)everything has more or less been discovered, afaik. |
|
| Back to top |
|
 |
|