52 PANIC(
"Expected ghost argument!");
55 for (
int i = 0; i < argc; ++i) {
58 WARN(
"Expected a flag! Got: %s", argv[i]);
72 PANIC(
"File cannot be a ghost! Check the file size.");
83 PANIC(
"Invalid flag!");
109 WARN(
"KReplaySystem instance not explicitly handled!");
120 constexpr u32 MAX_FRAME_COUNT = 10 * 60 * 60;
127 if (raceManager->timerManager().frameCounter() > MAX_FRAME_COUNT) {
138 report +=
"\n" + std::string(msg);
146 std::ostringstream oss;
147 oss << std::setw(2) << std::setfill(
'0') << timer.min <<
":" << std::setw(2)
148 << std::setfill(
'0') << timer.sec <<
"." << std::setw(3) << std::setfill(
'0')
161 if (desyncingTimerIdx != -1) {
166 if (desyncingTimerIdx == 0) {
167 msg =
"Final timer desync!";
169 msg =
"Lap " + std::to_string(desyncingTimerIdx) +
" timer desync!";
172 msg +=
" Expected " + format(correct) +
", got " + format(incorrect);
188 for (
size_t i = 0; i < 3; ++i) {
202 ASSERT(cond != std::strong_ordering::less);
204 if (cond == std::strong_ordering::equal) {
207 ASSERT(correct != incorrect);
209 }
else if (cond == std::strong_ordering::greater) {
212 ASSERT(correct != incorrect);
Scene * currentScene() const
void changeScene(int nextSceneId)
static KReplaySystem * Instance()
const char * m_currentGhostFileName
bool run() override
Executes a run.
void parseOptions(int argc, char **argv) override
Parses non-generic command line options.
size_t m_currentRawGhostSize
const System::GhostFile * m_currentGhost
static void OnInit(System::RaceConfig *config, void *arg)
Initializes the race configuration as needed for replays.
~KReplaySystem() override
EGG::SceneManager * m_sceneMgr
static KReplaySystem * CreateInstance()
std::pair< const System::Timer &, const System::Timer & > DesyncingTimerPair
DesyncingTimerPair getDesyncingTimer(s32 i) const
Gets the desyncing timer according to the index.
static void DestroyInstance()
bool calcEnd() const
Determines whether or not the ghost simulation should end.
void calc() override
Executes a frame.
void reportFail(const std::string &msg) const
Reports failure to file.
s32 getDesyncingTimerIdx() const
Finds the desyncing timer index, if one exists.
void init() override
Initializes the system.
bool success() const
Determines whether the simulation was a success or not.
const u8 * m_currentRawGhost
static KSystem * s_instance
const Timer & lapTimer(size_t i) const
const Timer & raceTimer() const
Initializes the player with parameters specified in the provided ghost file.
const Scenario & raceScenario() const
void setGhost(const u8 *rkg)
static void RegisterInitCallback(const InitCallback &callback, void *arg)
const Timer & lapTimer(size_t idx) const
const Timer & raceTimer() const
static RaceManager * Instance()
const Player & player() const
The binary data of a ghost saved to a file.
int Remove(const char *path)
void Append(const char *path, const char *data, size_t size)
u8 * LoadHost(const char *path, size_t &size)
Loads files from host system.
void egg_delete(const T *ptr)
T * egg_new(Args &&...args)
std::optional< EOption > CheckFlag(const char *arg)
std::array< Player, 12 > players
A simple struct to represent a lap or race finish time.