fixed multiple variable issues, added a way to view an ASX file
This commit is contained in:
parent
8f967fc172
commit
bf82ead8a8
4 changed files with 123 additions and 19 deletions
|
@ -1,6 +1,6 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
const ASXVERSION: [u8; 3] = [0,1,0];
|
||||
const ASXVERSION: [u8; 3] = [0,2,0];
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DecompiledFunction {
|
||||
|
@ -26,9 +26,11 @@ pub struct Variable {
|
|||
pub end: usize
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DecompiledData {
|
||||
pub functions: Vec<DecompiledFunction>,
|
||||
pub func_count: usize,
|
||||
pub version: String,
|
||||
}
|
||||
|
||||
pub fn operation_to_name(opcode: u8) -> String {
|
||||
|
@ -175,8 +177,10 @@ pub fn process(data: &Vec<u8>) -> DecompiledData {
|
|||
if data[0..3] != *"ASX".as_bytes() {
|
||||
panic!("Invalid ASX file header");
|
||||
}
|
||||
if data[3..6] != ASXVERSION {
|
||||
panic!("Unsupported ASX version");
|
||||
let ver = &data[3..6].to_vec();
|
||||
let ver_str: String = ver.iter().map(|b| b.to_string()).collect::<Vec<String>>().join(".");
|
||||
if *ver != ASXVERSION {
|
||||
panic!("Unsupported ASX version ({})", ver_str);
|
||||
}
|
||||
let func_count = read_be_num(&data[6..10]);
|
||||
let mut offset = 10;
|
||||
|
@ -188,5 +192,6 @@ pub fn process(data: &Vec<u8>) -> DecompiledData {
|
|||
return DecompiledData {
|
||||
functions: functions,
|
||||
func_count: func_count,
|
||||
version: ver_str,
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue