Allow savestate creation/loading during netplay (in-memory) #2
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#2
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
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?
Repo: gopher64-netplay (fork of https://github.com/gopher64/gopher64)
Context: Full scope doc at upstream analysis — see commit history. Netplay uses GGRS over WebRTC (matchbox_socket), reliable channel carries
NetplayMessage { name, data }in 16KB chunks. Savestates serialize full Device via postcard + compress.Goal: Enable savestate ops while a netplay session is active, without disk I/O.
Background:
src/savestates.rscreate_savestatedoes disk write in a spawned tokio task;load_savestatereads compressed filesrc/device/vi.rs:103guardsprocess_savestateswithif device.netplay.is_none()— states are refused during netplayprocess_requestsin netplay.rs already receives GGRSSaveGameState/LoadGameStaterequests but stubs them (lines 271-285)Acceptance:
SavestateData::save_to_memory() -> Vec<u8>(postcard + compress, no disk) andSavestateData::load_from_memory(&[u8])(decompress + deserialize)create_savestate_in_memory(device) -> Option<SavestateData>— clones device likecreate_savestatedoes, returns data instead of writingload_savestate_from_data(device, &SavestateData)— refactor the existingstd::mem::swapblock inload_savestateinto a shared function both paths useDEVICE_CLONE,SAVES_CLONE) must be reused, not duplicatedvi.rs:103guard ONLY for the netplay-savestate path (keep offline behavior identical)Devicestate matches (sample: cpu regs, rdram bytes, vi regs). Test during an active (mocked) netplay session.Verification:
cargo testpasses. Offline savestate behavior unchanged.