Things to neat up that I noticed with Hazel <3
This commit is contained in:
@@ -14,28 +14,17 @@ bool Debugger::render() {
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Follow program counter:", &followPC);
|
||||
if(followPC)
|
||||
startAddr = core.cpu->GetRegs().oldPC - 64; // TODO: arbitrary???
|
||||
startAddr = core.cpu->GetRegs().pc - 128; // TODO: arbitrary???
|
||||
|
||||
if(ImGui::BeginTable("Disassembly", 3, ImGuiTableFlags_RowBg)) {
|
||||
ImGui::TableSetupColumn("Address");
|
||||
ImGui::TableSetupColumn("Mnemonic");
|
||||
ImGui::TableSetupColumn("Instruction");
|
||||
ImGui::TableSetupColumn("Comment");
|
||||
ImGui::TableHeadersRow();
|
||||
|
||||
for(u64 addr = startAddr; addr < startAddr + MAX_LINES_OF_DISASM * sizeof(u32); addr += sizeof(u32)) {
|
||||
auto disasm = core.cpu->Disassemble(addr);
|
||||
std::string op_str;
|
||||
for(int i = 0; i < 3; i++) {
|
||||
if(i < 2) {
|
||||
if(!disasm.ops[i].empty()) {
|
||||
op_str += disasm.ops[i];
|
||||
if(!disasm.ops[i+1].empty()) op_str += ", ";
|
||||
}
|
||||
} else {
|
||||
if(!disasm.ops[i].empty()) op_str += disasm.ops[i];
|
||||
}
|
||||
}
|
||||
auto isPc = addr == core.cpu->GetRegs().oldPC;
|
||||
auto disasm = Disassembler::GetInstance().Disassemble(addr);
|
||||
auto isPc = addr == core.cpu->GetRegs().pc;
|
||||
if(isPc) {
|
||||
ImGui::PushStyleColor(ImGuiCol_TableRowBg, 0x809a9ade);
|
||||
ImGui::PushStyleColor(ImGuiCol_TableRowBgAlt, 0x807777bf);
|
||||
@@ -45,9 +34,25 @@ bool Debugger::render() {
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
ImGui::TextColored(ImColor(0xffeaefb6), "%s", std::format("{:016X}:", disasm.address).c_str());
|
||||
ImGui::TableSetColumnIndex(1);
|
||||
ImGui::TextColored(ImColor(0xffcbf1ae), "%s", std::format("{} {}", disasm.mnemonic, op_str).c_str());
|
||||
ImGui::TextColored(ImColor(0xffcbf1ae), "%s", std::format("{} ", disasm.mnemonic).c_str());
|
||||
ImGui::SameLine(0, 0);
|
||||
for(int i = 0; i < 3; i++) {
|
||||
if(i < 2) {
|
||||
if(!disasm.ops[i].str.empty()) {
|
||||
std::string op_str = disasm.ops[i].str;
|
||||
if(!disasm.ops[i+1].str.empty()) op_str += ", ";
|
||||
ImGui::TextColored(ImColor(disasm.ops[i].color), "%s", op_str.c_str());
|
||||
ImGui::SameLine(0, 0);
|
||||
}
|
||||
} else {
|
||||
if(!disasm.ops[i].str.empty()) {
|
||||
ImGui::TextColored(ImColor(disasm.ops[i].color), "%s", disasm.ops[i].str.c_str());
|
||||
ImGui::SameLine(0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::TableSetColumnIndex(2);
|
||||
ImGui::TextColored(ImColor(0xff71efe5), "%s", std::format("{}", "// no comments for now!").c_str());
|
||||
ImGui::TextColored(ImColor(0xff71efe5), "%s", std::format("{}", disasm.comment).c_str());
|
||||
} else {
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
ImGui::TextColored(ImColor(0xffeaefb6), "????????????????");
|
||||
@@ -61,6 +66,11 @@ bool Debugger::render() {
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
}
|
||||
|
||||
if(ImGui::TableGetHoveredColumn() == 2) {
|
||||
// do the thing with the little fucking hover popup that shows the memory view
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
ImGui::End();
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
#include <EmuThread.hpp>
|
||||
#include <KaizenGui.hpp>
|
||||
|
||||
EmuThread::EmuThread(double &fps, RenderWidget &renderWidget,
|
||||
SettingsWindow &settings) noexcept :
|
||||
renderWidget(renderWidget), settings(settings), fps(fps) {}
|
||||
EmuThread::EmuThread(double &fps, SettingsWindow &settings) noexcept : settings(settings), fps(fps) {}
|
||||
|
||||
void EmuThread::run() const noexcept {
|
||||
n64::Core& core = n64::Core::GetInstance();
|
||||
@@ -45,9 +43,7 @@ void EmuThread::TogglePause() const noexcept {
|
||||
}
|
||||
|
||||
void EmuThread::Reset() const noexcept {
|
||||
n64::Core& core = n64::Core::GetInstance();
|
||||
core.Stop();
|
||||
core.LoadROM(core.rom);
|
||||
n64::Core::GetInstance().Reset();
|
||||
}
|
||||
|
||||
void EmuThread::Stop() const noexcept {
|
||||
|
||||
@@ -8,10 +8,9 @@ struct Core;
|
||||
}
|
||||
|
||||
class EmuThread final {
|
||||
RenderWidget &renderWidget;
|
||||
bool started = false;
|
||||
public:
|
||||
explicit EmuThread(double &, RenderWidget &, SettingsWindow &) noexcept;
|
||||
explicit EmuThread(double &, SettingsWindow &) noexcept;
|
||||
~EmuThread() = default;
|
||||
void run() const noexcept;
|
||||
void TogglePause() const noexcept;
|
||||
|
||||
Reference in New Issue
Block a user