From 304df96411d9d7d999b9837152d4c896943668ca Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Mon, 2 Dec 2024 23:40:05 -0500 Subject: [PATCH] Display decoded rlwinm info to hover tooltip (#141) * Fix missing dependency feature for objdiff-gui * Update .gitignore * Display decoded rlwinm info to hover tooltip * Remove trailing newline when displaying decoded rlwinm info * Change variable name * Also update variable name in rlwinm.rs --- .gitignore | 2 +- objdiff-gui/Cargo.toml | 2 +- objdiff-gui/src/views/function_diff.rs | 4 ++++ objdiff-gui/src/views/rlwinm.rs | 6 +++--- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index c46c7cc..e4a9258 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,4 @@ android.keystore *.frag *.vert *.metal -.vscode/launch.json +.vscode/ diff --git a/objdiff-gui/Cargo.toml b/objdiff-gui/Cargo.toml index aac8873..555872f 100644 --- a/objdiff-gui/Cargo.toml +++ b/objdiff-gui/Cargo.toml @@ -95,7 +95,7 @@ exec = "0.3" # native: [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -tracing-subscriber = "0.3" +tracing-subscriber = { version = "0.3", features = ["env-filter"] } # web: [target.'cfg(target_arch = "wasm32")'.dependencies] diff --git a/objdiff-gui/src/views/function_diff.rs b/objdiff-gui/src/views/function_diff.rs index dde736e..a412649 100644 --- a/objdiff-gui/src/views/function_diff.rs +++ b/objdiff-gui/src/views/function_diff.rs @@ -149,6 +149,10 @@ fn ins_hover_ui( ui.colored_label(appearance.highlight_color, "Extern".to_string()); } } + + if let Some(decoded) = rlwinmdec::decode(&ins.formatted) { + ui.colored_label(appearance.highlight_color, decoded.trim()); + } }); } diff --git a/objdiff-gui/src/views/rlwinm.rs b/objdiff-gui/src/views/rlwinm.rs index 08b9354..780708a 100644 --- a/objdiff-gui/src/views/rlwinm.rs +++ b/objdiff-gui/src/views/rlwinm.rs @@ -16,13 +16,13 @@ pub fn rlwinm_decode_window( egui::Window::new("Rlwinm Decoder").open(show).show(ctx, |ui| { ui.text_edit_singleline(&mut state.text); ui.add_space(10.0); - if let Some(demangled) = rlwinmdec::decode(&state.text) { + if let Some(decoded) = rlwinmdec::decode(&state.text) { ui.scope(|ui| { ui.style_mut().override_text_style = Some(TextStyle::Monospace); - ui.colored_label(appearance.replace_color, &demangled); + ui.colored_label(appearance.replace_color, decoded.trim()); }); if ui.button("Copy").clicked() { - ui.output_mut(|output| output.copied_text = demangled); + ui.output_mut(|output| output.copied_text = decoded); } } else { ui.scope(|ui| {