The current position of the analog stick is available in the SceCtrlData struct. Look here for documentation:
http://psp.jim.sh/pspsdk-doc/structSceCtrlData.htmlI'd recommend making a deadzone in the centre of that range though. Since 128 is centred, I usually take the area from 100 to 156 as homed, just so you don't get unintended drift. The amount of dead zone required varys from PSP to PSP so if you want to go above and beyond, you can always make it a config setting.
- Code: Select all
int dx=pad.Lx,dy=pad.Ly;
dx-=100;
if(dx>0 && dx<56) dx=0; else if(dx>0) dx-=56;
dy-=100;
if(dy>0 && dy<56) dy=0; else if(dy>0) dy-=56;
int ax=dx; // from -100 to 100 with the dead zone range all set to 0.
int ay=dy; // from -100 to 100 with the dead zone range all set to 0.
Something like that is what I use.
You can use a GIF if you like. If you aren't using any special library like OSLib or SDL then you should look into libungif/libgif which works fine on the PSP (and is included with things like devkitPro and minpspw).