Tooltip in comment now works!

This commit is contained in:
irisz64
2025-07-31 17:25:22 +02:00
parent 1d117bf96b
commit 79de6f20b6
4 changed files with 42 additions and 18 deletions

View File

@@ -67,33 +67,44 @@ void CommentFunc(s64, s64, Disassembler::DisassemblyResult& disasm) {
}
ImGui::TextColored(ImColor(0xff71efe5), "%s", std::format("{}", disasm.GetFormattedComment()).c_str());
if(!ImGui::BeginItemTooltip())
u64 vaddr = disasm.GetResolvedAddressFromComment();
if(vaddr == 0xFFFF'FFFF'FFFF'FFFFull)
return;
if(!ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal | ImGuiHoveredFlags_ForTooltip))
return;
if(!ImGui::BeginTooltip())
return;
ImGui::Text("%s", std::format("Memory contents @ 0x{:016X}", disasm.address).c_str());
ImGui::BeginTable("##memoryContents", 16);
for(int col = 0; col < 16; col++)
ImGui::Text("%s", std::format("Memory contents @ 0x{:016X}", vaddr).c_str());
if(!ImGui::BeginTable("##memoryContents", 16))
return;
for(u32 col = 0; col < 16; col++)
ImGui::TableSetupColumn(std::format("##hexCol{}", col).c_str());
ImGui::TableHeadersRow();
for(int row = 0; row < 16; row++) {
for(u32 row = 0; row < 16; row++) {
ImGui::TableNextRow();
for(int col = 0; col < 16; col+=4) {
for(u32 col = 0; col < 16; col+=4) {
u32 paddr;
if(!regs.cop0.MapVAddr(n64::Cop0::LOAD, disasm.GetResolvedAddressFromComment(), paddr))
if(!regs.cop0.MapVAddr(n64::Cop0::LOAD, vaddr+row*0x10+col, paddr))
continue;
u32 val = mem.Read<u32>(paddr);
ImGui::TableSetColumnIndex(col+0);
ImGui::Text("%02X", val >> 24);
ImGui::Text("%02X", (val >> 24) & 0xff);
ImGui::TableSetColumnIndex(col+1);
ImGui::Text("%02X", val >> 16);
ImGui::Text("%02X", (val >> 16) & 0xff);
ImGui::TableSetColumnIndex(col+2);
ImGui::Text("%02X", val >> 8);
ImGui::Text("%02X", (val >> 8) & 0xff);
ImGui::TableSetColumnIndex(col+3);
ImGui::Text("%02X", val >> 0);
ImGui::Text("%02X", (val >> 0) & 0xff);
}
}
@@ -112,7 +123,8 @@ bool Debugger::render() {
int step = 4, stepFast = 256;
static bool followPC = true;
ImGui::Begin("Debugger", &enabled);
if(!ImGui::Begin("Debugger", &enabled))
return false;
ImGui::BeginDisabled(followPC);
ImGui::InputScalar("Address", ImGuiDataType_S64, (void*)&startAddr, (void*)&step, (void*)&stepFast, "%016lX", ImGuiInputTextFlags_CharsHexadecimal);
@@ -134,7 +146,9 @@ bool Debugger::render() {
core.ToggleBreakpoint(startAddr);
}
ImGui::BeginTable("Disassembly", columns.size(), ImGuiTableFlags_SizingStretchSame | ImGuiTableFlags_Resizable | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV | ImGuiTableFlags_ContextMenuInBody);
if(!ImGui::BeginTable("Disassembly", columns.size(), ImGuiTableFlags_SizingStretchSame | ImGuiTableFlags_Resizable | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV | ImGuiTableFlags_ContextMenuInBody))
return false;
for(int i = 0; i < columns.size(); i++)
ImGui::TableSetupColumn(columns[i].name);