coastline 0.0.4
Loading...
Searching...
No Matches
input.h File Reference

The input of each player, the cheat codes, and the translation of controller data. More...

#include <PR/os_cont.h>
#include <PR/ultratypes.h>
#include "common/game.h"
#include "common/playerinput.h"
Include dependency graph for input.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  CheatCode
 A cheat: the sequence of button changes that applies it, newest first, ending in 0xFFFF. More...

Macros

#define INPUT_RIGHT   0x0001
#define INPUT_DOWN   0x0002
#define INPUT_LEFT   0x0004
#define INPUT_UP   0x0008
#define INPUT_A   0x0010
#define INPUT_B   0x0020
#define INPUT_C_UP   0x0100
#define INPUT_C_RIGHT   0x0200
#define INPUT_C_DOWN   0x0400
#define INPUT_C_LEFT   0x0800
#define INPUT_L   0x1000
#define INPUT_R   0x2000
#define INPUT_START   0x4000
#define INPUT_Z   0x8000
#define INPUT_ACCELERATE   0x00010000
#define INPUT_REVERSE   0x00020000
#define INPUT_BRAKE   0x00040000
#define INPUT_EBRAKE   0x00080000
#define INPUT_GEAR_UP   0x00100000
#define INPUT_GEAR_DOWN   0x00200000
#define INPUT_VIEW_COCKPIT   0x01000000
#define INPUT_VIEW_TRACKSIDE   0x02000000
#define INPUT_VIEW_CHASE   0x04000000
#define INPUT_VIEW_BUMPER   0x08000000
#define INPUT_VIEWS   0x0F000000
#define INPUT_RECORDED_ACTIONS   0x003F0000
 The actions a recording keeps, with the steering.
#define CONTROLLER_LAYOUTS   5
 The button layouts of the controller screen.

Functions

void CheatToggleRamView (void)
 Toggle the view of memory.
void CheatFinishRace (void)
 Request that the race finish.
void CheatUnlockTracks0To4 (void)
 Unlock the first five tracks.
void CheatUnlockCars0To8 (void)
 Unlock the first nine cars.
void CheatSetUnlockBit200 (void)
 Set bit 9 of the unlocks of the profile.
void CheatSetUnlockBit1000 (void)
 Set bit 12 of the unlocks of the profile.
void CheatSetUnlockBit800 (void)
 Set bit 11 of the unlocks of the profile.
void CheatSetUnlockBit400 (void)
 Set bit 10 of the unlocks of the profile.
void CheatUnlockTracks5To9 (void)
 Unlock tracks 5 to 9.
void CheatSetUnlockBit8000 (void)
 Set bit 15 of the unlocks of the profile.
void CheatToggleMultiplayerMode (void)
 Toggle the multiplayer mode selected by the cheat sequence.
void CheatToggleBilinearFilter (void)
 Toggle bilinear texture filtering selected by the cheat sequence.
void ProcessInputCommandBuffer (PlayerInputState *state)
 Remember a change of the buttons and apply each cheat whose sequence the latest changes match.
void TranslateControllerInput (PlayerInputState *state)
 Read the pad of a player into buttons, race actions for the button layout, and the stick, record the input or replay a recording in its place, and check the cheats.
void CheckAnalogStickPositive (PlayerInputState *state, s32 *timer, f32 *axis, u32 button)
 Press a direction when a stick axis passes 0.6, then again after half a second and every 0.2 seconds while the axis stays above 0.3.
void CheckAnalogStickNegative (PlayerInputState *state, s32 *timer, f32 *axis, u32 button)
 The same as CheckAnalogStickPositive() for the negative side of an axis.
void UpdateStickRepeat (PlayerInputState *state)
 Press the directions of the stick with repeat, as the menus read them.
void StartControllerRead (void)
 Start a read of the controllers, unless one is already pending.
void ReadControllers (void)
 Wait for a read of the controllers, starting one if none is pending, and fill the pads.
void UpdateControllerState (void)
 Read the controllers and turn their state into the input of the players.
void InitControllersAndPaks (void)
 Probe the controllers and the Controller and Rumble Paks, running the controller check until each warning is dismissed and the Controller Pak menu while the first player holds start.

Variables

CheatCode g_aCheatCodes []
 The cheats, ending with a NULL sequence.
s32 g_bShowDepthBuffer
 Whether each frame shows the depth buffer, at the start of memory, in place of the picture.
s32 g_dwMultiplayerMode
 Whether the credits race scrolls the credits rather than displaying captions.
s32 g_bBilinearFiltering
 Whether textures are filtered.
s32 g_dwCheatFinishRacePending
 Set by CheatFinishRace() to finish the race.
s32 g_dwContReadPending
 Whether a read of the controllers is started and not yet received.
u8 g_bPakPort0Initialized
 Whether InitControllersAndPaks() has mounted the Controller Pak of the first controller.

Detailed Description

The input of each player, the cheat codes, and the translation of controller data.

Macro Definition Documentation

◆ INPUT_RIGHT

#define INPUT_RIGHT   0x0001

The right of the directional pad or the stick.

◆ INPUT_DOWN

#define INPUT_DOWN   0x0002

The down of the directional pad or the stick.

◆ INPUT_LEFT

#define INPUT_LEFT   0x0004

The left of the directional pad or the stick.

◆ INPUT_UP

#define INPUT_UP   0x0008

The up of the directional pad or the stick.

◆ INPUT_A

#define INPUT_A   0x0010

The A button.

◆ INPUT_B

#define INPUT_B   0x0020

The B button.

◆ INPUT_C_UP

#define INPUT_C_UP   0x0100

The up C button.

◆ INPUT_C_RIGHT

#define INPUT_C_RIGHT   0x0200

The right C button.

◆ INPUT_C_DOWN

#define INPUT_C_DOWN   0x0400

The down C button.

◆ INPUT_C_LEFT

#define INPUT_C_LEFT   0x0800

The left C button.

◆ INPUT_L

#define INPUT_L   0x1000

The L trigger.

◆ INPUT_R

#define INPUT_R   0x2000

The R trigger.

◆ INPUT_START

#define INPUT_START   0x4000

The Start button.

◆ INPUT_Z

#define INPUT_Z   0x8000

The Z trigger.

◆ INPUT_ACCELERATE

#define INPUT_ACCELERATE   0x00010000

Accelerate.

◆ INPUT_REVERSE

#define INPUT_REVERSE   0x00020000

Drive in reverse.

◆ INPUT_BRAKE

#define INPUT_BRAKE   0x00040000

Brake.

◆ INPUT_EBRAKE

#define INPUT_EBRAKE   0x00080000

Pull the handbrake.

◆ INPUT_GEAR_UP

#define INPUT_GEAR_UP   0x00100000

Shift up a gear.

◆ INPUT_GEAR_DOWN

#define INPUT_GEAR_DOWN   0x00200000

Shift down a gear.

◆ INPUT_VIEW_COCKPIT

#define INPUT_VIEW_COCKPIT   0x01000000

Choose the view from the cockpit.

◆ INPUT_VIEW_TRACKSIDE

#define INPUT_VIEW_TRACKSIDE   0x02000000

Choose the trackside camera.

◆ INPUT_VIEW_CHASE

#define INPUT_VIEW_CHASE   0x04000000

Choose the chase camera.

◆ INPUT_VIEW_BUMPER

#define INPUT_VIEW_BUMPER   0x08000000

Choose the view from the bumper.

◆ INPUT_VIEWS

#define INPUT_VIEWS   0x0F000000

Every bit that chooses a view.

◆ INPUT_RECORDED_ACTIONS

#define INPUT_RECORDED_ACTIONS   0x003F0000

The actions a recording keeps, with the steering.

◆ CONTROLLER_LAYOUTS

#define CONTROLLER_LAYOUTS   5

The button layouts of the controller screen.

Function Documentation

◆ CheatToggleRamView()

void CheatToggleRamView ( void )

Toggle the view of memory.

Ghidra address:
USA: 0x80254f40
Ghidra address:
Asia: 0x80254A90
Ghidra address:
EUR: 0x802564e0
Ghidra address:
JPN: 0x80255e70

◆ CheatFinishRace()

void CheatFinishRace ( void )

Request that the race finish.

Ghidra address:
EUR: 0x802564f8
Ghidra address:
JPN: 0x80255e88

◆ CheatUnlockTracks0To4()

void CheatUnlockTracks0To4 ( void )

Unlock the first five tracks.

Ghidra address:
USA: 0x80254f58
Ghidra address:
Asia: 0x80254AA8
Ghidra address:
EUR: 0x80256528
Ghidra address:
JPN: 0x80255eb8

◆ CheatUnlockCars0To8()

void CheatUnlockCars0To8 ( void )

Unlock the first nine cars.

Ghidra address:
USA: 0x80254f70
Ghidra address:
Asia: 0x80254AC0
Ghidra address:
EUR: 0x80256540
Ghidra address:
JPN: 0x80255ed0

◆ CheatSetUnlockBit200()

void CheatSetUnlockBit200 ( void )

Set bit 9 of the unlocks of the profile.

Ghidra address:
USA: 0x80254f88
Ghidra address:
Asia: 0x80254AD8
Ghidra address:
EUR: 0x80256558
Ghidra address:
JPN: 0x80255ee8

