resonance 1.0.1
Loading...
Searching...
No Matches
JoypadPS2 Class Reference

Handle to one of the eight pad slots, two ports of four multitap slots each. More...

#include <joypadps2.h>

Public Member Functions

 JoypadPS2 (int nIndex)
 Claim slot nIndex.
 ~JoypadPS2 ()
 Release the slot.
int Poll (unsigned int *pButtons, unsigned char *pAxis0, unsigned char *pAxis1, unsigned char *pAxis2, unsigned char *pAxis3)
 Decode the slot's latest report through BreugPadRead(), without the pressure outputs.
void Reset ()
 Restart the slot's setup state machine.
void Open (int nPort, int nSlot, int nDeadZone)
 Open the slot's pad through BreugPadInit().
void DeInitPadData ()
 Close the slot's pad through scePadPortClose().
void SetVibration (int nSmallMotor, int nBigMotor)
 Drive the slot's motors through BreugPadSetMotors().
int IsConnected ()
 Report whether a pad is present.

Public Attributes

int mId
 Position of the handle among the InputPoller's JoypadPS2 objects, from 0.

Static Public Attributes

static constexpr int kSlotCount = 8
 Pad slots, two ports of four multitap slots each.

Detailed Description

Handle to one of the eight pad slots, two ports of four multitap slots each.

The class is not polymorphic, emits no RTTI, and has no embedded file path. The eight-byte object, the allocation InputPoller::Setup() makes, stores the slot index and the position mId. Constructing a handle marks its slot in sSlotsInUse and destroying it clears the mark. Every other member forwards to the PadRecord of the slot in sRecords.

Constructor & Destructor Documentation

◆ JoypadPS2()

JoypadPS2::JoypadPS2 ( int nIndex)
explicit

Claim slot nIndex.

Parameters
nIndexThe slot, from 0.
Ghidra address:
NTSC-U/C: 0x004ec2b8
Ghidra address:
PAL: 0x0052ae40

◆ ~JoypadPS2()

JoypadPS2::~JoypadPS2 ( )

Release the slot.

Ghidra address:
NTSC-U/C: 0x004ec458
Ghidra address:
PAL: 0x0052afe0

Member Function Documentation

◆ Poll()

int JoypadPS2::Poll ( unsigned int * pButtons,
unsigned char * pAxis0,
unsigned char * pAxis1,
unsigned char * pAxis2,
unsigned char * pAxis3 )

Decode the slot's latest report through BreugPadRead(), without the pressure outputs.

InputPoller::ReadControllers() is the caller.

Parameters
pButtonsReceives the button word, or null.
pAxis0Receives the first analog byte, or null.
pAxis1Receives the second analog byte, or null.
pAxis2Receives the third analog byte, or null.
pAxis3Receives the fourth analog byte, or null.
Returns
BreugPadRead()'s result.
Ghidra address:
NTSC-U/C: 0x004ecaf8
Ghidra address:
PAL: 0x0052b680

◆ Reset()

void JoypadPS2::Reset ( )

Restart the slot's setup state machine.

Clears PadRecord::mPhase and PadRecord::mReadyLevel. InputPoller::ResetJoypads() is the caller, expanded inline in InputPoller::FindJoypadConnections(). The title is inferred.

Ghidra address:
NTSC-U/C: 0x004ecb30
Ghidra address:
PAL: 0x0052b6d8

◆ Open()

void JoypadPS2::Open ( int nPort,
int nSlot,
int nDeadZone )

Open the slot's pad through BreugPadInit().

InputPoller::Setup() is the caller. The title is inferred.

Parameters
nPortThe port, from 0.
nSlotThe multitap slot, from 0.
nDeadZoneThe analog dead zone, passed through.
Ghidra address:
NTSC-U/C: 0x004ecb60
Ghidra address:
PAL: 0x0052b708

◆ DeInitPadData()

void JoypadPS2::DeInitPadData ( )

Close the slot's pad through scePadPortClose().

InputPoller::Shutdown() is the caller.

Ghidra address:
NTSC-U/C: 0x004ecb90
Ghidra address:
PAL: 0x0052b738

◆ SetVibration()

void JoypadPS2::SetVibration ( int nSmallMotor,
int nBigMotor )

Drive the slot's motors through BreugPadSetMotors().

InputPoller::SetVibration() is the caller. The title is inferred.

Parameters
nSmallMotorPositive to run the small motor.
nBigMotorThe big motor's level.
Ghidra address:
NTSC-U/C: 0x004ecbc8
Ghidra address:
PAL: 0x0052b770

◆ IsConnected()

int JoypadPS2::IsConnected ( )

Report whether a pad is present.

InputPoller::NumberConnectedJoypads() is the caller. The title is inferred.

Returns
1 unless scePadGetState() reports the slot disconnected or closed, else 0.
Ghidra address:
NTSC-U/C: 0x004ecbf8
Ghidra address:
PAL: 0x0052b7a0

Member Data Documentation

◆ kSlotCount

int JoypadPS2::kSlotCount = 8
staticconstexpr

Pad slots, two ports of four multitap slots each.

◆ mId

int JoypadPS2::mId

Position of the handle among the InputPoller's JoypadPS2 objects, from 0.

The constructor does not write it. InputPoller::Setup() assigns it after construction, and InputPoller::ReadControllers() indexes the player table with it. Both accesses are direct. +0x04


The documentation for this class was generated from the following file: