A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
Kinoko::KReplaySystem Class Reference

#include <KReplaySystem.hh>

Description

Kinoko system designed to execute replays.

Definition at line 12 of file KReplaySystem.hh.

Inheritance diagram for Kinoko::KReplaySystem:

Public Member Functions

void init () override
 Initializes the system.
 
void calc () override
 Executes a frame.
 
bool run () override
 Executes a run.
 
void parseOptions (int argc, char **argv) override
 Parses non-generic command line options.
 
- Public Member Functions inherited from Kinoko::KSystem

Static Public Member Functions

static KReplaySystemCreateInstance ()
 
static void DestroyInstance ()
 
static KReplaySystemInstance ()
 

Private Types

typedef std::pair< const System::Timer &, const System::Timer & > DesyncingTimerPair
 

Private Member Functions

 KReplaySystem (const KReplaySystem &)=delete
 
 KReplaySystem (KReplaySystem &&)=delete
 
bool calcEnd () const
 Determines whether or not the ghost simulation should end.
 
void reportFail (const std::string &msg) const
 Reports failure to file.
 
bool success () const
 Determines whether the simulation was a success or not.
 
s32 getDesyncingTimerIdx () const
 Finds the desyncing timer index, if one exists.
 
DesyncingTimerPair getDesyncingTimer (s32 i) const
 Gets the desyncing timer according to the index.
 

Static Private Member Functions

static void OnInit (System::RaceConfig *config, void *arg)
 Initializes the race configuration as needed for replays.
 

Private Attributes

EGG::SceneManagerm_sceneMgr
 
const char * m_currentGhostFileName
 
const System::GhostFilem_currentGhost
 
const u8 * m_currentRawGhost
 
size_t m_currentRawGhostSize
 

Additional Inherited Members

- Static Protected Attributes inherited from Kinoko::KSystem
static KSystems_instance = nullptr
 

Member Typedef Documentation

◆ DesyncingTimerPair

std::pair<const System::Timer &, const System::Timer &> Kinoko::KReplaySystem::DesyncingTimerPair
private

Definition at line 27 of file KReplaySystem.hh.

Constructor & Destructor Documentation

◆ KReplaySystem()

Kinoko::KReplaySystem::KReplaySystem ( )
private

Definition at line 100 of file KReplaySystem.cc.

Member Function Documentation

◆ ~KReplaySystem()

Kinoko::KReplaySystem::~KReplaySystem ( )
overrideprivate

Definition at line 104 of file KReplaySystem.cc.

◆ calc()

void Kinoko::KReplaySystem::calc ( )
overridevirtual

Executes a frame.

Implements Kinoko::KSystem.

Definition at line 30 of file KReplaySystem.cc.

◆ calcEnd()

bool Kinoko::KReplaySystem::calcEnd ( ) const
private

Determines whether or not the ghost simulation should end.

Returns
Whether the ghost should end or not.

Definition at line 117 of file KReplaySystem.cc.

◆ CreateInstance()

KReplaySystem * Kinoko::KReplaySystem::CreateInstance ( )
static

Definition at line 87 of file KReplaySystem.cc.

◆ DestroyInstance()

void Kinoko::KReplaySystem::DestroyInstance ( )
static

Definition at line 93 of file KReplaySystem.cc.

◆ getDesyncingTimer()

KReplaySystem::DesyncingTimerPair Kinoko::KReplaySystem::getDesyncingTimer ( s32 i) const
private

Gets the desyncing timer according to the index.

Parameters
iIndex to the desyncing timer. Cannot be -1.
Returns
The pair of timers. The first is the correct one, and the second is the incorrect one.

Definition at line 198 of file KReplaySystem.cc.

◆ getDesyncingTimerIdx()

s32 Kinoko::KReplaySystem::getDesyncingTimerIdx ( ) const
private

Finds the desyncing timer index, if one exists.

Returns
-1 if there's no desync, 0 if the final timer desyncs, and 1+ if a lap timer desyncs.

Definition at line 180 of file KReplaySystem.cc.

◆ init()

void Kinoko::KReplaySystem::init ( )
overridevirtual

Initializes the system.

Implements Kinoko::KSystem.

Definition at line 15 of file KReplaySystem.cc.

◆ Instance()

static KReplaySystem * Kinoko::KReplaySystem::Instance ( )
inlinestatic

Definition at line 22 of file KReplaySystem.hh.

◆ OnInit()

void Kinoko::KReplaySystem::OnInit ( System::RaceConfig * config,
void * arg )
staticprivate

Initializes the race configuration as needed for replays.

Parameters
configThe race configuration instance.
argUnused optional argument.

Definition at line 221 of file KReplaySystem.cc.

◆ parseOptions()

void Kinoko::KReplaySystem::parseOptions ( int argc,
char ** argv )
overridevirtual

Parses non-generic command line options.

The only currently accepted option is the ghost flag.

Parameters
argcThe number of arguments.
argvThe arguments.

Implements Kinoko::KSystem.

Definition at line 49 of file KReplaySystem.cc.

◆ reportFail()

void Kinoko::KReplaySystem::reportFail ( const std::string & msg) const
private

Reports failure to file.

Parameters
msgThe message to report.

Definition at line 134 of file KReplaySystem.cc.

◆ run()

bool Kinoko::KReplaySystem::run ( )
overridevirtual

Executes a run.

A run consists of replaying a ghost.

Returns
Whether the run was successful or not.

Implements Kinoko::KSystem.

Definition at line 37 of file KReplaySystem.cc.

◆ success()

bool Kinoko::KReplaySystem::success ( ) const
private

Determines whether the simulation was a success or not.

Returns
Whether the simulation was a success or not.

Definition at line 142 of file KReplaySystem.cc.

Member Data Documentation

◆ m_currentGhost

const System::GhostFile* Kinoko::KReplaySystem::m_currentGhost
private

Definition at line 46 of file KReplaySystem.hh.

◆ m_currentGhostFileName

const char* Kinoko::KReplaySystem::m_currentGhostFileName
private

Definition at line 45 of file KReplaySystem.hh.

◆ m_currentRawGhost

const u8* Kinoko::KReplaySystem::m_currentRawGhost
private

Definition at line 47 of file KReplaySystem.hh.

◆ m_currentRawGhostSize

size_t Kinoko::KReplaySystem::m_currentRawGhostSize
private

Definition at line 48 of file KReplaySystem.hh.

◆ m_sceneMgr

EGG::SceneManager* Kinoko::KReplaySystem::m_sceneMgr
private

Definition at line 43 of file KReplaySystem.hh.