diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 2a91ee3..e37081e 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -47,6 +47,16 @@ version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" +[[package]] +name = "aotuv_lancer_vorbis_sys" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bc4fd1a61860d2f1198b60bedd30910eaffa978f1ee6214dfb24ac70d589225" +dependencies = [ + "cc", + "ogg_next_sys", +] + [[package]] name = "arbitrary" version = "1.4.2" @@ -2198,6 +2208,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" +[[package]] +name = "lewton" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "777b48df9aaab155475a83a7df3070395ea1ac6902f5cd062b8f2b028075c030" +dependencies = [ + "byteorder", + "ogg", + "tinyvec", +] + [[package]] name = "libappindicator" version = "0.9.0" @@ -2708,6 +2729,24 @@ dependencies = [ "objc2-foundation", ] +[[package]] +name = "ogg" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6951b4e8bf21c8193da321bcce9c9dd2e13c858fe078bf9054a288b419ae5d6e" +dependencies = [ + "byteorder", +] + +[[package]] +name = "ogg_next_sys" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2d7a48e247c2bb07e633aefb65a38648ea58c7eedd4e4408a5861721ab049b" +dependencies = [ + "cc", +] + [[package]] name = "once_cell" version = "1.21.4" @@ -3543,7 +3582,7 @@ dependencies = [ [[package]] name = "ritoshark" version = "0.1.0" -source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=2ed5554828764cf0ce9f3f426ed6352fea39578a#2ed5554828764cf0ce9f3f426ed6352fea39578a" +source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=24fe6b3#24fe6b3665edbf5b67977918571c8fa6769c74c2" dependencies = [ "rs_anim", "rs_audio", @@ -3565,7 +3604,7 @@ dependencies = [ [[package]] name = "rs_anim" version = "0.1.0" -source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=2ed5554828764cf0ce9f3f426ed6352fea39578a#2ed5554828764cf0ce9f3f426ed6352fea39578a" +source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=24fe6b3#24fe6b3665edbf5b67977918571c8fa6769c74c2" dependencies = [ "rs_hash", "rs_io", @@ -3576,16 +3615,19 @@ dependencies = [ [[package]] name = "rs_audio" version = "0.1.0" -source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=2ed5554828764cf0ce9f3f426ed6352fea39578a#2ed5554828764cf0ce9f3f426ed6352fea39578a" +source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=24fe6b3#24fe6b3665edbf5b67977918571c8fa6769c74c2" dependencies = [ + "lewton", + "ogg", "rs_io", "thiserror 2.0.18", + "vorbis_rs", ] [[package]] name = "rs_bin" version = "0.1.0" -source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=2ed5554828764cf0ce9f3f426ed6352fea39578a#2ed5554828764cf0ce9f3f426ed6352fea39578a" +source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=24fe6b3#24fe6b3665edbf5b67977918571c8fa6769c74c2" dependencies = [ "indexmap 2.14.0", "rs_hash", @@ -3597,12 +3639,12 @@ dependencies = [ [[package]] name = "rs_file" version = "0.1.0" -source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=2ed5554828764cf0ce9f3f426ed6352fea39578a#2ed5554828764cf0ce9f3f426ed6352fea39578a" +source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=24fe6b3#24fe6b3665edbf5b67977918571c8fa6769c74c2" [[package]] name = "rs_hash" version = "0.1.0" -source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=2ed5554828764cf0ce9f3f426ed6352fea39578a#2ed5554828764cf0ce9f3f426ed6352fea39578a" +source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=24fe6b3#24fe6b3665edbf5b67977918571c8fa6769c74c2" dependencies = [ "thiserror 2.0.18", "xxhash-rust", @@ -3611,7 +3653,7 @@ dependencies = [ [[package]] name = "rs_io" version = "0.1.0" -source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=2ed5554828764cf0ce9f3f426ed6352fea39578a#2ed5554828764cf0ce9f3f426ed6352fea39578a" +source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=24fe6b3#24fe6b3665edbf5b67977918571c8fa6769c74c2" dependencies = [ "memmap2", "rs_math", @@ -3621,7 +3663,7 @@ dependencies = [ [[package]] name = "rs_luabin" version = "0.1.0" -source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=2ed5554828764cf0ce9f3f426ed6352fea39578a#2ed5554828764cf0ce9f3f426ed6352fea39578a" +source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=24fe6b3#24fe6b3665edbf5b67977918571c8fa6769c74c2" dependencies = [ "rs_io", "thiserror 2.0.18", @@ -3630,7 +3672,7 @@ dependencies = [ [[package]] name = "rs_mapgeo" version = "0.1.0" -source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=2ed5554828764cf0ce9f3f426ed6352fea39578a#2ed5554828764cf0ce9f3f426ed6352fea39578a" +source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=24fe6b3#24fe6b3665edbf5b67977918571c8fa6769c74c2" dependencies = [ "rs_hash", "rs_io", @@ -3641,7 +3683,7 @@ dependencies = [ [[package]] name = "rs_math" version = "0.1.0" -source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=2ed5554828764cf0ce9f3f426ed6352fea39578a#2ed5554828764cf0ce9f3f426ed6352fea39578a" +source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=24fe6b3#24fe6b3665edbf5b67977918571c8fa6769c74c2" dependencies = [ "glam", ] @@ -3649,7 +3691,7 @@ dependencies = [ [[package]] name = "rs_mesh" version = "0.1.0" -source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=2ed5554828764cf0ce9f3f426ed6352fea39578a#2ed5554828764cf0ce9f3f426ed6352fea39578a" +source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=24fe6b3#24fe6b3665edbf5b67977918571c8fa6769c74c2" dependencies = [ "rs_io", "rs_math", @@ -3659,7 +3701,7 @@ dependencies = [ [[package]] name = "rs_rman" version = "0.1.0" -source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=2ed5554828764cf0ce9f3f426ed6352fea39578a#2ed5554828764cf0ce9f3f426ed6352fea39578a" +source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=24fe6b3#24fe6b3665edbf5b67977918571c8fa6769c74c2" dependencies = [ "rs_io", "thiserror 2.0.18", @@ -3669,7 +3711,7 @@ dependencies = [ [[package]] name = "rs_rst" version = "0.1.0" -source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=2ed5554828764cf0ce9f3f426ed6352fea39578a#2ed5554828764cf0ce9f3f426ed6352fea39578a" +source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=24fe6b3#24fe6b3665edbf5b67977918571c8fa6769c74c2" dependencies = [ "indexmap 2.14.0", "rs_hash", @@ -3680,7 +3722,7 @@ dependencies = [ [[package]] name = "rs_tex" version = "0.1.0" -source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=2ed5554828764cf0ce9f3f426ed6352fea39578a#2ed5554828764cf0ce9f3f426ed6352fea39578a" +source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=24fe6b3#24fe6b3665edbf5b67977918571c8fa6769c74c2" dependencies = [ "ddsfile", "image", @@ -3695,7 +3737,7 @@ dependencies = [ [[package]] name = "rs_troybin" version = "0.1.0" -source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=2ed5554828764cf0ce9f3f426ed6352fea39578a#2ed5554828764cf0ce9f3f426ed6352fea39578a" +source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=24fe6b3#24fe6b3665edbf5b67977918571c8fa6769c74c2" dependencies = [ "rs_hash", "rs_io", @@ -3705,7 +3747,7 @@ dependencies = [ [[package]] name = "rs_wad" version = "0.1.0" -source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=2ed5554828764cf0ce9f3f426ed6352fea39578a#2ed5554828764cf0ce9f3f426ed6352fea39578a" +source = "git+https://github.com/RitoShark/RitoShark-Crates?rev=24fe6b3#24fe6b3665edbf5b67977918571c8fa6769c74c2" dependencies = [ "flate2", "rs_hash", @@ -5473,6 +5515,20 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "vorbis_rs" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49c5da94d280f7a27e8c937e9b73df2da3e23a2583f48471fd8fb4c72f9c1933" +dependencies = [ + "aotuv_lancer_vorbis_sys", + "errno", + "getrandom 0.4.2", + "ogg_next_sys", + "thiserror 2.0.18", + "tinyvec", +] + [[package]] name = "vswhom" version = "0.1.0" diff --git a/src-tauri/crates/quartz-lib/Cargo.toml b/src-tauri/crates/quartz-lib/Cargo.toml index c1de839..57f73c7 100644 --- a/src-tauri/crates/quartz-lib/Cargo.toml +++ b/src-tauri/crates/quartz-lib/Cargo.toml @@ -52,10 +52,8 @@ image = { version = "0.25", default-features = false, features = ["png", "jpeg"] # Logging (macros only) tracing = "0.1" -# RitoShark crates — BIN/format handling + TEX decode. Pinned to a rev branched -# off d6af5ac (the rev Flint uses) that adds Wad::from_reader_toc + seek-per-chunk -# reads for lightweight WAD indexing/extraction (branch: wad-toc-seek). -ritoshark = { git = "https://github.com/RitoShark/RitoShark-Crates", rev = "2ed5554828764cf0ce9f3f426ed6352fea39578a", features = ["tex", "anim", "mesh"] } +# RitoShark crates — BIN/format handling + TEX decode. Same rev Flint pins. +ritoshark = { git = "https://github.com/RitoShark/RitoShark-Crates", rev = "24fe6b3", features = ["tex", "anim", "mesh"] } [dev-dependencies] # Scratch dirs for the live-install extraction tests (auto-removed on drop). diff --git a/src-tauri/crates/quartz-lib/src/bin/ritoshark_bridge.rs b/src-tauri/crates/quartz-lib/src/bin/ritoshark_bridge.rs index 9240b2e..0f435fe 100644 --- a/src-tauri/crates/quartz-lib/src/bin/ritoshark_bridge.rs +++ b/src-tauri/crates/quartz-lib/src/bin/ritoshark_bridge.rs @@ -144,7 +144,12 @@ pub fn write_bin(tree: &Bin) -> Result> { /// # Returns /// A String containing the ritobin text format with resolved names pub fn tree_to_text_with_hashes(tree: &Bin, hashes: &HashMapper) -> Result { - Ok(ritoshark::bin::to_text(tree, Some(hashes))) + /* `AnimationGraphData.mBlendDataTable` keys pack two clip hashes into a u64; + printed plainly they are meaningless 20-digit integers. `from_text` accepts + the readable `"From" -> "To"` form and the raw u64 alike, so every text→bin + path still round-trips whichever form the text carries. */ + let opts = ritoshark::bin::TextOptions { blend_keys: true }; + Ok(ritoshark::bin::to_text_with(tree, Some(hashes), &opts)) } /// Load BIN hashes from `hashes-bin.lmdb` (named DB `"bin"`, 4-byte BE keys). @@ -283,3 +288,51 @@ pub fn text_to_tree(text: &str) -> Result { ritoshark::bin::from_text(text, None) .map_err(|e| BinError(format!("Failed to parse text: {}", e))) } + +#[cfg(test)] +mod blend_text_tests { + use super::*; + use ritoshark::bin::{BinEntry, BinType, BinValue, BlendKey, BLEND_DATA_TABLE}; + use ritoshark::hash::fnv1a; + + #[test] + fn blend_keys_print_readable_and_round_trip() { + let resolved = BlendKey::from_names("Attack1", "Laugh").to_u64(); + let unresolved = ((fnv1a("Attack1") as u64) << 32) | 0xdead_beef; + let mut fields = indexmap::IndexMap::new(); + fields.insert( + BLEND_DATA_TABLE, + BinValue::Map { + key: BinType::U64, + value: BinType::F32, + entries: vec![ + (BinValue::U64(resolved), BinValue::F32(0.1)), + (BinValue::U64(unresolved), BinValue::F32(0.2)), + ], + }, + ); + let mut bin = Bin::new(); + bin.entries.push(BinEntry { + path_hash: 0x1, + class_hash: 0x2, + fields, + }); + + let mut mapper = HashMapper::new(); + mapper.insert(fnv1a("Attack1") as u64, "Attack1"); + mapper.insert(fnv1a("Laugh") as u64, "Laugh"); + + let text = tree_to_text_with_hashes(&bin, &mapper).unwrap(); + assert!( + text.contains("\"Attack1\" -> \"Laugh\""), + "resolved pair readable: {text}" + ); + assert!( + text.contains("\"Attack1\" -> 0xdeadbeef"), + "unresolved half stays hex: {text}" + ); + + let parsed = text_to_tree(&text).unwrap(); + assert_eq!(write_bin(&bin).unwrap(), write_bin(&parsed).unwrap()); + } +}