From f421d4ea88c2bdec2cee98ce38a21ede3024d557 Mon Sep 17 00:00:00 2001 From: progre Date: Thu, 12 Oct 2023 23:28:24 +0900 Subject: [PATCH] Revert "fix(junowen): remove unnecerassy seed sync" This reverts commit edf6dfbca265e846e966066755cf643b997c9698. --- junowen-lib/src/th19.rs | 11 +++++++++-- junowen/src/session.rs | 6 ++++++ junowen/src/state/game.rs | 12 ++++++++++++ junowen/src/state/select.rs | 12 ++++++++++++ 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/junowen-lib/src/th19.rs b/junowen-lib/src/th19.rs index 1e589dc..c8d505c 100644 --- a/junowen-lib/src/th19.rs +++ b/junowen-lib/src/th19.rs @@ -185,9 +185,16 @@ impl Th19 { u32_prop!(0x1a2478, difficulty_cursor, set_difficulty_cursor); pointer!(0x_1ae3a0, input_devices, input_devices_mut, InputDevices); - u16_prop!(0x1ae410, rand_seed1, set_rand_seed1); + u16_prop!(0x1ae410, rand_seed1, set_rand_seed1); // 同一フレームでも変わる可能性あり ここを起点にdesyncする? + u32_prop!(0x1ae414, rand_seed5, set_rand_seed5); // 公式にsyncしてない 遅いほうだけ書き換わる?0,0 時に複数回書き換わるが、その後は変わらない? + // 0x1ae418: unknown pointer!(0x_1ae41c, app, app_mut, App); - u16_prop!(0x1ae430, rand_seed2, set_rand_seed2); + u16_prop!(0x1ae420, rand_seed4, set_rand_seed4); // frame 依存? + u32_prop!(0x1ae424, rand_seed6, set_rand_seed6); // 公式にsyncしてない 書き換えが稀 + u16_prop!(0x1ae428, rand_seed3, set_rand_seed3); // frame 依存 0x1ae410 のコピー? + u32_prop!(0x1ae42c, rand_seed7, set_rand_seed7); // frame 依存 インクリメント + u16_prop!(0x1ae430, rand_seed2, set_rand_seed2); // frame 依存 0x1ae420 のコピー? + u32_prop!(0x1ae434, rand_seed8, set_rand_seed8); // frame 依存 インクリメント ptr_opt!(0x_1ae464, round, Round); pointer!(0x_1ae60c, player_name, PlayerName); value!(0x200850, p1_input, Input); diff --git a/junowen/src/session.rs b/junowen/src/session.rs index 9e061c1..5fb8c09 100644 --- a/junowen/src/session.rs +++ b/junowen/src/session.rs @@ -24,6 +24,12 @@ pub struct MatchInitial { pub struct RoundInitial { pub seed1: u16, pub seed2: u16, + pub seed3: u16, + pub seed4: u16, + pub seed5: u32, + pub seed6: u32, + pub seed7: u32, + pub seed8: u32, } pub async fn create_session( diff --git a/junowen/src/state/game.rs b/junowen/src/state/game.rs index 1328385..9d96cc0 100644 --- a/junowen/src/state/game.rs +++ b/junowen/src/state/game.rs @@ -35,12 +35,24 @@ pub fn on_round_over(session: &mut Session, th19: &mut Th19) -> Result<(), RecvE let init = session.init_round(Some(RoundInitial { seed1: th19.rand_seed1().unwrap(), seed2: th19.rand_seed2().unwrap(), + seed3: th19.rand_seed3().unwrap(), + seed4: th19.rand_seed4().unwrap(), + seed5: th19.rand_seed5().unwrap(), + seed6: th19.rand_seed6().unwrap(), + seed7: th19.rand_seed7().unwrap(), + seed8: th19.rand_seed8().unwrap(), }))?; assert!(init.is_none()); } else { let init = session.init_round(None)?.unwrap(); th19.set_rand_seed1(init.seed1).unwrap(); th19.set_rand_seed2(init.seed2).unwrap(); + th19.set_rand_seed3(init.seed3).unwrap(); + th19.set_rand_seed4(init.seed4).unwrap(); + th19.set_rand_seed5(init.seed5).unwrap(); + th19.set_rand_seed6(init.seed6).unwrap(); + th19.set_rand_seed7(init.seed7).unwrap(); + th19.set_rand_seed8(init.seed8).unwrap(); } Ok(()) } diff --git a/junowen/src/state/select.rs b/junowen/src/state/select.rs index 235c26c..55b30c1 100644 --- a/junowen/src/state/select.rs +++ b/junowen/src/state/select.rs @@ -35,6 +35,12 @@ pub fn on_input_players( let opt = session.init_round(Some(RoundInitial { seed1: th19.rand_seed1().unwrap(), seed2: th19.rand_seed2().unwrap(), + seed3: th19.rand_seed3().unwrap(), + seed4: th19.rand_seed4().unwrap(), + seed5: th19.rand_seed5().unwrap(), + seed6: th19.rand_seed6().unwrap(), + seed7: th19.rand_seed7().unwrap(), + seed8: th19.rand_seed8().unwrap(), }))?; debug_assert!(opt.is_none()); } else { @@ -48,6 +54,12 @@ pub fn on_input_players( let init = session.init_round(None)?.unwrap(); th19.set_rand_seed1(init.seed1).unwrap(); th19.set_rand_seed2(init.seed2).unwrap(); + th19.set_rand_seed3(init.seed3).unwrap(); + th19.set_rand_seed4(init.seed4).unwrap(); + th19.set_rand_seed5(init.seed5).unwrap(); + th19.set_rand_seed6(init.seed6).unwrap(); + th19.set_rand_seed7(init.seed7).unwrap(); + th19.set_rand_seed8(init.seed8).unwrap(); } }