forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to regist a callback of control pad button event

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
zealot0630



Joined: 12 Nov 2006
Posts: 1

PostPosted: Tue Nov 14, 2006 7:22 pm    Post subject: How to regist a callback of control pad button event Reply with quote

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
View user's profile Send private message
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Tue Nov 14, 2006 8:27 pm    Post subject: Re: How to regist a callback of control pad button event Reply with quote

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
View user's profile Send private message
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Tue Nov 14, 2006 8:37 pm    Post subject: Reply with quote

However i'm still unsure whether that callback system can handle analogic pad.
Back to top
View user's profile Send private message
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Tue Nov 14, 2006 8:50 pm    Post subject: Reply with quote

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
View user's profile Send private message
adrahil



Joined: 16 Mar 2006
Posts: 277

PostPosted: Wed Nov 15, 2006 7:29 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group