resonance 1.0.1
Loading...
Searching...
No Matches
padrecord.h File Reference
#include <libpad.h>
Include dependency graph for padrecord.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  PadRecord
 One controller's pad-library state: the DMA area libpad fills and the decoder's working state. More...

Functions

void BreugPadInit (PadRecord *pPad, int nPort, int nSlot, int nDeadZone)
 Reset a record and open the pad at nPort and nSlot.
int BreugPadRead (PadRecord *pPad, unsigned int *pButtons, unsigned char *pAxis0, unsigned char *pAxis1, unsigned char *pAxis2, unsigned char *pAxis3, unsigned char *pPressures, short *pPressureDeltas)
 Advance a pad's setup state machine and decode the latest report.
void BreugPadSetMotors (PadRecord *pPad, int nSmallMotor, int nBigMotor)
 Drive a pad's two vibration motors.

Function Documentation

◆ BreugPadInit()

void BreugPadInit ( PadRecord * pPad,
int nPort,
int nSlot,
int nDeadZone )

Reset a record and open the pad at nPort and nSlot.

Clears the actuator levels and the pressure baseline, aligns actuator 0 to byte 0 and actuator 1 to byte 1 with the rest unused, starts libpad through scePadInit(0) the first time any record opens, and opens the port with mDmaArea.

Parameters
pPadThe record.
nPortThe port, from 0.
nSlotThe multitap slot, from 0.
nDeadZoneStored in mDeadZone.
Ghidra address:
NTSC-U/C: 0x005bcf58
Ghidra address:
PAL: 0x00585f40

◆ BreugPadRead()

int BreugPadRead ( PadRecord * pPad,
unsigned int * pButtons,
unsigned char * pAxis0,
unsigned char * pAxis1,
unsigned char * pAxis2,
unsigned char * pAxis3,
unsigned char * pPressures,
short * pPressureDeltas )

Advance a pad's setup state machine and decode the latest report.

mPhase indexes a 78-entry jump table at 0x00834430 that walks the pad through analog mode, actuator alignment, and pressure-sensitive mode, and mReadyLevel records how far it has got. Each non-null output receives one value of the decoded report, the analog values centred on zero and zeroed inside the mDeadZone dead zone. A pad that is not stable reports only mButtons and zero axes.

Parameters
pPadThe record.
pButtonsReceives the button word at mButtons, 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.
pPressuresReceives the pressure bytes, or null.
pPressureDeltasReceives each pressure less its baseline, or null.
Returns
mReadyLevel, from 0 (no report) to 3 (pressure-sensitive), or 0 when the pad is not stable or the read fails.
Ghidra address:
NTSC-U/C: 0x005bc998
Ghidra address:
PAL: 0x00585960

◆ BreugPadSetMotors()

void BreugPadSetMotors ( PadRecord * pPad,
int nSmallMotor,
int nBigMotor )

Drive a pad's two vibration motors.

Does nothing until mReadyLevel arrives at 2. Otherwise the small motor runs whenever nSmallMotor is positive, and the big motor takes nBigMotor as its level.

Parameters
pPadThe record.
nSmallMotorPositive to run the small motor.
nBigMotorThe big motor's level.
Ghidra address:
NTSC-U/C: 0x005bd0b0
Ghidra address:
PAL: 0x00586098