From db2ee114a93ae2786e9edf28445d4c8ea7a5a6c5 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 28 Jun 2025 08:13:20 -0400 Subject: [PATCH] Fix the size of the aetheryte unlock bitmask This should really be calculated instead of guessed, because I already made a mistake. I didn't do that, only added a TODO for it. Fixes #74 --- src/bin/kawari-world.rs | 2 +- src/ipc/zone/player_setup.rs | 4 ++-- src/lib.rs | 3 ++- src/world/connection.rs | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/bin/kawari-world.rs b/src/bin/kawari-world.rs index 13208aa..b7ee68e 100644 --- a/src/bin/kawari-world.rs +++ b/src/bin/kawari-world.rs @@ -689,7 +689,7 @@ async fn client_loop( // id == 0 means "all" if id == 0 { - for i in 1..231 { + for i in 1..239 { let (value, index) = value_to_flag_byte_index_value(i); if on { connection.player_data.aetherytes[index as usize] |= value; diff --git a/src/ipc/zone/player_setup.rs b/src/ipc/zone/player_setup.rs index 799f4df..94f2ac5 100644 --- a/src/ipc/zone/player_setup.rs +++ b/src/ipc/zone/player_setup.rs @@ -164,8 +164,8 @@ pub struct PlayerStatus { pub cleared_pvp: [u8; 5], // meh, this is where i put all of the new data - #[br(count = 160)] - #[bw(pad_size_to = 160)] + #[br(count = 159)] + #[bw(pad_size_to = 159)] pub unknown948: Vec, } diff --git a/src/lib.rs b/src/lib.rs index 6dd9cf1..6cb8d6a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -73,4 +73,5 @@ pub const OBFUSCATION_ENABLED_MODE: u8 = 41; pub const UNLOCK_BITMASK_SIZE: usize = 64; /// The size of the aetheryte unlock bitmask. -pub const AETHERYTE_UNLOCK_BITMASK_SIZE: usize = 29; +// TODO: this can be automatically derived from game data +pub const AETHERYTE_UNLOCK_BITMASK_SIZE: usize = 30; diff --git a/src/world/connection.rs b/src/world/connection.rs index 1a99aa7..931bb89 100644 --- a/src/world/connection.rs +++ b/src/world/connection.rs @@ -694,7 +694,7 @@ impl ZoneConnection { Task::UnlockAetheryte { id, on } => { let unlock_all = *id == 0; if unlock_all { - for i in 1..231 { + for i in 1..239 { let (value, index) = value_to_flag_byte_index_value(i); if *on { self.player_data.aetherytes[index as usize] |= value;