diff --git a/UI/ImDebugger/ImDebugger.cpp b/UI/ImDebugger/ImDebugger.cpp index 68b233fef8..520da9c502 100644 --- a/UI/ImDebugger/ImDebugger.cpp +++ b/UI/ImDebugger/ImDebugger.cpp @@ -100,9 +100,9 @@ void DrawSchedulerView(ImConfig &cfg) { ImGui::End(); } -void DrawRegisterView(MIPSDebugInterface *mipsDebug, bool *open) { +void DrawRegisterView(ImConfig &config, ImControl &control, MIPSDebugInterface *mipsDebug) { ImGui::SetNextWindowSize(ImVec2(320, 600), ImGuiCond_FirstUseEver); - if (!ImGui::Begin("Registers", open)) { + if (!ImGui::Begin("Registers", &config.regsOpen)) { ImGui::End(); return; } @@ -114,24 +114,30 @@ void DrawRegisterView(MIPSDebugInterface *mipsDebug, bool *open) { ImGui::TableSetupColumn("value", ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("value_i", ImGuiTableColumnFlags_WidthStretch); - auto gprLine = [&](const char *regname, int value) { + auto gprLine = [&](int index, const char *regname, int value) { ImGui::TableNextRow(); ImGui::TableNextColumn(); ImGui::TextUnformatted(regname); ImGui::TableNextColumn(); - ImGui::Text("%08x", value); + if (Memory::IsValid4AlignedAddress(value)) { + ImGui::PushID(index); + ImClickableAddress(value, control, index == MIPS_REG_RA ? ImCmd::SHOW_IN_CPU_DISASM : ImCmd::SHOW_IN_MEMORY_VIEWER); + ImGui::PopID(); + } else { + ImGui::Text("%08x", value); + } if (value >= -1000000 && value <= 1000000) { ImGui::TableSetColumnIndex(2); ImGui::Text("%d", value); } }; for (int i = 0; i < 32; i++) { - gprLine(mipsDebug->GetRegName(0, i).c_str(), mipsDebug->GetGPR32Value(i)); + gprLine(i, mipsDebug->GetRegName(0, i).c_str(), mipsDebug->GetGPR32Value(i)); } - gprLine("hi", mipsDebug->GetHi()); - gprLine("lo", mipsDebug->GetLo()); - gprLine("pc", mipsDebug->GetPC()); - gprLine("ll", mipsDebug->GetLLBit()); + gprLine(32, "hi", mipsDebug->GetHi()); + gprLine(33, "lo", mipsDebug->GetLo()); + gprLine(34, "pc", mipsDebug->GetPC()); + gprLine(35, "ll", mipsDebug->GetLLBit()); ImGui::EndTable(); } @@ -238,7 +244,7 @@ void WaitIDToString(WaitType waitType, SceUID waitID, char *buffer, size_t bufSi } -void DrawThreadView(ImConfig &cfg) { +void DrawThreadView(ImConfig &cfg, ImControl &control) { ImGui::SetNextWindowSize(ImVec2(420, 300), ImGuiCond_FirstUseEver); if (!ImGui::Begin("Threads", &cfg.threadsOpen)) { ImGui::End(); @@ -273,9 +279,9 @@ void DrawThreadView(ImConfig &cfg) { ImGui::OpenPopup("threadPopup"); } ImGui::TableNextColumn(); - ImGui::Text("%08x", thread.curPC); + ImClickableAddress(thread.curPC, control, ImCmd::SHOW_IN_CPU_DISASM); ImGui::TableNextColumn(); - ImGui::Text("%08x", thread.entrypoint); + ImClickableAddress(thread.entrypoint, control, ImCmd::SHOW_IN_CPU_DISASM); ImGui::TableNextColumn(); ImGui::Text("%d", thread.priority); ImGui::TableNextColumn(); @@ -997,7 +1003,7 @@ void ImDebugger::Frame(MIPSDebugInterface *mipsDebug, GPUDebugInterface *gpuDebu } if (cfg_.regsOpen) { - DrawRegisterView(mipsDebug, &cfg_.regsOpen); + DrawRegisterView(cfg_, control, mipsDebug); } if (cfg_.breakpointsOpen) { @@ -1017,7 +1023,7 @@ void ImDebugger::Frame(MIPSDebugInterface *mipsDebug, GPUDebugInterface *gpuDebu } if (cfg_.threadsOpen) { - DrawThreadView(cfg_); + DrawThreadView(cfg_, control); } if (cfg_.callstackOpen) { diff --git a/UI/ImDebugger/ImGe.cpp b/UI/ImDebugger/ImGe.cpp index 433b1a08b5..a6a450b588 100644 --- a/UI/ImDebugger/ImGe.cpp +++ b/UI/ImDebugger/ImGe.cpp @@ -331,6 +331,7 @@ void ImGeDebuggerWindow::Draw(ImConfig &cfg, ImControl &control, GPUDebugInterfa ImGui::SameLine(); ImClickableAddress(list.pc, control, ImCmd::SHOW_IN_GE_DISASM); ImGui::Text("StartPC:"); + ImGui::SameLine(); ImClickableAddress(list.startpc, control, ImCmd::SHOW_IN_GE_DISASM); ImGui::Text("Pending interrupt: %d", (int)list.pendingInterrupt); ImGui::Text("Stack depth: %d", (int)list.stackptr);