mirror of
https://github.com/zeldaret/botw
synced 2026-05-23 06:54:18 -04:00
tools: Print a note when a U function actually exists and matches
Also fixes the function call check not being as strict as it should be and fixes several false positives in the function list
This commit is contained in:
@@ -15,6 +15,19 @@ pub enum Status {
|
||||
Library,
|
||||
}
|
||||
|
||||
impl Status {
|
||||
pub fn description(&self) -> &'static str {
|
||||
match &self {
|
||||
Status::Matching => "matching",
|
||||
Status::NonMatchingMinor => "non-matching (minor)",
|
||||
Status::NonMatchingMajor => "non-matching (major)",
|
||||
Status::NotDecompiled => "not decompiled",
|
||||
Status::Wip => "WIP",
|
||||
Status::Library => "library function",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Info {
|
||||
pub addr: u64,
|
||||
pub size: u32,
|
||||
@@ -145,7 +158,7 @@ pub fn make_known_function_map(functions: &[Info]) -> FxHashMap<u64, &Info> {
|
||||
FxHashMap::with_capacity_and_hasher(functions.len(), Default::default());
|
||||
|
||||
for function in functions {
|
||||
if !function.is_decompiled() {
|
||||
if function.name.is_empty() {
|
||||
continue;
|
||||
}
|
||||
known_functions.insert(function.addr, function);
|
||||
|
||||
@@ -27,13 +27,15 @@ fn check_function(
|
||||
decomp_symtab: &elf::SymbolTableByName,
|
||||
function: &functions::Info,
|
||||
) -> Result<bool> {
|
||||
if !function.is_decompiled() {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
let name = function.name.as_str();
|
||||
let decomp_fn = elf::get_function_by_name(&decomp_elf, &decomp_symtab, &name);
|
||||
|
||||
match function.status {
|
||||
Status::NotDecompiled if decomp_fn.is_err() => return Ok(true),
|
||||
Status::Library => return Ok(true),
|
||||
_ => (),
|
||||
}
|
||||
|
||||
if decomp_fn.is_err() {
|
||||
let error = decomp_fn.err().unwrap();
|
||||
ui::print_warning(&format!(
|
||||
@@ -79,7 +81,10 @@ fn check_function(
|
||||
}
|
||||
}
|
||||
|
||||
Status::NonMatchingMinor | Status::NonMatchingMajor | Status::Wip => {
|
||||
Status::NotDecompiled
|
||||
| Status::NonMatchingMinor
|
||||
| Status::NonMatchingMajor
|
||||
| Status::Wip => {
|
||||
let orig_fn = get_orig_fn()?;
|
||||
|
||||
let result = checker
|
||||
@@ -88,13 +93,14 @@ fn check_function(
|
||||
|
||||
if result.is_none() {
|
||||
ui::print_note(&format!(
|
||||
"function {} is marked as non-matching but matches",
|
||||
"function {} is marked as {} but matches",
|
||||
ui::format_symbol_name(name),
|
||||
function.status.description(),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Status::NotDecompiled | Status::Library => unreachable!(),
|
||||
Status::Library => unreachable!(),
|
||||
};
|
||||
|
||||
Ok(true)
|
||||
|
||||
Reference in New Issue
Block a user