Use the new ImClickableAddress in a few more places

This commit is contained in:
Henrik Rydgård committed 2024-12-11 10:26:56 +01:00
1 parent d9b92efd0e
commit 97cc0ec1b1
2 files changed
+21 -14

No files matched your search

+20 -14
View File
@@ -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) {