Debugger: Code window display/highlighting changes + more flexibility in how to display data vs code + actions to "mark" bytes as data/code/unknown

This commit is contained in:
Sour 2018-01-03 18:48:16 -05:00
parent 1e76d25986
commit cdaba3ffe8
20 changed files with 1124 additions and 285 deletions

View File

@ -204,3 +204,11 @@ void CodeDataLogger::StripData(uint8_t *romBuffer, CdlStripFlag flag)
}
}
}
void CodeDataLogger::MarkPrgBytesAs(uint32_t start, uint32_t end, CdlPrgFlags type)
{
for(uint32_t i = start; i <= end; i++) {
_cdlData[i] = (_cdlData[i] & 0xFC) | (int)type;
}
_debugger->UpdateCdlCache();
}

View File

@ -8,6 +8,7 @@ class Debugger;
enum class CdlPrgFlags
{
None = 0x00,
Code = 0x01,
Data = 0x02,
IndirectCode = 0x10,
@ -79,4 +80,6 @@ public:
void GetCdlData(uint32_t offset, uint32_t length, DebugMemoryType memoryType, uint8_t* cdlData);
void StripData(uint8_t* romBuffer, CdlStripFlag flag);
void MarkPrgBytesAs(uint32_t start, uint32_t end, CdlPrgFlags type);
};

View File

@ -754,9 +754,6 @@ void Debugger::GenerateCodeOutput()
_disassemblerOutput.clear();
_disassemblerOutput.reserve(10000);
bool showEffectiveAddresses = CheckFlag(DebuggerFlags::ShowEffectiveAddresses);
bool showOnlyDiassembledCode = CheckFlag(DebuggerFlags::ShowOnlyDisassembledCode);
for(uint32_t i = 0; i < 0x10000; i += 0x100) {
//Merge all sequential ranges into 1 chunk
AddressTypeInfo startInfo, currentInfo, endInfo;
@ -776,7 +773,7 @@ void Debugger::GenerateCodeOutput()
i+=0x100;
GetAbsoluteAddressAndType(i + 0x100, &endInfo);
}
_disassemblerOutput += _disassembler->GetCode(startInfo, endAddr, startMemoryAddr, showEffectiveAddresses, showOnlyDiassembledCode, cpuState, _memoryManager, _labelManager);
_disassemblerOutput += _disassembler->GetCode(startInfo, endAddr, startMemoryAddr, cpuState, _memoryManager, _labelManager);
}
}
}

View File

@ -4,14 +4,17 @@
enum class DebuggerFlags
{
None = 0x00,
PpuPartialDraw = 0x01,
ShowEffectiveAddresses = 0x02,
ShowOnlyDisassembledCode = 0x04,
DisplayOpCodesInLowerCase = 0x08,
DisassembleEverything = 0x10,
DisassembleEverythingButData = 0x20,
BreakOnBrk = 0x40,
BreakOnUnofficialOpCode = 0x80,
DisplayOpCodesInLowerCase = 0x04,
BreakOnBrk = 0x08,
BreakOnUnofficialOpCode = 0x10,
DisassembleVerifiedData = 0x20,
DisassembleUnidentifiedData = 0x40,
ShowVerifiedData = 0x80,
ShowUnidentifiedData = 0x100,
};
enum class AddressType

View File

