Skip to content

Commit

Permalink
update: updated App
Browse files Browse the repository at this point in the history
  • Loading branch information
yulmwu committed Sep 29, 2023
1 parent 6a004b8 commit bec83dd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions bin/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub struct App {
pub key_input: String,
pub settings: Settings,
pub window_visibility: WindowVisibility,
pub disassembled: Vec<(usize, String)>,
pub disassembled: Vec<(usize, String, String)>,
pub is_open_disassembler_window: bool,
}

Expand Down Expand Up @@ -103,7 +103,7 @@ impl eframe::App for App {

if self.is_open_disassembler_window {
Window::new("Disassembler")
.default_width(150.)
.default_width(250.)
.default_height(200.)
.default_pos((700., 100.))
.resizable(true)
Expand Down
8 changes: 6 additions & 2 deletions bin/src/ui/disassembler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,22 @@ impl View for DisassemblerUi {
ScrollArea::both()
.auto_shrink([false, true])
.show(ui, |ui| {
for (pointer, instruction) in app.disassembled.iter() {
for (pointer, bytes, instruction) in app.disassembled.iter() {
// ui.label(format!("0x{:04X}: {}", i + 0x8000, line));
let pointer = Label::new(
RichText::new(format!("0x{:04X}", pointer + 0x8000))
.monospace()
.color(Color32::from_rgb(50, 180, 80)),
);
let instruction = Label::new(RichText::new(instruction).monospace());
let bytes = Label::new(RichText::new(bytes).monospace());
let instruction =
Label::new(RichText::new(instruction).monospace().color(Color32::WHITE));

ui.horizontal(|ui| {
ui.add(pointer);
ui.separator();
ui.add(bytes);
ui.separator();
ui.add(instruction);
});

Expand Down
2 changes: 1 addition & 1 deletion bin/src/ui/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl View for MenuBar {
app.source_input = match disassemble(&binary) {
Ok(disassembled) => disassembled
.iter()
.map(|(_, i)| i.clone())
.map(|(_, _, i)| i.clone())
.collect::<Vec<_>>()
.join("\n"),
Err(e) => {
Expand Down

0 comments on commit bec83dd

Please sign in to comment.