Skip to content

Commit

Permalink
Update roead dep
Browse files Browse the repository at this point in the history
  • Loading branch information
GingerAvalanche committed Jan 19, 2023
1 parent 8e54b4e commit 8f644d1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ path-slash = "0.1.4"
parking_lot = "0.12.1"
pyo3 = { version = "0.16.5", features = ["extension-module", "anyhow"] }
rayon = "1.5.3"
roead = { features = ["yaml"], version = "0.18.2"}
roead = { features = ["yaml"], version = "0.19.0"}
rustc-hash = "1.1.0"
rstb = "0.3.2"
serde = { version = "1.0.144", features = ["derive"] }
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![feature(let_chains)]
#![deny(clippy::unwrap_used)]
#![feature(scoped_threads)]
pub mod manager;
pub mod mergers;
pub mod settings;
Expand Down
6 changes: 2 additions & 4 deletions src/mergers/maps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ impl MapUnit {
pack.get_data(&self.get_path())
.with_context(|| {
jstr!("Failed to read {&self.get_path()} from TitleBG.pack")
})?
.with_context(|| jstr!("{&self.get_path()} missing from TitleBG.pack"))?,
})?,
)?)?)
}
}
Expand All @@ -156,8 +155,7 @@ impl MapUnit {
pack.get_data(&self.get_path())
.with_context(|| {
jstr!("Failed to read {&self.get_path()} from TitleBG.pack")
})?
.with_context(|| jstr!("{&self.get_path()} missing from TitleBG.pack"))?,
})?,
)?)?)
}
}
Expand Down
13 changes: 4 additions & 9 deletions src/mergers/texts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,14 @@ pub fn diff_language(
.get_data(&message_path)
.with_context(|| {
jstr!("Failed to read {&message_path} from Bootup_{language}.pack")
})?
.with_context(|| jstr!("{&message_path} missing from Bootup_{language}.pack"))?,
})?,
)?)?;
let stock_message = Sarc::new(decompress(
stock_bootup
.get_data(&message_path)
.with_context(|| {
jstr!("Failed to read {&message_path} from Bootup_{language}.pack")
})?
.with_context(|| jstr!("{&message_path} missing from Bootup_{language}.pack"))?,
})?,
)?)?;
let diffs = mod_message
.files()
Expand All @@ -67,8 +65,6 @@ pub fn diff_language(
.with_context(|| jstr!("Invalid MSBT file: {&path}"))?;
if let Some(stock_text) = stock_message
.get_data(&path)
.ok()
.flatten()
.and_then(|data| Msyt::from_msbt_bytes(data).ok())
{
if mod_text == stock_text {
Expand Down Expand Up @@ -141,15 +137,14 @@ pub fn merge_language(
.get_data(&message_path)
.with_context(|| {
jstr!("Failed to read {&message_path} from Bootup_{language}.pack")
})?
.with_context(|| jstr!("{&message_path} missing from Bootup_{language}.pack"))?,
})?,
)?)?;
let mut new_message = SarcWriter::from(&stock_message);
let merged_files = diffs
.into_par_iter()
.map(|(file, diff)| -> Result<(String, Vec<u8>)> {
let file = file.replace("msyt", "msbt");
if let Ok(Some(stock_file)) = stock_message.get_data(&file) {
if let Some(stock_file) = stock_message.get_data(&file) {
let mut stock_text = Msyt::from_msbt_bytes(stock_file)?;
stock_text.entries.extend(diff.into_iter());
Ok((file, stock_text.into_msbt_bytes(endian)?))
Expand Down

0 comments on commit 8f644d1

Please sign in to comment.