@ -330,12 +330,12 @@ static const char* hexTable[256] = {
};
static string emptyString;
void Disassembler::GetLine(string &out, string code, string comment, int32_t cpuAddress, int32_t absoluteAddress)
void Disassembler::GetLine(string &out, string code, string comment, int32_t cpuAddress, int32_t absoluteAddress, DataType dataType)
{
GetCodeLine(out, code, comment, cpuAddress, absoluteAddress, emptyString, emptyString, false, false);
GetCodeLine(out, code, comment, cpuAddress, absoluteAddress, emptyString, emptyString, dataType, false);
}
void Disassembler::GetCodeLine(string &out, string &code, string &comment, int32_t cpuAddress, int32_t absoluteAddress, string &byteCode, string &addressing, bool speculativeCode, bool isIndented)
void Disassembler::GetCodeLine(string &out, string &code, string &comment, int32_t cpuAddress, int32_t absoluteAddress, string &byteCode, string &addressing, DataType dataType, bool isIndented)
{
char buffer[1000];
int pos = 0;
@ -369,10 +369,19 @@ void Disassembler::GetCodeLine(string &out, string &code, string &comment, int32
//Fields:
//Flags | CpuAddress | AbsAddr | ByteCode | Code | Addressing | Comment
//
//Flags:
//1: Executed code
//2: Unidentified code/data
//4: Indented line
//8: Verified data
if(cpuAddress >= 0) {
if(speculativeCode) {
if(dataType == DataType::UnidentifiedData) {
writeChar(isIndented ? '6' : '2');
writeChar('\x1');
} else if(dataType == DataType::VerifiedData) {
writeChar(isIndented ? '9' : '8');
writeChar('\x1');
} else {
writeChar((_debugger->IsMarkedAsCode(cpuAddress) || absoluteAddress == -1) ? (isIndented ? '5' : '1') : (isIndented ? '4' : '0'));
writeChar('\x1');
@ -381,7 +390,11 @@ void Disassembler::GetCodeLine(string &out, string &code, string &comment, int32
writeHex(hexTable[cpuAddress & 0xFF]);
writeChar('\x1');
} else {
writeChar('1');
if(dataType == DataType::VerifiedData) {
writeChar('8');
} else {
writeChar(dataType == DataType::UnidentifiedData ? '2' : '0');
}
writeChar('\x1');
writeChar('\x1');
}
@ -418,25 +431,20 @@ void Disassembler::GetSubHeader(string &out, DisassemblyInfo *info, string &labe
{
if(info->IsSubEntryPoint()) {
if(label.empty()) {
GetLine(out);
GetLine(out, "__sub start__");
} else {
GetLine(out);
GetLine(out, "__" + label + "()__");
}
} else if(relativeAddr == resetVector) {
GetLine(out);
GetLine(out, "--reset--");
GetLine(out, "__reset__");
} else if(relativeAddr == irqVector) {
GetLine(out);
GetLine(out, "--irq--");
GetLine(out, "__irq__");
} else if(relativeAddr == nmiVector) {
GetLine(out);
GetLine(out, "--nmi--");
GetLine(out, "__nmi__");
}
}
string Disassembler::GetCode(AddressTypeInfo &addressInfo, uint32_t endAddr, uint16_t memoryAddr, bool showEffectiveAddresses, bool showOnlyDiassembledCode, State& cpuState, shared_ptr<MemoryManager> memoryManager, shared_ptr<LabelManager> labelManager)
string Disassembler::GetCode(AddressTypeInfo &addressInfo, uint32_t endAddr, uint16_t memoryAddr, State& cpuState, shared_ptr<MemoryManager> memoryManager, shared_ptr<LabelManager> labelManager)
{
string output;
output.reserve(10000000);
@ -445,6 +453,12 @@ string Disassembler::GetCode(AddressTypeInfo &addressInfo, uint32_t endAddr, uin
int32_t dbAbsoluteAddr = 0;
string dbBuffer;
bool showEffectiveAddresses = _debugger->CheckFlag(DebuggerFlags::ShowEffectiveAddresses);
bool disassembleVerifiedData = _debugger->CheckFlag(DebuggerFlags::DisassembleVerifiedData);
bool disassembleUnidentifiedData = _debugger->CheckFlag(DebuggerFlags::DisassembleUnidentifiedData);
bool showUnidentifiedData = _debugger->CheckFlag(DebuggerFlags::ShowUnidentifiedData);
bool showVerifiedData = _debugger->CheckFlag(DebuggerFlags::ShowVerifiedData);
uint16_t resetVector = memoryManager->DebugReadWord(CPU::ResetVector);
uint16_t nmiVector = memoryManager->DebugReadWord(CPU::NMIVector);
uint16_t irqVector = memoryManager->DebugReadWord(CPU::IRQVector);
@ -453,60 +467,74 @@ string Disassembler::GetCode(AddressTypeInfo &addressInfo, uint32_t endAddr, uin
uint8_t *source;
uint32_t mask = addressInfo.Type == AddressType::InternalRam ? 0x7FF : 0xFFFFFFFF;
uint32_t size;
uint8_t* internalRam = _memoryManager->GetInternalRAM();
GetInfo(addressInfo, &source, size, &cache);
string unknownBlockHeader = showOnlyDiassembledCode ? "----" : "__unknown block__";
uint32_t addr = addressInfo.Address;
uint32_t byteCount = 0;
bool skippingCode = false;
bool insideDataBlock = false;
shared_ptr<CodeDataLogger> cdl = _debugger->GetCodeDataLogger();
string label;
string commentString;
string commentLines;
shared_ptr<DisassemblyInfo> infoRef;
DisassemblyInfo* info;
bool speculativeCode;
DataType dataType;
string spaces = " ";
string effAddress;
string code;
string byteCode;
bool isVerifiedData;
bool inVerifiedDataBlock = false;
bool emptyBlock = false;
auto outputBytes = [this, &inVerifiedDataBlock, &output, &dbBuffer, &dbRelativeAddr, &dbAbsoluteAddr, &byteCount]() {
if(byteCount > 0) {
GetLine(output, dbBuffer, "", dbRelativeAddr, dbAbsoluteAddr, inVerifiedDataBlock ? DataType::VerifiedData : DataType::UnidentifiedData);
byteCount = 0;
}
};
auto endDataBlock = [this, outputBytes, &inVerifiedDataBlock, &emptyBlock, &output, &addr, &insideDataBlock, &memoryAddr]() {
outputBytes();
if(emptyBlock) {
GetLine(output, "", "", -1, -1, inVerifiedDataBlock ? DataType::VerifiedData : DataType::UnidentifiedData);
}
GetLine(output, "----", "", emptyBlock ? (uint16_t)(memoryAddr - 1) : -1, emptyBlock ? addr - 1 : -1, inVerifiedDataBlock ? DataType::VerifiedData : DataType::UnidentifiedData);
insideDataBlock = false;
};
while(addr <= endAddr) {
labelManager->GetLabelAndComment(memoryAddr, label, commentString);
commentLines.clear();
speculativeCode = false;
if(commentString.find_first_of('\n') != string::npos) {
for(string &str : StringUtilities::Split(commentString, '\n')) {
GetLine(commentLines, "", str);
GetLine(commentLines, "", str, -1, -1, dataType);
}
commentString.clear();
}
infoRef = (*cache)[addr&mask];
isVerifiedData = addressInfo.Type == AddressType::PrgRom && cdl->IsData(addr&mask);
info = infoRef.get();
if(!info && (_debugger->CheckFlag(DebuggerFlags::DisassembleEverything) || _debugger->CheckFlag(DebuggerFlags::DisassembleEverythingButData) && !cdl->IsData(addr))) {
speculativeCode = true;
if(!info && (disassembleUnidentifiedData && !isVerifiedData || disassembleVerifiedData && isVerifiedData)) {
dataType = isVerifiedData ? DataType::VerifiedData : DataType::UnidentifiedData;
info = new DisassemblyInfo(source + (addr & mask), false);
} else if(info) {
dataType = DataType::VerifiedCode;
}
if(info && addr + info->GetSize() <= endAddr) {
if(byteCount > 0) {
GetLine(output, dbBuffer, "", dbRelativeAddr, dbAbsoluteAddr);
byteCount = 0;
}
if(skippingCode) {
GetLine(output, unknownBlockHeader, "", (uint16_t)(memoryAddr - 1), addr - 1);
skippingCode = false;
if(info && addr + info->GetSize() <= endAddr + 1) {
if(insideDataBlock) {
endDataBlock();
}
GetSubHeader(output, info, label, memoryAddr, resetVector, nmiVector, irqVector);
output += commentLines;
if(!label.empty()) {
GetLine(output, label + ":");
GetLine(output, label + ":", emptyString, -1, -1, dataType);
}
byteCode.clear();
@ -518,61 +546,77 @@ string Disassembler::GetCode(AddressTypeInfo &addressInfo, uint32_t endAddr, uin
info->ToString(code, memoryAddr, memoryManager.get(), labelManager.get());
info->GetByteCode(byteCode);
GetCodeLine(output, code, commentString, memoryAddr, source != internalRam ? addr : -1, byteCode, effAddress, speculativeCode, true);
GetCodeLine(output, code, commentString, memoryAddr, addressInfo.Type != AddressType::InternalRam ? addr : -1, byteCode, effAddress, dataType, true);
if(info->IsSubExitPoint()) {
GetLine(output, "__sub end__");
GetLine(output);
GetLine(output, "----");
}
if(speculativeCode) {
if(dataType == DataType::UnidentifiedData) {
//For unverified code, check if a verified instruction starts between the start of this instruction and its end.
//If so, we need to realign the disassembler to the start of the next verified instruction
for(uint32_t i = 0; i < info->GetSize(); i++) {
addr++;
memoryAddr++;
if(addr > endAddr || (*cache)[addr&mask]) {
//Verified code found, stop incrementing address counters
if(addr > endAddr || (*cache)[addr&mask] || (addressInfo.Type == AddressType::PrgRom && cdl->IsData(addr))) {
//Verified code or verified data found, stop incrementing address counters
break;
}
}
}
delete info;
} else {
addr += info->GetSize();
memoryAddr += info->GetSize();
}
} else {
if((!label.empty() || !commentString.empty()) && skippingCode) {
GetLine(output, unknownBlockHeader, "", (uint16_t)(memoryAddr - 1), addr - 1);
skippingCode = false;
}
//This byte should be interpreted as data
if((!label.empty() || !commentString.empty()) && insideDataBlock) {
//We just found a label and we're inside a data block, end the block, then start a new one
endDataBlock();
}
if(!skippingCode && showOnlyDiassembledCode) {
bool showData = (isVerifiedData && showVerifiedData) || (!isVerifiedData && showUnidentifiedData);
bool showEitherDataType = showVerifiedData || showUnidentifiedData;
if(inVerifiedDataBlock != isVerifiedData && insideDataBlock && showEitherDataType) {
//End of block (switching between verified data & unidentified data, while only either of them is set to be displayed)
endDataBlock();
} else if(inVerifiedDataBlock != isVerifiedData) {
outputBytes();
}
inVerifiedDataBlock = isVerifiedData;
dataType = showEitherDataType && inVerifiedDataBlock ? DataType::VerifiedData : DataType::UnidentifiedData;
if(!insideDataBlock) {
//Output block header
if(label.empty()) {
GetLine(output, "__unknown block__", "", memoryAddr, addr);
GetLine(output, showEitherDataType && inVerifiedDataBlock ? "__data block__" : "__unidentified block__", "", showData ? -1 : memoryAddr, showData ? -1 : addr, dataType);
if(!commentString.empty()) {
GetLine(output, "", commentString);
GetLine(output, "", commentString, -1, -1, dataType);
}
} else {
GetLine(output, "__" + label + "__", "", memoryAddr, addr);
GetLine(output, "__" + label + "__", "", showData ? -1 : memoryAddr, showData ? -1 : addr, dataType);
if(!commentString.empty()) {
GetLine(output, "", commentString);
GetLine(output, "", commentString, -1, -1, dataType);
}
output += commentLines;
}
skippingCode = true;
insideDataBlock = true;
emptyBlock = true;
}
if(!showOnlyDiassembledCode) {
if(showData) {
//Output bytes in ".db" statements
if(byteCount >= 8 || ((!label.empty() || !commentString.empty()) && byteCount > 0)) {
GetLine(output, dbBuffer, "", dbRelativeAddr, dbAbsoluteAddr);
byteCount = 0;
outputBytes();
}
if(byteCount == 0) {
dbBuffer = ".db";
output += commentLines;
if(!label.empty()) {
GetLine(output, label + ":");
GetLine(output, label + ":", "", -1, -1, dataType);
}
dbRelativeAddr = memoryAddr;
@ -582,27 +626,22 @@ string Disassembler::GetCode(AddressTypeInfo &addressInfo, uint32_t endAddr, uin
dbBuffer += " $" + HexUtilities::ToHex(source[addr&mask]);
if(!label.empty() || !commentString.empty()) {
GetLine(output, dbBuffer, commentString, dbRelativeAddr, dbAbsoluteAddr);
GetLine(output, dbBuffer, commentString, dbRelativeAddr, dbAbsoluteAddr, dataType);
byteCount = 0;
} else {
byteCount++;
}
emptyBlock = false;
}
addr++;
memoryAddr++;
}
if(speculativeCode) {
delete info;
}
}
if(byteCount > 0) {
GetLine(output, dbBuffer, "", dbRelativeAddr, dbAbsoluteAddr);
}
if(skippingCode) {
GetLine(output, "----", "", (uint16_t)(memoryAddr - 1), addr - 1);
if(insideDataBlock) {
//End the current data block if needed
endDataBlock();
}
return output;

View File

@ -9,6 +9,13 @@ class LabelManager;
class Debugger;
class BaseMapper;
enum class DataType
{
VerifiedCode,
VerifiedData,
UnidentifiedData,
};
class Disassembler
{
private:
@ -23,8 +30,8 @@ private:
bool IsJump(uint8_t opCode);
bool IsUnconditionalJump(uint8_t opCode);
void GetLine(string &out, string code = "", string comment = string(), int32_t cpuAddress = -1, int32_t absoluteAddress = -1);
void GetCodeLine(string &out, string &code, string &comment, int32_t cpuAddress, int32_t absoluteAddress, string &byteCode, string &addressing, bool speculativeCode, bool isCode);
void GetLine(string &out, string code = "", string comment = string(), int32_t cpuAddress = -1, int32_t absoluteAddress = -1, DataType dataType = DataType::VerifiedCode);
void GetCodeLine(string &out, string &code, string &comment, int32_t cpuAddress, int32_t absoluteAddress, string &byteCode, string &addressing, DataType dataType, bool isIndented);
void GetSubHeader(string &out, DisassemblyInfo *info, string &label, uint16_t relativeAddr, uint16_t resetVector, uint16_t nmiVector, uint16_t irqVector);
void GetInfo(AddressTypeInfo &info, uint8_t** source, uint32_t &size, vector<shared_ptr<DisassemblyInfo>> **cache);
@ -41,7 +48,7 @@ public:
bool IsUnofficialOpCode(uint8_t opCode);
string GetCode(AddressTypeInfo &addressInfo, uint32_t endAddr, uint16_t memoryAddr, bool showEffectiveAddresses, bool showOnlyDiassembledCode, State& cpuState, shared_ptr<MemoryManager> memoryManager, shared_ptr<LabelManager> labelManager);
string GetCode(AddressTypeInfo &addressInfo, uint32_t endAddr, uint16_t memoryAddr, State& cpuState, shared_ptr<MemoryManager> memoryManager, shared_ptr<LabelManager> labelManager);
DisassemblyInfo GetDisassemblyInfo(AddressTypeInfo &info);

View File

@ -80,14 +80,7 @@ namespace Mesen.GUI.Config
}
}
}
public enum DisassemblyType
{
VerifiedCode,
Everything,
EverythingButData
}
public class DebugInfo
{
private const int MaxRecentScripts = 10;
@ -98,7 +91,12 @@ namespace Mesen.GUI.Config
public bool ShowOnlyDisassembledCode = true;
public bool DisplayOpCodesInLowerCase = false;
public bool ShowEffectiveAddresses = true;
public DisassemblyType DisassemblyType = DisassemblyType.VerifiedCode;
public bool DisassembleVerifiedData = false;
public bool DisassembleUnidentifiedData = false;
public bool ShowVerifiedData = false;
public bool ShowUnidentifiedData = false;
public bool SplitView = false;
public bool HexDisplay = true;
@ -128,6 +126,15 @@ namespace Mesen.GUI.Config
public int LeftPanelWidth = 930;
public int TopPanelHeight = 450;
public XmlColor CodeVerifiedDataColor = Color.FromArgb(255, 252, 236);
public XmlColor CodeUnidentifiedDataColor = Color.FromArgb(255, 242, 242);
public XmlColor CodeUnexecutedCodeColor = Color.FromArgb(225, 244, 228);
public XmlColor CodeExecBreakpointColor = Color.FromArgb(140, 40, 40);
public XmlColor CodeWriteBreakpointColor = Color.FromArgb(40, 120, 80);
public XmlColor CodeReadBreakpointColor = Color.FromArgb(40, 40, 200);
public XmlColor CodeActiveStatementColor = Color.Yellow;
public bool RamAutoRefresh = true;
public int RamColumnCount = 2;
public float RamFontSize = BaseControl.DefaultFontSize;
@ -165,8 +172,6 @@ namespace Mesen.GUI.Config
public int BreakInCount = 1;
public bool BreakInPpuCycles = false;
public bool HighlightUnexecutedCode = true;
public bool FindOccurrencesMatchCase = false;
public bool FindOccurrencesMatchWholeWord = false;
public string FindOccurrencesLastSearch = string.Empty;

View File

@ -29,6 +29,11 @@
{
this.components = new System.ComponentModel.Container();
this.contextMenuCode = new System.Windows.Forms.ContextMenuStrip(this.components);
this.mnuMarkSelectionAs = new System.Windows.Forms.ToolStripMenuItem();
this.mnuMarkAsCode = new System.Windows.Forms.ToolStripMenuItem();
this.mnuMarkAsData = new System.Windows.Forms.ToolStripMenuItem();
this.mnuMarkAsUnidentifiedData = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator();
this.mnuEditSelectedCode = new System.Windows.Forms.ToolStripMenuItem();
this.mnuEditSubroutine = new System.Windows.Forms.ToolStripMenuItem();
this.copySelectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -87,6 +92,8 @@
// contextMenuCode
//
this.contextMenuCode.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuMarkSelectionAs,
this.toolStripMenuItem4,
this.mnuEditSelectedCode,
this.mnuEditSubroutine,
this.copySelectionToolStripMenuItem,
@ -110,10 +117,49 @@
this.mnuNavigateBackward,
this.mnuNavigateForward});
this.contextMenuCode.Name = "contextMenuWatch";
this.contextMenuCode.Size = new System.Drawing.Size(259, 414);
this.contextMenuCode.Size = new System.Drawing.Size(259, 442);
this.contextMenuCode.Closed += new System.Windows.Forms.ToolStripDropDownClosedEventHandler(this.contextMenuCode_Closed);
this.contextMenuCode.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuCode_Opening);
//
// mnuMarkSelectionAs
//
this.mnuMarkSelectionAs.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuMarkAsCode,
this.mnuMarkAsData,
this.mnuMarkAsUnidentifiedData});
this.mnuMarkSelectionAs.Name = "mnuMarkSelectionAs";
this.mnuMarkSelectionAs.Size = new System.Drawing.Size(258, 22);
this.mnuMarkSelectionAs.Text = "Mark selection as...";
//
// mnuMarkAsCode
//
this.mnuMarkAsCode.Image = global::Mesen.GUI.Properties.Resources.Accept;
this.mnuMarkAsCode.Name = "mnuMarkAsCode";
this.mnuMarkAsCode.Size = new System.Drawing.Size(166, 22);
this.mnuMarkAsCode.Text = "Verified Code";
this.mnuMarkAsCode.Click += new System.EventHandler(this.mnuMarkAsCode_Click);
//
// mnuMarkAsData
//
this.mnuMarkAsData.Image = global::Mesen.GUI.Properties.Resources.CheatCode;
this.mnuMarkAsData.Name = "mnuMarkAsData";
this.mnuMarkAsData.Size = new System.Drawing.Size(166, 22);
this.mnuMarkAsData.Text = "Verified Data";
this.mnuMarkAsData.Click += new System.EventHandler(this.mnuMarkAsData_Click);
//
// mnuMarkAsUnidentifiedData
//
this.mnuMarkAsUnidentifiedData.Image = global::Mesen.GUI.Properties.Resources.Help;
this.mnuMarkAsUnidentifiedData.Name = "mnuMarkAsUnidentifiedData";
this.mnuMarkAsUnidentifiedData.Size = new System.Drawing.Size(166, 22);
this.mnuMarkAsUnidentifiedData.Text = "Unidentified Data";
this.mnuMarkAsUnidentifiedData.Click += new System.EventHandler(this.mnuMarkAsUnidentifiedData_Click);
//
// toolStripMenuItem4
//
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
this.toolStripMenuItem4.Size = new System.Drawing.Size(255, 6);
//
// mnuEditSelectedCode
//
this.mnuEditSelectedCode.Image = global::Mesen.GUI.Properties.Resources.Edit;
@ -568,5 +614,10 @@
private System.Windows.Forms.ToolStripMenuItem mnuEditInMemoryViewer;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2;
private System.Windows.Forms.ToolStripMenuItem mnuShowInSplitView;
private System.Windows.Forms.ToolStripMenuItem mnuMarkSelectionAs;
private System.Windows.Forms.ToolStripMenuItem mnuMarkAsCode;
private System.Windows.Forms.ToolStripMenuItem mnuMarkAsData;
private System.Windows.Forms.ToolStripMenuItem mnuMarkAsUnidentifiedData;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem4;
}
}

View File

@ -28,6 +28,7 @@ namespace Mesen.GUI.Debugger
List<string> _codeNotes = new List<string>(10000);
List<string> _codeLines = new List<string>(10000);
private HashSet<int> _unexecutedAddresses = new HashSet<int>();
private HashSet<int> _verifiedDataAddresses = new HashSet<int>();
private HashSet<int> _speculativeCodeAddreses = new HashSet<int>();
Dictionary<int, string> _codeContent = new Dictionary<int, string>(10000);
Dictionary<int, string> _codeComments = new Dictionary<int, string>(10000);
@ -255,11 +256,13 @@ namespace Mesen.GUI.Debugger
_codeByteCode.Clear();
_unexecutedAddresses.Clear();
_speculativeCodeAddreses.Clear();
_verifiedDataAddresses.Clear();
string[] token = new string[7];
int tokenIndex = 0;
int startPos = 0;
int endPos = 0;
int lineNumber = 0;
Action readToken = () => {
endPos = _code.IndexOf('\x1', endPos) + 1;
@ -269,7 +272,7 @@ namespace Mesen.GUI.Debugger
Action readLine = () => {
tokenIndex = 0;
readToken(); readToken(); readToken(); readToken(); readToken(); readToken(); readToken();
readToken(); readToken(); readToken(); readToken(); readToken(); readToken(); readToken();
};
Func<bool> processLine = () => {
@ -281,14 +284,23 @@ namespace Mesen.GUI.Debugger
//1: Executed code
//2: Speculative Code
//4: Indented line
if(token[0] == "4") {
_unexecutedAddresses.Add(relativeAddress);
if(token[0] == "2") {
_speculativeCodeAddreses.Add(lineNumber);
_lineIndentations.Add(0);
} else if(token[0] == "4") {
_unexecutedAddresses.Add(lineNumber);
_lineIndentations.Add(20);
} else if(token[0] == "6") {
_speculativeCodeAddreses.Add(relativeAddress);
_speculativeCodeAddreses.Add(lineNumber);
_lineIndentations.Add(20);
} else if(token[0] == "5") {
_lineIndentations.Add(20);
} else if(token[0] == "8") {
_verifiedDataAddresses.Add(lineNumber);
_lineIndentations.Add(0);
} else if(token[0] == "9") {
_verifiedDataAddresses.Add(lineNumber);
_lineIndentations.Add(20);
} else {
_lineIndentations.Add(0);
}
@ -306,6 +318,8 @@ namespace Mesen.GUI.Debugger
_codeContent[relativeAddress] = token[4];
_codeComments[relativeAddress] = token[6];
lineNumber++;
return endPos < _code.Length;
};
@ -655,8 +669,18 @@ namespace Mesen.GUI.Debugger
private void contextMenuCode_Opening(object sender, CancelEventArgs e)
{
UpdateContextMenuItemVisibility(true);
int startAddress, endAddress;
string range;
GetSelectedAddressRange(out startAddress, out endAddress, out range);
mnuMarkSelectionAs.Enabled = startAddress >= 0 && endAddress >= 0 && startAddress <= endAddress;
if(mnuMarkSelectionAs.Enabled) {
mnuMarkSelectionAs.Text = "Mark selection as... (" + range + ")";
} else {
mnuMarkSelectionAs.Text = "Mark selection as...";
}
}
private void contextMenuCode_Closed(object sender, ToolStripDropDownClosedEventArgs e)
{
mnuEditSelectedCode.Enabled = true;
@ -856,12 +880,6 @@ namespace Mesen.GUI.Debugger
class LineStyleProvider : ctrlTextbox.ILineStyleProvider
{
private Color _unexecutedColor = Color.FromArgb(183, 229, 190);
private Color _speculativeColor = Color.FromArgb(240, 220, 220);
private Color _execBpColor = Color.FromArgb(140, 40, 40);
private Color _writeBpColor = Color.FromArgb(40, 120, 80);
private Color _readBpColor = Color.FromArgb(40, 40, 200);
private ctrlDebuggerCode _code;
public LineStyleProvider(ctrlDebuggerCode code)
@ -869,13 +887,25 @@ namespace Mesen.GUI.Debugger
_code = code;
}
public LineProperties GetLineStyle(int cpuAddress)
public LineProperties GetLineStyle(int cpuAddress, int lineNumber)
{
DebugInfo info = ConfigManager.Config.DebugInfo;
LineProperties props = null;
if(_code._currentActiveAddress.HasValue && cpuAddress == _code._currentActiveAddress) {
props = new LineProperties() { TextBgColor = info.CodeActiveStatementColor, Symbol = LineSymbol.Arrow };
} else if(_code._unexecutedAddresses.Contains(lineNumber)) {
props = new LineProperties() { LineBgColor = info.CodeUnexecutedCodeColor };
} else if(_code._speculativeCodeAddreses.Contains(lineNumber)) {
props = new LineProperties() { LineBgColor = info.CodeUnidentifiedDataColor };
} else if(_code._verifiedDataAddresses.Contains(lineNumber)) {
props = new LineProperties() { LineBgColor = info.CodeVerifiedDataColor };
}
foreach(Breakpoint breakpoint in BreakpointManager.Breakpoints) {
if(breakpoint.Matches(cpuAddress)) {
Color? fgColor = Color.White;
Color? bgColor = null;
Color bpColor = breakpoint.BreakOnExec ? _execBpColor : (breakpoint.BreakOnWrite ? _writeBpColor : _readBpColor);
Color bpColor = breakpoint.BreakOnExec ? info.CodeExecBreakpointColor : (breakpoint.BreakOnWrite ? info.CodeWriteBreakpointColor : info.CodeReadBreakpointColor);
Color? outlineColor = bpColor;
LineSymbol symbol;
if(breakpoint.Enabled) {
@ -890,26 +920,20 @@ namespace Mesen.GUI.Debugger
fgColor = Color.Black;
bgColor = Color.Yellow;
symbol |= LineSymbol.Arrow;
} else if(_code._unexecutedAddresses.Contains((Int32)breakpoint.Address)) {
fgColor = Color.Black;
bgColor = _unexecutedColor;
} else if(_code._speculativeCodeAddreses.Contains((Int32)breakpoint.Address)) {
fgColor = Color.Black;
bgColor = _speculativeColor;
}
return new LineProperties() { FgColor = fgColor, BgColor = bgColor, OutlineColor = outlineColor, Symbol = symbol };
if(props == null) {
props = new LineProperties();
}
props.FgColor = fgColor;
props.TextBgColor = bgColor;
props.OutlineColor = outlineColor;
props.Symbol = symbol;
break;
}
}
if(_code._currentActiveAddress.HasValue && cpuAddress == _code._currentActiveAddress) {
return new LineProperties() { FgColor = Color.Black, BgColor = Color.Yellow, OutlineColor = null, Symbol = LineSymbol.Arrow };
} else if(ConfigManager.Config.DebugInfo.HighlightUnexecutedCode && _code._unexecutedAddresses.Contains(cpuAddress)) {
return new LineProperties() { FgColor = null, BgColor = _unexecutedColor, OutlineColor = null, Symbol = LineSymbol.None };
} else if(_code._speculativeCodeAddreses.Contains(cpuAddress)) {
return new LineProperties() { FgColor = null, BgColor = _speculativeColor, OutlineColor = null, Symbol = LineSymbol.None };
}
return null;
return props;
}
}
@ -924,8 +948,60 @@ namespace Mesen.GUI.Debugger
DebugWindowManager.OpenMemoryViewer(_lastClickedAddress);
}
}
}
private void GetSelectedAddressRange(out int start, out int end, out string range)
{
int firstLineOfSelection = this.ctrlCodeViewer.SelectionStart;
while(this.ctrlCodeViewer.GetLineNumber(firstLineOfSelection) < 0) {
firstLineOfSelection++;
}
int firstLineAfterSelection = this.ctrlCodeViewer.SelectionStart + this.ctrlCodeViewer.SelectionLength + 1;
while(this.ctrlCodeViewer.GetLineNumber(firstLineAfterSelection) < 0) {
firstLineAfterSelection++;
}
start = this.ctrlCodeViewer.GetLineNumber(firstLineOfSelection);
end = this.ctrlCodeViewer.GetLineNumber(firstLineAfterSelection) - 1;
range = "";
if(start >= 0 && end >= 0) {
range = $"${start.ToString("X4")} - ${end.ToString("X4")}";
start = InteropEmu.DebugGetAbsoluteAddress((UInt32)start);
end = InteropEmu.DebugGetAbsoluteAddress((UInt32)end);
}
}
private void MarkSelectionAs(CdlPrgFlags type)
{
int startAddress, endAddress;
string range;
GetSelectedAddressRange(out startAddress, out endAddress, out range);
if(startAddress >= 0 && endAddress >= 0 && startAddress <= endAddress) {
InteropEmu.DebugMarkPrgBytesAs((UInt32)startAddress, (UInt32)endAddress, type);
frmDebugger debugger = DebugWindowManager.GetDebugger();
if(debugger != null) {
debugger.UpdateDebugger(false);
}
}
}
private void mnuMarkAsCode_Click(object sender, EventArgs e)
{
this.MarkSelectionAs(CdlPrgFlags.Code);
}
private void mnuMarkAsData_Click(object sender, EventArgs e)
{
this.MarkSelectionAs(CdlPrgFlags.Data);
}
private void mnuMarkAsUnidentifiedData_Click(object sender, EventArgs e)
{
this.MarkSelectionAs(CdlPrgFlags.None);
}
}
public class WatchEventArgs : EventArgs
{
public string WatchValue { get; set; }

View File

@ -92,10 +92,10 @@ namespace Mesen.GUI.Debugger.Controls
_addresses = addresses;
}
public LineProperties GetLineStyle(int cpuAddress)
public LineProperties GetLineStyle(int cpuAddress, int lineIndex)
{
if(_addresses.Contains(cpuAddress)) {
return new LineProperties() { BgColor = Color.LightCoral };
return new LineProperties() { TextBgColor = Color.LightCoral };
}
return null;
}

View File

@ -30,7 +30,8 @@ namespace Mesen.GUI.Debugger
public class LineProperties
{
public Color? BgColor;
public Color? LineBgColor;
public Color? TextBgColor;
public Color? FgColor;
public Color? OutlineColor;
public LineSymbol Symbol;
@ -324,7 +325,7 @@ namespace Mesen.GUI.Debugger
public interface ILineStyleProvider
{
LineProperties GetLineStyle(int cpuAddress);
LineProperties GetLineStyle(int cpuAddress, int lineIndex);
}
private ILineStyleProvider _styleProvider;
@ -338,10 +339,10 @@ namespace Mesen.GUI.Debugger
}
}
public LineProperties GetLineStyle(int lineNumber)
public LineProperties GetLineStyle(int lineIndex)
{
if(StyleProvider != null && _lineNumbers[lineNumber] >= 0) {
return StyleProvider.GetLineStyle(_lineNumbers[lineNumber]);
if(StyleProvider != null) {
return StyleProvider.GetLineStyle(_lineNumbers[lineIndex], lineIndex);
} else {
return null;
}
@ -828,42 +829,57 @@ namespace Mesen.GUI.Debugger
float codeStringLength = g.MeasureString(codeString, this.Font, int.MaxValue, StringFormat.GenericTypographic).Width;
float addressStringLength = g.MeasureString(addressString, this.Font, int.MaxValue, StringFormat.GenericTypographic).Width;
if(currentLine >= this.SelectionStart && currentLine <= this.SelectionStart + this.SelectionLength) {
//Highlight current line
using(Brush brush = new SolidBrush(Color.FromArgb(230, 238, 255))) {
int offset = currentLine - 1 == this.SelectedLine ? 1 : 0;
g.FillRectangle(brush, marginLeft, positionY + offset, Math.Max(_maxLineWidth, this.ClientRectangle.Width), lineHeight - offset);
}
if(currentLine == this.SelectedLine) {
g.DrawRectangle(Pens.Blue, marginLeft + 1, positionY+1, Math.Max(_maxLineWidth, this.ClientRectangle.Width - marginLeft) - 1, lineHeight);
}
}
//Adjust background color highlights based on number of spaces in front of content
int originalMargin = marginLeft;
marginLeft += (LineIndentations != null ? LineIndentations[currentLine] : 0);
bool isBlockStartOrEnd = codeString.StartsWith("--") && codeString.EndsWith("--") || codeString.StartsWith("__") && codeString.EndsWith("__");
bool isBlockStart = codeString.StartsWith("__") && codeString.EndsWith("__");
bool isBlockEnd = codeString.StartsWith("--") && codeString.EndsWith("--");
Color textColor = Color.Black;
LineProperties lineProperties = GetLineStyle(currentLine);
if(!isBlockStartOrEnd) {
//Setup text and bg color (only if the line is not the start/end of a block)
if(lineProperties != null) {
//Process background, foreground, outline color and line symbol
textColor = lineProperties.FgColor ?? Color.Black;
if(lineProperties.BgColor.HasValue) {
using(Brush bgBrush = new SolidBrush(lineProperties.BgColor.Value)) {
int yOffset = Program.IsMono ? 2 : 1;
g.FillRectangle(bgBrush, marginLeft, positionY + yOffset, codeStringLength, lineHeight-1);
//Setup text and bg color (only if the line is not the start/end of a block)
if(lineProperties != null) {
//Process background, foreground, outline color and line symbol
textColor = lineProperties.FgColor ?? Color.Black;
if(lineProperties.LineBgColor.HasValue) {
using(Brush bgBrush = new SolidBrush(lineProperties.LineBgColor.Value)) {
int yOffset = Program.IsMono ? 2 : 1;
if(isBlockStart) {
g.FillRectangle(bgBrush, originalMargin, positionY + yOffset + lineHeight / 2, Math.Max(_maxLineWidth + 10, this.ClientRectangle.Width - originalMargin), lineHeight / 2 + 1);
} else if(isBlockEnd) {
g.FillRectangle(bgBrush, originalMargin, positionY + yOffset, Math.Max(_maxLineWidth + 10, this.ClientRectangle.Width - originalMargin), lineHeight / 2 - 3);
} else {
g.FillRectangle(bgBrush, originalMargin, positionY + yOffset, Math.Max(_maxLineWidth + 10, this.ClientRectangle.Width - originalMargin), lineHeight);
}
}
if(lineProperties.OutlineColor.HasValue) {
using(Pen outlinePen = new Pen(lineProperties.OutlineColor.Value, 1)) {
g.DrawRectangle(outlinePen, marginLeft, positionY + 1, codeStringLength, lineHeight-1);
}
}
if(!isBlockStart && !isBlockEnd && lineProperties.TextBgColor.HasValue) {
using(Brush bgBrush = new SolidBrush(lineProperties.TextBgColor.Value)) {
int yOffset = Program.IsMono ? 2 : 1;
g.FillRectangle(bgBrush, marginLeft, positionY + yOffset, codeStringLength, lineHeight - 1);
}
}
if(!isBlockStart && !isBlockEnd && lineProperties.OutlineColor.HasValue) {
using(Pen outlinePen = new Pen(lineProperties.OutlineColor.Value, 1)) {
g.DrawRectangle(outlinePen, marginLeft, positionY + 1, codeStringLength, lineHeight-1);
}
}
}
if(currentLine >= this.SelectionStart && currentLine <= this.SelectionStart + this.SelectionLength) {
//Highlight current line
using(Brush brush = new SolidBrush(Color.FromArgb(150, 200, 200, 255))) {
int offset = currentLine - 1 == this.SelectedLine ? 1 : 0;
g.FillRectangle(brush, originalMargin, positionY + offset, Math.Max(_maxLineWidth, this.ClientRectangle.Width), lineHeight - offset);
}
if(currentLine == this.SelectedLine) {
g.DrawRectangle(Pens.Blue, originalMargin + 1, positionY + 1, Math.Max(_maxLineWidth, this.ClientRectangle.Width - originalMargin) - 1, lineHeight);
}
}
this.DrawLineText(g, currentLine, marginLeft, positionY, codeString, addressString, commentString, codeStringLength, addressStringLength, textColor, lineHeight);
@ -898,22 +914,25 @@ namespace Mesen.GUI.Debugger
private void DrawLineText(Graphics g, int currentLine, int marginLeft, int positionY, string codeString, string addressString, string commentString, float codeStringLength, float addressStringLength, Color textColor, int lineHeight)
{
using(Brush fgBrush = new SolidBrush(textColor)) {
if(codeString.StartsWith("--") && codeString.EndsWith("--")) {
//Draw block start
if(codeString.StartsWith("__") && codeString.EndsWith("__") || codeString.StartsWith("--") && codeString.EndsWith("--")) {
//Draw block start/end
g.TranslateTransform(HorizontalScrollPosition * HorizontalScrollFactor, 0);
string text = codeString.Substring(2, codeString.Length - 4);
float textLength = g.MeasureString(text, this._noteFont, int.MaxValue, StringFormat.GenericTypographic).Width;
g.DrawString(text, this._noteFont, fgBrush, (marginLeft + this.Width - textLength) / 2, positionY, StringFormat.GenericTypographic);
g.DrawLine(Pens.Black, marginLeft, positionY+lineHeight-2, marginLeft+this.Width, positionY+lineHeight-2);
g.ResetTransform();
} else if(codeString.StartsWith("__") && codeString.EndsWith("__")) {
//Draw block end
g.TranslateTransform(HorizontalScrollPosition * HorizontalScrollFactor, 0);
string text = codeString.Substring(2, codeString.Length - 4);
float textLength = g.MeasureString(text, this._noteFont, int.MaxValue, StringFormat.GenericTypographic).Width;
g.DrawString(text, this._noteFont, fgBrush, (marginLeft + this.Width - textLength) / 2, positionY + 4, StringFormat.GenericTypographic);
g.DrawLine(Pens.Black, marginLeft, positionY+2, marginLeft+this.Width, positionY+2);
g.ResetTransform();
float yOffset = codeString.StartsWith("__") ? 2 : -2;
if(text.Length > 0) {
SizeF size = g.MeasureString(text, this._noteFont, int.MaxValue, StringFormat.GenericTypographic);
float textLength = size.Width;
float textHeight = size.Height;
float positionX = (marginLeft + this.Width - textLength) / 2;
g.DrawLine(Pens.Black, marginLeft, yOffset + positionY + lineHeight / 2, marginLeft + this.Width, yOffset + positionY + lineHeight / 2);
yOffset = codeString.StartsWith("__") ? 3 : 2;
g.FillRectangle(Brushes.White, positionX - 4, yOffset + positionY, textLength + 8, textHeight);
g.DrawRectangle(Pens.Black, positionX - 4, yOffset + positionY, textLength + 8, textHeight);
g.DrawString(text, this._noteFont, fgBrush, positionX, yOffset + positionY, StringFormat.GenericTypographic);
} else {
g.DrawLine(Pens.Black, marginLeft, yOffset + positionY + lineHeight / 2, marginLeft + this.Width, yOffset + positionY + lineHeight / 2);
}
g.TranslateTransform(-HorizontalScrollPosition * HorizontalScrollFactor, 0);
} else {
//Draw line content
g.DrawString(codeString, this.Font, fgBrush, marginLeft, positionY, StringFormat.GenericTypographic);
@ -959,7 +978,7 @@ namespace Mesen.GUI.Debugger
if(lineProperties.Symbol.HasFlag(LineSymbol.Arrow)) {
int arrowY = positionY + lineHeight / 2 + 1;
if(Program.IsMono) {
using(Brush brush = new SolidBrush(lineProperties.BgColor.Value)) {
using(Brush brush = new SolidBrush(lineProperties.TextBgColor.Value)) {
g.FillRectangle(brush, 1, arrowY - lineHeight * 0.25f / 2, lineHeight - 1, lineHeight * 0.35f);
}
g.DrawRectangle(Pens.Black, 1, arrowY - lineHeight * 0.25f / 2, lineHeight - 1, lineHeight * 0.35f);
@ -972,7 +991,7 @@ namespace Mesen.GUI.Debugger
//Fill
pen.Width-=2f;
pen.Color = lineProperties.BgColor.Value;
pen.Color = lineProperties.TextBgColor.Value;
pen.EndCap = System.Drawing.Drawing2D.LineCap.Square;
g.DrawLine(pen, 4, arrowY, 3 + lineHeight * 0.25f - 1, arrowY);
pen.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
@ -1079,7 +1098,7 @@ namespace Mesen.GUI.Debugger
currentLine++;
}
pe.Graphics.ResetTransform();
pe.Graphics.TranslateTransform(HorizontalScrollPosition * HorizontalScrollFactor, 0);
if(this.ShowLineNumbers) {
using(Brush brush = new SolidBrush(Color.FromArgb(235, 235, 235))) {

View File

@ -99,15 +99,17 @@ namespace Mesen.GUI.Debugger
this.mnuOptions = new System.Windows.Forms.ToolStripMenuItem();
this.mnuDisassemblyOptions = new System.Windows.Forms.ToolStripMenuItem();
this.mnuDisassemble = new System.Windows.Forms.ToolStripMenuItem();
this.mnuDisassembleVerifiedCodeOnly = new System.Windows.Forms.ToolStripMenuItem();
this.mnuDisassembleEverything = new System.Windows.Forms.ToolStripMenuItem();
this.mnuDisassembleEverythingButData = new System.Windows.Forms.ToolStripMenuItem();
this.mnuDisassembleVerifiedCode = new System.Windows.Forms.ToolStripMenuItem();
this.mnuDisassembleVerifiedData = new System.Windows.Forms.ToolStripMenuItem();
this.mnuDisassembleUnidentifiedData = new System.Windows.Forms.ToolStripMenuItem();
this.mnuShow = new System.Windows.Forms.ToolStripMenuItem();
this.mnuShowDisassembledCode = new System.Windows.Forms.ToolStripMenuItem();
this.mnuShowVerifiedData = new System.Windows.Forms.ToolStripMenuItem();
this.mnuShowUnidentifiedData = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem7 = new System.Windows.Forms.ToolStripSeparator();
this.mnuDisplayOpCodesInLowerCase = new System.Windows.Forms.ToolStripMenuItem();
this.mnuHighlightUnexecutedCode = new System.Windows.Forms.ToolStripMenuItem();
this.mnuShowEffectiveAddresses = new System.Windows.Forms.ToolStripMenuItem();
this.mnuShowOnlyDisassembledCode = new System.Windows.Forms.ToolStripMenuItem();
this.breakOptionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnuBreakOptions = new System.Windows.Forms.ToolStripMenuItem();
this.mnuBreakOnReset = new System.Windows.Forms.ToolStripMenuItem();
this.mnuBreakOnUnofficialOpcodes = new System.Windows.Forms.ToolStripMenuItem();
this.mnuBreakOnBrk = new System.Windows.Forms.ToolStripMenuItem();
@ -115,6 +117,7 @@ namespace Mesen.GUI.Debugger
this.mnuBreakOnOpen = new System.Windows.Forms.ToolStripMenuItem();
this.mnuBreakOnDebuggerFocus = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem12 = new System.Windows.Forms.ToolStripSeparator();
this.mnuConfigureColors = new System.Windows.Forms.ToolStripMenuItem();
this.mnuSplitView = new System.Windows.Forms.ToolStripMenuItem();
this.fontSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnuIncreaseFontSize = new System.Windows.Forms.ToolStripMenuItem();
@ -230,7 +233,7 @@ namespace Mesen.GUI.Debugger
this.ctrlSplitContainerTop.Panel2.Controls.Add(this.tlpFunctionLabelLists);
this.ctrlSplitContainerTop.Panel2MinSize = 150;
this.ctrlSplitContainerTop.Size = new System.Drawing.Size(1172, 400);
this.ctrlSplitContainerTop.SplitterDistance = 842;
this.ctrlSplitContainerTop.SplitterDistance = 821;
this.ctrlSplitContainerTop.SplitterWidth = 7;
this.ctrlSplitContainerTop.TabIndex = 3;
this.ctrlSplitContainerTop.PanelCollapsed += new System.EventHandler(this.ctrlSplitContainerTop_PanelCollapsed);
@ -251,7 +254,7 @@ namespace Mesen.GUI.Debugger
this.tlpTop.Name = "tlpTop";
this.tlpTop.RowCount = 1;
this.tlpTop.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tlpTop.Size = new System.Drawing.Size(842, 400);
this.tlpTop.Size = new System.Drawing.Size(821, 400);
this.tlpTop.TabIndex = 2;
//
// ctrlDebuggerCode
@ -260,7 +263,7 @@ namespace Mesen.GUI.Debugger
this.ctrlDebuggerCode.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlDebuggerCode.Location = new System.Drawing.Point(3, 3);
this.ctrlDebuggerCode.Name = "ctrlDebuggerCode";
this.ctrlDebuggerCode.Size = new System.Drawing.Size(378, 394);
this.ctrlDebuggerCode.Size = new System.Drawing.Size(357, 394);
this.ctrlDebuggerCode.TabIndex = 2;
this.ctrlDebuggerCode.OnEditCode += new Mesen.GUI.Debugger.ctrlDebuggerCode.AssemblerEventHandler(this.ctrlDebuggerCode_OnEditCode);
this.ctrlDebuggerCode.OnSetNextStatement += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnSetNextStatement);
@ -270,7 +273,7 @@ namespace Mesen.GUI.Debugger
// ctrlConsoleStatus
//
this.ctrlConsoleStatus.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlConsoleStatus.Location = new System.Drawing.Point(384, 0);
this.ctrlConsoleStatus.Location = new System.Drawing.Point(363, 0);
this.ctrlConsoleStatus.Margin = new System.Windows.Forms.Padding(0);
this.ctrlConsoleStatus.Name = "ctrlConsoleStatus";
this.ctrlConsoleStatus.Size = new System.Drawing.Size(458, 400);
@ -281,7 +284,7 @@ namespace Mesen.GUI.Debugger
//
this.ctrlDebuggerCodeSplit.Code = null;
this.ctrlDebuggerCodeSplit.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlDebuggerCodeSplit.Location = new System.Drawing.Point(387, 3);
this.ctrlDebuggerCodeSplit.Location = new System.Drawing.Point(366, 3);
this.ctrlDebuggerCodeSplit.Name = "ctrlDebuggerCodeSplit";
this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(1, 394);
this.ctrlDebuggerCodeSplit.TabIndex = 4;
@ -304,7 +307,7 @@ namespace Mesen.GUI.Debugger
this.tlpFunctionLabelLists.RowCount = 2;
this.tlpFunctionLabelLists.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tlpFunctionLabelLists.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tlpFunctionLabelLists.Size = new System.Drawing.Size(323, 400);
this.tlpFunctionLabelLists.Size = new System.Drawing.Size(344, 400);
this.tlpFunctionLabelLists.TabIndex = 5;
//
// grpLabels
@ -313,7 +316,7 @@ namespace Mesen.GUI.Debugger
this.grpLabels.Dock = System.Windows.Forms.DockStyle.Fill;
this.grpLabels.Location = new System.Drawing.Point(3, 203);
this.grpLabels.Name = "grpLabels";
this.grpLabels.Size = new System.Drawing.Size(317, 194);
this.grpLabels.Size = new System.Drawing.Size(338, 194);
this.grpLabels.TabIndex = 6;
this.grpLabels.TabStop = false;
this.grpLabels.Text = "Labels";
@ -323,7 +326,7 @@ namespace Mesen.GUI.Debugger
this.ctrlLabelList.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlLabelList.Location = new System.Drawing.Point(3, 16);
this.ctrlLabelList.Name = "ctrlLabelList";
this.ctrlLabelList.Size = new System.Drawing.Size(311, 175);
this.ctrlLabelList.Size = new System.Drawing.Size(332, 175);
this.ctrlLabelList.TabIndex = 0;
this.ctrlLabelList.OnFindOccurrence += new System.EventHandler(this.ctrlLabelList_OnFindOccurrence);
this.ctrlLabelList.OnLabelSelected += new System.EventHandler(this.ctrlLabelList_OnLabelSelected);
@ -334,7 +337,7 @@ namespace Mesen.GUI.Debugger
this.grpFunctions.Dock = System.Windows.Forms.DockStyle.Fill;
this.grpFunctions.Location = new System.Drawing.Point(3, 3);
this.grpFunctions.Name = "grpFunctions";
this.grpFunctions.Size = new System.Drawing.Size(317, 194);
this.grpFunctions.Size = new System.Drawing.Size(338, 194);
this.grpFunctions.TabIndex = 5;
this.grpFunctions.TabStop = false;
this.grpFunctions.Text = "Functions";
@ -344,7 +347,7 @@ namespace Mesen.GUI.Debugger
this.ctrlFunctionList.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlFunctionList.Location = new System.Drawing.Point(3, 16);
this.ctrlFunctionList.Name = "ctrlFunctionList";
this.ctrlFunctionList.Size = new System.Drawing.Size(311, 175);
this.ctrlFunctionList.Size = new System.Drawing.Size(332, 175);
this.ctrlFunctionList.TabIndex = 0;
this.ctrlFunctionList.OnFindOccurrence += new System.EventHandler(this.ctrlFunctionList_OnFindOccurrence);
this.ctrlFunctionList.OnFunctionSelected += new System.EventHandler(this.ctrlFunctionList_OnFunctionSelected);
@ -839,8 +842,9 @@ namespace Mesen.GUI.Debugger
//
this.mnuOptions.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuDisassemblyOptions,
this.breakOptionsToolStripMenuItem,
this.mnuBreakOptions,
this.toolStripMenuItem12,
this.mnuConfigureColors,
this.mnuSplitView,
this.fontSizeToolStripMenuItem,
this.toolStripMenuItem11,
@ -862,11 +866,10 @@ namespace Mesen.GUI.Debugger
//
this.mnuDisassemblyOptions.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuDisassemble,
this.mnuShow,
this.toolStripMenuItem7,
this.mnuDisplayOpCodesInLowerCase,
this.mnuHighlightUnexecutedCode,
this.mnuShowEffectiveAddresses,
this.mnuShowOnlyDisassembledCode});
this.mnuShowEffectiveAddresses});
this.mnuDisassemblyOptions.Name = "mnuDisassemblyOptions";
this.mnuDisassemblyOptions.Size = new System.Drawing.Size(259, 22);
this.mnuDisassemblyOptions.Text = "Disassembly Options";
@ -874,83 +877,106 @@ namespace Mesen.GUI.Debugger
// mnuDisassemble
//
this.mnuDisassemble.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuDisassembleVerifiedCodeOnly,
this.mnuDisassembleEverything,
this.mnuDisassembleEverythingButData});
this.mnuDisassembleVerifiedCode,
this.mnuDisassembleVerifiedData,
this.mnuDisassembleUnidentifiedData});
this.mnuDisassemble.Name = "mnuDisassemble";
this.mnuDisassemble.Size = new System.Drawing.Size(237, 22);
this.mnuDisassemble.Size = new System.Drawing.Size(236, 22);
this.mnuDisassemble.Text = "Disassemble...";
//
// mnuDisassembleVerifiedCodeOnly
// mnuDisassembleVerifiedCode
//
this.mnuDisassembleVerifiedCodeOnly.Name = "mnuDisassembleVerifiedCodeOnly";
this.mnuDisassembleVerifiedCodeOnly.Size = new System.Drawing.Size(235, 22);
this.mnuDisassembleVerifiedCodeOnly.Text = "Verified code only";
this.mnuDisassembleVerifiedCodeOnly.Click += new System.EventHandler(this.mnuDisassembleVerifiedCodeOnly_Click);
this.mnuDisassembleVerifiedCode.Checked = true;
this.mnuDisassembleVerifiedCode.CheckState = System.Windows.Forms.CheckState.Checked;
this.mnuDisassembleVerifiedCode.Enabled = false;
this.mnuDisassembleVerifiedCode.Name = "mnuDisassembleVerifiedCode";
this.mnuDisassembleVerifiedCode.Size = new System.Drawing.Size(250, 22);
this.mnuDisassembleVerifiedCode.Text = "Verified Code";
//
// mnuDisassembleEverything
// mnuDisassembleVerifiedData
//
this.mnuDisassembleEverything.Name = "mnuDisassembleEverything";
this.mnuDisassembleEverything.Size = new System.Drawing.Size(235, 22);
this.mnuDisassembleEverything.Text = "Everything";
this.mnuDisassembleEverything.Click += new System.EventHandler(this.mnuDisassembleEverything_Click);
this.mnuDisassembleVerifiedData.CheckOnClick = true;
this.mnuDisassembleVerifiedData.Name = "mnuDisassembleVerifiedData";
this.mnuDisassembleVerifiedData.Size = new System.Drawing.Size(250, 22);
this.mnuDisassembleVerifiedData.Text = "Verified Data (not recommended)";
this.mnuDisassembleVerifiedData.Click += new System.EventHandler(this.mnuDisassembleVerifiedData_Click);
//
// mnuDisassembleEverythingButData
// mnuDisassembleUnidentifiedData
//
this.mnuDisassembleEverythingButData.Name = "mnuDisassembleEverythingButData";
this.mnuDisassembleEverythingButData.Size = new System.Drawing.Size(235, 22);
this.mnuDisassembleEverythingButData.Text = "Everything except verified data";
this.mnuDisassembleEverythingButData.Click += new System.EventHandler(this.mnuDisassembleEverythingButData_Click);
this.mnuDisassembleUnidentifiedData.CheckOnClick = true;
this.mnuDisassembleUnidentifiedData.Name = "mnuDisassembleUnidentifiedData";
this.mnuDisassembleUnidentifiedData.Size = new System.Drawing.Size(250, 22);
this.mnuDisassembleUnidentifiedData.Text = "Unidentified Code/Data";
this.mnuDisassembleUnidentifiedData.Click += new System.EventHandler(this.mnuDisassembleUnidentifiedData_Click);
//
// mnuShow
//
this.mnuShow.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuShowDisassembledCode,
this.mnuShowVerifiedData,
this.mnuShowUnidentifiedData});
this.mnuShow.Name = "mnuShow";
this.mnuShow.Size = new System.Drawing.Size(236, 22);
this.mnuShow.Text = "Show...";
//
// mnuShowDisassembledCode
//
this.mnuShowDisassembledCode.Checked = true;
this.mnuShowDisassembledCode.CheckState = System.Windows.Forms.CheckState.Checked;
this.mnuShowDisassembledCode.Enabled = false;
this.mnuShowDisassembledCode.Name = "mnuShowDisassembledCode";
this.mnuShowDisassembledCode.Size = new System.Drawing.Size(199, 22);
this.mnuShowDisassembledCode.Text = "Disassembled Code";
//
// mnuShowVerifiedData
//
this.mnuShowVerifiedData.CheckOnClick = true;
this.mnuShowVerifiedData.Name = "mnuShowVerifiedData";
this.mnuShowVerifiedData.Size = new System.Drawing.Size(199, 22);
this.mnuShowVerifiedData.Text = "Verified Data";
this.mnuShowVerifiedData.Click += new System.EventHandler(this.mnuShowVerifiedData_Click);
//
// mnuShowUnidentifiedData
//
this.mnuShowUnidentifiedData.CheckOnClick = true;
this.mnuShowUnidentifiedData.Name = "mnuShowUnidentifiedData";
this.mnuShowUnidentifiedData.Size = new System.Drawing.Size(199, 22);
this.mnuShowUnidentifiedData.Text = "Unidentified Code/Data";
this.mnuShowUnidentifiedData.Click += new System.EventHandler(this.mnuShowUnidentifiedData_Click);
//
// toolStripMenuItem7
//
this.toolStripMenuItem7.Name = "toolStripMenuItem7";
this.toolStripMenuItem7.Size = new System.Drawing.Size(234, 6);
this.toolStripMenuItem7.Size = new System.Drawing.Size(233, 6);
//
// mnuDisplayOpCodesInLowerCase
//
this.mnuDisplayOpCodesInLowerCase.CheckOnClick = true;
this.mnuDisplayOpCodesInLowerCase.Name = "mnuDisplayOpCodesInLowerCase";
this.mnuDisplayOpCodesInLowerCase.Size = new System.Drawing.Size(237, 22);
this.mnuDisplayOpCodesInLowerCase.Size = new System.Drawing.Size(236, 22);
this.mnuDisplayOpCodesInLowerCase.Text = "Display OP codes in lower case";
this.mnuDisplayOpCodesInLowerCase.Click += new System.EventHandler(this.mnuDisplayOpCodesInLowerCase_Click);
//
// mnuHighlightUnexecutedCode
//
this.mnuHighlightUnexecutedCode.CheckOnClick = true;
this.mnuHighlightUnexecutedCode.Name = "mnuHighlightUnexecutedCode";
this.mnuHighlightUnexecutedCode.Size = new System.Drawing.Size(237, 22);
this.mnuHighlightUnexecutedCode.Text = "Highlight Unexecuted Code";
this.mnuHighlightUnexecutedCode.Click += new System.EventHandler(this.mnuHighlightUnexecutedCode_Click);
//
// mnuShowEffectiveAddresses
//
this.mnuShowEffectiveAddresses.CheckOnClick = true;
this.mnuShowEffectiveAddresses.Name = "mnuShowEffectiveAddresses";
this.mnuShowEffectiveAddresses.Size = new System.Drawing.Size(237, 22);
this.mnuShowEffectiveAddresses.Size = new System.Drawing.Size(236, 22);
this.mnuShowEffectiveAddresses.Text = "Show Effective Addresses";
this.mnuShowEffectiveAddresses.Click += new System.EventHandler(this.mnuShowEffectiveAddresses_Click);
//
// mnuShowOnlyDisassembledCode
// mnuBreakOptions
//
this.mnuShowOnlyDisassembledCode.CheckOnClick = true;
this.mnuShowOnlyDisassembledCode.Name = "mnuShowOnlyDisassembledCode";
this.mnuShowOnlyDisassembledCode.Size = new System.Drawing.Size(237, 22);
this.mnuShowOnlyDisassembledCode.Text = "Show Only Disassembled Code";
this.mnuShowOnlyDisassembledCode.Click += new System.EventHandler(this.mnuShowOnlyDisassembledCode_Click);
//
// breakOptionsToolStripMenuItem
//
this.breakOptionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuBreakOptions.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuBreakOnReset,
this.mnuBreakOnUnofficialOpcodes,
this.mnuBreakOnBrk,
this.toolStripMenuItem15,
this.mnuBreakOnOpen,
this.mnuBreakOnDebuggerFocus});
this.breakOptionsToolStripMenuItem.Name = "breakOptionsToolStripMenuItem";
this.breakOptionsToolStripMenuItem.Size = new System.Drawing.Size(259, 22);
this.breakOptionsToolStripMenuItem.Text = "Break Options";
this.mnuBreakOptions.Name = "mnuBreakOptions";
this.mnuBreakOptions.Size = new System.Drawing.Size(259, 22);
this.mnuBreakOptions.Text = "Break Options";
//
// mnuBreakOnReset
//
@ -1002,6 +1028,14 @@ namespace Mesen.GUI.Debugger
this.toolStripMenuItem12.Name = "toolStripMenuItem12";
this.toolStripMenuItem12.Size = new System.Drawing.Size(256, 6);
//
// mnuConfigureColors
//
this.mnuConfigureColors.Image = global::Mesen.GUI.Properties.Resources.PipetteSmall;
this.mnuConfigureColors.Name = "mnuConfigureColors";
this.mnuConfigureColors.Size = new System.Drawing.Size(259, 22);
this.mnuConfigureColors.Text = "Configure Colors";
this.mnuConfigureColors.Click += new System.EventHandler(this.mnuConfigureColors_Click);
//
// mnuSplitView
//
this.mnuSplitView.CheckOnClick = true;
@ -1511,15 +1545,13 @@ namespace Mesen.GUI.Debugger
private System.Windows.Forms.ToolStripMenuItem mnuDisableDefaultLabels;
private System.Windows.Forms.ToolStripMenuItem mnuBreakOnReset;
private System.Windows.Forms.ToolStripMenuItem mnuDisassemblyOptions;
private System.Windows.Forms.ToolStripMenuItem mnuHighlightUnexecutedCode;
private System.Windows.Forms.ToolStripMenuItem mnuShowEffectiveAddresses;
private System.Windows.Forms.ToolStripMenuItem mnuShowOnlyDisassembledCode;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem7;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem12;
private System.Windows.Forms.ToolStripMenuItem mnuDisassemble;
private System.Windows.Forms.ToolStripMenuItem mnuDisassembleVerifiedCodeOnly;
private System.Windows.Forms.ToolStripMenuItem mnuDisassembleEverything;
private System.Windows.Forms.ToolStripMenuItem mnuDisassembleEverythingButData;
private System.Windows.Forms.ToolStripMenuItem mnuDisassembleVerifiedCode;
private System.Windows.Forms.ToolStripMenuItem mnuDisassembleVerifiedData;
private System.Windows.Forms.ToolStripMenuItem mnuDisassembleUnidentifiedData;
private System.Windows.Forms.ToolStripMenuItem mnuDisplayOpCodesInLowerCase;
private ctrlWatch ctrlWatch;
private GUI.Controls.ctrlSplitContainer ctrlSplitContainerTop;
@ -1532,7 +1564,7 @@ namespace Mesen.GUI.Debugger
private System.Windows.Forms.ToolStripMenuItem mnuAssembler;
private System.Windows.Forms.ToolStripMenuItem mnuCode;
private System.Windows.Forms.ToolStripMenuItem mnuRefreshWatchWhileRunning;
private System.Windows.Forms.ToolStripMenuItem breakOptionsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mnuBreakOptions;
private System.Windows.Forms.ToolStripMenuItem mnuBreakOnDebuggerFocus;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem15;
private System.Windows.Forms.ToolStripMenuItem mnuStepBack;
@ -1553,5 +1585,10 @@ namespace Mesen.GUI.Debugger
private System.Windows.Forms.ToolStripMenuItem mnuShowCodePreview;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem18;
private System.Windows.Forms.ToolStripMenuItem mnuShowOpCodeTooltips;
private System.Windows.Forms.ToolStripMenuItem mnuShow;
private System.Windows.Forms.ToolStripMenuItem mnuShowDisassembledCode;
private System.Windows.Forms.ToolStripMenuItem mnuShowVerifiedData;
private System.Windows.Forms.ToolStripMenuItem mnuShowUnidentifiedData;
private System.Windows.Forms.ToolStripMenuItem mnuConfigureColors;
}
}

View File

@ -59,8 +59,6 @@ namespace Mesen.GUI.Debugger
this.mnuShowCodePreview.Checked = ConfigManager.Config.DebugInfo.ShowCodePreview;
this.mnuShowCpuMemoryMapping.Checked = ConfigManager.Config.DebugInfo.ShowCpuMemoryMapping;
this.mnuShowPpuMemoryMapping.Checked = ConfigManager.Config.DebugInfo.ShowPpuMemoryMapping;
this.mnuShowOnlyDisassembledCode.Checked = ConfigManager.Config.DebugInfo.ShowOnlyDisassembledCode;
this.mnuHighlightUnexecutedCode.Checked = ConfigManager.Config.DebugInfo.HighlightUnexecutedCode;
this.mnuAutoLoadDbgFiles.Checked = ConfigManager.Config.DebugInfo.AutoLoadDbgFiles;
this.mnuAutoLoadCdlFiles.Checked = ConfigManager.Config.DebugInfo.AutoLoadCdlFiles;
this.mnuBreakOnReset.Checked = ConfigManager.Config.DebugInfo.BreakOnReset;
@ -69,9 +67,13 @@ namespace Mesen.GUI.Debugger
this.mnuBreakOnBrk.Checked = ConfigManager.Config.DebugInfo.BreakOnBrk;
this.mnuBreakOnDebuggerFocus.Checked = ConfigManager.Config.DebugInfo.BreakOnDebuggerFocus;
this.mnuDisplayOpCodesInLowerCase.Checked = ConfigManager.Config.DebugInfo.DisplayOpCodesInLowerCase;
this.mnuDisassembleVerifiedCodeOnly.Checked = ConfigManager.Config.DebugInfo.DisassemblyType == DisassemblyType.VerifiedCode;
this.mnuDisassembleEverything.Checked = ConfigManager.Config.DebugInfo.DisassemblyType == DisassemblyType.Everything;
this.mnuDisassembleEverythingButData.Checked = ConfigManager.Config.DebugInfo.DisassemblyType == DisassemblyType.EverythingButData;
this.mnuDisassembleVerifiedData.Checked = ConfigManager.Config.DebugInfo.DisassembleVerifiedData;
this.mnuDisassembleUnidentifiedData.Checked = ConfigManager.Config.DebugInfo.DisassembleUnidentifiedData;
this.mnuShowVerifiedData.Checked = ConfigManager.Config.DebugInfo.ShowVerifiedData;
this.mnuShowUnidentifiedData.Checked = ConfigManager.Config.DebugInfo.ShowUnidentifiedData;
this.mnuRefreshWatchWhileRunning.Checked = ConfigManager.Config.DebugInfo.RefreshWatchWhileRunning;
if(ConfigManager.Config.DebugInfo.WindowWidth > -1) {
@ -231,17 +233,23 @@ namespace Mesen.GUI.Debugger
if(mnuShowEffectiveAddresses.Checked) {
flags |= DebuggerFlags.ShowEffectiveAddresses;
}
if(mnuShowOnlyDisassembledCode.Checked) {
flags |= DebuggerFlags.ShowOnlyDisassembledCode;
}
if(mnuDisplayOpCodesInLowerCase.Checked) {
flags |= DebuggerFlags.DisplayOpCodesInLowerCase;
}
if(mnuDisassembleEverything.Checked) {
flags |= DebuggerFlags.DisassembleEverything;
} else if(mnuDisassembleEverythingButData.Checked) {
flags |= DebuggerFlags.DisassembleEverythingButData;
if(mnuDisassembleVerifiedData.Checked) {
flags |= DebuggerFlags.DisassembleVerifiedData;
}
if(mnuDisassembleUnidentifiedData.Checked) {
flags |= DebuggerFlags.DisassembleUnidentifiedData;
}
if(mnuShowVerifiedData.Checked) {
flags |= DebuggerFlags.ShowVerifiedData;
}
if(mnuShowUnidentifiedData.Checked) {
flags |= DebuggerFlags.ShowUnidentifiedData;
}
if(mnuBreakOnUnofficialOpcodes.Checked) {
flags |= DebuggerFlags.BreakOnUnofficialOpCode;
}
@ -680,13 +688,6 @@ namespace Mesen.GUI.Debugger
UpdateDebugger(false);
}
private void mnuShowOnlyDisassembledCode_Click(object sender, EventArgs e)
{
ConfigManager.Config.DebugInfo.ShowOnlyDisassembledCode = mnuShowOnlyDisassembledCode.Checked;
ConfigManager.ApplyChanges();
UpdateDebugger(false);
}
private void mnuShowCpuMemoryMapping_Click(object sender, EventArgs e)
{
ctrlCpuMemoryMapping.Visible = mnuShowCpuMemoryMapping.Checked;
@ -713,14 +714,6 @@ namespace Mesen.GUI.Debugger
ConfigManager.ApplyChanges();
}
private void mnuHighlightUnexecutedCode_Click(object sender, EventArgs e)
{
ConfigManager.Config.DebugInfo.HighlightUnexecutedCode = mnuHighlightUnexecutedCode.Checked;
ConfigManager.ApplyChanges();
ctrlDebuggerCode.UpdateLineColors();
ctrlDebuggerCodeSplit.UpdateLineColors();
}
private void mnuBreakOnReset_Click(object sender, EventArgs e)
{
ConfigManager.Config.DebugInfo.BreakOnReset = mnuBreakOnReset.Checked;
@ -872,31 +865,35 @@ namespace Mesen.GUI.Debugger
_lastCodeWindow.ScrollToLineNumber((int)sender);
}
private void SetDisassemblyType(DisassemblyType type, ToolStripMenuItem item)
private void UpdateDisassembleFlags()
{
mnuDisassembleVerifiedCodeOnly.Checked = mnuDisassembleEverything.Checked = mnuDisassembleEverythingButData.Checked = false;
item.Checked = true;
ConfigManager.Config.DebugInfo.DisassemblyType = type;
ConfigManager.ApplyChanges();
UpdateDebuggerFlags();
UpdateDebugger(false);
}
private void mnuDisassembleVerifiedCodeOnly_Click(object sender, EventArgs e)
private void mnuDisassembleVerifiedData_Click(object sender, EventArgs e)
{
SetDisassemblyType(DisassemblyType.VerifiedCode, sender as ToolStripMenuItem);
ConfigManager.Config.DebugInfo.DisassembleVerifiedData = mnuDisassembleVerifiedData.Checked;
UpdateDisassembleFlags();
}
private void mnuDisassembleEverything_Click(object sender, EventArgs e)
private void mnuDisassembleUnidentifiedData_Click(object sender, EventArgs e)
{
SetDisassemblyType(DisassemblyType.Everything, sender as ToolStripMenuItem);
ConfigManager.Config.DebugInfo.DisassembleUnidentifiedData = mnuDisassembleUnidentifiedData.Checked;
UpdateDisassembleFlags();
}
private void mnuDisassembleEverythingButData_Click(object sender, EventArgs e)
private void mnuShowVerifiedData_Click(object sender, EventArgs e)
{
SetDisassemblyType(DisassemblyType.EverythingButData, sender as ToolStripMenuItem);
ConfigManager.Config.DebugInfo.ShowVerifiedData = mnuShowVerifiedData.Checked;
UpdateDisassembleFlags();
}
private void mnuShowUnidentifiedData_Click(object sender, EventArgs e)
{
ConfigManager.Config.DebugInfo.ShowUnidentifiedData = mnuShowUnidentifiedData.Checked;
UpdateDisassembleFlags();
}
private void ctrlSplitContainerTop_PanelCollapsed(object sender, EventArgs e)
@ -1038,5 +1035,14 @@ namespace Mesen.GUI.Debugger
{
SaveRomWithCdlStripping(CdlStripFlag.StripUnused);
}
private void mnuConfigureColors_Click(object sender, EventArgs e)
{
using(frmDebuggerColors frm = new frmDebuggerColors()) {
if(frm.ShowDialog(this, this) == DialogResult.OK) {
this.UpdateDebugger(false, true);
}
}
}
}
}

View File

@ -0,0 +1,304 @@
namespace Mesen.GUI.Debugger
{
partial class frmDebuggerColors
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.picActiveStatement = new System.Windows.Forms.PictureBox();
this.lblActiveStatement = new System.Windows.Forms.Label();
this.lblExecBreakpoint = new System.Windows.Forms.Label();
this.lblUnidentifiedData = new System.Windows.Forms.Label();
this.picExecBreakpoint = new System.Windows.Forms.PictureBox();
this.picUnidentifiedData = new System.Windows.Forms.PictureBox();
this.picWriteBreakpoint = new System.Windows.Forms.PictureBox();
this.lblWriteBreakpoint = new System.Windows.Forms.Label();
this.lblUnexecutedCode = new System.Windows.Forms.Label();
this.lblVerifiedData = new System.Windows.Forms.Label();
this.picUnexecutedCode = new System.Windows.Forms.PictureBox();
this.picVerifiedData = new System.Windows.Forms.PictureBox();
this.lblReadBreakpoint = new System.Windows.Forms.Label();
this.picReadBreakpoint = new System.Windows.Forms.PictureBox();
this.btnReset = new System.Windows.Forms.Button();
this.baseConfigPanel.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picActiveStatement)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picExecBreakpoint)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picUnidentifiedData)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picWriteBreakpoint)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picUnexecutedCode)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picVerifiedData)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picReadBreakpoint)).BeginInit();
this.SuspendLayout();
//
// baseConfigPanel
//
this.baseConfigPanel.Controls.Add(this.btnReset);
this.baseConfigPanel.Location = new System.Drawing.Point(0, 116);
this.baseConfigPanel.Size = new System.Drawing.Size(555, 29);
this.baseConfigPanel.Controls.SetChildIndex(this.btnReset, 0);
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 8;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33332F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33334F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33334F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.Controls.Add(this.picActiveStatement, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.lblActiveStatement, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.lblExecBreakpoint, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.lblUnidentifiedData, 3, 0);
this.tableLayoutPanel1.Controls.Add(this.picExecBreakpoint, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.picUnidentifiedData, 4, 0);
this.tableLayoutPanel1.Controls.Add(this.picWriteBreakpoint, 4, 1);
this.tableLayoutPanel1.Controls.Add(this.lblWriteBreakpoint, 3, 1);
this.tableLayoutPanel1.Controls.Add(this.lblUnexecutedCode, 6, 0);
this.tableLayoutPanel1.Controls.Add(this.lblVerifiedData, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.picUnexecutedCode, 7, 0);
this.tableLayoutPanel1.Controls.Add(this.picVerifiedData, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.lblReadBreakpoint, 6, 1);
this.tableLayoutPanel1.Controls.Add(this.picReadBreakpoint, 7, 1);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 6;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(555, 145);
this.tableLayoutPanel1.TabIndex = 2;
//
// picActiveStatement
//
this.picActiveStatement.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picActiveStatement.Cursor = System.Windows.Forms.Cursors.Hand;
this.picActiveStatement.Location = new System.Drawing.Point(136, 79);
this.picActiveStatement.Name = "picActiveStatement";
this.picActiveStatement.Size = new System.Drawing.Size(32, 32);
this.picActiveStatement.TabIndex = 7;
this.picActiveStatement.TabStop = false;
this.picActiveStatement.Click += new System.EventHandler(this.picColorPicker_Click);
//
// lblActiveStatement
//
this.lblActiveStatement.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblActiveStatement.AutoSize = true;
this.lblActiveStatement.Location = new System.Drawing.Point(3, 88);
this.lblActiveStatement.Name = "lblActiveStatement";
this.lblActiveStatement.Size = new System.Drawing.Size(91, 13);
this.lblActiveStatement.TabIndex = 4;
this.lblActiveStatement.Text = "Active Statement:";
//
// lblExecBreakpoint
//
this.lblExecBreakpoint.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblExecBreakpoint.AutoSize = true;
this.lblExecBreakpoint.Location = new System.Drawing.Point(3, 50);
this.lblExecBreakpoint.Name = "lblExecBreakpoint";
this.lblExecBreakpoint.Size = new System.Drawing.Size(88, 13);
this.lblExecBreakpoint.TabIndex = 2;
this.lblExecBreakpoint.Text = "Exec Breakpoint:";
//
// lblUnidentifiedData
//
this.lblUnidentifiedData.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblUnidentifiedData.AutoSize = true;
this.lblUnidentifiedData.Location = new System.Drawing.Point(194, 12);
this.lblUnidentifiedData.Name = "lblUnidentifiedData";
this.lblUnidentifiedData.Size = new System.Drawing.Size(122, 13);
this.lblUnidentifiedData.TabIndex = 10;
this.lblUnidentifiedData.Text = "Unidentified Data/Code:";
//
// picExecBreakpoint
//
this.picExecBreakpoint.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picExecBreakpoint.Cursor = System.Windows.Forms.Cursors.Hand;
this.picExecBreakpoint.Location = new System.Drawing.Point(136, 41);
this.picExecBreakpoint.Name = "picExecBreakpoint";
this.picExecBreakpoint.Size = new System.Drawing.Size(32, 32);
this.picExecBreakpoint.TabIndex = 6;
this.picExecBreakpoint.TabStop = false;
this.picExecBreakpoint.Click += new System.EventHandler(this.picColorPicker_Click);
//
// picUnidentifiedData
//
this.picUnidentifiedData.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picUnidentifiedData.Cursor = System.Windows.Forms.Cursors.Hand;
this.picUnidentifiedData.Location = new System.Drawing.Point(327, 3);
this.picUnidentifiedData.Name = "picUnidentifiedData";
this.picUnidentifiedData.Size = new System.Drawing.Size(32, 32);
this.picUnidentifiedData.TabIndex = 8;
this.picUnidentifiedData.TabStop = false;
this.picUnidentifiedData.Click += new System.EventHandler(this.picColorPicker_Click);
//
// picWriteBreakpoint
//
this.picWriteBreakpoint.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picWriteBreakpoint.Cursor = System.Windows.Forms.Cursors.Hand;
this.picWriteBreakpoint.Location = new System.Drawing.Point(327, 41);
this.picWriteBreakpoint.Name = "picWriteBreakpoint";
this.picWriteBreakpoint.Size = new System.Drawing.Size(32, 32);
this.picWriteBreakpoint.TabIndex = 12;
this.picWriteBreakpoint.TabStop = false;
this.picWriteBreakpoint.Click += new System.EventHandler(this.picColorPicker_Click);
//
// lblWriteBreakpoint
//
this.lblWriteBreakpoint.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblWriteBreakpoint.AutoSize = true;
this.lblWriteBreakpoint.Location = new System.Drawing.Point(194, 50);
this.lblWriteBreakpoint.Name = "lblWriteBreakpoint";
this.lblWriteBreakpoint.Size = new System.Drawing.Size(89, 13);
this.lblWriteBreakpoint.TabIndex = 1;
this.lblWriteBreakpoint.Text = "Write Breakpoint:";
//
// lblUnexecutedCode
//
this.lblUnexecutedCode.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblUnexecutedCode.AutoSize = true;
this.lblUnexecutedCode.Location = new System.Drawing.Point(385, 12);
this.lblUnexecutedCode.Name = "lblUnexecutedCode";
this.lblUnexecutedCode.Size = new System.Drawing.Size(96, 13);
this.lblUnexecutedCode.TabIndex = 0;
this.lblUnexecutedCode.Text = "Unexecuted Code:";
//
// lblVerifiedData
//
this.lblVerifiedData.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblVerifiedData.AutoSize = true;
this.lblVerifiedData.Location = new System.Drawing.Point(3, 12);
this.lblVerifiedData.Name = "lblVerifiedData";
this.lblVerifiedData.Size = new System.Drawing.Size(71, 13);
this.lblVerifiedData.TabIndex = 11;
this.lblVerifiedData.Text = "Verified Data:";
//
// picUnexecutedCode
//
this.picUnexecutedCode.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picUnexecutedCode.Cursor = System.Windows.Forms.Cursors.Hand;
this.picUnexecutedCode.Location = new System.Drawing.Point(518, 3);
this.picUnexecutedCode.Name = "picUnexecutedCode";
this.picUnexecutedCode.Size = new System.Drawing.Size(32, 32);
this.picUnexecutedCode.TabIndex = 5;
this.picUnexecutedCode.TabStop = false;
this.picUnexecutedCode.Click += new System.EventHandler(this.picColorPicker_Click);
//
// picVerifiedData
//
this.picVerifiedData.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picVerifiedData.Cursor = System.Windows.Forms.Cursors.Hand;
this.picVerifiedData.Location = new System.Drawing.Point(136, 3);
this.picVerifiedData.Name = "picVerifiedData";
this.picVerifiedData.Size = new System.Drawing.Size(32, 32);
this.picVerifiedData.TabIndex = 9;
this.picVerifiedData.TabStop = false;
this.picVerifiedData.Click += new System.EventHandler(this.picColorPicker_Click);
//
// lblReadBreakpoint
//
this.lblReadBreakpoint.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblReadBreakpoint.AutoSize = true;
this.lblReadBreakpoint.Location = new System.Drawing.Point(385, 50);
this.lblReadBreakpoint.Name = "lblReadBreakpoint";
this.lblReadBreakpoint.Size = new System.Drawing.Size(90, 13);
this.lblReadBreakpoint.TabIndex = 16;
this.lblReadBreakpoint.Text = "Read Breakpoint:";
//
// picReadBreakpoint
//
this.picReadBreakpoint.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picReadBreakpoint.Cursor = System.Windows.Forms.Cursors.Hand;
this.picReadBreakpoint.Location = new System.Drawing.Point(518, 41);
this.picReadBreakpoint.Name = "picReadBreakpoint";
this.picReadBreakpoint.Size = new System.Drawing.Size(32, 32);
this.picReadBreakpoint.TabIndex = 17;
this.picReadBreakpoint.TabStop = false;
this.picReadBreakpoint.Click += new System.EventHandler(this.picColorPicker_Click);
//
// btnReset
//
this.btnReset.Location = new System.Drawing.Point(3, 3);
this.btnReset.Name = "btnReset";
this.btnReset.Size = new System.Drawing.Size(102, 23);
this.btnReset.TabIndex = 3;
this.btnReset.Text = "Use default colors";
this.btnReset.UseVisualStyleBackColor = true;
this.btnReset.Click += new System.EventHandler(this.btnReset_Click);
//
// frmDebuggerColors
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(555, 145);
this.Controls.Add(this.tableLayoutPanel1);
this.Name = "frmDebuggerColors";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Configure Colors...";
this.Controls.SetChildIndex(this.tableLayoutPanel1, 0);
this.Controls.SetChildIndex(this.baseConfigPanel, 0);
this.baseConfigPanel.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picActiveStatement)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picExecBreakpoint)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picUnidentifiedData)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picWriteBreakpoint)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picUnexecutedCode)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picVerifiedData)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picReadBreakpoint)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label lblActiveStatement;
private System.Windows.Forms.Label lblExecBreakpoint;
private System.Windows.Forms.Label lblUnexecutedCode;
private System.Windows.Forms.Label lblWriteBreakpoint;
private System.Windows.Forms.PictureBox picVerifiedData;
private System.Windows.Forms.PictureBox picUnidentifiedData;
private System.Windows.Forms.PictureBox picActiveStatement;
private System.Windows.Forms.PictureBox picExecBreakpoint;
private System.Windows.Forms.PictureBox picUnexecutedCode;
private System.Windows.Forms.Label lblUnidentifiedData;
private System.Windows.Forms.Label lblVerifiedData;
private System.Windows.Forms.PictureBox picWriteBreakpoint;
private System.Windows.Forms.Button btnReset;
private System.Windows.Forms.Label lblReadBreakpoint;
private System.Windows.Forms.PictureBox picReadBreakpoint;
}
}

View File

@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Mesen.GUI.Config;
using Mesen.GUI.Forms;
namespace Mesen.GUI.Debugger
{
public partial class frmDebuggerColors : BaseConfigForm
{
public frmDebuggerColors()
{
InitializeComponent();
picVerifiedData.BackColor = ConfigManager.Config.DebugInfo.CodeVerifiedDataColor;
picUnidentifiedData.BackColor = ConfigManager.Config.DebugInfo.CodeUnidentifiedDataColor;
picUnexecutedCode.BackColor = ConfigManager.Config.DebugInfo.CodeUnexecutedCodeColor;
picExecBreakpoint.BackColor = ConfigManager.Config.DebugInfo.CodeExecBreakpointColor;
picWriteBreakpoint.BackColor = ConfigManager.Config.DebugInfo.CodeWriteBreakpointColor;
picReadBreakpoint.BackColor = ConfigManager.Config.DebugInfo.CodeReadBreakpointColor;
picActiveStatement.BackColor = ConfigManager.Config.DebugInfo.CodeActiveStatementColor;
}
private void picColorPicker_Click(object sender, EventArgs e)
{
using(ColorDialog cd = new ColorDialog()) {
cd.SolidColorOnly = true;
cd.AllowFullOpen = true;
cd.FullOpen = true;
cd.Color = ((PictureBox)sender).BackColor;
if(cd.ShowDialog() == DialogResult.OK) {
((PictureBox)sender).BackColor = cd.Color;
}
}
}
protected override void OnFormClosing(FormClosingEventArgs e)
{
base.OnFormClosing(e);
if(DialogResult == DialogResult.OK) {
ConfigManager.Config.DebugInfo.CodeVerifiedDataColor = picVerifiedData.BackColor;
ConfigManager.Config.DebugInfo.CodeUnidentifiedDataColor = picUnidentifiedData.BackColor;
ConfigManager.Config.DebugInfo.CodeUnexecutedCodeColor = picUnexecutedCode.BackColor;
ConfigManager.Config.DebugInfo.CodeExecBreakpointColor = picExecBreakpoint.BackColor;
ConfigManager.Config.DebugInfo.CodeWriteBreakpointColor = picWriteBreakpoint.BackColor;
ConfigManager.Config.DebugInfo.CodeReadBreakpointColor = picReadBreakpoint.BackColor;
ConfigManager.Config.DebugInfo.CodeActiveStatementColor = picActiveStatement.BackColor;
ConfigManager.ApplyChanges();
}
}
private void btnReset_Click(object sender, EventArgs e)
{
picVerifiedData.BackColor = Color.FromArgb(255, 252, 236);
picUnidentifiedData.BackColor = Color.FromArgb(255, 242, 242);
picUnexecutedCode.BackColor = Color.FromArgb(225, 244, 228);
picExecBreakpoint.BackColor = Color.FromArgb(140, 40, 40);
picWriteBreakpoint.BackColor = Color.FromArgb(40, 120, 80);
picReadBreakpoint.BackColor = Color.FromArgb(40, 40, 200);
picActiveStatement.BackColor = Color.Yellow;
}
}
}

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -85,7 +85,7 @@ namespace Mesen.GUI.Debugger
public void ShowAddress(int address)
{
tabMain.SelectedTab = tpgMemoryViewer;
cboMemoryType.SetEnumValue(DebugMemoryType.CpuMemory);
cboMemoryType.SelectedIndex = 0; //Select CPU Memory
ctrlHexViewer.GoToAddress(address);
}
@ -437,6 +437,33 @@ namespace Mesen.GUI.Debugger
WatchManager.AddWatch(toAdd);
};
var mnuMarkSelectionAs = new ToolStripMenuItem();
var mnuMarkAsCode = new ToolStripMenuItem();
mnuMarkAsCode.Text = "Verified Code";
mnuMarkAsCode.Click += (s, e) => {
int startAddress = (int)hexBox.SelectionStart;
int endAddress = (int)(hexBox.SelectionStart + (hexBox.SelectionLength == 0 ? 0 : (hexBox.SelectionLength - 1)));
this.MarkSelectionAs(startAddress, endAddress, CdlPrgFlags.Code);
};
var mnuMarkAsData = new ToolStripMenuItem();
mnuMarkAsData.Text = "Verified Data";
mnuMarkAsData.Click += (s, e) => {
int startAddress = (int)hexBox.SelectionStart;
int endAddress = (int)(hexBox.SelectionStart + (hexBox.SelectionLength == 0 ? 0 : (hexBox.SelectionLength - 1)));
this.MarkSelectionAs(startAddress, endAddress, CdlPrgFlags.Data);
};
var mnuMarkAsUnidentifiedData = new ToolStripMenuItem();
mnuMarkAsUnidentifiedData.Text = "Unidentified Data";
mnuMarkAsUnidentifiedData.Click += (s, e) => {
int startAddress = (int)hexBox.SelectionStart;
int endAddress = (int)(hexBox.SelectionStart + (hexBox.SelectionLength == 0 ? 0 : (hexBox.SelectionLength - 1)));
this.MarkSelectionAs(startAddress, endAddress, CdlPrgFlags.None);
};
mnuMarkSelectionAs.DropDownItems.Add(mnuMarkAsCode);
mnuMarkSelectionAs.DropDownItems.Add(mnuMarkAsData);
mnuMarkSelectionAs.DropDownItems.Add(mnuMarkAsUnidentifiedData);
var mnuFreeze = new ToolStripMenuItem();
mnuFreeze.Click += (s, e) => {
UInt32 startAddress = (UInt32)hexBox.SelectionStart;
@ -477,6 +504,25 @@ namespace Mesen.GUI.Debugger
mnuFreeze.Tag = false;
}
if(this._memoryType == DebugMemoryType.CpuMemory) {
int absStart = InteropEmu.DebugGetAbsoluteAddress(startAddress);
int absEnd = InteropEmu.DebugGetAbsoluteAddress(endAddress);
if(absStart >= 0 && absEnd >= 0 && absStart <= absEnd) {
mnuMarkSelectionAs.Text = "Mark selection as... (" + addressRange + ")";
mnuMarkSelectionAs.Enabled = true;
} else {
mnuMarkSelectionAs.Text = "Mark selection as...";
mnuMarkSelectionAs.Enabled = false;
}
} else if(this._memoryType == DebugMemoryType.PrgRom) {
mnuMarkSelectionAs.Text = "Mark selection as... (" + addressRange + ")";
mnuMarkSelectionAs.Enabled = true;
} else {
mnuMarkSelectionAs.Text = "Mark selection as...";
mnuMarkSelectionAs.Enabled = false;
}
bool disableEditLabel = false;
if(this._memoryType == DebugMemoryType.CpuMemory) {
AddressTypeInfo info = new AddressTypeInfo();
@ -495,6 +541,24 @@ namespace Mesen.GUI.Debugger
hexBox.ContextMenuStrip.Items.Insert(0, mnuEditLabel);
hexBox.ContextMenuStrip.Items.Insert(0, mnuEditBreakpoint);
hexBox.ContextMenuStrip.Items.Insert(0, mnuAddWatch);
hexBox.ContextMenuStrip.Items.Insert(0, new ToolStripSeparator());
hexBox.ContextMenuStrip.Items.Insert(0, mnuMarkSelectionAs);
}
private void MarkSelectionAs(int start, int end, CdlPrgFlags type)
{
if(_memoryType == DebugMemoryType.CpuMemory) {
start = InteropEmu.DebugGetAbsoluteAddress((UInt32)start);
end = InteropEmu.DebugGetAbsoluteAddress((UInt32)end);
}
if(start >= 0 && end >= 0 && start <= end) {
InteropEmu.DebugMarkPrgBytesAs((UInt32)start, (UInt32)end, type);
frmDebugger debugger = DebugWindowManager.GetDebugger();
if(debugger != null) {
debugger.UpdateDebugger(false, false);
}
}
}
private void mnuColorProviderOptions_Click(object sender, EventArgs e)

