From 9c4dbca8e6aa1fa498286489971a75456d6208c6 Mon Sep 17 00:00:00 2001 From: Sour Date: Fri, 29 Dec 2017 13:08:43 -0500 Subject: [PATCH] Debugger: Disable find all reference on function list when address is not mapped --- GUI.NET/Debugger/Controls/ctrlFunctionList.cs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/GUI.NET/Debugger/Controls/ctrlFunctionList.cs b/GUI.NET/Debugger/Controls/ctrlFunctionList.cs index 4c5d6348..2e71f955 100644 --- a/GUI.NET/Debugger/Controls/ctrlFunctionList.cs +++ b/GUI.NET/Debugger/Controls/ctrlFunctionList.cs @@ -138,11 +138,14 @@ namespace Mesen.GUI.Debugger.Controls private void mnuFindOccurrences_Click(object sender, EventArgs e) { if(lstFunctions.SelectedItems.Count > 0) { - CodeLabel label = lstFunctions.SelectedItems[0].Tag as CodeLabel; - if(label != null) { - OnFindOccurrence?.Invoke(label.Label, null); - } else { - OnFindOccurrence?.Invoke("$" + ((int)lstFunctions.SelectedItems[0].SubItems[1].Tag).ToString("X4"), null); + int relativeAddress = (int)lstFunctions.SelectedItems[0].SubItems[1].Tag; + if(relativeAddress >= 0) { + CodeLabel label = lstFunctions.SelectedItems[0].Tag as CodeLabel; + if(label != null) { + OnFindOccurrence?.Invoke(label.Label, null); + } else { + OnFindOccurrence?.Invoke("$" + ((int)lstFunctions.SelectedItems[0].SubItems[1].Tag).ToString("X4"), null); + } } } } @@ -151,6 +154,12 @@ namespace Mesen.GUI.Debugger.Controls { mnuEditLabel.Enabled = lstFunctions.SelectedItems.Count == 1; mnuFindOccurrences.Enabled = lstFunctions.SelectedItems.Count == 1; + if(lstFunctions.SelectedItems.Count == 1) { + int relativeAddress = (int)lstFunctions.SelectedItems[0].SubItems[1].Tag; + if(relativeAddress < 0) { + mnuFindOccurrences.Enabled = false; + } + } } private void mnuAddBreakpoint_Click(object sender, EventArgs e)