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
How to regist a callback of control pad button event
-
- Posts: 1
- Joined: Sun Nov 12, 2006 9:13 pm
Re: How to regist a callback of control pad button event
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.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
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: Select all
#define sceCtrlSetButtonMasks sceCtrl_driver_7CA723DC
#define sceCtrlGetButtonMask sceCtrl_driver_5E77BC8A
#define sceCtrlRegisterButtonCallback sceCtrl_driver_5C56C779
thx for your post.
Last edited by hlide on Tue Nov 14, 2006 11:56 pm, edited 1 time in total.
a question for MrBrown or Tyranid :
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.
Code: Select all
/**
* Get button mask mode
*
* @mask - The bitmask to check
*
* @return 0 no setting, 1 set in button mask, 2 set in button set
*/
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.