◆ CheatSetUnlockBit1000()

void CheatSetUnlockBit1000 ( void )

Set bit 12 of the unlocks of the profile.

Ghidra address:
USA: 0x80254fa0
Ghidra address:
Asia: 0x80254AF0
Ghidra address:
EUR: 0x80256570
Ghidra address:
JPN: 0x80255f00

◆ CheatSetUnlockBit800()

void CheatSetUnlockBit800 ( void )

Set bit 11 of the unlocks of the profile.

Ghidra address:
USA: 0x80254fb8
Ghidra address:
Asia: 0x80254B08
Ghidra address:
EUR: 0x80256588
Ghidra address:
JPN: 0x80255f18

◆ CheatSetUnlockBit400()

void CheatSetUnlockBit400 ( void )

Set bit 10 of the unlocks of the profile.

Ghidra address:
USA: 0x80254fd0
Ghidra address:
Asia: 0x80254B20
Ghidra address:
EUR: 0x802565a0
Ghidra address:
JPN: 0x80255f30

◆ CheatUnlockTracks5To9()

void CheatUnlockTracks5To9 ( void )

Unlock tracks 5 to 9.

Ghidra address:
USA: 0x80254fe8
Ghidra address:
Asia: 0x80254B38
Ghidra address:
EUR: 0x802565b8
Ghidra address:
JPN: 0x80255f48

◆ CheatSetUnlockBit8000()

void CheatSetUnlockBit8000 ( void )

Set bit 15 of the unlocks of the profile.

Ghidra address:
USA: 0x80255000
Ghidra address:
Asia: 0x80254B50
Ghidra address:
EUR: 0x802565d0
Ghidra address:
JPN: 0x80255f60

◆ CheatToggleMultiplayerMode()

void CheatToggleMultiplayerMode ( void )

Toggle the multiplayer mode selected by the cheat sequence.

Ghidra address:
USA: 0x80255018
Ghidra address:
Asia: 0x80254B68
Ghidra address:
EUR: 0x802565e8
Ghidra address:
JPN: 0x80255f78

◆ CheatToggleBilinearFilter()

void CheatToggleBilinearFilter ( void )

Toggle bilinear texture filtering selected by the cheat sequence.

Ghidra address:
USA: 0x80255030
Ghidra address:
Asia: 0x80254B80
Ghidra address:
EUR: 0x80256600
Ghidra address:
JPN: 0x80255f90

◆ ProcessInputCommandBuffer()

void ProcessInputCommandBuffer ( PlayerInputState * state)

Remember a change of the buttons and apply each cheat whose sequence the latest changes match.

Parameters
stateThe input of the player.
Ghidra address:
USA: 0x80255048
Ghidra address:
Asia: 0x80254B98
Ghidra address:
EUR: 0x80256618
Ghidra address:
JPN: 0x80255fa8

◆ TranslateControllerInput()

void TranslateControllerInput ( PlayerInputState * state)

Read the pad of a player into buttons, race actions for the button layout, and the stick, record the input or replay a recording in its place, and check the cheats.

Parameters
stateThe input of the player.
Ghidra address:
USA: 0x80255120
Ghidra address:
Asia: 0x80254C70
Ghidra address:
EUR: 0x802566f0
Ghidra address:
JPN: 0x80256080

◆ CheckAnalogStickPositive()

void CheckAnalogStickPositive ( PlayerInputState * state,
s32 * timer,
f32 * axis,
u32 button )

Press a direction when a stick axis passes 0.6, then again after half a second and every 0.2 seconds while the axis stays above 0.3.

Parameters
stateThe input of the player.
timerThe time to the next repeat in milliseconds, 0 while the axis is released.
axisThe position of the axis, from -1 to 1.
buttonThe direction to press.
Ghidra address:
USA: 0x80255954
Ghidra address:
Asia: 0x802554A4
Ghidra address:
EUR: 0x80256f24
Ghidra address:
JPN: 0x802568b4

◆ CheckAnalogStickNegative()

void CheckAnalogStickNegative ( PlayerInputState * state,
s32 * timer,
f32 * axis,
u32 button )

The same as CheckAnalogStickPositive() for the negative side of an axis.

Parameters
stateThe input of the player.
timerThe time to the next repeat in milliseconds, 0 while the axis is released.
axisThe position of the axis, from -1 to 1.
buttonThe direction to press.
Ghidra address:
USA: 0x80255a18
Ghidra address:
Asia: 0x80255568
Ghidra address:
EUR: 0x80256fe8
Ghidra address:
JPN: 0x80256978

◆ UpdateStickRepeat()

void UpdateStickRepeat ( PlayerInputState * state)

Press the directions of the stick with repeat, as the menus read them.

