mirror of
https://github.com/lifegpc/msg-tool.git
synced 2026-07-08 01:31:53 +08:00
Fix disasm wrong offset calculate
This commit is contained in:
@@ -396,7 +396,7 @@ impl<'a> ECSExecutionImageDisassembler<'a> {
|
|||||||
self.addr
|
self.addr
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
let catch_addr = self.stream.read_u32()? + self.stream.pos as u32;
|
let catch_addr = self.stream.read_i32()? as i64 + self.stream.pos as i64;
|
||||||
self.line(&format!("Enter \"{}\" Try-Catch {:08x}", name, catch_addr))?;
|
self.line(&format!("Enter \"{}\" Try-Catch {:08x}", name, catch_addr))?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -408,14 +408,14 @@ impl<'a> ECSExecutionImageDisassembler<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn command_jump(&mut self) -> Result<()> {
|
fn command_jump(&mut self) -> Result<()> {
|
||||||
let target_addr = self.stream.read_u32()? as u64 + self.stream.pos as u64;
|
let target_addr = self.stream.read_i32()? as i64 + self.stream.pos as i64;
|
||||||
self.line(&format!("Jump {:08x}", target_addr))?;
|
self.line(&format!("Jump {:08x}", target_addr))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn command_cjump(&mut self) -> Result<()> {
|
fn command_cjump(&mut self) -> Result<()> {
|
||||||
let cond = self.stream.read_u8()?;
|
let cond = self.stream.read_u8()?;
|
||||||
let target_addr = self.stream.read_u32()? as u64 + self.stream.pos as u64;
|
let target_addr = self.stream.read_i32()? as i64 + self.stream.pos as i64;
|
||||||
self.line(&format!("CJump {} {:08x}", cond, target_addr))?;
|
self.line(&format!("CJump {} {:08x}", cond, target_addr))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ impl Script for CSXScript {
|
|||||||
fn custom_export(&self, filename: &std::path::Path, encoding: Encoding) -> Result<()> {
|
fn custom_export(&self, filename: &std::path::Path, encoding: Encoding) -> Result<()> {
|
||||||
if self.disasm {
|
if self.disasm {
|
||||||
let file = crate::utils::files::write_file(filename)?;
|
let file = crate::utils::files::write_file(filename)?;
|
||||||
|
let file = std::io::BufWriter::new(file);
|
||||||
self.img.disasm(Box::new(file))?;
|
self.img.disasm(Box::new(file))?;
|
||||||
} else {
|
} else {
|
||||||
let messages = self.img.export_all()?;
|
let messages = self.img.export_all()?;
|
||||||
|
|||||||
Reference in New Issue
Block a user