2019-03-23 21:56:35 -04:00
|
|
|
|
using Mesen.GUI.Config;
|
|
|
|
|
using Mesen.GUI.Debugger.Controls;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Mesen.GUI.Debugger.Code
|
|
|
|
|
{
|
2019-04-07 12:25:14 -04:00
|
|
|
|
public class CpuLineStyleProvider : BaseStyleProvider
|
2019-03-23 21:56:35 -04:00
|
|
|
|
{
|
|
|
|
|
public CpuLineStyleProvider()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-07 12:25:14 -04:00
|
|
|
|
public override string GetLineComment(int lineNumber)
|
2019-03-23 21:56:35 -04:00
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void ConfigureActiveStatement(LineProperties props)
|
|
|
|
|
{
|
|
|
|
|
props.FgColor = Color.Black;
|
2019-03-31 09:11:56 -04:00
|
|
|
|
props.TextBgColor = ConfigManager.Config.Debug.Debugger.CodeActiveStatementColor;
|
2019-03-23 21:56:35 -04:00
|
|
|
|
props.Symbol |= LineSymbol.Arrow;
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-07 12:25:14 -04:00
|
|
|
|
public override LineProperties GetLineStyle(CodeLineData lineData, int lineIndex)
|
2019-03-23 21:56:35 -04:00
|
|
|
|
{
|
2019-03-31 09:11:56 -04:00
|
|
|
|
DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger;
|
2019-03-23 21:56:35 -04:00
|
|
|
|
LineProperties props = new LineProperties();
|
|
|
|
|
|
|
|
|
|
if(lineData.Address >= 0) {
|
|
|
|
|
GetBreakpointLineProperties(props, lineData.Address);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool isActiveStatement = ActiveAddress.HasValue && ActiveAddress.Value == lineData.Address;
|
|
|
|
|
if(isActiveStatement) {
|
|
|
|
|
ConfigureActiveStatement(props);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//TODO
|
|
|
|
|
/* else if(_code._code.UnexecutedAddresses.Contains(lineNumber)) {
|
|
|
|
|
props.LineBgColor = info.CodeUnexecutedCodeColor;
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
if(lineData.Flags.HasFlag(LineFlags.PrgRom)) {
|
|
|
|
|
props.AddressColor = Color.Gray;
|
|
|
|
|
} else if(lineData.Flags.HasFlag(LineFlags.WorkRam)) {
|
|
|
|
|
props.AddressColor = Color.DarkBlue;
|
|
|
|
|
} else if(lineData.Flags.HasFlag(LineFlags.SaveRam)) {
|
|
|
|
|
props.AddressColor = Color.DarkRed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(lineData.Flags.HasFlag(LineFlags.VerifiedData)) {
|
2019-03-31 09:11:56 -04:00
|
|
|
|
props.LineBgColor = cfg.CodeVerifiedDataColor;
|
2019-03-23 21:56:35 -04:00
|
|
|
|
} else if(!lineData.Flags.HasFlag(LineFlags.VerifiedCode)) {
|
2019-03-31 09:11:56 -04:00
|
|
|
|
props.LineBgColor = cfg.CodeUnidentifiedDataColor;
|
2019-03-23 21:56:35 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return props;
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-07 12:25:14 -04:00
|
|
|
|
public void GetBreakpointLineProperties(LineProperties props, int cpuAddress)
|
2019-03-23 21:56:35 -04:00
|
|
|
|
{
|
2019-03-31 09:11:56 -04:00
|
|
|
|
DebuggerInfo config = ConfigManager.Config.Debug.Debugger;
|
2019-03-23 21:56:35 -04:00
|
|
|
|
foreach(Breakpoint breakpoint in BreakpointManager.Breakpoints) {
|
|
|
|
|
if(breakpoint.Matches((uint)cpuAddress, SnesMemoryType.CpuMemory)) {
|
2019-04-07 12:25:14 -04:00
|
|
|
|
SetBreakpointLineProperties(props, breakpoint);
|
2019-03-23 21:56:35 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|