How To Change Button Function

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
PsPfReAK
Posts: 61
Joined: Sat Mar 28, 2009 9:02 am
Contact:

How To Change Button Function

Post by PsPfReAK »

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: Select all

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.
Criptych
Posts: 64
Joined: Sat Sep 12, 2009 5:18 am

Post by Criptych »

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: Select all

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.
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

Look at RemaPSP source. The apihook functions can be replaced with sctrlHENFindFunction and sctrlHENPatchSyscall.
Post Reply