mirror of
https://github.com/lifegpc/msg-tool.git
synced 2026-06-06 21:08:48 +08:00
fix
This commit is contained in:
@@ -115,6 +115,9 @@ fn detect_script_type(buf: &[u8], buf_len: usize, _filename: &str) -> Option<&'s
|
||||
if buf_len >= 8 && buf.starts_with(b"CatScene") {
|
||||
return Some(&ScriptType::CatSystem);
|
||||
}
|
||||
if buf_len >= 4 && buf.starts_with(b"CSTL") {
|
||||
return Some(&ScriptType::CatSystemCstl);
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
|
||||
@@ -176,7 +176,13 @@ impl Script for CstlScript {
|
||||
if self.langs.is_empty() || self.data.is_empty() {
|
||||
return Err(anyhow::anyhow!("CSTL script has no languages or data"));
|
||||
}
|
||||
Ok(self.data[self.lang_index.unwrap_or(0)].clone())
|
||||
Ok(self.data[self.lang_index.unwrap_or(0)]
|
||||
.iter()
|
||||
.map(|m| Message {
|
||||
name: m.name.clone(),
|
||||
message: m.message.replace("\\n", "\n"),
|
||||
})
|
||||
.collect())
|
||||
}
|
||||
|
||||
fn import_messages<'a>(
|
||||
@@ -215,7 +221,7 @@ impl Script for CstlScript {
|
||||
mes = mes.replace(k, v);
|
||||
}
|
||||
}
|
||||
m.message = mes;
|
||||
m.message = mes.replace("\n", "\\n");
|
||||
}
|
||||
file.write_all(b"CSTL")?;
|
||||
file.write_u32(0)?; // unk
|
||||
|
||||
Reference in New Issue
Block a user