Skip to content

Commit

Permalink
fix: Skyjaguar breaks when put on store shelves
Browse files Browse the repository at this point in the history
close: #31
  • Loading branch information
progre committed Aug 8, 2024
1 parent 533ce90 commit eb068df
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion src-tauri/src/script/data/shop_items_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use super::{

pub fn parse(talk: &Talk) -> Result<(ShopItem, ShopItem, ShopItem)> {
let data = talk.as_bytes();
debug_assert_eq!(data.len(), 7 * 3);
let mut iter = (0..3)
.map(|i| i * 7)
.map(|x| ShopItem::from_bytes(&data[x..x + 7]));
Expand Down
7 changes: 6 additions & 1 deletion src-tauri/src/script/data/talk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ impl Talk {
Self(text.chars().map(|c| char_to_code[&c]).collect())
}

pub fn from_bytes(data: Vec<u8>) -> Self {
pub fn from_bytes(mut data: Vec<u8>) -> Self {
debug_assert_eq!(data.len(), 7 * 3);
// If the last datum is '<'(0x3c), parsing fails in the game.
// This happens only on the flag of SkyJaguar (0x33c).
if *data.last().unwrap() == b'<' {
data.push(b' ');
}
Self(data)
}

Expand Down

0 comments on commit eb068df

Please sign in to comment.