Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
pad.c File Reference
#include "engine/game.h"
#include <libpad.h>
Include dependency graph for pad.c:

Go to the source code of this file.

Macros

#define DEFAULT_REPEAT_RATE   0x10
 The vsyncs a held button takes to repeat, unless initPad is told otherwise.
 

Functions

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.
 
void startPad (void)
 Opens the pads with the defaults if needed, then starts reading them every vsync.
 
void stopPad (void)
 Stops reading the pads every vsync.
 
void updatePad (void)
 Reads every pad, or the demo data while a demo plays.
 
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.
 
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.
 

Variables

PadState PAD
 Controller input: cleared by initPad, then the methods.
 
u8 DEFAULT_BUTTON_MAP [16]
 The identity: logical button i is bit i.
 

Macro Definition Documentation

◆ DEFAULT_REPEAT_RATE

#define DEFAULT_REPEAT_RATE   0x10

The vsyncs a held button takes to repeat, unless initPad is told otherwise.

Definition at line 5 of file pad.c.

Function Documentation

◆ initPad()

void initPad ( s32  multitap,
s32  repeatRate 
)

Opens the pads (PadInitMtap or PadInitDirect); repeatRate 0 means DEFAULT_REPEAT_RATE.

Definition at line 8 of file pad.c.

Referenced by startPad().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shutdownPad()

void shutdownPad ( void  )

Stops reading the pads and forgets every flag, so the next startPad opens them again.

Definition at line 37 of file pad.c.

Here is the call graph for this function:

◆ startPad()

void startPad ( void  )

Opens the pads with the defaults if needed, then starts reading them every vsync.

< PadStartCom done

< PadStartCom done

Definition at line 43 of file pad.c.

Referenced by initPad().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stopPad()

void stopPad ( void  )

Stops reading the pads every vsync.

< PadStartCom done

< PadStartCom done

Definition at line 54 of file pad.c.

Referenced by shutdownPad().

Here is the caller graph for this function:

◆ updatePad()

void updatePad ( void  )

Reads every pad, or the demo data while a demo plays.

Definition at line 62 of file pad.c.

Here is the call graph for this function:

◆ setVibration()

s32 setVibration ( u16  port,
s32  motor,
s16  time,
u8  value 
)

Starts a motor for time vsyncs (0 stops it)

< the actuators are aligned

Definition at line 98 of file pad.c.

Referenced by startDemoPlayback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPadPressed()

s32 getPadPressed ( s32  pad)

The logical buttons newly pressed on pad 1 or 2 this frame.

Definition at line 131 of file pad.c.

◆ getPadHeld()

s32 getPadHeld ( s32  pad)

The logical buttons held on pad 1 or 2.

Definition at line 136 of file pad.c.

◆ getPadRepeated()

s32 getPadRepeated ( s32  pad)

The logical buttons pressed on pad 1 or 2, repeating while held.

Definition at line 141 of file pad.c.

◆ resetButtonMap()

void resetButtonMap ( u16  port)

Gives a pad slot the default button map, where button i is bit i.

Definition at line 146 of file pad.c.

Referenced by initPad().

Here is the caller graph for this function:

◆ swapButtons()

void swapButtons ( u16  port,
s32  a,
s32  b 
)

Swaps two logical buttons in a pad slot's button map.

Definition at line 155 of file pad.c.

◆ getButtonBit()

s32 getButtonBit ( s32  pad,
s32  index 
)

The bit that logical button index sets on pad 1 or 2.

Definition at line 163 of file pad.c.

Variable Documentation

◆ PAD

PadState PAD
Initial value:
= {
0, { { { 0 } } }, { { { 0 } } }, { { 0 } }, 0, 0, ((void *)0) , 0,
}
s32 startDemoRecording(void)
Demo recording was left out of the release: it never starts.
Definition demo.c:5
s32 isDemoRecording(s32 pad)
1 while pad pad records a demo, -1 while another pad does, 0 otherwise (never set)
Definition demo.c:14
void stopDemoRecording(void)
Does nothing: demo recording was left out.
Definition demo.c:10
void stopDemoPlayback(void)
Gives the pads back to the players.
Definition demo.c:40
s32 isDemoPlaying(s32 pad)
1 while pad pad replays a demo, -1 while another pad does, 0 otherwise
Definition demo.c:50
s32 startDemoPlayback(s16 pad, PadBuffer *data)
Replays data (one raw buffer a frame) as the input of pad.
Definition demo.c:25
s32 getButtonBit(s32 pad, s32 index)
The bit that logical button index sets on pad 1 or 2.
Definition pad.c:163
s32 setVibration(u16 port, s32 motor, s16 time, u8 value)
Starts a motor for time vsyncs (0 stops it)
Definition pad.c:98
void updatePad(void)
Reads every pad, or the demo data while a demo plays.
Definition pad.c:62
void shutdownPad(void)
Stops reading the pads and forgets every flag, so the next startPad opens them again.
Definition pad.c:37
s32 getPadHeld(s32 pad)
The logical buttons held on pad 1 or 2.
Definition pad.c:136
void initPad(s32 multitap, s32 repeatRate)
Opens the pads (PadInitMtap or PadInitDirect); repeatRate 0 means DEFAULT_REPEAT_RATE.
Definition pad.c:8
s32 getPadPressed(s32 pad)
The logical buttons newly pressed on pad 1 or 2 this frame.
Definition pad.c:131
s32 getPadRepeated(s32 pad)
The logical buttons pressed on pad 1 or 2, repeating while held.
Definition pad.c:141
void swapButtons(u16 port, s32 a, s32 b)
Swaps two logical buttons in a pad slot's button map.
Definition pad.c:155
void resetButtonMap(u16 port)
Gives a pad slot the default button map, where button i is bit i.
Definition pad.c:146
s32 lockPadMode(s32 port, s32 lock)
Locks or unlocks the analog button of a DualShock, keeping its current mode.
Definition port.c:163

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().

◆ DEFAULT_BUTTON_MAP

u8 DEFAULT_BUTTON_MAP[16]
Initial value:
= {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
}

The identity: logical button i is bit i.

Definition at line 178 of file pad.c.

Referenced by resetButtonMap().