diff --git a/PluginCommon/Interfaces.cs b/PluginCommon/Interfaces.cs index a4c9e12..3f9f655 100644 --- a/PluginCommon/Interfaces.cs +++ b/PluginCommon/Interfaces.cs @@ -39,6 +39,11 @@ namespace PluginCommon { /// 65xx code and data. /// Mapping between offsets and addresses. void Prepare(IApplication appRef, byte[] fileData, AddressTranslate addrTrans); + + /// + /// Tells the plugin that we're done talking to it for now. + /// + void Unprepare(); } /// @@ -138,7 +143,8 @@ namespace PluginCommon { /// /// VisGen identifier. /// Parameter set. - /// 2D visualization object reference. + /// 2D visualization object reference, or null if something went + /// wrong (unknown ident, bad parameters, etc). IVisualization2d Generate2d(VisDescr descr, Dictionary parms); } diff --git a/PluginCommon/PluginManager.cs b/PluginCommon/PluginManager.cs index dba75db..8a5d847 100644 --- a/PluginCommon/PluginManager.cs +++ b/PluginCommon/PluginManager.cs @@ -169,6 +169,16 @@ namespace PluginCommon { } } + /// + /// Invokes the Unprepare() method on all active plugins. + /// + public void UnpreparePlugins() { + foreach (KeyValuePair kvp in mActivePlugins) { + IPlugin ipl = kvp.Value; + ipl.Unprepare(); + } + } + /// /// Returns true if any of the plugins report that the before or after label is /// significant. diff --git a/PluginCommon/Util.cs b/PluginCommon/Util.cs index 3a67915..2911748 100644 --- a/PluginCommon/Util.cs +++ b/PluginCommon/Util.cs @@ -14,7 +14,7 @@ * limitations under the License. */ using System; - +using System.Collections.Generic; using CommonUtil; namespace PluginCommon { @@ -97,5 +97,23 @@ namespace PluginCommon { public static int MakeARGB(int a, int r, int g, int b) { return (a << 24) | (r << 16) | (g << 8) | b; } + + /// + /// Extracts a typed value from a dictionary with plain object values. + /// + /// Type of value to retrieve. + /// Dictionary with values. + /// Entry to find. + /// Default value. + /// Value found, or the default if the key doesn't exist or the value has the + /// wrong type. + public static T GetFromObjDict(Dictionary dict, string key, T defVal) { + if (dict.TryGetValue(key, out object objVal)) { + if (objVal is T) { + return (T)objVal; + } + } + return defVal; + } } } diff --git a/PluginCommon/VisBitmap8.cs b/PluginCommon/VisBitmap8.cs index 711c17b..fdfd08a 100644 --- a/PluginCommon/VisBitmap8.cs +++ b/PluginCommon/VisBitmap8.cs @@ -52,7 +52,7 @@ namespace PluginCommon { } public void SetPixelIndex(int x, int y, byte colorIndex) { - if (x < 0 || x >= Width || y < 0 || y >= Width) { + if (x < 0 || x >= Width || y < 0 || y >= Height) { throw new ArgumentException("Bad x/y: " + x + "," + y + " (width=" + Width + " height=" + Height + ")"); } @@ -82,7 +82,18 @@ namespace PluginCommon { Debug.WriteLine("Palette is full"); return; } + for (int i = 0; i < mNextColor; i++) { + if (mPalette[i] == color) { + Debug.WriteLine("Color " + color.ToString("x6") + + " already exists in palette (" + i + ")"); + return; + } + } mPalette[mNextColor++] = color; } + + public void AddColor(byte a, byte r, byte g, byte b) { + AddColor(Util.MakeARGB(a, r, g, b)); + } } } diff --git a/SourceGen/CodeAnalysis.cs b/SourceGen/CodeAnalysis.cs index a78ce16..4bae921 100644 --- a/SourceGen/CodeAnalysis.cs +++ b/SourceGen/CodeAnalysis.cs @@ -292,6 +292,9 @@ namespace SourceGen { searchStart = FindFirstUnvisitedInstruction(searchStart); } + if (mScriptManager != null) { + mScriptManager.UnprepareScripts(); + } mScriptSupport.Shutdown(); MarkUnexecutedEmbeddedCode(); diff --git a/SourceGen/DisasmProject.cs b/SourceGen/DisasmProject.cs index 35c3fb6..77c065c 100644 --- a/SourceGen/DisasmProject.cs +++ b/SourceGen/DisasmProject.cs @@ -2443,9 +2443,16 @@ namespace SourceGen { return bestSym; } + // Punch-through functions; trying to avoid exposing ScriptManager for now. public List GetActivePlugins() { return mScriptManager.GetActivePlugins(); } + public void PrepareScripts(PluginCommon.IApplication appRef) { + mScriptManager.PrepareScripts(appRef); + } + public void UnprepareScripts() { + mScriptManager.UnprepareScripts(); + } /// /// For debugging purposes, get some information about the currently loaded diff --git a/SourceGen/DisplayList.cs b/SourceGen/DisplayList.cs index 14bb69f..f219d51 100644 --- a/SourceGen/DisplayList.cs +++ b/SourceGen/DisplayList.cs @@ -354,6 +354,7 @@ namespace SourceGen { public string Operand { get; private set; } public string Comment { get; private set; } public bool IsLongComment { get; private set; } + public bool IsVisualizationSet { get; private set; } public bool HasBackgroundColor { get; private set; } public Brush BackgroundBrush { get; private set; } @@ -448,6 +449,13 @@ namespace SourceGen { return parts; } + public static FormattedParts CreateVisualizationSet(string summary) { + FormattedParts parts = new FormattedParts(); + parts.Comment = summary; + parts.IsVisualizationSet = true; + return parts; + } + public static FormattedParts AddSelectionHighlight(FormattedParts orig) { FormattedParts newParts = Clone(orig); newParts.HasAddrLabelHighlight = true; diff --git a/SourceGen/LineListGen.cs b/SourceGen/LineListGen.cs index 79b3812..18c4a58 100644 --- a/SourceGen/LineListGen.cs +++ b/SourceGen/LineListGen.cs @@ -509,7 +509,7 @@ namespace SourceGen { // TODO(xyzzy) mProject.VisualizationSets.TryGetValue(line.FileOffset, out VisualizationSet visSet); - parts = FormattedParts.CreateLongComment("!VISUALIZATION SET! " + + parts = FormattedParts.CreateVisualizationSet("!VISUALIZATION SET! " + (visSet != null ? "VS:" + visSet.Count : "???")); break; case Line.Type.Blank: diff --git a/SourceGen/RuntimeData/Apple/GSOS.cs b/SourceGen/RuntimeData/Apple/GSOS.cs index 57412d1..ffa34e8 100644 --- a/SourceGen/RuntimeData/Apple/GSOS.cs +++ b/SourceGen/RuntimeData/Apple/GSOS.cs @@ -54,7 +54,11 @@ namespace RuntimeData.Apple { mAppRef.DebugLog("GSOS(id=" + AppDomain.CurrentDomain.Id + "): prepare()"); //System.Diagnostics.Debugger.Break(); + } + public void Unprepare() { + mAppRef = null; + mFileData = null; } public void UpdateSymbolList(List plSyms) { diff --git a/SourceGen/RuntimeData/Apple/IIgs-Toolbox.cs b/SourceGen/RuntimeData/Apple/IIgs-Toolbox.cs index 7510975..978be22 100644 --- a/SourceGen/RuntimeData/Apple/IIgs-Toolbox.cs +++ b/SourceGen/RuntimeData/Apple/IIgs-Toolbox.cs @@ -47,6 +47,11 @@ namespace RuntimeData.Apple { mAppRef.DebugLog("IIgsToolbox(id=" + AppDomain.CurrentDomain.Id + "): prepare()"); } + public void Unprepare() { + mAppRef = null; + mFileData = null; + } + public void UpdateSymbolList(List plSyms) { // Extract the list of function name constants from the platform symbol file. mFunctionList = PlSymbol.GeneratePlatformValueList(plSyms, TOOLBOX_FUNC_TAG, mAppRef); diff --git a/SourceGen/RuntimeData/Apple/ProDOS8.cs b/SourceGen/RuntimeData/Apple/ProDOS8.cs index b2f67ce..b4b6b51 100644 --- a/SourceGen/RuntimeData/Apple/ProDOS8.cs +++ b/SourceGen/RuntimeData/Apple/ProDOS8.cs @@ -166,8 +166,14 @@ namespace RuntimeData.Apple { mAppRef.DebugLog("ProDOS(id=" + AppDomain.CurrentDomain.Id + "): prepare()"); //System.Diagnostics.Debugger.Break(); - } + + public void Unprepare() { + mAppRef = null; + mFileData = null; + mAddrTrans = null; + } + public void UpdateSymbolList(List plSyms) { // Extract the list of function name constants from the platform symbol file. mFunctionList = PlSymbol.GeneratePlatformValueList(plSyms, P8_MLI_TAG, mAppRef); diff --git a/SourceGen/RuntimeData/Apple/SOS.cs b/SourceGen/RuntimeData/Apple/SOS.cs index 93eb325..00ae99a 100644 --- a/SourceGen/RuntimeData/Apple/SOS.cs +++ b/SourceGen/RuntimeData/Apple/SOS.cs @@ -51,6 +51,11 @@ namespace RuntimeData.Apple { //System.Diagnostics.Debugger.Break(); } + public void Unprepare() { + mAppRef = null; + mFileData = null; + } + public void UpdateSymbolList(List plSyms) { // Extract the list of function name constants from the platform symbol file. mFunctionList = PlSymbol.GeneratePlatformValueList(plSyms, SOS_MLI_TAG, mAppRef); diff --git a/SourceGen/RuntimeData/Apple/VisHiRes.cs b/SourceGen/RuntimeData/Apple/VisHiRes.cs index 3b187b9..29e5fc3 100644 --- a/SourceGen/RuntimeData/Apple/VisHiRes.cs +++ b/SourceGen/RuntimeData/Apple/VisHiRes.cs @@ -21,6 +21,7 @@ using PluginCommon; namespace RuntimeData.Apple { public class VisHiRes : MarshalByRefObject, IPlugin, IPlugin_Visualizer { + // IPlugin public string Identifier { get { return "Apple II Hi-Res Graphic Visualizer"; } } @@ -32,49 +33,71 @@ namespace RuntimeData.Apple { private const string VIS_GEN_BITMAP = "apple2-hi-res-bitmap"; private const string VIS_GEN_MULTI_MAP = "apple2-hi-res-multi-map"; + private const string P_OFFSET = "offset"; + private const string P_BYTE_WIDTH = "byteWidth"; + private const string P_HEIGHT = "height"; + private const string P_COL_STRIDE = "colStride"; + private const string P_ROW_STRIDE = "rowStride"; + private const string P_IS_COLOR = "isColor"; + private const string P_IS_FIRST_ODD = "isFirstOdd"; + + private const string P_ITEM_BYTE_WIDTH = "itemByteWidth"; + private const string P_ITEM_HEIGHT = "itemHeight"; + private const string P_COUNT = "count"; + + private const int MAX_DIM = 4096; + // Visualization descriptors. private VisDescr[] mDescriptors = new VisDescr[] { new VisDescr(VIS_GEN_BITMAP, "Apple II Hi-Res Bitmap", VisDescr.VisType.Bitmap, new VisParamDescr[] { new VisParamDescr("File offset (hex)", - "offset", typeof(int), 0, 0x00ffffff, VisParamDescr.SpecialMode.Offset, + P_OFFSET, typeof(int), 0, 0x00ffffff, VisParamDescr.SpecialMode.Offset, 0x2000), new VisParamDescr("Width (in bytes)", - "byteWidth", typeof(int), 1, 40, 0, 1), + P_BYTE_WIDTH, typeof(int), 1, 40, 0, 1), new VisParamDescr("Height", - "height", typeof(int), 1, 192, 0, 1), + P_HEIGHT, typeof(int), 1, 192, 0, 1), new VisParamDescr("Column stride (bytes)", - "colStride", typeof(int), 0, 256, 0, 0), + P_COL_STRIDE, typeof(int), 0, 256, 0, 0), new VisParamDescr("Row stride (bytes)", - "rowStride", typeof(int), 0, 256, 0, 0), + P_ROW_STRIDE, typeof(int), 0, 256, 0, 0), new VisParamDescr("Color", - "color", typeof(bool), 0, 0, 0, true), - new VisParamDescr("First byte odd", - "firstOdd", typeof(bool), 0, 0, 0, false), + P_IS_COLOR, typeof(bool), 0, 0, 0, true), + new VisParamDescr("First col odd", + P_IS_FIRST_ODD, typeof(bool), 0, 0, 0, false), new VisParamDescr("Test Float", "floaty", typeof(float), -5.0f, 5.0f, 0, 0.1f), }), new VisDescr(VIS_GEN_MULTI_MAP, "Apple II Hi-Res Multi-Map", VisDescr.VisType.Bitmap, new VisParamDescr[] { new VisParamDescr("File offset (hex)", - "offset", typeof(int), 0, 0x00ffffff, VisParamDescr.SpecialMode.Offset, + P_OFFSET, typeof(int), 0, 0x00ffffff, VisParamDescr.SpecialMode.Offset, 0x1000), new VisParamDescr("Item width (in bytes)", - "itemByteWidth", typeof(int), 1, 40, 0, 1), + P_ITEM_BYTE_WIDTH, typeof(int), 1, 40, 0, 1), new VisParamDescr("Item height", - "itemHeight", typeof(int), 1, 192, 0, 8), + P_ITEM_HEIGHT, typeof(int), 1, 192, 0, 8), new VisParamDescr("Number of items", - "count", typeof(int), 1, 256, 0, 1), + P_COUNT, typeof(int), 1, 256, 0, 1), }), }; + // IPlugin public void Prepare(IApplication appRef, byte[] fileData, AddressTranslate addrTrans) { mAppRef = appRef; mFileData = fileData; mAddrTrans = addrTrans; } + // IPlugin + public void Unprepare() { + mAppRef = null; + mFileData = null; + mAddrTrans = null; + } + // IPlugin_Visualizer public VisDescr[] GetVisGenDescrs() { return mDescriptors; @@ -83,17 +106,241 @@ namespace RuntimeData.Apple { // IPlugin_Visualizer public IVisualization2d Generate2d(VisDescr descr, Dictionary parms) { - // TODO: replace with actual - VisBitmap8 vb = new VisBitmap8(16, 16); - vb.AddColor(Util.MakeARGB(0xff, 0x40, 0x40, 0x40)); - vb.AddColor(Util.MakeARGB(0xff, 0xff, 0x00, 0x00)); - vb.AddColor(Util.MakeARGB(0xff, 0x00, 0xff, 0x80)); + switch (descr.Ident) { + case VIS_GEN_BITMAP: + return GenerateBitmap(parms); + case VIS_GEN_MULTI_MAP: + // TODO + return null; + default: + mAppRef.DebugLog("Unknown ident " + descr.Ident); + return null; + } + } - for (int i = 0; i < 16; i++) { - vb.SetPixelIndex(i, i, 1); - vb.SetPixelIndex(15 - i, i, 2); + private IVisualization2d GenerateBitmap(Dictionary parms) { + int offset, byteWidth, height, colStride, rowStride; + bool isColor, isFirstOdd; + + offset = Util.GetFromObjDict(parms, P_OFFSET, 0); + byteWidth = Util.GetFromObjDict(parms, P_BYTE_WIDTH, 0); // width ignoring colStride + height = Util.GetFromObjDict(parms, P_HEIGHT, 0); + colStride = Util.GetFromObjDict(parms, P_COL_STRIDE, 0); + rowStride = Util.GetFromObjDict(parms, P_ROW_STRIDE, 0); + isColor = Util.GetFromObjDict(parms, P_IS_COLOR, true); + isFirstOdd = Util.GetFromObjDict(parms, P_IS_FIRST_ODD, false); + + // We allow the stride entries to be zero to indicate a "dense" bitmap. + if (colStride == 0) { + colStride = 1; + } + if (rowStride == 0) { + rowStride = byteWidth * colStride; + } + + if (offset < 0 || offset >= mFileData.Length || + byteWidth <= 0 || byteWidth > MAX_DIM || + height <= 0 || height > MAX_DIM || + colStride <= 0 || colStride > MAX_DIM || + rowStride < byteWidth * colStride - (colStride-1) || rowStride > MAX_DIM) { + mAppRef.DebugLog("Invalid parameter"); + return null; + } + + int lastOffset = offset + rowStride * height - (colStride - 1) - 1; + if (lastOffset >= mFileData.Length) { + mAppRef.DebugLog("Bitmap runs off end of file (lastOffset=" + lastOffset + ")"); + return null; + } + + VisBitmap8 vb = new VisBitmap8(byteWidth * 7, height); + SetHiResPalette(vb); + + if (!isColor) { + // B&W mode. Since we're not displaying this we don't need to worry about + // half-pixel shifts, and can just convert 7 bits to pixels. + int bx = 0; + int by = 0; + for (int row = 0; row < height; row++) { + int colIdx = 0; + for (int col = 0; col < byteWidth; col++) { + byte val = mFileData[offset + colIdx]; + for (int bit = 0; bit < 7; bit++) { + vb.SetPixelIndex(bx, by, (byte)((val & 0x01) + 1)); // black or white + val >>= 1; + bx++; + } + colIdx += colStride; + } + bx = 0; + by++; + offset += rowStride; + } + } else { + int bx = 0; + int by = 0; + +#if false + // Color mode. We treat the data as a strictly 140-mode bitmap, which doesn't + // quite match up with how the pixels will be displayed, but does allow a + // straightforward conversion between file formats. Color fringing is severe. + for (int row = 0; row < height; row++) { + int lastBit; + if (isFirstOdd) { + lastBit = 0; // pretend we already have one bit + } else { + lastBit = -1; + } + + for (int colByte = 0; colByte < byteWidth; colByte += colStride) { + byte val = mFileData[offset + colByte]; + bool hiBitSet = (val & 0x80) != 0; + + // Grab 3 or 4 pairs of bits. + int pairCount = (lastBit < 0) ? 3 : 4; + while (pairCount-- > 0) { + int twoBits; + if (lastBit >= 0) { + // merge with bit from previous byte + twoBits = (lastBit << 1) | (val & 0x01); + val >>= 1; + lastBit = -1; + } else { + // grab two bits + twoBits = (val & 0x03); + val >>= 2; + } + + if (hiBitSet) { + twoBits += 4; + } + + // We're in 140 mode, so set two adjacent pixels. + vb.SetPixelIndex(bx++, by, sHiResColorMap[twoBits]); + vb.SetPixelIndex(bx++, by, sHiResColorMap[twoBits]); + } + + bool thisEven = ((colByte & 0x01) == 0) ^ isFirstOdd; + if (thisEven) { + // started in even column we have one bit left over + lastBit = val & 0x01; + } else { + // started in odd column, all bits consumed + lastBit = -1; + } + } + bx = 0; + by++; + offset += rowStride; + } +#else + // Color conversion similar to what CiderPress does, but without the half-pixel + // shift (we're trying to create a 1:1 bitmap). + bool[] lineBits = new bool[byteWidth * 7]; + bool[] hiFlags = new bool[byteWidth * 7]; // overkill, but simplifies things + int[] colorBuf = new int[byteWidth * 7]; + for (int row = 0; row < height; row++) { + // Unravel the bits. + int idx = 0; + int colIdx = 0; + for (int col = 0; col < byteWidth; col++) { + byte val = mFileData[offset + colIdx]; + bool hiBitSet = (val & 0x80) != 0; + + for (int bit = 0; bit < 7; bit++) { + hiFlags[idx] = hiBitSet; + lineBits[idx] = (val & 0x01) != 0; + idx++; + val >>= 1; + } + colIdx += colStride; + } + + // Convert to color. + int lastBit = byteWidth * 7; + for (idx = 0; idx < lastBit; idx++) { + int colorShift = hiFlags[idx] ? 4 : 0; + if (!lineBits[idx]) { + // Bit not set, set pixel to black. + colorBuf[idx] = (int)HiResColors.Black0 + colorShift; + } else { + // Bit set, set pixel to white or color. + if (idx > 0 && colorBuf[idx - 1] != (int)HiResColors.Black0 && + colorBuf[idx - 1] != (int)HiResColors.Black1) { + // previous bit was also set, this is white + colorBuf[idx] = (int)HiResColors.White0 + colorShift; + + // the previous pixel is part of a run of white + colorBuf[idx - 1] = (int)HiResColors.White0 + colorShift; + } else { + // previous bit not set *or* was first pixel in line; + // set color based on whether this is even or odd pixel col + bool isOdd = ((idx & 0x01) != 0) ^ isFirstOdd; + if (isOdd) { + colorBuf[idx] = (int)HiResColors.Green + colorShift; + } else { + colorBuf[idx] = (int)HiResColors.Purple + colorShift; + } + } + + // Do we have a run of the same color? If so, smooth the color out. + // Note that white blends smoothly with everything. + if (idx > 1 && (colorBuf[idx - 2] == colorBuf[idx] || + colorBuf[idx - 2] == (int)HiResColors.White0 || + colorBuf[idx - 2] == (int)HiResColors.White1)) { + + //if (colorBuf[idx - 1] != (int)HiResColors.Black0 && + // colorBuf[idx - 1] != (int) HiResColors.Black1) { + // mAppRef.DebugLog("Unexpected color at row=" + by + + // " idx=" + idx + ": " + colorBuf[idx - 1]); + //} + + colorBuf[idx - 1] = colorBuf[idx]; + } + } + } + + // Write to bitmap. + for (idx = 0; idx < lastBit; idx++) { + vb.SetPixelIndex(bx++, by, sHiResColorMap[colorBuf[idx]]); + } + + // move to next row + bx = 0; + by++; + offset += rowStride; + } +#endif } return vb; } + + private enum HiResColors { + Black0 = 0, + Green = 1, + Purple = 2, + White0 = 3, + Black1 = 4, + Orange = 5, + Blue = 6, + White1 = 7 + } + + // HiRes: black0, green, purple, white0, black1, orange, blue, white1 + private static readonly byte[] sHiResColorMap = new byte[8] { + 1, 3, 4, 2, 1, 5, 6, 2 + }; + + private void SetHiResPalette(VisBitmap8 vb) { + // These don't match directly to hi-res color numbers because we want to + // avoid adding black/white twice. + vb.AddColor(0xff, 0xff, 0, 0); // 0=transparent (xyzzy: all 0) + vb.AddColor(0xff, 0x00, 0x00, 0x00); // 1=black0/black1 + vb.AddColor(0xff, 0xff, 0xff, 0xff); // 2=white0/white1 + vb.AddColor(0xff, 0x11, 0xdd, 0x00); // 3=green + vb.AddColor(0xff, 0xdd, 0x22, 0xdd); // 4=purple + vb.AddColor(0xff, 0xff, 0x66, 0x00); // 5=orange + vb.AddColor(0xff, 0x22, 0x22, 0xff); // 6=blue + } } } diff --git a/SourceGen/SGTestData/2011-hinting.cs b/SourceGen/SGTestData/2011-hinting.cs index cb09b80..fbf7aa9 100644 --- a/SourceGen/SGTestData/2011-hinting.cs +++ b/SourceGen/SGTestData/2011-hinting.cs @@ -24,6 +24,11 @@ namespace RuntimeData.Test2011 { mAppRef.DebugLog("Test2011(id=" + AppDomain.CurrentDomain.Id + "): prepare()"); } + public void Unprepare() { + mAppRef = null; + mFileData = null; + } + public void CheckJsr(int offset, int operand, out bool noContinue) { int ADDR = 0x2456; diff --git a/SourceGen/SGTestData/2022-extension-scripts-a.cs b/SourceGen/SGTestData/2022-extension-scripts-a.cs index 46426b9..5d77b30 100644 --- a/SourceGen/SGTestData/2022-extension-scripts-a.cs +++ b/SourceGen/SGTestData/2022-extension-scripts-a.cs @@ -31,6 +31,12 @@ namespace RuntimeData.Test2022 { mAppRef.DebugLog("Test2022-A(id=" + AppDomain.CurrentDomain.Id + "): prepare()"); } + + public void Unprepare() { + mAppRef = null; + mFileData = null; + } + public void UpdateSymbolList(List plSyms) { foreach (PlSymbol sym in plSyms) { switch (sym.Label) { diff --git a/SourceGen/SGTestData/2022-extension-scripts-b.cs b/SourceGen/SGTestData/2022-extension-scripts-b.cs index 3ed5725..4933764 100644 --- a/SourceGen/SGTestData/2022-extension-scripts-b.cs +++ b/SourceGen/SGTestData/2022-extension-scripts-b.cs @@ -26,6 +26,12 @@ namespace RuntimeData.Test2022 { mAppRef.DebugLog("Test2022-B(id=" + AppDomain.CurrentDomain.Id + "): prepare()"); } + public void Unprepare() { + mAppRef = null; + mFileData = null; + mAddrTrans = null; + } + public void CheckBrk(int offset, bool twoByteBrk, out bool noContinue) { noContinue = true; diff --git a/SourceGen/Sandbox/ScriptManager.cs b/SourceGen/Sandbox/ScriptManager.cs index 9c29df7..931ebf0 100644 --- a/SourceGen/Sandbox/ScriptManager.cs +++ b/SourceGen/Sandbox/ScriptManager.cs @@ -173,6 +173,22 @@ namespace SourceGen.Sandbox { } } + /// + /// Puts scripts back to sleep. + /// + public void UnprepareScripts() { + if (DomainMgr == null) { + foreach (KeyValuePair kvp in mActivePlugins) { + IPlugin ipl = kvp.Value; + ipl.Unprepare(); + } + } else { + List addrEnts = mProject.AddrMap.GetEntryList(); + DomainMgr.PluginMgr.UnpreparePlugins(); + } + } + + /// /// Returns true if any of the plugins report that the before or after label is /// significant. diff --git a/SourceGen/Visualization.cs b/SourceGen/Visualization.cs index 4968aa8..021ef63 100644 --- a/SourceGen/Visualization.cs +++ b/SourceGen/Visualization.cs @@ -38,15 +38,15 @@ namespace SourceGen { /// public Dictionary VisGenParams { get; private set; } - public double Thumbnail { get; } // TODO - 64x64(?) bitmap + private BitmapSource Thumbnail { get; set; } // TODO - 64x64(?) bitmap /// /// Constructor. /// - /// - /// - /// + /// Unique identifier. + /// Visualization generator identifier. + /// Parameters for visualization generator. public Visualization(string tag, string visGenIdent, Dictionary visGenParams) { Tag = tag; @@ -54,7 +54,12 @@ namespace SourceGen { VisGenParams = visGenParams; } - public static BitmapSource CreateBitmapSource(IVisualization2d vis2d) { + /// + /// Converts an IVisualization2d to a BitmapSource for display. + /// + /// + /// + public static BitmapSource ConvertToBitmapSource(IVisualization2d vis2d) { // Create indexed color palette. int[] intPal = vis2d.GetPalette(); List colors = new List(intPal.Length); diff --git a/SourceGen/WpfGui/CodeListItemStyle.xaml b/SourceGen/WpfGui/CodeListItemStyle.xaml index 422ffed..cd32ada 100644 --- a/SourceGen/WpfGui/CodeListItemStyle.xaml +++ b/SourceGen/WpfGui/CodeListItemStyle.xaml @@ -76,6 +76,38 @@ See also https://github.com/fadden/DisasmUiTest Width="{Binding LongCommentWidth}"/> + + + + + + + + + + + + +