From 1f022e5c52124fe61f9054beef48260817e15fa2 Mon Sep 17 00:00:00 2001 From: Lucas Jenss Date: Sun, 14 Jan 2024 23:35:37 +0100 Subject: [PATCH] Show index and memory mode in debugger tooltip I'm currently trying to get started with reverse engineering SNES games, and as far as I could tell this information as not otherwise exposed, even though Mesen records it.:wq --- UI/Debugger/Utilities/CodeTooltipHelper.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/UI/Debugger/Utilities/CodeTooltipHelper.cs b/UI/Debugger/Utilities/CodeTooltipHelper.cs index e378cd729..fdc2a9f1b 100644 --- a/UI/Debugger/Utilities/CodeTooltipHelper.cs +++ b/UI/Debugger/Utilities/CodeTooltipHelper.cs @@ -191,14 +191,25 @@ private static DynamicTooltip GetMarginAddressTooltip(CpuType cpuType, CodeSegme items.AddEntry("Address", addressField, true); bool isCode = false; + bool indexMode8 = false; + bool memoryMode8 = false; if(address >= 0) { - isCode = DebugApi.GetCdlData((uint)address, 1, memType)[0].HasFlag(CdlFlags.Code); + var cdl = DebugApi.GetCdlData((uint)address, 1, memType)[0]; + isCode = cdl.HasFlag(CdlFlags.Code); + indexMode8 = cdl.HasFlag(CdlFlags.IndexMode8); + memoryMode8 = cdl.HasFlag(CdlFlags.MemoryMode8); } else if(seg.Data.AbsoluteAddress.Address >= 0) { - isCode = DebugApi.GetCdlData((uint)seg.Data.AbsoluteAddress.Address, 1, seg.Data.AbsoluteAddress.Type)[0].HasFlag(CdlFlags.Code); + var cdl = DebugApi.GetCdlData((uint)seg.Data.AbsoluteAddress.Address, 1, seg.Data.AbsoluteAddress.Type)[0]; + isCode = cdl.HasFlag(CdlFlags.Code); + indexMode8 = cdl.HasFlag(CdlFlags.IndexMode8); + memoryMode8 = cdl.HasFlag(CdlFlags.MemoryMode8); + } if(isCode) { items.AddEntry("Byte code", seg.Data.ByteCodeStr, true); + items.AddEntry("Index Mode", indexMode8 ? "8-bit" : "16-bit", true); + items.AddEntry("Memory Mode", memoryMode8 ? "8-bit" : "16-bit", true); } return new DynamicTooltip() { Items = items };