feat(recorder): 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 relaxes the existing simulation option's extension restriction. |
| Generals/Code/GameEngine/Source/Common/Recorder.cpp | Adds replay path resolution, queued-playback validation, and the normal client-lifecycle launch flow for Generals. |
| GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp | Mirrors replay path resolution and queued-playback behavior for Zero Hour. |
| Generals/Code/GameEngine/Source/GameClient/GameClient.cpp | Starts a queued replay after shell initialization, using the same startup point as queued save loading. |
| GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp | Mirrors the post-shell queued replay handoff in the Zero Hour client. |
| Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp | Updates menu header reads to use the centralized filename and playback-mode contract. |
| GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp | Applies the centralized replay-header API to the Zero Hour replay menu. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
CLI[-loadreplay path] --> Global[Store queued replay]
Global --> Init[Initialize client and shell]
Init --> Validate[Read replay header and validate map]
Validate -->|Invalid replay| ReplayError[Show replay-load error and remain in menus]
Validate -->|Missing map| MapError[Show map error and remain in menus]
Validate -->|Valid| Playback[Open replay for playback]
Playback --> Queue[Queue MSG_NEW_GAME]
Queue --> Game[Start replay]
Game --> Menus[Return to menus after playback]
Reviews (7): 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. |
a82128f to
cbeeaa5
Compare
cbeeaa5 to
d35d0ff
Compare
d35d0ff to
00e5bc8
Compare
1d058e2 to
dc0d164
Compare
dc0d164 to
1b5c5be
Compare
-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::getReplayPathForReaddoes that, mirroringGameState::getSaveGamePathForReadfrom #3226. Because this resolution is shared, existing-replayalso gains support for absolute paths and no longer requires the.repextension.A replay that cannot be read, or whose map is unavailable, is rejected up front with the same message boxes the Replay menu shows, and the game stays on the main menu rather than failing deep in map loading.
Verified with failing files as controls so a pass is distinguishable from "the game started anyway":
\\localhost\C$\...)InGame:D9C721A5 Replay:D8A198C0 Frame:110)Todo:
z_generalsandg_generals)