more information about pspctrl.h

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

Moderators: cheriff, TyRaNiD

Post Reply
phobox
Posts: 127
Joined: Mon Mar 24, 2008 6:22 pm

more information about pspctrl.h

Post by phobox »

ok.. I want to ask some questions about the pspctrl.h file.

1) what's the meaning of

Code: Select all

 int sceCtrlSetSamplingCycle(int cycle); 
? i mean when do i have to use it?

2)same question for

Code: Select all

int sceCtrlSetSamplingMode(int mode);
3) which is the difference between all of these functions?

Code: Select all

int sceCtrlPeekBufferPositive(SceCtrlData *pad_data, int count);

int sceCtrlPeekBufferNegative(SceCtrlData *pad_data, int count);

int sceCtrlReadBufferPositive(SceCtrlData *pad_data, int count);

int sceCtrlReadBufferNegative(SceCtrlData *pad_data, int count);
4)what does these do?

Code: Select all

int sceCtrlPeekLatch(SceCtrlLatch *latch_data);

int sceCtrlReadLatch(SceCtrlLatch *latch_data);
5)and this?

Code: Select all

int sceCtrlSetIdleCancelThreshold(int idlereset, int idleback);

ok, i've asked about all of the functions... but i haven't found anything about them

plaese answer also only one question, it is better than nothing...
Ciao! from Italy
Smong
Posts: 82
Joined: Tue Sep 04, 2007 4:44 am

Post by Smong »

I don't know about the other functions but I have a comment in my code telling me if I don't call sceCtrlSetSamplingCycle(0); the analog stick doesn't work.

I also have a comment saying this doesn't make any difference:
sceCtrlSetSamplingMode(PSP_CTRL_MODE_DIGITAL);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);

I haven't tested my findings thoroughly so I could be wrong. Also as a side note I noticed in homebrew if you put the PSP into "hold mode" the analog stick still generates input (it locks correctly in the XMB picture viewer).
(+[__]%)
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Re: more information about pspctrl.h

Post by hlide »

Code: Select all

int sceCtrlSetSamplingCycle(int cycle);
This function tells the controller how often (period in ms) the sampling is performed. Note that if cycle == 0, a VSYNC period is used.

Code: Select all

int sceCtrlSetSamplingMode(int mode);
This function tells the controller whether analog pad should be read as well.

Code: Select all

int sceCtrlPeekBufferPositive(SceCtrlData *pad_data, int count);
int sceCtrlPeekBufferNegative(SceCtrlData *pad_data, int count);
int sceCtrlReadBufferPositive(SceCtrlData *pad_data, int count);
int sceCtrlReadBufferNegative(SceCtrlData *pad_data, int count);
Peek : read up to 'count' data but don't eat them from buffer
Read : eat up to 'count' data from buffer
Positive : bit in data set to 1 means a button pressed
Negative : bit in data set to 0 means a button pressed

Code: Select all

int sceCtrlPeekLatch(SceCtrlLatch *latch_data);
int sceCtrlReadLatch(SceCtrlLatch *latch_data);
Peek/Read : see above
each bit in make/break/oress/release fields describes a button state :

Code: Select all

  x     x     x     1 -> permanent released state
  x     x     1     x -> permanent pressed state
  x     1     x     x -> previously just pressed
  1     x     x     x -> previously just released
so a 1010 -> previously released and now continually pressed
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

Thanks, didn't know that :)
If not actually, then potentially.
phobox
Posts: 127
Joined: Mon Mar 24, 2008 6:22 pm

Post by phobox »

thanks very much!
Ciao! from Italy
Post Reply