|
Digimon World 3 decomp
The European version, SLES_039.36
|
Controllers and the demo recorder (pad/) More...
Go to the source code of this file.
Data Structures | |
| struct | PadData |
| What a pad sends (libpad's receive buffer) More... | |
| union | PadBuffer |
| A port's receive buffer, and a frame of a demo: a pad, or a multitap and the four pads behind it. More... | |
| struct | PadSlot |
| One controller: a port, or one of the four multitap slots behind it. More... | |
| struct | PadState |
| Controller input (PAD) More... | |
Macros | |
| #define | PAD_SELECT 0 |
| Logical buttons: bits of PadSlot.held/pressed/repeated, which readPadButtons builds from the raw pad data (circle, cross and triangle are rotated, and the left analog stick also sets the d-pad bits). | |
| #define | PAD_L3 1 |
| #define | PAD_R3 2 |
| #define | PAD_START 3 |
| #define | PAD_UP 4 |
| #define | PAD_RIGHT 5 |
| #define | PAD_DOWN 6 |
| #define | PAD_LEFT 7 |
| #define | PAD_L2 8 |
| #define | PAD_R2 9 |
| #define | PAD_L1 10 |
| #define | PAD_R1 11 |
| #define | PAD_CIRCLE 12 |
| #define | PAD_CROSS 13 |
| #define | PAD_TRIANGLE 14 |
| #define | PAD_SQUARE 15 |
| #define | PAD_ID_DIGITAL 4 |
| PadInfoMode(InfoModeCurExID) of a DualShock in digital and analog mode. | |
| #define | PAD_ID_ANALOG 7 |
| #define | PAD_MULTITAP_ID 0x80 |
| The second byte of the raw buffer when a multitap answers. | |
| #define | PAD_MODE_UNLOCKED 2 |
| PadSetMainMode's lock: the analog button may change the mode, or not. | |
| #define | PAD_MODE_LOCKED 3 |
| #define | RAW_TRIANGLE 12 |
| Raw bits of circle, cross and triangle, which readPadButtons rotates. | |
| #define | RAW_CIRCLE 13 |
| #define | RAW_CROSS 14 |
| #define | FACE_BUTTONS (1 << PAD_CIRCLE | 1 << PAD_CROSS | 1 << PAD_TRIANGLE) |
| #define | STICK_LOW 0x40 |
| A stick at or below LOW, or at or above HIGH, also presses the d-pad. | |
| #define | STICK_HIGH 0xC0 |
| #define | PAD_FLAG_DEMO_PLAYBACK 0x00400000 |
| PadState.flags: bits 0-7 hold the mode lock of each port/slot (lockPadMode), the rest are these. | |
| #define | PAD_FLAG_DEMO_RECORDING 0x00800000 |
| #define | PAD_FLAG_ALIGNING 0x04000000 |
| PadSetActAlign sent, not yet stable. | |
| #define | PAD_FLAG_VIBRATION 0x08000000 |
| the actuators are aligned | |
| #define | PAD_FLAG_STARTED 0x20000000 |
| PadStartCom done. | |
| #define | PAD_FLAG_INITIALIZED 0x40000000 |
| #define | PAD_FLAG_MULTITAP 0x80000000 |
| #define | PAD_DATA_SIZE 0x3E0 |
| The bytes PadState keeps before its methods, which initPad clears. | |
| #define | DEMO_FRAME_COUNT 0x707 |
| A demo replays recorded pad data (one raw buffer a frame, up to DEMO_FRAME_COUNT frames) instead of the pad, except for Start. | |
| #define | PAD_PRESSED(button) ((PAD.getPressed(0) >> PAD.getButtonBit(0, button)) & 1) |
| One button of pad 1: newly pressed, auto-repeated while held, or held. | |
| #define | PAD_REPEATED(button) ((PAD.getRepeated(0) >> PAD.getButtonBit(0, button)) & 1) |
| #define | PAD_HELD(button) ((PAD.getHeld(0) >> PAD.getButtonBit(0, button)) & 1) |
Functions | |
| void | readPadButtons (s32 port, PadData *data, PadData *record) |
| Builds held/pressed/repeated from the raw data (the demo record replaces all but Start) | |
| void | updateVibration (u16 port) |
| Counts down a pad's vibration timers and stops each motor whose time is up. | |
| void | resetButtonMap (u16 port) |
| Gives a pad slot the default button map, where button i is bit i. | |
| void | swapButtons (u16 port, s32 a, s32 b) |
| Swaps two logical buttons in a pad slot's button map. | |
| s32 | getButtonBit (s32 pad, s32 index) |
The bit that logical button index sets on pad 1 or 2. | |
| void | startPad (void) |
| Opens the pads with the defaults if needed, then starts reading them every vsync. | |
| s32 | pollPadState (u32 port) |
| The libpad state of a port while it can be read (0 otherwise); a stable pad gets its actuators aligned. | |
| void | stopPad (void) |
| Stops reading the pads every vsync. | |
| void | updatePad (void) |
| Reads every pad, or the demo data while a demo plays. | |
| void | initPad (s32 multitap, s32 repeatRate) |
| Opens the pads (PadInitMtap or PadInitDirect); repeatRate 0 means DEFAULT_REPEAT_RATE. | |
| void | shutdownPad (void) |
| Stops reading the pads and forgets every flag, so the next startPad opens them again. | |
| s32 | setVibration (u16 port, s32 motor, s16 time, u8 value) |
Starts a motor for time vsyncs (0 stops it) | |
| s32 | getPadPressed (s32 pad) |
| The logical buttons newly pressed on pad 1 or 2 this frame. | |
| s32 | getPadHeld (s32 pad) |
| The logical buttons held on pad 1 or 2. | |
| s32 | getPadRepeated (s32 pad) |
| The logical buttons pressed on pad 1 or 2, repeating while held. | |
| s32 | readPad (u16 port, PadData *data) |
| Reads one pad (vibration included), or clears its buttons when it is missing. | |
| s32 | startDemoRecording (void) |
| Demo recording was left out of the release: it never starts. | |
| void | stopDemoRecording (void) |
| Does nothing: demo recording was left out. | |
| s32 | isDemoRecording (s32 pad) |
1 while pad pad records a demo, -1 while another pad does, 0 otherwise (never set) | |
| s32 | alignActuators (u16 port) |
| Sends a DualShock its actuator alignment, so setVibration can drive the motors. | |
| s32 | startDemoPlayback (s16 pad, PadBuffer *data) |
Replays data (one raw buffer a frame) as the input of pad. | |
| void | stopDemoPlayback (void) |
| Gives the pads back to the players. | |
| s32 | isDemoPlaying (s32 pad) |
1 while pad pad replays a demo, -1 while another pad does, 0 otherwise | |
| s32 | lockPadMode (s32 port, s32 lock) |
| Locks or unlocks the analog button of a DualShock, keeping its current mode. | |
Variables | |
| u8 | DEFAULT_BUTTON_MAP [16] |
| The identity: logical button i is bit i. | |
| PadState | PAD |
| Controller input: cleared by initPad, then the methods. | |
Controllers and the demo recorder (pad/)
Definition in file pad.h.
| #define PAD_SELECT 0 |
Logical buttons: bits of PadSlot.held/pressed/repeated, which readPadButtons builds from the raw pad data (circle, cross and triangle are rotated, and the left analog stick also sets the d-pad bits).
A button map (getButtonBit) translates them again; by default it is the identity. The menus confirm with PAD_CROSS and cancel with PAD_TRIANGLE.
| #define PAD_ID_DIGITAL 4 |
| #define PAD_MULTITAP_ID 0x80 |
| #define PAD_MODE_UNLOCKED 2 |
| #define RAW_TRIANGLE 12 |
| #define FACE_BUTTONS (1 << PAD_CIRCLE | 1 << PAD_CROSS | 1 << PAD_TRIANGLE) |
| #define STICK_LOW 0x40 |
| #define PAD_FLAG_DEMO_PLAYBACK 0x00400000 |
PadState.flags: bits 0-7 hold the mode lock of each port/slot (lockPadMode), the rest are these.
| #define PAD_FLAG_ALIGNING 0x04000000 |
| #define PAD_FLAG_VIBRATION 0x08000000 |
| #define PAD_DATA_SIZE 0x3E0 |
| #define DEMO_FRAME_COUNT 0x707 |
| #define PAD_PRESSED | ( | button | ) | ((PAD.getPressed(0) >> PAD.getButtonBit(0, button)) & 1) |
| #define PAD_REPEATED | ( | button | ) | ((PAD.getRepeated(0) >> PAD.getButtonBit(0, button)) & 1) |
| #define PAD_HELD | ( | button | ) | ((PAD.getHeld(0) >> PAD.getButtonBit(0, button)) & 1) |
Builds held/pressed/repeated from the raw data (the demo record replaces all but Start)
Definition at line 40 of file port.c.
Referenced by readPad(), and updatePad().
| void updateVibration | ( | u16 | port | ) |
| void resetButtonMap | ( | u16 | port | ) |
| void startPad | ( | void | ) |
The libpad state of a port while it can be read (0 otherwise); a stable pad gets its actuators aligned.
< PadSetActAlign sent, not yet stable
< the actuators are aligned
< the actuators are aligned
< PadSetActAlign sent, not yet stable
< the actuators are aligned
< PadSetActAlign sent, not yet stable
Definition at line 8 of file port.c.
Referenced by lockPadMode(), readPad(), and setVibration().
| void stopPad | ( | void | ) |
Stops reading the pads every vsync.
< PadStartCom done
< PadStartCom done
Definition at line 54 of file pad.c.
Referenced by shutdownPad().
| void updatePad | ( | void | ) |
Opens the pads (PadInitMtap or PadInitDirect); repeatRate 0 means DEFAULT_REPEAT_RATE.
Definition at line 8 of file pad.c.
Referenced by startPad().
| void shutdownPad | ( | void | ) |
Starts a motor for time vsyncs (0 stops it)
< the actuators are aligned
Definition at line 98 of file pad.c.
Referenced by startDemoPlayback().
Reads one pad (vibration included), or clears its buttons when it is missing.
Definition at line 144 of file port.c.
Referenced by updatePad().
| s32 startDemoRecording | ( | void | ) |
| void stopDemoRecording | ( | void | ) |
Does nothing: demo recording was left out.
Definition at line 10 of file demo.c.
Referenced by updatePad().
1 while pad pad records a demo, -1 while another pad does, 0 otherwise (never set)
Definition at line 14 of file demo.c.
Referenced by updatePad().
Sends a DualShock its actuator alignment, so setVibration can drive the motors.
Definition at line 187 of file port.c.
Referenced by pollPadState().
| void stopDemoPlayback | ( | void | ) |
|
extern |
The identity: logical button i is bit i.
Definition at line 178 of file pad.c.
Referenced by resetButtonMap().
|
extern |
Controller input: cleared by initPad, then the methods.
Definition at line 168 of file pad.c.
Referenced by alignActuators(), answerQuitQuestion(), browseOpponentRow(), browseOwnRow(), browsePlayedRow(), CARDGAME_browseHand(), CARDGAME_drawFirstPlayer(), CARDGAME_readChooseInput(), CARDGAME_readCountInput(), CARDGAME_readPickInput(), editBattleDebug(), editProgress(), FIELDSTG_controlClimb(), FIELDSTG_controlFlight(), FIELDSTG_controlPlayer(), FIELDSTG_runGauge(), FIELDSTG_updateTriggers(), FIGHTSTG_stepConfusedMessage(), FIGHTSTG_stepMessage(), FIGHTSTG_updateCommandMenu(), FIGHTSTG_updateConfusedMenu(), FIGHTSTG_updateCursor(), FIGHTSTG_updateDigivolveMenu(), FIGHTSTG_updateItemMenu(), FIGHTSTG_updateSwitchInMenu(), FIGHTSTG_updateSwitchMenu(), FIGHTSTG_updateTechMenu(), getButtonBit(), getPadHeld(), getPadPressed(), getPadRepeated(), initPad(), isDemoPlaying(), isDemoRecording(), lockPadMode(), main(), moveDeckMarker(), moveMenuCursor(), openFieldMenu(), pickEffect(), pickInOpponentRow(), pickInOwnRow(), pollPadState(), readPad(), readPadButtons(), resetButtonMap(), runCameraList(), runFighterList(), runMotionList(), runPlayPage(), runStageList(), setVibration(), SHOCKTST_playPattern(), SHOCKTST_updateEditor(), shutdownPad(), SOUNDTST_playSounds(), SOUNDTST_selectBank(), SOUNDTST_updateScene(), STAGSLCT_updateStageSelect(), STAGSLCT_zoomTitle(), startDemoPlayback(), startPad(), STDWTITL_tickMoviePlayer(), stopDemoPlayback(), stopPad(), swapButtons(), updatePad(), updateTextWindow(), updateVibration(), WFIGHTTS_battleTest(), WFIGHTTS_cameraList(), WFIGHTTS_effectList(), WFIGHTTS_fighterList(), WFIGHTTS_motionList(), and WFIGHTTS_stageList().