Skip to content

Commit

Permalink
Disassembler tool bar
Browse files Browse the repository at this point in the history
  • Loading branch information
drhelius committed Aug 10, 2024
1 parent 67b3580 commit 5ddc504
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 19 deletions.
11 changes: 11 additions & 0 deletions platforms/shared/desktop/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include "imgui/imgui.h"
#include "imgui/implot.h"
#include "imgui/fonts/RobotoMedium.h"
#include "imgui/fonts/MaterialIcons.h"
#include "imgui/fonts/IconsMaterialDesign.h"
#include "nfd/nfd.h"
#include "config.h"
#include "application.h"
Expand Down Expand Up @@ -73,6 +75,15 @@ void gui_init(void)

gui_roboto_font = io.Fonts->AddFontFromMemoryCompressedTTF(RobotoMedium_compressed_data, RobotoMedium_compressed_size, 17.0f * application_display_scale, NULL, io.Fonts->GetGlyphRangesCyrillic());

float iconFontSize = 20.0f;
static const ImWchar icons_ranges[] = { ICON_MIN_MD, ICON_MAX_16_MD, 0 };
ImFontConfig icons_config;
icons_config.MergeMode = true;
icons_config.PixelSnapH = true;
icons_config.GlyphMinAdvanceX = iconFontSize;
icons_config.GlyphOffset = { 0.0f, 5.0f };
gui_material_icons_font = io.Fonts->AddFontFromMemoryCompressedTTF(MaterialIcons_compressed_data, MaterialIcons_compressed_size, iconFontSize, &icons_config, icons_ranges);

ImFontConfig font_cfg;

for (int i = 0; i < 4; i++)
Expand Down
1 change: 1 addition & 0 deletions platforms/shared/desktop/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ EXTERN bool gui_main_menu_hovered;
EXTERN ImFont* gui_default_font;
EXTERN ImFont* gui_default_fonts[4];
EXTERN ImFont* gui_roboto_font;
EXTERN ImFont* gui_material_icons_font;
EXTERN int gui_main_window_width;
EXTERN int gui_main_window_height;
EXTERN int gui_main_menu_height;
Expand Down
77 changes: 60 additions & 17 deletions platforms/shared/desktop/gui_debug_disassembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "gui_debug_disassembler.h"

#include "imgui/imgui.h"
#include "imgui/fonts/IconsMaterialDesign.h"
#include "../../../src/geargrafx.h"
#include "gui_debug_constants.h"
#include "gui.h"
Expand Down Expand Up @@ -178,44 +179,88 @@ void gui_debug_window_disassembler(void)

static void show_controls(void)
{
if (ImGui::Button("Step Over"))
ImGui::PushFont(gui_material_icons_font);

if (ImGui::Button(ICON_MD_PLAY_ARROW))
{
emu_debug_continue();
}
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled))
{
ImGui::SetTooltip("Continue (F5)");
}

ImGui::SameLine();
if (ImGui::Button(ICON_MD_STOP))
{
emu_debug_break();
}
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled))
{
ImGui::SetTooltip("Break (F7)");
}

ImGui::SameLine();
if (ImGui::Button(ICON_MD_REDO))
{
emu_debug_step_over();
}
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled))
{
ImGui::SetTooltip("Step Over (F10)");
}

ImGui::SameLine();
if (ImGui::Button("Step Into"))
if (ImGui::Button(ICON_MD_FILE_DOWNLOAD))
{
emu_debug_step_into();
}
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled))
{
ImGui::SetTooltip("Step Into (F11)");
}

ImGui::SameLine();
if (ImGui::Button("Step Out"))
if (ImGui::Button(ICON_MD_FILE_UPLOAD))
{
emu_debug_step_out();
}
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled))
{
ImGui::SetTooltip("Step Out (Shift+F11)");
}

ImGui::SameLine();
if (ImGui::Button("Step Frame"))
if (ImGui::Button(ICON_MD_KEYBOARD_TAB))
{
emu_debug_step_frame();
gui_debug_runtocursor();
}
if (ImGui::Button("Break"))
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled))
{
emu_debug_break();
ImGui::SetTooltip("Run to Cursor (F8)");
}

ImGui::SameLine();
if (ImGui::Button("Continue"))
if (ImGui::Button(ICON_MD_INPUT))
{
emu_debug_continue();
emu_debug_step_frame();
}
ImGui::SameLine();
if (ImGui::Button("Run To Cursor"))
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled))
{
gui_debug_runtocursor();
ImGui::SetTooltip("Step Frame (F6)");
}

ImGui::SameLine();
if (ImGui::Button("Reset"))
if (ImGui::Button(ICON_MD_REPLAY))
{
emu_reset();
}
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled))
{
ImGui::SetTooltip("Reset (CTRL+R)");
}

ImGui::PopFont();

ImGui::Checkbox("Opcodes", &show_mem); ImGui::SameLine();
ImGui::Checkbox("Symbols", &show_symbols); ImGui::SameLine();
Expand All @@ -224,8 +269,6 @@ static void show_controls(void)

ImGui::Separator();

ImGui::Text("Go To Address: ");
ImGui::SameLine();
ImGui::PushItemWidth(45);
if (ImGui::InputTextWithHint("##goto_address", "XXXX", goto_address, IM_ARRAYSIZE(goto_address), ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_EnterReturnsTrue))
{
Expand All @@ -240,7 +283,7 @@ static void show_controls(void)
}
ImGui::PopItemWidth();
ImGui::SameLine();
if (ImGui::Button("Go", ImVec2(30, 0)))
if (ImGui::Button("Go To Address", ImVec2(120, 0)))
{
try
{
Expand All @@ -253,7 +296,7 @@ static void show_controls(void)
}

ImGui::SameLine();
if (ImGui::Button("Back", ImVec2(50, 0)))
if (ImGui::Button("Go Back", ImVec2(80, 0)))
{
goto_back_requested = true;
}
Expand Down
4 changes: 2 additions & 2 deletions platforms/shared/desktop/gui_menus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ static void menu_debug(void)
emu_debug_step_into();
}

if (ImGui::MenuItem("Step Out", "SHIFT + F11", (void*)0, config_debug.debug))
if (ImGui::MenuItem("Step Out", "SHIFT+F11", (void*)0, config_debug.debug))
{
emu_debug_step_out();
}
Expand All @@ -529,7 +529,7 @@ static void menu_debug(void)

ImGui::Separator();

if (ImGui::MenuItem("Go Back", "CTRL + BACKSPACE", (void*)0, config_debug.debug))
if (ImGui::MenuItem("Go Back", "CTRL+BACKSPACE", (void*)0, config_debug.debug))
{
gui_debug_go_back();
}
Expand Down

0 comments on commit 5ddc504

Please sign in to comment.