Load a saved game state, then save a new state snapshot when the user reaches the next point
Load a saved game state to jump to a point in the game, then save a new state snapshot when the user is ready.
Arguments: <input-state> <output-state-name>
<input-state>: a state .json file to load from recordings/<output-state-name>: filename for the new state snapshot (without .json, always the last argument)If arguments are missing, list available state files and ask the user.
State files are stored at:
/home/dshanaghy/src/github.com/declanshanaghy/gwent/software/data/recordings/
If arguments are missing, list available state files:
ls software/data/recordings/*.json 2>/dev/null
Ask the user which state to load and what to name the new snapshot.
Resolve the input state to an absolute path under recordings/. Add .json if not present.
Kill any running gwent processes:
kill -9 $(pgrep -f 'bin/gwent') 2>/dev/null; sleep 2
Start gwent with both GWENT_STATE (load) and GWENT_STATE_OUT (save name):
source ~/gwent-venv/bin/activate && RUNNING_ON_PI=true PYTHONUNBUFFERED=1 GWENT_STATE=<absolute-input-path> GWENT_STATE_OUT=<output-name> gwent >> /tmp/logs/gwent.log 2>&1 &
Wait for startup, confirm the process is running, and check logs for "Loading game state" and "now at stage" messages.
Tell the user:
kill -USR1 $(pgrep -f 'bin/gwent' | head -1)recordings/<output-name>.jsontail -f /tmp/logs/gwent.log