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 Change Button Function

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



Joined: 28 Mar 2009
Posts: 61

PostPosted: Tue Nov 03, 2009 4:58 am    Post subject: How To Change Button Function Reply with quote

Right, so what i want to know is how do i changed button input.

For example if i press select, i want it to press start, ive tried this so far but with no luck

Code:
int main_thread(SceSize args, void *argp)

   SceCtrlData pad;

   while(1) // loop is required so buttons get checked more than ONCE
   {
 
      sceCtrlReadBufferPositive(&pad, 1); // update the var inside the loop
      if(pad.Buttons & PSP_CTRL_CROSS)
      {
        PSP_CTRL_SELECT;
      }
       sceKernelDelayThread(100000);// don't use processor for around 1/10 of a second
   }
   return 0;
}


Obvs PSP_CTRL_SELECT; is wrong, i dont know how to do it.
Back to top
View user's profile Send private message Visit poster's website
Criptych



Joined: 12 Sep 2009
Posts: 79

PostPosted: Tue Nov 03, 2009 5:53 am    Post subject: Reply with quote

As far as the compiler cares, "PSP_CTRL_SELECT" is just a value; to do something with it you need to make that line into a statement. For instance:
Code:
if(pad.Buttons & PSP_CTRL_CROSS)
{
   pad.Buttons |= PSP_CTRL_SELECT;
}


Better yet, write the bits to another variable so you don't overwrite the values you got from the controller, since this would mess up if you then tried to remap the Select button to something else.
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Tue Nov 03, 2009 2:07 pm    Post subject: Reply with quote

Look at RemaPSP source. The apihook functions can be replaced with sctrlHENFindFunction and sctrlHENPatchSyscall.
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