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

The ghost car of a time attack in the TOP GEAR GHOST note of the Controller Pak, as the console writes it, and the frames the race engine of the PC release plays the ghost car from. More...

#include <cstddef>
#include <filesystem>
#include <optional>
#include <span>
#include <vector>
#include "common/types.h"
Include dependency graph for ghostnote.h:

Go to the source code of this file.

Namespaces

namespace  coastline

Functions

std::optional< std::vector< u8 > > coastline::PackGhostNote (std::span< const u8 > recording)
 Compress a recording into the note of a ghost car, as SaveSaveLoadNote() of the console does: each of the two channels of the recording (the steering and the actions) with run lengths, and the length of each channel first in the byte order of the console.
std::optional< std::vector< u8 > > coastline::UnpackGhostNote (std::span< const u8 > note)
 Expand the note of a ghost car into its recording.
std::vector< u8 > coastline::PackGhostFrames (std::span< const u8 > recording, std::span< const u8 > frames)
 Store the frames of the race engine with the recording of the console they were recorded with.
std::optional< std::vector< u8 > > coastline::GhostFramesFor (std::span< const u8 > file, std::span< const u8 > recording)
 Read the frames of the race engine of a recording of the console from the file of PackGhostFrames().
bool coastline::SaveGhostFrames (const std::filesystem::path &path, std::span< const u8 > recording, std::span< const u8 > frames)
 Atomically write the payload of PackGhostFrames() with a verified integrity header.
std::optional< std::vector< u8 > > coastline::LoadGhostFrames (const std::filesystem::path &path, std::span< const u8 > recording)
 Read the frames of a recording from the file of SaveGhostFrames().

Variables

constexpr std::size_t coastline::GHOST_NOTE_SIZE = 0x3A00
 The size of the note of a ghost car, 58 pages.
constexpr std::size_t coastline::GHOST_RECORDING_CAPACITY = 0xDE5C
 The capacity of the recording of the console, its header included.

Detailed Description

The ghost car of a time attack in the TOP GEAR GHOST note of the Controller Pak, as the console writes it, and the frames the race engine of the PC release plays the ghost car from.

The console records the input of the player: a header of the track, the car, and the setup, and then the steering and the actions of each step of the race, two bytes a step. It plays the ghost car by driving it with the input again. The race engine of the PC release records the pose of the car at each step instead, and the SDL game records both in a time attack. Notes include only input. SDL recordings retain their poses beside the pak; console recordings drive the race engine with their recorded input when poses are absent.