PSPSDK 2026-01-13
Loading...
Searching...
No Matches
pspctrl.h
Go to the documentation of this file.
1/*
2 * PSP Software Development Kit - https://github.com/pspdev
3 * -----------------------------------------------------------------------
4 * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
5 *
6 * pspctrl.h - Prototypes for the sceCtrl library.
7 *
8 * Copyright (c) 2005 Marcus R. Brown <mrbrown@ocgnet.org>
9 * Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
10 * Copyright (c) 2005 John Kelley <ps2dev@kelley.ca>
11 *
12 */
13
14/* Note: Some of the structures, types, and definitions in this file were
15 extrapolated from symbolic debugging information found in the Japanese
16 version of Puzzle Bobble. */
17
18#ifndef __CTRL_H__
19#define __CTRL_H__
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
45 PSP_CTRL_SELECT = 0x000001,
47 PSP_CTRL_L3 = 0x000002,
49 PSP_CTRL_R3 = 0x000004,
51 PSP_CTRL_START = 0x000008,
53 PSP_CTRL_UP = 0x000010,
55 PSP_CTRL_RIGHT = 0x000020,
57 PSP_CTRL_DOWN = 0x000040,
59 PSP_CTRL_LEFT = 0x000080,
65 PSP_CTRL_L2 = 0x000100,
67 PSP_CTRL_R2 = 0x000200,
69 PSP_CTRL_L1 = 0x000400,
71 PSP_CTRL_R1 = 0x000800,
75 PSP_CTRL_CIRCLE = 0x002000,
77 PSP_CTRL_CROSS = 0x004000,
79 PSP_CTRL_SQUARE = 0x008000,
81 PSP_CTRL_HOME = 0x010000,
83 PSP_CTRL_HOLD = 0x020000,
85 PSP_CTRL_NOTE = 0x800000,
87 PSP_CTRL_SCREEN = 0x400000,
89 PSP_CTRL_VOLUP = 0x100000,
91 PSP_CTRL_VOLDOWN = 0x200000,
93 PSP_CTRL_WLAN_UP = 0x040000,
95 PSP_CTRL_REMOTE = 0x080000,
97 PSP_CTRL_DISC = 0x1000000,
99 PSP_CTRL_MS = 0x2000000,
100};
101
112{
113 /* Digital. */
115 /* Analog. */
117};
118
132typedef struct SceCtrlData {
134 unsigned int TimeStamp;
140 unsigned int Buttons;
142 unsigned char Lx;
144 unsigned char Ly;
145#ifndef DOXYGEN_SHOULD_SKIP_THIS
146 union {
147 struct {
148#endif // DOXYGEN_SHOULD_SKIP_THIS
151 unsigned char Rx;
154 unsigned char Ry;
156 unsigned char Reserved[4];
157 };
162 unsigned char Rsrv[6];
163#ifndef DOXYGEN_SHOULD_SKIP_THIS
164 };
165#endif // DOXYGEN_SHOULD_SKIP_THIS
167
202typedef struct SceCtrlLatch {
204 unsigned int uiMake;
206 unsigned int uiBreak;
208 unsigned int uiPress;
210 unsigned int uiRelease;
212
221
229int sceCtrlGetSamplingCycle(int *pcycle);
230
240
249
264int sceCtrlPeekBufferPositive(SceCtrlData *pad_data, int count);
265
266int sceCtrlPeekBufferNegative(SceCtrlData *pad_data, int count);
267
295int sceCtrlReadBufferPositive(SceCtrlData *pad_data, int count);
296
297int sceCtrlReadBufferNegative(SceCtrlData *pad_data, int count);
298
314
370
383int sceCtrlSetIdleCancelThreshold(int idlereset, int idleback);
384
393int sceCtrlGetIdleCancelThreshold(int *idlerest, int *idleback);
394
397#ifdef __cplusplus
398}
399#endif
400
401#endif
int sceCtrlPeekLatch(SceCtrlLatch *latch_data)
Read latest latch data from the controller service.
int sceCtrlSetIdleCancelThreshold(int idlereset, int idleback)
Set analog threshold relating to the idle timer.
int sceCtrlGetSamplingMode(int *pmode)
Get the current controller mode.
int sceCtrlPeekBufferNegative(SceCtrlData *pad_data, int count)
int sceCtrlSetSamplingCycle(int cycle)
Set the controller cycle setting.
int sceCtrlReadLatch(SceCtrlLatch *latch_data)
Read new latch data from the controller service.
int sceCtrlGetSamplingCycle(int *pcycle)
Get the controller current cycle setting.
int sceCtrlGetIdleCancelThreshold(int *idlerest, int *idleback)
Get the idle threshold values.
struct SceCtrlLatch SceCtrlLatch
Controller latch data.
SceCtrlData
Definition pspctrl.h:166
PspCtrlMode
Controller mode.
Definition pspctrl.h:112
int sceCtrlReadBufferPositive(SceCtrlData *pad_data, int count)
Read new controller data from the controller service.
int sceCtrlPeekBufferPositive(SceCtrlData *pad_data, int count)
Read latest controller data from the controller service.
PspCtrlButtons
Enumeration representing digital controller button flags.
Definition pspctrl.h:43
int sceCtrlSetSamplingMode(int mode)
Set the controller mode.
int sceCtrlReadBufferNegative(SceCtrlData *pad_data, int count)
@ PSP_CTRL_MODE_DIGITAL
Definition pspctrl.h:114
@ PSP_CTRL_MODE_ANALOG
Definition pspctrl.h:116
@ PSP_CTRL_UP
Up D-Pad button.
Definition pspctrl.h:53
@ PSP_CTRL_RIGHT
Right D-Pad button.
Definition pspctrl.h:55
@ PSP_CTRL_SQUARE
Square button.
Definition pspctrl.h:79
@ PSP_CTRL_NOTE
Music Note button.
Definition pspctrl.h:85
@ PSP_CTRL_HOLD
Hold button.
Definition pspctrl.h:83
@ PSP_CTRL_CROSS
Cross button.
Definition pspctrl.h:77
@ PSP_CTRL_REMOTE
Remote hold position.
Definition pspctrl.h:95
@ PSP_CTRL_VOLUP
Volume up button.
Definition pspctrl.h:89
@ PSP_CTRL_RTRIGGER
Right trigger.
Definition pspctrl.h:63
@ PSP_CTRL_R1
R1 button.
Definition pspctrl.h:71
@ PSP_CTRL_START
Start button.
Definition pspctrl.h:51
@ PSP_CTRL_R2
R2 button.
Definition pspctrl.h:67
@ PSP_CTRL_MS
Memory stick present.
Definition pspctrl.h:99
@ PSP_CTRL_LTRIGGER
Left trigger.
Definition pspctrl.h:61
@ PSP_CTRL_DOWN
Down D-Pad button.
Definition pspctrl.h:57
@ PSP_CTRL_L1
L1 button.
Definition pspctrl.h:69
@ PSP_CTRL_L3
L3 button.
Definition pspctrl.h:47
@ PSP_CTRL_CIRCLE
Circle button.
Definition pspctrl.h:75
@ PSP_CTRL_DISC
Disc present.
Definition pspctrl.h:97
@ PSP_CTRL_LEFT
Left D-Pad button.
Definition pspctrl.h:59
@ PSP_CTRL_SCREEN
Screen button.
Definition pspctrl.h:87
@ PSP_CTRL_TRIANGLE
Triangle button.
Definition pspctrl.h:73
@ PSP_CTRL_L2
L2 button.
Definition pspctrl.h:65
@ PSP_CTRL_SELECT
Select button.
Definition pspctrl.h:45
@ PSP_CTRL_R3
R3 button.
Definition pspctrl.h:49
@ PSP_CTRL_VOLDOWN
Volume down button.
Definition pspctrl.h:91
@ PSP_CTRL_WLAN_UP
Wlan switch up.
Definition pspctrl.h:93
@ PSP_CTRL_HOME
Home button.
Definition pspctrl.h:81
Controller data.
Definition pspctrl.h:132
unsigned char Lx
X-axis value of the Analog Stick.
Definition pspctrl.h:142
unsigned char Ry
Y-axis value of the right Analog Stick, valid when using DualShock 3 on PSP GO, a PS VITA system,...
Definition pspctrl.h:154
unsigned int TimeStamp
Current read frame.
Definition pspctrl.h:134
unsigned int Buttons
Buttons in pressed state.
Definition pspctrl.h:140
unsigned char Ly
Y-axis value of the Analog Stick.
Definition pspctrl.h:144
unsigned char Reserved[4]
Reserved bytes unused by the firmware.
Definition pspctrl.h:156
Controller latch data.
Definition pspctrl.h:202
unsigned int uiRelease
Button is in the released state.
Definition pspctrl.h:210
unsigned int uiPress
Button is in the pressed state.
Definition pspctrl.h:208
unsigned int uiMake
Button transitioned to pressed state.
Definition pspctrl.h:204
unsigned int uiBreak
Button transitioned to released state.
Definition pspctrl.h:206