Parameters
stateThe input of the player.
Ghidra address:
USA: 0x80255adc
Ghidra address:
Asia: 0x8025562C
Ghidra address:
EUR: 0x802570ac
Ghidra address:
JPN: 0x80256a3c

◆ StartControllerRead()

void StartControllerRead ( void )

Start a read of the controllers, unless one is already pending.

Ghidra address:
USA: 0x8021a920
Ghidra address:
Asia: 0x8021A470
Ghidra address:
EUR: 0x8021ba38
Ghidra address:
JPN: 0x8021b314
Ghidra address:
BRD3D: 0x10033780
Ghidra address:
BRGlide: 0x1002ce31

◆ ReadControllers()

void ReadControllers ( void )

Wait for a read of the controllers, starting one if none is pending, and fill the pads.

Ghidra address:
USA: 0x8021a964
Ghidra address:
Asia: 0x8021A4B4
Ghidra address:
EUR: 0x8021ba7c
Ghidra address:
JPN: 0x8021b358
Ghidra address:
BRD3D: 0x100337ae
Ghidra address:
BRGlide: 0x1002ce5f

◆ UpdateControllerState()

void UpdateControllerState ( void )

Read the controllers and turn their state into the input of the players.

Ghidra address:
USA: 0x8021a9b4
Ghidra address:
Asia: 0x8021A504
Ghidra address:
EUR: 0x8021bacc
Ghidra address:
JPN: 0x8021b3a8
Ghidra address:
BRD3D: 0x100337e9
Ghidra address:
BRGlide: 0x1002ce9a

◆ InitControllersAndPaks()

void InitControllersAndPaks ( void )

Probe the controllers and the Controller and Rumble Paks, running the controller check until each warning is dismissed and the Controller Pak menu while the first player holds start.

The Windows routine returns without probing controllers.

Ghidra address:
USA: 0x8021c188
Ghidra address:
Asia: 0x8021BCD8
Ghidra address:
EUR: 0x8021d37c
Ghidra address:
JPN: 0x8021cc4c
Ghidra address:
BRD3D: 0x10034a85
Ghidra address:
BRGlide: 0x1002e136

Variable Documentation

◆ g_aCheatCodes

CheatCode g_aCheatCodes[]
extern

The cheats, ending with a NULL sequence.

Ghidra address:
USA: 0x8028df48
Ghidra address:
Asia: 0x8028DA98
Ghidra address:
EUR: 0x80290704
Ghidra address:
JPN: 0x802901a4

◆ g_bShowDepthBuffer

s32 g_bShowDepthBuffer
extern

Whether each frame shows the depth buffer, at the start of memory, in place of the picture.

Ghidra address:
USA: 0x8028aa94
Ghidra address:
Asia: 0x8028A5E4
Ghidra address:
EUR: 0x8028cc9c
Ghidra address:
JPN: 0x8028c76c

◆ g_dwMultiplayerMode

s32 g_dwMultiplayerMode
extern

Whether the credits race scrolls the credits rather than displaying captions.

Ghidra address:
USA: 0x8026ff20
Ghidra address:
Asia: 0x8026FA70
Ghidra address:
EUR: 0x80271ef0
Ghidra address:
JPN: 0x802719a0

◆ g_bBilinearFiltering

s32 g_bBilinearFiltering
extern

Whether textures are filtered.

Ghidra address:
USA: 0x8028aa68
Ghidra address:
Asia: 0x8028A5B8
Ghidra address:
EUR: 0x8028cc70
Ghidra address:
JPN: 0x8028c740
Ghidra address:
BRD3D: 0x100aa890
Ghidra address:
BRGlide: 0x100aa020

◆ g_dwCheatFinishRacePending

s32 g_dwCheatFinishRacePending
extern

Set by CheatFinishRace() to finish the race.

Ghidra address:
EUR: 0x80272798
Ghidra address:
JPN: 0x80272248

◆ g_dwContReadPending

s32 g_dwContReadPending
extern

Whether a read of the controllers is started and not yet received.

Ghidra address:
USA: 0x8028ab6c
Ghidra address:
Asia: 0x8028A6BC
Ghidra address:
EUR: 0x8028ce18
Ghidra address:
JPN: 0x8028c848
Ghidra address:
BRD3D: 0x106c56e8
Ghidra address:
BRGlide: 0x106ec778

◆ g_bPakPort0Initialized

u8 g_bPakPort0Initialized
extern

Whether InitControllersAndPaks() has mounted the Controller Pak of the first controller.

Ghidra address:
USA: 0x8028adf0
Ghidra address:
Asia: 0x8028A940
Ghidra address:
EUR: 0x8028d0a0
Ghidra address:
JPN: 0x8028cad0