private static void addBehCommandToDump(ref List <ScriptDumpCommandInfo> dump, byte[] cmd, byte seg, uint offset, string description) { ScriptDumpCommandInfo info = new ScriptDumpCommandInfo(); info.data = cmd; info.description = description; info.segAddress = (uint)(seg << 24) | offset; info.romAddress = ROM.Instance.decodeSegmentAddress_safe(seg, offset); dump.Add(info); }
private static void addGLSCommandToDump(ref Model3D mdl, byte[] cmd, byte seg, uint offset, string description, byte?areaID) { ScriptDumpCommandInfo info = new ScriptDumpCommandInfo(); info.data = cmd; info.description = description; info.segAddress = (uint)(seg << 24) | offset; info.romAddress = ROM.Instance.decodeSegmentAddress_safe(seg, offset, areaID); mdl.GeoLayoutCommands_ForDump.Add(info); }
private static void addF3DCommandToDump(ref Model3D mdl, byte[] cmd, byte seg, uint offset, string description, byte?areaID) { ScriptDumpCommandInfo info = new ScriptDumpCommandInfo(); info.data = cmd; info.description = description; info.segAddress = (uint)(seg << 24) | offset; info.romAddress = ROM.Instance.decodeSegmentAddress_safe(seg, offset, areaID); //Console.WriteLine("Adding to dump " + (mdl.Fast3DCommands_ForDump.Count - 1)); if (mdl.Fast3DCommands_ForDump.Count > 0) { mdl.Fast3DCommands_ForDump[mdl.Fast3DCommands_ForDump.Count - 1].Add(info); } }
private void organizeCurrentBehaviorScript(List <ScriptDumpCommandInfo> behList) { // Apparently "RichTextBox.AppendText()" is a REALLY slow function, but luckly you can just give the RichTextBox a string in RTF format. This will drastically speed up performance. bool showROMAddr = showRomCB.Checked; bool showSegAddr = SegAddrCB.Checked; bool showComments = CommCB.Checked; bool formatBytes = FormatCB.Checked; bool indentBytes = IndentCB.Checked; currentTextbox.Clear(); int currentIndent = 0; StringBuilder sb = new StringBuilder(); sb.Append("{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Courier New;}}{\\colortbl;\\red200\\green200\\blue200;\\red0\\green128\\blue0; }\\viewkind4\\uc1\\pard\\f0\\fs17 "); sb.Append("\\cf1 "); //init colour 1 (lightgrey) for (int i = 0; i < behList.Count; i++) { ScriptDumpCommandInfo info = behList[i]; if (showROMAddr || showSegAddr) { sb.Append("["); if (showROMAddr) { sb.Append(info.romAddress.ToString("X8")); if (showSegAddr) { sb.Append(" / "); sb.Append(info.segAddress.ToString("X8")); } } else if (showSegAddr) { sb.Append(info.segAddress.ToString("X8")); } sb.Append("] "); } if (indentBytes) { for (int j = 0; j < currentIndent; j++) { sb.Append(" "); } bool isLastIndex = (i == behList.Count - 1); switch (info.data[0]) { case 0x02: case 0x05: case 0x08: currentIndent++; break; case 0x03: case 0x06: case 0x09: currentIndent--; break; } } sb.Append(format_BehCmd(info.data, formatBytes)); if (showComments) { sb.Append("\\cf2 // "); // Set to color #2 (Green) sb.Append(info.description); sb.Append("\\cf1 "); // Set to color #1 (Lightgrey) } sb.Append("\\line "); // Add a new line } sb.Append("}"); currentTextbox.Rtf = sb.ToString(); }
private void organizeCurrentLevelScript(List <ScriptDumpCommandInfo> lsList) { // Apparently "RichTextBox.AppendText()" is a REALLY slow function, but luckly you can just give the RichTextBox a string in RTF format. This will drastically speed up performance. bool showROMAddr = showRomCB.Checked; bool showSegAddr = SegAddrCB.Checked; bool showComments = CommCB.Checked; bool formatBytes = FormatCB.Checked; bool indentBytes = IndentCB.Checked; currentTextbox.Clear(); int currentIndent = 0; StringBuilder sb = new StringBuilder(); sb.Append("{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Courier New;}}{\\colortbl;\\red" + Theme.SCRIPTDUMPS_LEVEL_TEXTBOX_TEXT.R + "\\green" + Theme.SCRIPTDUMPS_LEVEL_TEXTBOX_TEXT.G + "\\blue" + Theme.SCRIPTDUMPS_LEVEL_TEXTBOX_TEXT.B + ";\\red" + Theme.SCRIPTDUMPS_LEVEL_TEXTBOX_COMMENTS.R + "\\green" + Theme.SCRIPTDUMPS_LEVEL_TEXTBOX_COMMENTS.G + "\\blue" + Theme.SCRIPTDUMPS_LEVEL_TEXTBOX_COMMENTS.B + "; }\\viewkind4\\uc1\\pard\\f0\\fs17\\cf1 "); for (int i = 0; i < lsList.Count; i++) { ScriptDumpCommandInfo info = lsList[i]; if (showROMAddr || showSegAddr) { sb.Append("["); if (showROMAddr) { sb.Append(info.romAddress.ToString("X8")); if (showSegAddr) { sb.Append(" / "); sb.Append(info.segAddress.ToString("X8")); } } else if (showSegAddr) { sb.Append(info.segAddress.ToString("X8")); } sb.Append("] "); } if (indentBytes) { for (int j = 0; j < currentIndent; j++) { sb.Append(" "); } bool isLastIndex = (i == lsList.Count - 1); switch (info.data[0]) { case 0x1B: case 0x1F: case 0x06: case 0x00: case 0x01: currentIndent++; break; case 0x1D: case 0x20: case 0x02: case 0x07: currentIndent--; break; } } sb.Append(format_LSCmd(info.data, formatBytes)); if (showComments) { sb.Append("\\cf2 // "); // Set to color #2 (Green) sb.Append(info.description); sb.Append("\\cf1 "); // Set to color #1 (Black) } sb.Append("\\line "); // Add a new line } sb.Append("}"); currentTextbox.Rtf = sb.ToString(); }
private void organizeCurrentFast3DScript(List <ScriptDumpCommandInfo> f3dList) { bool showROMAddr = showRomCB.Checked; bool showSegAddr = SegAddrCB.Checked; bool showComments = CommCB.Checked; bool formatBytes = FormatCB.Checked; bool indentBytes = IndentCB.Checked; currentTextbox.Clear(); int currentIndent = 0; StringBuilder sb = new StringBuilder(); sb.Append("{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Courier New;}}{\\colortbl;\\red0\\green0\\blue0;\\red0\\green128\\blue0; }\\viewkind4\\uc1\\pard\\f0\\fs17 "); for (int i = 0; i < f3dList.Count; i++) { ScriptDumpCommandInfo info = f3dList[i]; if (showROMAddr || showSegAddr) { sb.Append("["); if (showROMAddr) { sb.Append(info.romAddress.ToString("X8")); if (showSegAddr) { sb.Append(" / "); sb.Append(info.segAddress.ToString("X8")); } } else if (showSegAddr) { sb.Append(info.segAddress.ToString("X8")); } sb.Append("] "); } if (indentBytes) { for (int j = 0; j < currentIndent; j++) { sb.Append(" "); } bool isLastIndex = (i == f3dList.Count - 1); switch (info.data[0]) { case 0x06: currentIndent++; break; case 0xB8: if (currentIndent > 0) { currentIndent--; } break; } } sb.Append(format_F3DCmd(info.data, formatBytes)); if (showComments) { sb.Append("\\cf2 // "); // Set to color #2 (Green) sb.Append(info.description); sb.Append("\\cf1 "); // Set to color #1 (Black) } sb.Append("\\line "); // Add a new line } sb.Append("}"); currentTextbox.Rtf = sb.ToString(); }