From e49c00ac365027c18eec395f63999a4e55597106 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 7 Sep 2013 18:36:49 +0000 Subject: [PATCH] Reorganize the tools folder, making new folders for Lua, Watch, and Hex Editor, start new Watch Editor dialog. Split new Watch objects into their own file, rename legacy watch object accordingly --- .../BizHawk.MultiClient.csproj | 237 ++--- .../BizHawk.MultiClient_v4.5.csproj | 237 ++--- BizHawk.MultiClient/HistoryCollection.cs | 16 +- .../{ => HexEditor}/HexColor.Designer.cs | 0 .../tools/{ => HexEditor}/HexColor.cs | 0 .../tools/{ => HexEditor}/HexColor.resx | 0 .../{ => HexEditor}/HexEditor.Designer.cs | 0 .../tools/{ => HexEditor}/HexEditor.cs | 20 +- .../tools/{ => HexEditor}/HexEditor.resx | 0 .../tools/{ => HexEditor}/HexFind.Designer.cs | 0 .../tools/{ => HexEditor}/HexFind.cs | 0 .../tools/{ => HexEditor}/HexFind.resx | 0 .../tools/{ => Lua}/LuaButton.cs | 0 .../tools/{ => Lua}/LuaConsole.Designer.cs | 0 .../tools/{ => Lua}/LuaConsole.cs | 0 .../tools/{ => Lua}/LuaConsole.resx | 0 .../tools/{ => Lua}/LuaDocumentation.cs | 0 .../tools/{ => Lua}/LuaFiles.cs | 0 .../{ => Lua}/LuaFunctionList.Designer.cs | 0 .../tools/{ => Lua}/LuaFunctionList.cs | 0 .../tools/{ => Lua}/LuaFunctionList.resx | 0 .../{ => tools/Lua}/LuaImplementation.cs | 0 .../LuaRegisteredFunctionsList.Designer.cs | 0 .../{ => Lua}/LuaRegisteredFunctionsList.cs | 0 .../{ => Lua}/LuaRegisteredFunctionsList.resx | 0 .../tools/{ => Lua}/LuaText.cs | 0 .../tools/{ => Lua}/LuaTextBox.cs | 0 .../tools/{ => Lua}/LuaWinform.Designer.cs | 0 .../tools/{ => Lua}/LuaWinform.cs | 0 .../tools/{ => Lua}/LuaWinform.resx | 0 .../tools/{ => Lua}/LuaWriter.Designer.cs | 0 .../tools/{ => Lua}/LuaWriter.cs | 0 .../tools/{ => Lua}/LuaWriter.resx | 0 .../tools/{ => Lua}/LuaWriterBox.cs | 0 .../LuaWriterColorConfig.Designer.cs | 0 .../tools/{ => Lua}/LuaWriterColorConfig.cs | 0 .../tools/{ => Lua}/LuaWriterColorConfig.resx | 0 .../tools/{ => Watch}/NewRamWatch.Designer.cs | 0 .../tools/{ => Watch}/NewRamWatch.cs | 0 .../tools/{ => Watch}/NewRamWatch.resx | 0 .../tools/{ => Watch}/RamPoke.Designer.cs | 0 .../tools/{ => Watch}/RamPoke.cs | 92 +- .../tools/{ => Watch}/RamPoke.resx | 0 .../tools/{ => Watch}/RamSearch.Designer.cs | 0 .../tools/{ => Watch}/RamSearch.cs | 220 ++--- .../tools/{ => Watch}/RamSearch.resx | 0 .../tools/{ => Watch}/RamWatch.Designer.cs | 0 .../tools/{ => Watch}/RamWatch.cs | 44 +- .../tools/{ => Watch}/RamWatch.resx | 0 .../{ => Watch}/RamWatchNewWatch.Designer.cs | 0 .../tools/{ => Watch}/RamWatchNewWatch.cs | 30 +- .../tools/{ => Watch}/RamWatchNewWatch.resx | 0 .../tools/{ => Watch}/Watch.cs | 924 +----------------- .../tools/{ => Watch}/WatchCommon.cs | 8 +- .../tools/Watch/WatchEditor.Designer.cs | 311 ++++++ .../tools/Watch/WatchEditor.cs | 248 +++++ .../tools/Watch/WatchEditor.resx | 120 +++ .../tools/Watch/WatchLegacy.cs | 895 +++++++++++++++++ 58 files changed, 2049 insertions(+), 1353 deletions(-) rename BizHawk.MultiClient/tools/{ => HexEditor}/HexColor.Designer.cs (100%) rename BizHawk.MultiClient/tools/{ => HexEditor}/HexColor.cs (100%) rename BizHawk.MultiClient/tools/{ => HexEditor}/HexColor.resx (100%) rename BizHawk.MultiClient/tools/{ => HexEditor}/HexEditor.Designer.cs (100%) rename BizHawk.MultiClient/tools/{ => HexEditor}/HexEditor.cs (95%) rename BizHawk.MultiClient/tools/{ => HexEditor}/HexEditor.resx (100%) rename BizHawk.MultiClient/tools/{ => HexEditor}/HexFind.Designer.cs (100%) rename BizHawk.MultiClient/tools/{ => HexEditor}/HexFind.cs (100%) rename BizHawk.MultiClient/tools/{ => HexEditor}/HexFind.resx (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaButton.cs (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaConsole.Designer.cs (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaConsole.cs (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaConsole.resx (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaDocumentation.cs (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaFiles.cs (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaFunctionList.Designer.cs (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaFunctionList.cs (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaFunctionList.resx (100%) rename BizHawk.MultiClient/{ => tools/Lua}/LuaImplementation.cs (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaRegisteredFunctionsList.Designer.cs (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaRegisteredFunctionsList.cs (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaRegisteredFunctionsList.resx (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaText.cs (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaTextBox.cs (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaWinform.Designer.cs (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaWinform.cs (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaWinform.resx (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaWriter.Designer.cs (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaWriter.cs (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaWriter.resx (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaWriterBox.cs (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaWriterColorConfig.Designer.cs (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaWriterColorConfig.cs (100%) rename BizHawk.MultiClient/tools/{ => Lua}/LuaWriterColorConfig.resx (100%) rename BizHawk.MultiClient/tools/{ => Watch}/NewRamWatch.Designer.cs (100%) rename BizHawk.MultiClient/tools/{ => Watch}/NewRamWatch.cs (100%) rename BizHawk.MultiClient/tools/{ => Watch}/NewRamWatch.resx (100%) rename BizHawk.MultiClient/tools/{ => Watch}/RamPoke.Designer.cs (100%) rename BizHawk.MultiClient/tools/{ => Watch}/RamPoke.cs (78%) rename BizHawk.MultiClient/tools/{ => Watch}/RamPoke.resx (100%) rename BizHawk.MultiClient/tools/{ => Watch}/RamSearch.Designer.cs (100%) rename BizHawk.MultiClient/tools/{ => Watch}/RamSearch.cs (89%) rename BizHawk.MultiClient/tools/{ => Watch}/RamSearch.resx (100%) rename BizHawk.MultiClient/tools/{ => Watch}/RamWatch.Designer.cs (100%) rename BizHawk.MultiClient/tools/{ => Watch}/RamWatch.cs (93%) rename BizHawk.MultiClient/tools/{ => Watch}/RamWatch.resx (100%) rename BizHawk.MultiClient/tools/{ => Watch}/RamWatchNewWatch.Designer.cs (100%) rename BizHawk.MultiClient/tools/{ => Watch}/RamWatchNewWatch.cs (83%) rename BizHawk.MultiClient/tools/{ => Watch}/RamWatchNewWatch.resx (100%) rename BizHawk.MultiClient/tools/{ => Watch}/Watch.cs (50%) rename BizHawk.MultiClient/tools/{ => Watch}/WatchCommon.cs (93%) create mode 100644 BizHawk.MultiClient/tools/Watch/WatchEditor.Designer.cs create mode 100644 BizHawk.MultiClient/tools/Watch/WatchEditor.cs create mode 100644 BizHawk.MultiClient/tools/Watch/WatchEditor.resx create mode 100644 BizHawk.MultiClient/tools/Watch/WatchLegacy.cs diff --git a/BizHawk.MultiClient/BizHawk.MultiClient.csproj b/BizHawk.MultiClient/BizHawk.MultiClient.csproj index fd70c44bba..2dca27179b 100644 --- a/BizHawk.MultiClient/BizHawk.MultiClient.csproj +++ b/BizHawk.MultiClient/BizHawk.MultiClient.csproj @@ -325,7 +325,6 @@ - Form @@ -486,58 +485,73 @@ N64VideoPluginconfig.cs - + Form - + HexColor.cs - + Form - + + HexEditor.cs + + + Form + + HexFind.cs - + Component - - + Form - + + LuaConsole.cs + + + + + Form + + + LuaFunctionList.cs + + + + Form + + LuaRegisteredFunctionsList.cs - + + Component - + Form - + LuaWinform.cs - + Form - + LuaWriter.cs - + Component - + Form - + LuaWriterColorConfig.cs - - Form - - - NewRamWatch.cs - @@ -643,7 +657,45 @@ Component - + + Form + + + NewRamWatch.cs + + + Form + + + RamPoke.cs + + + Form + + + RamSearch.cs + + + Form + + + RamWatch.cs + + + Form + + + RamWatchNewWatch.cs + + + + + Form + + + WatchEditor.cs + + FFmpegWriterForm.cs @@ -762,43 +814,38 @@ N64VideoPluginconfig.cs - - HexColor.cs - - - HexFind.cs - - - LuaFunctionList.cs - - - LuaRegisteredFunctionsList.cs - - - LuaWinform.cs - - - LuaWriter.cs - - - LuaWriterColorConfig.cs - - - NewRamWatch.cs - - - RamWatch.cs - Designer - - - RamWatchNewWatch.cs - Designer - True Resources.resx True + + HexColor.cs + + + HexEditor.cs + + + HexFind.cs + + + LuaConsole.cs + + + LuaFunctionList.cs + + + LuaRegisteredFunctionsList.cs + + + LuaWinform.cs + + + LuaWriter.cs + + + LuaWriterColorConfig.cs + VirtualPad.cs @@ -826,6 +873,24 @@ VirtualPadSaturnControl.cs + + NewRamWatch.cs + + + RamPoke.cs + + + RamSearch.cs + + + RamWatch.cs + + + RamWatchNewWatch.cs + + + WatchEditor.cs + SettingsSingleFileGenerator Settings.Designer.cs @@ -858,60 +923,16 @@ Cheats.cs - - Form - - - LuaFunctionList.cs - - - Form - - - HexEditor.cs - - - Form - - - LuaConsole.cs - - - Component - - Form - - - RamPoke.cs - Form InputPrompt.cs - - Form - - - RamSearch.cs - - - Form - - - RamWatch.cs - - - Form - - - RamWatchNewWatch.cs - @@ -929,7 +950,6 @@ ToolBox.cs - @@ -1015,29 +1035,14 @@ TraceLogger.cs - - HexEditor.cs - Designer - - - LuaConsole.cs - MemoryViewer.cs Designer - - RamPoke.cs - Designer - InputPrompt.cs Designer - - RamSearch.cs - Designer - TAStudio.cs diff --git a/BizHawk.MultiClient/BizHawk.MultiClient_v4.5.csproj b/BizHawk.MultiClient/BizHawk.MultiClient_v4.5.csproj index f4ff57614e..a76836806b 100644 --- a/BizHawk.MultiClient/BizHawk.MultiClient_v4.5.csproj +++ b/BizHawk.MultiClient/BizHawk.MultiClient_v4.5.csproj @@ -339,7 +339,6 @@ - Form @@ -488,58 +487,73 @@ SNESOptions.cs - + Form - + HexColor.cs - + Form - + + HexEditor.cs + + + Form + + HexFind.cs - + Component - - + Form - + + LuaConsole.cs + + + + + Form + + + LuaFunctionList.cs + + + + Form + + LuaRegisteredFunctionsList.cs - + + Component - + Form - + LuaWinform.cs - + Form - + LuaWriter.cs - + Component - + Form - + LuaWriterColorConfig.cs - - Form - - - NewRamWatch.cs - @@ -645,7 +659,45 @@ Component - + + Form + + + NewRamWatch.cs + + + Form + + + RamPoke.cs + + + Form + + + RamSearch.cs + + + Form + + + RamWatch.cs + + + Form + + + RamWatchNewWatch.cs + + + + + Form + + + WatchEditor.cs + + FFmpegWriterForm.cs @@ -762,43 +814,38 @@ SNESOptions.cs - - HexColor.cs - - - HexFind.cs - - - LuaFunctionList.cs - - - LuaRegisteredFunctionsList.cs - - - LuaWinform.cs - - - LuaWriter.cs - - - LuaWriterColorConfig.cs - - - NewRamWatch.cs - - - RamWatch.cs - Designer - - - RamWatchNewWatch.cs - Designer - True Resources.resx True + + HexColor.cs + + + HexEditor.cs + + + HexFind.cs + + + LuaConsole.cs + + + LuaFunctionList.cs + + + LuaRegisteredFunctionsList.cs + + + LuaWinform.cs + + + LuaWriter.cs + + + LuaWriterColorConfig.cs + VirtualPad.cs @@ -826,6 +873,24 @@ VirtualPadSaturnControl.cs + + NewRamWatch.cs + + + RamPoke.cs + + + RamSearch.cs + + + RamWatch.cs + + + RamWatchNewWatch.cs + + + WatchEditor.cs + SettingsSingleFileGenerator Settings.Designer.cs @@ -858,60 +923,16 @@ Cheats.cs - - Form - - - LuaFunctionList.cs - - - Form - - - HexEditor.cs - - - Form - - - LuaConsole.cs - - - Component - - Form - - - RamPoke.cs - Form InputPrompt.cs - - Form - - - RamSearch.cs - - - Form - - - RamWatch.cs - - - Form - - - RamWatchNewWatch.cs - @@ -929,7 +950,6 @@ ToolBox.cs - @@ -1015,29 +1035,14 @@ TraceLogger.cs - - HexEditor.cs - Designer - - - LuaConsole.cs - MemoryViewer.cs Designer - - RamPoke.cs - Designer - InputPrompt.cs Designer - - RamSearch.cs - Designer - TAStudio.cs diff --git a/BizHawk.MultiClient/HistoryCollection.cs b/BizHawk.MultiClient/HistoryCollection.cs index 709466cafd..3fad588818 100644 --- a/BizHawk.MultiClient/HistoryCollection.cs +++ b/BizHawk.MultiClient/HistoryCollection.cs @@ -5,26 +5,26 @@ namespace BizHawk.MultiClient { public class HistoryCollection { - public List> History { get; private set; } + public List> History { get; private set; } private int curPos; //1-based public bool Enabled { get; private set; } public HistoryCollection(bool enabled) { - History = new List>(); + History = new List>(); Enabled = enabled; } - public HistoryCollection(List newState, bool enabled) + public HistoryCollection(List newState, bool enabled) { - History = new List>(); + History = new List>(); AddState(newState); Enabled = enabled; } public void Clear() { - History = new List>(); + History = new List>(); } public bool CanUndo @@ -42,7 +42,7 @@ namespace BizHawk.MultiClient get { return Enabled && History.Any(); } } - public void AddState(List newState) + public void AddState(List newState) { if (Enabled) { @@ -59,7 +59,7 @@ namespace BizHawk.MultiClient } } - public List Undo() + public List Undo() { if (CanUndo && Enabled) { @@ -72,7 +72,7 @@ namespace BizHawk.MultiClient } } - public List Redo() + public List Redo() { if (CanRedo && Enabled) { diff --git a/BizHawk.MultiClient/tools/HexColor.Designer.cs b/BizHawk.MultiClient/tools/HexEditor/HexColor.Designer.cs similarity index 100% rename from BizHawk.MultiClient/tools/HexColor.Designer.cs rename to BizHawk.MultiClient/tools/HexEditor/HexColor.Designer.cs diff --git a/BizHawk.MultiClient/tools/HexColor.cs b/BizHawk.MultiClient/tools/HexEditor/HexColor.cs similarity index 100% rename from BizHawk.MultiClient/tools/HexColor.cs rename to BizHawk.MultiClient/tools/HexEditor/HexColor.cs diff --git a/BizHawk.MultiClient/tools/HexColor.resx b/BizHawk.MultiClient/tools/HexEditor/HexColor.resx similarity index 100% rename from BizHawk.MultiClient/tools/HexColor.resx rename to BizHawk.MultiClient/tools/HexEditor/HexColor.resx diff --git a/BizHawk.MultiClient/tools/HexEditor.Designer.cs b/BizHawk.MultiClient/tools/HexEditor/HexEditor.Designer.cs similarity index 100% rename from BizHawk.MultiClient/tools/HexEditor.Designer.cs rename to BizHawk.MultiClient/tools/HexEditor/HexEditor.Designer.cs diff --git a/BizHawk.MultiClient/tools/HexEditor.cs b/BizHawk.MultiClient/tools/HexEditor/HexEditor.cs similarity index 95% rename from BizHawk.MultiClient/tools/HexEditor.cs rename to BizHawk.MultiClient/tools/HexEditor/HexEditor.cs index 076a2b4a60..02f89204a4 100644 --- a/BizHawk.MultiClient/tools/HexEditor.cs +++ b/BizHawk.MultiClient/tools/HexEditor/HexEditor.cs @@ -665,20 +665,20 @@ namespace BizHawk.MultiClient UpdateValues(); } - private Watch MakeWatch(int address) + private Watch_Legacy MakeWatch(int address) { - Watch w = new Watch {Address = address, BigEndian = BigEndian, Signed = Watch.DISPTYPE.HEX, Domain = Domain}; + Watch_Legacy w = new Watch_Legacy {Address = address, BigEndian = BigEndian, Signed = Watch_Legacy.DISPTYPE.HEX, Domain = Domain}; switch (DataSize) { default: case 1: - w.Type = Watch.TYPE.BYTE; + w.Type = Watch_Legacy.TYPE.BYTE; break; case 2: - w.Type = Watch.TYPE.WORD; + w.Type = Watch_Legacy.TYPE.WORD; break; case 4: - w.Type = Watch.TYPE.DWORD; + w.Type = Watch_Legacy.TYPE.DWORD; break; } return w; @@ -708,12 +708,12 @@ namespace BizHawk.MultiClient { int p = GetHighlightedAddress(); if (p < 0) return; - Watch w = new Watch + Watch_Legacy w = new Watch_Legacy { Address = p, Value = MakeValue(p), BigEndian = BigEndian, - Signed = Watch.DISPTYPE.HEX, + Signed = Watch_Legacy.DISPTYPE.HEX, Domain = Domain }; @@ -721,13 +721,13 @@ namespace BizHawk.MultiClient { default: case 1: - w.Type = Watch.TYPE.BYTE; + w.Type = Watch_Legacy.TYPE.BYTE; break; case 2: - w.Type = Watch.TYPE.WORD; + w.Type = Watch_Legacy.TYPE.WORD; break; case 4: - w.Type = Watch.TYPE.DWORD; + w.Type = Watch_Legacy.TYPE.DWORD; break; } diff --git a/BizHawk.MultiClient/tools/HexEditor.resx b/BizHawk.MultiClient/tools/HexEditor/HexEditor.resx similarity index 100% rename from BizHawk.MultiClient/tools/HexEditor.resx rename to BizHawk.MultiClient/tools/HexEditor/HexEditor.resx diff --git a/BizHawk.MultiClient/tools/HexFind.Designer.cs b/BizHawk.MultiClient/tools/HexEditor/HexFind.Designer.cs similarity index 100% rename from BizHawk.MultiClient/tools/HexFind.Designer.cs rename to BizHawk.MultiClient/tools/HexEditor/HexFind.Designer.cs diff --git a/BizHawk.MultiClient/tools/HexFind.cs b/BizHawk.MultiClient/tools/HexEditor/HexFind.cs similarity index 100% rename from BizHawk.MultiClient/tools/HexFind.cs rename to BizHawk.MultiClient/tools/HexEditor/HexFind.cs diff --git a/BizHawk.MultiClient/tools/HexFind.resx b/BizHawk.MultiClient/tools/HexEditor/HexFind.resx similarity index 100% rename from BizHawk.MultiClient/tools/HexFind.resx rename to BizHawk.MultiClient/tools/HexEditor/HexFind.resx diff --git a/BizHawk.MultiClient/tools/LuaButton.cs b/BizHawk.MultiClient/tools/Lua/LuaButton.cs similarity index 100% rename from BizHawk.MultiClient/tools/LuaButton.cs rename to BizHawk.MultiClient/tools/Lua/LuaButton.cs diff --git a/BizHawk.MultiClient/tools/LuaConsole.Designer.cs b/BizHawk.MultiClient/tools/Lua/LuaConsole.Designer.cs similarity index 100% rename from BizHawk.MultiClient/tools/LuaConsole.Designer.cs rename to BizHawk.MultiClient/tools/Lua/LuaConsole.Designer.cs diff --git a/BizHawk.MultiClient/tools/LuaConsole.cs b/BizHawk.MultiClient/tools/Lua/LuaConsole.cs similarity index 100% rename from BizHawk.MultiClient/tools/LuaConsole.cs rename to BizHawk.MultiClient/tools/Lua/LuaConsole.cs diff --git a/BizHawk.MultiClient/tools/LuaConsole.resx b/BizHawk.MultiClient/tools/Lua/LuaConsole.resx similarity index 100% rename from BizHawk.MultiClient/tools/LuaConsole.resx rename to BizHawk.MultiClient/tools/Lua/LuaConsole.resx diff --git a/BizHawk.MultiClient/tools/LuaDocumentation.cs b/BizHawk.MultiClient/tools/Lua/LuaDocumentation.cs similarity index 100% rename from BizHawk.MultiClient/tools/LuaDocumentation.cs rename to BizHawk.MultiClient/tools/Lua/LuaDocumentation.cs diff --git a/BizHawk.MultiClient/tools/LuaFiles.cs b/BizHawk.MultiClient/tools/Lua/LuaFiles.cs similarity index 100% rename from BizHawk.MultiClient/tools/LuaFiles.cs rename to BizHawk.MultiClient/tools/Lua/LuaFiles.cs diff --git a/BizHawk.MultiClient/tools/LuaFunctionList.Designer.cs b/BizHawk.MultiClient/tools/Lua/LuaFunctionList.Designer.cs similarity index 100% rename from BizHawk.MultiClient/tools/LuaFunctionList.Designer.cs rename to BizHawk.MultiClient/tools/Lua/LuaFunctionList.Designer.cs diff --git a/BizHawk.MultiClient/tools/LuaFunctionList.cs b/BizHawk.MultiClient/tools/Lua/LuaFunctionList.cs similarity index 100% rename from BizHawk.MultiClient/tools/LuaFunctionList.cs rename to BizHawk.MultiClient/tools/Lua/LuaFunctionList.cs diff --git a/BizHawk.MultiClient/tools/LuaFunctionList.resx b/BizHawk.MultiClient/tools/Lua/LuaFunctionList.resx similarity index 100% rename from BizHawk.MultiClient/tools/LuaFunctionList.resx rename to BizHawk.MultiClient/tools/Lua/LuaFunctionList.resx diff --git a/BizHawk.MultiClient/LuaImplementation.cs b/BizHawk.MultiClient/tools/Lua/LuaImplementation.cs similarity index 100% rename from BizHawk.MultiClient/LuaImplementation.cs rename to BizHawk.MultiClient/tools/Lua/LuaImplementation.cs diff --git a/BizHawk.MultiClient/tools/LuaRegisteredFunctionsList.Designer.cs b/BizHawk.MultiClient/tools/Lua/LuaRegisteredFunctionsList.Designer.cs similarity index 100% rename from BizHawk.MultiClient/tools/LuaRegisteredFunctionsList.Designer.cs rename to BizHawk.MultiClient/tools/Lua/LuaRegisteredFunctionsList.Designer.cs diff --git a/BizHawk.MultiClient/tools/LuaRegisteredFunctionsList.cs b/BizHawk.MultiClient/tools/Lua/LuaRegisteredFunctionsList.cs similarity index 100% rename from BizHawk.MultiClient/tools/LuaRegisteredFunctionsList.cs rename to BizHawk.MultiClient/tools/Lua/LuaRegisteredFunctionsList.cs diff --git a/BizHawk.MultiClient/tools/LuaRegisteredFunctionsList.resx b/BizHawk.MultiClient/tools/Lua/LuaRegisteredFunctionsList.resx similarity index 100% rename from BizHawk.MultiClient/tools/LuaRegisteredFunctionsList.resx rename to BizHawk.MultiClient/tools/Lua/LuaRegisteredFunctionsList.resx diff --git a/BizHawk.MultiClient/tools/LuaText.cs b/BizHawk.MultiClient/tools/Lua/LuaText.cs similarity index 100% rename from BizHawk.MultiClient/tools/LuaText.cs rename to BizHawk.MultiClient/tools/Lua/LuaText.cs diff --git a/BizHawk.MultiClient/tools/LuaTextBox.cs b/BizHawk.MultiClient/tools/Lua/LuaTextBox.cs similarity index 100% rename from BizHawk.MultiClient/tools/LuaTextBox.cs rename to BizHawk.MultiClient/tools/Lua/LuaTextBox.cs diff --git a/BizHawk.MultiClient/tools/LuaWinform.Designer.cs b/BizHawk.MultiClient/tools/Lua/LuaWinform.Designer.cs similarity index 100% rename from BizHawk.MultiClient/tools/LuaWinform.Designer.cs rename to BizHawk.MultiClient/tools/Lua/LuaWinform.Designer.cs diff --git a/BizHawk.MultiClient/tools/LuaWinform.cs b/BizHawk.MultiClient/tools/Lua/LuaWinform.cs similarity index 100% rename from BizHawk.MultiClient/tools/LuaWinform.cs rename to BizHawk.MultiClient/tools/Lua/LuaWinform.cs diff --git a/BizHawk.MultiClient/tools/LuaWinform.resx b/BizHawk.MultiClient/tools/Lua/LuaWinform.resx similarity index 100% rename from BizHawk.MultiClient/tools/LuaWinform.resx rename to BizHawk.MultiClient/tools/Lua/LuaWinform.resx diff --git a/BizHawk.MultiClient/tools/LuaWriter.Designer.cs b/BizHawk.MultiClient/tools/Lua/LuaWriter.Designer.cs similarity index 100% rename from BizHawk.MultiClient/tools/LuaWriter.Designer.cs rename to BizHawk.MultiClient/tools/Lua/LuaWriter.Designer.cs diff --git a/BizHawk.MultiClient/tools/LuaWriter.cs b/BizHawk.MultiClient/tools/Lua/LuaWriter.cs similarity index 100% rename from BizHawk.MultiClient/tools/LuaWriter.cs rename to BizHawk.MultiClient/tools/Lua/LuaWriter.cs diff --git a/BizHawk.MultiClient/tools/LuaWriter.resx b/BizHawk.MultiClient/tools/Lua/LuaWriter.resx similarity index 100% rename from BizHawk.MultiClient/tools/LuaWriter.resx rename to BizHawk.MultiClient/tools/Lua/LuaWriter.resx diff --git a/BizHawk.MultiClient/tools/LuaWriterBox.cs b/BizHawk.MultiClient/tools/Lua/LuaWriterBox.cs similarity index 100% rename from BizHawk.MultiClient/tools/LuaWriterBox.cs rename to BizHawk.MultiClient/tools/Lua/LuaWriterBox.cs diff --git a/BizHawk.MultiClient/tools/LuaWriterColorConfig.Designer.cs b/BizHawk.MultiClient/tools/Lua/LuaWriterColorConfig.Designer.cs similarity index 100% rename from BizHawk.MultiClient/tools/LuaWriterColorConfig.Designer.cs rename to BizHawk.MultiClient/tools/Lua/LuaWriterColorConfig.Designer.cs diff --git a/BizHawk.MultiClient/tools/LuaWriterColorConfig.cs b/BizHawk.MultiClient/tools/Lua/LuaWriterColorConfig.cs similarity index 100% rename from BizHawk.MultiClient/tools/LuaWriterColorConfig.cs rename to BizHawk.MultiClient/tools/Lua/LuaWriterColorConfig.cs diff --git a/BizHawk.MultiClient/tools/LuaWriterColorConfig.resx b/BizHawk.MultiClient/tools/Lua/LuaWriterColorConfig.resx similarity index 100% rename from BizHawk.MultiClient/tools/LuaWriterColorConfig.resx rename to BizHawk.MultiClient/tools/Lua/LuaWriterColorConfig.resx diff --git a/BizHawk.MultiClient/tools/NewRamWatch.Designer.cs b/BizHawk.MultiClient/tools/Watch/NewRamWatch.Designer.cs similarity index 100% rename from BizHawk.MultiClient/tools/NewRamWatch.Designer.cs rename to BizHawk.MultiClient/tools/Watch/NewRamWatch.Designer.cs diff --git a/BizHawk.MultiClient/tools/NewRamWatch.cs b/BizHawk.MultiClient/tools/Watch/NewRamWatch.cs similarity index 100% rename from BizHawk.MultiClient/tools/NewRamWatch.cs rename to BizHawk.MultiClient/tools/Watch/NewRamWatch.cs diff --git a/BizHawk.MultiClient/tools/NewRamWatch.resx b/BizHawk.MultiClient/tools/Watch/NewRamWatch.resx similarity index 100% rename from BizHawk.MultiClient/tools/NewRamWatch.resx rename to BizHawk.MultiClient/tools/Watch/NewRamWatch.resx diff --git a/BizHawk.MultiClient/tools/RamPoke.Designer.cs b/BizHawk.MultiClient/tools/Watch/RamPoke.Designer.cs similarity index 100% rename from BizHawk.MultiClient/tools/RamPoke.Designer.cs rename to BizHawk.MultiClient/tools/Watch/RamPoke.Designer.cs diff --git a/BizHawk.MultiClient/tools/RamPoke.cs b/BizHawk.MultiClient/tools/Watch/RamPoke.cs similarity index 78% rename from BizHawk.MultiClient/tools/RamPoke.cs rename to BizHawk.MultiClient/tools/Watch/RamPoke.cs index 5a18fca50d..01de4da264 100644 --- a/BizHawk.MultiClient/tools/RamPoke.cs +++ b/BizHawk.MultiClient/tools/Watch/RamPoke.cs @@ -7,7 +7,7 @@ namespace BizHawk.MultiClient { public partial class RamPoke : Form { - public Watch Watch = new Watch(); + public Watch_Legacy Watch = new Watch_Legacy(); public MemoryDomain Domain = Global.Emulator.MainMemory; public Point NewLocation = new Point(); @@ -16,10 +16,10 @@ namespace BizHawk.MultiClient InitializeComponent(); } - public void SetWatchObject(Watch w) + public void SetWatchObject(Watch_Legacy w) { PopulateMemoryDomainComboBox(); - Watch = new Watch(w); + Watch = new Watch_Legacy(w); Domain = w.Domain; } @@ -29,7 +29,7 @@ namespace BizHawk.MultiClient PopulateMemoryDomainComboBox(); SetTypeRadio(Watch.Type); SetSignedRadio(Watch.Signed); - if (Watch.Signed == Watch.DISPTYPE.HEX) + if (Watch.Signed == Watch_Legacy.DISPTYPE.HEX) { ValueHexLabel.Text = "0x"; } @@ -68,15 +68,15 @@ namespace BizHawk.MultiClient { switch (Watch.Signed) { - case Watch.DISPTYPE.SIGNED: + case Watch_Legacy.DISPTYPE.SIGNED: SignedRadio.Checked = true; ValueHexLabel.Text = ""; break; - case Watch.DISPTYPE.UNSIGNED: + case Watch_Legacy.DISPTYPE.UNSIGNED: UnsignedRadio.Checked = true; ValueHexLabel.Text = ""; break; - case Watch.DISPTYPE.HEX: + case Watch_Legacy.DISPTYPE.HEX: ValueHexLabel.Text = "0x"; HexRadio.Checked = true; break; @@ -90,7 +90,7 @@ namespace BizHawk.MultiClient { ValueHexLabel.Text = "0x"; ValueBox.MaxLength = GetValueNumDigits(); - Watch.Signed = Watch.DISPTYPE.HEX; + Watch.Signed = Watch_Legacy.DISPTYPE.HEX; FormatValue(); } @@ -98,7 +98,7 @@ namespace BizHawk.MultiClient { ValueHexLabel.Text = ""; ValueBox.MaxLength = GetValueNumDigits(); - Watch.Signed = Watch.DISPTYPE.UNSIGNED; + Watch.Signed = Watch_Legacy.DISPTYPE.UNSIGNED; FormatValue(); } @@ -106,7 +106,7 @@ namespace BizHawk.MultiClient { ValueHexLabel.Text = ""; ValueBox.MaxLength = GetValueNumDigits(); - Watch.Signed = Watch.DISPTYPE.SIGNED; + Watch.Signed = Watch_Legacy.DISPTYPE.SIGNED; FormatValue(); } @@ -130,33 +130,33 @@ namespace BizHawk.MultiClient Text = "Ram Poke - " + Domain; } - private void SetTypeRadio(Watch.TYPE a) + private void SetTypeRadio(Watch_Legacy.TYPE a) { switch (a) { - case Watch.TYPE.BYTE: + case Watch_Legacy.TYPE.BYTE: Byte1Radio.Checked = true; break; - case Watch.TYPE.WORD: + case Watch_Legacy.TYPE.WORD: Byte2Radio.Checked = true; break; - case Watch.TYPE.DWORD: + case Watch_Legacy.TYPE.DWORD: Byte4Radio.Checked = true; break; } } - private void SetSignedRadio(Watch.DISPTYPE a) + private void SetSignedRadio(Watch_Legacy.DISPTYPE a) { switch (a) { - case Watch.DISPTYPE.SIGNED: + case Watch_Legacy.DISPTYPE.SIGNED: SignedRadio.Checked = true; break; - case Watch.DISPTYPE.UNSIGNED: + case Watch_Legacy.DISPTYPE.UNSIGNED: UnsignedRadio.Checked = true; break; - case Watch.DISPTYPE.HEX: + case Watch_Legacy.DISPTYPE.HEX: HexRadio.Checked = true; break; } @@ -183,28 +183,28 @@ namespace BizHawk.MultiClient if (SignedRadio.Checked) { - Watch.Signed = Watch.DISPTYPE.SIGNED; + Watch.Signed = Watch_Legacy.DISPTYPE.SIGNED; } else if (UnsignedRadio.Checked) { - Watch.Signed = Watch.DISPTYPE.UNSIGNED; + Watch.Signed = Watch_Legacy.DISPTYPE.UNSIGNED; } else if (HexRadio.Checked) { - Watch.Signed = Watch.DISPTYPE.HEX; + Watch.Signed = Watch_Legacy.DISPTYPE.HEX; } if (Byte1Radio.Checked) { - Watch.Type = Watch.TYPE.BYTE; + Watch.Type = Watch_Legacy.TYPE.BYTE; } else if (Byte2Radio.Checked) { - Watch.Type = Watch.TYPE.WORD; + Watch.Type = Watch_Legacy.TYPE.WORD; } else if (Byte4Radio.Checked) { - Watch.Type = Watch.TYPE.DWORD; + Watch.Type = Watch_Legacy.TYPE.DWORD; } if (BigEndianRadio.Checked) @@ -261,7 +261,7 @@ namespace BizHawk.MultiClient switch (Watch.Signed) { - case Watch.DISPTYPE.UNSIGNED: + case Watch_Legacy.DISPTYPE.UNSIGNED: if (!InputValidate.IsValidUnsignedNumber(ValueBox.Text)) { ValueBox.Focus(); @@ -270,7 +270,7 @@ namespace BizHawk.MultiClient t.Show("Must be a valid unsigned decimal value", ValueBox, 5000); } break; - case Watch.DISPTYPE.SIGNED: + case Watch_Legacy.DISPTYPE.SIGNED: if (!InputValidate.IsValidSignedNumber(ValueBox.Text)) { ValueBox.Focus(); @@ -279,7 +279,7 @@ namespace BizHawk.MultiClient t.Show("Must be a valid signed decimal value", ValueBox, 5000); } break; - case Watch.DISPTYPE.HEX: + case Watch_Legacy.DISPTYPE.HEX: if (!InputValidate.IsValidHexNumber(ValueBox.Text)) { ValueBox.Focus(); @@ -292,23 +292,23 @@ namespace BizHawk.MultiClient } - private Watch.DISPTYPE GetDataType() + private Watch_Legacy.DISPTYPE GetDataType() { if (SignedRadio.Checked) { - return Watch.DISPTYPE.SIGNED; + return Watch_Legacy.DISPTYPE.SIGNED; } if (UnsignedRadio.Checked) { - return Watch.DISPTYPE.UNSIGNED; + return Watch_Legacy.DISPTYPE.UNSIGNED; } if (HexRadio.Checked) { - return Watch.DISPTYPE.HEX; + return Watch_Legacy.DISPTYPE.HEX; } else { - return Watch.DISPTYPE.UNSIGNED; //Just in case + return Watch_Legacy.DISPTYPE.UNSIGNED; //Just in case } } @@ -318,19 +318,19 @@ namespace BizHawk.MultiClient switch (GetDataType()) { - case Watch.DISPTYPE.UNSIGNED: + case Watch_Legacy.DISPTYPE.UNSIGNED: if (!InputValidate.IsValidUnsignedNumber(e.KeyChar)) { e.Handled = true; } break; - case Watch.DISPTYPE.SIGNED: + case Watch_Legacy.DISPTYPE.SIGNED: if (!InputValidate.IsValidSignedNumber(e.KeyChar)) { e.Handled = true; } break; - case Watch.DISPTYPE.HEX: + case Watch_Legacy.DISPTYPE.HEX: if (!InputValidate.IsValidHexNumber(e.KeyChar)) { e.Handled = true; @@ -339,23 +339,23 @@ namespace BizHawk.MultiClient } } - private Watch.TYPE GetDataSize() + private Watch_Legacy.TYPE GetDataSize() { if (Byte1Radio.Checked) { - return Watch.TYPE.BYTE; + return Watch_Legacy.TYPE.BYTE; } else if (Byte2Radio.Checked) { - return Watch.TYPE.WORD; + return Watch_Legacy.TYPE.WORD; } else if (Byte4Radio.Checked) { - return Watch.TYPE.DWORD; + return Watch_Legacy.TYPE.DWORD; } else { - return Watch.TYPE.BYTE; + return Watch_Legacy.TYPE.BYTE; } } @@ -365,7 +365,7 @@ namespace BizHawk.MultiClient bool i; switch (GetDataType()) { - case Watch.DISPTYPE.UNSIGNED: + case Watch_Legacy.DISPTYPE.UNSIGNED: i = InputValidate.IsValidUnsignedNumber(ValueBox.Text); if (!i) { @@ -375,7 +375,7 @@ namespace BizHawk.MultiClient { return (int)Int64.Parse(ValueBox.Text); //Note: 64 to be safe } - case Watch.DISPTYPE.SIGNED: + case Watch_Legacy.DISPTYPE.SIGNED: i = InputValidate.IsValidSignedNumber(ValueBox.Text); if (!i) { @@ -385,7 +385,7 @@ namespace BizHawk.MultiClient { return (int)Int64.Parse(ValueBox.Text); } - case Watch.DISPTYPE.HEX: + case Watch_Legacy.DISPTYPE.HEX: i = InputValidate.IsValidHexNumber(ValueBox.Text); if (!i) { @@ -404,15 +404,15 @@ namespace BizHawk.MultiClient switch (GetDataSize()) { default: - case Watch.TYPE.BYTE: + case Watch_Legacy.TYPE.BYTE: if (HexRadio.Checked) return 2; else if (UnsignedRadio.Checked) return 3; else return 4; - case Watch.TYPE.WORD: + case Watch_Legacy.TYPE.WORD: if (HexRadio.Checked) return 4; else if (UnsignedRadio.Checked) return 5; else return 6; - case Watch.TYPE.DWORD: + case Watch_Legacy.TYPE.DWORD: if (HexRadio.Checked) return 8; else if (UnsignedRadio.Checked) return 10; else return 11; diff --git a/BizHawk.MultiClient/tools/RamPoke.resx b/BizHawk.MultiClient/tools/Watch/RamPoke.resx similarity index 100% rename from BizHawk.MultiClient/tools/RamPoke.resx rename to BizHawk.MultiClient/tools/Watch/RamPoke.resx diff --git a/BizHawk.MultiClient/tools/RamSearch.Designer.cs b/BizHawk.MultiClient/tools/Watch/RamSearch.Designer.cs similarity index 100% rename from BizHawk.MultiClient/tools/RamSearch.Designer.cs rename to BizHawk.MultiClient/tools/Watch/RamSearch.Designer.cs diff --git a/BizHawk.MultiClient/tools/RamSearch.cs b/BizHawk.MultiClient/tools/Watch/RamSearch.cs similarity index 89% rename from BizHawk.MultiClient/tools/RamSearch.cs rename to BizHawk.MultiClient/tools/Watch/RamSearch.cs index 8bb7cedfa7..5fe8e87c06 100644 --- a/BizHawk.MultiClient/tools/RamSearch.cs +++ b/BizHawk.MultiClient/tools/Watch/RamSearch.cs @@ -20,7 +20,7 @@ namespace BizHawk.MultiClient //Multiple undo levels (List> UndoLists) private string systemID = "NULL"; - private List Searches = new List(); + private List Searches = new List(); private HistoryCollection SearchHistory = new HistoryCollection(enabled:true); private bool IsAWeededList = false; //For deciding whether the weeded list is relevant (0 size could mean all were removed in a legit preview private readonly List domainMenuItems = new List(); @@ -337,43 +337,43 @@ namespace BizHawk.MultiClient StartNewSearch(); } - private Watch.DISPTYPE GetDataType() + private Watch_Legacy.DISPTYPE GetDataType() { if (unsignedToolStripMenuItem.Checked) { - return Watch.DISPTYPE.UNSIGNED; + return Watch_Legacy.DISPTYPE.UNSIGNED; } else if (signedToolStripMenuItem.Checked) { - return Watch.DISPTYPE.SIGNED; + return Watch_Legacy.DISPTYPE.SIGNED; } else if (hexadecimalToolStripMenuItem.Checked) { - return Watch.DISPTYPE.HEX; + return Watch_Legacy.DISPTYPE.HEX; } else { - return Watch.DISPTYPE.UNSIGNED; //Just in case + return Watch_Legacy.DISPTYPE.UNSIGNED; //Just in case } } - private Watch.TYPE GetDataSize() + private Watch_Legacy.TYPE GetDataSize() { if (byteToolStripMenuItem.Checked) { - return Watch.TYPE.BYTE; + return Watch_Legacy.TYPE.BYTE; } else if (bytesToolStripMenuItem.Checked) { - return Watch.TYPE.WORD; + return Watch_Legacy.TYPE.WORD; } else if (dWordToolStripMenuItem1.Checked) { - return Watch.TYPE.DWORD; + return Watch_Legacy.TYPE.DWORD; } else { - return Watch.TYPE.BYTE; + return Watch_Legacy.TYPE.BYTE; } } @@ -408,10 +408,10 @@ namespace BizHawk.MultiClient { switch (GetDataSize()) { - case Watch.TYPE.WORD: + case Watch_Legacy.TYPE.WORD: divisor = 2; break; - case Watch.TYPE.DWORD: + case Watch_Legacy.TYPE.DWORD: divisor = 4; break; } @@ -419,7 +419,7 @@ namespace BizHawk.MultiClient for (int x = 0; x <= ((Domain.Size / divisor) - 1); x++) { - Searches.Add(new Watch()); + Searches.Add(new Watch_Legacy()); Searches[x].Address = count; Searches[x].Type = GetDataSize(); Searches[x].BigEndian = GetBigEndian(); @@ -437,13 +437,13 @@ namespace BizHawk.MultiClient { switch (GetDataSize()) { - case Watch.TYPE.BYTE: + case Watch_Legacy.TYPE.BYTE: count++; break; - case Watch.TYPE.WORD: + case Watch_Legacy.TYPE.WORD: count += 2; break; - case Watch.TYPE.DWORD: + case Watch_Legacy.TYPE.DWORD: count += 4; break; } @@ -675,7 +675,7 @@ namespace BizHawk.MultiClient private void ClearChangeCounts() { - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { t.Changecount = 0; } @@ -819,7 +819,7 @@ namespace BizHawk.MultiClient for (int x = 0; x < Searches.Count; x++) { int previous = GetPreviousValue(x); - if (Searches[x].Signed == Watch.DISPTYPE.SIGNED) + if (Searches[x].Signed == Watch_Legacy.DISPTYPE.SIGNED) { if (Searches[x].SignedVal(Searches[x].Value) < Searches[x].SignedVal(previous)) { @@ -847,7 +847,7 @@ namespace BizHawk.MultiClient for (int x = 0; x < Searches.Count; x++) { int previous = GetPreviousValue(x); - if (Searches[x].Signed == Watch.DISPTYPE.SIGNED) + if (Searches[x].Signed == Watch_Legacy.DISPTYPE.SIGNED) { if (Searches[x].SignedVal(Searches[x].Value) > Searches[x].SignedVal(previous)) { @@ -875,7 +875,7 @@ namespace BizHawk.MultiClient for (int x = 0; x < Searches.Count; x++) { int previous = GetPreviousValue(x); - if (Searches[x].Signed == Watch.DISPTYPE.SIGNED) + if (Searches[x].Signed == Watch_Legacy.DISPTYPE.SIGNED) { if (Searches[x].SignedVal(Searches[x].Value) <= Searches[x].SignedVal(previous)) { @@ -903,7 +903,7 @@ namespace BizHawk.MultiClient for (int x = 0; x < Searches.Count; x++) { int previous = GetPreviousValue(x); - if (Searches[x].Signed == Watch.DISPTYPE.SIGNED) + if (Searches[x].Signed == Watch_Legacy.DISPTYPE.SIGNED) { if (Searches[x].SignedVal(Searches[x].Value) >= Searches[x].SignedVal(previous)) { @@ -931,7 +931,7 @@ namespace BizHawk.MultiClient for (int x = 0; x < Searches.Count; x++) { int previous = GetPreviousValue(x); - if (Searches[x].Signed == Watch.DISPTYPE.SIGNED) + if (Searches[x].Signed == Watch_Legacy.DISPTYPE.SIGNED) { if (Searches[x].SignedVal(Searches[x].Value) == Searches[x].SignedVal(previous)) { @@ -959,7 +959,7 @@ namespace BizHawk.MultiClient for (int x = 0; x < Searches.Count; x++) { int previous = GetPreviousValue(x); - if (Searches[x].Signed == Watch.DISPTYPE.SIGNED) + if (Searches[x].Signed == Watch_Legacy.DISPTYPE.SIGNED) { if (Searches[x].SignedVal(Searches[x].Value) != Searches[x].SignedVal(previous)) { @@ -989,7 +989,7 @@ namespace BizHawk.MultiClient for (int x = 0; x < Searches.Count; x++) { int previous = GetPreviousValue(x); - if (Searches[x].Signed == Watch.DISPTYPE.SIGNED) + if (Searches[x].Signed == Watch_Legacy.DISPTYPE.SIGNED) { if (Searches[x].SignedVal(Searches[x].Value) == Searches[x].SignedVal(previous) + diff || Searches[x].SignedVal(Searches[x].Value) == Searches[x].SignedVal(previous) - diff) { @@ -1036,9 +1036,9 @@ namespace BizHawk.MultiClient switch (GetOperator()) { case SOperator.LESS: - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { - if (t.Signed == Watch.DISPTYPE.SIGNED) + if (t.Signed == Watch_Legacy.DISPTYPE.SIGNED) { if (t.SignedVal(t.Value) < t.SignedVal((int)value)) { @@ -1063,9 +1063,9 @@ namespace BizHawk.MultiClient } break; case SOperator.GREATER: - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { - if (t.Signed == Watch.DISPTYPE.SIGNED) + if (t.Signed == Watch_Legacy.DISPTYPE.SIGNED) { if (t.SignedVal(t.Value) > t.SignedVal((int)value)) { @@ -1090,9 +1090,9 @@ namespace BizHawk.MultiClient } break; case SOperator.LESSEQUAL: - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { - if (t.Signed == Watch.DISPTYPE.SIGNED) + if (t.Signed == Watch_Legacy.DISPTYPE.SIGNED) { if (t.SignedVal(t.Value) <= t.SignedVal((int)value)) { @@ -1117,9 +1117,9 @@ namespace BizHawk.MultiClient } break; case SOperator.GREATEREQUAL: - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { - if (t.Signed == Watch.DISPTYPE.SIGNED) + if (t.Signed == Watch_Legacy.DISPTYPE.SIGNED) { if (t.SignedVal(t.Value) >= t.SignedVal((int)value)) { @@ -1144,9 +1144,9 @@ namespace BizHawk.MultiClient } break; case SOperator.EQUAL: - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { - if (t.Signed == Watch.DISPTYPE.SIGNED) + if (t.Signed == Watch_Legacy.DISPTYPE.SIGNED) { if (t.SignedVal(t.Value) == t.SignedVal((int)value)) { @@ -1172,9 +1172,9 @@ namespace BizHawk.MultiClient } break; case SOperator.NOTEQUAL: - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { - if (t.Signed == Watch.DISPTYPE.SIGNED) + if (t.Signed == Watch_Legacy.DISPTYPE.SIGNED) { if (t.SignedVal(t.Value) != t.SignedVal((int)value)) { @@ -1201,9 +1201,9 @@ namespace BizHawk.MultiClient case SOperator.DIFFBY: int diff = GetDifferentBy(); if (diff < 0) return false; - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { - if (t.Signed == Watch.DISPTYPE.SIGNED) + if (t.Signed == Watch_Legacy.DISPTYPE.SIGNED) { if (t.SignedVal(t.Value) == t.SignedVal((int)value) + diff || t.SignedVal(t.Value) == t.SignedVal((int)value) - diff) { @@ -1237,27 +1237,27 @@ namespace BizHawk.MultiClient bool i; switch (GetDataType()) { - case Watch.DISPTYPE.UNSIGNED: + case Watch_Legacy.DISPTYPE.UNSIGNED: i = InputValidate.IsValidUnsignedNumber(SpecificValueBox.Text); if (!i) return null; return (int)Int64.Parse(SpecificValueBox.Text); //Note: 64 to be safe since 4 byte values can be entered - case Watch.DISPTYPE.SIGNED: + case Watch_Legacy.DISPTYPE.SIGNED: i = InputValidate.IsValidSignedNumber(SpecificValueBox.Text); if (!i) return null; int value = (int)Int64.Parse(SpecificValueBox.Text); switch (GetDataSize()) { - case Watch.TYPE.BYTE: + case Watch_Legacy.TYPE.BYTE: return (byte)value; - case Watch.TYPE.WORD: + case Watch_Legacy.TYPE.WORD: return (ushort)value; - case Watch.TYPE.DWORD: + case Watch_Legacy.TYPE.DWORD: return (int)(uint)value; } return value; - case Watch.DISPTYPE.HEX: + case Watch_Legacy.DISPTYPE.HEX: i = InputValidate.IsValidHexNumber(SpecificValueBox.Text); if (!i) return null; @@ -1303,7 +1303,7 @@ namespace BizHawk.MultiClient switch (GetOperator()) { case SOperator.LESS: - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { if (t.Address < address) { @@ -1316,7 +1316,7 @@ namespace BizHawk.MultiClient } break; case SOperator.GREATER: - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { if (t.Address > address) { @@ -1329,7 +1329,7 @@ namespace BizHawk.MultiClient } break; case SOperator.LESSEQUAL: - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { if (t.Address <= address) { @@ -1342,7 +1342,7 @@ namespace BizHawk.MultiClient } break; case SOperator.GREATEREQUAL: - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { if (t.Address >= address) { @@ -1355,7 +1355,7 @@ namespace BizHawk.MultiClient } break; case SOperator.EQUAL: - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { if (t.Address == address) { @@ -1368,7 +1368,7 @@ namespace BizHawk.MultiClient } break; case SOperator.NOTEQUAL: - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { if (t.Address != address) { @@ -1384,7 +1384,7 @@ namespace BizHawk.MultiClient { int diff = GetDifferentBy(); if (diff < 0) return false; - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { if (t.Address == address + diff || t.Address == address - diff) { @@ -1423,7 +1423,7 @@ namespace BizHawk.MultiClient switch (GetOperator()) { case SOperator.LESS: - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { if (t.Changecount < changes) { @@ -1436,7 +1436,7 @@ namespace BizHawk.MultiClient } break; case SOperator.GREATER: - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { if (t.Changecount > changes) { @@ -1449,7 +1449,7 @@ namespace BizHawk.MultiClient } break; case SOperator.LESSEQUAL: - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { if (t.Changecount <= changes) { @@ -1462,7 +1462,7 @@ namespace BizHawk.MultiClient } break; case SOperator.GREATEREQUAL: - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { if (t.Changecount >= changes) { @@ -1475,7 +1475,7 @@ namespace BizHawk.MultiClient } break; case SOperator.EQUAL: - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { if (t.Changecount == changes) { @@ -1488,7 +1488,7 @@ namespace BizHawk.MultiClient } break; case SOperator.NOTEQUAL: - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { if (t.Changecount != changes) { @@ -1503,7 +1503,7 @@ namespace BizHawk.MultiClient case SOperator.DIFFBY: int diff = GetDifferentBy(); if (diff < 0) return false; - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { if (t.Address == changes + diff || t.Address == changes - diff) { @@ -1519,16 +1519,16 @@ namespace BizHawk.MultiClient return true; } - private void ConvertListsDataType(Watch.DISPTYPE s) + private void ConvertListsDataType(Watch_Legacy.DISPTYPE s) { - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { t.Signed = s; } - foreach (List state in SearchHistory.History) + foreach (List state in SearchHistory.History) { - foreach (Watch watch in state) + foreach (Watch_Legacy watch in state) { watch.Signed = s; } @@ -1540,7 +1540,7 @@ namespace BizHawk.MultiClient DisplaySearchList(); } - private void ConvertListsDataSize(Watch.TYPE s, bool bigendian) + private void ConvertListsDataSize(Watch_Legacy.TYPE s, bool bigendian) { ConvertDataSize(s, ref Searches); @@ -1556,23 +1556,23 @@ namespace BizHawk.MultiClient DisplaySearchList(); } - private void ConvertDataSize(Watch.TYPE s, ref List list) + private void ConvertDataSize(Watch_Legacy.TYPE s, ref List list) { - List converted = new List(); + List converted = new List(); int divisor = 1; if (!includeMisalignedToolStripMenuItem.Checked) { switch (s) { - case Watch.TYPE.WORD: + case Watch_Legacy.TYPE.WORD: divisor = 2; break; - case Watch.TYPE.DWORD: + case Watch_Legacy.TYPE.DWORD: divisor = 4; break; } } - foreach (Watch t in list) + foreach (Watch_Legacy t in list) if (t.Address % divisor == 0) { int changes = t.Changecount; @@ -1591,50 +1591,50 @@ namespace BizHawk.MultiClient private void unsignedToolStripMenuItem_Click(object sender, EventArgs e) { - Watch specificValue = new Watch(); + Watch_Legacy specificValue = new Watch_Legacy(); int? value = GetSpecificValue(); ValidateSpecificValue(value); if (value != null) specificValue.Value = (int)value; - specificValue.Signed = Watch.DISPTYPE.UNSIGNED; + specificValue.Signed = Watch_Legacy.DISPTYPE.UNSIGNED; specificValue.Type = GetDataSize(); string converted = specificValue.ValueString; unsignedToolStripMenuItem.Checked = true; signedToolStripMenuItem.Checked = false; hexadecimalToolStripMenuItem.Checked = false; SpecificValueBox.Text = converted; - ConvertListsDataType(Watch.DISPTYPE.UNSIGNED); + ConvertListsDataType(Watch_Legacy.DISPTYPE.UNSIGNED); } private void signedToolStripMenuItem_Click(object sender, EventArgs e) { - Watch specificValue = new Watch(); + Watch_Legacy specificValue = new Watch_Legacy(); int? value = GetSpecificValue(); ValidateSpecificValue(value); if (value != null) specificValue.Value = (int)value; - specificValue.Signed = Watch.DISPTYPE.SIGNED; + specificValue.Signed = Watch_Legacy.DISPTYPE.SIGNED; specificValue.Type = GetDataSize(); string converted = specificValue.ValueString; unsignedToolStripMenuItem.Checked = false; signedToolStripMenuItem.Checked = true; hexadecimalToolStripMenuItem.Checked = false; SpecificValueBox.Text = converted; - ConvertListsDataType(Watch.DISPTYPE.SIGNED); + ConvertListsDataType(Watch_Legacy.DISPTYPE.SIGNED); } private void hexadecimalToolStripMenuItem_Click(object sender, EventArgs e) { - Watch specificValue = new Watch(); + Watch_Legacy specificValue = new Watch_Legacy(); int? value = GetSpecificValue(); ValidateSpecificValue(value); if (value != null) specificValue.Value = (int)value; - specificValue.Signed = Watch.DISPTYPE.HEX; + specificValue.Signed = Watch_Legacy.DISPTYPE.HEX; specificValue.Type = GetDataSize(); string converted = specificValue.ValueString; unsignedToolStripMenuItem.Checked = false; signedToolStripMenuItem.Checked = false; hexadecimalToolStripMenuItem.Checked = true; SpecificValueBox.Text = converted; - ConvertListsDataType(Watch.DISPTYPE.HEX); + ConvertListsDataType(Watch_Legacy.DISPTYPE.HEX); } private void SearchListView_MouseDoubleClick(object sender, MouseEventArgs e) @@ -1650,16 +1650,16 @@ namespace BizHawk.MultiClient { switch (GetDataType()) { - case Watch.DISPTYPE.UNSIGNED: + case Watch_Legacy.DISPTYPE.UNSIGNED: switch (GetDataSize()) { - case Watch.TYPE.BYTE: + case Watch_Legacy.TYPE.BYTE: SpecificValueBox.MaxLength = 3; break; - case Watch.TYPE.WORD: + case Watch_Legacy.TYPE.WORD: SpecificValueBox.MaxLength = 5; break; - case Watch.TYPE.DWORD: + case Watch_Legacy.TYPE.DWORD: SpecificValueBox.MaxLength = 10; break; default: @@ -1667,16 +1667,16 @@ namespace BizHawk.MultiClient break; } break; - case Watch.DISPTYPE.SIGNED: + case Watch_Legacy.DISPTYPE.SIGNED: switch (GetDataSize()) { - case Watch.TYPE.BYTE: + case Watch_Legacy.TYPE.BYTE: SpecificValueBox.MaxLength = 4; break; - case Watch.TYPE.WORD: + case Watch_Legacy.TYPE.WORD: SpecificValueBox.MaxLength = 6; break; - case Watch.TYPE.DWORD: + case Watch_Legacy.TYPE.DWORD: SpecificValueBox.MaxLength = 11; break; default: @@ -1684,16 +1684,16 @@ namespace BizHawk.MultiClient break; } break; - case Watch.DISPTYPE.HEX: + case Watch_Legacy.DISPTYPE.HEX: switch (GetDataSize()) { - case Watch.TYPE.BYTE: + case Watch_Legacy.TYPE.BYTE: SpecificValueBox.MaxLength = 2; break; - case Watch.TYPE.WORD: + case Watch_Legacy.TYPE.WORD: SpecificValueBox.MaxLength = 4; break; - case Watch.TYPE.DWORD: + case Watch_Legacy.TYPE.DWORD: SpecificValueBox.MaxLength = 8; break; default: @@ -1712,7 +1712,7 @@ namespace BizHawk.MultiClient byteToolStripMenuItem.Checked = true; bytesToolStripMenuItem.Checked = false; dWordToolStripMenuItem1.Checked = false; - ConvertListsDataSize(Watch.TYPE.BYTE, GetBigEndian()); + ConvertListsDataSize(Watch_Legacy.TYPE.BYTE, GetBigEndian()); } private void bytesToolStripMenuItem_Click(object sender, EventArgs e) @@ -1720,7 +1720,7 @@ namespace BizHawk.MultiClient byteToolStripMenuItem.Checked = false; bytesToolStripMenuItem.Checked = true; dWordToolStripMenuItem1.Checked = false; - ConvertListsDataSize(Watch.TYPE.WORD, GetBigEndian()); + ConvertListsDataSize(Watch_Legacy.TYPE.WORD, GetBigEndian()); } private void dWordToolStripMenuItem1_Click(object sender, EventArgs e) @@ -1728,7 +1728,7 @@ namespace BizHawk.MultiClient byteToolStripMenuItem.Checked = false; bytesToolStripMenuItem.Checked = false; dWordToolStripMenuItem1.Checked = true; - ConvertListsDataSize(Watch.TYPE.DWORD, GetBigEndian()); + ConvertListsDataSize(Watch_Legacy.TYPE.DWORD, GetBigEndian()); } private void includeMisalignedToolStripMenuItem_Click_1(object sender, EventArgs e) @@ -1831,7 +1831,7 @@ namespace BizHawk.MultiClient DisplaySearchList(); } - bool LoadSearchFile(string path, bool append, List list) + bool LoadSearchFile(string path, bool append, List list) { string domain; bool result = WatchCommon.LoadWatchFile(path, append, list, out domain); @@ -2047,19 +2047,19 @@ namespace BizHawk.MultiClient switch (GetDataType()) { - case Watch.DISPTYPE.UNSIGNED: + case Watch_Legacy.DISPTYPE.UNSIGNED: if (!InputValidate.IsValidUnsignedNumber(e.KeyChar)) { e.Handled = true; } break; - case Watch.DISPTYPE.SIGNED: + case Watch_Legacy.DISPTYPE.SIGNED: if (!InputValidate.IsValidSignedNumber(e.KeyChar)) { e.Handled = true; } break; - case Watch.DISPTYPE.HEX: + case Watch_Legacy.DISPTYPE.HEX: if (!InputValidate.IsValidHexNumber(e.KeyChar)) { e.Handled = true; @@ -2120,7 +2120,7 @@ namespace BizHawk.MultiClient var file = GetFileFromUser(); if (file != null) { - List temp = new List(); + List temp = new List(); LoadSearchFile(file.FullName, false, temp); TruncateList(temp); DoTruncate(); @@ -2130,17 +2130,17 @@ namespace BizHawk.MultiClient private void ClearWeeded() { - foreach (Watch watch in Searches) + foreach (Watch_Legacy watch in Searches) { watch.Deleted = false; } } - private void TruncateList(IEnumerable toRemove) + private void TruncateList(IEnumerable toRemove) { ClearWeeded(); - foreach (Watch watch in toRemove) + foreach (Watch_Legacy watch in toRemove) { var first_or_default = Searches.FirstOrDefault(x => x.Address == watch.Address); if (first_or_default != null) @@ -2181,7 +2181,7 @@ namespace BizHawk.MultiClient private void CopyValueToPrev() { - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { t.LastSearch = t.Value; t.Original = t.Value; @@ -2194,7 +2194,7 @@ namespace BizHawk.MultiClient private void UpdateLastSearch() { - foreach (Watch t in Searches) + foreach (Watch_Legacy t in Searches) { t.LastSearch = t.Value; } @@ -2247,14 +2247,14 @@ namespace BizHawk.MultiClient { switch (Searches[indexes[i]].Type) { - case Watch.TYPE.BYTE: + case Watch_Legacy.TYPE.BYTE: Global.CheatList.Remove(Domain, Searches[indexes[i]].Address); break; - case Watch.TYPE.WORD: + case Watch_Legacy.TYPE.WORD: Global.CheatList.Remove(Domain, Searches[indexes[i]].Address); Global.CheatList.Remove(Domain, Searches[indexes[i]].Address + 1); break; - case Watch.TYPE.DWORD: + case Watch_Legacy.TYPE.DWORD: Global.CheatList.Remove(Domain, Searches[indexes[i]].Address); Global.CheatList.Remove(Domain, Searches[indexes[i]].Address + 1); Global.CheatList.Remove(Domain, Searches[indexes[i]].Address + 2); @@ -2279,12 +2279,12 @@ namespace BizHawk.MultiClient { switch (Searches[indexes[i]].Type) { - case Watch.TYPE.BYTE: + case Watch_Legacy.TYPE.BYTE: Cheat c = new Cheat("", Searches[indexes[i]].Address, (byte)Searches[indexes[i]].Value, true, Domain); Global.MainForm.Cheats1.AddCheat(c); break; - case Watch.TYPE.WORD: + case Watch_Legacy.TYPE.WORD: { byte low = (byte)(Searches[indexes[i]].Value / 256); byte high = (byte)(Searches[indexes[i]].Value); @@ -2306,7 +2306,7 @@ namespace BizHawk.MultiClient } } break; - case Watch.TYPE.DWORD: + case Watch_Legacy.TYPE.DWORD: { byte HIWORDhigh = (byte)(Searches[indexes[i]].Value / 0x1000000); byte HIWORDlow = (byte)(Searches[indexes[i]].Value / 0x10000); @@ -2561,7 +2561,7 @@ namespace BizHawk.MultiClient string columnName = SearchListView.Columns[columnToOrder].Text; if (sortedCol.CompareTo(columnName) != 0) sortReverse = false; - Searches.Sort((x, y) => x.CompareTo(y, columnName, (Watch.PREVDEF)Global.Config.RamSearchPreviousAs) * (sortReverse ? -1 : 1)); + Searches.Sort((x, y) => x.CompareTo(y, columnName, (Watch_Legacy.PREVDEF)Global.Config.RamSearchPreviousAs) * (sortReverse ? -1 : 1)); sortedCol = columnName; sortReverse = !(sortReverse); SearchListView.Refresh(); diff --git a/BizHawk.MultiClient/tools/RamSearch.resx b/BizHawk.MultiClient/tools/Watch/RamSearch.resx similarity index 100% rename from BizHawk.MultiClient/tools/RamSearch.resx rename to BizHawk.MultiClient/tools/Watch/RamSearch.resx diff --git a/BizHawk.MultiClient/tools/RamWatch.Designer.cs b/BizHawk.MultiClient/tools/Watch/RamWatch.Designer.cs similarity index 100% rename from BizHawk.MultiClient/tools/RamWatch.Designer.cs rename to BizHawk.MultiClient/tools/Watch/RamWatch.Designer.cs diff --git a/BizHawk.MultiClient/tools/RamWatch.cs b/BizHawk.MultiClient/tools/Watch/RamWatch.cs similarity index 93% rename from BizHawk.MultiClient/tools/RamWatch.cs rename to BizHawk.MultiClient/tools/Watch/RamWatch.cs index 78b47af927..33e3a24e6e 100644 --- a/BizHawk.MultiClient/tools/RamWatch.cs +++ b/BizHawk.MultiClient/tools/Watch/RamWatch.cs @@ -26,7 +26,7 @@ namespace BizHawk.MultiClient private string systemID = "NULL"; private MemoryDomain Domain = new MemoryDomain("NULL", 1, Endian.Little, addr => 0, (a, v) => { }); - private readonly List Watches = new List(); + private readonly List Watches = new List(); private string currentFile = ""; private bool changes = false; private readonly List domainMenuItems = new List(); @@ -52,9 +52,9 @@ namespace BizHawk.MultiClient } } - public List GetRamWatchList() + public List GetRamWatchList() { - return Watches.Select(t => new Watch(t)).ToList(); + return Watches.Select(t => new Watch_Legacy(t)).ToList(); } public void DisplayWatchList() @@ -69,7 +69,7 @@ namespace BizHawk.MultiClient return; } - foreach (Watch t in Watches) + foreach (Watch_Legacy t in Watches) { t.PeekAddress(); } @@ -91,7 +91,7 @@ namespace BizHawk.MultiClient WatchListView.BlazingFast = false; } - public void AddWatch(Watch w) + public void AddWatch(Watch_Legacy w) { Watches.Add(w); Changes(); @@ -195,7 +195,7 @@ namespace BizHawk.MultiClient if (column == 0) { - if (Watches[index].Type == Watch.TYPE.SEPARATOR) + if (Watches[index].Type == Watch_Legacy.TYPE.SEPARATOR) { color = BackColor; } @@ -210,7 +210,7 @@ namespace BizHawk.MultiClient { text = ""; - if (Watches[index].Type == Watch.TYPE.SEPARATOR || index >= Watches.Count) + if (Watches[index].Type == Watch_Legacy.TYPE.SEPARATOR || index >= Watches.Count) { return; } @@ -334,7 +334,7 @@ namespace BizHawk.MultiClient private void UpdateWatchCount() { - int count = Watches.Count(w => w.Type != Watch.TYPE.SEPARATOR); + int count = Watches.Count(w => w.Type != Watch_Legacy.TYPE.SEPARATOR); WatchCountLabel.Text = count.ToString() + (count == 1 ? " watch" : " watches"); } @@ -346,7 +346,7 @@ namespace BizHawk.MultiClient if (result) { - foreach (Watch w in Watches) + foreach (Watch_Legacy w in Watches) { InitializeAddress(w); } @@ -375,7 +375,7 @@ namespace BizHawk.MultiClient private void AddNewWatch() { RamWatchNewWatch r = new RamWatchNewWatch {location = GetPromptPoint()}; - Watch w = new Watch {Domain = Domain}; + Watch_Legacy w = new Watch_Legacy {Domain = Domain}; r.SetWatch(w); Global.Sound.StopSound(); r.ShowDialog(); @@ -390,7 +390,7 @@ namespace BizHawk.MultiClient } } - private void InitializeAddress(Watch w) + private void InitializeAddress(Watch_Legacy w) { w.PeekAddress(); w.Prev = w.Value; @@ -485,7 +485,7 @@ namespace BizHawk.MultiClient if (indexes.Count == 0) return; foreach (int index in indexes) { - Watch temp = Watches[index]; + Watch_Legacy temp = Watches[index]; Watches.Remove(Watches[index]); Watches.Insert(index - 1, temp); @@ -514,7 +514,7 @@ namespace BizHawk.MultiClient if (indexes.Count == 0) return; foreach (int index in indexes) { - Watch temp = Watches[index]; + Watch_Legacy temp = Watches[index]; if (index < Watches.Count - 1) { @@ -787,7 +787,7 @@ namespace BizHawk.MultiClient private void InsertSeparator() { Changes(); - Watch w = new Watch {Type = Watch.TYPE.SEPARATOR}; + Watch_Legacy w = new Watch_Legacy {Type = Watch_Legacy.TYPE.SEPARATOR}; ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices; if (indexes.Count > 0) @@ -1065,7 +1065,7 @@ namespace BizHawk.MultiClient private void ClearChangeCounts() { - foreach (Watch t in Watches) + foreach (Watch_Legacy t in Watches) { t.Changecount = 0; } @@ -1196,12 +1196,12 @@ namespace BizHawk.MultiClient { switch (Watches[indexes[i]].Type) { - case Watch.TYPE.BYTE: + case Watch_Legacy.TYPE.BYTE: Cheat c = new Cheat("", Watches[indexes[i]].Address, (byte)Watches[indexes[i]].Value, true, Domain); Global.MainForm.Cheats1.AddCheat(c); break; - case Watch.TYPE.WORD: + case Watch_Legacy.TYPE.WORD: { byte low = (byte)(Watches[indexes[i]].Value / 256); byte high = (byte)(Watches[indexes[i]].Value); @@ -1223,7 +1223,7 @@ namespace BizHawk.MultiClient } } break; - case Watch.TYPE.DWORD: + case Watch_Legacy.TYPE.DWORD: { byte HIWORDhigh = (byte)(Watches[indexes[i]].Value >> 24); byte HIWORDlow = (byte)(Watches[indexes[i]].Value >> 16); @@ -1275,14 +1275,14 @@ namespace BizHawk.MultiClient { switch (Watches[indexes[i]].Type) { - case Watch.TYPE.BYTE: + case Watch_Legacy.TYPE.BYTE: Global.CheatList.Remove(Domain, Watches[indexes[i]].Address); break; - case Watch.TYPE.WORD: + case Watch_Legacy.TYPE.WORD: Global.CheatList.Remove(Domain, Watches[indexes[i]].Address); Global.CheatList.Remove(Domain, Watches[indexes[i]].Address + 1); break; - case Watch.TYPE.DWORD: + case Watch_Legacy.TYPE.DWORD: Global.CheatList.Remove(Domain, Watches[indexes[i]].Address); Global.CheatList.Remove(Domain, Watches[indexes[i]].Address + 1); Global.CheatList.Remove(Domain, Watches[indexes[i]].Address + 2); @@ -1494,7 +1494,7 @@ namespace BizHawk.MultiClient { sortReverse = false; } - Watches.Sort((x, y) => x.CompareTo(y, columnName, Global.Config.RamWatchPrev_Type == 1 ? Watch.PREVDEF.LASTFRAME : Watch.PREVDEF.LASTCHANGE) * (sortReverse ? -1 : 1)); + Watches.Sort((x, y) => x.CompareTo(y, columnName, Global.Config.RamWatchPrev_Type == 1 ? Watch_Legacy.PREVDEF.LASTFRAME : Watch_Legacy.PREVDEF.LASTCHANGE) * (sortReverse ? -1 : 1)); sortedCol = columnName; sortReverse = !(sortReverse); WatchListView.Refresh(); diff --git a/BizHawk.MultiClient/tools/RamWatch.resx b/BizHawk.MultiClient/tools/Watch/RamWatch.resx similarity index 100% rename from BizHawk.MultiClient/tools/RamWatch.resx rename to BizHawk.MultiClient/tools/Watch/RamWatch.resx diff --git a/BizHawk.MultiClient/tools/RamWatchNewWatch.Designer.cs b/BizHawk.MultiClient/tools/Watch/RamWatchNewWatch.Designer.cs similarity index 100% rename from BizHawk.MultiClient/tools/RamWatchNewWatch.Designer.cs rename to BizHawk.MultiClient/tools/Watch/RamWatchNewWatch.Designer.cs diff --git a/BizHawk.MultiClient/tools/RamWatchNewWatch.cs b/BizHawk.MultiClient/tools/Watch/RamWatchNewWatch.cs similarity index 83% rename from BizHawk.MultiClient/tools/RamWatchNewWatch.cs rename to BizHawk.MultiClient/tools/Watch/RamWatchNewWatch.cs index db892c9954..6680ff803c 100644 --- a/BizHawk.MultiClient/tools/RamWatchNewWatch.cs +++ b/BizHawk.MultiClient/tools/Watch/RamWatchNewWatch.cs @@ -7,7 +7,7 @@ namespace BizHawk.MultiClient { public partial class RamWatchNewWatch : Form { - public Watch Watch = new Watch(); + public Watch_Legacy Watch = new Watch_Legacy(); public bool SelectionWasMade = false; public Point location = new Point(); @@ -18,10 +18,10 @@ namespace BizHawk.MultiClient InitializeComponent(); } - public void SetWatch(Watch watch, string message = "New Watch") + public void SetWatch(Watch_Legacy watch, string message = "New Watch") { DoNotResetAddress = true; //Hack for the drop down event changing when initializing the drop down - Watch = new Watch(watch); + Watch = new Watch_Legacy(watch); Text = message; NotesBox.Text = watch.Notes; @@ -70,28 +70,28 @@ namespace BizHawk.MultiClient if (SignedRadio.Checked) { - Watch.Signed = Watch.DISPTYPE.SIGNED; + Watch.Signed = Watch_Legacy.DISPTYPE.SIGNED; } else if (UnsignedRadio.Checked) { - Watch.Signed = Watch.DISPTYPE.UNSIGNED; + Watch.Signed = Watch_Legacy.DISPTYPE.UNSIGNED; } else if (HexRadio.Checked) { - Watch.Signed = Watch.DISPTYPE.HEX; + Watch.Signed = Watch_Legacy.DISPTYPE.HEX; } if (Byte1Radio.Checked) { - Watch.Type = Watch.TYPE.BYTE; + Watch.Type = Watch_Legacy.TYPE.BYTE; } else if (Byte2Radio.Checked) { - Watch.Type = Watch.TYPE.WORD; + Watch.Type = Watch_Legacy.TYPE.WORD; } else if (Byte4Radio.Checked) { - Watch.Type = Watch.TYPE.DWORD; + Watch.Type = Watch_Legacy.TYPE.DWORD; } if (BigEndianRadio.Checked) @@ -153,13 +153,13 @@ namespace BizHawk.MultiClient { switch (Watch.Type) { - case Watch.TYPE.BYTE: + case Watch_Legacy.TYPE.BYTE: Byte1Radio.Checked = true; break; - case Watch.TYPE.WORD: + case Watch_Legacy.TYPE.WORD: Byte2Radio.Checked = true; break; - case Watch.TYPE.DWORD: + case Watch_Legacy.TYPE.DWORD: Byte4Radio.Checked = true; break; default: @@ -223,13 +223,13 @@ namespace BizHawk.MultiClient { switch (Watch.Signed) { - case Watch.DISPTYPE.SIGNED: + case Watch_Legacy.DISPTYPE.SIGNED: SignedRadio.Checked = true; break; - case Watch.DISPTYPE.UNSIGNED: + case Watch_Legacy.DISPTYPE.UNSIGNED: UnsignedRadio.Checked = true; break; - case Watch.DISPTYPE.HEX: + case Watch_Legacy.DISPTYPE.HEX: HexRadio.Checked = true; break; } diff --git a/BizHawk.MultiClient/tools/RamWatchNewWatch.resx b/BizHawk.MultiClient/tools/Watch/RamWatchNewWatch.resx similarity index 100% rename from BizHawk.MultiClient/tools/RamWatchNewWatch.resx rename to BizHawk.MultiClient/tools/Watch/RamWatchNewWatch.resx diff --git a/BizHawk.MultiClient/tools/Watch.cs b/BizHawk.MultiClient/tools/Watch/Watch.cs similarity index 50% rename from BizHawk.MultiClient/tools/Watch.cs rename to BizHawk.MultiClient/tools/Watch/Watch.cs index b6c1e7c146..430814eb43 100644 --- a/BizHawk.MultiClient/tools/Watch.cs +++ b/BizHawk.MultiClient/tools/Watch/Watch.cs @@ -9,894 +9,7 @@ using System.Windows.Forms; namespace BizHawk.MultiClient { - #region Legacy watch object - /// - /// An object that represent a ram address and related properties - /// - public class Watch - { - public enum TYPE { BYTE, WORD, DWORD, SEPARATOR }; - public enum DISPTYPE { SIGNED, UNSIGNED, HEX }; - public enum PREVDEF { LASTSEARCH, ORIGINAL, LASTFRAME, LASTCHANGE }; - - #region Constructors - - public Watch() - { - Address = 0; - Value = 0; - Type = TYPE.BYTE; - Signed = DISPTYPE.UNSIGNED; - BigEndian = true; - Notes = ""; - Changecount = 0; - Prev = 0; - Original = 0; - LastChange = 0; - LastSearch = 0; - Deleted = false; - Domain = Global.Emulator.MainMemory; - } - - public Watch(Watch w) - { - Address = w.Address; - Value = w.Value; - Type = w.Type; - Signed = w.Signed; - BigEndian = w.BigEndian; - Notes = w.Notes; - Changecount = w.Changecount; - Prev = w.Prev; - Original = w.Original; - LastChange = w.LastChange; - LastSearch = w.LastSearch; - Domain = w.Domain; - Deleted = w.Deleted; - } - - public Watch(MemoryDomain _domain, int _address, int _value, TYPE _type, DISPTYPE _disptype, bool _bigendian, string _notes) - { - Domain = _domain; - Address = _address; - Value = _value; - Type = _type; - Signed = _disptype; - BigEndian = _bigendian; - Notes = _notes; - Changecount = 0; - Prev = _value; - Original = _value; - LastChange = _value; - LastSearch = _value; - } - - #endregion - - #region Publics - - public MemoryDomain Domain; - public int Address; - public int Value; - public int Prev; - public int Original; - public int LastChange; - public int LastSearch; - public TYPE Type; - public DISPTYPE Signed; - public bool BigEndian; - public string Notes; - public int Changecount; - public bool Deleted; - - #endregion - - #region Properties - - public int DiffPrev - { - get { return Value - Prev; } - } - - public int DiffOriginal - { - get { return Value - Original; } - } - - public int DiffLastChange - { - get { return Value - LastChange; } - } - - public int DiffLastSearch - { - get { return Value - LastSearch; } - } - - public string ValueString - { - get { return ValToString(Value); } - } - - public string PrevString - { - get { return ValToString(Prev); } - } - - public string OriginalString - { - get { return ValToString(Original); } - } - - public string LastChangeString - { - get { return ValToString(LastChange); } - } - - public string LastSearchString - { - get { return ValToString(LastSearch); } - } - - public string DiffOriginalString - { - get { return DiffToString(Original); } - } - - public string DiffLastSearchString - { - get { return DiffToString(LastSearch); } - } - - public uint UnsignedValue - { - get { return UnsignedVal(Value); } - } - - public int SignedValue - { - get { return SignedVal(Value); } - } - - public char TypeChar - { - get - { - switch (Type) - { - case TYPE.BYTE: - return 'b'; - case TYPE.WORD: - return 'w'; - case TYPE.DWORD: - return 'd'; - case TYPE.SEPARATOR: - return 'S'; - default: - return 'b'; //Just in case - } - } - } - - public char SignedChar - { - get - { - switch (Signed) - { - case DISPTYPE.SIGNED: - return 's'; - case DISPTYPE.UNSIGNED: - return 'u'; - case DISPTYPE.HEX: - return 'h'; - default: - return 's'; //Just in case - } - } - } - - public string DiffPrevString - { - get { return DiffToString(DiffPrev); } - } - - public string DiffLastChangeString - { - get { return DiffToString(DiffLastChange); } - } - - #endregion - - #region Public Methods - - public bool SetTypeByChar(char c) //b = byte, w = word, d = dword - { - switch (c) - { - case 'b': - Type = TYPE.BYTE; - return true; - case 'w': - Type = TYPE.WORD; - return true; - case 'd': - Type = TYPE.DWORD; - return true; - case 'S': - Type = TYPE.SEPARATOR; - return true; - default: - return false; - } - } - - public bool SetSignedByChar(char c) //s = signed, u = unsigned, h = hex - { - switch (c) - { - case 's': - Signed = DISPTYPE.SIGNED; - return true; - case 'u': - Signed = DISPTYPE.UNSIGNED; - return true; - case 'h': - Signed = DISPTYPE.HEX; - return true; - default: - return false; - } - } - - public void PeekAddress() - { - if (Type == TYPE.SEPARATOR) - { - return; - } - - Prev = Value; - - switch (Type) - { - case TYPE.BYTE: - Value = Domain.PeekByte(Address); - break; - case TYPE.WORD: - if (BigEndian) - { - Value = 0; - Value |= Domain.PeekByte(Address) << 8; - Value |= Domain.PeekByte(Address + 1); - } - else - { - Value = 0; - Value |= Domain.PeekByte(Address); - Value |= Domain.PeekByte(Address + 1) << 8; - } - break; - case TYPE.DWORD: - if (BigEndian) - { - Value = 0; - Value |= Domain.PeekByte(Address) << 24; - Value |= Domain.PeekByte(Address + 1) << 16; - Value |= Domain.PeekByte(Address + 2) << 8; - Value |= Domain.PeekByte(Address + 3) << 0; - } - else - { - Value = 0; - Value |= Domain.PeekByte(Address) << 0; - Value |= Domain.PeekByte(Address + 1) << 8; - Value |= Domain.PeekByte(Address + 2) << 16; - Value |= Domain.PeekByte(Address + 3) << 24; - } - break; - } - - if (Value != Prev) - { - LastChange = Prev; - Changecount++; - } - } - - public void PokeAddress() - { - if (Type == TYPE.SEPARATOR) - return; - - switch (Type) - { - case TYPE.BYTE: - PokeByte(); - break; - case TYPE.WORD: - PokeWord(); - break; - case TYPE.DWORD: - PokeDWord(); - break; - } - } - - public uint UnsignedVal(int val) - { - switch (Type) - { - case TYPE.BYTE: - return (byte)val; - case TYPE.WORD: - return (ushort)val; - } - return (uint)val; - } - - public int SignedVal(int val) - { - switch (Type) - { - case TYPE.BYTE: - return (sbyte)val; - case TYPE.WORD: - return (short)val; - } - return val; - } - - public override string ToString() - { - if (Type == TYPE.SEPARATOR) - { - return "----"; - } - - StringBuilder str = new StringBuilder(Notes); - str.Append(": "); - str.Append(ValToString(Value)); - return str.ToString(); - } - - public void TrySetValue(string value) - { - switch (Signed) - { - case DISPTYPE.SIGNED: - try - { - Value = int.Parse(value); - } - catch { } - break; - case DISPTYPE.UNSIGNED: - try - { - Value = (int)uint.Parse(value); - } - catch { } - break; - case DISPTYPE.HEX: - try - { - Value = int.Parse(value, NumberStyles.HexNumber); - } - catch { } - break; - } - } - - #endregion - - #region Helpers - - private string ValToString(int val) - { - if (Type == TYPE.SEPARATOR) - { - return ""; - } - else - { - switch (Signed) - { - default: - case DISPTYPE.UNSIGNED: - return UnsignedVal(val).ToString(); - case DISPTYPE.SIGNED: - return SignedVal(val).ToString(); - case DISPTYPE.HEX: - switch (Type) - { - default: - case TYPE.BYTE: - return String.Format("{0:X2}", val); - case TYPE.WORD: - return String.Format("{0:X4}", val); - case TYPE.DWORD: - return String.Format("{0:X8}", val); - } - } - } - } - - - - private string DiffToString(int diff) - { - string converted = diff.ToString(); - if (diff >= 0) - converted = "+" + converted; - return converted; - } - - private void PokeByte() - { - Domain.PokeByte(Address, (byte)Value); - } - - private void PokeWord() - { - if (BigEndian) - { - Domain.PokeByte(Address + 0, (byte)(Value >> 8)); - Domain.PokeByte(Address + 1, (byte)(Value)); - } - else - { - Domain.PokeByte(Address + 0, (byte)(Value)); - Domain.PokeByte(Address + 1, (byte)(Value >> 8)); - } - } - - private void PokeDWord() - { - if (BigEndian) - { - Domain.PokeByte(Address + 0, (byte)(Value >> 24)); - Domain.PokeByte(Address + 1, (byte)(Value >> 16)); - Domain.PokeByte(Address + 2, (byte)(Value >> 8)); - Domain.PokeByte(Address + 3, (byte)(Value)); - } - else - { - Domain.PokeByte(Address + 0, (byte)(Value)); - Domain.PokeByte(Address + 1, (byte)(Value >> 8)); - Domain.PokeByte(Address + 2, (byte)(Value >> 16)); - Domain.PokeByte(Address + 3, (byte)(Value >> 24)); - } - } - - #endregion - - #region Compare Methods - - private int ComparePrevious(Watch Other, PREVDEF previous) - { - switch (previous) - { - case PREVDEF.LASTSEARCH: - return CompareLastSearch(Other); - case PREVDEF.ORIGINAL: - return CompareOriginal(Other); - default: - case PREVDEF.LASTFRAME: - return ComparePrev(Other); - case PREVDEF.LASTCHANGE: - return CompareLastChange(Other); - } - } - - private int CompareDiff(Watch Other, PREVDEF previous) - { - switch (previous) - { - case PREVDEF.LASTSEARCH: - return CompareDiffLastSearch(Other); - case PREVDEF.ORIGINAL: - return CompareDiffOriginal(Other); - default: - case PREVDEF.LASTFRAME: - return CompareDiffPrev(Other); - case PREVDEF.LASTCHANGE: - return CompareDiffLastChange(Other); - } - } - - private int CompareAddress(Watch Other) - { - if (Address < Other.Address) - return -1; - else if (Address > Other.Address) - return 1; - else - return 0; - } - - private int CompareValue(Watch Other) - { - if (Signed == DISPTYPE.SIGNED) - { - if (SignedVal(Value) < SignedVal(Other.Value)) - return -1; - else if (SignedVal(Value) > SignedVal(Other.Value)) - return 1; - else - return 0; - } - if (UnsignedVal(Value) < UnsignedVal(Other.Value)) - return -1; - else if (UnsignedVal(Value) > UnsignedVal(Other.Value)) - return 1; - else - return 0; - } - - private int ComparePrev(Watch Other) - { - if (Signed == DISPTYPE.SIGNED) - { - if (SignedVal(Prev) < SignedVal(Other.Prev)) - return -1; - else if (SignedVal(Prev) > SignedVal(Other.Prev)) - return 1; - else - return 0; - } - if (UnsignedVal(Prev) < UnsignedVal(Other.Prev)) - return -1; - else if (UnsignedVal(Prev) > UnsignedVal(Other.Prev)) - return 1; - else - return 0; - } - - private int CompareOriginal(Watch Other) - { - if (Signed == DISPTYPE.SIGNED) - { - if (SignedVal(Original) < SignedVal(Other.Original)) - return -1; - else if (SignedVal(Original) > SignedVal(Other.Original)) - return 1; - else - return 0; - } - if (UnsignedVal(Original) < UnsignedVal(Other.Original)) - return -1; - else if (UnsignedVal(Original) > UnsignedVal(Other.Original)) - return 1; - else - return 0; - } - - private int CompareLastChange(Watch Other) - { - if (Signed == DISPTYPE.SIGNED) - { - if (SignedVal(LastChange) < SignedVal(Other.LastChange)) - return -1; - else if (SignedVal(LastChange) > SignedVal(Other.LastChange)) - return 1; - else - return 0; - } - if (UnsignedVal(LastChange) < UnsignedVal(Other.LastChange)) - return -1; - else if (UnsignedVal(LastChange) > UnsignedVal(Other.LastChange)) - return 1; - else - return 0; - } - - private int CompareLastSearch(Watch Other) - { - if (Signed == DISPTYPE.SIGNED) - { - if (SignedVal(LastSearch) < SignedVal(Other.LastSearch)) - return -1; - else if (SignedVal(LastSearch) > SignedVal(Other.LastSearch)) - return 1; - else - return 0; - } - if (UnsignedVal(LastSearch) < UnsignedVal(Other.LastSearch)) - return -1; - else if (UnsignedVal(LastSearch) > UnsignedVal(Other.LastSearch)) - return 1; - else - return 0; - } - - private int CompareDiffPrev(Watch Other) - { - if (DiffPrev < Other.DiffPrev) - return -1; - else if (DiffPrev > Other.DiffPrev) - return 1; - else - return 0; - } - - private int CompareDiffOriginal(Watch Other) - { - if (DiffOriginal < Other.DiffOriginal) - return -1; - else if (DiffOriginal > Other.DiffOriginal) - return 1; - else - return 0; - } - - private int CompareDiffLastChange(Watch Other) - { - if (DiffLastChange < Other.DiffLastChange) - return -1; - else if (DiffLastChange > Other.DiffLastChange) - return 1; - else - return 0; - } - - private int CompareDiffLastSearch(Watch Other) - { - if (DiffLastSearch < Other.DiffLastSearch) - return -1; - else if (DiffLastSearch > Other.DiffLastSearch) - return 1; - else - return 0; - } - - private int CompareChanges(Watch Other) - { - if (Changecount < Other.Changecount) - return -1; - else if (Changecount > Other.Changecount) - return 1; - else - return 0; - } - - private int CompareNotes(Watch Other) - { - if (Notes == null & Other.Notes == null) - return 0; - else if (Notes == null) - return -1; - else if (Other.Notes == null) - return 1; - else - return Notes.CompareTo(Other.Notes); - } - - private int CompareDomain(Watch Other) - { - if (Domain == null & Other.Domain == null) - { - return 0; - } - else if (Domain == null) - { - return -1; - } - else if (Other.Domain == null) - { - return 1; - } - else - { - return Domain.Name.CompareTo(Other.Domain.Name); - } - } - - public int CompareTo(Watch Other, string parameter, PREVDEF previous) - { - int compare = 0; - if (parameter == "Address") - { - compare = CompareAddress(Other); - if (compare == 0) - { - compare = CompareValue(Other); - if (compare == 0) - { - compare = CompareChanges(Other); - if (compare == 0) - { - compare = ComparePrevious(Other, previous); - if (compare == 0) - { - compare = CompareDomain(Other); - if (compare == 0) - { - compare = CompareDiff(Other, previous); - if (compare == 0) - { - compare = CompareNotes(Other); - } - } - } - } - } - } - } - - else if (parameter == "Value") - { - compare = CompareValue(Other); - if (compare == 0) - { - compare = CompareAddress(Other); - if (compare == 0) - { - compare = CompareChanges(Other); - if (compare == 0) - { - compare = ComparePrevious(Other, previous); - if (compare == 0) - { - compare = CompareDiff(Other, previous); - if (compare == 0) - { - compare = CompareDomain(Other); - if (compare == 0) - { - compare = CompareNotes(Other); - } - } - } - } - } - } - } - - else if (parameter == "Changes") - { - compare = CompareChanges(Other); - if (compare == 0) - { - compare = CompareAddress(Other); - if (compare == 0) - { - compare = CompareValue(Other); - if (compare == 0) - { - compare = ComparePrevious(Other, previous); - if (compare == 0) - { - compare = CompareDiff(Other, previous); - if (compare == 0) - compare = CompareNotes(Other); - } - } - } - } - } - - else if (parameter == "Prev") - { - compare = ComparePrevious(Other, previous); - if (compare == 0) - { - compare = CompareAddress(Other); - if (compare == 0) - { - compare = CompareValue(Other); - if (compare == 0) - { - compare = CompareChanges(Other); - if (compare == 0) - { - compare = CompareDiff(Other, previous); - if (compare == 0) - { - compare = CompareDomain(Other); - if (compare == 0) - { - compare = CompareNotes(Other); - } - } - } - } - } - } - } - - else if (parameter == "Diff") - { - compare = CompareDiff(Other, previous); - if (compare == 0) - { - compare = CompareAddress(Other); - if (compare == 0) - { - compare = CompareValue(Other); - if (compare == 0) - { - compare = CompareChanges(Other); - if (compare == 0) - { - compare = ComparePrevious(Other, previous); - if (compare == 0) - { - compare = CompareDomain(Other); - if (compare == 0) - { - compare = CompareNotes(Other); - } - } - } - } - } - } - } - - else if (parameter == "Domain") - { - compare = CompareDomain(Other); - if (compare == 0) - { - compare = CompareAddress(Other); - if (compare == 0) - { - compare = CompareValue(Other); - if (compare == 0) - { - compare = CompareChanges(Other); - if (compare == 0) - { - compare = ComparePrevious(Other, previous); - if (compare == 0) - { - compare = CompareNotes(Other); - } - } - } - } - } - } - - else if (parameter == "Notes") - { - compare = CompareNotes(Other); - if (compare == 0) - { - compare = CompareAddress(Other); - if (compare == 0) - { - compare = CompareValue(Other); - if (compare == 0) - { - compare = CompareChanges(Other); - if (compare == 0) - { - compare = ComparePrevious(Other, previous); - if (compare == 0) - { - compare = CompareDiff(Other, previous); - if (compare == 0) - { - compare = CompareDomain(Other); - } - } - } - } - } - } - } - - return compare; - } - - #endregion - } - - #endregion - - public abstract class WatchBase + public abstract class Watch { public enum WatchSize { Byte = 1, Word = 2, DWord = 4, Separator = 0 }; public enum DisplayType { Separator, Signed, Unsigned, Hex, Binary, FixedPoint_12_4, FixedPoint_20_12, Float }; @@ -1070,7 +183,7 @@ namespace BizHawk.MultiClient } } - public static WatchBase GenerateWatch(MemoryDomain domain, int address, WatchSize size, bool details) + public static Watch GenerateWatch(MemoryDomain domain, int address, WatchSize size, bool details) { switch (size) { @@ -1086,7 +199,6 @@ namespace BizHawk.MultiClient { return new ByteWatch(domain, address); } - break; case WatchSize.Word: if (details) { @@ -1123,7 +235,7 @@ namespace BizHawk.MultiClient void Update(); } - public class SeparatorWatch : WatchBase + public class SeparatorWatch : Watch { public SeparatorWatch() { } @@ -1185,7 +297,7 @@ namespace BizHawk.MultiClient } } - public class ByteWatch : WatchBase + public class ByteWatch : Watch { public ByteWatch(MemoryDomain domain, int address) { @@ -1292,7 +404,7 @@ namespace BizHawk.MultiClient } } - public class WordWatch : WatchBase + public class WordWatch : Watch { public WordWatch(MemoryDomain domain, int address) { @@ -1391,7 +503,7 @@ namespace BizHawk.MultiClient } } - public class DWordWatch : WatchBase + public class DWordWatch : Watch { public DWordWatch(MemoryDomain domain, int address) { @@ -1498,12 +610,12 @@ namespace BizHawk.MultiClient public enum WatchPrevDef { LastSearch, Original, LastFrame, LastChange }; - private List _watchList = new List(); + private List _watchList = new List(); private MemoryDomain _domain = null; public WatchList() { } - public IEnumerator GetEnumerator() + public IEnumerator GetEnumerator() { return _watchList.GetEnumerator(); } @@ -1518,7 +630,7 @@ namespace BizHawk.MultiClient get { return _watchList.Count; } } - public WatchBase this[int index] + public Watch this[int index] { get { @@ -1575,19 +687,19 @@ namespace BizHawk.MultiClient } } - public void Add(WatchBase watch) + public void Add(Watch watch) { _watchList.Add(watch); Changes = true; } - public void Remove(WatchBase watch) + public void Remove(Watch watch) { _watchList.Remove(watch); Changes = true; } - public void Insert(int index, WatchBase watch) + public void Insert(int index, Watch watch) { _watchList.Insert(index, watch); } @@ -1660,7 +772,7 @@ namespace BizHawk.MultiClient .Append("Domain ").AppendLine(_domain.Name) .Append("SystemID ").AppendLine(Global.Emulator.SystemId); - foreach (WatchBase w in _watchList) + foreach (Watch w in _watchList) { sb .Append(String.Format(AddressFormatStr, w.Address)).Append('\t') @@ -1757,8 +869,8 @@ namespace BizHawk.MultiClient //Temporary, rename if kept int addr = 0; - WatchBase.WatchSize size = WatchBase.WatchSize.Separator; - WatchBase.DisplayType type = WatchBase.DisplayType.Unsigned; + Watch.WatchSize size = Watch.WatchSize.Separator; + Watch.DisplayType type = Watch.DisplayType.Unsigned; bool bigEndian = false; MemoryDomain memDomain = Global.Emulator.MainMemory; string notes; @@ -1775,12 +887,12 @@ namespace BizHawk.MultiClient startIndex = line.IndexOf('\t') + 1; line = line.Substring(startIndex, line.Length - startIndex); //Type - size = WatchBase.SizeFromChar(line[0]); + size = Watch.SizeFromChar(line[0]); startIndex = line.IndexOf('\t') + 1; line = line.Substring(startIndex, line.Length - startIndex); //Signed - type = WatchBase.DisplayTypeFromChar(line[0]); + type = Watch.DisplayTypeFromChar(line[0]); startIndex = line.IndexOf('\t') + 1; line = line.Substring(startIndex, line.Length - startIndex); //Endian @@ -1812,7 +924,7 @@ namespace BizHawk.MultiClient startIndex = line.IndexOf('\t') + 1; notes = line.Substring(startIndex, line.Length - startIndex); //User notes - WatchBase w = WatchBase.GenerateWatch(memDomain, addr, size, details); + Watch w = Watch.GenerateWatch(memDomain, addr, size, details); w.BigEndian = bigEndian; w.Type = type; if (w is iWatchEntryDetails) diff --git a/BizHawk.MultiClient/tools/WatchCommon.cs b/BizHawk.MultiClient/tools/Watch/WatchCommon.cs similarity index 93% rename from BizHawk.MultiClient/tools/WatchCommon.cs rename to BizHawk.MultiClient/tools/Watch/WatchCommon.cs index 9760a90901..adb678fecf 100644 --- a/BizHawk.MultiClient/tools/WatchCommon.cs +++ b/BizHawk.MultiClient/tools/Watch/WatchCommon.cs @@ -27,7 +27,7 @@ namespace BizHawk.MultiClient return file; } - public static bool SaveWchFile(string path, string domain_name, List watchList) + public static bool SaveWchFile(string path, string domain_name, List watchList) { using (StreamWriter sw = new StreamWriter(path)) { @@ -39,7 +39,7 @@ namespace BizHawk.MultiClient str.Append(Global.Emulator.SystemId); str.Append('\n'); - foreach (Watch t in watchList) + foreach (Watch_Legacy t in watchList) { str.Append(string.Format("{0:X4}", t.Address)); str.Append('\t'); @@ -67,7 +67,7 @@ namespace BizHawk.MultiClient return true; } - public static bool LoadWatchFile(string path, bool append, List watchList, out string domain) + public static bool LoadWatchFile(string path, bool append, List watchList, out string domain) { domain = ""; var file = new FileInfo(path); @@ -125,7 +125,7 @@ namespace BizHawk.MultiClient { continue; //If not 4, something is wrong with this line, ignore it } - Watch w = new Watch(); + Watch_Legacy w = new Watch_Legacy(); string temp = s.Substring(0, s.IndexOf('\t')); try diff --git a/BizHawk.MultiClient/tools/Watch/WatchEditor.Designer.cs b/BizHawk.MultiClient/tools/Watch/WatchEditor.Designer.cs new file mode 100644 index 0000000000..427b302496 --- /dev/null +++ b/BizHawk.MultiClient/tools/Watch/WatchEditor.Designer.cs @@ -0,0 +1,311 @@ +namespace BizHawk.MultiClient +{ + partial class WatchEditor + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.AddressBox = new BizHawk.HexTextBox(); + this.NotesBox = new System.Windows.Forms.TextBox(); + this.DataTypeGroupBox = new System.Windows.Forms.GroupBox(); + this.HexRadio = new System.Windows.Forms.RadioButton(); + this.UnsignedRadio = new System.Windows.Forms.RadioButton(); + this.SignedRadio = new System.Windows.Forms.RadioButton(); + this.DataSizeBox = new System.Windows.Forms.GroupBox(); + this.Byte4Radio = new System.Windows.Forms.RadioButton(); + this.Byte2Radio = new System.Windows.Forms.RadioButton(); + this.Byte1Radio = new System.Windows.Forms.RadioButton(); + this.EndianBox = new System.Windows.Forms.GroupBox(); + this.LittleEndianRadio = new System.Windows.Forms.RadioButton(); + this.BigEndianRadio = new System.Windows.Forms.RadioButton(); + this.OK = new System.Windows.Forms.Button(); + this.Cancel = new System.Windows.Forms.Button(); + this.label6 = new System.Windows.Forms.Label(); + this.DomainComboBox = new System.Windows.Forms.ComboBox(); + this.DataTypeGroupBox.SuspendLayout(); + this.DataSizeBox.SuspendLayout(); + this.EndianBox.SuspendLayout(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(9, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(62, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Address: 0x"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(9, 35); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(38, 13); + this.label2.TabIndex = 1; + this.label2.Text = "Notes:"; + // + // AddressBox + // + this.AddressBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; + this.AddressBox.Location = new System.Drawing.Point(69, 6); + this.AddressBox.MaxLength = 8; + this.AddressBox.Name = "AddressBox"; + this.AddressBox.Size = new System.Drawing.Size(100, 20); + this.AddressBox.TabIndex = 2; + this.AddressBox.Text = "00000000"; + this.AddressBox.Leave += new System.EventHandler(this.AddressBox_Leave); + // + // NotesBox + // + this.NotesBox.Location = new System.Drawing.Point(69, 32); + this.NotesBox.MaxLength = 256; + this.NotesBox.Name = "NotesBox"; + this.NotesBox.Size = new System.Drawing.Size(100, 20); + this.NotesBox.TabIndex = 3; + // + // DataTypeGroupBox + // + this.DataTypeGroupBox.Controls.Add(this.HexRadio); + this.DataTypeGroupBox.Controls.Add(this.UnsignedRadio); + this.DataTypeGroupBox.Controls.Add(this.SignedRadio); + this.DataTypeGroupBox.Location = new System.Drawing.Point(12, 67); + this.DataTypeGroupBox.Name = "DataTypeGroupBox"; + this.DataTypeGroupBox.Size = new System.Drawing.Size(95, 79); + this.DataTypeGroupBox.TabIndex = 4; + this.DataTypeGroupBox.TabStop = false; + this.DataTypeGroupBox.Text = "Data Type"; + // + // HexRadio + // + this.HexRadio.AutoSize = true; + this.HexRadio.Location = new System.Drawing.Point(4, 51); + this.HexRadio.Name = "HexRadio"; + this.HexRadio.Size = new System.Drawing.Size(86, 17); + this.HexRadio.TabIndex = 2; + this.HexRadio.Text = "Hexadecimal"; + this.HexRadio.UseVisualStyleBackColor = true; + // + // UnsignedRadio + // + this.UnsignedRadio.AutoSize = true; + this.UnsignedRadio.Checked = true; + this.UnsignedRadio.Location = new System.Drawing.Point(4, 34); + this.UnsignedRadio.Name = "UnsignedRadio"; + this.UnsignedRadio.Size = new System.Drawing.Size(70, 17); + this.UnsignedRadio.TabIndex = 1; + this.UnsignedRadio.TabStop = true; + this.UnsignedRadio.Text = "Unsigned"; + this.UnsignedRadio.UseVisualStyleBackColor = true; + // + // SignedRadio + // + this.SignedRadio.AutoSize = true; + this.SignedRadio.Location = new System.Drawing.Point(4, 17); + this.SignedRadio.Name = "SignedRadio"; + this.SignedRadio.Size = new System.Drawing.Size(58, 17); + this.SignedRadio.TabIndex = 0; + this.SignedRadio.Text = "Signed"; + this.SignedRadio.UseVisualStyleBackColor = true; + // + // DataSizeBox + // + this.DataSizeBox.Controls.Add(this.Byte4Radio); + this.DataSizeBox.Controls.Add(this.Byte2Radio); + this.DataSizeBox.Controls.Add(this.Byte1Radio); + this.DataSizeBox.Location = new System.Drawing.Point(115, 67); + this.DataSizeBox.Name = "DataSizeBox"; + this.DataSizeBox.Size = new System.Drawing.Size(83, 79); + this.DataSizeBox.TabIndex = 5; + this.DataSizeBox.TabStop = false; + this.DataSizeBox.Text = "Data Size:"; + // + // Byte4Radio + // + this.Byte4Radio.AutoSize = true; + this.Byte4Radio.Location = new System.Drawing.Point(5, 51); + this.Byte4Radio.Name = "Byte4Radio"; + this.Byte4Radio.Size = new System.Drawing.Size(60, 17); + this.Byte4Radio.TabIndex = 2; + this.Byte4Radio.Text = "4 Bytes"; + this.Byte4Radio.UseVisualStyleBackColor = true; + // + // Byte2Radio + // + this.Byte2Radio.AutoSize = true; + this.Byte2Radio.Location = new System.Drawing.Point(5, 34); + this.Byte2Radio.Name = "Byte2Radio"; + this.Byte2Radio.Size = new System.Drawing.Size(60, 17); + this.Byte2Radio.TabIndex = 1; + this.Byte2Radio.Text = "2 Bytes"; + this.Byte2Radio.UseVisualStyleBackColor = true; + // + // Byte1Radio + // + this.Byte1Radio.AutoSize = true; + this.Byte1Radio.Checked = true; + this.Byte1Radio.Location = new System.Drawing.Point(5, 17); + this.Byte1Radio.Name = "Byte1Radio"; + this.Byte1Radio.Size = new System.Drawing.Size(55, 17); + this.Byte1Radio.TabIndex = 0; + this.Byte1Radio.TabStop = true; + this.Byte1Radio.Text = "1 Byte"; + this.Byte1Radio.UseVisualStyleBackColor = true; + // + // EndianBox + // + this.EndianBox.Controls.Add(this.LittleEndianRadio); + this.EndianBox.Controls.Add(this.BigEndianRadio); + this.EndianBox.Location = new System.Drawing.Point(12, 152); + this.EndianBox.Name = "EndianBox"; + this.EndianBox.Size = new System.Drawing.Size(117, 55); + this.EndianBox.TabIndex = 6; + this.EndianBox.TabStop = false; + this.EndianBox.Text = "Endian"; + // + // LittleEndianRadio + // + this.LittleEndianRadio.AutoSize = true; + this.LittleEndianRadio.Location = new System.Drawing.Point(4, 35); + this.LittleEndianRadio.Name = "LittleEndianRadio"; + this.LittleEndianRadio.Size = new System.Drawing.Size(83, 17); + this.LittleEndianRadio.TabIndex = 1; + this.LittleEndianRadio.Text = "Little Endian"; + this.LittleEndianRadio.UseVisualStyleBackColor = true; + // + // BigEndianRadio + // + this.BigEndianRadio.AutoSize = true; + this.BigEndianRadio.Checked = true; + this.BigEndianRadio.Location = new System.Drawing.Point(4, 18); + this.BigEndianRadio.Name = "BigEndianRadio"; + this.BigEndianRadio.Size = new System.Drawing.Size(76, 17); + this.BigEndianRadio.TabIndex = 0; + this.BigEndianRadio.TabStop = true; + this.BigEndianRadio.Text = "Big Endian"; + this.BigEndianRadio.UseVisualStyleBackColor = true; + // + // OK + // + this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.OK.Location = new System.Drawing.Point(12, 260); + this.OK.Name = "OK"; + this.OK.Size = new System.Drawing.Size(75, 23); + this.OK.TabIndex = 7; + this.OK.Text = "Ok"; + this.OK.UseVisualStyleBackColor = true; + this.OK.Click += new System.EventHandler(this.OK_Click); + // + // Cancel + // + this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.Cancel.Location = new System.Drawing.Point(123, 260); + this.Cancel.Name = "Cancel"; + this.Cancel.Size = new System.Drawing.Size(75, 23); + this.Cancel.TabIndex = 8; + this.Cancel.Text = "Cancel"; + this.Cancel.UseVisualStyleBackColor = true; + this.Cancel.Click += new System.EventHandler(this.Cancel_Click); + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(11, 214); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(83, 13); + this.label6.TabIndex = 15; + this.label6.Text = "Memory Domain"; + // + // DomainComboBox + // + this.DomainComboBox.FormattingEnabled = true; + this.DomainComboBox.Location = new System.Drawing.Point(12, 230); + this.DomainComboBox.Name = "DomainComboBox"; + this.DomainComboBox.Size = new System.Drawing.Size(141, 21); + this.DomainComboBox.TabIndex = 14; + this.DomainComboBox.SelectedIndexChanged += new System.EventHandler(this.DomainComboBox_SelectedIndexChanged); + // + // WatchEditor + // + this.AcceptButton = this.OK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.Cancel; + this.ClientSize = new System.Drawing.Size(213, 296); + this.Controls.Add(this.label6); + this.Controls.Add(this.DomainComboBox); + this.Controls.Add(this.Cancel); + this.Controls.Add(this.OK); + this.Controls.Add(this.EndianBox); + this.Controls.Add(this.DataSizeBox); + this.Controls.Add(this.DataTypeGroupBox); + this.Controls.Add(this.NotesBox); + this.Controls.Add(this.AddressBox); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "WatchEditor"; + this.Text = "New Watch"; + this.Load += new System.EventHandler(this.RamWatchNewWatch_Load); + this.DataTypeGroupBox.ResumeLayout(false); + this.DataTypeGroupBox.PerformLayout(); + this.DataSizeBox.ResumeLayout(false); + this.DataSizeBox.PerformLayout(); + this.EndianBox.ResumeLayout(false); + this.EndianBox.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private HexTextBox AddressBox; + private System.Windows.Forms.TextBox NotesBox; + private System.Windows.Forms.GroupBox DataTypeGroupBox; + private System.Windows.Forms.RadioButton SignedRadio; + private System.Windows.Forms.RadioButton UnsignedRadio; + private System.Windows.Forms.RadioButton HexRadio; + private System.Windows.Forms.GroupBox DataSizeBox; + private System.Windows.Forms.RadioButton Byte1Radio; + private System.Windows.Forms.RadioButton Byte2Radio; + private System.Windows.Forms.RadioButton Byte4Radio; + private System.Windows.Forms.GroupBox EndianBox; + private System.Windows.Forms.RadioButton BigEndianRadio; + private System.Windows.Forms.RadioButton LittleEndianRadio; + private System.Windows.Forms.Button OK; + private System.Windows.Forms.Button Cancel; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.ComboBox DomainComboBox; + } +} \ No newline at end of file diff --git a/BizHawk.MultiClient/tools/Watch/WatchEditor.cs b/BizHawk.MultiClient/tools/Watch/WatchEditor.cs new file mode 100644 index 0000000000..daa7e84a7f --- /dev/null +++ b/BizHawk.MultiClient/tools/Watch/WatchEditor.cs @@ -0,0 +1,248 @@ +using System; +using System.Drawing; +using System.Windows.Forms; +using System.Globalization; + +namespace BizHawk.MultiClient +{ + public partial class WatchEditor : Form + { + public Watch_Legacy Watch = new Watch_Legacy(); + public bool SelectionWasMade = false; + public Point location = new Point(); + + private bool DoNotResetAddress; + + public WatchEditor() + { + InitializeComponent(); + } + + public void SetWatch(Watch_Legacy watch, string message = "New Watch") + { + DoNotResetAddress = true; //Hack for the drop down event changing when initializing the drop down + Watch = new Watch_Legacy(watch); + Text = message; + + NotesBox.Text = watch.Notes; + setTypeRadio(); + setSignedRadio(); + setEndianBox(); + setDomainSelection(); + setAddressBox(); + } + + #region Events + + private void RamWatchNewWatch_Load(object sender, EventArgs e) + { + if (location.X > 0 && location.Y > 0) + { + Location = location; + } + + populateMemoryDomainComboBox(); + DoNotResetAddress = false; + } + + private void Cancel_Click(object sender, EventArgs e) + { + SelectionWasMade = false; + Close(); + } + + private void OK_Click(object sender, EventArgs e) + { + //Put user settings in the watch file + SelectionWasMade = true; + if (InputValidate.IsValidHexNumber(AddressBox.Text)) + { + Watch.Address = int.Parse(AddressBox.Text, NumberStyles.HexNumber); + } + else + { + MessageBox.Show("Not a valid address (enter a valid Hex number)", "Invalid Address", MessageBoxButtons.OK, MessageBoxIcon.Error); + AddressBox.Focus(); + AddressBox.SelectAll(); + + return; + } + + if (SignedRadio.Checked) + { + Watch.Signed = Watch_Legacy.DISPTYPE.SIGNED; + } + else if (UnsignedRadio.Checked) + { + Watch.Signed = Watch_Legacy.DISPTYPE.UNSIGNED; + } + else if (HexRadio.Checked) + { + Watch.Signed = Watch_Legacy.DISPTYPE.HEX; + } + + if (Byte1Radio.Checked) + { + Watch.Type = Watch_Legacy.TYPE.BYTE; + } + else if (Byte2Radio.Checked) + { + Watch.Type = Watch_Legacy.TYPE.WORD; + } + else if (Byte4Radio.Checked) + { + Watch.Type = Watch_Legacy.TYPE.DWORD; + } + + if (BigEndianRadio.Checked) + { + Watch.BigEndian = true; + } + else if (LittleEndianRadio.Checked) + { + Watch.BigEndian = false; + } + + Watch.Domain = Global.Emulator.MemoryDomains[DomainComboBox.SelectedIndex]; + Watch.Notes = NotesBox.Text; + + Close(); + } + + private void AddressBox_Leave(object sender, EventArgs e) + { + AddressBox.Text = AddressBox.Text.Replace(" ", ""); + if (!InputValidate.IsValidHexNumber(AddressBox.Text)) + { + AddressBox.Focus(); + AddressBox.SelectAll(); + ToolTip t = new ToolTip(); + t.Show("Must be a valid hexadecimal vaue", AddressBox, 5000); + } + else + { + try + { + Watch.Address = int.Parse(AddressBox.Text, NumberStyles.HexNumber); + AddressBox.Text = String.Format("{0:X" + getNumDigits(Watch.Domain.Size - 1) + "}", Watch.Address); + } + catch + { + //Do nothing + } + } + } + + private void DomainComboBox_SelectedIndexChanged(object sender, EventArgs e) + { + if (!DoNotResetAddress) + { + Watch.Domain = Global.Emulator.MemoryDomains[DomainComboBox.SelectedIndex]; + Watch.Address = 0; + Watch.Value = 0; + setAddressBox(); + AddressBox.MaxLength = getNumDigits(Watch.Domain.Size); + } + } + + #endregion + + #region Helpers + + private void setTypeRadio() + { + switch (Watch.Type) + { + case Watch_Legacy.TYPE.BYTE: + Byte1Radio.Checked = true; + break; + case Watch_Legacy.TYPE.WORD: + Byte2Radio.Checked = true; + break; + case Watch_Legacy.TYPE.DWORD: + Byte4Radio.Checked = true; + break; + default: + break; + } + } + + private void setEndianBox() + { + if (Watch.BigEndian == true) + { + BigEndianRadio.Checked = true; + } + else + { + LittleEndianRadio.Checked = true; + } + } + + private void setDomainSelection() + { + //Counts should always be the same, but just in case, let's check + int max; + if (Global.Emulator.MemoryDomains.Count < DomainComboBox.Items.Count) + { + max = Global.Emulator.MemoryDomains.Count; + } + else + { + max = DomainComboBox.Items.Count; + } + + for (int i = 0; i < max; i++) + { + if (Watch.Domain.ToString() == DomainComboBox.Items[i].ToString()) + { + DomainComboBox.SelectedIndex = i; + } + } + } + + private void populateMemoryDomainComboBox() + { + DomainComboBox.Items.Clear(); + if (Global.Emulator.MemoryDomains.Count > 0) + { + foreach (MemoryDomain t in Global.Emulator.MemoryDomains) + { + DomainComboBox.Items.Add(t.ToString()); + } + } + setDomainSelection(); + } + + private void setAddressBox() + { + AddressBox.Text = String.Format("{0:X" + getNumDigits(Watch.Domain.Size - 1) + "}", Watch.Address); + } + + private void setSignedRadio() + { + switch (Watch.Signed) + { + case Watch_Legacy.DISPTYPE.SIGNED: + SignedRadio.Checked = true; + break; + case Watch_Legacy.DISPTYPE.UNSIGNED: + UnsignedRadio.Checked = true; + break; + case Watch_Legacy.DISPTYPE.HEX: + HexRadio.Checked = true; + break; + } + } + + private int getNumDigits(Int32 i) + { + if (i < 0x10000) return 4; + if (i < 0x1000000) return 6; + if (i < 0x10000000) return 7; + else return 8; + } + + #endregion + } +} diff --git a/BizHawk.MultiClient/tools/Watch/WatchEditor.resx b/BizHawk.MultiClient/tools/Watch/WatchEditor.resx new file mode 100644 index 0000000000..29dcb1b3a3 --- /dev/null +++ b/BizHawk.MultiClient/tools/Watch/WatchEditor.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/BizHawk.MultiClient/tools/Watch/WatchLegacy.cs b/BizHawk.MultiClient/tools/Watch/WatchLegacy.cs new file mode 100644 index 0000000000..f2ca5c9a77 --- /dev/null +++ b/BizHawk.MultiClient/tools/Watch/WatchLegacy.cs @@ -0,0 +1,895 @@ +using System; +using System.Text; +using System.Globalization; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.IO; +using System.Windows.Forms; + +namespace BizHawk.MultiClient +{ + /// + /// An object that represent a ram address and related properties + /// + public class Watch_Legacy + { + public enum TYPE { BYTE, WORD, DWORD, SEPARATOR }; + public enum DISPTYPE { SIGNED, UNSIGNED, HEX }; + public enum PREVDEF { LASTSEARCH, ORIGINAL, LASTFRAME, LASTCHANGE }; + + #region Constructors + + public Watch_Legacy() + { + Address = 0; + Value = 0; + Type = TYPE.BYTE; + Signed = DISPTYPE.UNSIGNED; + BigEndian = true; + Notes = ""; + Changecount = 0; + Prev = 0; + Original = 0; + LastChange = 0; + LastSearch = 0; + Deleted = false; + Domain = Global.Emulator.MainMemory; + } + + public Watch_Legacy(Watch_Legacy w) + { + Address = w.Address; + Value = w.Value; + Type = w.Type; + Signed = w.Signed; + BigEndian = w.BigEndian; + Notes = w.Notes; + Changecount = w.Changecount; + Prev = w.Prev; + Original = w.Original; + LastChange = w.LastChange; + LastSearch = w.LastSearch; + Domain = w.Domain; + Deleted = w.Deleted; + } + + public Watch_Legacy(MemoryDomain _domain, int _address, int _value, TYPE _type, DISPTYPE _disptype, bool _bigendian, string _notes) + { + Domain = _domain; + Address = _address; + Value = _value; + Type = _type; + Signed = _disptype; + BigEndian = _bigendian; + Notes = _notes; + Changecount = 0; + Prev = _value; + Original = _value; + LastChange = _value; + LastSearch = _value; + } + + #endregion + + #region Publics + + public MemoryDomain Domain; + public int Address; + public int Value; + public int Prev; + public int Original; + public int LastChange; + public int LastSearch; + public TYPE Type; + public DISPTYPE Signed; + public bool BigEndian; + public string Notes; + public int Changecount; + public bool Deleted; + + #endregion + + #region Properties + + public int DiffPrev + { + get { return Value - Prev; } + } + + public int DiffOriginal + { + get { return Value - Original; } + } + + public int DiffLastChange + { + get { return Value - LastChange; } + } + + public int DiffLastSearch + { + get { return Value - LastSearch; } + } + + public string ValueString + { + get { return ValToString(Value); } + } + + public string PrevString + { + get { return ValToString(Prev); } + } + + public string OriginalString + { + get { return ValToString(Original); } + } + + public string LastChangeString + { + get { return ValToString(LastChange); } + } + + public string LastSearchString + { + get { return ValToString(LastSearch); } + } + + public string DiffOriginalString + { + get { return DiffToString(Original); } + } + + public string DiffLastSearchString + { + get { return DiffToString(LastSearch); } + } + + public uint UnsignedValue + { + get { return UnsignedVal(Value); } + } + + public int SignedValue + { + get { return SignedVal(Value); } + } + + public char TypeChar + { + get + { + switch (Type) + { + case TYPE.BYTE: + return 'b'; + case TYPE.WORD: + return 'w'; + case TYPE.DWORD: + return 'd'; + case TYPE.SEPARATOR: + return 'S'; + default: + return 'b'; //Just in case + } + } + } + + public char SignedChar + { + get + { + switch (Signed) + { + case DISPTYPE.SIGNED: + return 's'; + case DISPTYPE.UNSIGNED: + return 'u'; + case DISPTYPE.HEX: + return 'h'; + default: + return 's'; //Just in case + } + } + } + + public string DiffPrevString + { + get { return DiffToString(DiffPrev); } + } + + public string DiffLastChangeString + { + get { return DiffToString(DiffLastChange); } + } + + #endregion + + #region Public Methods + + public bool SetTypeByChar(char c) //b = byte, w = word, d = dword + { + switch (c) + { + case 'b': + Type = TYPE.BYTE; + return true; + case 'w': + Type = TYPE.WORD; + return true; + case 'd': + Type = TYPE.DWORD; + return true; + case 'S': + Type = TYPE.SEPARATOR; + return true; + default: + return false; + } + } + + public bool SetSignedByChar(char c) //s = signed, u = unsigned, h = hex + { + switch (c) + { + case 's': + Signed = DISPTYPE.SIGNED; + return true; + case 'u': + Signed = DISPTYPE.UNSIGNED; + return true; + case 'h': + Signed = DISPTYPE.HEX; + return true; + default: + return false; + } + } + + public void PeekAddress() + { + if (Type == TYPE.SEPARATOR) + { + return; + } + + Prev = Value; + + switch (Type) + { + case TYPE.BYTE: + Value = Domain.PeekByte(Address); + break; + case TYPE.WORD: + if (BigEndian) + { + Value = 0; + Value |= Domain.PeekByte(Address) << 8; + Value |= Domain.PeekByte(Address + 1); + } + else + { + Value = 0; + Value |= Domain.PeekByte(Address); + Value |= Domain.PeekByte(Address + 1) << 8; + } + break; + case TYPE.DWORD: + if (BigEndian) + { + Value = 0; + Value |= Domain.PeekByte(Address) << 24; + Value |= Domain.PeekByte(Address + 1) << 16; + Value |= Domain.PeekByte(Address + 2) << 8; + Value |= Domain.PeekByte(Address + 3) << 0; + } + else + { + Value = 0; + Value |= Domain.PeekByte(Address) << 0; + Value |= Domain.PeekByte(Address + 1) << 8; + Value |= Domain.PeekByte(Address + 2) << 16; + Value |= Domain.PeekByte(Address + 3) << 24; + } + break; + } + + if (Value != Prev) + { + LastChange = Prev; + Changecount++; + } + } + + public void PokeAddress() + { + if (Type == TYPE.SEPARATOR) + return; + + switch (Type) + { + case TYPE.BYTE: + PokeByte(); + break; + case TYPE.WORD: + PokeWord(); + break; + case TYPE.DWORD: + PokeDWord(); + break; + } + } + + public uint UnsignedVal(int val) + { + switch (Type) + { + case TYPE.BYTE: + return (byte)val; + case TYPE.WORD: + return (ushort)val; + } + return (uint)val; + } + + public int SignedVal(int val) + { + switch (Type) + { + case TYPE.BYTE: + return (sbyte)val; + case TYPE.WORD: + return (short)val; + } + return val; + } + + public override string ToString() + { + if (Type == TYPE.SEPARATOR) + { + return "----"; + } + + StringBuilder str = new StringBuilder(Notes); + str.Append(": "); + str.Append(ValToString(Value)); + return str.ToString(); + } + + public void TrySetValue(string value) + { + switch (Signed) + { + case DISPTYPE.SIGNED: + try + { + Value = int.Parse(value); + } + catch { } + break; + case DISPTYPE.UNSIGNED: + try + { + Value = (int)uint.Parse(value); + } + catch { } + break; + case DISPTYPE.HEX: + try + { + Value = int.Parse(value, NumberStyles.HexNumber); + } + catch { } + break; + } + } + + #endregion + + #region Helpers + + private string ValToString(int val) + { + if (Type == TYPE.SEPARATOR) + { + return ""; + } + else + { + switch (Signed) + { + default: + case DISPTYPE.UNSIGNED: + return UnsignedVal(val).ToString(); + case DISPTYPE.SIGNED: + return SignedVal(val).ToString(); + case DISPTYPE.HEX: + switch (Type) + { + default: + case TYPE.BYTE: + return String.Format("{0:X2}", val); + case TYPE.WORD: + return String.Format("{0:X4}", val); + case TYPE.DWORD: + return String.Format("{0:X8}", val); + } + } + } + } + + + + private string DiffToString(int diff) + { + string converted = diff.ToString(); + if (diff >= 0) + converted = "+" + converted; + return converted; + } + + private void PokeByte() + { + Domain.PokeByte(Address, (byte)Value); + } + + private void PokeWord() + { + if (BigEndian) + { + Domain.PokeByte(Address + 0, (byte)(Value >> 8)); + Domain.PokeByte(Address + 1, (byte)(Value)); + } + else + { + Domain.PokeByte(Address + 0, (byte)(Value)); + Domain.PokeByte(Address + 1, (byte)(Value >> 8)); + } + } + + private void PokeDWord() + { + if (BigEndian) + { + Domain.PokeByte(Address + 0, (byte)(Value >> 24)); + Domain.PokeByte(Address + 1, (byte)(Value >> 16)); + Domain.PokeByte(Address + 2, (byte)(Value >> 8)); + Domain.PokeByte(Address + 3, (byte)(Value)); + } + else + { + Domain.PokeByte(Address + 0, (byte)(Value)); + Domain.PokeByte(Address + 1, (byte)(Value >> 8)); + Domain.PokeByte(Address + 2, (byte)(Value >> 16)); + Domain.PokeByte(Address + 3, (byte)(Value >> 24)); + } + } + + #endregion + + #region Compare Methods + + private int ComparePrevious(Watch_Legacy Other, PREVDEF previous) + { + switch (previous) + { + case PREVDEF.LASTSEARCH: + return CompareLastSearch(Other); + case PREVDEF.ORIGINAL: + return CompareOriginal(Other); + default: + case PREVDEF.LASTFRAME: + return ComparePrev(Other); + case PREVDEF.LASTCHANGE: + return CompareLastChange(Other); + } + } + + private int CompareDiff(Watch_Legacy Other, PREVDEF previous) + { + switch (previous) + { + case PREVDEF.LASTSEARCH: + return CompareDiffLastSearch(Other); + case PREVDEF.ORIGINAL: + return CompareDiffOriginal(Other); + default: + case PREVDEF.LASTFRAME: + return CompareDiffPrev(Other); + case PREVDEF.LASTCHANGE: + return CompareDiffLastChange(Other); + } + } + + private int CompareAddress(Watch_Legacy Other) + { + if (Address < Other.Address) + return -1; + else if (Address > Other.Address) + return 1; + else + return 0; + } + + private int CompareValue(Watch_Legacy Other) + { + if (Signed == DISPTYPE.SIGNED) + { + if (SignedVal(Value) < SignedVal(Other.Value)) + return -1; + else if (SignedVal(Value) > SignedVal(Other.Value)) + return 1; + else + return 0; + } + if (UnsignedVal(Value) < UnsignedVal(Other.Value)) + return -1; + else if (UnsignedVal(Value) > UnsignedVal(Other.Value)) + return 1; + else + return 0; + } + + private int ComparePrev(Watch_Legacy Other) + { + if (Signed == DISPTYPE.SIGNED) + { + if (SignedVal(Prev) < SignedVal(Other.Prev)) + return -1; + else if (SignedVal(Prev) > SignedVal(Other.Prev)) + return 1; + else + return 0; + } + if (UnsignedVal(Prev) < UnsignedVal(Other.Prev)) + return -1; + else if (UnsignedVal(Prev) > UnsignedVal(Other.Prev)) + return 1; + else + return 0; + } + + private int CompareOriginal(Watch_Legacy Other) + { + if (Signed == DISPTYPE.SIGNED) + { + if (SignedVal(Original) < SignedVal(Other.Original)) + return -1; + else if (SignedVal(Original) > SignedVal(Other.Original)) + return 1; + else + return 0; + } + if (UnsignedVal(Original) < UnsignedVal(Other.Original)) + return -1; + else if (UnsignedVal(Original) > UnsignedVal(Other.Original)) + return 1; + else + return 0; + } + + private int CompareLastChange(Watch_Legacy Other) + { + if (Signed == DISPTYPE.SIGNED) + { + if (SignedVal(LastChange) < SignedVal(Other.LastChange)) + return -1; + else if (SignedVal(LastChange) > SignedVal(Other.LastChange)) + return 1; + else + return 0; + } + if (UnsignedVal(LastChange) < UnsignedVal(Other.LastChange)) + return -1; + else if (UnsignedVal(LastChange) > UnsignedVal(Other.LastChange)) + return 1; + else + return 0; + } + + private int CompareLastSearch(Watch_Legacy Other) + { + if (Signed == DISPTYPE.SIGNED) + { + if (SignedVal(LastSearch) < SignedVal(Other.LastSearch)) + return -1; + else if (SignedVal(LastSearch) > SignedVal(Other.LastSearch)) + return 1; + else + return 0; + } + if (UnsignedVal(LastSearch) < UnsignedVal(Other.LastSearch)) + return -1; + else if (UnsignedVal(LastSearch) > UnsignedVal(Other.LastSearch)) + return 1; + else + return 0; + } + + private int CompareDiffPrev(Watch_Legacy Other) + { + if (DiffPrev < Other.DiffPrev) + return -1; + else if (DiffPrev > Other.DiffPrev) + return 1; + else + return 0; + } + + private int CompareDiffOriginal(Watch_Legacy Other) + { + if (DiffOriginal < Other.DiffOriginal) + return -1; + else if (DiffOriginal > Other.DiffOriginal) + return 1; + else + return 0; + } + + private int CompareDiffLastChange(Watch_Legacy Other) + { + if (DiffLastChange < Other.DiffLastChange) + return -1; + else if (DiffLastChange > Other.DiffLastChange) + return 1; + else + return 0; + } + + private int CompareDiffLastSearch(Watch_Legacy Other) + { + if (DiffLastSearch < Other.DiffLastSearch) + return -1; + else if (DiffLastSearch > Other.DiffLastSearch) + return 1; + else + return 0; + } + + private int CompareChanges(Watch_Legacy Other) + { + if (Changecount < Other.Changecount) + return -1; + else if (Changecount > Other.Changecount) + return 1; + else + return 0; + } + + private int CompareNotes(Watch_Legacy Other) + { + if (Notes == null & Other.Notes == null) + return 0; + else if (Notes == null) + return -1; + else if (Other.Notes == null) + return 1; + else + return Notes.CompareTo(Other.Notes); + } + + private int CompareDomain(Watch_Legacy Other) + { + if (Domain == null & Other.Domain == null) + { + return 0; + } + else if (Domain == null) + { + return -1; + } + else if (Other.Domain == null) + { + return 1; + } + else + { + return Domain.Name.CompareTo(Other.Domain.Name); + } + } + + public int CompareTo(Watch_Legacy Other, string parameter, PREVDEF previous) + { + int compare = 0; + if (parameter == "Address") + { + compare = CompareAddress(Other); + if (compare == 0) + { + compare = CompareValue(Other); + if (compare == 0) + { + compare = CompareChanges(Other); + if (compare == 0) + { + compare = ComparePrevious(Other, previous); + if (compare == 0) + { + compare = CompareDomain(Other); + if (compare == 0) + { + compare = CompareDiff(Other, previous); + if (compare == 0) + { + compare = CompareNotes(Other); + } + } + } + } + } + } + } + + else if (parameter == "Value") + { + compare = CompareValue(Other); + if (compare == 0) + { + compare = CompareAddress(Other); + if (compare == 0) + { + compare = CompareChanges(Other); + if (compare == 0) + { + compare = ComparePrevious(Other, previous); + if (compare == 0) + { + compare = CompareDiff(Other, previous); + if (compare == 0) + { + compare = CompareDomain(Other); + if (compare == 0) + { + compare = CompareNotes(Other); + } + } + } + } + } + } + } + + else if (parameter == "Changes") + { + compare = CompareChanges(Other); + if (compare == 0) + { + compare = CompareAddress(Other); + if (compare == 0) + { + compare = CompareValue(Other); + if (compare == 0) + { + compare = ComparePrevious(Other, previous); + if (compare == 0) + { + compare = CompareDiff(Other, previous); + if (compare == 0) + compare = CompareNotes(Other); + } + } + } + } + } + + else if (parameter == "Prev") + { + compare = ComparePrevious(Other, previous); + if (compare == 0) + { + compare = CompareAddress(Other); + if (compare == 0) + { + compare = CompareValue(Other); + if (compare == 0) + { + compare = CompareChanges(Other); + if (compare == 0) + { + compare = CompareDiff(Other, previous); + if (compare == 0) + { + compare = CompareDomain(Other); + if (compare == 0) + { + compare = CompareNotes(Other); + } + } + } + } + } + } + } + + else if (parameter == "Diff") + { + compare = CompareDiff(Other, previous); + if (compare == 0) + { + compare = CompareAddress(Other); + if (compare == 0) + { + compare = CompareValue(Other); + if (compare == 0) + { + compare = CompareChanges(Other); + if (compare == 0) + { + compare = ComparePrevious(Other, previous); + if (compare == 0) + { + compare = CompareDomain(Other); + if (compare == 0) + { + compare = CompareNotes(Other); + } + } + } + } + } + } + } + + else if (parameter == "Domain") + { + compare = CompareDomain(Other); + if (compare == 0) + { + compare = CompareAddress(Other); + if (compare == 0) + { + compare = CompareValue(Other); + if (compare == 0) + { + compare = CompareChanges(Other); + if (compare == 0) + { + compare = ComparePrevious(Other, previous); + if (compare == 0) + { + compare = CompareNotes(Other); + } + } + } + } + } + } + + else if (parameter == "Notes") + { + compare = CompareNotes(Other); + if (compare == 0) + { + compare = CompareAddress(Other); + if (compare == 0) + { + compare = CompareValue(Other); + if (compare == 0) + { + compare = CompareChanges(Other); + if (compare == 0) + { + compare = ComparePrevious(Other, previous); + if (compare == 0) + { + compare = CompareDiff(Other, previous); + if (compare == 0) + { + compare = CompareDomain(Other); + } + } + } + } + } + } + } + + return compare; + } + + #endregion + } +}