View File

@ -540,6 +540,12 @@
<Compile Include="Debugger\frmAssembler.Designer.cs">
<DependentUpon>frmAssembler.cs</DependentUpon>
</Compile>
<Compile Include="Debugger\frmDebuggerColors.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Debugger\frmDebuggerColors.Designer.cs">
<DependentUpon>frmDebuggerColors.cs</DependentUpon>
</Compile>
<Compile Include="Debugger\frmOpCodeTooltip.cs">
<SubType>Form</SubType>
</Compile>
@ -1194,6 +1200,9 @@
<EmbeddedResource Include="Debugger\frmAssembler.resx">
<DependentUpon>frmAssembler.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Debugger\frmDebuggerColors.resx">
<DependentUpon>frmDebuggerColors.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Debugger\frmOpCodeTooltip.resx">
<DependentUpon>frmOpCodeTooltip.cs</DependentUpon>
</EmbeddedResource>

View File

@ -265,6 +265,7 @@ namespace Mesen.GUI
[DllImport(DLLPath, EntryPoint = "DebugGetExecutionTrace")] private static extern IntPtr DebugGetExecutionTraceWrapper(UInt32 lineCount);
public static string DebugGetExecutionTrace(UInt32 lineCount) { return PtrToStringUtf8(InteropEmu.DebugGetExecutionTraceWrapper(lineCount)); }
[DllImport(DLLPath)] public static extern void DebugMarkPrgBytesAs(UInt32 start, UInt32 end, CdlPrgFlags type);
[DllImport(DLLPath)] [return: MarshalAs(UnmanagedType.I1)] public static extern bool DebugLoadCdlFile([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8Marshaler))]string cdlFilepath);
[DllImport(DLLPath)] [return: MarshalAs(UnmanagedType.I1)] public static extern bool DebugSaveCdlFile([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8Marshaler))]string cdlFilepath);
[DllImport(DLLPath)] public static extern void DebugGetCdlRatios(ref CdlRatios ratios);
@ -1048,6 +1049,17 @@ namespace Mesen.GUI
StripUsed = 2
}
public enum CdlPrgFlags
{
None = 0x00,
Code = 0x01,
Data = 0x02,
IndirectCode = 0x10,
IndirectData = 0x20,
PcmData = 0x40,
SubEntryPoint = 0x80
}
public struct DebugState
{
public CPUState CPU;
@ -1433,12 +1445,14 @@ namespace Mesen.GUI
None = 0x00,
PpuPartialDraw = 0x01,
ShowEffectiveAddresses = 0x02,
ShowOnlyDisassembledCode = 0x04,
DisplayOpCodesInLowerCase = 0x08,
DisassembleEverything = 0x10,
DisassembleEverythingButData = 0x20,
BreakOnBrk = 0x40,
BreakOnUnofficialOpCode = 0x80,
DisplayOpCodesInLowerCase = 0x04,
BreakOnBrk = 0x08,
BreakOnUnofficialOpCode = 0x10,
DisassembleVerifiedData = 0x20,
DisassembleUnidentifiedData = 0x40,
ShowVerifiedData = 0x80,
ShowUnidentifiedData = 0x100,
}
public struct InteropRomInfo

View File

@ -77,7 +77,8 @@ extern "C"
DllExport void __stdcall DebugGetCdlRatios(CdlRatios* cdlRatios) { *cdlRatios = GetDebugger()->GetCodeDataLogger()->GetRatios(); }
DllExport void __stdcall DebugResetCdlLog() { GetDebugger()->ResetCdl(); }
DllExport void __stdcall DebugGetCdlData(uint32_t offset, uint32_t length, DebugMemoryType memoryType, uint8_t* cdlData) { GetDebugger()->GetCodeDataLogger()->GetCdlData(offset, length, memoryType, cdlData); }
DllExport void __stdcall DebugMarkPrgBytesAs(uint32_t start, uint32_t end, CdlPrgFlags type) { GetDebugger()->GetCodeDataLogger()->MarkPrgBytesAs(start, end, type); }
DllExport int32_t __stdcall DebugEvaluateExpression(char* expression, EvalResultType *resultType) { return GetDebugger()->EvaluateExpression(expression, *resultType); }
DllExport void __stdcall DebugSetTraceOptions(TraceLoggerOptions options) { GetDebugger()->GetTraceLogger()->SetOptions(options); }