diff --git a/README.md b/README.md index 27b1eb1..206b66d 100644 --- a/README.md +++ b/README.md @@ -272,6 +272,7 @@ msg-tool create -t | `yuris-ystb` | `yuris` | Yu-Ris YSTB(compiled script) file (.ybn) | ❌ | ❌ | ❌ | ❌ | ✔️ | ✔️ | ❌ | | | `yuris-txt` | `yuris` | Yu-Ris scenario text file (.txt) | ✔️ | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ | | | `yuris-ystl` | `yuris` | Yu-Ris YSTL(file list) file (.ybn) | ❌ | ❌ | ❌ | ❌ | ✔️ | ✔️ | ✔️ | | +| `yuris-yslb` | `yuris` | Yu-Ris YSLB(labels) file (.ybn) | ❌ | ❌ | ❌ | ❌ | ✔️ | ✔️ | ✔️ | | | Image Type | Feature Name | Name | Export | Import | Export Multiple | Import Multiple | Create | Remarks | |---|---|---|---|---|---|---|---|---| diff --git a/src/scripts/mod.rs b/src/scripts/mod.rs index 4c6f3d3..035e13d 100644 --- a/src/scripts/mod.rs +++ b/src/scripts/mod.rs @@ -190,6 +190,8 @@ lazy_static::lazy_static! { Box::new(yuris::img::ydg::YDGImageBuilder::new()), #[cfg(feature = "yuris")] Box::new(yuris::ystl::YSTLBuilder::new()), + #[cfg(feature = "yuris")] + Box::new(yuris::yslb::YSLBBuilder::new()), ]; /// A list of all script extensions. pub static ref ALL_EXTS: Vec = diff --git a/src/scripts/yuris/mod.rs b/src/scripts/yuris/mod.rs index d4984d1..cc3ba86 100644 --- a/src/scripts/yuris/mod.rs +++ b/src/scripts/yuris/mod.rs @@ -6,5 +6,6 @@ mod types; pub mod yscfg; pub mod yscm; pub mod yser; +pub mod yslb; pub mod ystb; pub mod ystl; diff --git a/src/scripts/yuris/yslb.rs b/src/scripts/yuris/yslb.rs new file mode 100644 index 0000000..3c6f6f3 --- /dev/null +++ b/src/scripts/yuris/yslb.rs @@ -0,0 +1,211 @@ +//!Yu-Ris YSLB(labels) file (.ybn) +use crate::ext::io::*; +use crate::scripts::base::*; +use crate::types::*; +use crate::utils::encoding::*; +use crate::utils::struct_pack::*; +use anyhow::Result; +use msg_tool_macro::*; +use serde::{Deserialize, Serialize}; +use std::io::{Read, Seek, Write}; + +#[derive(Debug, StructUnpack, StructPack, Deserialize, Serialize)] +struct Label { + #[pstring(u8)] + name: String, + id: u32, + offset: u32, + script_index: u16, + #[serde(skip)] + padding: u16, +} + +#[derive(Debug, StructUnpack, StructPack, Deserialize, Serialize)] +struct YSLBData { + version: u32, + #[serde(skip)] + num_labels: u32, + #[fvec = 0x100] + #[serde(skip)] + /// label_range_start_indexes[N] = index of first label with ID >= (N << 24) + label_range_start_indexes: Vec, + #[pack_vec_len(self.num_labels)] + #[unpack_vec_len(num_labels)] + labels: Vec