coastline 0.0.4
Loading...
Searching...
No Matches
replay.h
Go to the documentation of this file.
1#ifndef COASTLINE_REPLAY_H
2#define COASTLINE_REPLAY_H
3
8
9#include <PR/ultratypes.h>
10
11#include "common/input.h"
13#include "common/rle.h"
14#include "common/vehicle.h"
15#if TGR_PLATFORM == TGR_PLATFORM_SDL || defined(_MSC_VER)
16#include "common/vehiclemodel.h"
17#endif
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
31extern u8 g_abGhostRecording[];
32
42
43extern u8 _ghostRecordingSegmentRomStart[];
44extern u8 _creditsRecordingSegmentRomStart[];
45extern u8 _endingRecordingSegmentRomStart[];
46
48#define ROM_GHOST_RECORDING ((u32)_ghostRecordingSegmentRomStart)
49
51#define RECORDING_CAPACITY 0xDE5C
52
61
69extern u8 g_aabInputRecordings[][0xF000];
70
71#if !TGR_BOSS_RALLY
83#endif /* !TGR_BOSS_RALLY */
84
96
97#if TGR_PLATFORM == TGR_PLATFORM_N64
106extern u8 *g_apReplayGhostPtrs[];
107
117#endif /* TGR_PLATFORM == TGR_PLATFORM_N64 */
118
120#define LAST_LAP_RECORDING_SIZE 0x3840
121
131
135#if TGR_PLATFORM == TGR_PLATFORM_SDL || defined(_MSC_VER)
136/* The SDL and MSVC builds use a cast to view vehicle-model storage as last-lap buffers. */
137#define g_aLastLapBuffers ((LastLapBuffer *)g_aVehicleModels)
138#elif TGR_BOSS_RALLY
139extern LastLapBuffer g_aLastLapBuffers[] __asm__("_g_aVehicleModels");
140#else
142#endif
143
145#if TGR_BOSS_RALLY
146#define LAST_LAP_FIRST_SLOT 15
147#else
148#define LAST_LAP_FIRST_SLOT 3
149#endif
150
152typedef struct {
153 void *data;
155} SaveField;
156
168
180
182#define PAUSED_CLOCK_STATE_SIZE 0x40
183
195
196#if !TGR_BOSS_RALLY && (TGR_REGION == TGR_REGION_JP || TGR_REGION == TGR_REGION_EU)
208s32 SerializeSaveData(SaveField *fields, u8 *buffer, s32 capacity, s32 offset);
209
220s32 DeserializeSaveData(SaveField *fields, u8 *buffer, s32 offset);
221#else
233void SerializeSaveData(SaveField *fields, u8 *buffer, s32 capacity);
234
245void DeserializeSaveData(SaveField *fields, u8 *buffer);
246#endif /* \
247 * !TGR_BOSS_RALLY && (TGR_REGION == TGR_REGION_JP || TGR_REGION == \
248 * TGR_REGION_EU) \
249 */
250
263
276
277#if TGR_PLATFORM == TGR_PLATFORM_N64
289#endif /* TGR_PLATFORM == TGR_PLATFORM_N64 */
290
291#if TGR_REGION == TGR_REGION_JP || TGR_REGION == TGR_REGION_EU
299
307
315
323
332#endif /* TGR_REGION == TGR_REGION_JP || TGR_REGION == TGR_REGION_EU */
333
334#ifdef __cplusplus
335}
336#endif
337
338#endif /* COASTLINE_REPLAY_H */
The input of each player, the cheat codes, and the translation of controller data.
unsigned g_dwGhostRecordingSize
The number of metadata bytes written before the frames.
#define INPUT_RECORDERS
The recordings of the input a player can make at once.
Definition playerinput.h:29
s32 g_dwReplayKeyframeFrameCount
The frames RestoreReplayKeyframeState() has run.
void RestoreRaceSnapshot(LastLapBuffer *buffer)
Restore the state of the race from a snapshot SaveLastLapSnapshot() took.
void SaveRaceSnapshot(LastLapBuffer *buffer)
Take a snapshot of the race into the buffer of a last lap.
s32 g_adwReplayGhostSizes[]
The lengths of the instant replay recordings of the local players, in bytes.
#define PAUSED_CLOCK_STATE_SIZE
The bytes of the paused clock state.
Definition replay.h:182
u8 g_abPlaybackRecording[]
The buffer the recording a race replays is copied to.
SaveField g_aReplayKeyframeDescTable3[]
The third group of variables restored from a demo keyframe.
void RestoreReplayKeyframeState(void)
In the demo, restore the race from a keyframe when the recording of the first vehicle reaches one,...
s32 DeserializeSaveData(SaveField *fields, u8 *buffer, s32 offset)
Copy the variables of a list back from a buffer SerializeSaveData() filled.
#define g_aLastLapBuffers
Last-lap buffers share vehicle-model storage and descend through slots by local-player index.
Definition replay.h:137
s32 SerializeSaveData(SaveField *fields, u8 *buffer, s32 capacity, s32 offset)
Copy the variables of a list one after another into a buffer, and report when they overflow it.
SaveField g_aRaceSnapshotFields[]
The variables a snapshot of the race saves: the vehicles, the racers, the clocks, the sounds and more...
SaveField g_aPausedClockFields[]
The random seed and the clocks a pause keeps.
SaveField g_aReplayKeyframeDescTable2[]
The second group of variables restored from a demo keyframe.
u8 g_aabInputRecordings[][0xF000]
The buffers the input of each local player is recorded into, 0xF000 bytes apart.
u8 g_abGhostRecording[]
The recorded input of the ghost.
s32 g_dwBestReplayPlayer
The player whose recording the instant replay plays.
void SaveLastLapSnapshot(Vehicle *vehicle)
At the start of the last lap, give each local player a buffer to record the lap into and take a snaps...
#define LAST_LAP_RECORDING_SIZE
The bytes of the recording of each local player's input over the last lap.
Definition replay.h:120
SaveField g_aReplayKeyframeDescTable1[]
The variables a keyframe of the recording of the demo restores, in the order of the keyframe.
s32 g_dwBestReplayLength
The player whose recording the instant replay plays, and the length of that recording.
u8 * g_apReplayGhostPtrs[]
The recordings the instant replay gives each local player, and their lengths.
u8 g_abPausedClockState[PAUSED_CLOCK_STATE_SIZE]
Where a pause keeps them.
The last lap of a player: the input of each local player over it, and a snapshot of the race at its s...
Definition replay.h:126
u8 recordings[INPUT_RECORDERS][LAST_LAP_RECORDING_SIZE]
Definition replay.h:127
u8 snapshot[sizeof(VehicleModel) - INPUT_RECORDERS *LAST_LAP_RECORDING_SIZE]
Definition replay.h:128
A block of variables a snapshot saves, in a list ending in a NULL block.
Definition replay.h:152
void * data
Definition replay.h:153
u32 size
Definition replay.h:154
The model of a car as it is loaded from the cartridge.
Definition vehiclemodel.h:55
A vehicle.
Definition vehicle.h:143
Integer and floating-point types of libultra.
unsigned int u32
Definition ultratypes.h:20
int s32
Definition ultratypes.h:25
unsigned char u8
Definition ultratypes.h:18
The vehicles of a race, the cars they are, and their place on the track.