resonance 1.0.1
Loading...
Searching...
No Matches
joypadps2.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
5#include "game/padrecord.h"
6
15class JoypadPS2 {
16public:
18 static constexpr int kSlotCount = 8;
19
27 explicit JoypadPS2(int nIndex);
28
36
51 int Poll(unsigned int *pButtons,
52 unsigned char *pAxis0,
53 unsigned char *pAxis1,
54 unsigned char *pAxis2,
55 unsigned char *pAxis3);
56
66 void Reset();
67
79 void Open(int nPort, int nSlot, int nDeadZone);
80
90
101 void SetVibration(int nSmallMotor, int nBigMotor);
102
113
114#ifdef VIDEO_STANDARD_PAL
122 static void EndLibrary();
123#endif
124
125private:
126 int mIndex; // +0x00
127
128public:
136 int mId;
137
138private:
139 // One bit per slot, set while a handle holds the slot. The unit's static initialiser (at
140 // `0x004ec7d0`) builds it at 0x00704b40 with every bit clear.
141 static std::vector<bool> sSlotsInUse;
142
143 // One record per slot, at 0x00704bc0.
144 static PadRecord sRecords[kSlotCount];
145};
void Reset()
Restart the slot's setup state machine.
int IsConnected()
Report whether a pad is present.
int mId
Position of the handle among the InputPoller's JoypadPS2 objects, from 0.
Definition joypadps2.h:136
~JoypadPS2()
Release the slot.
void SetVibration(int nSmallMotor, int nBigMotor)
Drive the slot's motors through BreugPadSetMotors().
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.
JoypadPS2(int nIndex)
Claim slot nIndex.
void Open(int nPort, int nSlot, int nDeadZone)
Open the slot's pad through BreugPadInit().
static constexpr int kSlotCount
Pad slots, two ports of four multitap slots each.
Definition joypadps2.h:18
void DeInitPadData()
Close the slot's pad through scePadPortClose().
One controller's pad-library state: the DMA area libpad fills and the decoder's working state.
Definition padrecord.h:18