[Bug] Streaming: resuming a save state restores the newest in-game save, not the one saved with that state (GameCube hangs on its next save)

Open
#5,847 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Trace state claiming from POST /api/streaming/sessions through saves.restorable_for and newest_restorable, then inspect how the selected state_id and optional save_id reach the stream session. The reproduction identifies the required behavior: without save_id, choose the archive filed at the same exit as the state; with no state, keep the newest archive as the default. Verify that resuming the saved state uploads its matching archive and that Dolphin can complete an in-game save.

Written by the indexing model from the issue text.

Description

RomM version
5.5.0-beta.2

Describe the bug
With emulator streaming (webstation), claiming a session with state_id and no save_id restores the user's newest saves archive (saves.restorable_for -> newest_restorable), not the archive filed at the same exit as the picked state. When the in-game save is newer than the state, the game boots from the state with a memory card that does not match what the game has in RAM.

On GameCube (Dolphin, GCI folder card) this hangs the game: the next in-game save never finishes. The game stops (Dolphin idle, no log output, UsePanicHandlers=False), and a save-and-exit from that point stores a state of the hung game, which then shows "Decompressing State..." forever on every resume.

The web player hits this too: its stream page only sends save_id when the container has supports_save_picker and the user picked a save, so on GameCube (no save picker) a state resume always gets the newest archive.

To Reproduce

  1. Stream a GameCube game (Pikmin 2, USA), play, Save and quit. RomM stores state A and, a few seconds later, saves archive A.
  2. Resume from state A, save in-game (memory card), then quit without saving. RomM stores saves archive B (newer card), no new state.
  3. Resume from state A again. RomM uploads archive B (uploaded saves to container, file=<archive B>), Dolphin loads state A.
  4. Save in-game. The game hangs at the save. Save and quit now stores a state that never loads.

Expected behavior
A state resume restores the saves archive that belongs with that state (the one filed at the same exit), so the state and the memory card / save files match. The newest archive is the right default only when no state is picked.

Screenshots
n/a (log lines and timings below)

Server (please complete the following information):

  • OS: Docker on a UGREEN NAS
  • Version: RomM 5.5.0-beta.2, webstation (linuxserver :romm tag), broker 0.15.3, Dolphin from the webstation image

Client (please complete the following information):

  • Device: Google TV Streamer, custom client using POST /api/streaming/sessions
  • OS: Android 14
  • Browser: n/a
  • Version: n/a

Additional context
Timings from the run: state at 00:04:51 with archive at 00:04:54 (same exit); in-game card save at 00:06:38 (archive at 00:15:26 after a quit without saving); every resume of the 00:04:51 state afterwards uploaded the newer archive and hung on the next in-game save. Resuming the same state with save_id of the 00:04:54 archive gives a matching card.

Suggested fix: when state_id is given and save_id is not, restore the archive filed at the same exit as that state (for example by recording the archive id on the state at pull time, or by picking the archive created right after the state). Clients can work around it today by sending that save_id themselves, which is what my client now does.

Related: #5544 (restore uses only the newest archive).

Dominant language
Python
Stars
13.3k
Forks
747
Avg merge
20h 58m
Merged PRs (30d)
207

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rommapp/romm

All issues in rommapp/romm

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.