diff --git a/savestate/src/party.rs b/savestate/src/party.rs index 05941aa..93d01e4 100644 --- a/savestate/src/party.rs +++ b/savestate/src/party.rs @@ -70,15 +70,16 @@ impl TryFrom<&[u8]> for PokemonList { } // Pokemon names x6 + // Data seems to consist of 10 chars padded with 0x50 plus one 0x50 per pokémon. let mut pk_nicks: Vec = vec![]; let mut start = PARTY_PK_NAMES_OFFSET; - for _ in 0..count { + for i in 1..=count { let mut end = start + 1; while data[end] != 0x50 { end += 1; } pk_nicks.push(PKString::try_from(&data[start..end])?); - start = end + 1; + start = PARTY_PK_NAMES_OFFSET + 11 * i; } // Now pokemon data.