feat(cli): Play a replay file from the command line - #3227
Conversation
PR Summary by QodoAdd visual replay playback and absolute file loading to CLI
AI Description
Diagram
High-Level Assessment
Files changed (15)
|
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Source/Common/CommandLine.cpp | Adds -loadreplay parsing and validates replay/save extensions before queuing startup work. |
| Core/GameEngine/Source/Common/System/FileSystem.cpp | Adds platform-aware recognition of rooted Windows and POSIX paths. |
| Generals/Code/GameEngine/Source/Common/Recorder.cpp | Supports absolute replay paths and validates queued replay headers and map availability before playback. |
| GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp | Mirrors the queued replay and absolute-path behavior for Zero Hour. |
| Generals/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp | Resolves absolute save paths in place while retaining managed Save-directory lookup for relative names. |
| GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp | Mirrors the command-line save-path resolution behavior for Zero Hour. |
| Generals/Code/GameEngine/Source/GameClient/GameClient.cpp | Starts queued replay playback after shell initialization, following the existing queued-save lifecycle point. |
| GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp | Mirrors the post-shell queued replay startup hook for Zero Hour. |
Sequence Diagram
sequenceDiagram
participant CLI as Command line
participant Client as GameClient
participant Recorder as RecorderClass
participant FS as FileSystem
participant Maps as MapCache
CLI->>Client: Queue -loadreplay path
Client->>Client: Initialize and show shell
Client->>Recorder: loadQueuedReplay()
Recorder->>FS: Resolve absolute path or Replay directory
FS-->>Recorder: Replay header
Recorder->>Maps: Validate replay map
Maps-->>Recorder: Map available
Recorder->>Recorder: playbackFile(path)
Recorder-->>Client: Start visual replay playback
Reviews (1): Last reviewed commit: "feat(cli): Play a replay file from the c..." | Re-trigger Greptile
Code Review by Qodo
1. -ignoreReplaySyncErrors is unregistered
|
This is not entirely the case. |
Yeah that's true, replay without -headless already plays visually. Fixed the description. |
-replayalready plays visually when used without-headless, but it enters the replay-simulation workflow before the normal shell is shown and terminates the process when that workflow finishes. This is appropriate for batch simulation and synchronization checking, but not for an operating-system file handler whose playback should return to the menus.-loadreplay <file>instead plays one replay through the normal client lifecycle.loadQueuedReplayruns at the point-loadsavealready uses, once the client has initialized the shell, so the menus the playback returns to are on the stack.Absolute paths are opened in place while relative names still resolve from the Replay directory.
RecorderClass::readReplayHeaderusesFileSystem::isAbsolutePathfrom #3226 for that; because this resolution is shared, existing-replayalso gains support for absolute paths.A replay whose map is unavailable starts a game that cannot load, so
loadQueuedReplayrejects it up front and quits rather than failing deep in map loading.Verified with a bogus path as a control so a pass is distinguishable from "the game started anyway":
\\localhost\C$\...)InGame:D9C721A5 Replay:D8A198C0 Frame:110)Todo:
z_generalsandg_generals)