Some checks failed
Rust / build-linux (linux-x86_64, X64, ubuntu-24.04, x86_64-unknown-linux-gnu) (pull_request) Failing after 5s
Rust / build-android (29.0.14206865, ubuntu-24.04, 33) (pull_request) Failing after 2s
Rust-lint / lint-linux (pull_request) Failing after 2s
Rust / build-linux (linux-aarch64, ARM64, ubuntu-24.04-arm, aarch64-unknown-linux-gnu) (pull_request) Has been cancelled
Rust / build-windows (windows-aarch64, woa64, windows-11-arm, aarch64-pc-windows-msvc) (pull_request) Has been cancelled
Rust / build-windows (windows-x86_64, win64, windows-2025, x86_64-pc-windows-msvc) (pull_request) Has been cancelled
Rust / build-macos (macos-aarch64, ARM64, aarch64-apple-darwin) (pull_request) Has been cancelled
Rust / Collect release artifacts (pull_request) Has been cancelled
After a netplay savestate load, the GGRS session's internal frame counter
must be reset to match the savestate's frame, or desync detection fires
immediately on resume.
Changes:
- Patch vendored ggrs 0.13.0 to expose set_current_frame(frame) on
P2PSession and SyncTestSession, with internal SyncLayer and InputQueue
reset methods to clear stale saved states, checksum history, and input
queues
- Add [patch.crates-io] ggrs = { path = 'vendor/ggrs' } in Cargo.toml
- Add netplay::reset_frame(session, frame) wrapper function
- Record current GGRS frame in Savestate.netplay_frame during
create_savestate when in netplay context
- Call reset_frame after load_savestate in netplay context
- Add tests: advance 120 frames, reset to 60, verify current_frame()==60
and clean resume with matching inputs; reset to 0; idempotent reset
Closes #5
26 lines
785 B
Rust
26 lines
785 B
Rust
mod stubs_enum;
|
|
|
|
use ggrs::{GgrsError, SessionBuilder};
|
|
|
|
#[test]
|
|
fn test_enum_advance_frames_with_delayed_input() -> Result<(), GgrsError> {
|
|
let check_distance = 7;
|
|
let mut stub = stubs_enum::GameStubEnum::new();
|
|
let mut sess = SessionBuilder::new()
|
|
.with_check_distance(check_distance)
|
|
.with_input_delay(2)
|
|
.start_synctest_session()?;
|
|
|
|
let inputs = [stubs_enum::EnumInput::Val1, stubs_enum::EnumInput::Val2];
|
|
for i in 0..200 {
|
|
let input = inputs[i % inputs.len()];
|
|
sess.add_local_input(0, input)?;
|
|
sess.add_local_input(1, input)?;
|
|
let requests = sess.advance_frame()?;
|
|
stub.handle_requests(requests);
|
|
assert_eq!(stub.gs.frame, i as i32 + 1); // frame should have advanced
|
|
}
|
|
|
|
Ok(())
|
|
}
|