parent
bfa926ebbf
commit
fdafe59e13
|
@ -19,8 +19,8 @@ pub fn detect_objects(obj: &mut ObjInfo) -> Result<()> {
|
|||
}
|
||||
let expected_size = match symbol.data_kind {
|
||||
ObjDataKind::Byte => 1,
|
||||
ObjDataKind::Byte2 => 2,
|
||||
ObjDataKind::Byte4 | ObjDataKind::Float => 4,
|
||||
ObjDataKind::Byte2 | ObjDataKind::Short => 2,
|
||||
ObjDataKind::Byte4 | ObjDataKind::Float | ObjDataKind::Int => 4,
|
||||
ObjDataKind::Byte8 | ObjDataKind::Double => 8,
|
||||
_ => 0,
|
||||
};
|
||||
|
|
|
@ -172,6 +172,8 @@ pub enum ObjDataKind {
|
|||
String16,
|
||||
StringTable,
|
||||
String16Table,
|
||||
Int,
|
||||
Short,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Eq, PartialEq)]
|
||||
|
|
|
@ -704,8 +704,8 @@ where W: Write + ?Sized {
|
|||
_ => {}
|
||||
}
|
||||
let chunk_size = match data_kind {
|
||||
ObjDataKind::Byte2 => 2,
|
||||
ObjDataKind::Unknown | ObjDataKind::Byte4 | ObjDataKind::Float => 4,
|
||||
ObjDataKind::Byte2 | ObjDataKind::Short => 2,
|
||||
ObjDataKind::Unknown | ObjDataKind::Byte4 | ObjDataKind::Float | ObjDataKind::Int => 4,
|
||||
ObjDataKind::Byte | ObjDataKind::Byte8 | ObjDataKind::Double => 8,
|
||||
ObjDataKind::String
|
||||
| ObjDataKind::String16
|
||||
|
@ -740,10 +740,18 @@ where W: Write + ?Sized {
|
|||
writeln!(w, "\t.float {data}")?;
|
||||
}
|
||||
}
|
||||
4 if data_kind == ObjDataKind::Int => {
|
||||
let data = i32::from_be_bytes(chunk.try_into().unwrap());
|
||||
writeln!(w, "\t.int {data}")?;
|
||||
}
|
||||
4 => {
|
||||
let data = u32::from_be_bytes(chunk.try_into().unwrap());
|
||||
writeln!(w, "\t.4byte {data:#010X}")?;
|
||||
}
|
||||
2 if data_kind == ObjDataKind::Short => {
|
||||
let data = i16::from_be_bytes(chunk.try_into().unwrap());
|
||||
writeln!(w, "\t.short {data}")?;
|
||||
}
|
||||
2 => {
|
||||
writeln!(w, "\t.2byte {:#06X}", u16::from_be_bytes(chunk.try_into().unwrap()))?;
|
||||
}
|
||||
|
|
|
@ -321,6 +321,8 @@ fn symbol_data_kind_to_str(kind: ObjDataKind) -> Option<&'static str> {
|
|||
ObjDataKind::String16 => Some("wstring"),
|
||||
ObjDataKind::StringTable => Some("string_table"),
|
||||
ObjDataKind::String16Table => Some("wstring_table"),
|
||||
ObjDataKind::Int => Some("int"),
|
||||
ObjDataKind::Short => Some("short"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -372,6 +374,8 @@ fn symbol_data_kind_from_str(s: &str) -> Option<ObjDataKind> {
|
|||
"wstring" => Some(ObjDataKind::String16),
|
||||
"string_table" => Some(ObjDataKind::StringTable),
|
||||
"wstring_table" => Some(ObjDataKind::String16Table),
|
||||
"int" => Some(ObjDataKind::Int),
|
||||
"short" => Some(ObjDataKind::Short),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue