Skip to content

feat(cli): Add -saveatframe and -saveto options - #3135

Draft
bobtista wants to merge 1 commit into
TheSuperHackers:mainfrom
bobtista:bobtista/feat/saveatframe-cli
Draft

feat(cli): Add -saveatframe and -saveto options#3135
bobtista wants to merge 1 commit into
TheSuperHackers:mainfrom
bobtista:bobtista/feat/saveatframe-cli

Conversation

@bobtista

@bobtista bobtista commented Aug 14, 2026

Copy link
Copy Markdown

-file starts a map from the command line and #3001 loads a save from it, but there is no way to write one, so a save/load round trip cannot be run unattended and an xfer change has to be checked manually through the in-game menu.

-saveatframe <frame> now requests a save at the first player-saveable start-of-frame boundary at or after that logic frame. The hook runs before scripts, terrain, and object updates, matching the engine's normal save timing: TheGameClient->UPDATE() precedes TheGameLogic->UPDATE().

If input is disabled eg during a cinematic, the save is deferred until input is enabled. This prevents the harness from creating a save that the in-game Save button would reject. (I tried loading a save made during a campaign mission intro, and it's bad)

-saveto <file> names the file, defaulting to commandline.sav. Both options are registered alongside -file in the debug-only section of paramsForEngineInit, so release builds are unaffected.

The earlier draft placed the hook after logic-frame work had begun. Reloading that mid-frame snapshot repeated work already represented in the save, producing a permanent AI-group ID skew in continuous-vs-loaded CRC comparisons. Moving it to the start-of-frame boundary removes that harness artifact.

Verified on MD_CHI01 with the save/load determinism harness:

-saveatframe 1780 -saveto crctrans.sav
  save deferred while input was disabled
  Command line save to 'crctrans.sav' at frame 1781 returned 0

-loadsave crctrans.sav
  loadGame result=0 file=crctrans.sav

Todo:

  • Save at a valid start-of-frame boundary
  • Defer while player input is disabled
  • Verify the save loads through -loadsave
  • Replicate to Generals

@bobtista
bobtista force-pushed the bobtista/feat/saveatframe-cli branch 2 times, most recently from 6933dd3 to 351db69 Compare August 14, 2026 01:28
@bobtista bobtista self-assigned this Aug 14, 2026
@bobtista bobtista added Enhancement Is new feature or request Debug Is mostly debug functionality labels Aug 14, 2026
@bobtista
bobtista force-pushed the bobtista/feat/saveatframe-cli branch from 351db69 to c89d8fc Compare August 16, 2026 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Debug Is mostly debug functionality Enhancement Is new feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No command line option to write a save at a chosen point

1 participant