netplay: session save to disk (host) [issue-3] #13
No reviewers
Labels
No Label
blocked
bounced
in-progress
in-review
manual-only
needs-guidance
netplay
p1
p2
p3
rust
No Milestone
No project
No Assignees
1 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: pbwraith/gopher64-netplay#13
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "issue-3"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implements gopher64-netplay issue #3: host-side netplay session save.
storage::paths.netplay_state_file_path—{prefix}-{hash}.netplay-statenext to the other state files (per-slot style, alongside savestates).
SavestateData::save_to_memory()serializes the in-memorysavestate to the same compressed multi-entry zip layout used on disk, and
create_savestate_in_memory(device)captures the state snapshot withouttouching the disk.
netplay::save_netplay_session(device, path)captures thein-memory savestate, encodes
{ state, frame, input_delay, rom_hash, players }via postcard (
NetplaySessionSave), zstd-compresses via the existingui::storage::compress_filepath and writes atomically (tmp + rename).On success shows "Session saved — safe to quit"; on failure shows a
"Failed to save netplay session" message.
player_number == 0) may save; other playersget "Only the host can save the session".
emulation.netplay_save_key(default F7),edge-triggered in
ui::input::getand consumed per-frame inui::video::check_callback.file-level test verifying frame/rom_hash/input_delay/players metadata.
Verification
cargo check --all-targets— passes.cargo test— 2 passed / 0 failed (netplay session save round-trip +metadata tests).
Closes #3
Add host-side netplay session save: - storage::paths.netplay_state_file_path next to other state files - savestates::create_savestate_in_memory + SavestateData::save_to_memory (in-memory capture, same zip layout as on-disk savestates) - netplay::save_netplay_session(device, path): postcard-encodes {state, frame, input_delay, rom_hash, players}, zstd-compresses and writes atomically (tmp + rename); onscreen 'Session saved — safe to quit' - only the host (player_number 0) may save; others get an onscreen notice - configurable hotkey (emulation.netplay_save_key, default F7), edge triggered in ui::input::get and consumed per-frame in check_callback - unit tests: encode/decode round-trip + file metadata verificationImplementation complete for gopher64-netplay #3 — session save to disk (host).
Commit:
15fc132(branchissue-3, basemain)Changed files: 7 (netplay.rs, savestates.rs, ui.rs, ui/config.rs, ui/input.rs, ui/storage.rs, ui/video.rs); +244 lines.
What's implemented:
storage::paths.netplay_state_file_path—{prefix}-{hash}.netplay-statenext to the other state filesSavestateData::save_to_memory()+create_savestate_in_memory(device)— in-memory snapshot without disk I/Onetplay::save_netplay_session(device, path)— captures savestate, encodes{state, frame, input_delay, rom_hash, players}via postcard, zstd-compresses and writes atomically (tmp + rename); onscreen "Session saved — safe to quit"player_number == 0may save; others see "Only the host can save the session"emulation.netplay_save_key(default F7, SDL scancode), edge-triggered inui::input::get, consumed per-frame inui::video::check_callbackTest evidence (this machine: WSL2, rustc 1.98.0, RUSTFLAGS target-cpu=x86-64-v2 since the host CPU predates x86-64-v3):
git diff --checkclean.Note: this machine required a local (non-sudo) dev toolchain (pkgconf/cmake/clang-18/libfontconfig/X11 dev extracted from Ubuntu .debs) because the base WSL box lacks system build deps;
-flto=thinrequires clang, which upstream's.cargo/config.tomlalready assumes (CC=clang). Also initialized the three git submodules (parallel-rdp-standalone, rcheevos, sse2neon) at their recorded commits — the empty submodules made the C sources (volk.c etc.) missing.Not merged this sweep, and not bounced — this PR has not been found faulty.
Two things block a verdict, both recorded in gopher64-netplay#16:
cargo checkfails on aclean
origin/mainbefore compiling any of this repo's code — the CPU ispre-AVX2 and
.cargo/config.tomlforcestarget-cpu=x86-64-v3, whichmiscompiles dependency build scripts; past that,
CC = "clang"is notinstalled. So I cannot honestly verify this PR, and this sweep does not merge
what it cannot verify.
src/netplay.rs. Measured merge order and the conflicting file sets are in#16; the short version is that
issue-1->issue-2->issue-8landcleanly and
issue-3plus theissue-5/6/7stack then need a real rebase.No action needed from you until #16 is resolved. Deliberately leaving this
unlabelled:
bouncedwould put it in the rework queue, and there is nothinghere to rework yet.
Parked: subsumed by !18, and blocked on #23
git merge-base --is-ancestor origin/issue-3 origin/issue-4-> true. Yoursingle commit
15fc132is already a merge-parent of !18's tree, so mergingboth would deliver the same change twice, and the whole cluster is currently
held by the gate defect in #23.
No rework is wanted here -- when #23 lands and !18 merges, this PR should be
closed as subsumed, not rebased.
The cluster map, measured (not inferred)
git merge-base --is-ancestoron every pair, plus a realgit mergeinto athrowaway worktree for every conflict claim -- Gitea's
mergeableflag saystruefor all ten of these and is not evidence either way:issue-1issue-2issue-3issue-5issue-4issue-6issue-7issue-8The four
vendor/ggrstrees on !9/!10/!11/!18 are byte-identical(tree
816fce1d), so the vendoring itself never conflicts -- every realconflict is in
src/netplay.rs,src/savestates.rs,src/device.rs.Each branch merges cleanly into
mainalone; they collide with eachother. So the order is forced regardless of this issue: one lands, the rest
rebase.
Suggested resolution once #23 lands
Land !18 (it delivers #1/#2/#3/#4/#5 in one self-consistent tree), then
close !15/!13/!9 as subsumed rather than merging them -- their commits are
already ancestors of
issue-4. Then rebase !11 (which carries !10) and !12.Closing as subsumed, now that the thing this was parked on has landed.
#23is CLOSED --!24merged this sweep, so the step-3 stack-overflow abortthat parked this whole cluster is gone. Re-verified the containment claim from
the earlier review rather than trusting the comment:
So
!18already carries every commit onissue-3; your session save to disk (#3) work is notbeing dropped, it ships there. Repairing both branches would mean resolving the
same
src/netplay.rsconflict twice and then reconciling two rebases of thesame commits.
The branch
issue-3is untouched -- I have not deleted it, because deleting aGitea PR source branch auto-closes the PR and recreating the branch does not
reopen it. If the containment ever needs re-checking, the branch is still there.
Follow the work on
!18, which I have bounced with the specific rebaseit needs.