class

InputPlayback

Reads a .mirec file produced by InputRecorder and replays its events into InputManager one frame at a time. The full event stream is read into a std::vector at Load() time — recordings are small (KB to single-digit MB for long sessions), so streaming from disk during gameplay would only add hitch risk for no real memory win.

Module
Input
Header
#include "Input/InputPlayback.h"
Namespace
Mowo

Public functions

ReturnsNameDescription
boolLoadLoads path into memory and parses the header.
voidStopAborts playback.
boolIsActive
boolIsFinishedTrue when the read cursor has reached the end of the stream.
uint64_tFrameCount
uint64_tEventCount
uint64_tCurrentFrame
voidInjectFrameReplays every event up to and including the next FrameMarker into the given InputManager.

Function details

Load

C++
bool Load(const std::string& path)

Loads path into memory and parses the header. Returns false if the file can't be opened, is shorter than the header, or has wrong magic / unsupported version. On failure the playback is left inactive so a subsequent Load() can retry.

Stop

C++
void Stop()

Aborts playback. Safe to call when not active.

IsActive

C++
bool IsActive() const

IsFinished

C++
bool IsFinished() const

True when the read cursor has reached the end of the stream. Hosts can poll this to auto-stop or loop. Becomes true after the last frame's events have been injected by InjectFrame(). True once the stream ended for ANY reason — natural end-of-data OR an abort (truncated file, unknown tag). The old m_active gate made an aborted playback read as never-finished, and hosts looping on !IsFinished() hung forever.

FrameCount

C++
uint64_t FrameCount() const

EventCount

C++
uint64_t EventCount() const

CurrentFrame

C++
uint64_t CurrentFrame() const

InjectFrame

C++
void InjectFrame(InputManager& mgr)

Replays every event up to and including the next FrameMarker into the given InputManager. Each call advances exactly one recorded frame — matched 1:1 with InputManager::Update(). When the stream is finished becomes a no-op (so a stuck playback won't crash the game loop).

Generated from Input/InputPlayback.h via input.json · Nov 2, 2026Version 1.0.0