From 259f7c9b7d9da33591f1a6bf2ba83d2c68176a63 Mon Sep 17 00:00:00 2001 From: Souryo Date: Sat, 26 Nov 2016 14:16:25 -0500 Subject: [PATCH] Debugger: Display original C code as comments --- GUI.NET/Debugger/DbgImporter.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/GUI.NET/Debugger/DbgImporter.cs b/GUI.NET/Debugger/DbgImporter.cs index 8e912753..c2e6ba1d 100644 --- a/GUI.NET/Debugger/DbgImporter.cs +++ b/GUI.NET/Debugger/DbgImporter.cs @@ -37,7 +37,7 @@ namespace Mesen.GUI.Debugger private static Regex _asmFirstLineRegex = new Regex(";(.*)", RegexOptions.Compiled); private static Regex _asmPreviousLinesRegex = new Regex("^\\s*;(.*)", RegexOptions.Compiled); - private static Regex _cFirstLineRegex = new Regex("//(.*)", RegexOptions.Compiled); + private static Regex _cFirstLineRegex = new Regex("(.*)", RegexOptions.Compiled); private static Regex _cPreviousLinesRegex = new Regex("^\\s*//(.*)", RegexOptions.Compiled); private bool LoadSegments(string row) @@ -180,7 +180,7 @@ namespace Mesen.GUI.Debugger continue; } - bool isAsm = Path.GetExtension(_files[line.FileID].Name) == ".s"; + bool isAsm = Path.GetExtension(_files[line.FileID].Name).StartsWith(".s"); string comment = ""; for(int i = line.LineNumber; i >= 0; i--) { @@ -199,10 +199,11 @@ namespace Mesen.GUI.Debugger Match match = regex.Match(sourceCodeLine); if(match.Success) { + string matchedComment = match.Groups[1].Value.Replace("\t", " "); if(string.IsNullOrWhiteSpace(comment)) { - comment = match.Groups[1].Value; + comment = matchedComment; } else { - comment = match.Groups[1].Value + Environment.NewLine + comment; + comment = matchedComment + Environment.NewLine + comment; } } else if(i != line.LineNumber) { break;