PSPSDK 2024-12-16
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
40{
42 PSP_CTRL_SELECT = 0x000001,
44 PSP_CTRL_START = 0x000008,
46 PSP_CTRL_UP = 0x000010,
48 PSP_CTRL_RIGHT = 0x000020,
50 PSP_CTRL_DOWN = 0x000040,
52 PSP_CTRL_LEFT = 0x000080,
60 PSP_CTRL_CIRCLE = 0x002000,
62 PSP_CTRL_CROSS = 0x004000,
64 PSP_CTRL_SQUARE = 0x008000,
69 PSP_CTRL_HOME = 0x010000,
71 PSP_CTRL_HOLD = 0x020000,
73 PSP_CTRL_NOTE = 0x800000,
75 PSP_CTRL_SCREEN = 0x400000,
77 PSP_CTRL_VOLUP = 0x100000,
79 PSP_CTRL_VOLDOWN = 0x200000,
81 PSP_CTRL_WLAN_UP = 0x040000,
83 PSP_CTRL_REMOTE = 0x080000,
85 PSP_CTRL_DISC = 0x1000000,
87 PSP_CTRL_MS = 0x2000000,
88};
89
100{
101 /* Digital. */
103 /* Analog. */
105};
106
120typedef struct SceCtrlData {
122 unsigned int TimeStamp;
128 unsigned int Buttons;
130 unsigned char Lx;
132 unsigned char Ly;
134 unsigned char Rsrv[6];
136
171typedef struct SceCtrlLatch {
173 unsigned int uiMake;
175 unsigned int uiBreak;
177 unsigned int uiPress;
179 unsigned int uiRelease;
181
190
198int sceCtrlGetSamplingCycle(int *pcycle);
199
209
218
233int sceCtrlPeekBufferPositive(SceCtrlData *pad_data, int count);
234
235int sceCtrlPeekBufferNegative(SceCtrlData *pad_data, int count);
236
264int sceCtrlReadBufferPositive(SceCtrlData *pad_data, int count);
265
266int sceCtrlReadBufferNegative(SceCtrlData *pad_data, int count);
267
283
339
352int sceCtrlSetIdleCancelThreshold(int idlereset, int idleback);
353
362int sceCtrlGetIdleCancelThreshold(int *idlerest, int *idleback);
363
366#ifdef __cplusplus
367}
368#endif
369
370#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.
PspCtrlMode
Controller mode.
Definition pspctrl.h:100
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:40
int sceCtrlSetSamplingMode(int mode)
Set the controller mode.
int sceCtrlReadBufferNegative(SceCtrlData *pad_data, int count)
@ PSP_CTRL_MODE_DIGITAL
Definition pspctrl.h:102
@ PSP_CTRL_MODE_ANALOG
Definition pspctrl.h:104
@ PSP_CTRL_UP
Up D-Pad button.
Definition pspctrl.h:46
@ PSP_CTRL_RIGHT
Right D-Pad button.
Definition pspctrl.h:48
@ PSP_CTRL_SQUARE
Square button.
Definition pspctrl.h:64
@ PSP_CTRL_NOTE
Music note button - kernel mode only.
Definition pspctrl.h:73
@ PSP_CTRL_HOLD
Hold button.
Definition pspctrl.h:71
@ PSP_CTRL_CROSS
Cross button.
Definition pspctrl.h:62
@ PSP_CTRL_REMOTE
Remote hold position - kernel mode only.
Definition pspctrl.h:83
@ PSP_CTRL_VOLUP
Volume up button - kernel mode only.
Definition pspctrl.h:77
@ PSP_CTRL_RTRIGGER
Right trigger.
Definition pspctrl.h:56
@ PSP_CTRL_START
Start button.
Definition pspctrl.h:44
@ PSP_CTRL_MS
Memory stick present - kernel mode only.
Definition pspctrl.h:87
@ PSP_CTRL_LTRIGGER
Left trigger.
Definition pspctrl.h:54
@ PSP_CTRL_DOWN
Down D-Pad button.
Definition pspctrl.h:50
@ PSP_CTRL_CIRCLE
Circle button.
Definition pspctrl.h:60
@ PSP_CTRL_DISC
Disc present - kernel mode only.
Definition pspctrl.h:85
@ PSP_CTRL_LEFT
Left D-Pad button.
Definition pspctrl.h:52
@ PSP_CTRL_SCREEN
Screen button - kernel mode only.
Definition pspctrl.h:75
@ PSP_CTRL_TRIANGLE
Triangle button.
Definition pspctrl.h:58
@ PSP_CTRL_SELECT
Select button.
Definition pspctrl.h:42
@ PSP_CTRL_VOLDOWN
Volume down button - kernel mode only.
Definition pspctrl.h:79
@ PSP_CTRL_WLAN_UP
Wlan switch up - kernel mode only.
Definition pspctrl.h:81
@ PSP_CTRL_HOME
Kernel mode: Home button state.
Definition pspctrl.h:69
Controller data.
Definition pspctrl.h:120
unsigned char Lx
X-axis value of the Analog Stick.
Definition pspctrl.h:130
unsigned int TimeStamp
Current read frame.
Definition pspctrl.h:122
unsigned int Buttons
Buttons in pressed state.
Definition pspctrl.h:128
unsigned char Rsrv[6]
Reserved.
Definition pspctrl.h:134
unsigned char Ly
Y-axis value of the Analog Stick.
Definition pspctrl.h:132
Controller latch data.
Definition pspctrl.h:171
unsigned int uiRelease
Button is in the released state.
Definition pspctrl.h:179
unsigned int uiPress
Button is in the pressed state.
Definition pspctrl.h:177
unsigned int uiMake
Button transitioned to pressed state.
Definition pspctrl.h:173
unsigned int uiBreak
Button transitioned to released state.
Definition pspctrl.h:175