Skip to content

Commit e4831cf

Browse files
authored
Merge pull request #287 from MotoLegacy/cypress/right-stick-support
Document and explicitly declare right analog stick input; display right analog stick in controller sample
2 parents f2b1155 + 4cfccb0 commit e4831cf

File tree

3 files changed

+37
-5
lines changed

3 files changed

+37
-5
lines changed

Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2373,7 +2373,7 @@ INCLUDE_FILE_PATTERNS =
23732373
# recursively expanded use the := operator instead of the = operator.
23742374
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
23752375

2376-
PREDEFINED = __attribute__(x)=
2376+
PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS __attribute__(x)=
23772377

23782378
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
23792379
# tag can be used to specify a list of macro names that should be expanded. The

src/ctrl/pspctrl.h

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,27 @@ typedef struct SceCtrlData {
134134
unsigned char Lx;
135135
/** Y-axis value of the Analog Stick.*/
136136
unsigned char Ly;
137-
/** Reserved. */
138-
unsigned char Rsrv[6];
137+
#ifndef DOXYGEN_SHOULD_SKIP_THIS
138+
union {
139+
struct {
140+
#endif // DOXYGEN_SHOULD_SKIP_THIS
141+
/** X-axis value of the right Analog Stick, valid when using DualShock 3 on PSP GO,
142+
* a PS VITA system, through hardware/software hacking, or system emulation. */
143+
unsigned char Rx;
144+
/** Y-axis value of the right Analog Stick, valid when using DualShock 3 on PSP GO,
145+
* a PS VITA system, through hardware/software hacking, or system emulation. */
146+
unsigned char Ry;
147+
/** Reserved bytes unused by the firmware. */
148+
unsigned char Reserved[4];
149+
};
150+
/**
151+
* @private
152+
* Reserved bytes. This is deprecated with the implementation of Rx and Ry and only here for backwards compatibility.
153+
*/
154+
unsigned char Rsrv[6];
155+
#ifndef DOXYGEN_SHOULD_SKIP_THIS
156+
};
157+
#endif // DOXYGEN_SHOULD_SKIP_THIS
139158
} SceCtrlData;
140159

141160
/**

src/samples/controller/basic/main.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,21 @@ int main(void)
7575

7676
sceCtrlReadBufferPositive(&pad, 1);
7777

78-
pspDebugScreenPrintf("Analog X = %3d ", pad.Lx);
79-
pspDebugScreenPrintf("Analog Y = %3d \n", pad.Ly);
78+
// 10 May 2025
79+
// ---
80+
// Depending on the configuration of the device the
81+
// sample is being ran on, it may support a second
82+
// analog stick. Known instances of this are:
83+
// 1. On a PSP GO system with a connected DualShock 3
84+
// 2. On a PS VITA system
85+
// 3. On the PPSSPP emulator if bound in configuration settings
86+
// 4. Through hardware or software modification (see https://github.com/operation-ditto)
87+
// Due to these instances we should also report the second
88+
// stick to the screen.
89+
pspDebugScreenPrintf("L Analog X = %3d \n", pad.Lx);
90+
pspDebugScreenPrintf("L Analog Y = %3d \n", pad.Ly);
91+
pspDebugScreenPrintf("R Analog X = %3d \n", pad.Rx);
92+
pspDebugScreenPrintf("R Analog Y = %3d \n", pad.Ry);
8093

8194
if (pad.Buttons != 0){
8295
if (pad.Buttons & PSP_CTRL_SQUARE){

0 commit comments

Comments
 (0)