1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-06-30 11:47:45 +00:00

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
This commit is contained in:
Joshua Goins 2025-06-28 08:13:20 -04:00
parent d3647a4b3b
commit db2ee114a9
4 changed files with 6 additions and 5 deletions

View file

@ -689,7 +689,7 @@ async fn client_loop(
// id == 0 means "all" // id == 0 means "all"
if id == 0 { if id == 0 {
for i in 1..231 { for i in 1..239 {
let (value, index) = value_to_flag_byte_index_value(i); let (value, index) = value_to_flag_byte_index_value(i);
if on { if on {
connection.player_data.aetherytes[index as usize] |= value; connection.player_data.aetherytes[index as usize] |= value;

View file

@ -164,8 +164,8 @@ pub struct PlayerStatus {
pub cleared_pvp: [u8; 5], pub cleared_pvp: [u8; 5],
// meh, this is where i put all of the new data // meh, this is where i put all of the new data
#[br(count = 160)] #[br(count = 159)]
#[bw(pad_size_to = 160)] #[bw(pad_size_to = 159)]
pub unknown948: Vec<u8>, pub unknown948: Vec<u8>,
} }

View file

@ -73,4 +73,5 @@ pub const OBFUSCATION_ENABLED_MODE: u8 = 41;
pub const UNLOCK_BITMASK_SIZE: usize = 64; pub const UNLOCK_BITMASK_SIZE: usize = 64;
/// The size of the aetheryte unlock bitmask. /// 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;

View file

@ -694,7 +694,7 @@ impl ZoneConnection {
Task::UnlockAetheryte { id, on } => { Task::UnlockAetheryte { id, on } => {
let unlock_all = *id == 0; let unlock_all = *id == 0;
if unlock_all { if unlock_all {
for i in 1..231 { for i in 1..239 {
let (value, index) = value_to_flag_byte_index_value(i); let (value, index) = value_to_flag_byte_index_value(i);
if *on { if *on {
self.player_data.aetherytes[index as usize] |= value; self.player_data.aetherytes[index as usize] |= value;