savestate: Take pokemon nickname padding into account
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
4593b45e2e
commit
e88529fe90
1 changed files with 3 additions and 2 deletions
|
@ -70,15 +70,16 @@ impl TryFrom<&[u8]> for PokemonList {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pokemon names x6
|
// Pokemon names x6
|
||||||
|
// Data seems to consist of 10 chars padded with 0x50 plus one 0x50 per pokémon.
|
||||||
let mut pk_nicks: Vec<PKString> = vec![];
|
let mut pk_nicks: Vec<PKString> = vec![];
|
||||||
let mut start = PARTY_PK_NAMES_OFFSET;
|
let mut start = PARTY_PK_NAMES_OFFSET;
|
||||||
for _ in 0..count {
|
for i in 1..=count {
|
||||||
let mut end = start + 1;
|
let mut end = start + 1;
|
||||||
while data[end] != 0x50 {
|
while data[end] != 0x50 {
|
||||||
end += 1;
|
end += 1;
|
||||||
}
|
}
|
||||||
pk_nicks.push(PKString::try_from(&data[start..end])?);
|
pk_nicks.push(PKString::try_from(&data[start..end])?);
|
||||||
start = end + 1;
|
start = PARTY_PK_NAMES_OFFSET + 11 * i;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now pokemon data.
|
// Now pokemon data.
|
||||||
|
|
Loading…
Reference in a new issue