Skip to content

Commit

Permalink
Minor decompiler changes
Browse files Browse the repository at this point in the history
  • Loading branch information
FirowMD committed Jan 1, 2025
1 parent 0a80a8b commit 160d74b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions bytesto4t/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,10 @@ fn get_decompiled_info(app_data: State<Storage>) -> Result<String, String> {
return Err("Function index out of bounds".to_string());
}
let function = &functions[index];
Ok(format!("{}", decompile_function(&bytecode, &function)
.display(&bytecode, &hlbc_decompiler::fmt::FormatOptions::new(2))))
decompile_function(&bytecode, &function)
.map_err(|e| format!("Decompilation failed: {}", e))
.map(|decompiled| format!("{}", decompiled
.display(&bytecode, &hlbc_decompiler::fmt::FormatOptions::new(2))))
}
"class" => {
let types = &bytecode.types;
Expand All @@ -221,8 +223,10 @@ fn get_decompiled_info(app_data: State<Storage>) -> Result<String, String> {
let type_obj = &types[index];
match type_obj {
Type::Obj(obj) => {
Ok(format!("{}", decompile_class(&bytecode, obj)
.display(&bytecode, &hlbc_decompiler::fmt::FormatOptions::new(2))))
decompile_class(&bytecode, obj)
.map_err(|e| format!("Decompilation failed: {}", e))
.map(|decompiled| format!("{}", decompiled
.display(&bytecode, &hlbc_decompiler::fmt::FormatOptions::new(2))))
}
_ => Err("Type is not an object".to_string()),
}
Expand Down
2 changes: 1 addition & 1 deletion bytesto4t/src/lib/ViewDecompiler.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
{decompilerTitle}
</h3>
{#if functionName !== ""}
<h3 class="h3">
<h3 class="h3 truncate">
{functionName}
</h3>
{/if}
Expand Down

0 comments on commit 160d74b

Please sign in to comment.