Document and explicitly declare right analog stick input; display right analog stick in controller sample

This commit is contained in:
MotoLegacy
2025-05-10 11:55:02 -07:00
parent f2b1155689
commit 4cfccb0785
3 changed files with 37 additions and 5 deletions

View File

@@ -2373,7 +2373,7 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
PREDEFINED = __attribute__(x)=
PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS __attribute__(x)=
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The

View File

@@ -134,8 +134,27 @@ typedef struct SceCtrlData {
unsigned char Lx;
/** Y-axis value of the Analog Stick.*/
unsigned char Ly;
/** Reserved. */
#ifndef DOXYGEN_SHOULD_SKIP_THIS
union {
struct {
#endif // DOXYGEN_SHOULD_SKIP_THIS
/** X-axis value of the right Analog Stick, valid when using DualShock 3 on PSP GO,
* a PS VITA system, through hardware/software hacking, or system emulation. */
unsigned char Rx;
/** Y-axis value of the right Analog Stick, valid when using DualShock 3 on PSP GO,
* a PS VITA system, through hardware/software hacking, or system emulation. */
unsigned char Ry;
/** Reserved bytes unused by the firmware. */
unsigned char Reserved[4];
};
/**
* @private
* Reserved bytes. This is deprecated with the implementation of Rx and Ry and only here for backwards compatibility.
*/
unsigned char Rsrv[6];
#ifndef DOXYGEN_SHOULD_SKIP_THIS
};
#endif // DOXYGEN_SHOULD_SKIP_THIS
} SceCtrlData;
/**

View File

@@ -75,8 +75,21 @@ int main(void)
sceCtrlReadBufferPositive(&pad, 1);
pspDebugScreenPrintf("Analog X = %3d ", pad.Lx);
pspDebugScreenPrintf("Analog Y = %3d \n", pad.Ly);
// 10 May 2025
// ---
// Depending on the configuration of the device the
// sample is being ran on, it may support a second
// analog stick. Known instances of this are:
// 1. On a PSP GO system with a connected DualShock 3
// 2. On a PS VITA system
// 3. On the PPSSPP emulator if bound in configuration settings
// 4. Through hardware or software modification (see https://github.com/operation-ditto)
// Due to these instances we should also report the second
// stick to the screen.
pspDebugScreenPrintf("L Analog X = %3d \n", pad.Lx);
pspDebugScreenPrintf("L Analog Y = %3d \n", pad.Ly);
pspDebugScreenPrintf("R Analog X = %3d \n", pad.Rx);
pspDebugScreenPrintf("R Analog Y = %3d \n", pad.Ry);
if (pad.Buttons != 0){
if (pad.Buttons & PSP_CTRL_SQUARE){