mirror of
https://github.com/lifegpc/msg-tool.git
synced 2026-06-06 21:08:48 +08:00
Fix BGI Bp parse bug
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -805,7 +805,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "msg_tool"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"byteorder",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "msg_tool"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
edition = "2024"
|
||||
repository = "https://github.com/lifegpc/msg-tool"
|
||||
description = "A command-line tool for exporting, importing, packing, and unpacking script files."
|
||||
|
||||
@@ -73,10 +73,14 @@ impl BGIBpScript {
|
||||
}
|
||||
let mut last_instr_pos = 0;
|
||||
reader.seek(SeekFrom::Start(header_size as u64))?;
|
||||
for _ in 0..instr_size / 4 {
|
||||
let instr = reader.read_u32()?;
|
||||
let max_instr_len = reader.data.len() - 4;
|
||||
while reader.pos < max_instr_len {
|
||||
let instr = reader.cpeek_u32()?;
|
||||
if instr == 0x17 {
|
||||
last_instr_pos = reader.pos;
|
||||
reader.pos += 4;
|
||||
} else {
|
||||
reader.pos += 1;
|
||||
}
|
||||
}
|
||||
if last_instr_pos == 0 {
|
||||
|
||||
@@ -56,7 +56,7 @@ pub struct SrcXmlScript {
|
||||
|
||||
impl SrcXmlScript {
|
||||
/// Creates a new `SrcXmlScript` from the provided buffer and encoding.
|
||||
///
|
||||
///
|
||||
/// * `buf` - The buffer containing the XML data.
|
||||
/// * `encoding` - The encoding of the XML data.
|
||||
/// * `config` - Additional configuration options.
|
||||
|
||||
Reference in New Issue
Block a user