UI: Update PPC debugger to support dark mode

Might have to tweak the dark mode colors later if I notice some of them are odd choices.
This commit is contained in:
Crementif 2025-07-15 17:35:38 +02:00
parent 4e6bb67e01
commit 8b196cce68
12 changed files with 174 additions and 144 deletions

View file

@ -114,22 +114,10 @@ add_library(CemuWxGui
windows/TextureRelationViewer
windows/TextureRelationViewer/TextureRelationWindow.cpp
windows/TextureRelationViewer/TextureRelationWindow.h
wxcomponents/checked2.xpm
wxcomponents/checked_dis.xpm
wxcomponents/checked_d.xpm
wxcomponents/checked_ld.xpm
wxcomponents/checkedlistctrl.cpp
wxcomponents/checkedlistctrl.h
wxcomponents/checked_mo.xpm
wxcomponents/checked.xpm
wxcomponents/checktree.cpp
wxcomponents/checktree.h
wxcomponents/unchecked2.xpm
wxcomponents/unchecked_dis.xpm
wxcomponents/unchecked_d.xpm
wxcomponents/unchecked_ld.xpm
wxcomponents/unchecked_mo.xpm
wxcomponents/unchecked.xpm
wxgui.h
wxHelper.h
)

View file

@ -29,8 +29,6 @@ BreakpointWindow::BreakpointWindow(DebuggerWindow2& parent, const wxPoint& main_
: wxFrame(&parent, wxID_ANY, _("Breakpoints"), wxDefaultPosition, wxSize(420, 250), wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER | wxFRAME_FLOAT_ON_PARENT)
{
this->SetSizeHints(wxDefaultSize, wxDefaultSize);
this->wxWindowBase::SetBackgroundColour(*wxWHITE);
wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);

View file

@ -220,18 +220,22 @@ void DebuggerWindow2::CreateToolBar()
m_toolbar = wxFrame::CreateToolBar(wxTB_HORIZONTAL, wxID_ANY);
m_toolbar->SetToolBitmapSize(wxSize(16, 16));
m_toolbar->AddTool(TOOL_ID_GOTO, wxEmptyString, wxBITMAP_PNG_FROM_DATA(DEBUGGER_GOTO), wxNullBitmap, wxITEM_NORMAL, _("GoTo (CTRL + G)"), "test", NULL);
wxBitmap goto_bitmap = LoadThemedBitmapFromPNG(DEBUGGER_GOTO_png, sizeof(DEBUGGER_GOTO_png), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
m_toolbar->AddTool(TOOL_ID_GOTO, wxEmptyString, goto_bitmap, wxNullBitmap, wxITEM_NORMAL, _("GoTo (CTRL + G)"), "test", NULL);
m_toolbar->AddSeparator();
m_toolbar->AddTool(TOOL_ID_BP, wxEmptyString, wxBITMAP_PNG_FROM_DATA(DEBUGGER_BP_RED), wxNullBitmap, wxITEM_NORMAL, _("Toggle Breakpoint (F9)"), wxEmptyString, NULL);
wxBitmap bp_bitmap = LoadThemedBitmapFromPNG(DEBUGGER_BP_RED_png, sizeof(DEBUGGER_BP_RED_png), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
m_toolbar->AddTool(TOOL_ID_BP, wxEmptyString, bp_bitmap, wxNullBitmap, wxITEM_NORMAL, _("Toggle Breakpoint (F9)"), wxEmptyString, NULL);
m_toolbar->AddSeparator();
m_pause = wxBITMAP_PNG_FROM_DATA(DEBUGGER_PAUSE);
m_run = wxBITMAP_PNG_FROM_DATA(DEBUGGER_PLAY);
m_pause = LoadThemedBitmapFromPNG(DEBUGGER_PAUSE_png, sizeof(DEBUGGER_PAUSE_png), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
m_run = LoadThemedBitmapFromPNG(DEBUGGER_PLAY_png, sizeof(DEBUGGER_PLAY_png), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
m_toolbar->AddTool(TOOL_ID_PAUSE, wxEmptyString, m_pause, wxNullBitmap, wxITEM_NORMAL, _("Break (F5)"), wxEmptyString, NULL);
m_toolbar->AddTool(TOOL_ID_STEP_INTO, wxEmptyString, wxBITMAP_PNG_FROM_DATA(DEBUGGER_STEP_INTO), wxNullBitmap, wxITEM_NORMAL, _("Step Into (F11)"), wxEmptyString, NULL);
m_toolbar->AddTool(TOOL_ID_STEP_OVER, wxEmptyString, wxBITMAP_PNG_FROM_DATA(DEBUGGER_STEP_OVER), wxNullBitmap, wxITEM_NORMAL, _("Step Over (F10)"), wxEmptyString, NULL);
wxBitmap step_into_bitmap = LoadThemedBitmapFromPNG(DEBUGGER_STEP_INTO_png, sizeof(DEBUGGER_STEP_INTO_png), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
wxBitmap step_over_bitmap = LoadThemedBitmapFromPNG(DEBUGGER_STEP_OVER_png, sizeof(DEBUGGER_STEP_OVER_png), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
m_toolbar->AddTool(TOOL_ID_STEP_INTO, wxEmptyString, step_into_bitmap, wxNullBitmap, wxITEM_NORMAL, _("Step Into (F11)"), wxEmptyString, NULL);
m_toolbar->AddTool(TOOL_ID_STEP_OVER, wxEmptyString, step_over_bitmap, wxNullBitmap, wxITEM_NORMAL, _("Step Over (F10)"), wxEmptyString, NULL);
m_toolbar->AddSeparator();
m_toolbar->Realize();
@ -272,8 +276,6 @@ DebuggerWindow2::DebuggerWindow2(wxFrame& parent, const wxRect& display_size)
{
g_debuggerDispatcher.SetDebuggerCallbacks(this);
this->wxWindowBase::SetBackgroundColour(*wxWHITE);
const auto file = ActiveSettings::GetConfigPath("debugger/config.xml");
m_config.SetFilename(file.generic_wstring());
m_config.Load();
@ -311,7 +313,6 @@ DebuggerWindow2::DebuggerWindow2(wxFrame& parent, const wxRect& display_size)
}
m_module_label = new wxStaticText(this, wxID_ANY, label_text);
m_module_label->SetBackgroundColour(*wxWHITE);
m_module_label->SetForegroundColour(wxColour(0xFFbf52fe));
main_sizer->Add(m_module_label, 0, wxEXPAND | wxALL, 5);

View file

@ -8,6 +8,7 @@
#include <wx/bitmap.h>
#include <wx/frame.h>
#include <wx/mstream.h>
class BreakpointWindow;
class RegisterWindow;
@ -56,6 +57,14 @@ struct DebuggerModuleStorage
};
typedef XMLDataConfig<DebuggerModuleStorage> XMLDebuggerModuleConfig;
static wxBitmap LoadThemedBitmapFromPNG(const uint8* data, size_t size, const wxColour& tint)
{
wxMemoryInputStream strm(data, size);
wxImage img(strm, wxBITMAP_TYPE_PNG);
img.Replace(0x00, 0x00, 0x00, tint.Red(), tint.Green(), tint.Blue());
return wxBitmap(img);
}
class DebuggerWindow2 : public wxFrame, public DebuggerCallbacks
{
public:

View file

@ -18,29 +18,8 @@ wxDEFINE_EVENT(wxEVT_DISASMCTRL_NOTIFY_GOTO_ADDRESS, wxCommandEvent);
#define MAX_SYMBOL_LEN (120)
#define COLOR_DEBUG_ACTIVE_BP 0xFFFFA0FF
#define COLOR_DEBUG_ACTIVE 0xFFFFA080
#define COLOR_DEBUG_BP 0xFF8080FF
#define SYNTAX_COLOR_GPR 0xFF000066
#define SYNTAX_COLOR_FPR 0xFF006666
#define SYNTAX_COLOR_SPR 0xFF666600
#define SYNTAX_COLOR_CR 0xFF666600
#define SYNTAX_COLOR_IMM 0xFF006600
#define SYNTAX_COLOR_IMM_OFFSET 0xFF006600
#define SYNTAX_COLOR_CIMM 0xFF880000
#define SYNTAX_COLOR_PSEUDO 0xFFA0A0A0 // color for pseudo code
#define SYNTAX_COLOR_SYMBOL 0xFF0000A0 // color for function symbol
#define OFFSET_ADDRESS (60)
#define OFFSET_ADDRESS_RELATIVE (90)
#define OFFSET_DISASSEMBLY (300)
#define OFFSET_DISASSEMBLY_OPERAND (80)
wxBitmap* g_ipArrowBitmap = nullptr;
uint8 _arrowRightPNG[] =
constexpr uint8 arrowRightPNG[] =
{
0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x0B,
@ -59,17 +38,91 @@ uint8 _arrowRightPNG[] =
0x73, 0x8D, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE,
0x42, 0x60, 0x82
};
std::optional<wxBitmap> g_ipArrowBitmap;
static wxColour theme_foreground;
static wxColour theme_foregroundMuted;
static wxColour theme_background;
static wxColour theme_addressBreakpointHit;
static wxColour theme_lineBreakpointHit;
static wxColour theme_addressCurrentInstruction;
static wxColour theme_lineCurrentInstruction;
static wxColour theme_addressBreakpointSet;
static wxColour theme_lineBreakpointSet;
static wxColour theme_addressLoggingBreakpointSet;
static wxColour theme_lineLoggingBreakpointSet;
static wxColour theme_syntaxGPR;
static wxColour theme_syntaxFPR;
static wxColour theme_syntaxSPR;
static wxColour theme_syntaxCR;
static wxColour theme_syntaxIMM;
static wxColour theme_syntaxIMMOffset;
static wxColour theme_syntaxCallIMM;
static wxColour theme_syntaxPseudoOrUnknown;
static wxColour theme_syntaxSymbol;
static wxColour theme_opCode;
static wxColour theme_typeData;
static wxColour theme_patchedOpCode;
static wxColour theme_patchedData;
static void InitSyntaxColors()
{
theme_foreground = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
theme_foregroundMuted = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT);
theme_background = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
// addresses
theme_addressBreakpointSet = wxSystemSettings::SelectLightDark(0xFFCCFFCC, 0xFF006600);
theme_addressBreakpointHit = wxSystemSettings::SelectLightDark(0xFF80A0FF, 0xFF004080);
// line backgrounds
theme_lineBreakpointSet = wxSystemSettings::SelectLightDark(0xFF8080FF, 0xFF004080); // red-ish for normal breakpoints
theme_lineBreakpointHit = wxSystemSettings::SelectLightDark(0xFFFFA0FF, 0xFF800080); // yellow-ish for hit breakpoints
theme_lineCurrentInstruction = wxSystemSettings::SelectLightDark(0xFF80A0FF, 0xFF004080); // pink-ish for current instruction
theme_lineLoggingBreakpointSet = wxSystemSettings::SelectLightDark(0x80FFFFFF, 0xFF808080); // baby blue-ish for logging breakpoints
theme_syntaxGPR = wxSystemSettings::SelectLightDark(0xFF000066, 0xFF66A0FF);
theme_syntaxFPR = wxSystemSettings::SelectLightDark(0xFF006666, 0xFF66FFFF);
theme_syntaxSPR = wxSystemSettings::SelectLightDark(0xFF666600, 0xFFFFCC66);
theme_syntaxCR = wxSystemSettings::SelectLightDark(0xFF666600, 0xFFFFCC66);
theme_syntaxIMM = wxSystemSettings::SelectLightDark(0xFF006600, 0xFF66FF66);
theme_syntaxIMMOffset = wxSystemSettings::SelectLightDark(0xFF006600, 0xFF66FF66);
theme_syntaxCallIMM = wxSystemSettings::SelectLightDark(0xFF880000, 0xFFFF6666);
theme_syntaxPseudoOrUnknown = wxSystemSettings::SelectLightDark(0xFFA0A0A0, 0xFF808080); // color for pseudo code
theme_syntaxSymbol = wxSystemSettings::SelectLightDark(0xFF0000A0, 0xFF66A0FF); // color for function symbol
theme_opCode = wxSystemSettings::SelectLightDark(0xFF4000FF, 0xFF8000FF); // orange for opcodes
theme_patchedOpCode = wxSystemSettings::SelectLightDark(0xFF2020FF, 0xFF006600); // light green for patched instructions
theme_typeData = wxSystemSettings::SelectLightDark(0xFF4000FF, 0xFF8000FF); // orange for .long, .int etc.
theme_patchedData = wxSystemSettings::SelectLightDark(0xFF2020FF, 0xFF0000FF); // bright red for patched data
// theme the current instruction pointer arrow
wxMemoryInputStream strm(arrowRightPNG, sizeof(arrowRightPNG));
g_ipArrowBitmap = LoadThemedBitmapFromPNG(arrowRightPNG, sizeof(arrowRightPNG), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
}
#define OFFSET_ADDRESS (60)
#define OFFSET_ADDRESS_RELATIVE (90)
#define OFFSET_DISASSEMBLY (300)
#define OFFSET_DISASSEMBLY_OPERAND (80)
DisasmCtrl::DisasmCtrl(wxWindow* parent, const wxWindowID& id, const wxPoint& pos, const wxSize& size, long style)
: TextList(parent, id, pos, size, style), m_mouse_line(-1), m_mouse_line_drawn(-1), m_active_line(-1)
{
Init();
if (!g_ipArrowBitmap)
if (!g_ipArrowBitmap.has_value())
{
wxMemoryInputStream strm(_arrowRightPNG, sizeof(_arrowRightPNG));
wxImage img(strm, wxBITMAP_TYPE_PNG);
g_ipArrowBitmap = new wxBitmap(img);
InitSyntaxColors();
}
auto tooltip_sizer = new wxBoxSizer(wxVERTICAL);
@ -106,8 +159,8 @@ void DisasmCtrl::SelectCodeRegion(uint32 newAddress)
// update line tracking
sint32 element_count = currentCodeRegionEnd - currentCodeRegionStart;
if (element_count <= 0x00010000)
element_count = 0x00010000;
// if (element_count <= 0x00010000)
// element_count = 0x00010000;
if (this->SetElementCount(element_count / 4))
{
@ -146,23 +199,23 @@ void DisasmCtrl::DrawDisassemblyLine(wxDC& dc, const wxPoint& linePosition, MPTR
// write virtual address
wxColour background_colour;
if (is_active_bp && bp != nullptr)
background_colour = wxColour(0xFFFFA0FF);
background_colour = theme_lineBreakpointHit;
else if (is_active_bp)
background_colour = wxColour(0xFF80A0FF);
background_colour = theme_lineCurrentInstruction;
else if (bp != nullptr)
background_colour = wxColour(bp->bpType == DEBUGGER_BP_T_NORMAL ? 0xFF8080FF : 0x80FFFFFF);
background_colour = bp->bpType == DEBUGGER_BP_T_NORMAL ? theme_lineBreakpointSet : theme_lineLoggingBreakpointSet;
else if(virtualAddress == m_lastGotoTarget)
background_colour = wxColour(0xFFE0E0E0);
background_colour = theme_lineCurrentInstruction.ChangeLightness(220);
else
background_colour = wxColour(COLOR_WHITE);
background_colour = wxColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
DrawLineBackground(dc, position, background_colour);
dc.SetTextForeground(COLOR_BLACK);
dc.SetTextForeground(theme_foreground);
dc.DrawText(wxString::Format("%08x", virtualAddress), position);
position.x += OFFSET_ADDRESS;
dc.SetTextForeground(COLOR_GREY);
dc.SetTextForeground(theme_foregroundMuted);
if (rplModule)
dc.DrawText(wxString::Format("+0x%-8x", virtualAddress - rplModule->regionMappingBase_text.GetMPTR()), position);
else
@ -178,29 +231,29 @@ void DisasmCtrl::DrawDisassemblyLine(wxDC& dc, const wxPoint& linePosition, MPTR
auto debugSymbolDataType = DebugSymbolStorage::GetDataType(virtualAddress);
if (debugSymbolDataType == DEBUG_SYMBOL_TYPE::FLOAT)
{
dc.SetTextForeground(hasPatch ? wxColour(0xFF2020FF) : wxColour(0xFF400000));
dc.SetTextForeground(hasPatch ? theme_patchedData : theme_syntaxIMM);
dc.DrawText(fmt::format(".float"), position);
position.x += OFFSET_DISASSEMBLY_OPERAND;
dc.SetTextForeground(hasPatch ? wxColour(0xFF2020FF) : wxColour(SYNTAX_COLOR_IMM));
dc.SetTextForeground(hasPatch ? theme_patchedData : theme_syntaxIMM);
dc.DrawText(fmt::format("{}", memory_readFloat(virtualAddress)), position);
return;
}
else if (debugSymbolDataType == DEBUG_SYMBOL_TYPE::U32)
{
dc.SetTextForeground(hasPatch ? wxColour(0xFF2020FF) : wxColour(0xFF400000));
dc.SetTextForeground(hasPatch ? theme_patchedData : theme_syntaxIMM);
dc.DrawText(fmt::format(".uint"), position);
position.x += OFFSET_DISASSEMBLY_OPERAND;
dc.SetTextForeground(hasPatch ? wxColour(0xFF2020FF) : wxColour(SYNTAX_COLOR_IMM));
dc.SetTextForeground(hasPatch ? theme_patchedData : theme_syntaxIMM);
dc.DrawText(fmt::format("{}", memory_readU32(virtualAddress)), position);
return;
}
sint32 start_width = position.x;
dc.SetTextForeground(hasPatch ? wxColour(0xFF2020FF) : wxColour(0xFF400000));
dc.SetTextForeground(hasPatch ? theme_patchedOpCode : theme_opCode);
char opName[32];
strcpy(opName, ppcAssembler_getInstructionName(disasmInstr.ppcAsmCode));
std::transform(opName, opName + sizeof(opName), opName, tolower);
@ -221,7 +274,7 @@ void DisasmCtrl::DrawDisassemblyLine(wxDC& dc, const wxPoint& linePosition, MPTR
if (disasmInstr.ppcAsmCode == PPCASM_OP_UKN)
{
// show raw bytes
WriteText(dc, wxString::Format("%02x %02x %02x %02x", (opcode >> 24) & 0xFF, (opcode >> 16) & 0xFF, (opcode >> 8) & 0xFF, (opcode >> 0) & 0xFF), position, SYNTAX_COLOR_PSEUDO);
WriteText(dc, wxString::Format("%02x %02x %02x %02x", (opcode >> 24) & 0xFF, (opcode >> 16) & 0xFF, (opcode >> 8) & 0xFF, (opcode >> 0) & 0xFF), position, theme_syntaxPseudoOrUnknown);
}
bool is_first_operand = true;
@ -231,25 +284,25 @@ void DisasmCtrl::DrawDisassemblyLine(wxDC& dc, const wxPoint& linePosition, MPTR
continue;
if (!is_first_operand)
WriteText(dc, ", ", position, COLOR_BLACK);
WriteText(dc, ", ", position, theme_foreground);
is_first_operand = false;
switch (disasmInstr.operand[o].type)
{
case PPCASM_OPERAND_TYPE_GPR:
WriteText(dc, wxString::Format("r%d", disasmInstr.operand[o].registerIndex), position, SYNTAX_COLOR_GPR);
WriteText(dc, wxString::Format("r%d", disasmInstr.operand[o].registerIndex), position, theme_syntaxGPR);
break;
case PPCASM_OPERAND_TYPE_FPR:
WriteText(dc, wxString::Format("f%d", disasmInstr.operand[o].registerIndex), position, SYNTAX_COLOR_FPR);
WriteText(dc, wxString::Format("f%d", disasmInstr.operand[o].registerIndex), position, theme_syntaxFPR);
break;
case PPCASM_OPERAND_TYPE_SPR:
WriteText(dc, wxString::Format("spr%d", disasmInstr.operand[o].registerIndex), position, SYNTAX_COLOR_SPR);
WriteText(dc, wxString::Format("spr%d", disasmInstr.operand[o].registerIndex), position, theme_syntaxSPR);
break;
case PPCASM_OPERAND_TYPE_CR:
WriteText(dc, wxString::Format("cr%d", disasmInstr.operand[o].registerIndex), position, SYNTAX_COLOR_CR);
WriteText(dc, wxString::Format("cr%d", disasmInstr.operand[o].registerIndex), position, theme_syntaxCR);
break;
case PPCASM_OPERAND_TYPE_IMM:
@ -280,16 +333,15 @@ void DisasmCtrl::DrawDisassemblyLine(wxDC& dc, const wxPoint& linePosition, MPTR
string = wxString::Format("0x%x", uImm);
}
WriteText(dc, string, position, SYNTAX_COLOR_IMM);
WriteText(dc, string, position, theme_syntaxIMM);
break;
}
case PPCASM_OPERAND_TYPE_PSQMODE:
{
if (disasmInstr.operand[o].immS32)
WriteText(dc, "single", position, SYNTAX_COLOR_IMM);
WriteText(dc, "single", position, theme_syntaxIMM);
else
WriteText(dc, "paired", position, SYNTAX_COLOR_IMM);
WriteText(dc, "paired", position, theme_syntaxIMM);
break;
}
case PPCASM_OPERAND_TYPE_CIMM:
@ -322,7 +374,7 @@ void DisasmCtrl::DrawDisassemblyLine(wxDC& dc, const wxPoint& linePosition, MPTR
string = wxString::Format("0x%08x", disasmInstr.operand[o].immU32);
}
WriteText(dc, string, position, SYNTAX_COLOR_CIMM);
WriteText(dc, string, position, theme_syntaxCallIMM);
if (disasmInstr.ppcAsmCode != PPCASM_OP_BL)
{
@ -332,7 +384,7 @@ void DisasmCtrl::DrawDisassemblyLine(wxDC& dc, const wxPoint& linePosition, MPTR
else
x.Append(wxUniChar(0x2193)); // arrow down
WriteText(dc, x, position, COLOR_BLACK);
WriteText(dc, x, position, theme_foreground);
}
break;
@ -346,12 +398,12 @@ void DisasmCtrl::DrawDisassemblyLine(wxDC& dc, const wxPoint& linePosition, MPTR
else
string = wxString::Format("-0x%x", -disasmInstr.operand[o].immS32);
WriteText(dc, string, position, SYNTAX_COLOR_IMM_OFFSET);
WriteText(dc, "(", position, COLOR_BLACK);
WriteText(dc, string, position, theme_syntaxIMMOffset);
WriteText(dc, "(", position, theme_foreground);
// register
WriteText(dc, wxString::Format("r%d", disasmInstr.operand[o].registerIndex), position, SYNTAX_COLOR_GPR);
WriteText(dc, ")", position, COLOR_BLACK);
WriteText(dc, wxString::Format("r%d", disasmInstr.operand[o].registerIndex), position, theme_syntaxGPR);
WriteText(dc, ")", position, theme_foreground);
break;
}
default:
@ -363,7 +415,7 @@ void DisasmCtrl::DrawDisassemblyLine(wxDC& dc, const wxPoint& linePosition, MPTR
position.x = start_width + OFFSET_DISASSEMBLY;
const auto comment = static_cast<rplDebugSymbolComment*>(rplDebugSymbol_getForAddress(virtualAddress));
if (comment && comment->type == RplDebugSymbolComment)
WriteText(dc, comment->comment, position, COLOR_BLACK);
WriteText(dc, comment->comment, position, theme_foreground);
else if (isRLWINM)
{
sint32 rS, rA, SH, MB, ME;
@ -384,7 +436,7 @@ void DisasmCtrl::DrawDisassemblyLine(wxDC& dc, const wxPoint& linePosition, MPTR
string = wxString::Format("r%d=r%d>>%d", rA, rS, 32 - SH);
else
string = wxString::Format("r%d=(r%d<<<%d)&0x%x", rA, rS, SH, mask);
WriteText(dc, string, position, COLOR_GREY);
WriteText(dc, string, position, theme_foregroundMuted);
}
else if (disasmInstr.ppcAsmCode == PPCASM_OP_SUBF || disasmInstr.ppcAsmCode == PPCASM_OP_SUBF_)
{
@ -395,7 +447,7 @@ void DisasmCtrl::DrawDisassemblyLine(wxDC& dc, const wxPoint& linePosition, MPTR
wxString string;
string = wxString::Format("r%d=r%d-r%d", rD, rB, rA);
WriteText(dc, string, position, COLOR_GREY);
WriteText(dc, string, position, theme_foregroundMuted);
}
}
@ -408,7 +460,7 @@ void DisasmCtrl::DrawLabelName(wxDC& dc, const wxPoint& linePosition, MPTR virtu
symbol_string.Append("..:");
}
wxPoint tmpPos(linePosition);
WriteText(dc, symbol_string, tmpPos, SYNTAX_COLOR_SYMBOL);
WriteText(dc, symbol_string, tmpPos, theme_syntaxSymbol);
}
void DisasmCtrl::OnDraw(wxDC& dc, sint32 start, sint32 count, const wxPoint& start_position)

View file

@ -30,8 +30,6 @@ public:
void CenterOffset(uint32 offset);
void GoToAddressDialog();
protected:
void OnDraw(wxDC& dc, sint32 start, sint32 count, const wxPoint& start_position) override;
void OnMouseMove(const wxPoint& position, uint32 line) override;

View file

@ -7,31 +7,11 @@
#include "Cemu/ExpressionParser/ExpressionParser.h"
#define COLOR_BLACK 0xFF000000
#define COLOR_GREY 0xFFA0A0A0
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_DEBUG_ACTIVE_BP 0xFFFFA0FF
#define COLOR_DEBUG_ACTIVE 0xFFFFA080
#define COLOR_DEBUG_BP 0xFF8080FF
#define SYNTAX_COLOR_GPR 0xFF000066
#define SYNTAX_COLOR_FPR 0xFF006666
#define SYNTAX_COLOR_SPR 0xFF666600
#define SYNTAX_COLOR_CR 0xFF666600
#define SYNTAX_COLOR_IMM 0xFF006600
#define SYNTAX_COLOR_IMM_OFFSET 0xFF006600
#define SYNTAX_COLOR_CIMM 0xFF880000
#define SYNTAX_COLOR_PSEUDO 0xFFA0A0A0 // color for pseudo code
#define SYNTAX_COLOR_SYMBOL 0xFF0000A0 // color for function symbol
#define OFFSET_ADDRESS (60)
#define OFFSET_ADDRESS_RELATIVE (90)
#define OFFSET_MEMORY (450)
#define OFFSET_DISASSEMBLY_OPERAND (80)
DumpCtrl::DumpCtrl(wxWindow* parent, const wxWindowID& id, const wxPoint& pos, const wxSize& size, long style)
: TextList(parent, id, pos, size, style)
{
@ -68,11 +48,11 @@ void DumpCtrl::OnDraw(wxDC& dc, sint32 start, sint32 count, const wxPoint& start
{
const uint32 virtual_address = m_memoryRegion.baseAddress + (start + i) * 0x10;
dc.SetTextForeground(wxColour(COLOR_BLACK));
dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
dc.DrawText(wxString::Format("%08x", virtual_address), position);
position.x += OFFSET_ADDRESS;
dc.SetTextForeground(wxColour(COLOR_GREY));
dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT));
if (currentCodeRPL)
{
dc.DrawText(wxString::Format("+0x%-8x", virtual_address - currentCodeRPL->regionMappingBase_text.GetMPTR()), position);
@ -110,7 +90,7 @@ void DumpCtrl::OnDraw(wxDC& dc, sint32 start, sint32 count, const wxPoint& start
position.x += (m_char_width * 3);
}
position.x = start_width = OFFSET_MEMORY;
dc.SetTextForeground(wxColour(COLOR_BLACK));
dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
for (auto b : data)
{
if (isprint(b))
@ -144,7 +124,7 @@ void DumpCtrl::OnDraw(wxDC& dc, sint32 start, sint32 count, const wxPoint& start
start_position.y
);
wxPoint line_to(line_from.x, line_from.y + m_line_height * (count + 1));
dc.SetPen(*wxLIGHT_GREY_PEN);
dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTIONTEXT));
for (sint32 i = 0; i < 3; i++)
{
dc.DrawLine(line_from, line_to);

View file

@ -17,8 +17,6 @@ enum
DumpWindow::DumpWindow(DebuggerWindow2& parent, const wxPoint& main_position, const wxSize& main_size)
: wxFrame(&parent, wxID_ANY, _("Memory Dump"), wxDefaultPosition, wxSize(600, 250), wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER | wxFRAME_FLOAT_ON_PARENT)
{
this->wxWindowBase::SetBackgroundColour(*wxWHITE);
wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
m_dump_ctrl = new DumpCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxScrolledWindowStyle);
main_sizer->Add(m_dump_ctrl, 1, wxEXPAND);

View file

@ -23,7 +23,7 @@ ModuleWindow::ModuleWindow(DebuggerWindow2& parent, const wxPoint& main_position
{
this->SetSizeHints(wxDefaultSize, wxDefaultSize);
this->wxWindowBase::SetBackgroundColour(*wxWHITE);
// this->wxWindowBase::SetBackgroundColour(*wxWHITE);
wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);

View file

@ -33,8 +33,8 @@ RegisterWindow::RegisterWindow(DebuggerWindow2& parent, const wxPoint& main_posi
{
SetSizeHints(wxDefaultSize, wxDefaultSize);
SetMaxSize({ 400, 975 });
wxWindowBase::SetBackgroundColour(*wxWHITE);
this->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
auto scrolled_win = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
@ -47,29 +47,33 @@ RegisterWindow::RegisterWindow(DebuggerWindow2& parent, const wxPoint& main_posi
{
gpr_sizer->Add(new wxStaticText(scrolled_win, wxID_ANY, wxString::Format("R%d", i)), 0, wxLEFT, 5);
auto value = new wxTextCtrl(scrolled_win, kRegisterValueR0 + i, wxString::Format("%08x", 0), wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxNO_BORDER);
value->SetBackgroundColour(*wxWHITE);
auto value = new wxTextCtrl(scrolled_win, kRegisterValueR0 + i, wxString::Format("%08x", 0), wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxNO_BORDER | wxTE_RICH2);
value->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
value->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
value->Bind(wxEVT_LEFT_DCLICK, &RegisterWindow::OnMouseDClickEvent, this);
//value->Bind(wxEVT_CONTEXT_MENU, &RegisterWindow::OnValueContextMenu, this);
gpr_sizer->Add(value, 0, wxLEFT|wxRIGHT, 5);
auto label = new wxTextCtrl(scrolled_win, kRegisterLabelR0 + i, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxNO_BORDER);
auto label = new wxTextCtrl(scrolled_win, kRegisterLabelR0 + i, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxNO_BORDER | wxTE_RICH2);
label->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
label->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
label->SetMinSize(wxSize(500, -1));
label->SetBackgroundColour(*wxWHITE);
gpr_sizer->Add(label, 0, wxEXPAND);
}
{
// LR
gpr_sizer->Add(new wxStaticText(scrolled_win, wxID_ANY, wxString::Format("LR")), 0, wxLEFT, 5);
auto value = new wxTextCtrl(scrolled_win, kRegisterValueLR, wxString::Format("%08x", 0), wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxNO_BORDER);
value->SetBackgroundColour(*wxWHITE);
auto value = new wxTextCtrl(scrolled_win, kRegisterValueLR, wxString::Format("%08x", 0), wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxNO_BORDER | wxTE_RICH2);
value->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
value->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
value->Bind(wxEVT_LEFT_DCLICK, &RegisterWindow::OnMouseDClickEvent, this);
//value->Bind(wxEVT_CONTEXT_MENU, &RegisterWindow::OnValueContextMenu, this);
gpr_sizer->Add(value, 0, wxLEFT | wxRIGHT, 5);
auto label = new wxTextCtrl(scrolled_win, kRegisterLabelLR, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxNO_BORDER);
auto label = new wxTextCtrl(scrolled_win, kRegisterLabelLR, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxNO_BORDER | wxTE_RICH2);
label->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
label->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
label->SetMinSize(wxSize(500, -1));
label->SetBackgroundColour(*wxWHITE);
gpr_sizer->Add(label, 0, wxEXPAND);
}
@ -84,13 +88,15 @@ RegisterWindow::RegisterWindow(DebuggerWindow2& parent, const wxPoint& main_posi
{
fp_sizer->Add(new wxStaticText(scrolled_win, wxID_ANY, wxString::Format("FP%d", i)), 0, wxLEFT, 5);
auto value0 = new wxTextCtrl(scrolled_win, kRegisterValueFPR0_0 + i, wxString::Format("%lf", 0.0), wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxNO_BORDER);
value0->SetBackgroundColour(*wxWHITE);
auto value0 = new wxTextCtrl(scrolled_win, kRegisterValueFPR0_0 + i, wxString::Format("%lf", 0.0), wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxNO_BORDER | wxTE_RICH2);
value0->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
value0->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
value0->Bind(wxEVT_LEFT_DCLICK, &RegisterWindow::OnMouseDClickEvent, this);
fp_sizer->Add(value0, 0, wxLEFT | wxRIGHT, 5);
auto value1 = new wxTextCtrl(scrolled_win, kRegisterValueFPR1_0 + i, wxString::Format("%lf", 0.0), wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxNO_BORDER);
value1->SetBackgroundColour(*wxWHITE);
auto value1 = new wxTextCtrl(scrolled_win, kRegisterValueFPR1_0 + i, wxString::Format("%lf", 0.0), wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxNO_BORDER | wxTE_RICH2);
value1->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
value1->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
value1->Bind(wxEVT_LEFT_DCLICK, &RegisterWindow::OnMouseDClickEvent, this);
fp_sizer->Add(value1, 0, wxLEFT | wxRIGHT, 5);
}
@ -102,8 +108,9 @@ RegisterWindow::RegisterWindow(DebuggerWindow2& parent, const wxPoint& main_posi
for (sint32 i = 0; i < 8; ++i)
{
cr_sizer->Add(new wxStaticText(scrolled_win, wxID_ANY, wxString::Format("CR%d", i)), 0, wxLEFT, 5);
auto value = new wxTextCtrl(scrolled_win, kRegisterValueCR0 + i, "-", wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxNO_BORDER);
value->SetBackgroundColour(*wxWHITE);
auto value = new wxTextCtrl(scrolled_win, kRegisterValueCR0 + i, "-", wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxNO_BORDER | wxTE_RICH2);
value->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
value->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
//value->Bind(wxEVT_CONTEXT_MENU, &RegisterWindow::OnValueContextMenu, this);
cr_sizer->Add(value, 0, wxRIGHT, 5);
}
@ -141,15 +148,15 @@ void RegisterWindow::UpdateIntegerRegister(wxTextCtrl* label, wxTextCtrl* value,
//const bool has_changed = register_value != m_prev_snapshot.gpr[i];
if (hasChanged)
value->SetForegroundColour(COLOR_RED);
else if (value->GetForegroundColour() != COLOR_BLACK)
value->SetForegroundColour(COLOR_BLACK);
value->SetForegroundColour(m_changed_color);
else if (value->GetForegroundColour() != wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT))
value->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
value->ChangeValue(wxString::Format("%08x", registerValue));
//const auto label = dynamic_cast<wxTextCtrl*>(GetWindowChild(kRegisterLabelR0 + i));
//wxASSERT(label);
label->SetForegroundColour(hasChanged ? COLOR_RED : COLOR_BLACK);
label->SetForegroundColour(hasChanged ? m_changed_color : wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
// check if address is a string
if (registerValue >= MEMORY_DATA_AREA_ADDR && registerValue < (MEMORY_DATA_AREA_ADDR + MEMORY_DATA_AREA_SIZE))
@ -257,9 +264,9 @@ void RegisterWindow::OnUpdateView()
const bool has_changed = register_value != m_prev_snapshot.fpr[i].fp0int;
if (has_changed)
value->SetForegroundColour(COLOR_RED);
else if (value->GetForegroundColour() != COLOR_BLACK)
value->SetForegroundColour(COLOR_BLACK);
value->SetForegroundColour(m_changed_color);
else if (value->GetForegroundColour() != wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT))
value->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
else
continue;
@ -278,9 +285,9 @@ void RegisterWindow::OnUpdateView()
const bool has_changed = register_value != m_prev_snapshot.fpr[i].fp1int;
if (has_changed)
value->SetForegroundColour(COLOR_RED);
else if (value->GetForegroundColour() != COLOR_BLACK)
value->SetForegroundColour(COLOR_BLACK);
value->SetForegroundColour(m_changed_color);
else if (value->GetForegroundColour() != wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT))
value->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
else
continue;
@ -301,9 +308,9 @@ void RegisterWindow::OnUpdateView()
const bool has_changed = !std::equal(cr_bits_ptr, cr_bits_ptr + 4, cr_bits_ptr_cmp);
if (has_changed)
value->SetForegroundColour(COLOR_RED);
else if (value->GetForegroundColour() != COLOR_BLACK)
value->SetForegroundColour(COLOR_BLACK);
value->SetForegroundColour(m_changed_color);
else if (value->GetForegroundColour() != wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT))
value->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
else
continue;

View file

@ -21,6 +21,7 @@ private:
PPCSnapshot m_prev_snapshot;
bool m_show_double_values;
wxColour m_changed_color = {0xFF0000FF};
wxTextCtrl* m_context_ctrl;
};

View file

@ -14,8 +14,6 @@ enum ItemColumns
SymbolWindow::SymbolWindow(DebuggerWindow2& parent, const wxPoint& main_position, const wxSize& main_size)
: wxFrame(&parent, wxID_ANY, _("Symbols"), wxDefaultPosition, wxSize(600, 250), wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER | wxFRAME_FLOAT_ON_PARENT)
{
this->wxWindowBase::SetBackgroundColour(*wxWHITE);
wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
m_symbol_ctrl = new SymbolListCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
main_sizer->Add(m_symbol_ctrl, 1, wxEXPAND);