From 067363b80dd700edfd25b0eeb7df9e0b3b80af47 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 20 Oct 2013 00:00:59 +0000 Subject: [PATCH] Start a Client.Core project, and moved several files over to this, including Global.cs, made a GlobalWinF class for handling winform specific global instances --- BizHawk.MultiClient/AVOut/AviWriter.cs | 2 + BizHawk.MultiClient/AVOut/FFmpegWriterForm.cs | 2 + BizHawk.MultiClient/AVOut/GifWriter.cs | 2 + BizHawk.MultiClient/AVOut/GifWriterForm.cs | 2 + BizHawk.MultiClient/AVOut/JMDWriter.cs | 2 + .../AVOut/VideoWriterChooserForm.cs | 6 +- .../BizHawk.MultiClient.csproj | 10 +- BizHawk.MultiClient/Config.cs | 1467 ----------------- BizHawk.MultiClient/ConfigService.cs | 62 - .../DisplayManager/DisplayManager.cs | 68 +- BizHawk.MultiClient/FirmwareManager.cs | 2 + .../{Global.cs => GlobalWinF.cs} | 5 +- .../Input/ControllerBinding.cs | 10 +- BizHawk.MultiClient/Input/GamePad.cs | 2 +- BizHawk.MultiClient/Input/Input.cs | 4 +- BizHawk.MultiClient/Input/Keyboard.cs | 2 +- BizHawk.MultiClient/LogConsole.cs | 2 + BizHawk.MultiClient/LogWindow.cs | 4 +- BizHawk.MultiClient/MainForm.MenuItems.cs | 238 +-- BizHawk.MultiClient/MainForm.Movie.cs | 180 +- BizHawk.MultiClient/MainForm.Rewind.cs | 18 +- BizHawk.MultiClient/MainForm.cs | 602 +++---- BizHawk.MultiClient/Program.cs | 14 +- BizHawk.MultiClient/RenderPanel.cs | 12 +- BizHawk.MultiClient/SavestateManager.cs | 4 +- BizHawk.MultiClient/Sound.cs | 6 +- BizHawk.MultiClient/Throttle.cs | 8 +- BizHawk.MultiClient/config/AutofireConfig.cs | 12 +- .../config/ControllerConfig.cs | 20 +- .../ControllerConfig/AnalogBindControl.cs | 6 +- .../ControllerConfig/AnalogBindPanel.cs | 8 +- BizHawk.MultiClient/config/FirmwaresConfig.cs | 4 +- BizHawk.MultiClient/config/GifAnimator.cs | 2 + BizHawk.MultiClient/config/HotkeyConfig.cs | 16 +- BizHawk.MultiClient/config/MessageConfig.cs | 18 +- BizHawk.MultiClient/config/PathConfig.cs | 6 +- BizHawk.MultiClient/config/PathManager.cs | 10 +- BizHawk.MultiClient/config/RewindConfig.cs | 26 +- BizHawk.MultiClient/config/SoundConfig.cs | 12 +- BizHawk.MultiClient/movie/InputAdapters.cs | 6 +- BizHawk.MultiClient/movie/Movie.cs | 50 +- BizHawk.MultiClient/movie/MovieHeader.cs | 6 +- BizHawk.MultiClient/movie/MovieImport.cs | 2 + BizHawk.MultiClient/movie/MovieLog.cs | 16 +- BizHawk.MultiClient/movie/MovieMnemonics.cs | 4 +- BizHawk.MultiClient/movie/MovieSession.cs | 2 +- BizHawk.MultiClient/movie/PlayMovie.cs | 12 +- BizHawk.MultiClient/movie/RecordMovie.cs | 36 +- BizHawk.MultiClient/tools/Cheats/Cheat.cs | 2 + .../tools/Cheats/CheatEdit.Designer.cs | 8 +- BizHawk.MultiClient/tools/Cheats/CheatEdit.cs | 10 +- BizHawk.MultiClient/tools/Cheats/CheatForm.cs | 129 +- BizHawk.MultiClient/tools/Cheats/CheatList.cs | 20 +- .../tools/GB/CGBColorChooserForm.cs | 2 + .../tools/GB/ColorChooserForm.cs | 2 + .../tools/GB/DualGBFileSelector.cs | 2 + BizHawk.MultiClient/tools/GB/GBGPUView.cs | 10 +- BizHawk.MultiClient/tools/GB/GBGameGenie.cs | 12 +- BizHawk.MultiClient/tools/GBA/GBAGPUView.cs | 2 +- .../tools/Genesis/GenGameGenie.cs | 12 +- .../tools/HexEditor/HexColor.cs | 12 +- .../tools/HexEditor/HexEditor.cs | 94 +- .../tools/HexEditor/HexFind.cs | 6 +- .../tools/HexEditor/MemoryViewer.cs | 5 +- BizHawk.MultiClient/tools/InputPrompt.cs | 2 + BizHawk.MultiClient/tools/Lua/LuaConsole.cs | 26 +- .../tools/Lua/LuaDocumentation.cs | 2 +- .../tools/Lua/LuaFunctionList.cs | 20 +- .../tools/Lua/LuaImplementation.cs | 360 ++-- .../tools/Lua/LuaRegisteredFunctionsList.cs | 8 +- BizHawk.MultiClient/tools/Lua/LuaTextBox.cs | 2 + .../tools/Lua/LuaWinform.Designer.cs | 2 +- BizHawk.MultiClient/tools/Lua/LuaWinform.cs | 4 +- BizHawk.MultiClient/tools/Lua/LuaWriter.cs | 15 +- .../Lua/LuaWriterColorConfig.Designer.cs | 2 +- .../tools/Lua/LuaWriterColorConfig.cs | 254 +-- .../tools/N64/N64VideoPluginconfig.cs | 4 +- BizHawk.MultiClient/tools/NES/NESDebugger.cs | 8 +- BizHawk.MultiClient/tools/NES/NESGameGenie.cs | 10 +- .../tools/NES/NESGraphicsConfig.cs | 8 +- .../tools/NES/NESNameTableViewer.cs | 14 +- BizHawk.MultiClient/tools/NES/NESPPU.cs | 12 +- .../tools/NES/NESSoundConfig.cs | 14 +- .../tools/NES/NameTableViewer.cs | 6 +- .../tools/NES/PaletteViewer.cs | 6 +- .../tools/NES/PatternViewer.cs | 6 +- BizHawk.MultiClient/tools/NES/SpriteViewer.cs | 6 +- BizHawk.MultiClient/tools/PCE/PCEBGViewer.cs | 12 +- .../tools/PCE/PCEGraphicsConfig.cs | 2 + .../tools/SMS/SMSGraphicsConfig.cs | 2 + .../tools/SNES/SNESGameGenie.cs | 14 +- .../tools/SNES/SNESGraphicsDebugger.cs | 6 +- .../tools/Saturn/SaturnPrefs.Designer.cs | 2 +- .../tools/Saturn/SaturnPrefs.cs | 4 +- BizHawk.MultiClient/tools/StateVisualizer.cs | 4 +- .../tools/TAStudio.Designer.cs | 2 +- BizHawk.MultiClient/tools/TAStudio.cs | 128 +- BizHawk.MultiClient/tools/TI83/TI83KeyPad.cs | 104 +- BizHawk.MultiClient/tools/ToolBox.cs | 48 +- BizHawk.MultiClient/tools/ToolHelpers.cs | 40 +- BizHawk.MultiClient/tools/TraceLogger.cs | 24 +- .../tools/VirtualPads/VirtualPadA26.cs | 24 +- .../tools/VirtualPads/VirtualPadA26Control.cs | 12 +- .../tools/VirtualPads/VirtualPadA78.cs | 28 +- .../tools/VirtualPads/VirtualPadA78Control.cs | 20 +- .../tools/VirtualPads/VirtualPadButton.cs | 8 +- .../VirtualPads/VirtualPadC64Keyboard.cs | 292 ++-- .../tools/VirtualPads/VirtualPadColeco.cs | 76 +- .../tools/VirtualPads/VirtualPadForm.cs | 18 +- .../tools/VirtualPads/VirtualPadGB.cs | 36 +- .../tools/VirtualPads/VirtualPadGBA.cs | 44 +- .../tools/VirtualPads/VirtualPadGBControl.cs | 8 +- .../tools/VirtualPads/VirtualPadGen3Button.cs | 36 +- .../tools/VirtualPads/VirtualPadN64.cs | 8 +- .../tools/VirtualPads/VirtualPadN64Control.cs | 10 +- .../tools/VirtualPads/VirtualPadNES.cs | 36 +- .../tools/VirtualPads/VirtualPadNESControl.cs | 10 +- .../tools/VirtualPads/VirtualPadPCE.cs | 36 +- .../tools/VirtualPads/VirtualPadSMS.cs | 28 +- .../tools/VirtualPads/VirtualPadSMSControl.cs | 12 +- .../tools/VirtualPads/VirtualPadSNES.cs | 52 +- .../VirtualPads/VirtualPadSNESControl.cs | 12 +- .../tools/VirtualPads/VirtualPadSaturn.cs | 56 +- .../VirtualPads/VirtualPadSaturnControl.cs | 12 +- .../tools/Watch/RamPoke.Designer.cs | 4 +- BizHawk.MultiClient/tools/Watch/RamPoke.cs | 2 + .../tools/Watch/RamSearch.Designer.cs | 4 +- BizHawk.MultiClient/tools/Watch/RamSearch.cs | 36 +- .../tools/Watch/RamSearchEngine.cs | 6 +- BizHawk.MultiClient/tools/Watch/RamWatch.cs | 46 +- BizHawk.MultiClient/tools/Watch/Watch.cs | 930 ----------- .../tools/Watch/WatchEditor.cs | 12 +- BizHawk.MultiClient/tools/Watch/WatchList.cs | 24 +- .../tools/Watch/WatchValueBox.cs | 3 + BizHawk.Util/BizHawk.Util.csproj | 9 +- BizHawk.Util/HexTextBox.cs | 2 + BizHawk.sln | 14 + Client.Core/Client.Core.csproj | 71 + .../InputValidate.cs | 2 +- {BizHawk.Util => Client.Core}/KeyTurbo.cs | 2 +- Client.Core/Properties/AssemblyInfo.cs | 36 + .../RecentFiles.cs | 2 +- .../StringHelpers.cs | 2 +- 143 files changed, 2222 insertions(+), 4380 deletions(-) delete mode 100644 BizHawk.MultiClient/Config.cs delete mode 100644 BizHawk.MultiClient/ConfigService.cs rename BizHawk.MultiClient/{Global.cs => GlobalWinF.cs} (95%) delete mode 100644 BizHawk.MultiClient/tools/Watch/Watch.cs create mode 100644 Client.Core/Client.Core.csproj rename {BizHawk.Util => Client.Core}/InputValidate.cs (95%) rename {BizHawk.Util => Client.Core}/KeyTurbo.cs (87%) create mode 100644 Client.Core/Properties/AssemblyInfo.cs rename {BizHawk.MultiClient => Client.Core}/RecentFiles.cs (94%) rename {BizHawk.Util => Client.Core}/StringHelpers.cs (92%) diff --git a/BizHawk.MultiClient/AVOut/AviWriter.cs b/BizHawk.MultiClient/AVOut/AviWriter.cs index b74cc553bc..379f277755 100644 --- a/BizHawk.MultiClient/AVOut/AviWriter.cs +++ b/BizHawk.MultiClient/AVOut/AviWriter.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; +using BizHawk.Client.Core; + //some helpful p/invoke from http://www.codeproject.com/KB/audio-video/Motion_Detection.aspx?msg=1142967 namespace BizHawk.MultiClient diff --git a/BizHawk.MultiClient/AVOut/FFmpegWriterForm.cs b/BizHawk.MultiClient/AVOut/FFmpegWriterForm.cs index 92a56088bb..8d1fc70625 100644 --- a/BizHawk.MultiClient/AVOut/FFmpegWriterForm.cs +++ b/BizHawk.MultiClient/AVOut/FFmpegWriterForm.cs @@ -7,6 +7,8 @@ using System.Linq; using System.Text; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { /// diff --git a/BizHawk.MultiClient/AVOut/GifWriter.cs b/BizHawk.MultiClient/AVOut/GifWriter.cs index 981c77a813..e1dc2dc463 100644 --- a/BizHawk.MultiClient/AVOut/GifWriter.cs +++ b/BizHawk.MultiClient/AVOut/GifWriter.cs @@ -5,6 +5,8 @@ using System.Text; using System.IO; using System.Drawing; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient.AVOut { public class GifWriter : IVideoWriter diff --git a/BizHawk.MultiClient/AVOut/GifWriterForm.cs b/BizHawk.MultiClient/AVOut/GifWriterForm.cs index 39fb9725d6..74c7521d0c 100644 --- a/BizHawk.MultiClient/AVOut/GifWriterForm.cs +++ b/BizHawk.MultiClient/AVOut/GifWriterForm.cs @@ -7,6 +7,8 @@ using System.Linq; using System.Text; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient.AVOut { public partial class GifWriterForm : Form diff --git a/BizHawk.MultiClient/AVOut/JMDWriter.cs b/BizHawk.MultiClient/AVOut/JMDWriter.cs index 3ea8f754e8..46faffd022 100644 --- a/BizHawk.MultiClient/AVOut/JMDWriter.cs +++ b/BizHawk.MultiClient/AVOut/JMDWriter.cs @@ -7,6 +7,8 @@ using System.Text; using ICSharpCode.SharpZipLib.Zip.Compression.Streams; using ICSharpCode.SharpZipLib.Zip.Compression; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { /// diff --git a/BizHawk.MultiClient/AVOut/VideoWriterChooserForm.cs b/BizHawk.MultiClient/AVOut/VideoWriterChooserForm.cs index 80cbdc0a9f..a75663a354 100644 --- a/BizHawk.MultiClient/AVOut/VideoWriterChooserForm.cs +++ b/BizHawk.MultiClient/AVOut/VideoWriterChooserForm.cs @@ -7,6 +7,8 @@ using System.Linq; using System.Text; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { /// @@ -85,8 +87,8 @@ namespace BizHawk.MultiClient private void buttonAuto_Click(object sender, EventArgs e) { - numericTextBoxW.Text = Global.Emulator.CoreComm.NominalWidth.ToString(); - numericTextBoxH.Text = Global.Emulator.CoreComm.NominalHeight.ToString(); + numericTextBoxW.Text = GlobalWinF.Emulator.CoreComm.NominalWidth.ToString(); + numericTextBoxH.Text = GlobalWinF.Emulator.CoreComm.NominalHeight.ToString(); } private void buttonOK_Click(object sender, EventArgs e) diff --git a/BizHawk.MultiClient/BizHawk.MultiClient.csproj b/BizHawk.MultiClient/BizHawk.MultiClient.csproj index 5aeadbc718..d8fb797705 100644 --- a/BizHawk.MultiClient/BizHawk.MultiClient.csproj +++ b/BizHawk.MultiClient/BizHawk.MultiClient.csproj @@ -159,8 +159,6 @@ BizBox.cs - - Form @@ -244,7 +242,7 @@ - + @@ -708,7 +706,6 @@ RamWatch.cs - Form @@ -955,7 +952,6 @@ InputPrompt.cs - @@ -982,6 +978,10 @@ {EE135301-08B3-4EFC-A61C-1C53E1C65CB9} BizHawk.Util + + {24A0AA3C-B25F-4197-B23D-476D6462DBA0} + Client.Core + diff --git a/BizHawk.MultiClient/Config.cs b/BizHawk.MultiClient/Config.cs deleted file mode 100644 index a848a65c14..0000000000 --- a/BizHawk.MultiClient/Config.cs +++ /dev/null @@ -1,1467 +0,0 @@ -using System.IO; -using System.Linq; -using System.Drawing; -using System.Collections.Generic; -using System.Collections; - -namespace BizHawk.MultiClient -{ - public class Config - { - public Config() - { - ControllerConfig.ConfigCheckAllControlDefaults(this); - } - - public void ResolveDefaults() - { - PathEntries.ResolveWithDefaults(); - HotkeyBindings.ResolveWithDefaults(); - } - - //Path Settings ************************************/ - public bool UseRecentForROMs = false; - public string LastRomPath = "."; - public PathEntryCollection PathEntries = new PathEntryCollection(); - - //BIOS Paths - public Dictionary FirmwareUserSpecifications = new Dictionary(); //key: sysid+firmwareId; value: absolute path - - public string FFMpegPath = "%exe%/dll/ffmpeg.exe"; - - //N64 Config Settings - public string N64VidPlugin = "Rice"; - public int N64VideoSizeX = 320; - public int N64VideoSizeY = 240; - - public N64RicePluginSettings RicePlugin = new N64RicePluginSettings(); - public N64GlidePluginSettings GlidePlugin = new N64GlidePluginSettings(); - public N64Glide64mk2PluginSettings Glide64mk2Plugin = new N64Glide64mk2PluginSettings(); - - // General Client Settings - public int Input_Hotkey_OverrideOptions = 0; - public bool StackOSDMessages = true; - public int TargetZoomFactor = 2; - public int TargetDisplayFilter = 0; - public RecentFiles RecentRoms = new RecentFiles(8); - public bool PauseWhenMenuActivated = true; - public bool SaveWindowPosition = true; - public bool StartPaused = false; - public int MainWndx = -1; //Negative numbers will be ignored - public int MainWndy = -1; - public bool RunInBackground = true; - public bool AcceptBackgroundInput = false; - public bool SingleInstanceMode = false; - public bool AllowUD_LR = false; - public bool ShowContextMenu = true; - public bool EnableBackupMovies = true; - public bool HotkeyConfigAutoTab = true; - public bool InputConfigAutoTab = true; - public bool ShowLogWindow = false; - public bool BackupSavestates = true; - public bool BackupSaveram = true; - public bool AutoSavestates = false; - public bool SaveScreenshotWithStates = true; - public int AutofireOn = 1; - public int AutofireOff = 1; - public bool AutofireLagFrames = true; - public int SaveSlot = 0; //currently selected savestate slot - public bool AutoLoadLastSaveSlot = false; - public bool WIN32_CONSOLE = true; - public bool SkipLagFrame = false; - public string MovieExtension = "bkm"; - public bool SupressAskSave = false; - public bool AVI_CaptureOSD = false; - public bool Screenshot_CaptureOSD = false; - - public enum SaveStateTypeE { Default, Binary, Text }; - public SaveStateTypeE SaveStateType = SaveStateTypeE.Default; - - // Run-Control settings - public int FrameProgressDelayMs = 500; //how long until a frame advance hold turns into a frame progress? - public int FrameSkip = 4; - public int SpeedPercent = 100; - public int SpeedPercentAlternate = 400; - public bool ClockThrottle = true; - public bool AutoMinimizeSkipping = true; - public bool VSyncThrottle = false; - - //Rewind settings - public bool Rewind_UseDelta = true; - public bool RewindEnabledSmall = true; - public bool RewindEnabledMedium = true; - public bool RewindEnabledLarge = false; - public int RewindFrequencySmall = 1; - public int RewindFrequencyMedium = 2; - public int RewindFrequencyLarge = 60; - public int Rewind_MediumStateSize = 262144; //256kb - public int Rewind_LargeStateSize = 1048576; //1mb - public int Rewind_BufferSize = 128; //in mb - public bool Rewind_OnDisk = false; - public bool Rewind_IsThreaded = false; - - /// use vsync. if VSyncThrottle = false, this will try to use vsync without throttling to it - public bool VSync = false; - - // Display options - public int MessagesColor = -1; - public int AlertMessageColor = -65536; - public int LastInputColor = -23296; - public int MovieInput = -8355712; - public bool DisplayFPS = false; - public int DispFPSx = 0; - public int DispFPSy = 0; - public int DispFPSanchor = 0; //0 = UL, 1 = UR, 2 = DL, 3 = DR - public bool DisplayFrameCounter = false; - public int DispFrameCx = 0; - public int DispFrameCy = 14; - public int DispFrameanchor = 0; - public bool DisplayLagCounter = false; - public int DispLagx = 0; - public int DispLagy = 42; - public int DispLaganchor = 0; - public bool DisplayInput = false; - public int DispInpx = 0; - public int DispInpy = 28; - public int DispInpanchor = 0; - public bool DisplayRerecordCount = false; - public int DispRecx = 0; - public int DispRecy = 56; - public int DispRecanchor = 0; - public int DispMultix = 0; - public int DispMultiy = 14; - public int DispMultianchor = 1; - public bool DisplayGDI = false; - public bool SuppressGui = false; - public bool DisplayStatusBar = true; - public int DispRamWatchx = 0; - public int DispRamWatchy = 70; - public bool DisplayRamWatch = false; - public bool ShowMenuInFullscreen = false; - public int DispMessagex = 3; - public int DispMessagey = 0; - public int DispMessageanchor = 2; - public int DispAutoholdx = 0; - public int DispAutoholdy = 0; - public int DispAutoholdanchor = 1; - public bool DispBlurry = false; // make display look ugly - - // Sound options - public bool SoundEnabled = true; - public bool MuteFrameAdvance = true; - public int SoundVolume = 100; //Range 0-100 - public bool SoundThrottle = false; - public string SoundDevice = ""; - - // Log Window - public bool LogWindowSaveWindowPosition = true; - public int LogWindowWndx = -1; - public int LogWindowWndy = -1; - public int LogWindowWidth = -1; - public int LogWindowHeight = -1; - - // Lua Console - public RecentFiles RecentLua = new RecentFiles(8); - public RecentFiles RecentLuaSession = new RecentFiles(8); - public bool AutoLoadLuaConsole = false; - public bool LuaConsoleSaveWindowPosition = true; - public int LuaConsoleWndx = -1; //Negative numbers will be ignored even with save window position set - public int LuaConsoleWndy = -1; - public int LuaConsoleWidth = -1; - public int LuaConsoleHeight = -1; - public bool DisableLuaScriptsOnLoad = false; - - // RamWatch Settings - public RecentFiles RecentWatches = new RecentFiles(8); - public bool RamWatchSaveWindowPosition = true; - public bool RamWatchAlwaysOnTop = false; - public int RamWatchWndx = -1; //Negative numbers will be ignored even with save window position set - public int RamWatchWndy = -1; - public int RamWatchWidth = -1; - public int RamWatchHeight = -1; - public bool RamWatchShowChangeColumn = true; - public bool RamWatchShowPrevColumn = false; - public bool RamWatchShowDiffColumn = false; - public bool RamWatchShowDomainColumn = true; - - public Dictionary RamWatchColumnWidths = new Dictionary() - { - { "AddressColumn", -1 }, - { "ValueColumn", -1 }, - { "PrevColumn", -1 }, - { "ChangesColumn", -1 }, - { "DiffColumn", -1 }, - { "DomainColumn", -1 }, - { "NotesColumn",-1 }, - }; - - public Dictionary RamWatchColumnIndexes = new Dictionary() - { - { "AddressColumn", 0 }, - { "ValueColumn", 1 }, - { "PrevColumn", 2 }, - { "ChangesColumn", 3 }, - { "DiffColumn", 4 }, - { "DomainColumn", 5 }, - { "NotesColumn", 6 }, - }; - - public Watch.PreviousType RamWatchDefinePrevious = Watch.PreviousType.LastFrame; - - // RamSearch Settings - public int RamSearchPrev_Type = 1; - public bool RamSearchSaveWindowPosition = true; - public RecentFiles RecentSearches = new RecentFiles(8); - public int RamSearchWndx = -1; //Negative numbers will be ignored even with save window position set - public int RamSearchWndy = -1; - public int RamSearchWidth = -1; //Negative numbers will be ignored - public int RamSearchHeight = -1; - public int RamSearchPreviousAs = 0; - public bool RamSearchPreviewMode = true; - public bool RamSearchAlwaysExcludeRamWatch = false; - public int RamSearchAddressWidth = -1; - public int RamSearchValueWidth = -1; - public int RamSearchPrevWidth = -1; - public int RamSearchChangesWidth = -1; - public int RamSearchAddressIndex = 0; - public int RamSearchValueIndex = 1; - public int RamSearchPrevIndex = 2; - public int RamSearchChangesIndex = 3; - public bool RamSearchFastMode = false; - public bool RamSearchAlwaysOnTop = false; - - public Dictionary RamSearchColumnWidths = new Dictionary() - { - { "AddressColumn", -1 }, - { "ValueColumn", -1 }, - { "PrevColumn", -1 }, - { "ChangesColumn", -1 }, - { "DiffColumn", -1 }, - }; - - public Dictionary RamSearchColumnIndexes = new Dictionary() - { - { "AddressColumn", 0 }, - { "ValueColumn", 1 }, - { "PrevColumn", 2 }, - { "ChangesColumn", 3 }, - { "DiffColumn", 4 }, - }; - - public bool RamSearchShowPrevColumn = true; - public bool RamSearchShowChangeColumn = true; - public bool RamSearchShowDiffColumn = false; - - // HexEditor Settings - public bool AutoLoadHexEditor = false; - public bool HexEditorSaveWindowPosition = true; - public int HexEditorWndx = -1; //Negative numbers will be ignored even with save window position set - public int HexEditorWndy = -1; - public int HexEditorWidth = -1; - public int HexEditorHeight = -1; - public bool HexEditorBigEndian = false; - public int HexEditorDataSize = 1; - //Hex Editor Colors - public Color HexBackgrndColor = Color.FromName("Control"); - public Color HexForegrndColor = Color.FromName("ControlText"); - public Color HexMenubarColor = Color.FromName("Control"); - public Color HexFreezeColor = Color.LightBlue; - public Color HexHighlightColor = Color.Pink; - public Color HexHighlightFreezeColor = Color.Violet; - - //Trace Logger Settings - public bool TraceLoggerAutoLoad = false; - public bool TraceLoggerSaveWindowPosition = true; - public int TraceLoggerMaxLines = 100000; - public int TraceLoggerWndx = -1; - public int TraceLoggerWndy = -1; - public int TraceLoggerWidth = -1; - public int TraceLoggerHeight = -1; - - // Video dumping settings - public string VideoWriter = ""; - public int JMDCompression = 3; - public int JMDThreads = 3; - public string FFmpegFormat = ""; - public string FFmpegCustomCommand = "-c:a foo -c:v bar -f baz"; - public string AVICodecToken = ""; - public int GifWriterFrameskip = 3; - public int GifWriterDelay = -1; - - // NESPPU Settings - public bool AutoLoadNESPPU = false; - public bool NESPPUSaveWindowPosition = true; - public int NESPPUWndx = -1; - public int NESPPUWndy = -1; - public int NESPPURefreshRate = 4; - - // NESDebuger Settings - public bool AutoLoadNESDebugger = false; - public bool NESDebuggerSaveWindowPosition = true; - public int NESDebuggerWndx = -1; - public int NESDebuggerWndy = -1; - public int NESDebuggerWidth = -1; - public int NESDebuggerHeight = -1; - - // NESNameTableViewer Settings - public bool AutoLoadNESNameTable = false; - public bool NESNameTableSaveWindowPosition = true; - public int NESNameTableWndx = -1; - public int NESNameTableWndy = -1; - public int NESNameTableRefreshRate = 4; - - // NES Graphics settings - public bool NESAllowMoreThanEightSprites = false; - public bool NESClipLeftAndRight = false; - public bool NESAutoLoadPalette = true; - public bool NESDispBackground = true; - public bool NESDispSprites = true; - public int NESBackgroundColor = 0; - public string NESPaletteFile = ""; - public int NTSC_NESTopLine = 8; - public int NTSC_NESBottomLine = 231; - public int PAL_NESTopLine = 8; - public int PAL_NESBottomLine = 231; - - // gb gpu view settings - public bool AutoLoadGBGPUView = false; - public bool GBGPUViewSaveWindowPosition = true; - public int GBGPUViewWndx = -1; - public int GBGPUViewWndy = -1; - public Color GBGPUSpriteBack = Color.Lime; - - // SNES Graphics Debugger Dialog Settings - public bool AutoLoadSNESGraphicsDebugger = false; - public bool SNESGraphicsDebuggerSaveWindowPosition = true; - public int SNESGraphicsDebuggerWndx = -1; - public int SNESGraphicsDebuggerWndy = -1; - public int SNESGraphicsDebuggerRefreshRate = 4; - public bool SNESGraphicsUseUserBackdropColor = false; - public int SNESGraphicsUserBackdropColor = -1; - public string SNESPalette = "BizHawk"; - - // SNES Graphics settings - //bsnes allows the layers to be enabled for each priority level. - //this may not be important for the bg (there are two priority levels) - //but it may be useful for OBJ, so we might want to control them separately - public bool SNES_ShowBG1_0 = true; - public bool SNES_ShowBG2_0 = true; - public bool SNES_ShowBG3_0 = true; - public bool SNES_ShowBG4_0 = true; - public bool SNES_ShowBG1_1 = true; - public bool SNES_ShowBG2_1 = true; - public bool SNES_ShowBG3_1 = true; - public bool SNES_ShowBG4_1 = true; - public bool SNES_ShowOBJ1 = true; - public bool SNES_ShowOBJ2 = true; - public bool SNES_ShowOBJ3 = true; - public bool SNES_ShowOBJ4 = true; - - // SATURN GRAPHICS SETTINGS - public bool SaturnUseGL = false; - public int SaturnDispFactor = 1; - public bool SaturnDispFree = false; - public int SaturnGLW = 640; - public int SaturnGLH = 480; - - // PCE Graphics settings - public bool PCEDispBG1 = true; - public bool PCEDispOBJ1 = true; - public bool PCEDispBG2 = true; - public bool PCEDispOBJ2 = true; - - // PCE BG Viewer settings - public bool PCEBGViewerSaveWIndowPosition = true; - public bool PCEBGViewerAutoload = false; - public int PCEBGViewerWndx = -1; - public int PCEBGViewerWndy = -1; - public int PCEBGViewerRefreshRate = 16; - - // SMS Graphics settings - public bool SMSDispBG = true; - public bool SMSDispOBJ = true; - - // Coleco Settings - public bool ColecoSkipBiosIntro = false; - - //GB Debugger settings - public bool AutoloadGBDebugger = false; - public bool GBDebuggerSaveWindowPosition = true; - public bool GameBoySkipBIOS = true; - - // Cheats Dialog - public bool Cheats_ValuesAsHex = true; - public bool CheatsSaveWindowPosition = true; - public bool DisableCheatsOnLoad = false; - public bool LoadCheatFileByGame = true; - public bool CheatsAutoSaveOnClose = true; - public RecentFiles RecentCheats = new RecentFiles(8); - public int CheatsWndx = -1; - public int CheatsWndy = -1; - public int CheatsWidth = -1; - public int CheatsHeight = -1; - public int CheatsNameWidth = -1; - public int CheatsAddressWidth = -1; - public int CheatsValueWidth = -1; - public int CheatsCompareWidth = -1; - public int CheatsDomainWidth = -1; - public int CheatsOnWidth = -1; - public int CheatsNameIndex = 0; - public int CheatsAddressIndex = 1; - public int CheatsValueIndex = 2; - public int CheatsCompareIndex = 3; - public int CheatsOnIndex = 4; - public int CheatsDomainIndex = 5; - public bool CheatsAlwaysOnTop = false; - - public Dictionary CheatsColumnWidths = new Dictionary() - { - { "NamesColumn", -1 }, - { "AddressColumn", -1 }, - { "ValueColumn", -1 }, - { "CompareColumn", -1 }, - { "OnColumn", -1 }, - { "DomainColumn", -1 }, - { "SizeColumn", -1 }, - { "EndianColumn", -1 }, - { "DisplayTypeColumn", -1 }, - }; - - public Dictionary CheatsColumnIndices = new Dictionary() - { - { "NamesColumn", 0 }, - { "AddressColumn", 1 }, - { "ValueColumn", 2 }, - { "CompareColumn", 3 }, - { "OnColumn", 4 }, - { "DomainColumn", 5 }, - { "SizeColumn", 6 }, - { "EndianColumn", 7 }, - { "DisplayTypeColumn", 8 }, - }; - - public Dictionary CheatsColumnShow = new Dictionary() - { - { "NamesColumn", true }, - { "AddressColumn", true }, - { "ValueColumn", true }, - { "CompareColumn", true }, - { "OnColumn", false }, - { "DomainColumn", true }, - { "SizeColumn", true }, - { "EndianColumn", false }, - { "DisplayTypeColumn", false }, - }; - - // TAStudio Dialog - public bool TAStudioSaveWindowPosition = true; - public bool AutoloadTAStudio = false; - public int TASWndx = -1; - public int TASWndy = -1; - public int TASWidth = -1; - public int TASHeight = -1; - public bool TASUpdatePads = true; - - // VirtualPad Dialog - public bool VirtualPadSaveWindowPosition = true; - public bool AutoloadVirtualPad = false; - public bool VirtualPadSticky = true; - public int VPadWndx = -1; - public int VPadWndy = -1; - public int VPadWidth = -1; - public int VPadHeight = -1; - - // NES Game Genie Encoder/Decoder - public bool NESGGAutoload = false; - public bool NESGGSaveWindowPosition = true; - public int NESGGWndx = -1; - public int NESGGWndy = -1; - - // SNES Game Genie Encoder/Decoder - public bool SNESGGAutoload = false; - public bool SNESGGSaveWindowPosition = true; - public int SNESGGWndx = -1; - public int SNESGGWndy = -1; - - // GB/GG Game Genie Encoder/Decoder - public bool GBGGAutoload = false; - public bool GBGGSaveWindowPosition = true; - public int GBGGWndx = -1; - public int GBGGWndy = -1; - - // GEN Game Genie Encoder/Decoder - public bool GENGGAutoload = false; - public bool GENGGSaveWindowPosition = true; - public int GENGGWndx = -1; - public int GENGGWndy = -1; - - //Movie Settings - public RecentFiles RecentMovies = new RecentFiles(8); - public bool BindSavestatesToMovies = true; - public string DefaultAuthor = "default user"; - public bool UseDefaultAuthor = true; - public bool DisplaySubtitles = true; - public bool VBAStyleMovieLoadState = false; - public bool MoviePlaybackPokeMode = false; - - //Play Movie Dialog - public bool PlayMovie_IncludeSubdir = true; - public bool PlayMovie_ShowStateFiles = false; - public bool PlayMovie_MatchGameName = false; - - //TI83 - public bool TI83autoloadKeyPad = true; - public bool TI83KeypadSaveWindowPosition = true; - public int TI83KeyPadWndx = -1; - public int TI83KeyPadWndy = -1; - public bool TI83ToolTips = true; - - public BindingCollection HotkeyBindings = new BindingCollection(); - - //Analog Hotkey values - public int Analog_LargeChange = 10; - public int Analog_SmallChange = 1; - - // NES Sound settings - public int NESSquare1 = 376; - public int NESSquare2 = 376; - public int NESTriangle = 426; - public int NESNoise = 247; - public int NESDMC = 167; - - public const int NESSquare1Max = 376; - public const int NESSquare2Max = 376; - public const int NESTriangleMax = 426; - public const int NESNoiseMax = 247; - public const int NESDMCMax = 167; - - public struct AnalogBind - { - /// the physical stick that we're bound to - public string Value; - /// sensitivity and flip - public float Mult; - /// portion of axis to ignore - public float Deadzone; - public AnalogBind(string Value, float Mult, float Deadzone) - { - this.Value = Value; - this.Mult = Mult; - this.Deadzone = Deadzone; - } - } - - // [ControllerType][ButtonName] => Physical Bind - public Dictionary> AllTrollers = new Dictionary>(); - public Dictionary> AllTrollersAutoFire = new Dictionary>(); - public Dictionary> AllTrollersAnalog = new Dictionary>(); - - // SMS / GameGear Settings - public bool SmsEnableFM = true; - public bool SmsAllowOverlock = false; - public bool SmsForceStereoSeparation = false; - public bool SmsSpriteLimit = false; - public bool GGShowClippedRegions = false; - public bool GGHighlightActiveDisplayRegion = false; - - // PCEngine Settings - public bool PceSpriteLimit = false; - public bool PceEqualizeVolume = false; - public bool PceArcadeCardRewindHack = true; - - // Genesis Settings - - //Atari 2600 Settings - public bool Atari2600_BW = false; - public bool Atari2600_LeftDifficulty = true; - public bool Atari2600_RightDifficulty = true; - - //Atari 7800 Settings - - //ColecoVision - - //Intellivision - - //NES settings - - //SNES settings - public string SNESProfile = "Compatibility"; - public bool SNESUseRingBuffer = true; - public bool SNESAlwaysDoubleSize = false; - - //N64 settings - - //TI 83 settings - - //GB settings - public bool GB_ForceDMG = false; - public bool GB_GBACGB = false; - public bool GB_MulticartCompat = false; - public string GB_PaletteFile = ""; - public bool GB_AsSGB = false; - public Emulation.Consoles.GB.GBColors.ColorType CGBColors = Emulation.Consoles.GB.GBColors.ColorType.gambatte; - - //Dual Gb - - //GBA settings - - //Saturn - - //Commodore 64 Settings - - //GIF Animator Settings - public int GifAnimatorNumFrames; - public int GifAnimatorFrameSkip; - public int GifAnimatorSpeed; - public bool GifAnimatorReversable; - - //LuaWriter Settings - public int LuaDefaultTextColor = -16777216; - public bool LuaDefaultTextBold = false; - public int LuaWriterBackColor = -1; - - public int LuaKeyWordColor = -16776961; - public bool LuaKeyWordBold = false; - public int LuaCommentColor = -16744448; - public bool LuaCommentBold = false; - public int LuaStringColor = -8355712; - public bool LuaStringBold = false; - public int LuaSymbolColor = -16777216; - public bool LuaSymbolBold = false; - public int LuaLibraryColor = -16711681; - public bool LuaLibraryBold = false; - public int LuaDecimalColor = -23296; - public bool LuaDecimalBold = false; - public float LuaWriterFontSize = 11; - public string LuaWriterFont = "Courier New"; - public float LuaWriterZoom = 1; - public bool LuaWriterStartEmpty = false; - - //Atari 2600 Settings - public bool Atari2600_ShowBG = true; - public bool Atari2600_ShowPlayer1 = true; - public bool Atari2600_ShowPlayer2 = true; - public bool Atari2600_ShowMissle1 = true; - public bool Atari2600_ShowMissle2 = true; - public bool Atari2600_ShowBall = true; - public bool Atari2600_ShowPlayfield = true; - } - - #region Sub-classes TODO - it is about time to port these to separate files - - public class BindingCollection : IEnumerable - { - public List Bindings { get; private set; } - - public BindingCollection() - { - Bindings = new List(); - Bindings.AddRange(DefaultValues); - } - - public void Add(Binding b) - { - Bindings.Add(b); - } - - public IEnumerator GetEnumerator() - { - return Bindings.GetEnumerator(); - } - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - public Binding this[string index] - { - get - { - return Bindings.FirstOrDefault(x => x.DisplayName == index) ?? new Binding(); - } - } - - public void ResolveWithDefaults() - { - //Add missing entries - foreach (Binding default_binding in DefaultValues) - { - var binding = Bindings.FirstOrDefault(x => x.DisplayName == default_binding.DisplayName); - if (binding == null) - { - Bindings.Add(default_binding); - } - } - - List entriesToRemove = new List(); - - //Remove entries that no longer exist in defaults - foreach (Binding entry in Bindings) - { - var binding = DefaultValues.FirstOrDefault(x => x.DisplayName == entry.DisplayName); - if (binding == null) - { - entriesToRemove.Add(entry); - } - } - - foreach (Binding entry in entriesToRemove) - { - Bindings.Remove(entry); - } - } - - public static List DefaultValues - { - get - { - return new List() - { - //General - new Binding() { DisplayName = "Frame Advance", Bindings = "F", TabGroup = "General", DefaultBinding = "F", Ordinal = 0 }, - new Binding() { DisplayName = "Rewind", Bindings = "Shift+R, J1 B7, X1 Left Trigger", TabGroup = "General", DefaultBinding = "Shift+R, J1 B7, X1 Left Trigger", Ordinal = 1 }, - new Binding() { DisplayName = "Pause", Bindings = "Pause", TabGroup = "General", DefaultBinding = "Pause", Ordinal = 2 }, - new Binding() { DisplayName = "Fast Forward", Bindings = "Tab, J1 B8, X1 Right Trigger", TabGroup = "General", DefaultBinding = "Tab, J1 B8, X1 Right Trigger", Ordinal = 3 }, - new Binding() { DisplayName = "Turbo", Bindings = "Shift+Tab", TabGroup = "General", DefaultBinding = "Shift+Tab", Ordinal = 4 }, - new Binding() { DisplayName = "Toggle Throttle", Bindings = "", TabGroup = "General", DefaultBinding = "", Ordinal = 5 }, - new Binding() { DisplayName = "Soft Reset", Bindings = "", TabGroup = "General", DefaultBinding = "", Ordinal = 6 }, - new Binding() { DisplayName = "Hard Reset", Bindings = "", TabGroup = "General", DefaultBinding = "", Ordinal = 7 }, - new Binding() { DisplayName = "Quick Load", Bindings = "P", TabGroup = "General", DefaultBinding = "P", Ordinal = 8 }, - new Binding() { DisplayName = "Quick Save", Bindings = "I", TabGroup = "General", DefaultBinding = "I", Ordinal = 9 }, - new Binding() { DisplayName = "Autohold", Bindings = "", TabGroup = "General", DefaultBinding = "", Ordinal = 10 }, - new Binding() { DisplayName = "Clear Autohold", Bindings = "", TabGroup = "General", DefaultBinding = "", Ordinal = 11 }, - new Binding() { DisplayName = "Screenshot", Bindings = "F12", TabGroup = "General", DefaultBinding = "F12", Ordinal = 12 }, - new Binding() { DisplayName = "Full Screen", Bindings = "Alt+Return", TabGroup = "General", DefaultBinding = "Alt+Return", Ordinal = 13 }, - new Binding() { DisplayName = "Open ROM", Bindings = "Ctrl+O", TabGroup = "General", DefaultBinding = "Ctrl+O", Ordinal = 14 }, - new Binding() { DisplayName = "Close ROM", Bindings = "Ctrl+W", TabGroup = "General", DefaultBinding = "Ctrl+W", Ordinal = 15 }, - new Binding() { DisplayName = "Display FPS", Bindings = "", TabGroup = "General", DefaultBinding = "", Ordinal = 16 }, - new Binding() { DisplayName = "Frame Counter", Bindings = "", TabGroup = "General", DefaultBinding = "", Ordinal = 17 }, - new Binding() { DisplayName = "Lag Counter", Bindings = "", TabGroup = "General", DefaultBinding = "", Ordinal = 18 }, - new Binding() { DisplayName = "Input Display", Bindings = "", TabGroup = "General", DefaultBinding = "", Ordinal = 19 }, - new Binding() { DisplayName = "Toggle BG Input", Bindings = "", TabGroup = "General", DefaultBinding = "", Ordinal = 20 }, - new Binding() { DisplayName = "Toggle Menu", Bindings = "", TabGroup = "General", DefaultBinding = "", Ordinal = 21 }, - new Binding() { DisplayName = "Volume Up", Bindings = "", TabGroup = "General", DefaultBinding = "", Ordinal = 22 }, - new Binding() { DisplayName = "Volume Down", Bindings = "", TabGroup = "General", DefaultBinding = "", Ordinal = 23 }, - new Binding() { DisplayName = "Record A/V", Bindings = "", TabGroup = "General", DefaultBinding = "", Ordinal = 24 }, - new Binding() { DisplayName = "Stop A/V", Bindings = "", TabGroup = "General", DefaultBinding = "", Ordinal = 25 }, - new Binding() { DisplayName = "Larger Window", Bindings = "Alt+UpArrow", TabGroup = "General", DefaultBinding = "Alt+UpArrow", Ordinal = 26 }, - new Binding() { DisplayName = "Smaller Window", Bindings = "Alt+DownArrow", TabGroup = "General", DefaultBinding = "Alt+DownArrow", Ordinal = 27 }, - new Binding() { DisplayName = "Increase Speed", Bindings = "Equals", TabGroup = "General", DefaultBinding = "Equals", Ordinal = 28 }, - new Binding() { DisplayName = "Decrease Speed", Bindings = "Minus", TabGroup = "General", DefaultBinding = "Minus", Ordinal = 29 }, - new Binding() { DisplayName = "Reboot Core", Bindings = "Ctrl+R", TabGroup = "General", DefaultBinding = "Ctrl+R", Ordinal = 30 }, - new Binding() { DisplayName = "Autofire", Bindings = "", TabGroup = "General", DefaultBinding = "", Ordinal = 31 }, - - //Save States - new Binding() { DisplayName = "Save State 0", Bindings = "Shift+F10", TabGroup = "Save States", DefaultBinding = "Shift+F10", Ordinal = 1 }, - new Binding() { DisplayName = "Save State 1", Bindings = "Shift+F1", TabGroup = "Save States", DefaultBinding = "Shift+F1", Ordinal = 2 }, - new Binding() { DisplayName = "Save State 2", Bindings = "Shift+F2", TabGroup = "Save States", DefaultBinding = "Shift+F2", Ordinal = 3 }, - new Binding() { DisplayName = "Save State 3", Bindings = "Shift+F3", TabGroup = "Save States", DefaultBinding = "Shift+F3", Ordinal = 4 }, - new Binding() { DisplayName = "Save State 4", Bindings = "Shift+F4", TabGroup = "Save States", DefaultBinding = "Shift+F4", Ordinal = 5 }, - new Binding() { DisplayName = "Save State 5", Bindings = "Shift+F5", TabGroup = "Save States", DefaultBinding = "Shift+F5", Ordinal = 6 }, - new Binding() { DisplayName = "Save State 6", Bindings = "Shift+F6", TabGroup = "Save States", DefaultBinding = "Shift+F6", Ordinal = 7 }, - new Binding() { DisplayName = "Save State 7", Bindings = "Shift+F7", TabGroup = "Save States", DefaultBinding = "Shift+F7", Ordinal = 8 }, - new Binding() { DisplayName = "Save State 8", Bindings = "Shift+F8", TabGroup = "Save States", DefaultBinding = "Shift+F8", Ordinal = 9 }, - new Binding() { DisplayName = "Save State 9", Bindings = "Shift+F9", TabGroup = "Save States", DefaultBinding = "Shift+F9", Ordinal = 10 }, - new Binding() { DisplayName = "Load State 0", Bindings = "F10", TabGroup = "Save States", DefaultBinding = "F10", Ordinal = 11 }, - new Binding() { DisplayName = "Load State 1", Bindings = "F1", TabGroup = "Save States", DefaultBinding = "F1", Ordinal = 12 }, - new Binding() { DisplayName = "Load State 2", Bindings = "F2", TabGroup = "Save States", DefaultBinding = "F2", Ordinal = 13 }, - new Binding() { DisplayName = "Load State 3", Bindings = "F3", TabGroup = "Save States", DefaultBinding = "F3", Ordinal = 14 }, - new Binding() { DisplayName = "Load State 4", Bindings = "F4", TabGroup = "Save States", DefaultBinding = "F4", Ordinal = 15 }, - new Binding() { DisplayName = "Load State 5", Bindings = "F5", TabGroup = "Save States", DefaultBinding = "F5", Ordinal = 16 }, - new Binding() { DisplayName = "Load State 6", Bindings = "F6", TabGroup = "Save States", DefaultBinding = "F6", Ordinal = 17 }, - new Binding() { DisplayName = "Load State 7", Bindings = "F7", TabGroup = "Save States", DefaultBinding = "F7", Ordinal = 18 }, - new Binding() { DisplayName = "Load State 8", Bindings = "F8", TabGroup = "Save States", DefaultBinding = "F8", Ordinal = 19 }, - new Binding() { DisplayName = "Load State 9", Bindings = "F9", TabGroup = "Save States", DefaultBinding = "F9", Ordinal = 20 }, - new Binding() { DisplayName = "Select State 0", Bindings = "D0", TabGroup = "Save States", DefaultBinding = "D0", Ordinal = 21 }, - new Binding() { DisplayName = "Select State 1", Bindings = "D1", TabGroup = "Save States", DefaultBinding = "D1", Ordinal = 22 }, - new Binding() { DisplayName = "Select State 2", Bindings = "D2", TabGroup = "Save States", DefaultBinding = "D2", Ordinal = 23 }, - new Binding() { DisplayName = "Select State 3", Bindings = "D3", TabGroup = "Save States", DefaultBinding = "D3", Ordinal = 24 }, - new Binding() { DisplayName = "Select State 4", Bindings = "D4", TabGroup = "Save States", DefaultBinding = "D4", Ordinal = 25 }, - new Binding() { DisplayName = "Select State 5", Bindings = "D5", TabGroup = "Save States", DefaultBinding = "D5", Ordinal = 26 }, - new Binding() { DisplayName = "Select State 6", Bindings = "D6", TabGroup = "Save States", DefaultBinding = "D6", Ordinal = 27 }, - new Binding() { DisplayName = "Select State 7", Bindings = "D7", TabGroup = "Save States", DefaultBinding = "D7", Ordinal = 28 }, - new Binding() { DisplayName = "Select State 8", Bindings = "D8", TabGroup = "Save States", DefaultBinding = "D8", Ordinal = 29 }, - new Binding() { DisplayName = "Select State 9", Bindings = "D9", TabGroup = "Save States", DefaultBinding = "D9", Ordinal = 30 }, - new Binding() { DisplayName = "Save Named State", Bindings = "", TabGroup = "Save States", DefaultBinding = "", Ordinal = 31 }, - new Binding() { DisplayName = "Load Named State", Bindings = "", TabGroup = "Save States", DefaultBinding = "", Ordinal = 32 }, - new Binding() { DisplayName = "Previous Slot", Bindings = "", TabGroup = "Save States", DefaultBinding = "", Ordinal = 33 }, - new Binding() { DisplayName = "Next Slot", Bindings = "", TabGroup = "Save States", DefaultBinding = "", Ordinal = 34 }, - - //Movie - new Binding() { DisplayName = "Toggle read-only", Bindings = "Q", TabGroup = "Movie", DefaultBinding = "Q", Ordinal = 0 }, - new Binding() { DisplayName = "Play Movie", Bindings = "", TabGroup = "Movie", DefaultBinding = "", Ordinal = 1 }, - new Binding() { DisplayName = "Record Movie", Bindings = "", TabGroup = "Movie", DefaultBinding = "", Ordinal = 2 }, - new Binding() { DisplayName = "Stop Movie", Bindings = "", TabGroup = "Movie", DefaultBinding = "", Ordinal = 3 }, - new Binding() { DisplayName = "Play from beginning", Bindings = "", TabGroup = "Movie", DefaultBinding = "", Ordinal = 4 }, - new Binding() { DisplayName = "Save Movie", Bindings = "", TabGroup = "Movie", DefaultBinding = "", Ordinal = 5 }, - new Binding() { DisplayName = "Toggle MultiTrack", Bindings = "", TabGroup = "Movie", DefaultBinding = "", Ordinal = 6 }, - new Binding() { DisplayName = "MT Select All", Bindings = "", TabGroup = "Movie", DefaultBinding = "", Ordinal = 7 }, - new Binding() { DisplayName = "MT Select None", Bindings = "", TabGroup = "Movie", DefaultBinding = "", Ordinal = 8 }, - new Binding() { DisplayName = "MT Increment Player", Bindings = "", TabGroup = "Movie", DefaultBinding = "", Ordinal = 9 }, - new Binding() { DisplayName = "MT Decrement Player", Bindings = "", TabGroup = "Movie", DefaultBinding = "", Ordinal = 10 }, - new Binding() { DisplayName = "Movie Poke", Bindings = "", TabGroup = "Movie", DefaultBinding = "", Ordinal = 11 }, - new Binding() { DisplayName = "Scrub Input", Bindings = "", TabGroup = "Movie", DefaultBinding = "", Ordinal = 12 }, - - //Tools - new Binding() { DisplayName = "Ram Watch", Bindings = "", TabGroup = "Tools", DefaultBinding = "", Ordinal = 0 }, - new Binding() { DisplayName = "Ram Search", Bindings = "", TabGroup = "Tools", DefaultBinding = "", Ordinal = 1 }, - new Binding() { DisplayName = "Hex Editor", Bindings = "", TabGroup = "Tools", DefaultBinding = "", Ordinal = 3 }, - new Binding() { DisplayName = "Trace Logger", Bindings = "", TabGroup = "Tools", DefaultBinding = "", Ordinal = 4 }, - new Binding() { DisplayName = "Lua Console", Bindings = "", TabGroup = "Tools", DefaultBinding = "", Ordinal = 5 }, - new Binding() { DisplayName = "Cheats", Bindings = "", TabGroup = "Tools", DefaultBinding = "", Ordinal = 6 }, - new Binding() { DisplayName = "TAStudio", Bindings = "", TabGroup = "Tools", DefaultBinding = "", Ordinal = 7 }, - new Binding() { DisplayName = "ToolBox", Bindings = "T", TabGroup = "Tools", DefaultBinding = "", Ordinal = 8 }, - new Binding() { DisplayName = "Virtual Pad", Bindings = "", TabGroup = "Tools", DefaultBinding = "", Ordinal = 9 }, - - new Binding() { DisplayName = "New Search", Bindings = "", TabGroup = "Ram Search", DefaultBinding = "", Ordinal = 10 }, - new Binding() { DisplayName = "Do Search", Bindings = "", TabGroup = "Ram Search", DefaultBinding = "", Ordinal = 11 }, - new Binding() { DisplayName = "Previous Compare To", Bindings = "", TabGroup = "Ram Search", DefaultBinding = "", Ordinal = 12 }, - new Binding() { DisplayName = "Next Compare To", Bindings = "", TabGroup = "Ram Search", DefaultBinding = "", Ordinal = 13 }, - new Binding() { DisplayName = "Previous Operator", Bindings = "", TabGroup = "Ram Search", DefaultBinding = "", Ordinal = 14 }, - new Binding() { DisplayName = "Next Operator", Bindings = "", TabGroup = "Ram Search", DefaultBinding = "", Ordinal = 15 }, - - //SNES - new Binding() { DisplayName = "Toggle BG 1", Bindings = "", TabGroup = "SNES", DefaultBinding = "", Ordinal = 0 }, - new Binding() { DisplayName = "Toggle BG 2", Bindings = "", TabGroup = "SNES", DefaultBinding = "", Ordinal = 1 }, - new Binding() { DisplayName = "Toggle BG 3", Bindings = "", TabGroup = "SNES", DefaultBinding = "", Ordinal = 2 }, - new Binding() { DisplayName = "Toggle BG 4", Bindings = "", TabGroup = "SNES", DefaultBinding = "", Ordinal = 3 }, - new Binding() { DisplayName = "Toggle OBJ 1", Bindings = "", TabGroup = "SNES", DefaultBinding = "", Ordinal = 4 }, - new Binding() { DisplayName = "Toggle OBJ 2", Bindings = "", TabGroup = "SNES", DefaultBinding = "", Ordinal = 5 }, - new Binding() { DisplayName = "Toggle OBJ 3", Bindings = "", TabGroup = "SNES", DefaultBinding = "", Ordinal = 6 }, - new Binding() { DisplayName = "Toggle OBJ 4", Bindings = "", TabGroup = "SNES", DefaultBinding = "", Ordinal = 7 }, - - //Analog - new Binding() { DisplayName = "Y Up Small", Bindings = "", TabGroup = "Analog", DefaultBinding = "", Ordinal = 0 }, - new Binding() { DisplayName = "Y Up Large", Bindings = "", TabGroup = "Analog", DefaultBinding = "", Ordinal = 1 }, - new Binding() { DisplayName = "Y Down Small", Bindings = "", TabGroup = "Analog", DefaultBinding = "", Ordinal = 2 }, - new Binding() { DisplayName = "Y Down Large", Bindings = "", TabGroup = "Analog", DefaultBinding = "", Ordinal = 3 }, - new Binding() { DisplayName = "X Up Small", Bindings = "", TabGroup = "Analog", DefaultBinding = "", Ordinal = 4 }, - new Binding() { DisplayName = "X Up Large", Bindings = "", TabGroup = "Analog", DefaultBinding = "", Ordinal = 5 }, - new Binding() { DisplayName = "X Down Small", Bindings = "", TabGroup = "Analog", DefaultBinding = "", Ordinal = 6 }, - new Binding() { DisplayName = "X Down Large", Bindings = "", TabGroup = "Analog", DefaultBinding = "", Ordinal = 7 }, - - }; - } - } - } - - public class Binding - { - //TODO: how about a delegate, that would be called by the mainform? Thereby putting all the action logic in one place - public string DisplayName; - public string Bindings; - public string DefaultBinding; - public string TabGroup; - public int Ordinal = 0; - public Binding() { } - } - - public class PathEntryCollection : IEnumerable - { - public List Paths { get; private set; } - - public PathEntryCollection() - { - Paths = new List(); - Paths.AddRange(DefaultValues); - } - - public void Add(PathEntry p) - { - Paths.Add(p); - } - - public IEnumerator GetEnumerator() - { - return Paths.GetEnumerator(); - } - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - public PathEntry this[string system, string type] - { - get - { - return Paths.FirstOrDefault(x => x.HasSystem(system) && x.Type == type); - } - } - - public void ResolveWithDefaults() - { - //Add missing entries - foreach (PathEntry defaultpath in DefaultValues) - { - var path = Paths.FirstOrDefault(x => x.System == defaultpath.System && x.Type == defaultpath.Type); - if (path == null) - { - Paths.Add(defaultpath); - } - } - - List entriesToRemove = new List(); - - //Remove entries that no longer exist in defaults - foreach (PathEntry pathEntry in Paths) - { - var path = DefaultValues.FirstOrDefault(x => x.System == pathEntry.System && x.Type == pathEntry.Type); - if (path == null) - { - entriesToRemove.Add(pathEntry); - } - } - - foreach (PathEntry entry in entriesToRemove) - { - Paths.Remove(entry); - } - - //Add missing displaynames - var missingDisplayPaths = Paths.Where(x => x.SystemDisplayName == null).ToList(); - foreach (PathEntry path in missingDisplayPaths) - { - path.SystemDisplayName = DefaultValues.FirstOrDefault(x => x.System == path.System).SystemDisplayName; - - } - } - - //Some frequently requested paths, made into a property for convenience - public string WatchPath { get { return Global.Config.PathEntries["Global", "Watch (.wch)"].Path; } } - public string MoviesPath { get { return Global.Config.PathEntries["Global", "Movies"].Path; } } - public string LuaPath { get { return Global.Config.PathEntries["Global", "Lua"].Path; } } - public string LogPath { get { return Global.Config.PathEntries["Global", "Debug Logs"].Path; } } - public string FirmwaresPath { get { return Global.Config.PathEntries["Global", "Firmware"].Path; } } - public string AVPath { get { return Global.Config.PathEntries["Global", "A/V Dumps"].Path; } } - public string GlobalBase { get { return Global.Config.PathEntries["Global", "Base"].Path; } } - - public static List DefaultValues - { - get - { - return new List() - { - new PathEntry() { System = "Global_NULL", SystemDisplayName="Global", Type = "Movies", Path = Path.Combine(".", "Movies"), Ordinal = 0 }, - new PathEntry() { System = "Global_NULL", SystemDisplayName="Global", Type = "Movie backups", Path = Path.Combine(".", "Movies", "backup"), Ordinal = 1 }, - new PathEntry() { System = "Global_NULL", SystemDisplayName="Global", Type = "Lua", Path = Path.Combine(".", "Lua"), Ordinal = 2 }, - new PathEntry() { System = "Global_NULL", SystemDisplayName="Global", Type = "Watch (.wch)", Path = ".", Ordinal = 3 }, - new PathEntry() { System = "Global_NULL", SystemDisplayName="Global", Type = "A/V Dumps", Path = ".", Ordinal = 4 }, - new PathEntry() { System = "Global_NULL", SystemDisplayName="Global", Type = "Debug Logs", Path = ".", Ordinal = 5 }, - new PathEntry() { System = "Global_NULL", SystemDisplayName="Global", Type = "Firmware", Path = Path.Combine(".", "Firmware"), Ordinal = 6 }, - new PathEntry() { System = "Global_NULL", SystemDisplayName="Global", Type = "Base ROM", Path = ".", Ordinal = 6 }, - new PathEntry() { System = "Global_NULL", SystemDisplayName="Global", Type = "Base", Path = ".", Ordinal = 6 }, - - new PathEntry() { System = "INTV", SystemDisplayName="Intellivision", Type = "Base", Path = Path.Combine(".", "Intellivision"), Ordinal = 0 }, - new PathEntry() { System = "INTV", SystemDisplayName="Intellivision", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry() { System = "INTV", SystemDisplayName="Intellivision", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, - new PathEntry() { System = "INTV", SystemDisplayName="Intellivision", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, - new PathEntry() { System = "INTV", SystemDisplayName="Intellivision", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, - new PathEntry() { System = "INTV", SystemDisplayName="Intellivision", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - new PathEntry() { System = "INTV", SystemDisplayName="Intellivision", Type = "Palettes", Path = Path.Combine(".", "Palettes"), Ordinal = 6 }, - - new PathEntry() { System = "NES", SystemDisplayName="NES", Type = "Base", Path = Path.Combine(".", "NES"), Ordinal = 0 }, - new PathEntry() { System = "NES", SystemDisplayName="NES", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry() { System = "NES", SystemDisplayName="NES", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, - new PathEntry() { System = "NES", SystemDisplayName="NES", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, - new PathEntry() { System = "NES", SystemDisplayName="NES", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, - new PathEntry() { System = "NES", SystemDisplayName="NES", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - new PathEntry() { System = "NES", SystemDisplayName="NES", Type = "Palettes", Path = Path.Combine(".", "Palettes"), Ordinal = 6 }, - - new PathEntry() { System = "SNES_SGB", SystemDisplayName="SNES", Type = "Base", Path= Path.Combine(".", "SNES"), Ordinal = 0 }, - new PathEntry() { System = "SNES_SGB", SystemDisplayName="SNES", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry() { System = "SNES_SGB", SystemDisplayName="SNES", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, - new PathEntry() { System = "SNES_SGB", SystemDisplayName="SNES", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, - new PathEntry() { System = "SNES_SGB", SystemDisplayName="SNES", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, - new PathEntry() { System = "SNES_SGB", SystemDisplayName="SNES", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - - new PathEntry() { System = "GBA", SystemDisplayName="GBA", Type = "Base", Path= Path.Combine(".", "GBA"), Ordinal = 0 }, - new PathEntry() { System = "GBA", SystemDisplayName="GBA", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry() { System = "GBA", SystemDisplayName="GBA", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, - new PathEntry() { System = "GBA", SystemDisplayName="GBA", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, - new PathEntry() { System = "GBA", SystemDisplayName="GBA", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, - new PathEntry() { System = "GBA", SystemDisplayName="GBA", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - - new PathEntry() { System = "SMS", SystemDisplayName="SMS", Type = "Base", Path= Path.Combine(".", "SMS"), Ordinal = 0 }, - new PathEntry() { System = "SMS", SystemDisplayName="SMS", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry() { System = "SMS", SystemDisplayName="SMS", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, - new PathEntry() { System = "SMS", SystemDisplayName="SMS", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, - new PathEntry() { System = "SMS", SystemDisplayName="SMS", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, - new PathEntry() { System = "SMS", SystemDisplayName="SMS", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - - new PathEntry() { System = "GG", SystemDisplayName="GG", Type = "Base", Path= Path.Combine(".", "Game Gear"), Ordinal = 0 }, - new PathEntry() { System = "GG", SystemDisplayName="GG", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry() { System = "GG", SystemDisplayName="GG", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, - new PathEntry() { System = "GG", SystemDisplayName="GG", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, - new PathEntry() { System = "GG", SystemDisplayName="GG", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, - new PathEntry() { System = "GG", SystemDisplayName="GG", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - - new PathEntry() { System = "SG", SystemDisplayName="SG", Type = "Base", Path= Path.Combine(".", "SG-1000"), Ordinal = 0 }, - new PathEntry() { System = "SG", SystemDisplayName="SG", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry() { System = "SG", SystemDisplayName="SG", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, - new PathEntry() { System = "SG", SystemDisplayName="SG", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, - new PathEntry() { System = "SG", SystemDisplayName="SG", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, - new PathEntry() { System = "SG", SystemDisplayName="SG", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - - new PathEntry() { System = "GEN", SystemDisplayName="Genesis", Type = "Base", Path= Path.Combine(".", "Genesis"), Ordinal = 0 }, - new PathEntry() { System = "GEN", SystemDisplayName="Genesis", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry() { System = "GEN", SystemDisplayName="Genesis", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, - new PathEntry() { System = "GEN", SystemDisplayName="Genesis", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, - new PathEntry() { System = "GEN", SystemDisplayName="Genesis", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, - new PathEntry() { System = "GEN", SystemDisplayName="Genesis", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - - new PathEntry() { System = "PCE_PCECD_SGX", SystemDisplayName="PC Engine", Type = "Base", Path= Path.Combine(".", "PC Engine"), Ordinal = 0 }, - new PathEntry() { System = "PCE_PCECD_SGX", SystemDisplayName="PC Engine", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry() { System = "PCE_PCECD_SGX", SystemDisplayName="PC Engine", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, - new PathEntry() { System = "PCE_PCECD_SGX", SystemDisplayName="PC Engine", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, - new PathEntry() { System = "PCE_PCECD_SGX", SystemDisplayName="PC Engine", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, - new PathEntry() { System = "PCE_PCECD_SGX", SystemDisplayName="PC Engine", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - - new PathEntry() { System = "GB_GBC", SystemDisplayName="Gameboy", Type = "Base", Path= Path.Combine(".", "Gameboy"), Ordinal = 0 }, - new PathEntry() { System = "GB_GBC", SystemDisplayName="Gameboy", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry() { System = "GB_GBC", SystemDisplayName="Gameboy", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, - new PathEntry() { System = "GB_GBC", SystemDisplayName="Gameboy", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, - new PathEntry() { System = "GB_GBC", SystemDisplayName="Gameboy", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, - new PathEntry() { System = "GB_GBC", SystemDisplayName="Gameboy", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - new PathEntry() { System = "GB_GBC", SystemDisplayName="Gameboy", Type = "Palettes", Path = Path.Combine(".", "Palettes"), Ordinal = 6 }, - - new PathEntry() { System = "DGB", SystemDisplayName="Dual Gameboy", Type = "Base", Path= Path.Combine(".", "Dual Gameboy"), Ordinal = 0 }, - new PathEntry() { System = "DGB", SystemDisplayName="Dual Gameboy", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry() { System = "DGB", SystemDisplayName="Dual Gameboy", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, - new PathEntry() { System = "DGB", SystemDisplayName="Dual Gameboy", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, - new PathEntry() { System = "DGB", SystemDisplayName="Dual Gameboy", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, - new PathEntry() { System = "DGB", SystemDisplayName="Dual Gameboy", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - new PathEntry() { System = "DGB", SystemDisplayName="Dual Gameboy", Type = "Palettes", Path = Path.Combine(".", "Palettes"), Ordinal = 6 }, - - new PathEntry() { System = "TI83", SystemDisplayName="TI83", Type = "Base", Path= Path.Combine(".", "TI83"), Ordinal = 0 }, - new PathEntry() { System = "TI83", SystemDisplayName="TI83", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry() { System = "TI83", SystemDisplayName="TI83", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, - new PathEntry() { System = "TI83", SystemDisplayName="TI83", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, - new PathEntry() { System = "TI83", SystemDisplayName="TI83", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, - new PathEntry() { System = "TI83", SystemDisplayName="TI83", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - - new PathEntry() { System = "A26", SystemDisplayName="Atari 2600", Type = "Base", Path= Path.Combine(".", "Atari 2600"), Ordinal = 0 }, - new PathEntry() { System = "A26", SystemDisplayName="Atari 2600", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry() { System = "A26", SystemDisplayName="Atari 2600", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, - new PathEntry() { System = "A26", SystemDisplayName="Atari 2600", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, - new PathEntry() { System = "A26", SystemDisplayName="Atari 2600", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - - new PathEntry() { System = "A78", SystemDisplayName="Atari 7800", Type = "Base", Path= Path.Combine(".", "Atari 7800"), Ordinal = 0 }, - new PathEntry() { System = "A78", SystemDisplayName="Atari 7800", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry() { System = "A78", SystemDisplayName="Atari 7800", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, - new PathEntry() { System = "A78", SystemDisplayName="Atari 7800", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, - new PathEntry() { System = "A78", SystemDisplayName="Atari 7800", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, - new PathEntry() { System = "A78", SystemDisplayName="Atari 7800", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - - new PathEntry() { System = "C64", SystemDisplayName="Commodore 64", Type = "Base", Path= Path.Combine(".", "C64"), Ordinal = 0 }, - new PathEntry() { System = "C64", SystemDisplayName="Commodore 64", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry() { System = "C64", SystemDisplayName="Commodore 64", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, - new PathEntry() { System = "C64", SystemDisplayName="Commodore 64", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, - new PathEntry() { System = "C64", SystemDisplayName="Commodore 64", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - - new PathEntry() { System = "PSX", SystemDisplayName="Playstation", Type = "Base", Path= Path.Combine(".", "PSX"), Ordinal = 0 }, - new PathEntry() { System = "PSX", SystemDisplayName="Playstation", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry() { System = "PSX", SystemDisplayName="Playstation", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, - new PathEntry() { System = "PSX", SystemDisplayName="Playstation", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, - new PathEntry() { System = "PSX", SystemDisplayName="Playstation", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, - new PathEntry() { System = "PSX", SystemDisplayName="Playstation", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - - new PathEntry() { System = "Coleco", SystemDisplayName = "Coleco", Type = "Base", Path= Path.Combine(".", "Coleco"), Ordinal = 0 }, - new PathEntry() { System = "Coleco", SystemDisplayName = "Coleco", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry() { System = "Coleco", SystemDisplayName = "Coleco", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, - new PathEntry() { System = "Coleco", SystemDisplayName = "Coleco", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, - new PathEntry() { System = "Coleco", SystemDisplayName = "Coleco", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - - new PathEntry() { System = "N64", SystemDisplayName = "N64", Type = "Base", Path= Path.Combine(".", "N64"), Ordinal = 0 }, - new PathEntry() { System = "N64", SystemDisplayName = "N64", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry() { System = "N64", SystemDisplayName = "N64", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, - new PathEntry() { System = "N64", SystemDisplayName = "N64", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, - new PathEntry() { System = "N64", SystemDisplayName = "N64", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, - new PathEntry() { System = "N64", SystemDisplayName = "N64", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - - new PathEntry() { System = "SAT", SystemDisplayName = "Saturn", Type = "Base", Path= Path.Combine(".", "Saturn"), Ordinal = 0 }, - new PathEntry() { System = "SAT", SystemDisplayName = "Saturn", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry() { System = "SAT", SystemDisplayName = "Saturn", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, - new PathEntry() { System = "SAT", SystemDisplayName = "Saturn", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, - new PathEntry() { System = "SAT", SystemDisplayName = "Saturn", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, - new PathEntry() { System = "SAT", SystemDisplayName = "Saturn", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - }; - } - } - } - - public class PathEntry - { - public string SystemDisplayName; - public string Type; - public string Path; - public string System; - public int Ordinal; - public PathEntry() { } - public bool HasSystem(string systemID) - { - string[] ids = System.Split('_'); - return ids.Contains(systemID); - } - } - - public enum PLUGINTYPE { RICE, GLIDE, GLIDE64MK2 }; - - public interface iPluginSettings - { - PLUGINTYPE PluginType { get; } - Dictionary GetPluginSettings(); - } - - public class N64RicePluginSettings : iPluginSettings - { - public PLUGINTYPE PluginType - { - get { return PLUGINTYPE.RICE; } - } - - public void FillPerGameHacks(GameInfo game) - { - if (Global.Config.RicePlugin.UseDefaultHacks) - { - DisableTextureCRC = game.GetBool("RiceDisableTextureCRC", false); - DisableCulling = game.GetBool("RiceDisableCulling", false); - IncTexRectEdge = game.GetBool("RiceIncTexRectEdge", false); - ZHack = game.GetBool("RiceZHack", false); - TextureScaleHack = game.GetBool("RiceTextureScaleHack", false); - PrimaryDepthHack = game.GetBool("RicePrimaryDepthHack", false); - Texture1Hack = game.GetBool("RiceTexture1Hack", false); - FastLoadTile = game.GetBool("RiceFastLoadTile", false); - UseSmallerTexture = game.GetBool("RiceUseSmallerTexture", false); - VIWidth = game.GetInt("RiceVIWidth", -1); - VIHeight = game.GetInt("RiceVIHeight", -1); - UseCIWidthAndRatio = game.GetInt("RiceUseCIWidthAndRatio", 0); - FullTMEM = game.GetInt("RiceFullTMEM", 0); - TxtSizeMethod2 = game.GetBool("RiceTxtSizeMethod2", false); - EnableTxtLOD = game.GetBool("RiceEnableTxtLOD", false); - FastTextureCRC = game.GetInt("RiceFastTextureCRC", 0); - EmulateClear = game.GetBool("RiceEmulateClear", false); - ForceScreenClear = game.GetBool("RiceForceScreenClear", false); - AccurateTextureMappingHack = game.GetInt("RiceAccurateTextureMappingHack", 0); - NormalBlender = game.GetInt("RiceNormalBlender", 0); - DisableBlender = game.GetBool("RiceDisableBlender", false); - ForceDepthBuffer = game.GetBool("RiceForceDepthBuffer", false); - DisableObjBG = game.GetBool("RiceDisableObjBG", false); - FrameBufferOption = game.GetInt("RiceFrameBufferOption", 0); - RenderToTextureOption = game.GetInt("RiceRenderToTextureOption", 0); - ScreenUpdateSettingHack = game.GetInt("RiceScreenUpdateSettingHack", 0); - EnableHacksForGame = game.GetInt("RiceEnableHacksForGame", 0); - } - } - - public Dictionary GetPluginSettings() - { - //TODO: deal witn the game depedent settings - Dictionary dictionary = new Dictionary(); - System.Reflection.FieldInfo[] members = Global.Config.RicePlugin.GetType().GetFields(); - foreach (System.Reflection.FieldInfo member in members) - { - object field = Global.Config.RicePlugin.GetType().GetField(member.Name).GetValue(Global.Config.RicePlugin); - dictionary.Add(member.Name, field); - } - - return dictionary; - } - - public int FrameBufferSetting = 0; - public int FrameBufferWriteBackControl = 0; - public int RenderToTexture = 0; - public int ScreenUpdateSetting = 4; - public int Mipmapping = 2; - public int FogMethod = 0; - public int ForceTextureFilter = 0; - public int TextureEnhancement = 0; - public int TextureEnhancementControl = 0; - public int TextureQuality = 0; - public int OpenGLDepthBufferSetting = 16; - public int MultiSampling = 0; - public int ColorQuality = 0; - public int OpenGLRenderSetting = 0; - public int AnisotropicFiltering = 0; - - - public bool NormalAlphaBlender = false; - public bool FastTextureLoading = false; - public bool AccurateTextureMapping = true; - public bool InN64Resolution = false; - public bool SaveVRAM = false; - public bool DoubleSizeForSmallTxtrBuf = false; - public bool DefaultCombinerDisable = false; - public bool EnableHacks = true; - public bool WinFrameMode = false; - public bool FullTMEMEmulation = false; - public bool OpenGLVertexClipper = false; - public bool EnableSSE = true; - public bool EnableVertexShader = false; - public bool SkipFrame = false; - public bool TexRectOnly = false; - public bool SmallTextureOnly = false; - public bool LoadHiResCRCOnly = true; - public bool LoadHiResTextures = false; - public bool DumpTexturesToFiles = false; - - public bool UseDefaultHacks = true; - public bool DisableTextureCRC = false; - public bool DisableCulling = false; - public bool IncTexRectEdge = false; - public bool ZHack = false; - public bool TextureScaleHack = false; - public bool PrimaryDepthHack = false; - public bool Texture1Hack = false; - public bool FastLoadTile = false; - public bool UseSmallerTexture = false; - public int VIWidth = -1; - public int VIHeight = -1; - public int UseCIWidthAndRatio = 0; - public int FullTMEM = 0; - public bool TxtSizeMethod2 = false; - public bool EnableTxtLOD = false; - public int FastTextureCRC = 0; - public bool EmulateClear = false; - public bool ForceScreenClear = false; - public int AccurateTextureMappingHack = 0; - public int NormalBlender = 0; - public bool DisableBlender = false; - public bool ForceDepthBuffer = false; - public bool DisableObjBG = false; - public int FrameBufferOption = 0; - public int RenderToTextureOption = 0; - public int ScreenUpdateSettingHack = 0; - public int EnableHacksForGame = 0; - } - - public class N64GlidePluginSettings : iPluginSettings - { - public PLUGINTYPE PluginType - { - get { return PLUGINTYPE.GLIDE; } - } - - public void FillPerGameHacks(GameInfo game) - { - if (Global.Config.GlidePlugin.UseDefaultHacks) - { - alt_tex_size = Global.Game.GetBool("Glide_alt_tex_size", false); - buff_clear = Global.Game.GetBool("Glide_buff_clear", true); - decrease_fillrect_edge = Global.Game.GetBool("Glide_decrease_fillrect_edge", false); - detect_cpu_write = Global.Game.GetBool("Glide_detect_cpu_write", false); - fb_clear = Global.Game.GetBool("Glide_fb_clear", false); - fb_hires = Global.Game.GetBool("Glide_fb_clear", true); - fb_read_alpha = Global.Game.GetBool("Glide_fb_read_alpha", false); - fb_smart = Global.Game.GetBool("Glide_fb_smart", false); - fillcolor_fix = Global.Game.GetBool("Glide_fillcolor_fix", false); - fog = Global.Game.GetBool("Glide_fog", true); - force_depth_compare = Global.Game.GetBool("Glide_force_depth_compare", false); - force_microcheck = Global.Game.GetBool("Glide_force_microcheck", false); - fb_hires_buf_clear = Global.Game.GetBool("Glide_fb_hires_buf_clear", true); - fb_ignore_aux_copy = Global.Game.GetBool("Glide_fb_ignore_aux_copy", false); - fb_ignore_previous = Global.Game.GetBool("Glide_fb_ignore_previous", false); - increase_primdepth = Global.Game.GetBool("Glide_increase_primdepth", false); - increase_texrect_edge = Global.Game.GetBool("Glide_increase_texrect_edge", false); - fb_optimize_texrect = Global.Game.GetBool("Glide_fb_optimize_texrect", true); - fb_optimize_write = Global.Game.GetBool("Glide_fb_optimize_write", false); - PPL = Global.Game.GetBool("Glide_PPL", false); - soft_depth_compare = Global.Game.GetBool("Glide_soft_depth_compare", false); - use_sts1_only = Global.Game.GetBool("Glide_use_sts1_only", false); - wrap_big_tex = Global.Game.GetBool("Glide_wrap_big_tex", false); - - depth_bias = Global.Game.GetInt("Glide_depth_bias", 20); - filtering = Global.Game.GetInt("Glide_filtering", 1); - fix_tex_coord = Global.Game.GetInt("Glide_fix_tex_coord", 0); - lodmode = Global.Game.GetInt("Glide_lodmode", 0); - - stipple_mode = Global.Game.GetInt("Glide_stipple_mode", 2); - stipple_pattern = Global.Game.GetInt("Glide_stipple_pattern", 1041204192); - swapmode = Global.Game.GetInt("Glide_swapmode", 1); - enable_hacks_for_game = Global.Game.GetInt("Glide_enable_hacks_for_game", 0); - } - } - - public Dictionary GetPluginSettings() - { - //TODO: deal witn the game depedent settings - Dictionary dictionary = new Dictionary(); - System.Reflection.FieldInfo[] members = Global.Config.GlidePlugin.GetType().GetFields(); - foreach (System.Reflection.FieldInfo member in members) - { - object field = Global.Config.GlidePlugin.GetType().GetField(member.Name).GetValue(Global.Config.GlidePlugin); - dictionary.Add(member.Name, field); - } - - return dictionary; - } - - public int wfmode = 1; - public bool wireframe = false; - public int card_id = 0; - public bool flame_corona = false; - public int ucode = 2; - public bool autodetect_ucode = true; - public bool motionblur = false; - public bool fb_read_always = false; - public bool unk_as_red = false; - public bool filter_cache = false; - public bool fast_crc = false; - public bool disable_auxbuf = false; - public bool fbo = false; - public bool noglsl = true; - public bool noditheredalpha = true; - public int tex_filter = 0; - public bool fb_render = false; - public bool wrap_big_tex = false; - public bool use_sts1_only = false; - public bool soft_depth_compare = false; - public bool PPL = false; - public bool fb_optimize_write = false; - public bool fb_optimize_texrect = true; - public bool increase_texrect_edge = false; - public bool increase_primdepth = false; - public bool fb_ignore_previous = false; - public bool fb_ignore_aux_copy = false; - public bool fb_hires_buf_clear = true; - public bool force_microcheck = false; - public bool force_depth_compare = false; - public bool fog = true; - public bool fillcolor_fix = false; - public bool fb_smart = false; - public bool fb_read_alpha = false; - public bool fb_get_info = false; - public bool fb_hires = true; - public bool fb_clear = false; - public bool detect_cpu_write = false; - public bool decrease_fillrect_edge = false; - public bool buff_clear = true; - public bool alt_tex_size = false; - public bool UseDefaultHacks = true; - public int enable_hacks_for_game = 0; - public int swapmode = 1; - public int stipple_pattern = 1041204192; - public int stipple_mode = 2; - public int scale_y = 100000; - public int scale_x = 100000; - public int offset_y = 0; - public int offset_x = 0; - public int lodmode = 0; - public int fix_tex_coord = 0; - public int filtering = 1; - public int depth_bias = 20; - } - - public class N64Glide64mk2PluginSettings : iPluginSettings - { - public PLUGINTYPE PluginType - { - get { return PLUGINTYPE.GLIDE64MK2; } - } - - public void FillPerGameHacks(GameInfo game) - { - if (Global.Config.Glide64mk2Plugin.UseDefaultHacks) - { - use_sts1_only = Global.Game.GetBool("Glide64mk2_use_sts1_only", false); - optimize_texrect = Global.Game.GetBool("Glide64mk2_optimize_texrect", true); - increase_texrect_edge = Global.Game.GetBool("Glide64mk2_increase_texrect_edge", false); - ignore_aux_copy = Global.Game.GetBool("Glide64mk2_ignore_aux_copy", false); - hires_buf_clear = Global.Game.GetBool("Glide64mk2_hires_buf_clear", true); - force_microcheck = Global.Game.GetBool("Glide64mk2_force_microcheck", false); - fog = Global.Game.GetBool("Glide64mk2_fog", true); - fb_smart = Global.Game.GetBool("Glide64mk2_fb_smart", false); - fb_read_alpha = Global.Game.GetBool("Glide64mk2_fb_read_alpha", false); - fb_hires = Global.Game.GetBool("Glide64mk2_fb_hires", true); - detect_cpu_write = Global.Game.GetBool("Glide64mk2_detect_cpu_write", false); - decrease_fillrect_edge = Global.Game.GetBool("Glide64mk2_decrease_fillrect_edge", false); - buff_clear = Global.Game.GetBool("Glide64mk2_buff_clear", true); - alt_tex_size = Global.Game.GetBool("Glide64mk2_alt_tex_size", true); - swapmode = Global.Game.GetInt("Glide64mk2_swapmode", 1); - stipple_pattern = Global.Game.GetInt("Glide64mk2_stipple_pattern", 1041204192); - stipple_mode = Global.Game.GetInt("Glide64mk2_stipple_mode", 2); - lodmode = Global.Game.GetInt("Glide64mk2_lodmode", 0); - filtering = Global.Game.GetInt("Glide64mk2_filtering", 0); - correct_viewport = Global.Game.GetBool("Glide64mk2_correct_viewport", false); - force_calc_sphere = Global.Game.GetBool("Glide64mk2_force_calc_sphere", false); - pal230 = Global.Game.GetBool("Glide64mk2_pal230", false); - texture_correction = Global.Game.GetBool("Glide64mk2_texture_correction", true); - n64_z_scale = Global.Game.GetBool("Glide64mk2_n64_z_scale", false); - old_style_adither = Global.Game.GetBool("Glide64mk2_old_style_adither", false); - zmode_compare_less = Global.Game.GetBool("Glide64mk2_zmode_compare_less", false); - adjust_aspect = Global.Game.GetBool("Glide64mk2_adjust_aspect", true); - clip_zmax = Global.Game.GetBool("Glide64mk2_clip_zmax", true); - clip_zmin = Global.Game.GetBool("Glide64mk2_clip_zmin", false); - force_quad3d = Global.Game.GetBool("Glide64mk2_force_quad3d", false); - useless_is_useless = Global.Game.GetBool("Glide64mk2_useless_is_useless", false); - fb_read_always = Global.Game.GetBool("Glide64mk2_fb_read_always", false); - aspectmode = Global.Game.GetInt("Glide64mk2_aspectmode", 0); - fb_crc_mode = Global.Game.GetInt("Glide64mk2_fb_crc_mode", 1); - enable_hacks_for_game = Global.Game.GetInt("Glide64mk2_enable_hacks_for_game", 0); - read_back_to_screen = Global.Game.GetInt("Glide64mk2_read_back_to_screen", 0); - fast_crc = Global.Game.GetBool("Glide64mk2_fast_crc", true); - } - } - - public Dictionary GetPluginSettings() - { - //TODO: deal witn the game depedent settings - Dictionary dictionary = new Dictionary(); - System.Reflection.FieldInfo[] members = Global.Config.Glide64mk2Plugin.GetType().GetFields(); - foreach (System.Reflection.FieldInfo member in members) - { - object field = Global.Config.Glide64mk2Plugin.GetType().GetField(member.Name).GetValue(Global.Config.Glide64mk2Plugin); - dictionary.Add(member.Name, field); - } - - return dictionary; - } - - public bool wrpFBO = true; - public int card_id = 0; - public bool use_sts1_only = false; - public bool optimize_texrect = true; - public bool increase_texrect_edge = false; - public bool ignore_aux_copy = false; - public bool hires_buf_clear = true; - public bool force_microcheck = false; - public bool fog = true; - public bool fb_smart = false; - public bool fb_read_alpha = false; - public bool fb_hires = true; - public bool detect_cpu_write = false; - public bool decrease_fillrect_edge = false; - public bool buff_clear = true; - public bool alt_tex_size = false; - public int swapmode = 1; - public int stipple_pattern = 1041204192; - public int stipple_mode = 2; - public int lodmode = 0; - public int filtering = 0; - public bool wrpAnisotropic = false; - public bool correct_viewport = false; - public bool force_calc_sphere = false; - public bool pal230 = false; - public bool texture_correction = true; - public bool n64_z_scale = false; - public bool old_style_adither = false; - public bool zmode_compare_less = false; - public bool adjust_aspect = true; - public bool clip_zmax = true; - public bool clip_zmin = false; - public bool force_quad3d = false; - public bool useless_is_useless = false; - public bool fb_read_always = false; - public bool fb_get_info = false; - public bool fb_render = true; - public int aspectmode = 0; - public int fb_crc_mode = 1; - public bool fast_crc = true; - public bool UseDefaultHacks = true; - public int enable_hacks_for_game = 0; - public int read_back_to_screen = 0; - } - - #endregion -} \ No newline at end of file diff --git a/BizHawk.MultiClient/ConfigService.cs b/BizHawk.MultiClient/ConfigService.cs deleted file mode 100644 index bdf9f850ef..0000000000 --- a/BizHawk.MultiClient/ConfigService.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.IO; -using System.Reflection; -using System.Windows.Forms; -using Newtonsoft.Json; - -namespace BizHawk.MultiClient -{ - public static class ConfigService - { - public static T Load(string filepath, T currentConfig) where T : new() - { - T config = new T(); - - try - { - var file = new FileInfo(filepath); - if (file.Exists) - using (var reader = file.OpenText()) - { - var s = new JsonSerializer {SuppressMissingMemberException = true, SuppressDuplicateMemberException = true}; - var r = new JsonReader(reader); - config = (T)s.Deserialize(r, typeof(T)); - } - } - catch (Exception e) { MessageBox.Show(e.ToString(), "Config Error"); } - if (config == null) return new T(); - - //patch up arrays in the config with the minimum number of things - foreach(var fi in typeof(T).GetFields(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public)) - if (fi.FieldType.IsArray) - { - Array aold = fi.GetValue(currentConfig) as Array; - Array anew = fi.GetValue(config) as Array; - if (aold.Length == anew.Length) continue; - - //create an array of the right size - Array acreate = Array.CreateInstance(fi.FieldType.GetElementType(), Math.Max(aold.Length,anew.Length)); - - //copy the old values in, (presumably the defaults), and then copy the new ones on top - Array.Copy(aold, acreate, Math.Min(aold.Length,acreate.Length)); - Array.Copy(anew, acreate, Math.Min(anew.Length, acreate.Length)); - - //stash it into the config struct - fi.SetValue(config, acreate); - } - - return config; - } - - public static void Save(string filepath, object config) - { - var file = new FileInfo(filepath); - using (var writer = file.CreateText()) - { - var s = new JsonSerializer(); - var w = new JsonWriter(writer) { Formatting = Formatting.Indented }; - s.Serialize(w, config); - } - } - } -} \ No newline at end of file diff --git a/BizHawk.MultiClient/DisplayManager/DisplayManager.cs b/BizHawk.MultiClient/DisplayManager/DisplayManager.cs index c9e1ed0d0a..9bae8b03bb 100644 --- a/BizHawk.MultiClient/DisplayManager/DisplayManager.cs +++ b/BizHawk.MultiClient/DisplayManager/DisplayManager.cs @@ -11,6 +11,8 @@ using System.Drawing.Imaging; //using dx=SlimDX; //using d3d=SlimDX.Direct3D9; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { /// @@ -340,14 +342,14 @@ namespace BizHawk.MultiClient private string MakeFrameCounter() { - if (Global.MovieSession.Movie.IsFinished) + if (GlobalWinF.MovieSession.Movie.IsFinished) { StringBuilder s = new StringBuilder(); - s.Append(Global.Emulator.Frame); + s.Append(GlobalWinF.Emulator.Frame); s.Append('/'); - if (Global.MovieSession.Movie.Frames.HasValue) + if (GlobalWinF.MovieSession.Movie.Frames.HasValue) { - s.Append(Global.MovieSession.Movie.Frames); + s.Append(GlobalWinF.MovieSession.Movie.Frames); } else { @@ -356,14 +358,14 @@ namespace BizHawk.MultiClient s.Append(" (Finished)"); return s.ToString(); } - else if (Global.MovieSession.Movie.IsPlaying) + else if (GlobalWinF.MovieSession.Movie.IsPlaying) { StringBuilder s = new StringBuilder(); - s.Append(Global.Emulator.Frame); + s.Append(GlobalWinF.Emulator.Frame); s.Append('/'); - if (Global.MovieSession.Movie.Frames.HasValue) + if (GlobalWinF.MovieSession.Movie.Frames.HasValue) { - s.Append(Global.MovieSession.Movie.Frames); + s.Append(GlobalWinF.MovieSession.Movie.Frames); } else { @@ -371,19 +373,19 @@ namespace BizHawk.MultiClient } return s.ToString(); } - else if (Global.MovieSession.Movie.IsRecording) + else if (GlobalWinF.MovieSession.Movie.IsRecording) { - return Global.Emulator.Frame.ToString(); + return GlobalWinF.Emulator.Frame.ToString(); } else { - return Global.Emulator.Frame.ToString(); + return GlobalWinF.Emulator.Frame.ToString(); } } private string MakeLagCounter() { - return Global.Emulator.LagCount.ToString(); + return GlobalWinF.Emulator.LagCount.ToString(); } private List messages = new List(5); @@ -391,19 +393,19 @@ namespace BizHawk.MultiClient public void AddMessage(string message) { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; messages.Add(new UIMessage { Message = message, ExpireAt = DateTime.Now + TimeSpan.FromSeconds(2) }); } public void AddGUIText(string message, int x, int y, bool alert, Color BackGround, Color ForeColor, int anchor) { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; GUITextList.Add(new UIDisplay { Message = message, X = x, Y = y, BackGround = BackGround, ForeColor = ForeColor, Alert = alert, Anchor = anchor }); } public void ClearGUIText() { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; GUITextList.Clear(); } @@ -411,7 +413,7 @@ namespace BizHawk.MultiClient public void DrawMessages(IBlitter g) { - if (!Global.ClientControls["MaxTurbo"]) + if (!GlobalWinF.ClientControls["MaxTurbo"]) { messages.RemoveAll(m => DateTime.Now > m.ExpireAt); int line = 1; @@ -481,13 +483,13 @@ namespace BizHawk.MultiClient public string MakeInputDisplay() { StringBuilder s; - if (!Global.MovieSession.Movie.IsActive || Global.MovieSession.Movie.IsFinished) + if (!GlobalWinF.MovieSession.Movie.IsActive || GlobalWinF.MovieSession.Movie.IsFinished) { - s = new StringBuilder(Global.GetOutputControllersAsMnemonic()); + s = new StringBuilder(GlobalWinF.GetOutputControllersAsMnemonic()); } else { - s = new StringBuilder(Global.MovieSession.Movie.GetInput(Global.Emulator.Frame - 1)); + s = new StringBuilder(GlobalWinF.MovieSession.Movie.GetInput(GlobalWinF.Emulator.Frame - 1)); } s.Replace(".", " ").Replace("|", "").Replace(" 000, 000", " "); @@ -497,9 +499,9 @@ namespace BizHawk.MultiClient public string MakeRerecordCount() { - if (Global.MovieSession.Movie.IsActive) + if (GlobalWinF.MovieSession.Movie.IsActive) { - return "Rerecord Count: " + Global.MovieSession.Movie.Rerecords.ToString(); + return "Rerecord Count: " + GlobalWinF.MovieSession.Movie.Rerecords.ToString(); } else { @@ -526,7 +528,7 @@ namespace BizHawk.MultiClient Color c; float x = GetX(g, Global.Config.DispInpx, Global.Config.DispInpanchor, MessageFont, input); float y = GetY(g, Global.Config.DispInpy, Global.Config.DispInpanchor, MessageFont, input); - if (Global.MovieSession.Movie.IsPlaying && !Global.MovieSession.Movie.IsRecording) + if (GlobalWinF.MovieSession.Movie.IsPlaying && !GlobalWinF.MovieSession.Movie.IsRecording) { c = Color.FromArgb(Global.Config.MovieInput); } @@ -538,7 +540,7 @@ namespace BizHawk.MultiClient g.DrawString(input, MessageFont, Color.Black, x+1,y+1); g.DrawString(input, MessageFont, c, x,y); } - if (Global.MovieSession.MultiTrack.IsActive) + if (GlobalWinF.MovieSession.MultiTrack.IsActive) { float x = GetX(g, Global.Config.DispMultix, Global.Config.DispMultianchor, MessageFont, MT); float y = GetY(g, Global.Config.DispMultiy, Global.Config.DispMultianchor, MessageFont, MT); @@ -559,7 +561,7 @@ namespace BizHawk.MultiClient { string counter = MakeLagCounter(); - if (Global.Emulator.IsLagFrame) + if (GlobalWinF.Emulator.IsLagFrame) { float x = GetX(g, Global.Config.DispLagx, Global.Config.DispLaganchor, AlertFont, counter); float y = GetY(g, Global.Config.DispLagy, Global.Config.DispLaganchor, AlertFont, counter); @@ -584,17 +586,17 @@ namespace BizHawk.MultiClient g.DrawString(rerec, MessageFont, FixedMessagesColor, x, y); } - if (Global.ClientControls["Autohold"] || Global.ClientControls["Autofire"]) + if (GlobalWinF.ClientControls["Autohold"] || GlobalWinF.ClientControls["Autofire"]) { StringBuilder disp = new StringBuilder("Held: "); - foreach (string s in Global.StickyXORAdapter.CurrentStickies) + foreach (string s in GlobalWinF.StickyXORAdapter.CurrentStickies) { disp.Append(s); disp.Append(' '); } - foreach (string s in Global.AutofireStickyXORAdapter.CurrentStickies) + foreach (string s in GlobalWinF.AutofireStickyXORAdapter.CurrentStickies) { disp.Append("Auto-"); disp.Append(s); @@ -622,9 +624,9 @@ namespace BizHawk.MultiClient // //g.DrawEllipse(new Pen(new SolidBrush(Color.Pink)), new Rectangle((int)g.ClipBounds.Width - 22, 2, 20, 20)); //} - if (Global.MovieSession.Movie.IsActive && Global.Config.DisplaySubtitles) + if (GlobalWinF.MovieSession.Movie.IsActive && Global.Config.DisplaySubtitles) { - List s = Global.MovieSession.Movie.Subtitles.GetSubtitles(Global.Emulator.Frame); + List s = GlobalWinF.MovieSession.Movie.Subtitles.GetSubtitles(GlobalWinF.Emulator.Frame); if (s == null) { return; @@ -660,7 +662,7 @@ namespace BizHawk.MultiClient /// update Global.RenderPanel from the passed IVideoProvider public void UpdateSource(IVideoProvider videoProvider) { - UpdateSourceEx(videoProvider, Global.RenderPanel); + UpdateSourceEx(videoProvider, GlobalWinF.RenderPanel); } /// @@ -773,10 +775,10 @@ namespace BizHawk.MultiClient void RenderOSD(IBlitter renderPanel) { - Global.OSD.Begin(renderPanel); + GlobalWinF.OSD.Begin(renderPanel); renderPanel.Open(); - Global.OSD.DrawScreenInfo(renderPanel); - Global.OSD.DrawMessages(renderPanel); + GlobalWinF.OSD.DrawScreenInfo(renderPanel); + GlobalWinF.OSD.DrawMessages(renderPanel); renderPanel.Close(); } diff --git a/BizHawk.MultiClient/FirmwareManager.cs b/BizHawk.MultiClient/FirmwareManager.cs index 6e120a3163..57b8815f50 100644 --- a/BizHawk.MultiClient/FirmwareManager.cs +++ b/BizHawk.MultiClient/FirmwareManager.cs @@ -3,6 +3,8 @@ using System.Linq; using System.IO; using System.Collections.Generic; +using BizHawk.Client.Core; + //IDEA: put filesizes in DB too. then scans can go real quick by only scanning filesizes that match (and then scanning filesizes that dont match, in case of an emergency) //this would be adviseable if we end up with a very large firmware file diff --git a/BizHawk.MultiClient/Global.cs b/BizHawk.MultiClient/GlobalWinF.cs similarity index 95% rename from BizHawk.MultiClient/Global.cs rename to BizHawk.MultiClient/GlobalWinF.cs index bd79a38c24..498dd7ca09 100644 --- a/BizHawk.MultiClient/Global.cs +++ b/BizHawk.MultiClient/GlobalWinF.cs @@ -7,7 +7,7 @@ using SlimDX.DirectSound; namespace BizHawk.MultiClient { - public static class Global + public static class GlobalWinF { public static MainForm MainForm; #if WINDOWS @@ -18,12 +18,9 @@ namespace BizHawk.MultiClient public static IRenderer RenderPanel; public static OSDManager OSD = new OSDManager(); public static DisplayManager DisplayManager = new DisplayManager(); - public static Config Config; public static IEmulator Emulator; public static CoreComm CoreComm; - public static GameInfo Game; public static CheatList CheatList; - public static Controller NullControls; public static AutofireController AutofireNullControls; diff --git a/BizHawk.MultiClient/Input/ControllerBinding.cs b/BizHawk.MultiClient/Input/ControllerBinding.cs index c8dd7ddbd3..6e5b1e9701 100644 --- a/BizHawk.MultiClient/Input/ControllerBinding.cs +++ b/BizHawk.MultiClient/Input/ControllerBinding.cs @@ -2,6 +2,8 @@ using System.Collections.Generic; using System.Linq; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public class Controller : IController @@ -14,7 +16,7 @@ namespace BizHawk.MultiClient private readonly Dictionary FloatRanges = new WorkingDictionary(); - private readonly Dictionary FloatBinds = new Dictionary(); + private readonly Dictionary FloatBinds = new Dictionary(); public Controller(ControllerDefinition definition) { @@ -153,7 +155,7 @@ namespace BizHawk.MultiClient bindings[button].Add(control.Trim()); } - public void BindFloat(string button, Config.AnalogBind bind) + public void BindFloat(string button, BizHawk.Client.Core.Config.AnalogBind bind) { FloatBinds[button] = bind; } @@ -212,7 +214,7 @@ namespace BizHawk.MultiClient { if (autofire) { - int a = (Global.Emulator.Frame - buttonStarts[button]) % (On + Off); + int a = (GlobalWinF.Emulator.Frame - buttonStarts[button]) % (On + Off); if (a < On) return buttons[button]; else @@ -252,7 +254,7 @@ namespace BizHawk.MultiClient foreach (var bound_button in kvp.Value) { if (buttons[kvp.Key] == false && controller[bound_button]) - buttonStarts[kvp.Key] = Global.Emulator.Frame; + buttonStarts[kvp.Key] = GlobalWinF.Emulator.Frame; } } diff --git a/BizHawk.MultiClient/Input/GamePad.cs b/BizHawk.MultiClient/Input/GamePad.cs index 5179db9e56..d3d8550fc1 100644 --- a/BizHawk.MultiClient/Input/GamePad.cs +++ b/BizHawk.MultiClient/Input/GamePad.cs @@ -27,7 +27,7 @@ namespace BizHawk.MultiClient continue; // Don't input XBOX 360 controllers into here; we'll process them via XInput (there are limitations in some trigger axes when xbox pads go over xinput) var joystick = new Joystick(dinput, device.InstanceGuid); - joystick.SetCooperativeLevel(Global.MainForm.Handle, CooperativeLevel.Background | CooperativeLevel.Nonexclusive); + joystick.SetCooperativeLevel(GlobalWinF.MainForm.Handle, CooperativeLevel.Background | CooperativeLevel.Nonexclusive); foreach (DeviceObjectInstance deviceObject in joystick.GetObjects()) { if ((deviceObject.ObjectType & ObjectDeviceType.Axis) != 0) diff --git a/BizHawk.MultiClient/Input/Input.cs b/BizHawk.MultiClient/Input/Input.cs index 986da8097f..b723da8fdc 100644 --- a/BizHawk.MultiClient/Input/Input.cs +++ b/BizHawk.MultiClient/Input/Input.cs @@ -337,7 +337,7 @@ namespace BizHawk.MultiClient } - bool swallow = !Global.MainForm.AllowInput; + bool swallow = !GlobalWinF.MainForm.AllowInput; foreach (var ie in _NewEvents) { @@ -399,7 +399,7 @@ namespace BizHawk.MultiClient lock (this) { if (InputEvents.Count == 0) return null; - if (!Global.MainForm.AllowInput) return null; + if (!GlobalWinF.MainForm.AllowInput) return null; //we only listen to releases for input binding, because we need to distinguish releases of pure modifierkeys from modified keys //if you just pressed ctrl, wanting to bind ctrl, we'd see: pressed:ctrl, unpressed:ctrl diff --git a/BizHawk.MultiClient/Input/Keyboard.cs b/BizHawk.MultiClient/Input/Keyboard.cs index a1d3f569a0..a8bf4210cd 100644 --- a/BizHawk.MultiClient/Input/Keyboard.cs +++ b/BizHawk.MultiClient/Input/Keyboard.cs @@ -16,7 +16,7 @@ namespace BizHawk.MultiClient if (keyboard == null || keyboard.Disposed) keyboard = new Keyboard(dinput); - keyboard.SetCooperativeLevel(Global.MainForm.Handle, CooperativeLevel.Background | CooperativeLevel.Nonexclusive); + keyboard.SetCooperativeLevel(GlobalWinF.MainForm.Handle, CooperativeLevel.Background | CooperativeLevel.Nonexclusive); } public static void Update() diff --git a/BizHawk.MultiClient/LogConsole.cs b/BizHawk.MultiClient/LogConsole.cs index 2a93106993..c2b25990b1 100644 --- a/BizHawk.MultiClient/LogConsole.cs +++ b/BizHawk.MultiClient/LogConsole.cs @@ -3,6 +3,8 @@ using System.Text; using System.IO; using System.Runtime.InteropServices; +using BizHawk.Client.Core; + #pragma warning disable 162 //thanks! - http://sharp-developer.net/ru/CodeBank/WinForms/GuiConsole.aspx diff --git a/BizHawk.MultiClient/LogWindow.cs b/BizHawk.MultiClient/LogWindow.cs index 79a9644619..c0247c9b4d 100644 --- a/BizHawk.MultiClient/LogWindow.cs +++ b/BizHawk.MultiClient/LogWindow.cs @@ -4,6 +4,8 @@ using System.Drawing; using System.Text; using System.Windows.Forms; +using BizHawk.Client.Core; + //todo - perks - pause, copy to clipboard, backlog length limiting namespace BizHawk.MultiClient @@ -18,7 +20,7 @@ namespace BizHawk.MultiClient Closing += (o, e) => { Global.Config.ShowLogWindow = false; - Global.MainForm.notifyLogWindowClosing(); + GlobalWinF.MainForm.notifyLogWindowClosing(); LogConsole.notifyLogWindowClosing(); SaveConfigSettings(); }; diff --git a/BizHawk.MultiClient/MainForm.MenuItems.cs b/BizHawk.MultiClient/MainForm.MenuItems.cs index e8cdf4c021..3938b058c5 100644 --- a/BizHawk.MultiClient/MainForm.MenuItems.cs +++ b/BizHawk.MultiClient/MainForm.MenuItems.cs @@ -7,6 +7,8 @@ using BizHawk.Emulation.Consoles.Calculator; using BizHawk.Emulation.Consoles.GB; using BizHawk.Emulation.Consoles.Nintendo.SNES; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { partial class MainForm @@ -28,11 +30,11 @@ namespace BizHawk.MultiClient private void DumpStatus_Click(object sender, EventArgs e) { - string details = Global.Emulator.CoreComm.RomStatusDetails; + string details = GlobalWinF.Emulator.CoreComm.RomStatusDetails; if (string.IsNullOrEmpty(details)) return; - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); LogWindow.ShowReport("Dump Status Report", details, this); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); } private void saveWindowPositionToolStripMenuItem_Click(object sender, EventArgs e) @@ -62,7 +64,7 @@ namespace BizHawk.MultiClient old = Global.Config.VSyncThrottle; Global.Config.VSyncThrottle = false; if (old) - Global.RenderPanel.Resized = true; + GlobalWinF.RenderPanel.Resized = true; } LimitFrameRateMessage(); } @@ -77,7 +79,7 @@ namespace BizHawk.MultiClient bool old = Global.Config.VSyncThrottle; Global.Config.VSyncThrottle = false; if (old) - Global.RenderPanel.Resized = true; + GlobalWinF.RenderPanel.Resized = true; } } @@ -85,7 +87,7 @@ namespace BizHawk.MultiClient private void miDisplayVsync_Click(object sender, EventArgs e) { Global.Config.VSyncThrottle ^= true; - Global.RenderPanel.Resized = true; + GlobalWinF.RenderPanel.Resized = true; if (Global.Config.VSyncThrottle) { Global.Config.ClockThrottle = false; @@ -101,18 +103,18 @@ namespace BizHawk.MultiClient { Global.Config.VSync ^= true; if (!Global.Config.VSyncThrottle) // when vsync throttle is on, vsync is forced to on, so no change to make here - Global.RenderPanel.Resized = true; + GlobalWinF.RenderPanel.Resized = true; } public void LimitFrameRateMessage() { if (Global.Config.ClockThrottle) { - Global.OSD.AddMessage("Framerate limiting on"); + GlobalWinF.OSD.AddMessage("Framerate limiting on"); } else { - Global.OSD.AddMessage("Framerate limiting off"); + GlobalWinF.OSD.AddMessage("Framerate limiting off"); } } @@ -121,11 +123,11 @@ namespace BizHawk.MultiClient { if (Global.Config.VSyncThrottle) { - Global.OSD.AddMessage("Display Vsync is set to on"); + GlobalWinF.OSD.AddMessage("Display Vsync is set to on"); } else { - Global.OSD.AddMessage("Display Vsync is set to off"); + GlobalWinF.OSD.AddMessage("Display Vsync is set to off"); } } @@ -138,11 +140,11 @@ namespace BizHawk.MultiClient { if (Global.Config.AutoMinimizeSkipping) { - Global.OSD.AddMessage("Autominimizing set to on"); + GlobalWinF.OSD.AddMessage("Autominimizing set to on"); } else { - Global.OSD.AddMessage("Autominimizing set to off"); + GlobalWinF.OSD.AddMessage("Autominimizing set to off"); } } @@ -159,7 +161,7 @@ namespace BizHawk.MultiClient public void FrameSkipMessage() { - Global.OSD.AddMessage("Frameskipping set to " + Global.Config.FrameSkip.ToString()); + GlobalWinF.OSD.AddMessage("Frameskipping set to " + Global.Config.FrameSkip.ToString()); } public void ClickSpeedItem(int num) @@ -439,7 +441,7 @@ namespace BizHawk.MultiClient private void OpenControllerConfig() { - ControllerConfig c = new ControllerConfig(Global.Emulator.ControllerDefinition); + ControllerConfig c = new ControllerConfig(GlobalWinF.Emulator.ControllerDefinition); c.ShowDialog(); if (c.DialogResult == DialogResult.OK) { @@ -466,25 +468,25 @@ namespace BizHawk.MultiClient private void displayFPSToolStripMenuItem_Click(object sender, EventArgs e) { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; ToggleFPS(); } private void displayFrameCounterToolStripMenuItem_Click(object sender, EventArgs e) { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; ToggleFrameCounter(); } private void displayInputToolStripMenuItem_Click(object sender, EventArgs e) { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; ToggleInputDisplay(); } private void displayLagCounterToolStripMenuItem_Click(object sender, EventArgs e) { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; ToggleLagCounter(); } @@ -636,9 +638,9 @@ namespace BizHawk.MultiClient virtualPadToolStripMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Virtual Pad"].Bindings; traceLoggerToolStripMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Trace Logger"].Bindings; toolBoxToolStripMenuItem.Enabled = !ToolBox1.IsHandleCreated || ToolBox1.IsDisposed; - traceLoggerToolStripMenuItem.Enabled = Global.Emulator.CoreComm.CpuTraceAvailable; + traceLoggerToolStripMenuItem.Enabled = GlobalWinF.Emulator.CoreComm.CpuTraceAvailable; - cheatsToolStripMenuItem.Enabled = !(Global.Emulator is NullEmulator); + cheatsToolStripMenuItem.Enabled = !(GlobalWinF.Emulator is NullEmulator); } private void saveSlotToolStripMenuItem_DropDownOpened(object sender, EventArgs e) @@ -671,13 +673,13 @@ namespace BizHawk.MultiClient private void autoloadVirtualKeyboardToolStripMenuItem_Click(object sender, EventArgs e) { - if (!(Global.Emulator is TI83)) return; + if (!(GlobalWinF.Emulator is TI83)) return; Global.Config.TI83autoloadKeyPad ^= true; } private void keypadToolStripMenuItem_Click(object sender, EventArgs e) { - if (!(Global.Emulator is TI83)) + if (!(GlobalWinF.Emulator is TI83)) return; LoadTI83KeyPad(); } @@ -696,7 +698,7 @@ namespace BizHawk.MultiClient private void displayRerecordCountToolStripMenuItem_Click(object sender, EventArgs e) { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; Global.Config.DisplayRerecordCount ^= true; } @@ -733,9 +735,9 @@ namespace BizHawk.MultiClient Filter = "PNG File (*.png)|*.png" }; - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = sfd.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result != DialogResult.OK) return; TakeScreenshot(sfd.FileName); @@ -761,11 +763,11 @@ namespace BizHawk.MultiClient Global.Config.AcceptBackgroundInput ^= true; if (Global.Config.AcceptBackgroundInput) { - Global.OSD.AddMessage("Background Input enabled"); + GlobalWinF.OSD.AddMessage("Background Input enabled"); } else { - Global.OSD.AddMessage("Background Input disabled"); + GlobalWinF.OSD.AddMessage("Background Input disabled"); } } @@ -827,11 +829,11 @@ namespace BizHawk.MultiClient Global.Config.ShowContextMenu ^= true; if (Global.Config.ShowContextMenu) { - Global.OSD.AddMessage("Context menu enabled"); + GlobalWinF.OSD.AddMessage("Context menu enabled"); } else { - Global.OSD.AddMessage("Context menu disabled"); + GlobalWinF.OSD.AddMessage("Context menu disabled"); } } @@ -856,10 +858,10 @@ namespace BizHawk.MultiClient s.DisableFrame(); int index = -1; Subtitle sub = new Subtitle(); - for (int x = 0; x < Global.MovieSession.Movie.Subtitles.Count; x++) + for (int x = 0; x < GlobalWinF.MovieSession.Movie.Subtitles.Count; x++) { - sub = Global.MovieSession.Movie.Subtitles.GetSubtitleByIndex(x); - if (Global.Emulator.Frame == sub.Frame) + sub = GlobalWinF.MovieSession.Movie.Subtitles.GetSubtitleByIndex(x); + if (GlobalWinF.Emulator.Frame == sub.Frame) { index = x; break; @@ -867,15 +869,15 @@ namespace BizHawk.MultiClient } if (index < 0) { - sub = new Subtitle { Frame = Global.Emulator.Frame }; + sub = new Subtitle { Frame = GlobalWinF.Emulator.Frame }; } s.sub = sub; if (s.ShowDialog() == DialogResult.OK) { if (index >= 0) - Global.MovieSession.Movie.Subtitles.Remove(index); - Global.MovieSession.Movie.Subtitles.AddSubtitle(s.sub); + GlobalWinF.MovieSession.Movie.Subtitles.Remove(index); + GlobalWinF.MovieSession.Movie.Subtitles.AddSubtitle(s.sub); } } @@ -941,7 +943,7 @@ namespace BizHawk.MultiClient cmiLoadLastRom.Visible = false; toolStripSeparator_afterRomLoading.Visible = false; - if (Global.MovieSession.Movie.IsActive) + if (GlobalWinF.MovieSession.Movie.IsActive) { cmiRecordMovie.Visible = false; cmiPlayMovie.Visible = false; @@ -1028,7 +1030,7 @@ namespace BizHawk.MultiClient ShowMenuContextMenuSeparator.Visible = cmiShowMenu.Visible = false; } - ContextMenuStopMovieNoSaving.Visible = Global.MovieSession.Movie.IsActive && Global.MovieSession.Movie.HasChanges; + ContextMenuStopMovieNoSaving.Visible = GlobalWinF.MovieSession.Movie.IsActive && GlobalWinF.MovieSession.Movie.HasChanges; } @@ -1042,7 +1044,7 @@ namespace BizHawk.MultiClient private void makeMovieBackupToolStripMenuItem_Click(object sender, EventArgs e) { - Global.MovieSession.Movie.WriteBackup(); + GlobalWinF.MovieSession.Movie.WriteBackup(); } private void automaticallyBackupMoviesToolStripMenuItem_Click(object sender, EventArgs e) @@ -1072,7 +1074,7 @@ namespace BizHawk.MultiClient private void displaySubtitlesToolStripMenuItem_Click(object sender, EventArgs e) { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; Global.Config.DisplaySubtitles ^= true; } @@ -1096,20 +1098,20 @@ namespace BizHawk.MultiClient private void viewCommentsToolStripMenuItem_Click(object sender, EventArgs e) { - if (Global.MovieSession.Movie.IsActive) + if (GlobalWinF.MovieSession.Movie.IsActive) { EditCommentsForm c = new EditCommentsForm { ReadOnly = ReadOnly }; - c.GetMovie(Global.MovieSession.Movie); + c.GetMovie(GlobalWinF.MovieSession.Movie); c.ShowDialog(); } } private void viewSubtitlesToolStripMenuItem_Click(object sender, EventArgs e) { - if (Global.MovieSession.Movie.IsActive) + if (GlobalWinF.MovieSession.Movie.IsActive) { EditSubtitlesForm s = new EditSubtitlesForm { ReadOnly = ReadOnly }; - s.GetMovie(Global.MovieSession.Movie); + s.GetMovie(GlobalWinF.MovieSession.Movie); s.ShowDialog(); } } @@ -1158,12 +1160,12 @@ namespace BizHawk.MultiClient private void movieToolStripMenuItem_DropDownOpened(object sender, EventArgs e) { - fullMovieLoadstatesToolStripMenuItem.Enabled = !Global.MovieSession.MultiTrack.IsActive; - stopMovieWithoutSavingToolStripMenuItem.Enabled = Global.MovieSession.Movie.IsActive && Global.MovieSession.Movie.HasChanges; + fullMovieLoadstatesToolStripMenuItem.Enabled = !GlobalWinF.MovieSession.MultiTrack.IsActive; + stopMovieWithoutSavingToolStripMenuItem.Enabled = GlobalWinF.MovieSession.Movie.IsActive && GlobalWinF.MovieSession.Movie.HasChanges; stopMovieToolStripMenuItem.Enabled = playFromBeginningToolStripMenuItem.Enabled = saveMovieToolStripMenuItem.Enabled - = Global.MovieSession.Movie.IsActive; + = GlobalWinF.MovieSession.Movie.IsActive; readonlyToolStripMenuItem.Checked = ReadOnly; bindSavestatesToMoviesToolStripMenuItem.Checked = Global.Config.BindSavestatesToMovies; @@ -1181,14 +1183,14 @@ namespace BizHawk.MultiClient private void saveConfigToolStripMenuItem_Click(object sender, EventArgs e) { SaveConfig(); - Global.OSD.AddMessage("Saved settings"); + GlobalWinF.OSD.AddMessage("Saved settings"); } private void loadConfigToolStripMenuItem_Click(object sender, EventArgs e) { Global.Config = ConfigService.Load(PathManager.DefaultIniPath, Global.Config); Global.Config.ResolveDefaults(); - Global.OSD.AddMessage("Config file loaded"); + GlobalWinF.OSD.AddMessage("Config file loaded"); } private void frameSkipToolStripMenuItem_DropDownOpened(object sender, EventArgs e) @@ -1273,7 +1275,7 @@ namespace BizHawk.MultiClient private void menuStrip1_MenuDeactivate(object sender, EventArgs e) { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; if (!wasPaused) { UnpauseEmulator(); @@ -1431,12 +1433,12 @@ namespace BizHawk.MultiClient { rebootCoreToolStripMenuItem.Enabled = !IsNullEmulator(); - resetToolStripMenuItem.Enabled = Global.Emulator.ControllerDefinition.BoolButtons.Contains("Reset") && - (!Global.MovieSession.Movie.IsPlaying || Global.MovieSession.Movie.IsFinished); + resetToolStripMenuItem.Enabled = GlobalWinF.Emulator.ControllerDefinition.BoolButtons.Contains("Reset") && + (!GlobalWinF.MovieSession.Movie.IsPlaying || GlobalWinF.MovieSession.Movie.IsFinished); - hardResetToolStripMenuItem.Enabled = Global.Emulator.ControllerDefinition.BoolButtons.Contains("Power") && - (!Global.MovieSession.Movie.IsPlaying || Global.MovieSession.Movie.IsFinished); + hardResetToolStripMenuItem.Enabled = GlobalWinF.Emulator.ControllerDefinition.BoolButtons.Contains("Power") && + (!GlobalWinF.MovieSession.Movie.IsPlaying || GlobalWinF.MovieSession.Movie.IsFinished); pauseToolStripMenuItem.Checked = EmulatorPaused; if (didMenuPause) @@ -1500,11 +1502,11 @@ namespace BizHawk.MultiClient Global.Config.BackupSavestates ^= true; if (Global.Config.BackupSavestates) { - Global.OSD.AddMessage("Backup savestates enabled"); + GlobalWinF.OSD.AddMessage("Backup savestates enabled"); } else { - Global.OSD.AddMessage("Backup savestates disabled"); + GlobalWinF.OSD.AddMessage("Backup savestates disabled"); } } @@ -1513,11 +1515,11 @@ namespace BizHawk.MultiClient Global.Config.AutoSavestates ^= true; if (Global.Config.AutoSavestates) { - Global.OSD.AddMessage("AutoSavestates enabled"); + GlobalWinF.OSD.AddMessage("AutoSavestates enabled"); } else { - Global.OSD.AddMessage("AutoSavestates disabled"); + GlobalWinF.OSD.AddMessage("AutoSavestates disabled"); } } @@ -1526,11 +1528,11 @@ namespace BizHawk.MultiClient Global.Config.SaveScreenshotWithStates ^= true; if (Global.Config.SaveScreenshotWithStates) { - Global.OSD.AddMessage("Screenshots will be saved in savestates"); + GlobalWinF.OSD.AddMessage("Screenshots will be saved in savestates"); } else { - Global.OSD.AddMessage("Screenshots will not be saved in savestates"); + GlobalWinF.OSD.AddMessage("Screenshots will not be saved in savestates"); } } @@ -1538,7 +1540,7 @@ namespace BizHawk.MultiClient { string path = PathManager.SaveStatePrefix(Global.Game) + "." + "QuickSave" + Global.Config.SaveSlot + ".State"; SwapBackupSavestate(path); - Global.OSD.AddMessage("Save slot " + Global.Config.SaveSlot.ToString() + " restored."); + GlobalWinF.OSD.AddMessage("Save slot " + Global.Config.SaveSlot.ToString() + " restored."); } private void FreezeStatus_Click(object sender, EventArgs e) @@ -1551,7 +1553,7 @@ namespace BizHawk.MultiClient public void UpdateCheatStatus() { - if (Global.CheatList.ActiveCount > 0) + if (GlobalWinF.CheatList.ActiveCount > 0) { CheatStatus.ToolTipText = "Cheats are currently active"; CheatStatus.Image = Properties.Resources.Freeze; @@ -1597,40 +1599,40 @@ namespace BizHawk.MultiClient private void bWToolStripMenuItem_Click(object sender, EventArgs e) { - if (Global.Emulator is Atari2600) + if (GlobalWinF.Emulator is Atari2600) { Global.Config.Atari2600_BW ^= true; - ((Atari2600)Global.Emulator).SetBw(Global.Config.Atari2600_BW); + ((Atari2600)GlobalWinF.Emulator).SetBw(Global.Config.Atari2600_BW); if (Global.Config.Atari2600_BW) - Global.OSD.AddMessage("Setting to Black and White Switch to On"); + GlobalWinF.OSD.AddMessage("Setting to Black and White Switch to On"); else - Global.OSD.AddMessage("Setting to Black and White Switch to Off"); + GlobalWinF.OSD.AddMessage("Setting to Black and White Switch to Off"); } } private void p0DifficultyToolStripMenuItem_Click(object sender, EventArgs e) { - if (Global.Emulator is Atari2600) + if (GlobalWinF.Emulator is Atari2600) { Global.Config.Atari2600_LeftDifficulty ^= true; - ((Atari2600)Global.Emulator).SetP0Diff(Global.Config.Atari2600_BW); + ((Atari2600)GlobalWinF.Emulator).SetP0Diff(Global.Config.Atari2600_BW); if (Global.Config.Atari2600_LeftDifficulty) - Global.OSD.AddMessage("Setting Left Difficulty to B"); + GlobalWinF.OSD.AddMessage("Setting Left Difficulty to B"); else - Global.OSD.AddMessage("Setting Left Difficulty to A"); + GlobalWinF.OSD.AddMessage("Setting Left Difficulty to A"); } } private void rightDifficultyToolStripMenuItem_Click(object sender, EventArgs e) { - if (Global.Emulator is Atari2600) + if (GlobalWinF.Emulator is Atari2600) { Global.Config.Atari2600_RightDifficulty ^= true; - ((Atari2600)Global.Emulator).SetP1Diff(Global.Config.Atari2600_BW); + ((Atari2600)GlobalWinF.Emulator).SetP1Diff(Global.Config.Atari2600_BW); if (Global.Config.Atari2600_RightDifficulty) - Global.OSD.AddMessage("Setting Right Difficulty to B"); + GlobalWinF.OSD.AddMessage("Setting Right Difficulty to B"); else - Global.OSD.AddMessage("Setting Right Difficulty to A"); + GlobalWinF.OSD.AddMessage("Setting Right Difficulty to A"); } } @@ -1684,7 +1686,7 @@ namespace BizHawk.MultiClient public void SNES_ToggleBG1(bool? setto = null) { - if (Global.Emulator is LibsnesCore) + if (GlobalWinF.Emulator is LibsnesCore) { if (setto.HasValue) { @@ -1698,18 +1700,18 @@ namespace BizHawk.MultiClient SyncCoreCommInputSignals(); if (Global.Config.SNES_ShowBG1_1) { - Global.OSD.AddMessage("BG 1 Layer On"); + GlobalWinF.OSD.AddMessage("BG 1 Layer On"); } else { - Global.OSD.AddMessage("BG 1 Layer Off"); + GlobalWinF.OSD.AddMessage("BG 1 Layer Off"); } } } public void SNES_ToggleBG2(bool? setto = null) { - if (Global.Emulator is LibsnesCore) + if (GlobalWinF.Emulator is LibsnesCore) { if (setto.HasValue) { @@ -1722,18 +1724,18 @@ namespace BizHawk.MultiClient SyncCoreCommInputSignals(); if (Global.Config.SNES_ShowBG2_1) { - Global.OSD.AddMessage("BG 2 Layer On"); + GlobalWinF.OSD.AddMessage("BG 2 Layer On"); } else { - Global.OSD.AddMessage("BG 2 Layer Off"); + GlobalWinF.OSD.AddMessage("BG 2 Layer Off"); } } } public void SNES_ToggleBG3(bool? setto = null) { - if (Global.Emulator is LibsnesCore) + if (GlobalWinF.Emulator is LibsnesCore) { if (setto.HasValue) { @@ -1746,18 +1748,18 @@ namespace BizHawk.MultiClient SyncCoreCommInputSignals(); if (Global.Config.SNES_ShowBG3_1) { - Global.OSD.AddMessage("BG 3 Layer On"); + GlobalWinF.OSD.AddMessage("BG 3 Layer On"); } else { - Global.OSD.AddMessage("BG 3 Layer Off"); + GlobalWinF.OSD.AddMessage("BG 3 Layer Off"); } } } public void SNES_ToggleBG4(bool? setto = null) { - if (Global.Emulator is LibsnesCore) + if (GlobalWinF.Emulator is LibsnesCore) { if (setto.HasValue) { @@ -1770,18 +1772,18 @@ namespace BizHawk.MultiClient SyncCoreCommInputSignals(); if (Global.Config.SNES_ShowBG4_1) { - Global.OSD.AddMessage("BG 4 Layer On"); + GlobalWinF.OSD.AddMessage("BG 4 Layer On"); } else { - Global.OSD.AddMessage("BG 4 Layer Off"); + GlobalWinF.OSD.AddMessage("BG 4 Layer Off"); } } } public void SNES_ToggleOBJ1(bool? setto = null) { - if (Global.Emulator is LibsnesCore) + if (GlobalWinF.Emulator is LibsnesCore) { if (setto.HasValue) { @@ -1794,18 +1796,18 @@ namespace BizHawk.MultiClient SyncCoreCommInputSignals(); if (Global.Config.SNES_ShowOBJ1) { - Global.OSD.AddMessage("OBJ 1 Layer On"); + GlobalWinF.OSD.AddMessage("OBJ 1 Layer On"); } else { - Global.OSD.AddMessage("OBJ 1 Layer Off"); + GlobalWinF.OSD.AddMessage("OBJ 1 Layer Off"); } } } public void SNES_ToggleOBJ2(bool? setto = null) { - if (Global.Emulator is LibsnesCore) + if (GlobalWinF.Emulator is LibsnesCore) { if (setto.HasValue) { @@ -1818,18 +1820,18 @@ namespace BizHawk.MultiClient SyncCoreCommInputSignals(); if (Global.Config.SNES_ShowOBJ2) { - Global.OSD.AddMessage("OBJ 2 Layer On"); + GlobalWinF.OSD.AddMessage("OBJ 2 Layer On"); } else { - Global.OSD.AddMessage("OBJ 2 Layer Off"); + GlobalWinF.OSD.AddMessage("OBJ 2 Layer Off"); } } } public void SNES_ToggleOBJ3(bool? setto = null) { - if (Global.Emulator is LibsnesCore) + if (GlobalWinF.Emulator is LibsnesCore) { if (setto.HasValue) { @@ -1842,18 +1844,18 @@ namespace BizHawk.MultiClient SyncCoreCommInputSignals(); if (Global.Config.SNES_ShowOBJ3) { - Global.OSD.AddMessage("OBJ 3 Layer On"); + GlobalWinF.OSD.AddMessage("OBJ 3 Layer On"); } else { - Global.OSD.AddMessage("OBJ 3 Layer Off"); + GlobalWinF.OSD.AddMessage("OBJ 3 Layer Off"); } } } public void SNES_ToggleOBJ4(bool? setto = null) { - if (Global.Emulator is LibsnesCore) + if (GlobalWinF.Emulator is LibsnesCore) { if (setto.HasValue) { @@ -1866,11 +1868,11 @@ namespace BizHawk.MultiClient SyncCoreCommInputSignals(); if (Global.Config.SNES_ShowOBJ4) { - Global.OSD.AddMessage("OBJ 4 Layer On"); + GlobalWinF.OSD.AddMessage("OBJ 4 Layer On"); } else { - Global.OSD.AddMessage("OBJ 4 Layer Off"); + GlobalWinF.OSD.AddMessage("OBJ 4 Layer Off"); } } } @@ -2120,7 +2122,7 @@ namespace BizHawk.MultiClient { var ofd = new OpenFileDialog { - InitialDirectory = PathManager.GetRomsPath(Global.Emulator.SystemId), + InitialDirectory = PathManager.GetRomsPath(GlobalWinF.Emulator.SystemId), Multiselect = true, Filter = FormatFilter( "Movie Files", "*.fm2;*.mc2;*.mcm;*.mmv;*.gmv;*.vbm;*.lsmv;*.fcm;*.fmv;*.vmv;*.nmv;*.smv;*.zmv;", @@ -2140,9 +2142,9 @@ namespace BizHawk.MultiClient RestoreDirectory = false }; - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = ofd.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result != DialogResult.OK) return; @@ -2187,7 +2189,7 @@ namespace BizHawk.MultiClient } else if (ext.ToUpper() == ".CHT") { - Global.CheatList.Load(filePaths[0], false); + GlobalWinF.CheatList.Load(filePaths[0], false); LoadCheatsWindow(); } else if (ext.ToUpper() == ".WCH") @@ -2225,7 +2227,7 @@ namespace BizHawk.MultiClient m.WriteMovie(); StartNewMovie(m, false); } - Global.OSD.AddMessage(warningMsg); + GlobalWinF.OSD.AddMessage(warningMsg); } else LoadRom(filePaths[0]); @@ -2258,12 +2260,12 @@ namespace BizHawk.MultiClient private void createDualGBXMLToolStripMenuItem_Click(object sender, EventArgs e) { - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); using (var dlg = new GBtools.DualGBXMLCreator()) { dlg.ShowDialog(this); } - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); } private void tempN64PluginControlToolStripMenuItem_Click(object sender, EventArgs e) @@ -2271,11 +2273,11 @@ namespace BizHawk.MultiClient var result = new N64VideoPluginconfig().ShowDialog(); if (result == DialogResult.OK) { - Global.OSD.AddMessage("Plugin settings saved"); + GlobalWinF.OSD.AddMessage("Plugin settings saved"); } else { - Global.OSD.AddMessage("Plugin settings aborted"); + GlobalWinF.OSD.AddMessage("Plugin settings aborted"); } } @@ -2309,7 +2311,7 @@ namespace BizHawk.MultiClient private void preferencesToolStripMenuItem_Click(object sender, EventArgs e) { - using (var dlg = new SATTools.SaturnPrefs()) + using (var dlg = new SaturnPrefs()) { var result = dlg.ShowDialog(this); if (result == DialogResult.OK) @@ -2361,9 +2363,9 @@ namespace BizHawk.MultiClient private void changeDMGPalettesToolStripMenuItem_Click(object sender, EventArgs e) { - if (Global.Emulator is Gameboy) + if (GlobalWinF.Emulator is Gameboy) { - var g = Global.Emulator as Gameboy; + var g = GlobalWinF.Emulator as Gameboy; if (g.IsCGBMode()) { if (GBtools.CGBColorChooserForm.DoCGBColorChooserFormDialog(this)) @@ -2390,7 +2392,7 @@ namespace BizHawk.MultiClient private void sNESToolStripMenuItem_DropDownOpened(object sender, EventArgs e) { - if ((Global.Emulator as LibsnesCore).IsSGB) + if ((GlobalWinF.Emulator as LibsnesCore).IsSGB) { loadGBInSGBToolStripMenuItem.Visible = true; loadGBInSGBToolStripMenuItem.Checked = Global.Config.GB_AsSGB; @@ -2412,7 +2414,7 @@ namespace BizHawk.MultiClient private void MainForm_Resize(object sender, EventArgs e) { - Global.RenderPanel.Resized = true; + GlobalWinF.RenderPanel.Resized = true; } private void backupSaveramToolStripMenuItem_Click(object sender, EventArgs e) @@ -2420,11 +2422,11 @@ namespace BizHawk.MultiClient Global.Config.BackupSaveram ^= true; if (Global.Config.BackupSaveram) { - Global.OSD.AddMessage("Backup saveram enabled"); + GlobalWinF.OSD.AddMessage("Backup saveram enabled"); } else { - Global.OSD.AddMessage("Backup saveram disabled"); + GlobalWinF.OSD.AddMessage("Backup saveram disabled"); } } @@ -2447,13 +2449,13 @@ namespace BizHawk.MultiClient private void showClippedRegionsToolStripMenuItem_Click(object sender, EventArgs e) { Global.Config.GGShowClippedRegions ^= true; - Global.CoreComm.GG_ShowClippedRegions = Global.Config.GGShowClippedRegions; + GlobalWinF.CoreComm.GG_ShowClippedRegions = Global.Config.GGShowClippedRegions; } private void highlightActiveDisplayRegionToolStripMenuItem_Click(object sender, EventArgs e) { Global.Config.GGHighlightActiveDisplayRegion ^= true; - Global.CoreComm.GG_HighlightActiveDisplayRegion = Global.Config.GGHighlightActiveDisplayRegion; + GlobalWinF.CoreComm.GG_HighlightActiveDisplayRegion = Global.Config.GGHighlightActiveDisplayRegion; } private void saveMovieToolStripMenuItem_Click(object sender, EventArgs e) @@ -2615,14 +2617,14 @@ namespace BizHawk.MultiClient { try { - (Global.Emulator as TI83).LinkPort.SendFileToCalc(File.OpenRead(OFD.FileName), true); + (GlobalWinF.Emulator as TI83).LinkPort.SendFileToCalc(File.OpenRead(OFD.FileName), true); } catch (IOException ex) { string Message = string.Format("Invalid file format. Reason: {0} \nForce transfer? This may cause the calculator to crash.", ex.Message); if (MessageBox.Show(Message, "Upload Failed", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) - (Global.Emulator as TI83).LinkPort.SendFileToCalc(File.OpenRead(OFD.FileName), false); + (GlobalWinF.Emulator as TI83).LinkPort.SendFileToCalc(File.OpenRead(OFD.FileName), false); } } } diff --git a/BizHawk.MultiClient/MainForm.Movie.cs b/BizHawk.MultiClient/MainForm.Movie.cs index cab9360910..5152900f60 100644 --- a/BizHawk.MultiClient/MainForm.Movie.cs +++ b/BizHawk.MultiClient/MainForm.Movie.cs @@ -2,6 +2,8 @@ using System.IO; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { partial class MainForm @@ -10,70 +12,70 @@ namespace BizHawk.MultiClient public void ClearFrame() { - if (Global.MovieSession.Movie.IsPlaying) + if (GlobalWinF.MovieSession.Movie.IsPlaying) { - Global.MovieSession.Movie.ClearFrame(Global.Emulator.Frame); - Global.OSD.AddMessage("Scrubbed input at frame " + Global.Emulator.Frame.ToString()); + GlobalWinF.MovieSession.Movie.ClearFrame(GlobalWinF.Emulator.Frame); + GlobalWinF.OSD.AddMessage("Scrubbed input at frame " + GlobalWinF.Emulator.Frame.ToString()); } } public void StartNewMovie(Movie m, bool record) { //If a movie is already loaded, save it before starting a new movie - if (Global.MovieSession.Movie.IsActive) + if (GlobalWinF.MovieSession.Movie.IsActive) { - Global.MovieSession.Movie.WriteMovie(); + GlobalWinF.MovieSession.Movie.WriteMovie(); } - Global.MovieSession = new MovieSession {Movie = m}; + GlobalWinF.MovieSession = new MovieSession {Movie = m}; RewireInputChain(); if (!record) { - Global.MovieSession.Movie.LoadMovie(); + GlobalWinF.MovieSession.Movie.LoadMovie(); SetSyncDependentSettings(); } - LoadRom(Global.MainForm.CurrentlyOpenRom, true, !record); + LoadRom(GlobalWinF.MainForm.CurrentlyOpenRom, true, !record); Global.Config.RecentMovies.Add(m.Filename); - if (Global.MovieSession.Movie.StartsFromSavestate) + if (GlobalWinF.MovieSession.Movie.StartsFromSavestate) { - LoadStateFile(Global.MovieSession.Movie.Filename, Path.GetFileName(Global.MovieSession.Movie.Filename)); - Global.Emulator.ResetFrameCounter(); + LoadStateFile(GlobalWinF.MovieSession.Movie.Filename, Path.GetFileName(GlobalWinF.MovieSession.Movie.Filename)); + GlobalWinF.Emulator.ResetFrameCounter(); } if (record) { - Global.MovieSession.Movie.StartRecording(); + GlobalWinF.MovieSession.Movie.StartRecording(); ReadOnly = false; } else { - Global.MovieSession.Movie.StartPlayback(); + GlobalWinF.MovieSession.Movie.StartPlayback(); } SetMainformMovieInfo(); TAStudio1.Restart(); VirtualPadForm1.Restart(); - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; } public void SetMainformMovieInfo() { - if (Global.MovieSession.Movie.IsPlaying) + if (GlobalWinF.MovieSession.Movie.IsPlaying) { - Text = DisplayNameForSystem(Global.Game.System) + " - " + Global.Game.Name + " - " + Path.GetFileName(Global.MovieSession.Movie.Filename); + Text = DisplayNameForSystem(Global.Game.System) + " - " + Global.Game.Name + " - " + Path.GetFileName(GlobalWinF.MovieSession.Movie.Filename); PlayRecordStatus.Image = Properties.Resources.Play; PlayRecordStatus.ToolTipText = "Movie is in playback mode"; PlayRecordStatus.Visible = true; } - else if (Global.MovieSession.Movie.IsRecording) + else if (GlobalWinF.MovieSession.Movie.IsRecording) { - Text = DisplayNameForSystem(Global.Game.System) + " - " + Global.Game.Name + " - " + Path.GetFileName(Global.MovieSession.Movie.Filename); + Text = DisplayNameForSystem(Global.Game.System) + " - " + Global.Game.Name + " - " + Path.GetFileName(GlobalWinF.MovieSession.Movie.Filename); PlayRecordStatus.Image = Properties.Resources.RecordHS; PlayRecordStatus.ToolTipText = "Movie is in record mode"; PlayRecordStatus.Visible = true; } - else if (!Global.MovieSession.Movie.IsActive) + else if (!GlobalWinF.MovieSession.Movie.IsActive) { Text = DisplayNameForSystem(Global.Game.System) + " - " + Global.Game.Name; PlayRecordStatus.Image = Properties.Resources.Blank; @@ -90,10 +92,10 @@ namespace BizHawk.MultiClient public void RecordMovie() { // put any BEETA quality cores here - if (Global.Emulator is Emulation.Consoles.Nintendo.GBA.GBA || - Global.Emulator is Emulation.Consoles.Sega.Genesis || - Global.Emulator is Emulation.Consoles.Sega.Saturn.Yabause || - Global.Emulator is Emulation.Consoles.Sony.PSP.PSP) + if (GlobalWinF.Emulator is Emulation.Consoles.Nintendo.GBA.GBA || + GlobalWinF.Emulator is Emulation.Consoles.Sega.Genesis || + GlobalWinF.Emulator is Emulation.Consoles.Sega.Saturn.Yabause || + GlobalWinF.Emulator is Emulation.Consoles.Sony.PSP.PSP) { var result = MessageBox.Show (this, "Thanks for using Bizhawk! The emulation core you have selected " + @@ -108,44 +110,44 @@ namespace BizHawk.MultiClient public void PlayMovieFromBeginning() { - if (Global.MovieSession.Movie.IsActive) + if (GlobalWinF.MovieSession.Movie.IsActive) { LoadRom(CurrentlyOpenRom, true, true); - if (Global.MovieSession.Movie.StartsFromSavestate) + if (GlobalWinF.MovieSession.Movie.StartsFromSavestate) { - LoadStateFile(Global.MovieSession.Movie.Filename, Path.GetFileName(Global.MovieSession.Movie.Filename)); - Global.Emulator.ResetFrameCounter(); + LoadStateFile(GlobalWinF.MovieSession.Movie.Filename, Path.GetFileName(GlobalWinF.MovieSession.Movie.Filename)); + GlobalWinF.Emulator.ResetFrameCounter(); } - Global.MovieSession.Movie.StartPlayback(); + GlobalWinF.MovieSession.Movie.StartPlayback(); SetMainformMovieInfo(); - Global.OSD.AddMessage("Replaying movie file in read-only mode"); - Global.MainForm.ReadOnly = true; + GlobalWinF.OSD.AddMessage("Replaying movie file in read-only mode"); + GlobalWinF.MainForm.ReadOnly = true; } } public void StopMovie(bool abortchanges = false) { string message = "Movie "; - if (Global.MovieSession.Movie.IsRecording) + if (GlobalWinF.MovieSession.Movie.IsRecording) { message += "recording "; } - else if (Global.MovieSession.Movie.IsPlaying) + else if (GlobalWinF.MovieSession.Movie.IsPlaying) { message += "playback "; } message += "stopped."; - if (Global.MovieSession.Movie.IsActive) + if (GlobalWinF.MovieSession.Movie.IsActive) { - Global.MovieSession.Movie.Stop(abortchanges); + GlobalWinF.MovieSession.Movie.Stop(abortchanges); if (!abortchanges) { - Global.OSD.AddMessage(Path.GetFileName(Global.MovieSession.Movie.Filename) + " written to disk."); + GlobalWinF.OSD.AddMessage(Path.GetFileName(GlobalWinF.MovieSession.Movie.Filename) + " written to disk."); } - Global.OSD.AddMessage(message); - Global.MainForm.ReadOnly = true; + GlobalWinF.OSD.AddMessage(message); + GlobalWinF.MainForm.ReadOnly = true; SetMainformMovieInfo(); } } @@ -161,44 +163,44 @@ namespace BizHawk.MultiClient private bool HandleMovieLoadState(StreamReader reader) { //Note, some of the situations in these IF's may be identical and could be combined but I intentionally separated it out for clarity - if (!Global.MovieSession.Movie.IsActive) + if (!GlobalWinF.MovieSession.Movie.IsActive) { return true; } - else if (Global.MovieSession.Movie.IsRecording) + else if (GlobalWinF.MovieSession.Movie.IsRecording) { if (ReadOnly) { - if (!Global.MovieSession.Movie.CheckTimeLines(reader, false)) + if (!GlobalWinF.MovieSession.Movie.CheckTimeLines(reader, false)) { return false; //Timeline/GUID error } else { - Global.MovieSession.Movie.WriteMovie(); - Global.MovieSession.Movie.SwitchToPlay(); + GlobalWinF.MovieSession.Movie.WriteMovie(); + GlobalWinF.MovieSession.Movie.SwitchToPlay(); SetMainformMovieInfo(); } } else { - if (!Global.MovieSession.Movie.CheckTimeLines(reader, true)) + if (!GlobalWinF.MovieSession.Movie.CheckTimeLines(reader, true)) { return false; //GUID Error } reader.BaseStream.Position = 0; reader.DiscardBufferedData(); - Global.MovieSession.Movie.LoadLogFromSavestateText(reader); + GlobalWinF.MovieSession.Movie.LoadLogFromSavestateText(reader); } } - else if (Global.MovieSession.Movie.IsPlaying && !Global.MovieSession.Movie.IsFinished) + else if (GlobalWinF.MovieSession.Movie.IsPlaying && !GlobalWinF.MovieSession.Movie.IsFinished) { if (ReadOnly) { - if (!Global.MovieSession.Movie.CheckTimeLines(reader, false)) + if (!GlobalWinF.MovieSession.Movie.CheckTimeLines(reader, false)) { return false; //Timeline/GUID error } @@ -206,33 +208,33 @@ namespace BizHawk.MultiClient } else { - if (!Global.MovieSession.Movie.CheckTimeLines(reader, true)) + if (!GlobalWinF.MovieSession.Movie.CheckTimeLines(reader, true)) { return false; //GUID Error } - Global.MovieSession.Movie.SwitchToRecord(); + GlobalWinF.MovieSession.Movie.SwitchToRecord(); SetMainformMovieInfo(); reader.BaseStream.Position = 0; reader.DiscardBufferedData(); - Global.MovieSession.Movie.LoadLogFromSavestateText(reader); + GlobalWinF.MovieSession.Movie.LoadLogFromSavestateText(reader); } } - else if (Global.MovieSession.Movie.IsFinished) + else if (GlobalWinF.MovieSession.Movie.IsFinished) { if (ReadOnly) { { - if (!Global.MovieSession.Movie.CheckTimeLines(reader, false)) + if (!GlobalWinF.MovieSession.Movie.CheckTimeLines(reader, false)) { return false; //Timeline/GUID error } - else if (Global.MovieSession.Movie.IsFinished) //TimeLine check can change a movie to finished, hence the check here (not a good design) + else if (GlobalWinF.MovieSession.Movie.IsFinished) //TimeLine check can change a movie to finished, hence the check here (not a good design) { - Global.MovieSession.LatchInputFromPlayer(Global.MovieInputSourceAdapter); + GlobalWinF.MovieSession.LatchInputFromPlayer(GlobalWinF.MovieInputSourceAdapter); } else { - Global.MovieSession.Movie.SwitchToPlay(); + GlobalWinF.MovieSession.Movie.SwitchToPlay(); SetMainformMovieInfo(); } } @@ -240,17 +242,17 @@ namespace BizHawk.MultiClient else { { - if (!Global.MovieSession.Movie.CheckTimeLines(reader, true)) + if (!GlobalWinF.MovieSession.Movie.CheckTimeLines(reader, true)) { return false; //GUID Error } else { - Global.MovieSession.Movie.StartRecording(); + GlobalWinF.MovieSession.Movie.StartRecording(); SetMainformMovieInfo(); reader.BaseStream.Position = 0; reader.DiscardBufferedData(); - Global.MovieSession.Movie.LoadLogFromSavestateText(reader); + GlobalWinF.MovieSession.Movie.LoadLogFromSavestateText(reader); } } } @@ -260,98 +262,98 @@ namespace BizHawk.MultiClient private void HandleMovieSaveState(StreamWriter writer) { - if (Global.MovieSession.Movie.IsActive) + if (GlobalWinF.MovieSession.Movie.IsActive) { - Global.MovieSession.Movie.DumpLogIntoSavestateText(writer); + GlobalWinF.MovieSession.Movie.DumpLogIntoSavestateText(writer); } } private void HandleMovieOnFrameLoop() { - if (!Global.MovieSession.Movie.IsActive) + if (!GlobalWinF.MovieSession.Movie.IsActive) { - Global.MovieSession.LatchInputFromPlayer(Global.MovieInputSourceAdapter); + GlobalWinF.MovieSession.LatchInputFromPlayer(GlobalWinF.MovieInputSourceAdapter); } - else if (Global.MovieSession.Movie.IsFinished) + else if (GlobalWinF.MovieSession.Movie.IsFinished) { - if (Global.Emulator.Frame < Global.MovieSession.Movie.Frames) //This scenario can happen from rewinding (suddenly we are back in the movie, so hook back up to the movie + if (GlobalWinF.Emulator.Frame < GlobalWinF.MovieSession.Movie.Frames) //This scenario can happen from rewinding (suddenly we are back in the movie, so hook back up to the movie { - Global.MovieSession.Movie.SwitchToPlay(); - Global.MovieSession.LatchInputFromLog(); + GlobalWinF.MovieSession.Movie.SwitchToPlay(); + GlobalWinF.MovieSession.LatchInputFromLog(); } else { - Global.MovieSession.LatchInputFromPlayer(Global.MovieInputSourceAdapter); + GlobalWinF.MovieSession.LatchInputFromPlayer(GlobalWinF.MovieInputSourceAdapter); } } - else if (Global.MovieSession.Movie.IsPlaying) + else if (GlobalWinF.MovieSession.Movie.IsPlaying) { - if (Global.Emulator.Frame >= Global.MovieSession.Movie.Frames) + if (GlobalWinF.Emulator.Frame >= GlobalWinF.MovieSession.Movie.Frames) { if (TAStudio1.IsHandleCreated && !TAStudio1.IsDisposed) { - Global.MovieSession.Movie.CaptureState(); - Global.MovieSession.LatchInputFromLog(); - Global.MovieSession.Movie.CommitFrame(Global.Emulator.Frame, Global.MovieOutputHardpoint); + GlobalWinF.MovieSession.Movie.CaptureState(); + GlobalWinF.MovieSession.LatchInputFromLog(); + GlobalWinF.MovieSession.Movie.CommitFrame(GlobalWinF.Emulator.Frame, GlobalWinF.MovieOutputHardpoint); } else { - Global.MovieSession.Movie.Finish(); + GlobalWinF.MovieSession.Movie.Finish(); } } else { - Global.MovieSession.Movie.CaptureState(); - Global.MovieSession.LatchInputFromLog(); - if (Global.ClientControls["ClearFrame"]) + GlobalWinF.MovieSession.Movie.CaptureState(); + GlobalWinF.MovieSession.LatchInputFromLog(); + if (GlobalWinF.ClientControls["ClearFrame"]) { - Global.MovieSession.LatchInputFromPlayer(Global.MovieInputSourceAdapter); + GlobalWinF.MovieSession.LatchInputFromPlayer(GlobalWinF.MovieInputSourceAdapter); ClearFrame(); } else if (TAStudio1.IsHandleCreated && !TAStudio1.IsDisposed || Global.Config.MoviePlaybackPokeMode) { - Global.MovieSession.LatchInputFromPlayer(Global.MovieInputSourceAdapter); + GlobalWinF.MovieSession.LatchInputFromPlayer(GlobalWinF.MovieInputSourceAdapter); MnemonicsGenerator mg = new MnemonicsGenerator(); - mg.SetSource( Global.MovieOutputHardpoint); + mg.SetSource( GlobalWinF.MovieOutputHardpoint); if (!mg.IsEmpty) { - Global.MovieSession.LatchInputFromPlayer(Global.MovieInputSourceAdapter); - Global.MovieSession.Movie.PokeFrame(Global.Emulator.Frame, mg.GetControllersAsMnemonic()); + GlobalWinF.MovieSession.LatchInputFromPlayer(GlobalWinF.MovieInputSourceAdapter); + GlobalWinF.MovieSession.Movie.PokeFrame(GlobalWinF.Emulator.Frame, mg.GetControllersAsMnemonic()); } else { - Global.MovieSession.LatchInputFromLog(); + GlobalWinF.MovieSession.LatchInputFromLog(); } } } } - else if (Global.MovieSession.Movie.IsRecording) + else if (GlobalWinF.MovieSession.Movie.IsRecording) { - Global.MovieSession.Movie.CaptureState(); - if (Global.MovieSession.MultiTrack.IsActive) + GlobalWinF.MovieSession.Movie.CaptureState(); + if (GlobalWinF.MovieSession.MultiTrack.IsActive) { - Global.MovieSession.LatchMultitrackPlayerInput(Global.MovieInputSourceAdapter, Global.MultitrackRewiringControllerAdapter); + GlobalWinF.MovieSession.LatchMultitrackPlayerInput(GlobalWinF.MovieInputSourceAdapter, GlobalWinF.MultitrackRewiringControllerAdapter); } else { - Global.MovieSession.LatchInputFromPlayer(Global.MovieInputSourceAdapter); + GlobalWinF.MovieSession.LatchInputFromPlayer(GlobalWinF.MovieInputSourceAdapter); } //the movie session makes sure that the correct input has been read and merged to its MovieControllerAdapter; //this has been wired to Global.MovieOutputHardpoint in RewireInputChain - Global.MovieSession.Movie.CommitFrame(Global.Emulator.Frame, Global.MovieOutputHardpoint); + GlobalWinF.MovieSession.Movie.CommitFrame(GlobalWinF.Emulator.Frame, GlobalWinF.MovieOutputHardpoint); } } //On movie load, these need to be set based on the contents of the movie file private void SetSyncDependentSettings() { - switch (Global.Emulator.SystemId) + switch (GlobalWinF.Emulator.SystemId) { case "Coleco": - string str = Global.MovieSession.Movie.Header.GetHeaderLine(MovieHeader.SKIPBIOS); + string str = GlobalWinF.MovieSession.Movie.Header.GetHeaderLine(MovieHeader.SKIPBIOS); if (!String.IsNullOrWhiteSpace(str)) { if (str.ToLower() == "true") diff --git a/BizHawk.MultiClient/MainForm.Rewind.cs b/BizHawk.MultiClient/MainForm.Rewind.cs index 78192592fb..c0664adc7f 100644 --- a/BizHawk.MultiClient/MainForm.Rewind.cs +++ b/BizHawk.MultiClient/MainForm.Rewind.cs @@ -4,6 +4,8 @@ using System.Threading; using System.Collections.Generic; using System.Collections.Concurrent; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class MainForm @@ -388,9 +390,9 @@ namespace BizHawk.MultiClient //log a frame - if (LastState != null && Global.Emulator.Frame % RewindFrequency == 0) + if (LastState != null && GlobalWinF.Emulator.Frame % RewindFrequency == 0) { - byte[] CurrentState = Global.Emulator.SaveStateBinary(); + byte[] CurrentState = GlobalWinF.Emulator.SaveStateBinary(); RewindThread.Capture(CurrentState); } } @@ -399,12 +401,12 @@ namespace BizHawk.MultiClient { if (RewindActive != enabled) { - Global.OSD.AddMessage("Rewind " + (enabled ? "Enabled" : "Disabled")); + GlobalWinF.OSD.AddMessage("Rewind " + (enabled ? "Enabled" : "Disabled")); } if (RewindFrequency != frequency && enabled) { - Global.OSD.AddMessage("Rewind frequency set to " + frequency); + GlobalWinF.OSD.AddMessage("Rewind frequency set to " + frequency); } RewindActive = enabled; @@ -417,7 +419,7 @@ namespace BizHawk.MultiClient public void DoRewindSettings() { // This is the first frame. Capture the state, and put it in LastState for future deltas to be compared against. - LastState = Global.Emulator.SaveStateBinary(); + LastState = GlobalWinF.Emulator.SaveStateBinary(); int state_size = 0; if (LastState.Length >= Global.Config.Rewind_LargeStateSize) @@ -570,7 +572,7 @@ namespace BizHawk.MultiClient bool fullstate = reader.ReadBoolean(); if (fullstate) { - Global.Emulator.LoadStateBinary(reader); + GlobalWinF.Emulator.LoadStateBinary(reader); } else { @@ -588,7 +590,7 @@ namespace BizHawk.MultiClient } reader.Close(); output.Position = 0; - Global.Emulator.LoadStateBinary(new BinaryReader(output)); + GlobalWinF.Emulator.LoadStateBinary(new BinaryReader(output)); } } @@ -601,7 +603,7 @@ namespace BizHawk.MultiClient { for (int i = 0; i < frames; i++) { - if (RewindBuf.Count == 0 || (Global.MovieSession.Movie.Loaded && 0 == Global.MovieSession.Movie.Frames)) + if (RewindBuf.Count == 0 || (GlobalWinF.MovieSession.Movie.Loaded && 0 == GlobalWinF.MovieSession.Movie.Frames)) return; if (LastState.Length < 0x10000) diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index dc730ac94f..fbfb122975 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -22,6 +22,8 @@ using BizHawk.Emulation.Consoles.Nintendo.SNES; using BizHawk.Emulation.Consoles.Sega; using BizHawk.Emulation.Consoles.TurboGrafx; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class MainForm : Form @@ -136,7 +138,7 @@ namespace BizHawk.MultiClient public void Cheats_Restart() { if (_cheats != null) _cheats.Restart(); - else Global.CheatList.NewList(); + else GlobalWinF.CheatList.NewList(); } #if WINDOWS @@ -158,7 +160,7 @@ namespace BizHawk.MultiClient public MainForm(string[] args) { - Global.MovieSession = new MovieSession { Movie = new Movie() }; + GlobalWinF.MovieSession = new MovieSession { Movie = new Movie() }; MainWait = new AutoResetEvent(false); Icon = Properties.Resources.logo; InitializeComponent(); @@ -174,7 +176,7 @@ namespace BizHawk.MultiClient FFMpeg.FFMpegPath = PathManager.MakeProgramRelativePath(Global.Config.FFMpegPath); - Global.CheatList = new CheatList(); + GlobalWinF.CheatList = new CheatList(); UpdateStatusSlots(); UpdateKeyPriorityIcon(); @@ -185,7 +187,7 @@ namespace BizHawk.MultiClient using (HawkFile NesCartFile = new HawkFile(Path.Combine(PathManager.GetExeDirectoryAbsolute(), "gamedb", "NesCarts.7z")).BindFirst()) return Util.ReadAllBytes(NesCartFile.GetStream()); }; - Global.MainForm = this; + GlobalWinF.MainForm = this; //Global.CoreComm = new CoreComm(); //SyncCoreCommInputSignals(); @@ -202,38 +204,38 @@ namespace BizHawk.MultiClient Closing += (o, e) => { - Global.CheatList.SaveOnClose(); + GlobalWinF.CheatList.SaveOnClose(); CloseGame(); - Global.MovieSession.Movie.Stop(); + GlobalWinF.MovieSession.Movie.Stop(); CloseTools(); SaveConfig(); }; ResizeBegin += (o, e) => { - if (Global.Sound != null) Global.Sound.StopSound(); + if (GlobalWinF.Sound != null) GlobalWinF.Sound.StopSound(); }; ResizeEnd += (o, e) => { - if (Global.RenderPanel != null) Global.RenderPanel.Resized = true; - if (Global.Sound != null) Global.Sound.StartSound(); + if (GlobalWinF.RenderPanel != null) GlobalWinF.RenderPanel.Resized = true; + if (GlobalWinF.Sound != null) GlobalWinF.Sound.StartSound(); }; Input.Initialize(); InitControls(); - Global.CoreComm = new CoreComm(); + GlobalWinF.CoreComm = new CoreComm(); SyncCoreCommInputSignals(); - Global.Emulator = new NullEmulator(Global.CoreComm); - Global.ActiveController = Global.NullControls; - Global.AutoFireController = Global.AutofireNullControls; - Global.AutofireStickyXORAdapter.SetOnOffPatternFromConfig(); + GlobalWinF.Emulator = new NullEmulator(GlobalWinF.CoreComm); + GlobalWinF.ActiveController = GlobalWinF.NullControls; + GlobalWinF.AutoFireController = GlobalWinF.AutofireNullControls; + GlobalWinF.AutofireStickyXORAdapter.SetOnOffPatternFromConfig(); #if WINDOWS - Global.Sound = new Sound(Handle, Global.DSound); + GlobalWinF.Sound = new Sound(Handle, GlobalWinF.DSound); #else Global.Sound = new Sound(); #endif - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); RewireInputChain(); //TODO - replace this with some kind of standard dictionary-yielding parser in a separate component string cmdRom = null; @@ -348,23 +350,23 @@ namespace BizHawk.MultiClient { LoadCheatsWindow(); } - if (Global.Config.AutoLoadNESPPU && Global.Emulator is NES) + if (Global.Config.AutoLoadNESPPU && GlobalWinF.Emulator is NES) { LoadNESPPU(); } - if (Global.Config.AutoLoadNESNameTable && Global.Emulator is NES) + if (Global.Config.AutoLoadNESNameTable && GlobalWinF.Emulator is NES) { LoadNESNameTable(); } - if (Global.Config.AutoLoadNESDebugger && Global.Emulator is NES) + if (Global.Config.AutoLoadNESDebugger && GlobalWinF.Emulator is NES) { LoadNESDebugger(); } - if (Global.Config.NESGGAutoload && Global.Emulator is NES) + if (Global.Config.NESGGAutoload && GlobalWinF.Emulator is NES) { LoadGameGenieEC(); } - if (Global.Config.AutoLoadGBGPUView && Global.Emulator is Gameboy) + if (Global.Config.AutoLoadGBGPUView && GlobalWinF.Emulator is Gameboy) { LoadGBGPUView(); } @@ -380,17 +382,17 @@ namespace BizHawk.MultiClient { OpenLuaConsole(); } - if (Global.Config.PCEBGViewerAutoload && Global.Emulator is PCEngine) + if (Global.Config.PCEBGViewerAutoload && GlobalWinF.Emulator is PCEngine) { LoadPCEBGViewer(); } - if (Global.Config.AutoLoadSNESGraphicsDebugger && Global.Emulator is LibsnesCore) + if (Global.Config.AutoLoadSNESGraphicsDebugger && GlobalWinF.Emulator is LibsnesCore) { LoadSNESGraphicsDebugger(); } if (Global.Config.TraceLoggerAutoLoad) { - if (Global.CoreComm.CpuTraceAvailable) + if (GlobalWinF.CoreComm.CpuTraceAvailable) { LoadTraceLogger(); } @@ -431,7 +433,7 @@ namespace BizHawk.MultiClient renderTarget.Paint += (o, e) => { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; }; } @@ -441,8 +443,8 @@ namespace BizHawk.MultiClient /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { - if (Global.DisplayManager != null) Global.DisplayManager.Dispose(); - Global.DisplayManager = null; + if (GlobalWinF.DisplayManager != null) GlobalWinF.DisplayManager.Dispose(); + GlobalWinF.DisplayManager = null; if (disposing && (components != null)) { @@ -538,15 +540,15 @@ namespace BizHawk.MultiClient public void SyncCoreCommInputSignals() { - SyncCoreCommInputSignals(Global.CoreComm); + SyncCoreCommInputSignals(GlobalWinF.CoreComm); } void SyncPresentationMode() { - Global.DisplayManager.Suspend(); + GlobalWinF.DisplayManager.Suspend(); #if WINDOWS - bool gdi = Global.Config.DisplayGDI || Global.Direct3D == null; + bool gdi = Global.Config.DisplayGDI || GlobalWinF.Direct3D == null; #endif if (renderTarget != null) { @@ -555,7 +557,7 @@ namespace BizHawk.MultiClient } if (retainedPanel != null) retainedPanel.Dispose(); - if (Global.RenderPanel != null) Global.RenderPanel.Dispose(); + if (GlobalWinF.RenderPanel != null) GlobalWinF.RenderPanel.Dispose(); #if WINDOWS if (gdi) @@ -574,7 +576,7 @@ namespace BizHawk.MultiClient if (gdi) { #endif - Global.RenderPanel = new SysdrawingRenderPanel(retainedPanel); + GlobalWinF.RenderPanel = new SysdrawingRenderPanel(retainedPanel); retainedPanel.ActivateThreaded(); #if WINDOWS } @@ -582,33 +584,33 @@ namespace BizHawk.MultiClient { try { - var d3dPanel = new Direct3DRenderPanel(Global.Direct3D, renderTarget); + var d3dPanel = new Direct3DRenderPanel(GlobalWinF.Direct3D, renderTarget); d3dPanel.CreateDevice(); - Global.RenderPanel = d3dPanel; + GlobalWinF.RenderPanel = d3dPanel; } catch { Program.DisplayDirect3DError(); - Global.Direct3D.Dispose(); - Global.Direct3D = null; + GlobalWinF.Direct3D.Dispose(); + GlobalWinF.Direct3D = null; SyncPresentationMode(); } } #endif - Global.DisplayManager.Resume(); + GlobalWinF.DisplayManager.Resume(); } void SyncThrottle() { - bool fastforward = Global.ClientControls["Fast Forward"] || FastForward; - bool superfastforward = Global.ClientControls["Turbo"]; - Global.ForceNoThrottle = unthrottled || fastforward; + bool fastforward = GlobalWinF.ClientControls["Fast Forward"] || FastForward; + bool superfastforward = GlobalWinF.ClientControls["Turbo"]; + GlobalWinF.ForceNoThrottle = unthrottled || fastforward; // realtime throttle is never going to be so exact that using a double here is wrong - throttle.SetCoreFps(Global.Emulator.CoreComm.VsyncRate); + throttle.SetCoreFps(GlobalWinF.Emulator.CoreComm.VsyncRate); - throttle.signal_paused = EmulatorPaused || Global.Emulator is NullEmulator; + throttle.signal_paused = EmulatorPaused || GlobalWinF.Emulator is NullEmulator; throttle.signal_unthrottle = unthrottled || superfastforward; if (fastforward) @@ -626,14 +628,14 @@ namespace BizHawk.MultiClient { Global.Config.SpeedPercentAlternate = value; SyncThrottle(); - Global.OSD.AddMessage("Alternate Speed: " + value + "%"); + GlobalWinF.OSD.AddMessage("Alternate Speed: " + value + "%"); } void SetSpeedPercent(int value) { Global.Config.SpeedPercent = value; SyncThrottle(); - Global.OSD.AddMessage("Speed: " + value + "%"); + GlobalWinF.OSD.AddMessage("Speed: " + value + "%"); } public void ProgramRunLoop() @@ -646,20 +648,20 @@ namespace BizHawk.MultiClient Input.Instance.Update(); //handle events and dispatch as a hotkey action, or a hotkey button, or an input button ProcessInput(); - Global.ClientControls.LatchFromPhysical(Global.HotkeyCoalescer); - Global.ActiveController.LatchFromPhysical(Global.ControllerInputCoalescer); + GlobalWinF.ClientControls.LatchFromPhysical(GlobalWinF.HotkeyCoalescer); + GlobalWinF.ActiveController.LatchFromPhysical(GlobalWinF.ControllerInputCoalescer); - Global.ActiveController.OR_FromLogical(Global.ClickyVirtualPadController); - Global.AutoFireController.LatchFromPhysical(Global.ControllerInputCoalescer); + GlobalWinF.ActiveController.OR_FromLogical(GlobalWinF.ClickyVirtualPadController); + GlobalWinF.AutoFireController.LatchFromPhysical(GlobalWinF.ControllerInputCoalescer); - if (Global.ClientControls["Autohold"]) + if (GlobalWinF.ClientControls["Autohold"]) { - Global.StickyXORAdapter.MassToggleStickyState(Global.ActiveController.PressedButtons); - Global.AutofireStickyXORAdapter.MassToggleStickyState(Global.AutoFireController.PressedButtons); + GlobalWinF.StickyXORAdapter.MassToggleStickyState(GlobalWinF.ActiveController.PressedButtons); + GlobalWinF.AutofireStickyXORAdapter.MassToggleStickyState(GlobalWinF.AutoFireController.PressedButtons); } - else if (Global.ClientControls["Autofire"]) + else if (GlobalWinF.ClientControls["Autofire"]) { - Global.AutofireStickyXORAdapter.MassToggleStickyState(Global.ActiveController.PressedButtons); + GlobalWinF.AutofireStickyXORAdapter.MassToggleStickyState(GlobalWinF.ActiveController.PressedButtons); } //if (!EmulatorPaused) @@ -673,7 +675,7 @@ namespace BizHawk.MultiClient //if(!IsNullEmulator()) StepRunLoop_Throttle(); - if (Global.DisplayManager.NeedsToPaint) { Render(); } + if (GlobalWinF.DisplayManager.NeedsToPaint) { Render(); } CheckMessages(); if (exit) @@ -766,14 +768,14 @@ namespace BizHawk.MultiClient BoolButtons = Global.Config.HotkeyBindings.Select(x => x.DisplayName).ToList() }); - foreach (Binding b in Global.Config.HotkeyBindings) + foreach (var b in Global.Config.HotkeyBindings) { controls.BindMulti(b.DisplayName, b.Bindings); } - Global.ClientControls = controls; - Global.NullControls = new Controller(NullEmulator.NullController); - Global.AutofireNullControls = new AutofireController(NullEmulator.NullController); + GlobalWinF.ClientControls = controls; + GlobalWinF.NullControls = new Controller(NullEmulator.NullController); + GlobalWinF.AutofireNullControls = new AutofireController(NullEmulator.NullController); } @@ -791,7 +793,7 @@ namespace BizHawk.MultiClient public bool IsNullEmulator() { - return Global.Emulator is NullEmulator; + return GlobalWinF.Emulator is NullEmulator; } private string DisplayNameForSystem(string system) @@ -891,7 +893,7 @@ namespace BizHawk.MultiClient break; case "SNES": case "SGB": - if ((Global.Emulator as LibsnesCore).IsSGB) + if ((GlobalWinF.Emulator as LibsnesCore).IsSGB) sNESToolStripMenuItem.Text = "&SGB"; else sNESToolStripMenuItem.Text = "&SNES"; @@ -914,12 +916,12 @@ namespace BizHawk.MultiClient nESSpeicalToolStripMenuItem.Visible = true; nESSpeicalToolStripMenuItem.DropDownItems.Add(name, null, delegate { - if (Global.Emulator.ControllerDefinition.BoolButtons.Contains(button)) + if (GlobalWinF.Emulator.ControllerDefinition.BoolButtons.Contains(button)) { - if (!Global.MovieSession.Movie.IsPlaying || Global.MovieSession.Movie.IsFinished) + if (!GlobalWinF.MovieSession.Movie.IsPlaying || GlobalWinF.MovieSession.Movie.IsFinished) { - Global.ClickyVirtualPadController.Click(button); - Global.OSD.AddMessage(msg); + GlobalWinF.ClickyVirtualPadController.Click(button); + GlobalWinF.OSD.AddMessage(msg); } } }); @@ -930,7 +932,7 @@ namespace BizHawk.MultiClient // ugly and hacky nESSpeicalToolStripMenuItem.Visible = false; nESSpeicalToolStripMenuItem.DropDownItems.Clear(); - var ss = Global.Emulator.ControllerDefinition.BoolButtons; + var ss = GlobalWinF.Emulator.ControllerDefinition.BoolButtons; if (ss.Contains("FDS Eject")) NESSpeicalMenuAdd("Eject Disk", "FDS Eject", "FDS Disk Ejected."); for (int i = 0; i < 16; i++) @@ -948,7 +950,7 @@ namespace BizHawk.MultiClient void SaturnSetPrefs(Emulation.Consoles.Sega.Saturn.Yabause e = null) { if (e == null) - e = Global.Emulator as Emulation.Consoles.Sega.Saturn.Yabause; + e = GlobalWinF.Emulator as Emulation.Consoles.Sega.Saturn.Yabause; if (Global.Config.SaturnUseGL != e.GLMode) { @@ -965,7 +967,7 @@ namespace BizHawk.MultiClient } } - static Controller BindToDefinition(ControllerDefinition def, Dictionary> allbinds, Dictionary> analogbinds) + static Controller BindToDefinition(ControllerDefinition def, Dictionary> allbinds, Dictionary> analogbinds) { var ret = new Controller(def); Dictionary binds; @@ -1012,44 +1014,44 @@ namespace BizHawk.MultiClient void SyncControls() { - var def = Global.Emulator.ControllerDefinition; + var def = GlobalWinF.Emulator.ControllerDefinition; - Global.ActiveController = BindToDefinition(def, Global.Config.AllTrollers, Global.Config.AllTrollersAnalog); - Global.AutoFireController = BindToDefinitionAF(def, Global.Config.AllTrollersAutoFire); + GlobalWinF.ActiveController = BindToDefinition(def, Global.Config.AllTrollers, Global.Config.AllTrollersAnalog); + GlobalWinF.AutoFireController = BindToDefinitionAF(def, Global.Config.AllTrollersAutoFire); // allow propogating controls that are in the current controller definition but not in the prebaked one // these two lines shouldn't be required anymore under the new system? - Global.ActiveController.ForceType(new ControllerDefinition(Global.Emulator.ControllerDefinition)); - Global.ClickyVirtualPadController.Type = new ControllerDefinition(Global.Emulator.ControllerDefinition); + GlobalWinF.ActiveController.ForceType(new ControllerDefinition(GlobalWinF.Emulator.ControllerDefinition)); + GlobalWinF.ClickyVirtualPadController.Type = new ControllerDefinition(GlobalWinF.Emulator.ControllerDefinition); RewireInputChain(); } void RewireInputChain() { - Global.ControllerInputCoalescer = new ControllerInputCoalescer { Type = Global.ActiveController.Type }; + GlobalWinF.ControllerInputCoalescer = new ControllerInputCoalescer { Type = GlobalWinF.ActiveController.Type }; - Global.OrControllerAdapter.Source = Global.ActiveController; - Global.OrControllerAdapter.SourceOr = Global.AutoFireController; - Global.UD_LR_ControllerAdapter.Source = Global.OrControllerAdapter; + GlobalWinF.OrControllerAdapter.Source = GlobalWinF.ActiveController; + GlobalWinF.OrControllerAdapter.SourceOr = GlobalWinF.AutoFireController; + GlobalWinF.UD_LR_ControllerAdapter.Source = GlobalWinF.OrControllerAdapter; - Global.StickyXORAdapter.Source = Global.UD_LR_ControllerAdapter; - Global.AutofireStickyXORAdapter.Source = Global.StickyXORAdapter; + GlobalWinF.StickyXORAdapter.Source = GlobalWinF.UD_LR_ControllerAdapter; + GlobalWinF.AutofireStickyXORAdapter.Source = GlobalWinF.StickyXORAdapter; - Global.MultitrackRewiringControllerAdapter.Source = Global.AutofireStickyXORAdapter; - Global.ForceOffAdaptor.Source = Global.MultitrackRewiringControllerAdapter; + GlobalWinF.MultitrackRewiringControllerAdapter.Source = GlobalWinF.AutofireStickyXORAdapter; + GlobalWinF.ForceOffAdaptor.Source = GlobalWinF.MultitrackRewiringControllerAdapter; - Global.MovieInputSourceAdapter.Source = Global.ForceOffAdaptor; - Global.ControllerOutput.Source = Global.MovieOutputHardpoint; + GlobalWinF.MovieInputSourceAdapter.Source = GlobalWinF.ForceOffAdaptor; + GlobalWinF.ControllerOutput.Source = GlobalWinF.MovieOutputHardpoint; - Global.Emulator.Controller = Global.ControllerOutput; - Global.MovieSession.MovieControllerAdapter.Type = Global.MovieInputSourceAdapter.Type; + GlobalWinF.Emulator.Controller = GlobalWinF.ControllerOutput; + GlobalWinF.MovieSession.MovieControllerAdapter.Type = GlobalWinF.MovieInputSourceAdapter.Type; //connect the movie session before MovieOutputHardpoint if it is doing anything //otherwise connect the MovieInputSourceAdapter to it, effectively bypassing the movie session - if (Global.MovieSession.Movie != null) - Global.MovieOutputHardpoint.Source = Global.MovieSession.MovieControllerAdapter; + if (GlobalWinF.MovieSession.Movie != null) + GlobalWinF.MovieOutputHardpoint.Source = GlobalWinF.MovieSession.MovieControllerAdapter; else - Global.MovieOutputHardpoint.Source = Global.MovieInputSourceAdapter; + GlobalWinF.MovieOutputHardpoint.Source = GlobalWinF.MovieInputSourceAdapter; } public bool LoadRom(string path, bool deterministicemulation = false, bool hasmovie = false) @@ -1321,7 +1323,7 @@ namespace BizHawk.MultiClient } } - NES nes = new NES(nextComm, game, rom.FileData, bios, Global.MovieSession.Movie.Header.BoardProperties) + NES nes = new NES(nextComm, game, rom.FileData, bios, GlobalWinF.MovieSession.Movie.Header.BoardProperties) { SoundOn = Global.Config.SoundEnabled, NTSC_FirstDrawLine = Global.Config.NTSC_NESTopLine, @@ -1536,9 +1538,9 @@ namespace BizHawk.MultiClient if (nextEmulator == null) throw new Exception("No core could load the rom."); CloseGame(); - Global.Emulator.Dispose(); - Global.Emulator = nextEmulator; - Global.CoreComm = nextComm; + GlobalWinF.Emulator.Dispose(); + GlobalWinF.Emulator = nextEmulator; + GlobalWinF.CoreComm = nextComm; Global.Game = game; SyncCoreCommInputSignals(); SyncControls(); @@ -1551,7 +1553,7 @@ namespace BizHawk.MultiClient if (game.System == "NES") { - NES nes = Global.Emulator as NES; + NES nes = GlobalWinF.Emulator as NES; if (nes.GameName != null) Global.Game.Name = nes.GameName; Global.Game.Status = nes.RomStatus; @@ -1561,18 +1563,18 @@ namespace BizHawk.MultiClient Text = DisplayNameForSystem(game.System) + " - " + game.Name; ResetRewindBuffer(); - if (Global.Emulator.CoreComm.RomStatusDetails == null) + if (GlobalWinF.Emulator.CoreComm.RomStatusDetails == null) { - Global.Emulator.CoreComm.RomStatusDetails = + GlobalWinF.Emulator.CoreComm.RomStatusDetails = string.Format("{0}\r\nSHA1:{1}\r\nMD5:{2}\r\n", game.Name, Util.BytesToHexString(System.Security.Cryptography.SHA1.Create().ComputeHash(rom.RomData)), Util.BytesToHexString(System.Security.Cryptography.MD5.Create().ComputeHash(rom.RomData))); } - if (Global.Emulator.BoardName != null) + if (GlobalWinF.Emulator.BoardName != null) { - Console.WriteLine("Core reported BoardID: \"{0}\"", Global.Emulator.BoardName); + Console.WriteLine("Core reported BoardID: \"{0}\"", GlobalWinF.Emulator.BoardName); } //restarts the lua console if a different rom is loaded. @@ -1614,10 +1616,10 @@ namespace BizHawk.MultiClient if (Global.Config.LoadCheatFileByGame) { - if (Global.CheatList.AttemptToLoadCheatFile()) + if (GlobalWinF.CheatList.AttemptToLoadCheatFile()) { ToolHelpers.UpdateCheatRelatedTools(); - Global.OSD.AddMessage("Cheats file loaded"); + GlobalWinF.OSD.AddMessage("Cheats file loaded"); } } @@ -1631,9 +1633,9 @@ namespace BizHawk.MultiClient CaptureRewindState(); - Global.StickyXORAdapter.ClearStickies(); - Global.StickyXORAdapter.ClearStickyFloats(); - Global.AutofireStickyXORAdapter.ClearStickies(); + GlobalWinF.StickyXORAdapter.ClearStickies(); + GlobalWinF.StickyXORAdapter.ClearStickyFloats(); + GlobalWinF.AutofireStickyXORAdapter.ClearStickies(); RewireSound(); @@ -1647,25 +1649,25 @@ namespace BizHawk.MultiClient { // we're video dumping, so async mode only and use the DumpProxy. // note that the avi dumper has already rewired the emulator itself in this case. - Global.Sound.SetAsyncInputPin(DumpProxy); + GlobalWinF.Sound.SetAsyncInputPin(DumpProxy); } else if (Global.Config.SoundThrottle) { // for sound throttle, use sync mode - Global.Emulator.EndAsyncSound(); - Global.Sound.SetSyncInputPin(Global.Emulator.SyncSoundProvider); + GlobalWinF.Emulator.EndAsyncSound(); + GlobalWinF.Sound.SetSyncInputPin(GlobalWinF.Emulator.SyncSoundProvider); } else { // for vsync\clock throttle modes, use async - if (!Global.Emulator.StartAsyncSound()) + if (!GlobalWinF.Emulator.StartAsyncSound()) { // if the core doesn't support async mode, use a standard vecna wrapper - Global.Sound.SetAsyncInputPin(new Emulation.Sound.MetaspuAsync(Global.Emulator.SyncSoundProvider, Emulation.Sound.ESynchMethod.ESynchMethod_V)); + GlobalWinF.Sound.SetAsyncInputPin(new Emulation.Sound.MetaspuAsync(GlobalWinF.Emulator.SyncSoundProvider, Emulation.Sound.ESynchMethod.ESynchMethod_V)); } else { - Global.Sound.SetAsyncInputPin(Global.Emulator.SoundProvider); + GlobalWinF.Sound.SetAsyncInputPin(GlobalWinF.Emulator.SoundProvider); } } } @@ -1675,7 +1677,7 @@ namespace BizHawk.MultiClient DumpStatus.Image = Properties.Resources.Blank; DumpStatus.ToolTipText = ""; - if (Global.Emulator == null) return; + if (GlobalWinF.Emulator == null) return; if (Global.Game == null) return; var status = Global.Game.Status; @@ -1720,8 +1722,8 @@ namespace BizHawk.MultiClient DumpStatus.Image = Properties.Resources.GreenCheck; annotation = "Verified good dump"; } - if (!string.IsNullOrEmpty(Global.Emulator.CoreComm.RomStatusAnnotation)) - annotation = Global.Emulator.CoreComm.RomStatusAnnotation; + if (!string.IsNullOrEmpty(GlobalWinF.Emulator.CoreComm.RomStatusAnnotation)) + annotation = GlobalWinF.Emulator.CoreComm.RomStatusAnnotation; DumpStatus.ToolTipText = annotation; } @@ -1734,17 +1736,17 @@ namespace BizHawk.MultiClient { byte[] sram; // GBA core might not know how big the saveram ought to be, so just send it the whole file - if (Global.Emulator is GBA) + if (GlobalWinF.Emulator is GBA) { sram = File.ReadAllBytes(PathManager.SaveRamPath(Global.Game)); } else { - sram = new byte[Global.Emulator.ReadSaveRam().Length]; + sram = new byte[GlobalWinF.Emulator.ReadSaveRam().Length]; using (var reader = new BinaryReader(new FileStream(PathManager.SaveRamPath(Global.Game), FileMode.Open, FileAccess.Read))) reader.Read(sram, 0, sram.Length); } - Global.Emulator.StoreSaveRam(sram); + GlobalWinF.Emulator.StoreSaveRam(sram); } catch (IOException) { } } @@ -1770,7 +1772,7 @@ namespace BizHawk.MultiClient var writer = new BinaryWriter(new FileStream(path, FileMode.Create, FileAccess.Write)); - var saveram = Global.Emulator.ReadSaveRam(); + var saveram = GlobalWinF.Emulator.ReadSaveRam(); // this assumes that the default state of the core's sram is 0-filled, so don't do // int len = Util.SaveRamBytesUsed(saveram); @@ -1824,7 +1826,7 @@ namespace BizHawk.MultiClient //TODO - wonder what happens if we pop up something interactive as a response to one of these hotkeys? may need to purge further processing //look for hotkey bindings for this key - var triggers = Global.ClientControls.SearchBindings(ie.LogicalButton.ToString()); + var triggers = GlobalWinF.ClientControls.SearchBindings(ie.LogicalButton.ToString()); if (triggers.Count == 0) { //bool sys_hotkey = false; @@ -1871,7 +1873,7 @@ namespace BizHawk.MultiClient { default: case 0: //Both allowed - Global.ControllerInputCoalescer.Receive(ie); + GlobalWinF.ControllerInputCoalescer.Receive(ie); handled = false; if (ie.EventType == Input.InputEventType.Press) @@ -1882,12 +1884,12 @@ namespace BizHawk.MultiClient //hotkeys which arent handled as actions get coalesced as pollable virtual client buttons if (!handled) { - Global.HotkeyCoalescer.Receive(ie); + GlobalWinF.HotkeyCoalescer.Receive(ie); } break; case 1: //Input overrides Hokeys - Global.ControllerInputCoalescer.Receive(ie); - bool inputisbound = Global.ActiveController.HasBinding(ie.LogicalButton.ToString()); + GlobalWinF.ControllerInputCoalescer.Receive(ie); + bool inputisbound = GlobalWinF.ActiveController.HasBinding(ie.LogicalButton.ToString()); if (!inputisbound) { handled = false; @@ -1899,7 +1901,7 @@ namespace BizHawk.MultiClient //hotkeys which arent handled as actions get coalesced as pollable virtual client buttons if (!handled) { - Global.HotkeyCoalescer.Receive(ie); + GlobalWinF.HotkeyCoalescer.Receive(ie); } } break; @@ -1913,8 +1915,8 @@ namespace BizHawk.MultiClient //hotkeys which arent handled as actions get coalesced as pollable virtual client buttons if (!handled) { - Global.HotkeyCoalescer.Receive(ie); - Global.ControllerInputCoalescer.Receive(ie); + GlobalWinF.HotkeyCoalescer.Receive(ie); + GlobalWinF.ControllerInputCoalescer.Receive(ie); } break; } @@ -1922,15 +1924,15 @@ namespace BizHawk.MultiClient } //foreach event // also handle floats - Global.ControllerInputCoalescer.AcceptNewFloats(Input.Instance.GetFloats()); + GlobalWinF.ControllerInputCoalescer.AcceptNewFloats(Input.Instance.GetFloats()); } private void ClearAutohold() { - Global.StickyXORAdapter.ClearStickies(); - Global.AutofireStickyXORAdapter.ClearStickies(); + GlobalWinF.StickyXORAdapter.ClearStickies(); + GlobalWinF.AutofireStickyXORAdapter.ClearStickies(); VirtualPadForm1.ClearVirtualPadHolds(); - Global.OSD.AddMessage("Autohold keys cleared"); + GlobalWinF.OSD.AddMessage("Autohold keys cleared"); } bool CheckHotkey(string trigger) @@ -1943,7 +1945,7 @@ namespace BizHawk.MultiClient case "Pause": TogglePause(); break; case "Toggle Throttle": unthrottled ^= true; - Global.OSD.AddMessage("Unthrottled: " + unthrottled); + GlobalWinF.OSD.AddMessage("Unthrottled: " + unthrottled); break; case "Soft Reset": SoftReset(); break; case "Hard Reset": HardReset(); break; @@ -2024,66 +2026,66 @@ namespace BizHawk.MultiClient case "Play from beginning": PlayMovieFromBeginning(); break; case "Save Movie": SaveMovie(); break; case "Toggle MultiTrack": - if (Global.MovieSession.Movie.IsActive) + if (GlobalWinF.MovieSession.Movie.IsActive) { if (Global.Config.VBAStyleMovieLoadState) { - Global.OSD.AddMessage("Multi-track can not be used in Full Movie Loadstates mode"); + GlobalWinF.OSD.AddMessage("Multi-track can not be used in Full Movie Loadstates mode"); } else { - Global.MovieSession.MultiTrack.IsActive = !Global.MovieSession.MultiTrack.IsActive; - if (Global.MovieSession.MultiTrack.IsActive) + GlobalWinF.MovieSession.MultiTrack.IsActive = !GlobalWinF.MovieSession.MultiTrack.IsActive; + if (GlobalWinF.MovieSession.MultiTrack.IsActive) { - Global.OSD.AddMessage("MultiTrack Enabled"); - Global.OSD.MT = "Recording None"; + GlobalWinF.OSD.AddMessage("MultiTrack Enabled"); + GlobalWinF.OSD.MT = "Recording None"; } else { - Global.OSD.AddMessage("MultiTrack Disabled"); + GlobalWinF.OSD.AddMessage("MultiTrack Disabled"); } - Global.MovieSession.MultiTrack.RecordAll = false; - Global.MovieSession.MultiTrack.CurrentPlayer = 0; + GlobalWinF.MovieSession.MultiTrack.RecordAll = false; + GlobalWinF.MovieSession.MultiTrack.CurrentPlayer = 0; } } else { - Global.OSD.AddMessage("MultiTrack cannot be enabled while not recording."); + GlobalWinF.OSD.AddMessage("MultiTrack cannot be enabled while not recording."); } - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; break; case "MT Select All": - Global.MovieSession.MultiTrack.CurrentPlayer = 0; - Global.MovieSession.MultiTrack.RecordAll = true; - Global.OSD.MT = "Recording All"; - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.MovieSession.MultiTrack.CurrentPlayer = 0; + GlobalWinF.MovieSession.MultiTrack.RecordAll = true; + GlobalWinF.OSD.MT = "Recording All"; + GlobalWinF.DisplayManager.NeedsToPaint = true; break; case "MT Select None": - Global.MovieSession.MultiTrack.CurrentPlayer = 0; - Global.MovieSession.MultiTrack.RecordAll = false; - Global.OSD.MT = "Recording None"; - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.MovieSession.MultiTrack.CurrentPlayer = 0; + GlobalWinF.MovieSession.MultiTrack.RecordAll = false; + GlobalWinF.OSD.MT = "Recording None"; + GlobalWinF.DisplayManager.NeedsToPaint = true; break; case "MT Increment Player": - Global.MovieSession.MultiTrack.CurrentPlayer++; - Global.MovieSession.MultiTrack.RecordAll = false; - if (Global.MovieSession.MultiTrack.CurrentPlayer > 5) //TODO: Replace with console's maximum or current maximum players??! + GlobalWinF.MovieSession.MultiTrack.CurrentPlayer++; + GlobalWinF.MovieSession.MultiTrack.RecordAll = false; + if (GlobalWinF.MovieSession.MultiTrack.CurrentPlayer > 5) //TODO: Replace with console's maximum or current maximum players??! { - Global.MovieSession.MultiTrack.CurrentPlayer = 1; + GlobalWinF.MovieSession.MultiTrack.CurrentPlayer = 1; } - Global.OSD.MT = "Recording Player " + Global.MovieSession.MultiTrack.CurrentPlayer.ToString(); - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.OSD.MT = "Recording Player " + GlobalWinF.MovieSession.MultiTrack.CurrentPlayer.ToString(); + GlobalWinF.DisplayManager.NeedsToPaint = true; break; case "MT Decrement Player": - Global.MovieSession.MultiTrack.CurrentPlayer--; - Global.MovieSession.MultiTrack.RecordAll = false; - if (Global.MovieSession.MultiTrack.CurrentPlayer < 1) + GlobalWinF.MovieSession.MultiTrack.CurrentPlayer--; + GlobalWinF.MovieSession.MultiTrack.RecordAll = false; + if (GlobalWinF.MovieSession.MultiTrack.CurrentPlayer < 1) { - Global.MovieSession.MultiTrack.CurrentPlayer = 5;//TODO: Replace with console's maximum or current maximum players??! + GlobalWinF.MovieSession.MultiTrack.CurrentPlayer = 5;//TODO: Replace with console's maximum or current maximum players??! } - Global.OSD.MT = "Recording Player " + Global.MovieSession.MultiTrack.CurrentPlayer.ToString(); - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.OSD.MT = "Recording Player " + GlobalWinF.MovieSession.MultiTrack.CurrentPlayer.ToString(); + GlobalWinF.DisplayManager.NeedsToPaint = true; break; case "Movie Poke": ToggleModePokeMode(); break; @@ -2147,12 +2149,12 @@ namespace BizHawk.MultiClient double frameAdvanceTimestampDelta = (now - FrameAdvanceTimestamp).TotalMilliseconds; bool frameProgressTimeElapsed = Global.Config.FrameProgressDelayMs < frameAdvanceTimestampDelta; - if (Global.Config.SkipLagFrame && Global.Emulator.IsLagFrame && frameProgressTimeElapsed) + if (Global.Config.SkipLagFrame && GlobalWinF.Emulator.IsLagFrame && frameProgressTimeElapsed) { runFrame = true; } - if (Global.ClientControls["Frame Advance"] || PressFrameAdvance) + if (GlobalWinF.ClientControls["Frame Advance"] || PressFrameAdvance) { //handle the initial trigger of a frame advance if (FrameAdvanceTimestamp == DateTime.MinValue) @@ -2189,8 +2191,8 @@ namespace BizHawk.MultiClient runFrame = true; } - bool ReturnToRecording = Global.MovieSession.Movie.IsRecording; - if (RewindActive && (Global.ClientControls["Rewind"] || PressRewind)) + bool ReturnToRecording = GlobalWinF.MovieSession.Movie.IsRecording; + if (RewindActive && (GlobalWinF.ClientControls["Rewind"] || PressRewind)) { Rewind(1); suppressCaptureRewind = true; @@ -2203,17 +2205,17 @@ namespace BizHawk.MultiClient runFrame = true; } //we don't want to capture input when rewinding, even in record mode - if (Global.MovieSession.Movie.IsRecording) + if (GlobalWinF.MovieSession.Movie.IsRecording) { - Global.MovieSession.Movie.SwitchToPlay(); + GlobalWinF.MovieSession.Movie.SwitchToPlay(); } } if (UpdateFrame) { runFrame = true; - if (Global.MovieSession.Movie.IsRecording) + if (GlobalWinF.MovieSession.Movie.IsRecording) { - Global.MovieSession.Movie.SwitchToPlay(); + GlobalWinF.MovieSession.Movie.SwitchToPlay(); } } @@ -2221,8 +2223,8 @@ namespace BizHawk.MultiClient bool coreskipaudio = false; if (runFrame) { - bool ff = Global.ClientControls["Fast Forward"] || Global.ClientControls["Turbo"]; - bool fff = Global.ClientControls["Turbo"]; + bool ff = GlobalWinF.ClientControls["Fast Forward"] || GlobalWinF.ClientControls["Turbo"]; + bool fff = GlobalWinF.ClientControls["Turbo"]; bool updateFpsString = (runloop_last_ff != ff); runloop_last_ff = ff; @@ -2231,11 +2233,11 @@ namespace BizHawk.MultiClient UpdateToolsBefore(); } - Global.ClickyVirtualPadController.FrameTick(); + GlobalWinF.ClickyVirtualPadController.FrameTick(); runloop_fps++; //client input-related duties - Global.OSD.ClearGUIText(); + GlobalWinF.OSD.ClearGUIText(); if ((DateTime.Now - runloop_second).TotalSeconds > 1) { @@ -2256,7 +2258,7 @@ namespace BizHawk.MultiClient { fps_string += " >>"; } - Global.OSD.FPS = fps_string; + GlobalWinF.OSD.FPS = fps_string; } if (!suppressCaptureRewind && RewindActive) CaptureRewindState(); @@ -2267,12 +2269,12 @@ namespace BizHawk.MultiClient HandleMovieOnFrameLoop(); - coreskipaudio = Global.ClientControls["Turbo"] && CurrAviWriter == null; + coreskipaudio = GlobalWinF.ClientControls["Turbo"] && CurrAviWriter == null; //======================================= - Global.CheatList.Pulse(); - Global.Emulator.FrameAdvance(!throttle.skipnextframe || CurrAviWriter != null, !coreskipaudio); - Global.DisplayManager.NeedsToPaint = true; - Global.CheatList.Pulse(); + GlobalWinF.CheatList.Pulse(); + GlobalWinF.Emulator.FrameAdvance(!throttle.skipnextframe || CurrAviWriter != null, !coreskipaudio); + GlobalWinF.DisplayManager.NeedsToPaint = true; + GlobalWinF.CheatList.Pulse(); //======================================= if (!PauseAVI) @@ -2280,9 +2282,9 @@ namespace BizHawk.MultiClient AVIFrameAdvance(); } - if (Global.Emulator.IsLagFrame && Global.Config.AutofireLagFrames) + if (GlobalWinF.Emulator.IsLagFrame && Global.Config.AutofireLagFrames) { - Global.AutoFireController.IncrementStarts(); + GlobalWinF.AutoFireController.IncrementStarts(); } PressFrameAdvance = false; @@ -2292,12 +2294,12 @@ namespace BizHawk.MultiClient } } - if (Global.ClientControls["Rewind"] || PressRewind) + if (GlobalWinF.ClientControls["Rewind"] || PressRewind) { UpdateToolsAfter(); if (ReturnToRecording) { - Global.MovieSession.Movie.SwitchToRecord(); + GlobalWinF.MovieSession.Movie.SwitchToRecord(); } PressRewind = false; } @@ -2305,17 +2307,17 @@ namespace BizHawk.MultiClient { if (ReturnToRecording) { - Global.MovieSession.Movie.SwitchToRecord(); + GlobalWinF.MovieSession.Movie.SwitchToRecord(); } UpdateFrame = false; } if (genSound && !coreskipaudio) { - Global.Sound.UpdateSound(); + GlobalWinF.Sound.UpdateSound(); } else - Global.Sound.UpdateSilence(); + GlobalWinF.Sound.UpdateSilence(); } /// @@ -2371,7 +2373,7 @@ namespace BizHawk.MultiClient LuaConsole1.LuaImp.FrameRegisterAfter(); if (!fromLua) { - Global.DisplayManager.PreFrameUpdateLuaSource(); + GlobalWinF.DisplayManager.PreFrameUpdateLuaSource(); LuaConsole1.EndLuaDrawing(); } } @@ -2380,7 +2382,7 @@ namespace BizHawk.MultiClient private unsafe Image MakeScreenshotImage() { - var video = Global.Emulator.VideoProvider; + var video = GlobalWinF.Emulator.VideoProvider; var image = new Bitmap(video.BufferWidth, video.BufferHeight, PixelFormat.Format32bppArgb); //TODO - replace with BitmapBuffer @@ -2393,7 +2395,7 @@ namespace BizHawk.MultiClient { int col = framebuf[(y * video.BufferWidth) + x]; - if (Global.Emulator is TI83) + if (GlobalWinF.Emulator is TI83) { if (col == 0) col = Color.Black.ToArgb(); @@ -2416,7 +2418,7 @@ namespace BizHawk.MultiClient { Clipboard.SetImage(img); } - Global.OSD.AddMessage("Screenshot saved to clipboard."); + GlobalWinF.OSD.AddMessage("Screenshot saved to clipboard."); } public void TakeScreenshot() @@ -2441,7 +2443,7 @@ namespace BizHawk.MultiClient { img.Save(fi.FullName, ImageFormat.Png); } - Global.OSD.AddMessage(fi.Name + " saved."); + GlobalWinF.OSD.AddMessage(fi.Name + " saved."); } public void SaveState(string name) @@ -2474,16 +2476,16 @@ namespace BizHawk.MultiClient public void SaveStateFile(string filename, string name, bool fromLua) { if (Global.Config.SaveStateType == Config.SaveStateTypeE.Text || - (Global.Config.SaveStateType == Config.SaveStateTypeE.Default && !Global.Emulator.BinarySaveStatesPreferred)) + (Global.Config.SaveStateType == Config.SaveStateTypeE.Default && !GlobalWinF.Emulator.BinarySaveStatesPreferred)) { // text mode savestates var writer = new StreamWriter(filename); - Global.Emulator.SaveStateText(writer); + GlobalWinF.Emulator.SaveStateText(writer); HandleMovieSaveState(writer); if (Global.Config.SaveScreenshotWithStates) { writer.Write("Framebuffer "); - Global.Emulator.VideoProvider.GetVideoBuffer().SaveAsHex(writer); + GlobalWinF.Emulator.VideoProvider.GetVideoBuffer().SaveAsHex(writer); } writer.Close(); //DateTime end = DateTime.UtcNow; @@ -2499,7 +2501,7 @@ namespace BizHawk.MultiClient delegate(Stream s) { BinaryWriter bw = new BinaryWriter(s); - Global.Emulator.SaveStateBinary(bw); + GlobalWinF.Emulator.SaveStateBinary(bw); bw.Flush(); }); if (Global.Config.SaveScreenshotWithStates) @@ -2507,20 +2509,20 @@ namespace BizHawk.MultiClient bs.PutFrameBuffer( delegate(Stream s) { - var buff = Global.Emulator.VideoProvider.GetVideoBuffer(); + var buff = GlobalWinF.Emulator.VideoProvider.GetVideoBuffer(); BinaryWriter bw = new BinaryWriter(s); bw.Write(buff); bw.Flush(); }); } - if (Global.MovieSession.Movie.IsActive) + if (GlobalWinF.MovieSession.Movie.IsActive) { bs.PutInputLog( delegate(Stream s) { StreamWriter sw = new StreamWriter(s); // this never should have been a core's responsibility - sw.WriteLine("Frame {0}", Global.Emulator.Frame); + sw.WriteLine("Frame {0}", GlobalWinF.Emulator.Frame); HandleMovieSaveState(sw); sw.Flush(); }); @@ -2529,7 +2531,7 @@ namespace BizHawk.MultiClient //DateTime end = DateTime.UtcNow; //Console.WriteLine("n64 savestate TEXT time: {0}", (end - start).TotalMilliseconds); } - Global.OSD.AddMessage("Saved state: " + name); + GlobalWinF.OSD.AddMessage("Saved state: " + name); if (!fromLua) UpdateStatusSlots(); @@ -2546,9 +2548,9 @@ namespace BizHawk.MultiClient if (file.Directory != null && file.Directory.Exists == false) file.Directory.Create(); - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = sfd.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result != DialogResult.OK) return; @@ -2558,7 +2560,7 @@ namespace BizHawk.MultiClient public void LoadStateFile(string path, string name, bool fromLua = false) { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; // try to detect binary first BinaryStateLoader bw = BinaryStateLoader.LoadAndDetect(path); if (bw != null) @@ -2567,7 +2569,7 @@ namespace BizHawk.MultiClient { bool succeed = false; - if (Global.MovieSession.Movie.IsActive) + if (GlobalWinF.MovieSession.Movie.IsActive) { bw.GetInputLogRequired( delegate(Stream s) @@ -2583,7 +2585,7 @@ namespace BizHawk.MultiClient delegate(Stream s) { BinaryReader br = new BinaryReader(s); - Global.Emulator.LoadStateBinary(br); + GlobalWinF.Emulator.LoadStateBinary(br); }); bw.GetFrameBuffer( @@ -2591,7 +2593,7 @@ namespace BizHawk.MultiClient { BinaryReader br = new BinaryReader(s); int i; - var buff = Global.Emulator.VideoProvider.GetVideoBuffer(); + var buff = GlobalWinF.Emulator.VideoProvider.GetVideoBuffer(); try { for (i = 0; i < buff.Length; i++) @@ -2621,7 +2623,7 @@ namespace BizHawk.MultiClient { using (var reader = new StreamReader(path)) { - Global.Emulator.LoadStateText(reader); + GlobalWinF.Emulator.LoadStateText(reader); while (true) { @@ -2632,22 +2634,22 @@ namespace BizHawk.MultiClient string[] args = str.Split(' '); if (args[0] == "Framebuffer") { - Global.Emulator.VideoProvider.GetVideoBuffer().ReadFromHex(args[1]); + GlobalWinF.Emulator.VideoProvider.GetVideoBuffer().ReadFromHex(args[1]); } } } } else - Global.OSD.AddMessage("Loadstate error!"); + GlobalWinF.OSD.AddMessage("Loadstate error!"); } cleanup: - Global.OSD.ClearGUIText(); + GlobalWinF.OSD.ClearGUIText(); UpdateToolsBefore(fromLua); UpdateToolsAfter(fromLua); UpdateToolsLoadstate(); - Global.OSD.AddMessage("Loaded state: " + name); + GlobalWinF.OSD.AddMessage("Loaded state: " + name); LuaConsole1.LuaImp.SavestateRegisterLoad(name); } @@ -2661,7 +2663,7 @@ namespace BizHawk.MultiClient string path = PathManager.SaveStatePrefix(Global.Game) + "." + name + ".State"; if (File.Exists(path) == false) { - Global.OSD.AddMessage("Unable to load " + name + ".State"); + GlobalWinF.OSD.AddMessage("Unable to load " + name + ".State"); return; } @@ -2678,9 +2680,9 @@ namespace BizHawk.MultiClient RestoreDirectory = true }; - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = ofd.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result != DialogResult.OK) return; @@ -2693,7 +2695,7 @@ namespace BizHawk.MultiClient private void SaveSlotSelectedMessage() { - Global.OSD.AddMessage("Slot " + Global.Config.SaveSlot + " selected."); + GlobalWinF.OSD.AddMessage("Slot " + Global.Config.SaveSlot + " selected."); } public void LoadRamSearch() @@ -2783,7 +2785,7 @@ namespace BizHawk.MultiClient public void LoadNesSoundConfig() { - if (Global.Emulator is NES) + if (GlobalWinF.Emulator is NES) { if (!NesSound.IsHandleCreated || NesSound.IsDisposed) { @@ -2798,7 +2800,7 @@ namespace BizHawk.MultiClient public void LoadGameGenieEC() { - if (Global.Emulator is NES) + if (GlobalWinF.Emulator is NES) { if (!NESgg.IsHandleCreated || NESgg.IsDisposed) { @@ -2808,7 +2810,7 @@ namespace BizHawk.MultiClient else NESgg.Focus(); } - else if (Global.Emulator is LibsnesCore) + else if (GlobalWinF.Emulator is LibsnesCore) { if (!SNESgg.IsHandleCreated || SNESgg.IsDisposed) { @@ -2818,7 +2820,7 @@ namespace BizHawk.MultiClient else SNESgg.Focus(); } - else if ((Global.Emulator.SystemId == "GB") || (Global.Game.System == "GG")) + else if ((GlobalWinF.Emulator.SystemId == "GB") || (Global.Game.System == "GG")) { if (!GBgg.IsHandleCreated || GBgg.IsDisposed) { @@ -2828,7 +2830,7 @@ namespace BizHawk.MultiClient else GBgg.Focus(); } - else if (Global.Emulator is Genesis) + else if (GlobalWinF.Emulator is Genesis) { if (!Gengg.IsHandleCreated || Gengg.IsDisposed) { @@ -2865,7 +2867,7 @@ namespace BizHawk.MultiClient public void LoadTraceLogger() { - if (Global.Emulator.CoreComm.CpuTraceAvailable) + if (GlobalWinF.Emulator.CoreComm.CpuTraceAvailable) { if (!TraceLogger1.IsHandleCreated || TraceLogger1.IsDisposed) { @@ -2989,9 +2991,9 @@ namespace BizHawk.MultiClient { string PluginToUse = ""; - if (hasmovie && Global.MovieSession.Movie.Header.HeaderParams[MovieHeader.PLATFORM] == "N64" && Global.MovieSession.Movie.Header.HeaderParams.ContainsKey(MovieHeader.VIDEOPLUGIN)) + if (hasmovie && GlobalWinF.MovieSession.Movie.Header.HeaderParams[MovieHeader.PLATFORM] == "N64" && GlobalWinF.MovieSession.Movie.Header.HeaderParams.ContainsKey(MovieHeader.VIDEOPLUGIN)) { - PluginToUse = Global.MovieSession.Movie.Header.HeaderParams[MovieHeader.VIDEOPLUGIN]; + PluginToUse = GlobalWinF.MovieSession.Movie.Header.HeaderParams[MovieHeader.VIDEOPLUGIN]; } if (PluginToUse == "" || (PluginToUse != "Rice" && PluginToUse != "Glide64")) @@ -3017,14 +3019,14 @@ namespace BizHawk.MultiClient video_settings.Parameters = Global.Config.Glide64mk2Plugin.GetPluginSettings(); } - if (hasmovie && Global.MovieSession.Movie.Header.HeaderParams[MovieHeader.PLATFORM] == "N64" && Global.MovieSession.Movie.Header.HeaderParams.ContainsKey(MovieHeader.VIDEOPLUGIN)) + if (hasmovie && GlobalWinF.MovieSession.Movie.Header.HeaderParams[MovieHeader.PLATFORM] == "N64" && GlobalWinF.MovieSession.Movie.Header.HeaderParams.ContainsKey(MovieHeader.VIDEOPLUGIN)) { List settings = new List(video_settings.Parameters.Keys); foreach (string setting in settings) { - if (Global.MovieSession.Movie.Header.HeaderParams.ContainsKey(setting)) + if (GlobalWinF.MovieSession.Movie.Header.HeaderParams.ContainsKey(setting)) { - string Value = Global.MovieSession.Movie.Header.HeaderParams[setting]; + string Value = GlobalWinF.MovieSession.Movie.Header.HeaderParams[setting]; if (video_settings.Parameters[setting] is bool) { try @@ -3079,7 +3081,7 @@ namespace BizHawk.MultiClient private void Render() { - var video = Global.Emulator.VideoProvider; + var video = GlobalWinF.Emulator.VideoProvider; if (video.BufferHeight != lastHeight || video.BufferWidth != lastWidth) { lastWidth = video.BufferWidth; @@ -3087,7 +3089,7 @@ namespace BizHawk.MultiClient FrameBufferResized(); } - Global.DisplayManager.UpdateSource(Global.Emulator.VideoProvider); + GlobalWinF.DisplayManager.UpdateSource(GlobalWinF.Emulator.VideoProvider); } public void FrameBufferResized() @@ -3095,7 +3097,7 @@ namespace BizHawk.MultiClient // run this entire thing exactly twice, since the first resize may adjust the menu stacking for (int i = 0; i < 2; i++) { - var video = Global.Emulator.VideoProvider; + var video = GlobalWinF.Emulator.VideoProvider; int zoom = Global.Config.TargetZoomFactor; var area = Screen.FromControl(this).WorkingArea; @@ -3112,7 +3114,7 @@ namespace BizHawk.MultiClient // Change size Size = new Size((video.BufferWidth * zoom) + borderWidth, (video.BufferHeight * zoom + borderHeight)); PerformLayout(); - Global.RenderPanel.Resized = true; + GlobalWinF.RenderPanel.Resized = true; // Is window off the screen at this size? if (area.Contains(Bounds) == false) @@ -3139,7 +3141,7 @@ namespace BizHawk.MultiClient MainMenuStrip.Visible = false; StatusSlot0.Visible = false; PerformLayout(); - Global.RenderPanel.Resized = true; + GlobalWinF.RenderPanel.Resized = true; InFullscreen = true; } else @@ -3205,7 +3207,7 @@ namespace BizHawk.MultiClient int LastOpenRomFilter; private void OpenROM() { - var ofd = new OpenFileDialog { InitialDirectory = PathManager.GetRomsPath(Global.Emulator.SystemId) }; + var ofd = new OpenFileDialog { InitialDirectory = PathManager.GetRomsPath(GlobalWinF.Emulator.SystemId) }; //"Rom Files|*.NES;*.SMS;*.GG;*.SG;*.PCE;*.SGX;*.GB;*.BIN;*.SMD;*.ROM;*.ZIP;*.7z|NES (*.NES)|*.NES|Master System|*.SMS;*.GG;*.SG;*.ZIP;*.7z|PC Engine|*.PCE;*.SGX;*.ZIP;*.7z|Gameboy|*.GB;*.ZIP;*.7z|TI-83|*.rom|Archive Files|*.zip;*.7z|Savestate|*.state|All Files|*.*"; //adelikat: ugly design for this, I know @@ -3260,9 +3262,9 @@ namespace BizHawk.MultiClient ofd.RestoreDirectory = false; ofd.FilterIndex = LastOpenRomFilter; - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = ofd.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result != DialogResult.OK) return; var file = new FileInfo(ofd.FileName); @@ -3277,7 +3279,7 @@ namespace BizHawk.MultiClient private void CloseGame(bool clearSRAM = false) { - if (Global.Config.AutoSavestates && Global.Emulator is NullEmulator == false) + if (Global.Config.AutoSavestates && GlobalWinF.Emulator is NullEmulator == false) { SaveState("Auto"); } @@ -3288,22 +3290,22 @@ namespace BizHawk.MultiClient if (File.Exists(path)) { File.Delete(path); - Global.OSD.AddMessage("SRAM cleared."); + GlobalWinF.OSD.AddMessage("SRAM cleared."); } } - else if (Global.Emulator.SaveRamModified) + else if (GlobalWinF.Emulator.SaveRamModified) { SaveRam(); } StopAVI(); - Global.Emulator.Dispose(); - Global.CoreComm = new CoreComm(); + GlobalWinF.Emulator.Dispose(); + GlobalWinF.CoreComm = new CoreComm(); SyncCoreCommInputSignals(); - Global.Emulator = new NullEmulator(Global.CoreComm); - Global.ActiveController = Global.NullControls; - Global.AutoFireController = Global.AutofireNullControls; - Global.MovieSession.Movie.Stop(); + GlobalWinF.Emulator = new NullEmulator(GlobalWinF.CoreComm); + GlobalWinF.ActiveController = GlobalWinF.NullControls; + GlobalWinF.AutoFireController = GlobalWinF.AutofireNullControls; + GlobalWinF.MovieSession.Movie.Stop(); NeedsReboot = false; SetRebootIconStatus(); } @@ -3311,9 +3313,9 @@ namespace BizHawk.MultiClient public void CloseROM(bool clearSRAM = false) { CloseGame(clearSRAM); - Global.CoreComm = new CoreComm(); + GlobalWinF.CoreComm = new CoreComm(); SyncCoreCommInputSignals(); - Global.Emulator = new NullEmulator(Global.CoreComm); + GlobalWinF.Emulator = new NullEmulator(GlobalWinF.CoreComm); Global.Game = GameInfo.GetNullGame(); RewireSound(); @@ -3428,21 +3430,21 @@ namespace BizHawk.MultiClient public void ToggleReadOnly() { - if (Global.MovieSession.Movie.IsActive) + if (GlobalWinF.MovieSession.Movie.IsActive) { ReadOnly ^= true; if (ReadOnly) { - Global.OSD.AddMessage("Movie read-only mode"); + GlobalWinF.OSD.AddMessage("Movie read-only mode"); } else { - Global.OSD.AddMessage("Movie read+write mode"); + GlobalWinF.OSD.AddMessage("Movie read+write mode"); } } else { - Global.OSD.AddMessage("No movie active"); + GlobalWinF.OSD.AddMessage("No movie active"); } } @@ -3452,11 +3454,11 @@ namespace BizHawk.MultiClient ReadOnly = read_only; if (ReadOnly) { - Global.OSD.AddMessage("Movie read-only mode"); + GlobalWinF.OSD.AddMessage("Movie read-only mode"); } else { - Global.OSD.AddMessage("Movie read+write mode"); + GlobalWinF.OSD.AddMessage("Movie read+write mode"); } } @@ -3487,8 +3489,8 @@ namespace BizHawk.MultiClient Global.Config.SoundVolume += 10; if (Global.Config.SoundVolume > 100) Global.Config.SoundVolume = 100; - Global.Sound.ChangeVolume(Global.Config.SoundVolume); - Global.OSD.AddMessage("Volume " + Global.Config.SoundVolume.ToString()); + GlobalWinF.Sound.ChangeVolume(Global.Config.SoundVolume); + GlobalWinF.OSD.AddMessage("Volume " + Global.Config.SoundVolume.ToString()); } private void VolumeDown() @@ -3496,19 +3498,19 @@ namespace BizHawk.MultiClient Global.Config.SoundVolume -= 10; if (Global.Config.SoundVolume < 0) Global.Config.SoundVolume = 0; - Global.Sound.ChangeVolume(Global.Config.SoundVolume); - Global.OSD.AddMessage("Volume " + Global.Config.SoundVolume.ToString()); + GlobalWinF.Sound.ChangeVolume(Global.Config.SoundVolume); + GlobalWinF.OSD.AddMessage("Volume " + Global.Config.SoundVolume.ToString()); } private void SoftReset() { //is it enough to run this for one frame? maybe.. - if (Global.Emulator.ControllerDefinition.BoolButtons.Contains("Reset")) + if (GlobalWinF.Emulator.ControllerDefinition.BoolButtons.Contains("Reset")) { - if (!Global.MovieSession.Movie.IsPlaying || Global.MovieSession.Movie.IsFinished) + if (!GlobalWinF.MovieSession.Movie.IsPlaying || GlobalWinF.MovieSession.Movie.IsFinished) { - Global.ClickyVirtualPadController.Click("Reset"); - Global.OSD.AddMessage("Reset button pressed."); + GlobalWinF.ClickyVirtualPadController.Click("Reset"); + GlobalWinF.OSD.AddMessage("Reset button pressed."); } } } @@ -3516,12 +3518,12 @@ namespace BizHawk.MultiClient private void HardReset() { //is it enough to run this for one frame? maybe.. - if (Global.Emulator.ControllerDefinition.BoolButtons.Contains("Power")) + if (GlobalWinF.Emulator.ControllerDefinition.BoolButtons.Contains("Power")) { - if (!Global.MovieSession.Movie.IsPlaying || Global.MovieSession.Movie.IsFinished) + if (!GlobalWinF.MovieSession.Movie.IsPlaying || GlobalWinF.MovieSession.Movie.IsFinished) { - Global.ClickyVirtualPadController.Click("Power"); - Global.OSD.AddMessage("Power button pressed."); + GlobalWinF.ClickyVirtualPadController.Click("Power"); + GlobalWinF.OSD.AddMessage("Power button pressed."); } } } @@ -3700,7 +3702,7 @@ namespace BizHawk.MultiClient } else { - aw = VideoWriterChooserForm.DoVideoWriterChoserDlg(video_writers, Global.MainForm, out avwriter_resizew, out avwriter_resizeh); + aw = VideoWriterChooserForm.DoVideoWriterChoserDlg(video_writers, GlobalWinF.MainForm, out avwriter_resizew, out avwriter_resizeh); } foreach (var w in video_writers) @@ -3712,19 +3714,19 @@ namespace BizHawk.MultiClient if (aw == null) { if (unattended) - Global.OSD.AddMessage(string.Format("Couldn't start video writer \"{0}\"", videowritername)); + GlobalWinF.OSD.AddMessage(string.Format("Couldn't start video writer \"{0}\"", videowritername)); else - Global.OSD.AddMessage("A/V capture canceled."); + GlobalWinF.OSD.AddMessage("A/V capture canceled."); return; } try { - aw.SetMovieParameters(Global.Emulator.CoreComm.VsyncNum, Global.Emulator.CoreComm.VsyncDen); + aw.SetMovieParameters(GlobalWinF.Emulator.CoreComm.VsyncNum, GlobalWinF.Emulator.CoreComm.VsyncDen); if (avwriter_resizew > 0 && avwriter_resizeh > 0) aw.SetVideoParameters(avwriter_resizew, avwriter_resizeh); else - aw.SetVideoParameters(Global.Emulator.VideoProvider.BufferWidth, Global.Emulator.VideoProvider.BufferHeight); + aw.SetVideoParameters(GlobalWinF.Emulator.VideoProvider.BufferWidth, GlobalWinF.Emulator.VideoProvider.BufferHeight); aw.SetAudioParameters(44100, 2, 16); // select codec token @@ -3735,10 +3737,10 @@ namespace BizHawk.MultiClient } else { - var token = aw.AcquireVideoCodecToken(Global.MainForm); + var token = aw.AcquireVideoCodecToken(GlobalWinF.MainForm); if (token == null) { - Global.OSD.AddMessage("A/V capture canceled."); + GlobalWinF.OSD.AddMessage("A/V capture canceled."); aw.Dispose(); return; } @@ -3753,7 +3755,7 @@ namespace BizHawk.MultiClient else { var sfd = new SaveFileDialog(); - if (!(Global.Emulator is NullEmulator)) + if (!(GlobalWinF.Emulator is NullEmulator)) { sfd.FileName = PathManager.FilesystemSafeName(Global.Game); sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.AVPath, null); @@ -3765,9 +3767,9 @@ namespace BizHawk.MultiClient } sfd.Filter = String.Format("{0} (*.{0})|*.{0}|All Files|*.*", aw.DesiredExtension()); - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = sfd.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result == DialogResult.Cancel) { @@ -3779,7 +3781,7 @@ namespace BizHawk.MultiClient //commit the avi writing last, in case there were any errors earlier CurrAviWriter = aw; - Global.OSD.AddMessage("A/V capture started"); + GlobalWinF.OSD.AddMessage("A/V capture started"); AVIStatusLabel.Image = Properties.Resources.AVI; AVIStatusLabel.ToolTipText = "A/V capture in progress"; AVIStatusLabel.Visible = true; @@ -3787,16 +3789,16 @@ namespace BizHawk.MultiClient } catch { - Global.OSD.AddMessage("A/V capture failed!"); + GlobalWinF.OSD.AddMessage("A/V capture failed!"); aw.Dispose(); throw; } // do sound rewire. the plan is to eventually have AVI writing support syncsound input, but it doesn't for the moment - if (!Global.Emulator.StartAsyncSound()) - AviSoundInput = new Emulation.Sound.MetaspuAsync(Global.Emulator.SyncSoundProvider, Emulation.Sound.ESynchMethod.ESynchMethod_V); + if (!GlobalWinF.Emulator.StartAsyncSound()) + AviSoundInput = new Emulation.Sound.MetaspuAsync(GlobalWinF.Emulator.SyncSoundProvider, Emulation.Sound.ESynchMethod.ESynchMethod_V); else - AviSoundInput = Global.Emulator.SoundProvider; + AviSoundInput = GlobalWinF.Emulator.SoundProvider; DumpProxy = new Emulation.Sound.MetaspuSoundProvider(Emulation.Sound.ESynchMethod.ESynchMethod_V); SoundRemainder = 0; RewireSound(); @@ -3812,7 +3814,7 @@ namespace BizHawk.MultiClient } CurrAviWriter.Dispose(); CurrAviWriter = null; - Global.OSD.AddMessage("A/V capture aborted"); + GlobalWinF.OSD.AddMessage("A/V capture aborted"); AVIStatusLabel.Image = Properties.Resources.Blank; AVIStatusLabel.ToolTipText = ""; AVIStatusLabel.Visible = false; @@ -3833,7 +3835,7 @@ namespace BizHawk.MultiClient CurrAviWriter.CloseFile(); CurrAviWriter.Dispose(); CurrAviWriter = null; - Global.OSD.AddMessage("A/V capture stopped"); + GlobalWinF.OSD.AddMessage("A/V capture stopped"); AVIStatusLabel.Image = Properties.Resources.Blank; AVIStatusLabel.ToolTipText = ""; AVIStatusLabel.Visible = false; @@ -3847,10 +3849,10 @@ namespace BizHawk.MultiClient { if (CurrAviWriter != null) { - long nsampnum = 44100 * (long)Global.Emulator.CoreComm.VsyncDen + SoundRemainder; - long nsamp = nsampnum / Global.Emulator.CoreComm.VsyncNum; + long nsampnum = 44100 * (long)GlobalWinF.Emulator.CoreComm.VsyncDen + SoundRemainder; + long nsamp = nsampnum / GlobalWinF.Emulator.CoreComm.VsyncNum; // exactly remember fractional parts of an audio sample - SoundRemainder = nsampnum % Global.Emulator.CoreComm.VsyncNum; + SoundRemainder = nsampnum % GlobalWinF.Emulator.CoreComm.VsyncNum; short[] temp = new short[nsamp * 2]; AviSoundInput.GetSamples(temp); @@ -3866,9 +3868,9 @@ namespace BizHawk.MultiClient bmpin = CaptureOSD(); else { - bmpin = new Bitmap(Global.Emulator.VideoProvider.BufferWidth, Global.Emulator.VideoProvider.BufferHeight, PixelFormat.Format32bppArgb); + bmpin = new Bitmap(GlobalWinF.Emulator.VideoProvider.BufferWidth, GlobalWinF.Emulator.VideoProvider.BufferHeight, PixelFormat.Format32bppArgb); var lockdata = bmpin.LockBits(new Rectangle(0, 0, bmpin.Width, bmpin.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); - System.Runtime.InteropServices.Marshal.Copy(Global.Emulator.VideoProvider.GetVideoBuffer(), 0, lockdata.Scan0, bmpin.Width * bmpin.Height); + System.Runtime.InteropServices.Marshal.Copy(GlobalWinF.Emulator.VideoProvider.GetVideoBuffer(), 0, lockdata.Scan0, bmpin.Width * bmpin.Height); bmpin.UnlockBits(lockdata); } Bitmap bmpout = new Bitmap(avwriter_resizew, avwriter_resizeh, PixelFormat.Format32bppArgb); @@ -3882,7 +3884,7 @@ namespace BizHawk.MultiClient if (Global.Config.AVI_CaptureOSD) output = new AVOut.BmpVideoProvder(CaptureOSD()); else - output = Global.Emulator.VideoProvider; + output = GlobalWinF.Emulator.VideoProvider; } CurrAviWriter.AddFrame(output); @@ -3964,9 +3966,9 @@ namespace BizHawk.MultiClient if (errorMsg.Length > 0) MessageBox.Show(errorMsg, "Conversion error", MessageBoxButtons.OK, MessageBoxIcon.Error); if (warningMsg.Length > 0) - Global.OSD.AddMessage(warningMsg); + GlobalWinF.OSD.AddMessage(warningMsg); else - Global.OSD.AddMessage(Path.GetFileName(fn) + " imported as " + "Movies\\" + + GlobalWinF.OSD.AddMessage(Path.GetFileName(fn) + " imported as " + "Movies\\" + Path.GetFileName(fn) + "." + Global.Config.MovieExtension); if (!Directory.Exists(d)) Directory.CreateDirectory(d); @@ -3996,11 +3998,11 @@ namespace BizHawk.MultiClient } // this size can be different for showing off stretching or filters - captureosd_rvp.Width = Global.Emulator.VideoProvider.BufferWidth; - captureosd_rvp.Height = Global.Emulator.VideoProvider.BufferHeight; + captureosd_rvp.Width = GlobalWinF.Emulator.VideoProvider.BufferWidth; + captureosd_rvp.Height = GlobalWinF.Emulator.VideoProvider.BufferHeight; - Global.DisplayManager.UpdateSourceEx(Global.Emulator.VideoProvider, captureosd_srp); + GlobalWinF.DisplayManager.UpdateSourceEx(GlobalWinF.Emulator.VideoProvider, captureosd_srp); Bitmap ret = (Bitmap)captureosd_rvp.GetBitmap().Clone(); @@ -4127,7 +4129,7 @@ namespace BizHawk.MultiClient public void SetNESSoundChannels() { - NES nes = Global.Emulator as NES; + NES nes = GlobalWinF.Emulator as NES; nes.SetSquare1(Global.Config.NESSquare1); nes.SetSquare2(Global.Config.NESSquare2); nes.SetTriangle(Global.Config.NESTriangle); @@ -4154,7 +4156,7 @@ namespace BizHawk.MultiClient else Array.Copy(sram, Global.Emulator.ReadSaveRam, Global.Emulator.ReadSaveRam.Length); */ - Global.Emulator.ClearSaveRam(); + GlobalWinF.Emulator.ClearSaveRam(); } catch { } } @@ -4175,15 +4177,15 @@ namespace BizHawk.MultiClient { NeedsReboot = true; SetRebootIconStatus(); - Global.OSD.AddMessage("Core reboot needed for this setting"); + GlobalWinF.OSD.AddMessage("Core reboot needed for this setting"); } private void SaveMovie() { - if (Global.MovieSession.Movie.IsActive) + if (GlobalWinF.MovieSession.Movie.IsActive) { - Global.MovieSession.Movie.WriteMovie(); - Global.OSD.AddMessage(Global.MovieSession.Movie.Filename + " saved."); + GlobalWinF.MovieSession.Movie.WriteMovie(); + GlobalWinF.OSD.AddMessage(GlobalWinF.MovieSession.Movie.Filename + " saved."); } } @@ -4191,13 +4193,13 @@ namespace BizHawk.MultiClient { if (StatusSlot0.Visible) { - if (Global.Emulator.CoreComm.UsesDriveLed) + if (GlobalWinF.Emulator.CoreComm.UsesDriveLed) { if (!StatusBarLedLight.Visible) { StatusBarLedLight.Visible = true; } - if (Global.Emulator.CoreComm.DriveLED) + if (GlobalWinF.Emulator.CoreComm.DriveLED) { StatusBarLedLight.Image = Properties.Resources.LightOn; } @@ -4241,11 +4243,11 @@ namespace BizHawk.MultiClient Global.Config.MoviePlaybackPokeMode ^= true; if (Global.Config.MoviePlaybackPokeMode) { - Global.OSD.AddMessage("Movie Poke mode enabled"); + GlobalWinF.OSD.AddMessage("Movie Poke mode enabled"); } else { - Global.OSD.AddMessage("Movie Poke mode disabled"); + GlobalWinF.OSD.AddMessage("Movie Poke mode disabled"); } } @@ -4263,7 +4265,7 @@ namespace BizHawk.MultiClient private void configToolStripMenuItem_DropDownOpened(object sender, EventArgs e) { - controllersToolStripMenuItem.Enabled = !(Global.Emulator is NullEmulator); + controllersToolStripMenuItem.Enabled = !(GlobalWinF.Emulator is NullEmulator); } private void firmwaresToolStripMenuItem_Click(object sender, EventArgs e) @@ -4273,12 +4275,12 @@ namespace BizHawk.MultiClient private void menuStrip1_Leave(object sender, EventArgs e) { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; } private void MainForm_Enter(object sender, EventArgs e) { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; } public void LoadRamWatch(bool load_dialog) diff --git a/BizHawk.MultiClient/Program.cs b/BizHawk.MultiClient/Program.cs index 96d2a38ae0..f466f7aad3 100644 --- a/BizHawk.MultiClient/Program.cs +++ b/BizHawk.MultiClient/Program.cs @@ -12,6 +12,8 @@ using Microsoft.VisualBasic.ApplicationServices; #pragma warning disable 618 +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { static class Program @@ -67,13 +69,13 @@ namespace BizHawk.MultiClient Global.Config.ResolveDefaults(); #if WINDOWS - try { Global.DSound = SoundEnumeration.Create(); } + try { GlobalWinF.DSound = SoundEnumeration.Create(); } catch { MessageBox.Show("Couldn't initialize DirectSound! Things may go poorly for you. Try changing your sound driver to 41khz instead of 48khz in mmsys.cpl.", "Initialization Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } - try { Global.Direct3D = new Direct3D(); } + try { GlobalWinF.Direct3D = new Direct3D(); } catch { //fallback to GDI rendering @@ -122,10 +124,10 @@ namespace BizHawk.MultiClient #if WINDOWS finally { - if (Global.DSound != null && Global.DSound.Disposed == false) - Global.DSound.Dispose(); - if (Global.Direct3D != null && Global.Direct3D.Disposed == false) - Global.Direct3D.Dispose(); + if (GlobalWinF.DSound != null && GlobalWinF.DSound.Disposed == false) + GlobalWinF.DSound.Dispose(); + if (GlobalWinF.Direct3D != null && GlobalWinF.Direct3D.Disposed == false) + GlobalWinF.Direct3D.Dispose(); GamePad.CloseAll(); } #endif diff --git a/BizHawk.MultiClient/RenderPanel.cs b/BizHawk.MultiClient/RenderPanel.cs index b1c888d534..4c3ae34eb0 100644 --- a/BizHawk.MultiClient/RenderPanel.cs +++ b/BizHawk.MultiClient/RenderPanel.cs @@ -10,6 +10,8 @@ using SlimDX; using SlimDX.Direct3D9; using d3d9font=SlimDX.Direct3D9.Font; #endif + +using BizHawk.Client.Core; using BizHawk.Core; namespace BizHawk.MultiClient @@ -346,13 +348,13 @@ namespace BizHawk.MultiClient d3d = direct3D; backingControl = control; control.MouseDoubleClick += (o, e) => HandleFullscreenToggle(o, e); - control.MouseClick += (o, e) => Global.MainForm.MainForm_MouseClick(o, e); + control.MouseClick += (o, e) => GlobalWinF.MainForm.MainForm_MouseClick(o, e); } private void HandleFullscreenToggle(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) - Global.MainForm.ToggleFullscreen(); + GlobalWinF.MainForm.ToggleFullscreen(); } private void DestroyDevice() @@ -390,7 +392,7 @@ namespace BizHawk.MultiClient { get { - if (Global.ForceNoThrottle) + if (GlobalWinF.ForceNoThrottle) return false; return Global.Config.VSyncThrottle || Global.Config.VSync; } @@ -461,13 +463,13 @@ namespace BizHawk.MultiClient // Wait until device is available or user gets annoyed and closes app Result r; // it can take a while for the device to be ready again, so avoid sound looping during the wait - if (Global.Sound != null) Global.Sound.StopSound(); + if (GlobalWinF.Sound != null) GlobalWinF.Sound.StopSound(); do { r = _device.TestCooperativeLevel(); Thread.Sleep(100); } while (r == ResultCode.DeviceLost); - if (Global.Sound != null) Global.Sound.StartSound(); + if (GlobalWinF.Sound != null) GlobalWinF.Sound.StartSound(); // lets try recovery! DestroyDevice(); diff --git a/BizHawk.MultiClient/SavestateManager.cs b/BizHawk.MultiClient/SavestateManager.cs index faca48799b..fb30336089 100644 --- a/BizHawk.MultiClient/SavestateManager.cs +++ b/BizHawk.MultiClient/SavestateManager.cs @@ -1,5 +1,7 @@ using System.IO; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { class SavestateManager @@ -14,7 +16,7 @@ namespace BizHawk.MultiClient public void Update() { - if (Global.Game == null || Global.Emulator == null) + if (Global.Game == null || GlobalWinF.Emulator == null) { for (int x = 0; x < 10; x++) slots[x] = false; diff --git a/BizHawk.MultiClient/Sound.cs b/BizHawk.MultiClient/Sound.cs index e1b17d38aa..b26404ed22 100644 --- a/BizHawk.MultiClient/Sound.cs +++ b/BizHawk.MultiClient/Sound.cs @@ -6,6 +6,8 @@ using SlimDX.DirectSound; using SlimDX.Multimedia; #endif +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { #if WINDOWS @@ -135,7 +137,7 @@ namespace BizHawk.MultiClient syncsoundProvider = null; asyncsoundProvider = source; semisync.BaseSoundProvider = source; - semisync.RecalculateMagic(Global.CoreComm.VsyncRate); + semisync.RecalculateMagic(GlobalWinF.CoreComm.VsyncRate); } static int circularDist(int from, int to, int size) @@ -206,7 +208,7 @@ namespace BizHawk.MultiClient samplesProvided = 2 * nsampgot; - if (!Global.ForceNoThrottle) + if (!GlobalWinF.ForceNoThrottle) while (samplesNeeded < samplesProvided) { System.Threading.Thread.Sleep((samplesProvided - samplesNeeded) / 88); // let audio clock control sleep time diff --git a/BizHawk.MultiClient/Throttle.cs b/BizHawk.MultiClient/Throttle.cs index f491688361..b5708e98d2 100644 --- a/BizHawk.MultiClient/Throttle.cs +++ b/BizHawk.MultiClient/Throttle.cs @@ -2,6 +2,8 @@ using System.Runtime.InteropServices; using System.Threading; +using BizHawk.Client.Core; + //this throttle is nitsuja's fine-tuned techniques from desmume namespace BizHawk.MultiClient @@ -23,7 +25,7 @@ namespace BizHawk.MultiClient { get { - if (Global.ClientControls["MaxTurbo"]) + if (GlobalWinF.ClientControls["MaxTurbo"]) { return 20; } @@ -37,7 +39,7 @@ namespace BizHawk.MultiClient { get { - if (Global.ClientControls["MaxTurbo"]) + if (GlobalWinF.ClientControls["MaxTurbo"]) { return false; } @@ -52,7 +54,7 @@ namespace BizHawk.MultiClient { get { - if (Global.ClientControls["MaxTurbo"]) + if (GlobalWinF.ClientControls["MaxTurbo"]) { return false; } diff --git a/BizHawk.MultiClient/config/AutofireConfig.cs b/BizHawk.MultiClient/config/AutofireConfig.cs index 385d03c4d0..1d2ee433c1 100644 --- a/BizHawk.MultiClient/config/AutofireConfig.cs +++ b/BizHawk.MultiClient/config/AutofireConfig.cs @@ -7,6 +7,8 @@ using System.Linq; using System.Text; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class AutofireConfig : Form @@ -37,18 +39,18 @@ namespace BizHawk.MultiClient private void Ok_Click(object sender, EventArgs e) { - Global.AutoFireController.On = Global.Config.AutofireOn = (int)OnNumeric.Value; - Global.AutoFireController.Off = Global.Config.AutofireOff = (int)OffNumeric.Value; + GlobalWinF.AutoFireController.On = Global.Config.AutofireOn = (int)OnNumeric.Value; + GlobalWinF.AutoFireController.Off = Global.Config.AutofireOff = (int)OffNumeric.Value; Global.Config.AutofireLagFrames = LagFrameCheck.Checked; - Global.AutofireStickyXORAdapter.SetOnOffPatternFromConfig(); + GlobalWinF.AutofireStickyXORAdapter.SetOnOffPatternFromConfig(); - Global.OSD.AddMessage("Autofire settings saved"); + GlobalWinF.OSD.AddMessage("Autofire settings saved"); this.Close(); } private void Cancel_Click(object sender, EventArgs e) { - Global.OSD.AddMessage("Autofire config aborted"); + GlobalWinF.OSD.AddMessage("Autofire config aborted"); this.Close(); } } diff --git a/BizHawk.MultiClient/config/ControllerConfig.cs b/BizHawk.MultiClient/config/ControllerConfig.cs index 0139b8ce94..32b135e945 100644 --- a/BizHawk.MultiClient/config/ControllerConfig.cs +++ b/BizHawk.MultiClient/config/ControllerConfig.cs @@ -4,6 +4,8 @@ using System.Drawing; using System.Linq; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class ControllerConfig : Form @@ -51,7 +53,7 @@ namespace BizHawk.MultiClient return cp; } - Control CreateAnalogPanel(Dictionary settings, List buttons, Size size) + Control CreateAnalogPanel(Dictionary settings, List buttons, Size size) { var acp = new AnalogBindPanel(settings, buttons) { Dock = DockStyle.Fill }; return acp; @@ -115,7 +117,7 @@ namespace BizHawk.MultiClient } if (buckets[0].Count > 0) { - if (Global.Emulator.SystemId == "C64") //This is a kludge, if there starts to be more exceptions to this pattern, we will need a more robust solution + if (GlobalWinF.Emulator.SystemId == "C64") //This is a kludge, if there starts to be more exceptions to this pattern, we will need a more robust solution { tt.TabPages.Add("Keyboard"); } @@ -153,7 +155,7 @@ namespace BizHawk.MultiClient private void LoadPanels(Dictionary> normal, Dictionary> autofire, - Dictionary> analog) + Dictionary> analog) { LoadToPanel(tabPage1, the_definition.Name, the_definition.BoolButtons, normal, "", CreateNormalPanel); LoadToPanel(tabPage2, the_definition.Name, the_definition.BoolButtons, autofire, "", CreateNormalPanel); @@ -170,7 +172,7 @@ namespace BizHawk.MultiClient LoadPanels(cd.AllTrollers, cd.AllTrollersAutoFire, cd.AllTrollersAnalog); } - private void LoadPanels(Config c) + private void LoadPanels(BizHawk.Client.Core.Config c) { LoadPanels(c.AllTrollers, c.AllTrollersAutoFire, c.AllTrollersAnalog); } @@ -257,14 +259,14 @@ namespace BizHawk.MultiClient Save(); - Global.OSD.AddMessage("Controller settings saved"); + GlobalWinF.OSD.AddMessage("Controller settings saved"); DialogResult = DialogResult.OK; Close(); } private void buttonCancel_Click(object sender, EventArgs e) { - Global.OSD.AddMessage("Controller config aborted"); + GlobalWinF.OSD.AddMessage("Controller config aborted"); Close(); } @@ -356,10 +358,10 @@ namespace BizHawk.MultiClient { public Dictionary> AllTrollers = new Dictionary>(); public Dictionary> AllTrollersAutoFire = new Dictionary>(); - public Dictionary> AllTrollersAnalog = new Dictionary>(); + public Dictionary> AllTrollersAnalog = new Dictionary>(); } - public static void ConfigCheckAllControlDefaults(Config c) + public static void ConfigCheckAllControlDefaults(BizHawk.Client.Core.Config c) { if (c.AllTrollers.Count == 0 && c.AllTrollersAutoFire.Count == 0 && c.AllTrollersAnalog.Count == 0) { @@ -380,7 +382,7 @@ namespace BizHawk.MultiClient cd = ConfigService.Load(ControlDefaultPath, cd); cd.AllTrollers[the_definition.Name] = new Dictionary(); cd.AllTrollersAutoFire[the_definition.Name] = new Dictionary(); - cd.AllTrollersAnalog[the_definition.Name] = new Dictionary(); + cd.AllTrollersAnalog[the_definition.Name] = new Dictionary(); SaveToDefaults(cd); diff --git a/BizHawk.MultiClient/config/ControllerConfig/AnalogBindControl.cs b/BizHawk.MultiClient/config/ControllerConfig/AnalogBindControl.cs index 4395016bac..2ebe26bad2 100644 --- a/BizHawk.MultiClient/config/ControllerConfig/AnalogBindControl.cs +++ b/BizHawk.MultiClient/config/ControllerConfig/AnalogBindControl.cs @@ -7,6 +7,8 @@ using System.Linq; using System.Text; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class AnalogBindControl : UserControl @@ -17,10 +19,10 @@ namespace BizHawk.MultiClient } public string ButtonName; - public Config.AnalogBind Bind; + public BizHawk.Client.Core.Config.AnalogBind Bind; bool listening = false; - public AnalogBindControl(string ButtonName, Config.AnalogBind Bind) + public AnalogBindControl(string ButtonName, BizHawk.Client.Core.Config.AnalogBind Bind) : this() { this.Bind = Bind; diff --git a/BizHawk.MultiClient/config/ControllerConfig/AnalogBindPanel.cs b/BizHawk.MultiClient/config/ControllerConfig/AnalogBindPanel.cs index 2be74fbf40..bcfb0ffa63 100644 --- a/BizHawk.MultiClient/config/ControllerConfig/AnalogBindPanel.cs +++ b/BizHawk.MultiClient/config/ControllerConfig/AnalogBindPanel.cs @@ -5,13 +5,15 @@ using System.Text; using System.Windows.Forms; using System.Drawing; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { class AnalogBindPanel : UserControl { - Dictionary RealConfigObject; + Dictionary RealConfigObject; - public AnalogBindPanel(Dictionary RealConfigObject, List RealConfigButtons = null) + public AnalogBindPanel(Dictionary RealConfigObject, List RealConfigButtons = null) :base() { this.RealConfigObject = RealConfigObject; @@ -38,7 +40,7 @@ namespace BizHawk.MultiClient /// save to config /// /// if non-null, save to possibly different config object than originally initialized from - public void Save(Dictionary SaveConfigObject = null) + public void Save(Dictionary SaveConfigObject = null) { var saveto = SaveConfigObject ?? RealConfigObject; foreach (Control c in Controls) diff --git a/BizHawk.MultiClient/config/FirmwaresConfig.cs b/BizHawk.MultiClient/config/FirmwaresConfig.cs index 69de8be2ca..2fc974a21f 100644 --- a/BizHawk.MultiClient/config/FirmwaresConfig.cs +++ b/BizHawk.MultiClient/config/FirmwaresConfig.cs @@ -9,6 +9,8 @@ using System.Linq; using System.Text; using System.Windows.Forms; +using BizHawk.Client.Core; + //notes: eventually, we intend to have a "firmware acquisition interface" exposed to the emulator cores. //it will be implemented by the multiclient, and use firmware keys to fetch the firmware content. //however, for now, the cores are using strings from the config class. so we have the `configMember` which is @@ -175,7 +177,7 @@ namespace BizHawk.MultiClient DoScan(); } - FirmwareManager Manager { get { return Global.MainForm.FirmwareManager; } } + FirmwareManager Manager { get { return GlobalWinF.MainForm.FirmwareManager; } } private void DoScan() { diff --git a/BizHawk.MultiClient/config/GifAnimator.cs b/BizHawk.MultiClient/config/GifAnimator.cs index 6238107c5d..6093c45284 100644 --- a/BizHawk.MultiClient/config/GifAnimator.cs +++ b/BizHawk.MultiClient/config/GifAnimator.cs @@ -7,6 +7,8 @@ using System.Linq; using System.Text; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class GifAnimator : Form diff --git a/BizHawk.MultiClient/config/HotkeyConfig.cs b/BizHawk.MultiClient/config/HotkeyConfig.cs index 9c6816df2c..3f396f53f0 100644 --- a/BizHawk.MultiClient/config/HotkeyConfig.cs +++ b/BizHawk.MultiClient/config/HotkeyConfig.cs @@ -7,6 +7,8 @@ using System.Linq; using System.Text; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class HotkeyConfig : Form @@ -31,14 +33,14 @@ namespace BizHawk.MultiClient private void IDB_CANCEL_Click(object sender, EventArgs e) { - Global.OSD.AddMessage("Hotkey config aborted"); + GlobalWinF.OSD.AddMessage("Hotkey config aborted"); Close(); } private void IDB_SAVE_Click(object sender, EventArgs e) { Save(); - Global.OSD.AddMessage("Hotkey settings saved"); + GlobalWinF.OSD.AddMessage("Hotkey settings saved"); DialogResult = DialogResult.OK; Close(); } @@ -59,7 +61,7 @@ namespace BizHawk.MultiClient foreach (InputWidget w in _inputWidgets) { - Binding b = Global.Config.HotkeyBindings.FirstOrDefault(x => x.DisplayName == w.WidgetName); + var b = Global.Config.HotkeyBindings.FirstOrDefault(x => x.DisplayName == w.WidgetName); b.Bindings = w.Text; } } @@ -95,14 +97,14 @@ namespace BizHawk.MultiClient tb.Name = tab; tb.Text = tab; - List bindings = Global.Config.HotkeyBindings.Where(x => x.TabGroup == tab).OrderBy(x => x.Ordinal).ThenBy(x => x.DisplayName).ToList(); + var bindings = Global.Config.HotkeyBindings.Where(x => x.TabGroup == tab).OrderBy(x => x.Ordinal).ThenBy(x => x.DisplayName).ToList(); int _x = 6; int _y = 14; int iw_offset_x = 110; int iw_offset_y = -4; int iw_width = 120; - foreach (Binding b in bindings) + foreach (var b in bindings) { Label l = new Label() { @@ -139,7 +141,7 @@ namespace BizHawk.MultiClient { foreach (InputWidget w in _inputWidgets) { - Binding b = Global.Config.HotkeyBindings.FirstOrDefault(x => x.DisplayName == w.WidgetName); + var b = Global.Config.HotkeyBindings.FirstOrDefault(x => x.DisplayName == w.WidgetName); w.Text = b.DefaultBinding; } } @@ -180,7 +182,7 @@ namespace BizHawk.MultiClient { string user_selection = SearchBox.Text; - Binding b = Global.Config.HotkeyBindings.FirstOrDefault(x => x.DisplayName == SearchBox.Text); + var b = Global.Config.HotkeyBindings.FirstOrDefault(x => x.DisplayName == SearchBox.Text); //Found if (b != null) diff --git a/BizHawk.MultiClient/config/MessageConfig.cs b/BizHawk.MultiClient/config/MessageConfig.cs index 0590e1e7f0..56c4e65039 100644 --- a/BizHawk.MultiClient/config/MessageConfig.cs +++ b/BizHawk.MultiClient/config/MessageConfig.cs @@ -7,6 +7,8 @@ using System.Linq; using System.Text; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class MessageConfig : Form @@ -68,17 +70,17 @@ namespace BizHawk.MultiClient private void SetMaxXY() { - XNumeric.Maximum = Global.Emulator.VideoProvider.BufferWidth - 12; - YNumeric.Maximum = Global.Emulator.VideoProvider.BufferHeight - 12; - PositionPanel.Size = new Size(Global.Emulator.VideoProvider.BufferWidth + 2, Global.Emulator.VideoProvider.BufferHeight + 2); + XNumeric.Maximum = GlobalWinF.Emulator.VideoProvider.BufferWidth - 12; + YNumeric.Maximum = GlobalWinF.Emulator.VideoProvider.BufferHeight - 12; + PositionPanel.Size = new Size(GlobalWinF.Emulator.VideoProvider.BufferWidth + 2, GlobalWinF.Emulator.VideoProvider.BufferHeight + 2); int width; - if (Global.Emulator.VideoProvider.BufferWidth > 128) - width = Global.Emulator.VideoProvider.BufferWidth + 44; + if (GlobalWinF.Emulator.VideoProvider.BufferWidth > 128) + width = GlobalWinF.Emulator.VideoProvider.BufferWidth + 44; else width = 128 + 44; - PositionGroupBox.Size = new Size(width, Global.Emulator.VideoProvider.BufferHeight + 52); + PositionGroupBox.Size = new Size(width, GlobalWinF.Emulator.VideoProvider.BufferHeight + 52); } private void SetColorBox() @@ -227,7 +229,7 @@ namespace BizHawk.MultiClient private void OK_Click(object sender, EventArgs e) { SaveSettings(); - Global.OSD.AddMessage("Message settings saved"); + GlobalWinF.OSD.AddMessage("Message settings saved"); this.Close(); } @@ -287,7 +289,7 @@ namespace BizHawk.MultiClient private void Cancel_Click(object sender, EventArgs e) { - Global.OSD.AddMessage("Message config aborted"); + GlobalWinF.OSD.AddMessage("Message config aborted"); this.Close(); } diff --git a/BizHawk.MultiClient/config/PathConfig.cs b/BizHawk.MultiClient/config/PathConfig.cs index bbd55dc642..7b9f75fd62 100644 --- a/BizHawk.MultiClient/config/PathConfig.cs +++ b/BizHawk.MultiClient/config/PathConfig.cs @@ -7,6 +7,8 @@ using System.Linq; using System.Text; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class PathConfig : Form @@ -56,13 +58,13 @@ namespace BizHawk.MultiClient private void OK_Click(object sender, EventArgs e) { SaveSettings(); - Global.OSD.AddMessage("Path settings saved"); + GlobalWinF.OSD.AddMessage("Path settings saved"); Close(); } private void Cancel_Click(object sender, EventArgs e) { - Global.OSD.AddMessage("Path config aborted"); + GlobalWinF.OSD.AddMessage("Path config aborted"); Close(); } diff --git a/BizHawk.MultiClient/config/PathManager.cs b/BizHawk.MultiClient/config/PathManager.cs index 2650adea30..015008f3ef 100644 --- a/BizHawk.MultiClient/config/PathManager.cs +++ b/BizHawk.MultiClient/config/PathManager.cs @@ -3,6 +3,8 @@ using System.Linq; using System.IO; using System.Reflection; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public static class PathManager @@ -228,9 +230,9 @@ namespace BizHawk.MultiClient public static string SaveRamPath(GameInfo game) { string name = FilesystemSafeName(game); - if (Global.MovieSession.Movie.IsActive) + if (GlobalWinF.MovieSession.Movie.IsActive) { - name += "." + Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename); + name += "." + Path.GetFileNameWithoutExtension(GlobalWinF.MovieSession.Movie.Filename); } PathEntry pathEntry = Global.Config.PathEntries[game.System, "Save RAM"]; @@ -259,9 +261,9 @@ namespace BizHawk.MultiClient { string name = FilesystemSafeName(game); - if (Global.Config.BindSavestatesToMovies && Global.MovieSession.Movie.IsActive) + if (Global.Config.BindSavestatesToMovies && GlobalWinF.MovieSession.Movie.IsActive) { - name += "." + Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename); + name += "." + Path.GetFileNameWithoutExtension(GlobalWinF.MovieSession.Movie.Filename); } PathEntry pathEntry = Global.Config.PathEntries[game.System, "Savestates"]; diff --git a/BizHawk.MultiClient/config/RewindConfig.cs b/BizHawk.MultiClient/config/RewindConfig.cs index e208676578..86e4119e92 100644 --- a/BizHawk.MultiClient/config/RewindConfig.cs +++ b/BizHawk.MultiClient/config/RewindConfig.cs @@ -2,6 +2,8 @@ using System.Windows.Forms; using System.Drawing; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class RewindConfig : Form @@ -9,7 +11,7 @@ namespace BizHawk.MultiClient private long StateSize; private int MediumStateSize; private int LargeStateSize; - private int StateSizeCategory = 1; //1 = small, 2 = med, 3 = larg //TODO: enum + private int StateSizeCategory = 1; //1 = small, 2 = med, 3 = larg //TODO: enum public RewindConfig() { InitializeComponent(); @@ -17,10 +19,10 @@ namespace BizHawk.MultiClient private void RewindConfig_Load(object sender, EventArgs e) { - if (Global.MainForm.RewindBuf != null) + if (GlobalWinF.MainForm.RewindBuf != null) { - FullnessLabel.Text = String.Format("{0:0.00}", Global.MainForm.Rewind_FullnessRatio * 100) + "%"; - RewindFramesUsedLabel.Text = Global.MainForm.Rewind_Count.ToString(); + FullnessLabel.Text = String.Format("{0:0.00}", GlobalWinF.MainForm.Rewind_FullnessRatio * 100) + "%"; + RewindFramesUsedLabel.Text = GlobalWinF.MainForm.Rewind_Count.ToString(); } else { @@ -31,7 +33,7 @@ namespace BizHawk.MultiClient DiskBufferCheckbox.Checked = Global.Config.Rewind_OnDisk; RewindIsThreadedCheckbox.Checked = Global.Config.Rewind_IsThreaded; - StateSize = Global.Emulator.SaveStateBinary().Length; + StateSize = GlobalWinF.Emulator.SaveStateBinary().Length; BufferSizeUpDown.Value = Global.Config.Rewind_BufferSize; MediumStateSize = Global.Config.Rewind_MediumStateSize; @@ -109,13 +111,13 @@ namespace BizHawk.MultiClient private void Cancel_Click(object sender, EventArgs e) { - Global.OSD.AddMessage("Rewind config aborted"); + GlobalWinF.OSD.AddMessage("Rewind config aborted"); Close(); } private void OK_Click(object sender, EventArgs e) { - Global.OSD.AddMessage("Rewind settings saved"); + GlobalWinF.OSD.AddMessage("Rewind settings saved"); Global.Config.RewindFrequencySmall = (int)SmallSavestateNumeric.Value; Global.Config.RewindFrequencyMedium = (int)MediumSavestateNumeric.Value; @@ -125,7 +127,7 @@ namespace BizHawk.MultiClient Global.Config.RewindEnabledMedium = MediumStateEnabledBox.Checked; Global.Config.RewindEnabledLarge = LargeStateEnabledBox.Checked; - Global.MainForm.DoRewindSettings(); + GlobalWinF.MainForm.DoRewindSettings(); Global.Config.Rewind_UseDelta = UseDeltaCompression.Checked; @@ -135,7 +137,7 @@ namespace BizHawk.MultiClient Global.Config.Rewind_BufferSize = (int)BufferSizeUpDown.Value; if (Global.Config.Rewind_IsThreaded != RewindIsThreadedCheckbox.Checked) { - Global.MainForm.FlagNeedsReboot(); + GlobalWinF.MainForm.FlagNeedsReboot(); Global.Config.Rewind_IsThreaded = RewindIsThreadedCheckbox.Checked; } @@ -258,13 +260,13 @@ namespace BizHawk.MultiClient if (UseDeltaCompression.Checked || StateSize == 0) { - if (Global.MainForm.Rewind_Count > 0) + if (GlobalWinF.MainForm.Rewind_Count > 0) { - avg_state_size = (long)(Global.MainForm.Rewind_Size / Global.MainForm.Rewind_Count); + avg_state_size = (long)(GlobalWinF.MainForm.Rewind_Size / GlobalWinF.MainForm.Rewind_Count); } else { - avg_state_size = Global.Emulator.SaveStateBinary().Length; + avg_state_size = GlobalWinF.Emulator.SaveStateBinary().Length; } } else diff --git a/BizHawk.MultiClient/config/SoundConfig.cs b/BizHawk.MultiClient/config/SoundConfig.cs index c99e1af3df..407940f229 100644 --- a/BizHawk.MultiClient/config/SoundConfig.cs +++ b/BizHawk.MultiClient/config/SoundConfig.cs @@ -7,6 +7,8 @@ using System.Linq; using System.Text; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class SoundConfig : Form @@ -47,16 +49,16 @@ namespace BizHawk.MultiClient Global.Config.SoundVolume = SoundVolBar.Value; Global.Config.SoundThrottle = ThrottlecheckBox.Checked; Global.Config.SoundDevice = (string)listBoxSoundDevices.SelectedItem ?? ""; - Global.Sound.ChangeVolume(Global.Config.SoundVolume); - Global.Sound.UpdateSoundSettings(); - Global.Sound.StartSound(); - Global.OSD.AddMessage("Sound settings saved"); + GlobalWinF.Sound.ChangeVolume(Global.Config.SoundVolume); + GlobalWinF.Sound.UpdateSoundSettings(); + GlobalWinF.Sound.StartSound(); + GlobalWinF.OSD.AddMessage("Sound settings saved"); this.Close(); } private void Cancel_Click(object sender, EventArgs e) { - Global.OSD.AddMessage("Sound config aborted"); + GlobalWinF.OSD.AddMessage("Sound config aborted"); this.Close(); } diff --git a/BizHawk.MultiClient/movie/InputAdapters.cs b/BizHawk.MultiClient/movie/InputAdapters.cs index 20fe124929..09a54abe41 100644 --- a/BizHawk.MultiClient/movie/InputAdapters.cs +++ b/BizHawk.MultiClient/movie/InputAdapters.cs @@ -2,6 +2,8 @@ using System.Text; using System.Collections.Generic; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { /// @@ -307,7 +309,7 @@ namespace BizHawk.MultiClient { if (stickySet.Contains(button)) { - int a = (Global.Emulator.Frame - buttonStarts[button]) % (On + Off); + int a = (GlobalWinF.Emulator.Frame - buttonStarts[button]) % (On + Off); if (a < On) return this[button]; else @@ -331,7 +333,7 @@ namespace BizHawk.MultiClient { - int a = (Global.Emulator.Frame - buttonStarts[button]) % (On + Off); + int a = (GlobalWinF.Emulator.Frame - buttonStarts[button]) % (On + Off); if (a < On) { source ^= true; diff --git a/BizHawk.MultiClient/movie/Movie.cs b/BizHawk.MultiClient/movie/Movie.cs index f7f224c035..1e77996e6e 100644 --- a/BizHawk.MultiClient/movie/Movie.cs +++ b/BizHawk.MultiClient/movie/Movie.cs @@ -3,6 +3,8 @@ using System.IO; using System.Windows.Forms; using System.Globalization; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public class Movie @@ -239,7 +241,7 @@ namespace BizHawk.MultiClient /// public void StartRecording(bool truncate = true) { - Global.MainForm.ClearSaveRAM(); + GlobalWinF.MainForm.ClearSaveRAM(); Mode = MOVIEMODE.RECORD; if (Global.Config.EnableBackupMovies && MakeBackup && Log.Length > 0) { @@ -254,7 +256,7 @@ namespace BizHawk.MultiClient public void StartPlayback() { - Global.MainForm.ClearSaveRAM(); + GlobalWinF.MainForm.ClearSaveRAM(); Mode = MOVIEMODE.PLAY; } @@ -372,7 +374,7 @@ namespace BizHawk.MultiClient var directory_info = new FileInfo(BackupName).Directory; if (directory_info != null) Directory.CreateDirectory(directory_info.FullName); - Global.OSD.AddMessage("Backup movie saved to " + BackupName); + GlobalWinF.OSD.AddMessage("Backup movie saved to " + BackupName); if (IsText) { WriteText(BackupName); @@ -563,7 +565,7 @@ namespace BizHawk.MultiClient { if (StateCapturing) { - byte[] state = Global.Emulator.SaveStateBinary(); + byte[] state = GlobalWinF.Emulator.SaveStateBinary(); Log.AddState(state); GC.Collect(); } @@ -575,43 +577,43 @@ namespace BizHawk.MultiClient { return; } - if (frame <= Global.Emulator.Frame) + if (frame <= GlobalWinF.Emulator.Frame) { if (frame <= Log.StateFirstIndex) { - Global.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(Log.InitState))); - if (Global.MainForm.EmulatorPaused && frame > 0) + GlobalWinF.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(Log.InitState))); + if (GlobalWinF.MainForm.EmulatorPaused && frame > 0) { - Global.MainForm.UnpauseEmulator(); + GlobalWinF.MainForm.UnpauseEmulator(); } if (MOVIEMODE.RECORD == Mode) { Mode = MOVIEMODE.PLAY; - Global.MainForm.RestoreReadWriteOnStop = true; + GlobalWinF.MainForm.RestoreReadWriteOnStop = true; } } else { if (frame == 0) { - Global.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(Log.InitState))); + GlobalWinF.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(Log.InitState))); } else { //frame-1 because we need to go back an extra frame and then run a frame, otherwise the display doesn't get updated. - Global.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(Log.GetState(frame - 1)))); - Global.MainForm.UpdateFrame = true; + GlobalWinF.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(Log.GetState(frame - 1)))); + GlobalWinF.MainForm.UpdateFrame = true; } } } else if (frame <= Log.StateLastIndex) { - Global.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(Log.GetState(frame - 1)))); - Global.MainForm.UpdateFrame = true; + GlobalWinF.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(Log.GetState(frame - 1)))); + GlobalWinF.MainForm.UpdateFrame = true; } else { - Global.MainForm.UnpauseEmulator(); + GlobalWinF.MainForm.UnpauseEmulator(); } } @@ -628,10 +630,10 @@ namespace BizHawk.MultiClient //this allows users to restore a movie with any savestate from that "timeline" if (Global.Config.VBAStyleMovieLoadState) { - if (Global.Emulator.Frame < Log.Length) + if (GlobalWinF.Emulator.Frame < Log.Length) { - Log.TruncateMovie(Global.Emulator.Frame); - Log .TruncateStates(Global.Emulator.Frame); + Log.TruncateMovie(GlobalWinF.Emulator.Frame); + Log .TruncateStates(GlobalWinF.Emulator.Frame); } } changes = true; @@ -664,7 +666,7 @@ namespace BizHawk.MultiClient { int? stateFrame = null; //We are in record mode so replace the movie log with the one from the savestate - if (!Global.MovieSession.MultiTrack.IsActive) + if (!GlobalWinF.MovieSession.MultiTrack.IsActive) { if (Global.Config.EnableBackupMovies && MakeBackup && Log.Length > 0) { @@ -686,7 +688,7 @@ namespace BizHawk.MultiClient { stateFrame = int.Parse(strs[1], NumberStyles.HexNumber); } - catch { Global.OSD.AddMessage("Savestate Frame failed to parse"); } //TODO: message? + catch { GlobalWinF.OSD.AddMessage("Savestate Frame failed to parse"); } //TODO: message? } else if (line.Contains("Frame ")) { @@ -695,7 +697,7 @@ namespace BizHawk.MultiClient { stateFrame = int.Parse(strs[1]); } - catch { Global.OSD.AddMessage("Savestate Frame failed to parse"); } //TODO: message? + catch { GlobalWinF.OSD.AddMessage("Savestate Frame failed to parse"); } //TODO: message? } if (line[0] == '|') { @@ -720,7 +722,7 @@ namespace BizHawk.MultiClient { stateFrame = int.Parse(strs[1], NumberStyles.HexNumber); } - catch { Global.OSD.AddMessage("Savestate Frame failed to parse"); } //TODO: message? + catch { GlobalWinF.OSD.AddMessage("Savestate Frame failed to parse"); } //TODO: message? } else if (line.Contains("Frame ")) { @@ -843,7 +845,7 @@ namespace BizHawk.MultiClient { stateFrame = int.Parse(strs[1], NumberStyles.HexNumber); } - catch { Global.OSD.AddMessage("Savestate Frame number failed to parse"); } + catch { GlobalWinF.OSD.AddMessage("Savestate Frame number failed to parse"); } } else if (line.Contains("Frame ")) { @@ -852,7 +854,7 @@ namespace BizHawk.MultiClient { stateFrame = int.Parse(strs[1]); } - catch { Global.OSD.AddMessage("Savestate Frame number failed to parse"); } + catch { GlobalWinF.OSD.AddMessage("Savestate Frame number failed to parse"); } } else if (line == "[Input]") continue; else if (line == "[/Input]") break; diff --git a/BizHawk.MultiClient/movie/MovieHeader.cs b/BizHawk.MultiClient/movie/MovieHeader.cs index b5ba4674b7..c529ce3d3f 100644 --- a/BizHawk.MultiClient/movie/MovieHeader.cs +++ b/BizHawk.MultiClient/movie/MovieHeader.cs @@ -2,6 +2,8 @@ using System.IO; using System.Linq; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public class MovieHeader @@ -55,9 +57,9 @@ namespace BizHawk.MultiClient public MovieHeader() //All required fields will be set to default values { - if (Global.MainForm != null) + if (GlobalWinF.MainForm != null) { - HeaderParams.Add(EMULATIONVERSION, Global.MainForm.GetEmuVersion()); + HeaderParams.Add(EMULATIONVERSION, GlobalWinF.MainForm.GetEmuVersion()); } else { diff --git a/BizHawk.MultiClient/movie/MovieImport.cs b/BizHawk.MultiClient/movie/MovieImport.cs index 0b36faac26..21e406e54f 100644 --- a/BizHawk.MultiClient/movie/MovieImport.cs +++ b/BizHawk.MultiClient/movie/MovieImport.cs @@ -4,6 +4,8 @@ using System.Linq; using System.Text; using System.IO; +using BizHawk.Client.Core; + #pragma warning disable 219 namespace BizHawk.MultiClient diff --git a/BizHawk.MultiClient/movie/MovieLog.cs b/BizHawk.MultiClient/movie/MovieLog.cs index 4888c26111..a36fb0e0fd 100644 --- a/BizHawk.MultiClient/movie/MovieLog.cs +++ b/BizHawk.MultiClient/movie/MovieLog.cs @@ -81,23 +81,23 @@ namespace BizHawk.MultiClient public void AddState(byte[] state) { - if (Global.Emulator.Frame == 0) + if (GlobalWinF.Emulator.Frame == 0) { InitState = state; } - if (Global.Emulator.Frame < StateFirstIndex) + if (GlobalWinF.Emulator.Frame < StateFirstIndex) { _state_records.Clear(); - _state_records.Add(new StateRecord(Global.Emulator.Frame, state)); + _state_records.Add(new StateRecord(GlobalWinF.Emulator.Frame, state)); } - if (Global.Emulator.Frame > StateLastIndex) + if (GlobalWinF.Emulator.Frame > StateLastIndex) { if (StateSizeInBytes + state.Length > MAXSTATERECORDSIZE) { // Discard the oldest state to save space. _state_records.RemoveAt(0); } - _state_records.Add(new StateRecord(Global.Emulator.Frame,state)); + _state_records.Add(new StateRecord(GlobalWinF.Emulator.Frame,state)); } } @@ -127,12 +127,12 @@ namespace BizHawk.MultiClient if (frame <= StateFirstIndex) { _state_records.Clear(); - Global.MovieSession.Movie.RewindToFrame(0); + GlobalWinF.MovieSession.Movie.RewindToFrame(0); } else { _state_records.RemoveRange(frame - StateFirstIndex, StateLastIndex - frame + 1); - Global.MovieSession.Movie.RewindToFrame(frame); + GlobalWinF.MovieSession.Movie.RewindToFrame(frame); } } } @@ -231,7 +231,7 @@ namespace BizHawk.MultiClient { Index = index; State = state; - Lagged = Global.Emulator.IsLagFrame; + Lagged = GlobalWinF.Emulator.IsLagFrame; } public readonly int Index; diff --git a/BizHawk.MultiClient/movie/MovieMnemonics.cs b/BizHawk.MultiClient/movie/MovieMnemonics.cs index c4c9873584..963e82cc32 100644 --- a/BizHawk.MultiClient/movie/MovieMnemonics.cs +++ b/BizHawk.MultiClient/movie/MovieMnemonics.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public static class MnemonicConstants @@ -225,7 +227,7 @@ namespace BizHawk.MultiClient { get { - switch (Global.Emulator.SystemId) + switch (GlobalWinF.Emulator.SystemId) { default: case "NULL": diff --git a/BizHawk.MultiClient/movie/MovieSession.cs b/BizHawk.MultiClient/movie/MovieSession.cs index 14e264263e..1ed4035998 100644 --- a/BizHawk.MultiClient/movie/MovieSession.cs +++ b/BizHawk.MultiClient/movie/MovieSession.cs @@ -29,7 +29,7 @@ /// public void LatchInputFromLog() { - string loggedFrame = Movie.GetInput(Global.Emulator.Frame); + string loggedFrame = Movie.GetInput(GlobalWinF.Emulator.Frame); MovieControllerAdapter.SetControllersAsMnemonic(loggedFrame); } } diff --git a/BizHawk.MultiClient/movie/PlayMovie.cs b/BizHawk.MultiClient/movie/PlayMovie.cs index f14c7dc1a0..c3f6942d47 100644 --- a/BizHawk.MultiClient/movie/PlayMovie.cs +++ b/BizHawk.MultiClient/movie/PlayMovie.cs @@ -5,6 +5,8 @@ using System.Text; using System.Windows.Forms; using System.IO; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class PlayMovie : Form @@ -65,12 +67,12 @@ namespace BizHawk.MultiClient //Import file if necessary - Global.MainForm.StartNewMovie(MovieList[MovieView.SelectedIndices[0]], false); + GlobalWinF.MainForm.StartNewMovie(MovieList[MovieView.SelectedIndices[0]], false); } private void OK_Click(object sender, EventArgs e) { - Global.MainForm.ReadOnly = ReadOnlyCheckBox.Checked; + GlobalWinF.MainForm.ReadOnly = ReadOnlyCheckBox.Checked; Run(); Close(); } @@ -81,9 +83,9 @@ namespace BizHawk.MultiClient string filter = "Movie Files (*." + Global.Config.MovieExtension + ")|*." + Global.Config.MovieExtension + "|Savestates|*.state|All Files|*.*"; ofd.Filter = filter; - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = ofd.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result == DialogResult.OK) { var file = new FileInfo(ofd.FileName); @@ -387,7 +389,7 @@ namespace BizHawk.MultiClient } break; case MovieHeader.EMULATIONVERSION: - if (kvp.Value != Global.MainForm.GetEmuVersion()) + if (kvp.Value != GlobalWinF.MainForm.GetEmuVersion()) { item.BackColor = Color.Yellow; } diff --git a/BizHawk.MultiClient/movie/RecordMovie.cs b/BizHawk.MultiClient/movie/RecordMovie.cs index 19ca6bd754..5f850453c6 100644 --- a/BizHawk.MultiClient/movie/RecordMovie.cs +++ b/BizHawk.MultiClient/movie/RecordMovie.cs @@ -1,6 +1,8 @@ using System; using System.Windows.Forms; using System.IO; + +using BizHawk.Client.Core; using BizHawk.Emulation.Consoles.GB; using BizHawk.Emulation.Consoles.Nintendo.SNES; using BizHawk.Emulation.Consoles.Sega; @@ -60,7 +62,7 @@ namespace BizHawk.MultiClient //Header MovieToRecord.Header.SetHeaderLine(MovieHeader.AUTHOR, AuthorBox.Text); - MovieToRecord.Header.SetHeaderLine(MovieHeader.EMULATIONVERSION, Global.MainForm.GetEmuVersion()); + MovieToRecord.Header.SetHeaderLine(MovieHeader.EMULATIONVERSION, GlobalWinF.MainForm.GetEmuVersion()); MovieToRecord.Header.SetHeaderLine(MovieHeader.MOVIEVERSION, MovieHeader.MovieVersion); MovieToRecord.Header.SetHeaderLine(MovieHeader.GUID, MovieHeader.MakeGUID()); MovieToRecord.Header.SetHeaderLine(MovieHeader.PLATFORM, Global.Game.System); @@ -76,45 +78,45 @@ namespace BizHawk.MultiClient MovieToRecord.Header.SetHeaderLine(MovieHeader.GAMENAME, "NULL"); } - if (Global.Emulator.BoardName != null) + if (GlobalWinF.Emulator.BoardName != null) { - MovieToRecord.Header.SetHeaderLine(MovieHeader.BOARDNAME, Global.Emulator.BoardName); + MovieToRecord.Header.SetHeaderLine(MovieHeader.BOARDNAME, GlobalWinF.Emulator.BoardName); } - if (Global.Emulator is Gameboy) + if (GlobalWinF.Emulator is Gameboy) { MovieToRecord.Header.SetHeaderLine(MovieHeader.GB_FORCEDMG, Global.Config.GB_ForceDMG.ToString()); MovieToRecord.Header.SetHeaderLine(MovieHeader.GB_GBA_IN_CGB, Global.Config.GB_GBACGB.ToString()); } - if (Global.Emulator is LibsnesCore) + if (GlobalWinF.Emulator is LibsnesCore) { - MovieToRecord.Header.SetHeaderLine(MovieHeader.SGB, ((Global.Emulator) as LibsnesCore).IsSGB.ToString()); - if ((Global.Emulator as LibsnesCore).DisplayType == DisplayType.PAL) + MovieToRecord.Header.SetHeaderLine(MovieHeader.SGB, ((GlobalWinF.Emulator) as LibsnesCore).IsSGB.ToString()); + if ((GlobalWinF.Emulator as LibsnesCore).DisplayType == DisplayType.PAL) { MovieToRecord.Header.SetHeaderLine(MovieHeader.PAL, "1"); } } - else if (Global.Emulator is SMS) + else if (GlobalWinF.Emulator is SMS) { - if ((Global.Emulator as SMS).DisplayType == DisplayType.PAL) + if ((GlobalWinF.Emulator as SMS).DisplayType == DisplayType.PAL) { MovieToRecord.Header.SetHeaderLine(MovieHeader.PAL, "1"); } } - else if (Global.Emulator is NES) + else if (GlobalWinF.Emulator is NES) { - if ((Global.Emulator as NES).DisplayType == DisplayType.PAL) + if ((GlobalWinF.Emulator as NES).DisplayType == DisplayType.PAL) { MovieToRecord.Header.SetHeaderLine(MovieHeader.PAL, "1"); } } - else if (Global.Emulator is ColecoVision) + else if (GlobalWinF.Emulator is ColecoVision) { MovieToRecord.Header.SetHeaderLine(MovieHeader.SKIPBIOS, Global.Config.ColecoSkipBiosIntro.ToString()); } - else if (Global.Emulator is N64) + else if (GlobalWinF.Emulator is N64) { MovieToRecord.Header.SetHeaderLine(MovieHeader.VIDEOPLUGIN, Global.Config.N64VidPlugin); @@ -141,7 +143,7 @@ namespace BizHawk.MultiClient MovieToRecord.StartsFromSavestate = true; var temppath = path; var writer = new StreamWriter(temppath); - Global.Emulator.SaveStateText(writer); + GlobalWinF.Emulator.SaveStateText(writer); writer.Close(); var file = new FileInfo(temppath); @@ -160,7 +162,7 @@ namespace BizHawk.MultiClient } } } - Global.MainForm.StartNewMovie(MovieToRecord, true); + GlobalWinF.MainForm.StartNewMovie(MovieToRecord, true); Global.Config.UseDefaultAuthor = DefaultAuthorCheckBox.Checked; if (DefaultAuthorCheckBox.Checked) @@ -194,9 +196,9 @@ namespace BizHawk.MultiClient string filter = "Movie Files (*." + Global.Config.MovieExtension + ")|*." + Global.Config.MovieExtension + "|Savestates|*.state|All Files|*.*"; sfd.Filter = filter; - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = sfd.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result == DialogResult.OK) { filename = sfd.FileName; diff --git a/BizHawk.MultiClient/tools/Cheats/Cheat.cs b/BizHawk.MultiClient/tools/Cheats/Cheat.cs index c085ebdfbf..b8e703179c 100644 --- a/BizHawk.MultiClient/tools/Cheats/Cheat.cs +++ b/BizHawk.MultiClient/tools/Cheats/Cheat.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public class Cheat diff --git a/BizHawk.MultiClient/tools/Cheats/CheatEdit.Designer.cs b/BizHawk.MultiClient/tools/Cheats/CheatEdit.Designer.cs index 03d8dc5899..5c18572e97 100644 --- a/BizHawk.MultiClient/tools/Cheats/CheatEdit.Designer.cs +++ b/BizHawk.MultiClient/tools/Cheats/CheatEdit.Designer.cs @@ -231,7 +231,7 @@ // // CompareBox // - this.CompareBox.ByteSize = BizHawk.MultiClient.Watch.WatchSize.Byte; + this.CompareBox.ByteSize = BizHawk.Client.Core.Watch.WatchSize.Byte; this.CompareBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; this.CompareBox.Location = new System.Drawing.Point(113, 91); this.CompareBox.MaxLength = 2; @@ -240,11 +240,11 @@ this.CompareBox.Size = new System.Drawing.Size(65, 20); this.CompareBox.TabIndex = 15; this.CompareBox.Text = "00"; - this.CompareBox.Type = BizHawk.MultiClient.Watch.DisplayType.Hex; + this.CompareBox.Type = BizHawk.Client.Core.Watch.DisplayType.Hex; // // ValueBox // - this.ValueBox.ByteSize = BizHawk.MultiClient.Watch.WatchSize.Byte; + this.ValueBox.ByteSize = BizHawk.Client.Core.Watch.WatchSize.Byte; this.ValueBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; this.ValueBox.Location = new System.Drawing.Point(113, 65); this.ValueBox.MaxLength = 2; @@ -253,7 +253,7 @@ this.ValueBox.Size = new System.Drawing.Size(65, 20); this.ValueBox.TabIndex = 12; this.ValueBox.Text = "00"; - this.ValueBox.Type = BizHawk.MultiClient.Watch.DisplayType.Hex; + this.ValueBox.Type = BizHawk.Client.Core.Watch.DisplayType.Hex; // // CheatEdit // diff --git a/BizHawk.MultiClient/tools/Cheats/CheatEdit.cs b/BizHawk.MultiClient/tools/Cheats/CheatEdit.cs index 71b49948c1..5a6b539c9f 100644 --- a/BizHawk.MultiClient/tools/Cheats/CheatEdit.cs +++ b/BizHawk.MultiClient/tools/Cheats/CheatEdit.cs @@ -8,6 +8,8 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class CheatEdit : UserControl @@ -31,9 +33,9 @@ namespace BizHawk.MultiClient private void CheatEdit_Load(object sender, EventArgs e) { - if (Global.Emulator != null) + if (GlobalWinF.Emulator != null) { - ToolHelpers.PopulateMemoryDomainDropdown(ref DomainDropDown, Global.Emulator.MainMemory); + ToolHelpers.PopulateMemoryDomainDropdown(ref DomainDropDown, GlobalWinF.Emulator.MainMemory); } SetFormToDefault(); } @@ -79,9 +81,9 @@ namespace BizHawk.MultiClient NameBox.Text = String.Empty; - if (Global.Emulator != null) + if (GlobalWinF.Emulator != null) { - AddressBox.SetHexProperties(Global.Emulator.MainMemory.Size); + AddressBox.SetHexProperties(GlobalWinF.Emulator.MainMemory.Size); } ValueBox.ByteSize = diff --git a/BizHawk.MultiClient/tools/Cheats/CheatForm.cs b/BizHawk.MultiClient/tools/Cheats/CheatForm.cs index 4ec8e63958..5b7f55091a 100644 --- a/BizHawk.MultiClient/tools/Cheats/CheatForm.cs +++ b/BizHawk.MultiClient/tools/Cheats/CheatForm.cs @@ -9,6 +9,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using BizHawk.Client.Core; using BizHawk.Emulation.Consoles.Nintendo.SNES; using BizHawk.Emulation.Consoles.Nintendo; using BizHawk.Emulation.Consoles.Sega; @@ -85,23 +86,23 @@ namespace BizHawk.MultiClient private void UpdateListView() { - CheatListView.ItemCount = Global.CheatList.Count; - TotalLabel.Text = Global.CheatList.CheatCount.ToString() - + (Global.CheatList.CheatCount == 1 ? " cheat " : " cheats ") - + Global.CheatList.ActiveCount.ToString() + " active"; + CheatListView.ItemCount = GlobalWinF.CheatList.Count; + TotalLabel.Text = GlobalWinF.CheatList.CheatCount.ToString() + + (GlobalWinF.CheatList.CheatCount == 1 ? " cheat " : " cheats ") + + GlobalWinF.CheatList.ActiveCount.ToString() + " active"; } public void LoadFileFromRecent(string path) { bool ask_result = true; - if (Global.CheatList.Changes) + if (GlobalWinF.CheatList.Changes) { ask_result = AskSave(); } if (ask_result) { - bool load_result = Global.CheatList.Load(path, append: false); + bool load_result = GlobalWinF.CheatList.Load(path, append: false); if (!load_result) { ToolHelpers.HandleLoadError(Global.Config.RecentWatches, path); @@ -121,11 +122,11 @@ namespace BizHawk.MultiClient if (saved) { - message = Path.GetFileName(Global.CheatList.CurrentFileName) + " saved."; + message = Path.GetFileName(GlobalWinF.CheatList.CurrentFileName) + " saved."; } else { - message = Path.GetFileName(Global.CheatList.CurrentFileName) + (Global.CheatList.Changes ? " *" : String.Empty); + message = Path.GetFileName(GlobalWinF.CheatList.CurrentFileName) + (GlobalWinF.CheatList.Changes ? " *" : String.Empty); } MessageLabel.Text = message; @@ -138,14 +139,14 @@ namespace BizHawk.MultiClient return true; } - if (Global.CheatList.Changes) + if (GlobalWinF.CheatList.Changes) { - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); DialogResult result = MessageBox.Show("Save Changes?", "Cheats", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result == DialogResult.Yes) { - Global.CheatList.Save(); + GlobalWinF.CheatList.Save(); } else if (result == DialogResult.No) { @@ -165,17 +166,17 @@ namespace BizHawk.MultiClient if (file != null) { bool result = true; - if (Global.CheatList.Changes) + if (GlobalWinF.CheatList.Changes) { result = AskSave(); } if (result) { - Global.CheatList.Load(file.FullName, append); + GlobalWinF.CheatList.Load(file.FullName, append); UpdateListView(); UpdateMessageLabel(); - Global.Config.RecentCheats.Add(Global.CheatList.CurrentFileName); + Global.Config.RecentCheats.Add(GlobalWinF.CheatList.CurrentFileName); } } } @@ -203,16 +204,16 @@ namespace BizHawk.MultiClient { GameGenieToolbarSeparator.Visible = LoadGameGenieToolbarItem.Visible = - ((Global.Emulator is NES) - || (Global.Emulator is Genesis) - || (Global.Emulator.SystemId == "GB") + ((GlobalWinF.Emulator is NES) + || (GlobalWinF.Emulator is Genesis) + || (GlobalWinF.Emulator.SystemId == "GB") || (Global.Game.System == "GG") - || (Global.Emulator is LibsnesCore)); + || (GlobalWinF.Emulator is LibsnesCore)); } private void AddCheat() { - Global.CheatList.Add(CheatEditor.Cheat); + GlobalWinF.CheatList.Add(CheatEditor.Cheat); UpdateListView(); UpdateMessageLabel(); } @@ -278,7 +279,7 @@ namespace BizHawk.MultiClient private void CheatListView_QueryItemText(int index, int column, out string text) { text = ""; - if (index >= Global.CheatList.Count || Global.CheatList[index].IsSeparator) + if (index >= GlobalWinF.CheatList.Count || GlobalWinF.CheatList[index].IsSeparator) { return; } @@ -288,44 +289,44 @@ namespace BizHawk.MultiClient switch (columnName) { case NAME: - text = Global.CheatList[index].Name; + text = GlobalWinF.CheatList[index].Name; break; case ADDRESS: - text = Global.CheatList[index].AddressStr; + text = GlobalWinF.CheatList[index].AddressStr; break; case VALUE: - text = Global.CheatList[index].ValueStr; + text = GlobalWinF.CheatList[index].ValueStr; break; case COMPARE: - text = Global.CheatList[index].CompareStr; + text = GlobalWinF.CheatList[index].CompareStr; break; case ON: - text = Global.CheatList[index].Enabled ? "*" : ""; + text = GlobalWinF.CheatList[index].Enabled ? "*" : ""; break; case DOMAIN: - text = Global.CheatList[index].Domain.Name; + text = GlobalWinF.CheatList[index].Domain.Name; break; case SIZE: - text = Global.CheatList[index].Size.ToString(); + text = GlobalWinF.CheatList[index].Size.ToString(); break; case ENDIAN: - text = Global.CheatList[index].BigEndian.Value ? "Big" : "Little"; + text = GlobalWinF.CheatList[index].BigEndian.Value ? "Big" : "Little"; break; case TYPE: - text = Watch.DisplayTypeToString(Global.CheatList[index].Type); + text = Watch.DisplayTypeToString(GlobalWinF.CheatList[index].Type); break; } } private void CheatListView_QueryItemBkColor(int index, int column, ref Color color) { - if (index < Global.CheatList.Count) + if (index < GlobalWinF.CheatList.Count) { - if (Global.CheatList[index].IsSeparator) + if (GlobalWinF.CheatList[index].IsSeparator) { color = BackColor; } - else if (Global.CheatList[index].Enabled) + else if (GlobalWinF.CheatList[index].Enabled) { color = Color.LightCyan; } @@ -355,9 +356,9 @@ namespace BizHawk.MultiClient { foreach (int index in SelectedIndices) { - if (!Global.CheatList[index].IsSeparator) + if (!GlobalWinF.CheatList[index].IsSeparator) { - selected.Add(Global.CheatList[index]); + selected.Add(GlobalWinF.CheatList[index]); } } } @@ -383,9 +384,9 @@ namespace BizHawk.MultiClient foreach (int index in indices) { - var cheat = Global.CheatList[index]; - Global.CheatList.Remove(Global.CheatList[index]); - Global.CheatList.Insert(index - 1, cheat); + var cheat = GlobalWinF.CheatList[index]; + GlobalWinF.CheatList.Remove(GlobalWinF.CheatList[index]); + GlobalWinF.CheatList.Insert(index - 1, cheat); } UpdateMessageLabel(); @@ -415,12 +416,12 @@ namespace BizHawk.MultiClient foreach (int index in indices) { - var cheat = Global.CheatList[index]; + var cheat = GlobalWinF.CheatList[index]; - if (index < Global.CheatList.Count - 1) + if (index < GlobalWinF.CheatList.Count - 1) { - Global.CheatList.Remove(Global.CheatList[index]); - Global.CheatList.Insert(index + 1, cheat); + GlobalWinF.CheatList.Remove(GlobalWinF.CheatList[index]); + GlobalWinF.CheatList.Insert(index + 1, cheat); } } @@ -447,7 +448,7 @@ namespace BizHawk.MultiClient { foreach (int index in SelectedIndices) { - Global.CheatList.Remove(Global.CheatList[SelectedIndices[0]]); //SelectedIndices[0] used since each iteration will make this the correct list index + GlobalWinF.CheatList.Remove(GlobalWinF.CheatList[SelectedIndices[0]]); //SelectedIndices[0] used since each iteration will make this the correct list index } CheatListView.SelectedIndices.Clear(); } @@ -459,7 +460,7 @@ namespace BizHawk.MultiClient { SelectedCheats.ForEach(x => x.Toggle()); ToolHelpers.UpdateCheatRelatedTools(); - Global.CheatList.FlagChanges(); + GlobalWinF.CheatList.FlagChanges(); } private void SaveColumnInfo() @@ -544,14 +545,14 @@ namespace BizHawk.MultiClient private void NewList() { bool result = true; - if (Global.CheatList.Changes) + if (GlobalWinF.CheatList.Changes) { result = AskSave(); } if (result) { - Global.CheatList.NewList(); + GlobalWinF.CheatList.NewList(); UpdateListView(); UpdateMessageLabel(); } @@ -563,7 +564,7 @@ namespace BizHawk.MultiClient private void FileSubMenu_DropDownOpened(object sender, EventArgs e) { - SaveMenuItem.Enabled = Global.CheatList.Changes; + SaveMenuItem.Enabled = GlobalWinF.CheatList.Changes; } private void RecentSubMenu_DropDownOpened(object sender, EventArgs e) @@ -582,14 +583,14 @@ namespace BizHawk.MultiClient private void OpenMenuItem_Click(object sender, EventArgs e) { bool append = sender == AppendMenuItem; - LoadFile(CheatList.GetFileFromUser(Global.CheatList.CurrentFileName), append); + LoadFile(CheatList.GetFileFromUser(GlobalWinF.CheatList.CurrentFileName), append); } private void SaveMenuItem_Click(object sender, EventArgs e) { - if (Global.CheatList.Changes) + if (GlobalWinF.CheatList.Changes) { - if (Global.CheatList.Save()) + if (GlobalWinF.CheatList.Save()) { UpdateMessageLabel(saved: true); } @@ -602,7 +603,7 @@ namespace BizHawk.MultiClient private void SaveAsMenuItem_Click(object sender, EventArgs e) { - if (Global.CheatList.SaveAs()) + if (GlobalWinF.CheatList.SaveAs()) { UpdateMessageLabel(saved: true); } @@ -626,15 +627,15 @@ namespace BizHawk.MultiClient ToggleMenuItem.Enabled = SelectedIndices.Any(); - DisableAllCheatsMenuItem.Enabled = Global.CheatList.ActiveCount > 0; + DisableAllCheatsMenuItem.Enabled = GlobalWinF.CheatList.ActiveCount > 0; GameGenieSeparator.Visible = OpenGameGenieEncoderDecoderMenuItem.Visible = - ((Global.Emulator is NES) - || (Global.Emulator is Genesis) - || (Global.Emulator.SystemId == "GB") + ((GlobalWinF.Emulator is NES) + || (GlobalWinF.Emulator is Genesis) + || (GlobalWinF.Emulator.SystemId == "GB") || (Global.Game.System == "GG") - || (Global.Emulator is LibsnesCore)); + || (GlobalWinF.Emulator is LibsnesCore)); } private void RemoveCheatMenuItem_Click(object sender, EventArgs e) @@ -648,7 +649,7 @@ namespace BizHawk.MultiClient { foreach (int index in CheatListView.SelectedIndices) { - Global.CheatList.Add(new Cheat(Global.CheatList[index])); + GlobalWinF.CheatList.Add(new Cheat(GlobalWinF.CheatList[index])); } } @@ -660,11 +661,11 @@ namespace BizHawk.MultiClient { if (SelectedIndices.Any()) { - Global.CheatList.Insert(SelectedIndices.Max(), Cheat.Separator); + GlobalWinF.CheatList.Insert(SelectedIndices.Max(), Cheat.Separator); } else { - Global.CheatList.Add(Cheat.Separator); + GlobalWinF.CheatList.Add(Cheat.Separator); } UpdateListView(); @@ -683,7 +684,7 @@ namespace BizHawk.MultiClient private void SelectAllMenuItem_Click(object sender, EventArgs e) { - for (int i = 0; i < Global.CheatList.Count; i++) + for (int i = 0; i < GlobalWinF.CheatList.Count; i++) { CheatListView.SelectItem(i, true); } @@ -696,12 +697,12 @@ namespace BizHawk.MultiClient private void DisableAllCheatsMenuItem_Click(object sender, EventArgs e) { - Global.CheatList.DisableAll(); + GlobalWinF.CheatList.DisableAll(); } private void OpenGameGenieEncoderDecoderMenuItem_Click(object sender, EventArgs e) { - Global.MainForm.LoadGameGenieEC(); + GlobalWinF.MainForm.LoadGameGenieEC(); } #endregion @@ -913,7 +914,7 @@ namespace BizHawk.MultiClient _sortReverse = false; } - Global.CheatList.Sort(column.Name, _sortReverse); + GlobalWinF.CheatList.Sort(column.Name, _sortReverse); _sortedColumn = column.Name; _sortReverse ^= true; @@ -942,7 +943,7 @@ namespace BizHawk.MultiClient RemoveContextMenuItem.Enabled = SelectedCheats.Any(); - DisableAllContextMenuItem.Enabled = Global.CheatList.ActiveCount > 0; + DisableAllContextMenuItem.Enabled = GlobalWinF.CheatList.ActiveCount > 0; } #endregion diff --git a/BizHawk.MultiClient/tools/Cheats/CheatList.cs b/BizHawk.MultiClient/tools/Cheats/CheatList.cs index 595004ecd0..6878c78327 100644 --- a/BizHawk.MultiClient/tools/Cheats/CheatList.cs +++ b/BizHawk.MultiClient/tools/Cheats/CheatList.cs @@ -6,6 +6,8 @@ using System.Linq; using System.Text; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public class CheatList : IEnumerable @@ -327,7 +329,7 @@ namespace BizHawk.MultiClient } } - Global.MainForm.UpdateCheatStatus(); + GlobalWinF.MainForm.UpdateCheatStatus(); return true; } @@ -505,12 +507,12 @@ namespace BizHawk.MultiClient private string GenerateDefaultFilename() { - PathEntry pathEntry = Global.Config.PathEntries[Global.Emulator.SystemId, "Cheats"]; + PathEntry pathEntry = Global.Config.PathEntries[GlobalWinF.Emulator.SystemId, "Cheats"]; if (pathEntry == null) { - pathEntry = Global.Config.PathEntries[Global.Emulator.SystemId, "Base"]; + pathEntry = Global.Config.PathEntries[GlobalWinF.Emulator.SystemId, "Base"]; } - string path = PathManager.MakeAbsolutePath(pathEntry.Path, Global.Emulator.SystemId); + string path = PathManager.MakeAbsolutePath(pathEntry.Path, GlobalWinF.Emulator.SystemId); var f = new FileInfo(path); if (f.Directory != null && f.Directory.Exists == false) @@ -590,9 +592,9 @@ namespace BizHawk.MultiClient ofd.Filter = "Cheat Files (*.cht)|*.cht|All Files|*.*"; ofd.RestoreDirectory = true; - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = ofd.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result != DialogResult.OK) return null; var file = new FileInfo(ofd.FileName); @@ -606,16 +608,16 @@ namespace BizHawk.MultiClient { sfd.FileName = Path.GetFileNameWithoutExtension(_currentFileName); } - else if (!(Global.Emulator is NullEmulator)) + else if (!(GlobalWinF.Emulator is NullEmulator)) { sfd.FileName = PathManager.FilesystemSafeName(Global.Game); } sfd.InitialDirectory = PathManager.GetCheatsPath(Global.Game); sfd.Filter = "Cheat Files (*.cht)|*.cht|All Files|*.*"; sfd.RestoreDirectory = true; - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = sfd.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result != DialogResult.OK) { return null; diff --git a/BizHawk.MultiClient/tools/GB/CGBColorChooserForm.cs b/BizHawk.MultiClient/tools/GB/CGBColorChooserForm.cs index e974c7798b..e5a63abcaf 100644 --- a/BizHawk.MultiClient/tools/GB/CGBColorChooserForm.cs +++ b/BizHawk.MultiClient/tools/GB/CGBColorChooserForm.cs @@ -3,6 +3,8 @@ using System.Drawing; using System.Windows.Forms; using BizHawk.Emulation.Consoles.GB; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient.GBtools { public partial class CGBColorChooserForm : Form diff --git a/BizHawk.MultiClient/tools/GB/ColorChooserForm.cs b/BizHawk.MultiClient/tools/GB/ColorChooserForm.cs index 337b031e1e..3b806a82a3 100644 --- a/BizHawk.MultiClient/tools/GB/ColorChooserForm.cs +++ b/BizHawk.MultiClient/tools/GB/ColorChooserForm.cs @@ -4,6 +4,8 @@ using System.Drawing; using System.Windows.Forms; using System.IO; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient.GBtools { public partial class ColorChooserForm : Form diff --git a/BizHawk.MultiClient/tools/GB/DualGBFileSelector.cs b/BizHawk.MultiClient/tools/GB/DualGBFileSelector.cs index e58461da12..ea2b98625a 100644 --- a/BizHawk.MultiClient/tools/GB/DualGBFileSelector.cs +++ b/BizHawk.MultiClient/tools/GB/DualGBFileSelector.cs @@ -7,6 +7,8 @@ using System.Linq; using System.Text; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient.GBtools { public partial class DualGBFileSelector : UserControl diff --git a/BizHawk.MultiClient/tools/GB/GBGPUView.cs b/BizHawk.MultiClient/tools/GB/GBGPUView.cs index 9e51701ff4..652ff35352 100644 --- a/BizHawk.MultiClient/tools/GB/GBGPUView.cs +++ b/BizHawk.MultiClient/tools/GB/GBGPUView.cs @@ -3,6 +3,8 @@ using System.Drawing; using System.Text; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient.GBtools { public partial class GBGPUView : Form @@ -78,9 +80,9 @@ namespace BizHawk.MultiClient.GBtools public void Restart() { - if (Global.Emulator is Emulation.Consoles.GB.Gameboy) + if (GlobalWinF.Emulator is Emulation.Consoles.GB.Gameboy) { - gb = Global.Emulator as Emulation.Consoles.GB.Gameboy; + gb = GlobalWinF.Emulator as Emulation.Consoles.GB.Gameboy; cgb = gb.IsCGBMode(); _lcdc = 0; if (!gb.GetGPUMemoryAreas(out vram, out bgpal, out sppal, out oam)) @@ -955,9 +957,9 @@ namespace BizHawk.MultiClient.GBtools dlg.FullOpen = true; dlg.Color = spriteback; - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = dlg.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result == DialogResult.OK) { // force full opaque diff --git a/BizHawk.MultiClient/tools/GB/GBGameGenie.cs b/BizHawk.MultiClient/tools/GB/GBGameGenie.cs index 60dc69c8b5..4cdd88b8c1 100644 --- a/BizHawk.MultiClient/tools/GB/GBGameGenie.cs +++ b/BizHawk.MultiClient/tools/GB/GBGameGenie.cs @@ -5,6 +5,8 @@ using System.Windows.Forms; using System.Globalization; using System.Text.RegularExpressions; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class GBGameGenie : Form @@ -346,7 +348,7 @@ namespace BizHawk.MultiClient private void AddCheatClick(object sender, EventArgs e) { - if ((Global.Emulator.SystemId == "GB") || (Global.Game.System == "GG")) + if ((GlobalWinF.Emulator.SystemId == "GB") || (Global.Game.System == "GG")) { string NAME = String.Empty; int ADDRESS = 0; @@ -389,9 +391,9 @@ namespace BizHawk.MultiClient } } - for (int i = 0; i < Global.Emulator.MemoryDomains.Count; i++) + for (int i = 0; i < GlobalWinF.Emulator.MemoryDomains.Count; i++) { - if (Global.Emulator.MemoryDomains[i].ToString() == "System Bus") + if (GlobalWinF.Emulator.MemoryDomains[i].ToString() == "System Bus") { sysBusIndex = i; break; @@ -399,14 +401,14 @@ namespace BizHawk.MultiClient } Watch watch = Watch.GenerateWatch( - Global.Emulator.MemoryDomains[sysBusIndex], + GlobalWinF.Emulator.MemoryDomains[sysBusIndex], ADDRESS, Watch.WatchSize.Byte, Watch.DisplayType.Hex, NAME, false); - Global.CheatList.Add(new Cheat( + GlobalWinF.CheatList.Add(new Cheat( watch, VALUE, COMPARE, diff --git a/BizHawk.MultiClient/tools/GBA/GBAGPUView.cs b/BizHawk.MultiClient/tools/GBA/GBAGPUView.cs index 2d78f33b40..24be3b5194 100644 --- a/BizHawk.MultiClient/tools/GBA/GBAGPUView.cs +++ b/BizHawk.MultiClient/tools/GBA/GBAGPUView.cs @@ -673,7 +673,7 @@ namespace BizHawk.MultiClient.GBAtools public void Restart() { - gba = Global.Emulator as Emulation.Consoles.Nintendo.GBA.GBA; + gba = GlobalWinF.Emulator as Emulation.Consoles.Nintendo.GBA.GBA; if (gba != null) { gba.GetGPUMemoryAreas(out vram, out palram, out oam, out mmio); diff --git a/BizHawk.MultiClient/tools/Genesis/GenGameGenie.cs b/BizHawk.MultiClient/tools/Genesis/GenGameGenie.cs index afcb3b0c23..46d9bc8ffd 100644 --- a/BizHawk.MultiClient/tools/Genesis/GenGameGenie.cs +++ b/BizHawk.MultiClient/tools/Genesis/GenGameGenie.cs @@ -4,6 +4,8 @@ using System.Drawing; using System.Windows.Forms; using System.Globalization; using System.Text.RegularExpressions; + +using BizHawk.Client.Core; using BizHawk.Emulation.Consoles.Sega; #pragma warning disable 675 //TOOD: fix the potential problem this is masking @@ -222,7 +224,7 @@ namespace BizHawk.MultiClient private void addcheatbt_Click(object sender, EventArgs e) { - if (Global.Emulator is Genesis) + if (GlobalWinF.Emulator is Genesis) { string NAME; int ADDRESS = 0; @@ -253,16 +255,16 @@ namespace BizHawk.MultiClient VALUE = ValueBox.ToRawInt(); } - for (int i = 0; i < Global.Emulator.MemoryDomains.Count; i++) + for (int i = 0; i < GlobalWinF.Emulator.MemoryDomains.Count; i++) { - if (Global.Emulator.MemoryDomains[i].ToString() == "Rom Data") + if (GlobalWinF.Emulator.MemoryDomains[i].ToString() == "Rom Data") { romDataDomainIndex = i; } } Watch watch = Watch.GenerateWatch( - Global.Emulator.MemoryDomains[romDataDomainIndex], + GlobalWinF.Emulator.MemoryDomains[romDataDomainIndex], ADDRESS, Watch.WatchSize.Word, Watch.DisplayType.Hex, @@ -270,7 +272,7 @@ namespace BizHawk.MultiClient bigEndian: true ); - Global.CheatList.Add(new Cheat( + GlobalWinF.CheatList.Add(new Cheat( watch, VALUE, compare: null, diff --git a/BizHawk.MultiClient/tools/HexEditor/HexColor.cs b/BizHawk.MultiClient/tools/HexEditor/HexColor.cs index e82ee085ea..977e44dd90 100644 --- a/BizHawk.MultiClient/tools/HexEditor/HexColor.cs +++ b/BizHawk.MultiClient/tools/HexEditor/HexColor.cs @@ -1,6 +1,8 @@ using System; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class HexColors_Form : Form @@ -25,8 +27,8 @@ namespace BizHawk.MultiClient if (colorDialog1.ShowDialog() == DialogResult.OK) { Global.Config.HexBackgrndColor = colorDialog1.Color; - Global.MainForm.HexEditor1.Header.BackColor = colorDialog1.Color; - Global.MainForm.HexEditor1.MemoryViewerBox.BackColor = Global.Config.HexBackgrndColor; + GlobalWinF.MainForm.HexEditor1.Header.BackColor = colorDialog1.Color; + GlobalWinF.MainForm.HexEditor1.MemoryViewerBox.BackColor = Global.Config.HexBackgrndColor; HexBackgrnd.BackColor = colorDialog1.Color; } } @@ -36,8 +38,8 @@ namespace BizHawk.MultiClient if (colorDialog1.ShowDialog() == DialogResult.OK) { Global.Config.HexForegrndColor = colorDialog1.Color; - Global.MainForm.HexEditor1.Header.ForeColor = colorDialog1.Color; - Global.MainForm.HexEditor1.MemoryViewerBox.ForeColor = Global.Config.HexForegrndColor; + GlobalWinF.MainForm.HexEditor1.Header.ForeColor = colorDialog1.Color; + GlobalWinF.MainForm.HexEditor1.MemoryViewerBox.ForeColor = Global.Config.HexForegrndColor; HexForegrnd.BackColor = colorDialog1.Color; } @@ -48,7 +50,7 @@ namespace BizHawk.MultiClient if (colorDialog1.ShowDialog() == DialogResult.OK) { Global.Config.HexMenubarColor = colorDialog1.Color; - Global.MainForm.HexEditor1.menuStrip1.BackColor = Global.Config.HexMenubarColor; + GlobalWinF.MainForm.HexEditor1.menuStrip1.BackColor = Global.Config.HexMenubarColor; HexMenubar.BackColor = colorDialog1.Color; } } diff --git a/BizHawk.MultiClient/tools/HexEditor/HexEditor.cs b/BizHawk.MultiClient/tools/HexEditor/HexEditor.cs index 3d611be67f..7696ff5717 100644 --- a/BizHawk.MultiClient/tools/HexEditor/HexEditor.cs +++ b/BizHawk.MultiClient/tools/HexEditor/HexEditor.cs @@ -8,6 +8,8 @@ using System.Windows.Forms; using System.Globalization; using System.IO; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class HexEditor : Form @@ -257,9 +259,9 @@ namespace BizHawk.MultiClient private int? GetDomainInt(string name) { - for (int i = 0; i < Global.Emulator.MemoryDomains.Count; i++) + for (int i = 0; i < GlobalWinF.Emulator.MemoryDomains.Count; i++) { - if (Global.Emulator.MemoryDomains[i].Name == name) + if (GlobalWinF.Emulator.MemoryDomains[i].Name == name) { return i; } @@ -384,7 +386,7 @@ namespace BizHawk.MultiClient private bool CurrentROMIsArchive() { - string path = Global.MainForm.CurrentlyOpenRom; + string path = GlobalWinF.MainForm.CurrentlyOpenRom; if (path == null) { return false; @@ -412,7 +414,7 @@ namespace BizHawk.MultiClient private byte[] GetRomBytes() { - string path = Global.MainForm.CurrentlyOpenRom; + string path = GlobalWinF.MainForm.CurrentlyOpenRom; if (path == null) { return null; @@ -455,9 +457,9 @@ namespace BizHawk.MultiClient // THIS IS HORRIBLE. Domain = ROMDomain; } - else if (pos < Global.Emulator.MemoryDomains.Count) //Sanity check + else if (pos < GlobalWinF.Emulator.MemoryDomains.Count) //Sanity check { - SetMemoryDomain(Global.Emulator.MemoryDomains[pos]); + SetMemoryDomain(GlobalWinF.Emulator.MemoryDomains[pos]); } SetHeader(); UpdateGroupBoxTitle(); @@ -469,7 +471,7 @@ namespace BizHawk.MultiClient private void UpdateGroupBoxTitle() { string memoryDomain = Domain.ToString(); - string systemID = Global.Emulator.SystemId; + string systemID = GlobalWinF.Emulator.SystemId; int addresses = Domain.Size / DataSize; string addressesString = "0x" + string.Format("{0:X8}", addresses).TrimStart('0'); //if ((addresses & 0x3FF) == 0) @@ -482,11 +484,11 @@ namespace BizHawk.MultiClient { memoryDomainsToolStripMenuItem.DropDownItems.Clear(); - for (int i = 0; i < Global.Emulator.MemoryDomains.Count; i++) + for (int i = 0; i < GlobalWinF.Emulator.MemoryDomains.Count; i++) { - if (Global.Emulator.MemoryDomains[i].Size > 0) + if (GlobalWinF.Emulator.MemoryDomains[i].Size > 0) { - string str = Global.Emulator.MemoryDomains[i].ToString(); + string str = GlobalWinF.Emulator.MemoryDomains[i].ToString(); var item = new ToolStripMenuItem { Text = str }; { int z = i; @@ -534,9 +536,9 @@ namespace BizHawk.MultiClient InputPrompt i = new InputPrompt { Text = "Go to Address" }; i._Location = GetPromptPoint(); i.SetMessage("Enter a hexadecimal value"); - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); i.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (i.UserOK) { @@ -704,16 +706,16 @@ namespace BizHawk.MultiClient { if (HighlightedAddress.HasValue || SecondaryHighlightedAddresses.Count > 0) { - Global.MainForm.LoadRamWatch(true); + GlobalWinF.MainForm.LoadRamWatch(true); } if (HighlightedAddress.HasValue) { - Global.MainForm.RamWatch1.AddWatch(MakeWatch(HighlightedAddress.Value)); + GlobalWinF.MainForm.RamWatch1.AddWatch(MakeWatch(HighlightedAddress.Value)); } foreach (int i in SecondaryHighlightedAddresses) { - Global.MainForm.RamWatch1.AddWatch(MakeWatch(i)); + GlobalWinF.MainForm.RamWatch1.AddWatch(MakeWatch(i)); } } @@ -751,10 +753,10 @@ namespace BizHawk.MultiClient poke.SetWatch(Watches); - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = poke.ShowDialog(); UpdateValues(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); } } @@ -833,7 +835,7 @@ namespace BizHawk.MultiClient private bool IsFrozen(int address) { - return Global.CheatList.IsActive(Domain, address); + return GlobalWinF.CheatList.IsActive(Domain, address); } private void ToggleFreeze() @@ -866,8 +868,8 @@ namespace BizHawk.MultiClient { if (address >= 0) { - var cheats = Global.CheatList.Where(x => x.Contains(address)).ToList(); - Global.CheatList.RemoveRange(cheats); + var cheats = GlobalWinF.CheatList.Where(x => x.Contains(address)).ToList(); + GlobalWinF.CheatList.RemoveRange(cheats); } MemoryViewerBox.Refresh(); } @@ -891,10 +893,10 @@ namespace BizHawk.MultiClient private void UpdateRelatedDialogs() { - Global.MainForm.UpdateCheatStatus(); - Global.MainForm.RamSearch1.UpdateValues(); - Global.MainForm.RamWatch1.UpdateValues(); - Global.MainForm.Cheats_UpdateValues(); + GlobalWinF.MainForm.UpdateCheatStatus(); + GlobalWinF.MainForm.RamSearch1.UpdateValues(); + GlobalWinF.MainForm.RamWatch1.UpdateValues(); + GlobalWinF.MainForm.Cheats_UpdateValues(); UpdateValues(); } @@ -910,7 +912,7 @@ namespace BizHawk.MultiClient String.Empty, BigEndian); - Global.CheatList.Add(new Cheat( + GlobalWinF.CheatList.Add(new Cheat( watch, watch.Value.Value, compare: null, @@ -997,19 +999,19 @@ namespace BizHawk.MultiClient { var sfd = new SaveFileDialog(); - if (!(Global.Emulator is NullEmulator)) + if (!(GlobalWinF.Emulator is NullEmulator)) sfd.FileName = PathManager.FilesystemSafeName(Global.Game); else sfd.FileName = "MemoryDump"; - sfd.InitialDirectory = PathManager.GetPlatformBase(Global.Emulator.SystemId); + sfd.InitialDirectory = PathManager.GetPlatformBase(GlobalWinF.Emulator.SystemId); sfd.Filter = "Text (*.txt)|*.txt|All Files|*.*"; sfd.RestoreDirectory = true; - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = sfd.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result != DialogResult.OK) return null; var file = new FileInfo(sfd.FileName); @@ -1020,7 +1022,7 @@ namespace BizHawk.MultiClient { if (Domain.Name == "ROM File") { - string extension = Path.GetExtension(Global.MainForm.CurrentlyOpenRom); + string extension = Path.GetExtension(GlobalWinF.MainForm.CurrentlyOpenRom); return "Binary (*" + extension + ")|*" + extension + "|All Files|*.*"; } @@ -1034,19 +1036,19 @@ namespace BizHawk.MultiClient { var sfd = new SaveFileDialog(); - if (!(Global.Emulator is NullEmulator)) + if (!(GlobalWinF.Emulator is NullEmulator)) sfd.FileName = PathManager.FilesystemSafeName(Global.Game); else sfd.FileName = "MemoryDump"; - sfd.InitialDirectory = PathManager.GetPlatformBase(Global.Emulator.SystemId); + sfd.InitialDirectory = PathManager.GetPlatformBase(GlobalWinF.Emulator.SystemId); sfd.Filter = GetSaveFileFilter(); sfd.RestoreDirectory = true; - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = sfd.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result != DialogResult.OK) return null; var file = new FileInfo(sfd.FileName); @@ -1207,7 +1209,7 @@ namespace BizHawk.MultiClient private void MemoryViewerBox_Paint(object sender, PaintEventArgs e) { - var activeCheats = Global.CheatList.Where(x => x.Enabled); + var activeCheats = GlobalWinF.CheatList.Where(x => x.Enabled); foreach (var cheat in activeCheats) { if (IsVisible(cheat.Address.Value)) @@ -1232,7 +1234,7 @@ namespace BizHawk.MultiClient Rectangle textrect = new Rectangle(textpoint, new Size((8 * DataSize), fontHeight)); - if (Global.CheatList.IsActive(Domain, addressHighlighted)) + if (GlobalWinF.CheatList.IsActive(Domain, addressHighlighted)) { e.Graphics.FillRectangle(new SolidBrush(Global.Config.HexHighlightFreezeColor), rect); e.Graphics.FillRectangle(new SolidBrush(Global.Config.HexHighlightFreezeColor), textrect); @@ -1254,7 +1256,7 @@ namespace BizHawk.MultiClient Rectangle textrect = new Rectangle(textpoint, new Size(8, fontHeight)); - if (Global.CheatList.IsActive(Domain, address)) + if (GlobalWinF.CheatList.IsActive(Domain, address)) { e.Graphics.FillRectangle(new SolidBrush(Global.Config.HexHighlightFreezeColor), rect); e.Graphics.FillRectangle(new SolidBrush(Global.Config.HexHighlightFreezeColor), textrect); @@ -1690,10 +1692,10 @@ namespace BizHawk.MultiClient private void IncrementAddress(int address) { - if (Global.CheatList.IsActive(Domain, address)) + if (GlobalWinF.CheatList.IsActive(Domain, address)) { - Global.CheatList.FirstOrDefault(x => x.Domain == Domain && x.Address == address).Increment(); - Global.CheatList.FlagChanges(); + GlobalWinF.CheatList.FirstOrDefault(x => x.Domain == Domain && x.Address == address).Increment(); + GlobalWinF.CheatList.FlagChanges(); } else { @@ -1728,10 +1730,10 @@ namespace BizHawk.MultiClient private void DecrementAddress(int address) { - if (Global.CheatList.IsActive(Domain, address)) + if (GlobalWinF.CheatList.IsActive(Domain, address)) { - Global.CheatList.FirstOrDefault(x => x.Domain == Domain && x.Address == address).Decrement(); - Global.CheatList.FlagChanges(); + GlobalWinF.CheatList.FirstOrDefault(x => x.Domain == Domain && x.Address == address).Decrement(); + GlobalWinF.CheatList.FlagChanges(); } else { @@ -2059,9 +2061,9 @@ namespace BizHawk.MultiClient private void setColorsToolStripMenuItem1_Click(object sender, EventArgs e) { HexColors_Form h = new HexColors_Form(); - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); h.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); } private void resetToDefaultToolStripMenuItem1_Click(object sender, EventArgs e) @@ -2121,7 +2123,7 @@ namespace BizHawk.MultiClient } else { - FileInfo file = new FileInfo(Global.MainForm.CurrentlyOpenRom); + FileInfo file = new FileInfo(GlobalWinF.MainForm.CurrentlyOpenRom); SaveFileBinary(file); } } diff --git a/BizHawk.MultiClient/tools/HexEditor/HexFind.cs b/BizHawk.MultiClient/tools/HexEditor/HexFind.cs index 2f8ecf8108..c0a0d3427e 100644 --- a/BizHawk.MultiClient/tools/HexEditor/HexFind.cs +++ b/BizHawk.MultiClient/tools/HexEditor/HexFind.cs @@ -60,12 +60,12 @@ namespace BizHawk.MultiClient private void Find_Prev_Click(object sender, EventArgs e) { - Global.MainForm.HexEditor1.FindPrev(GetFindBoxChars(), false); + GlobalWinF.MainForm.HexEditor1.FindPrev(GetFindBoxChars(), false); } private void Find_Next_Click(object sender, EventArgs e) { - Global.MainForm.HexEditor1.FindNext(GetFindBoxChars(), false); + GlobalWinF.MainForm.HexEditor1.FindNext(GetFindBoxChars(), false); } private void ChangeCasing() @@ -94,7 +94,7 @@ namespace BizHawk.MultiClient { if (e.KeyData == Keys.Enter) { - Global.MainForm.HexEditor1.FindNext(GetFindBoxChars(), false); + GlobalWinF.MainForm.HexEditor1.FindNext(GetFindBoxChars(), false); } } } diff --git a/BizHawk.MultiClient/tools/HexEditor/MemoryViewer.cs b/BizHawk.MultiClient/tools/HexEditor/MemoryViewer.cs index 0eeb7b5cd5..c3965367bc 100644 --- a/BizHawk.MultiClient/tools/HexEditor/MemoryViewer.cs +++ b/BizHawk.MultiClient/tools/HexEditor/MemoryViewer.cs @@ -4,6 +4,7 @@ using System.Windows.Forms; using System.Text; using System.Globalization; +using BizHawk.Client.Core; namespace BizHawk.MultiClient { @@ -517,9 +518,9 @@ namespace BizHawk.MultiClient { InputPrompt i = new InputPrompt {Text = "Go to Address"}; i.SetMessage("Enter a hexadecimal value"); - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); i.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (i.UserOK) { diff --git a/BizHawk.MultiClient/tools/InputPrompt.cs b/BizHawk.MultiClient/tools/InputPrompt.cs index dcbe39807a..328b249dd8 100644 --- a/BizHawk.MultiClient/tools/InputPrompt.cs +++ b/BizHawk.MultiClient/tools/InputPrompt.cs @@ -2,6 +2,8 @@ using System.Drawing; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { /// diff --git a/BizHawk.MultiClient/tools/Lua/LuaConsole.cs b/BizHawk.MultiClient/tools/Lua/LuaConsole.cs index fa02cbf57e..9a2ec4ced6 100644 --- a/BizHawk.MultiClient/tools/Lua/LuaConsole.cs +++ b/BizHawk.MultiClient/tools/Lua/LuaConsole.cs @@ -6,6 +6,8 @@ using System.Linq; using System.Windows.Forms; using System.IO; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class LuaConsole : Form @@ -178,9 +180,9 @@ namespace BizHawk.MultiClient if (!Directory.Exists(ofd.InitialDirectory)) Directory.CreateDirectory(ofd.InitialDirectory); - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = ofd.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result != DialogResult.OK) return null; var file = new FileInfo(ofd.FileName); @@ -708,9 +710,9 @@ namespace BizHawk.MultiClient private void luaFunctionsListToolStripMenuItem_Click(object sender, EventArgs e) { - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); new LuaFunctionList().Show(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); } public bool LoadLuaSession(string path) @@ -907,7 +909,7 @@ namespace BizHawk.MultiClient sfd.FileName = Path.GetFileNameWithoutExtension(currentSessionFile); sfd.InitialDirectory = Path.GetDirectoryName(currentSessionFile); } - else if (!(Global.Emulator is NullEmulator)) + else if (!(GlobalWinF.Emulator is NullEmulator)) { sfd.FileName = PathManager.FilesystemSafeName(Global.Game); sfd.InitialDirectory = PathManager.GetLuaPath(); @@ -920,9 +922,9 @@ namespace BizHawk.MultiClient } sfd.Filter = "Lua Session Files (*.luases)|*.luases|All Files|*.*"; sfd.RestoreDirectory = true; - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = sfd.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result != DialogResult.OK) return null; var file = new FileInfo(sfd.FileName); @@ -1017,9 +1019,9 @@ namespace BizHawk.MultiClient if (changes) { - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); DialogResult result = MessageBox.Show("Save changes to session?", "Lua Console", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result == DialogResult.Yes) { if (string.Compare(currentSessionFile, "") == 0) @@ -1099,7 +1101,7 @@ namespace BizHawk.MultiClient turnOffAllScriptsToolStripMenuItem.Enabled = luaRunning; - showRegisteredFunctionsToolStripMenuItem.Enabled = Global.MainForm.LuaConsole1.LuaImp.RegisteredFunctions.Any(); + showRegisteredFunctionsToolStripMenuItem.Enabled = GlobalWinF.MainForm.LuaConsole1.LuaImp.RegisteredFunctions.Any(); } private void contextMenuStrip1_Opening(object sender, CancelEventArgs e) @@ -1245,7 +1247,7 @@ namespace BizHawk.MultiClient private void showRegisteredFunctionsToolStripMenuItem_Click(object sender, EventArgs e) { - if (Global.MainForm.LuaConsole1.LuaImp.RegisteredFunctions.Any()) + if (GlobalWinF.MainForm.LuaConsole1.LuaImp.RegisteredFunctions.Any()) { LuaRegisteredFunctionsList dialog = new LuaRegisteredFunctionsList(); dialog.ShowDialog(); @@ -1254,7 +1256,7 @@ namespace BizHawk.MultiClient private void contextMenuStrip2_Opening(object sender, CancelEventArgs e) { - registeredFunctionsToolStripMenuItem.Enabled = Global.MainForm.LuaConsole1.LuaImp.RegisteredFunctions.Any(); + registeredFunctionsToolStripMenuItem.Enabled = GlobalWinF.MainForm.LuaConsole1.LuaImp.RegisteredFunctions.Any(); } } } diff --git a/BizHawk.MultiClient/tools/Lua/LuaDocumentation.cs b/BizHawk.MultiClient/tools/Lua/LuaDocumentation.cs index 4a74ff96dc..8397789852 100644 --- a/BizHawk.MultiClient/tools/Lua/LuaDocumentation.cs +++ b/BizHawk.MultiClient/tools/Lua/LuaDocumentation.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Text; -namespace BizHawk.MultiClient.tools +namespace BizHawk.MultiClient { public class LuaDocumentation { diff --git a/BizHawk.MultiClient/tools/Lua/LuaFunctionList.cs b/BizHawk.MultiClient/tools/Lua/LuaFunctionList.cs index 0d5a7f65f8..63cd5b5a3f 100644 --- a/BizHawk.MultiClient/tools/Lua/LuaFunctionList.cs +++ b/BizHawk.MultiClient/tools/Lua/LuaFunctionList.cs @@ -23,7 +23,7 @@ namespace BizHawk.MultiClient private void PopulateListView() { FunctionView.Items.Clear(); - foreach (LuaDocumentation.LibraryFunction l in Global.MainForm.LuaConsole1.LuaImp.docs.FunctionList) + foreach (LuaDocumentation.LibraryFunction l in GlobalWinF.MainForm.LuaConsole1.LuaImp.docs.FunctionList) { ListViewItem item = new ListViewItem {Text = l.ReturnType}; item.SubItems.Add(l.library + "."); @@ -41,16 +41,16 @@ namespace BizHawk.MultiClient switch (column) { case 0: //Return - Global.MainForm.LuaConsole1.LuaImp.docs.FunctionList = Global.MainForm.LuaConsole1.LuaImp.docs.FunctionList.OrderByDescending(x => x.ReturnType).ToList(); + GlobalWinF.MainForm.LuaConsole1.LuaImp.docs.FunctionList = GlobalWinF.MainForm.LuaConsole1.LuaImp.docs.FunctionList.OrderByDescending(x => x.ReturnType).ToList(); break; case 1: //Library - Global.MainForm.LuaConsole1.LuaImp.docs.FunctionList = Global.MainForm.LuaConsole1.LuaImp.docs.FunctionList.OrderByDescending(x => x.library).ToList(); + GlobalWinF.MainForm.LuaConsole1.LuaImp.docs.FunctionList = GlobalWinF.MainForm.LuaConsole1.LuaImp.docs.FunctionList.OrderByDescending(x => x.library).ToList(); break; case 2: //Name - Global.MainForm.LuaConsole1.LuaImp.docs.FunctionList = Global.MainForm.LuaConsole1.LuaImp.docs.FunctionList.OrderByDescending(x => x.name).ToList(); + GlobalWinF.MainForm.LuaConsole1.LuaImp.docs.FunctionList = GlobalWinF.MainForm.LuaConsole1.LuaImp.docs.FunctionList.OrderByDescending(x => x.name).ToList(); break; case 3: //Parameters - Global.MainForm.LuaConsole1.LuaImp.docs.FunctionList = Global.MainForm.LuaConsole1.LuaImp.docs.FunctionList.OrderByDescending(x => x.ParameterList).ToList(); + GlobalWinF.MainForm.LuaConsole1.LuaImp.docs.FunctionList = GlobalWinF.MainForm.LuaConsole1.LuaImp.docs.FunctionList.OrderByDescending(x => x.ParameterList).ToList(); break; } } @@ -59,16 +59,16 @@ namespace BizHawk.MultiClient switch (column) { case 0: //Return - Global.MainForm.LuaConsole1.LuaImp.docs.FunctionList = Global.MainForm.LuaConsole1.LuaImp.docs.FunctionList.OrderBy(x => x.ReturnType).ToList(); + GlobalWinF.MainForm.LuaConsole1.LuaImp.docs.FunctionList = GlobalWinF.MainForm.LuaConsole1.LuaImp.docs.FunctionList.OrderBy(x => x.ReturnType).ToList(); break; case 1: //Library - Global.MainForm.LuaConsole1.LuaImp.docs.FunctionList = Global.MainForm.LuaConsole1.LuaImp.docs.FunctionList.OrderBy(x => x.library).ToList(); + GlobalWinF.MainForm.LuaConsole1.LuaImp.docs.FunctionList = GlobalWinF.MainForm.LuaConsole1.LuaImp.docs.FunctionList.OrderBy(x => x.library).ToList(); break; case 2: //Name - Global.MainForm.LuaConsole1.LuaImp.docs.FunctionList = Global.MainForm.LuaConsole1.LuaImp.docs.FunctionList.OrderBy(x => x.name).ToList(); + GlobalWinF.MainForm.LuaConsole1.LuaImp.docs.FunctionList = GlobalWinF.MainForm.LuaConsole1.LuaImp.docs.FunctionList.OrderBy(x => x.name).ToList(); break; case 3: //Parameters - Global.MainForm.LuaConsole1.LuaImp.docs.FunctionList = Global.MainForm.LuaConsole1.LuaImp.docs.FunctionList.OrderBy(x => x.ParameterList).ToList(); + GlobalWinF.MainForm.LuaConsole1.LuaImp.docs.FunctionList = GlobalWinF.MainForm.LuaConsole1.LuaImp.docs.FunctionList.OrderBy(x => x.ParameterList).ToList(); break; } } @@ -132,7 +132,7 @@ namespace BizHawk.MultiClient foreach (int index in indexes) { - var library_function = Global.MainForm.LuaConsole1.LuaImp.docs.FunctionList[index]; + var library_function = GlobalWinF.MainForm.LuaConsole1.LuaImp.docs.FunctionList[index]; sb.Append(library_function.library).Append('.').Append(library_function.name).Append("()\n"); } diff --git a/BizHawk.MultiClient/tools/Lua/LuaImplementation.cs b/BizHawk.MultiClient/tools/Lua/LuaImplementation.cs index 495ef0f0f8..a48c5c9b02 100644 --- a/BizHawk.MultiClient/tools/Lua/LuaImplementation.cs +++ b/BizHawk.MultiClient/tools/Lua/LuaImplementation.cs @@ -8,10 +8,12 @@ using System.Drawing; using System.Threading; using System.Globalization; +using BizHawk.Client.Core; using BizHawk.Emulation.Consoles.Nintendo; -using BizHawk.MultiClient.tools; using System.Text; +using BizHawk.MultiClient.tools; //TODO: remove me, this is not an intended namespace + namespace BizHawk.MultiClient { public class LuaImplementation @@ -561,7 +563,7 @@ namespace BizHawk.MultiClient public void client_closerom() { - Global.MainForm.CloseROM(); + GlobalWinF.MainForm.CloseROM(); } public int client_getwindowsize() @@ -571,74 +573,74 @@ namespace BizHawk.MultiClient public void client_opencheats() { - Global.MainForm.LoadCheatsWindow(); + GlobalWinF.MainForm.LoadCheatsWindow(); } public void client_openhexeditor() { - Global.MainForm.LoadHexEditor(); + GlobalWinF.MainForm.LoadHexEditor(); } public void client_openramwatch() { - Global.MainForm.LoadRamWatch(true); + GlobalWinF.MainForm.LoadRamWatch(true); } public void client_openramsearch() { - Global.MainForm.LoadRamSearch(); + GlobalWinF.MainForm.LoadRamSearch(); } public void client_openrom(object lua_input) { - Global.MainForm.LoadRom(lua_input.ToString()); + GlobalWinF.MainForm.LoadRom(lua_input.ToString()); } public void client_opentasstudio() { - Global.MainForm.LoadTAStudio(); + GlobalWinF.MainForm.LoadTAStudio(); } public void client_opentoolbox() { - Global.MainForm.LoadToolBox(); + GlobalWinF.MainForm.LoadToolBox(); } public void client_opentracelogger() { - Global.MainForm.LoadTraceLogger(); + GlobalWinF.MainForm.LoadTraceLogger(); } public void client_pause_av() { - Global.MainForm.PauseAVI = true; + GlobalWinF.MainForm.PauseAVI = true; } public void client_reboot_core() { - Global.MainForm.RebootCore(); + GlobalWinF.MainForm.RebootCore(); } public int client_screenheight() { - return Global.RenderPanel.NativeSize.Height; + return GlobalWinF.RenderPanel.NativeSize.Height; } public void client_screenshot(object path = null) { if (path == null) { - Global.MainForm.TakeScreenshot(); + GlobalWinF.MainForm.TakeScreenshot(); } else { - Global.MainForm.TakeScreenshot(path.ToString()); + GlobalWinF.MainForm.TakeScreenshot(path.ToString()); } } public void client_screenshottoclipboard() { - Global.MainForm.TakeScreenshotToClipboard(); + GlobalWinF.MainForm.TakeScreenshotToClipboard(); } public void client_setscreenshotosd(bool value) @@ -648,7 +650,7 @@ namespace BizHawk.MultiClient public int client_screenwidth() { - return Global.RenderPanel.NativeSize.Width; + return GlobalWinF.RenderPanel.NativeSize.Width; } public void client_setwindowsize(object window_size) @@ -660,8 +662,8 @@ namespace BizHawk.MultiClient if (size == 1 || size == 2 || size == 3 || size == 4 || size == 5 || size == 10) { Global.Config.TargetZoomFactor = size; - Global.MainForm.FrameBufferResized(); - Global.OSD.AddMessage("Window size set to " + size.ToString() + "x"); + GlobalWinF.MainForm.FrameBufferResized(); + GlobalWinF.OSD.AddMessage("Window size set to " + size.ToString() + "x"); } else { @@ -677,17 +679,17 @@ namespace BizHawk.MultiClient public void client_unpause_av() { - Global.MainForm.PauseAVI = false; + GlobalWinF.MainForm.PauseAVI = false; } public int client_xpos() { - return Global.MainForm.DesktopLocation.X; + return GlobalWinF.MainForm.DesktopLocation.X; } public int client_ypos() { - return Global.MainForm.DesktopLocation.Y; + return GlobalWinF.MainForm.DesktopLocation.Y; } #endregion @@ -696,13 +698,13 @@ namespace BizHawk.MultiClient public void console_clear() { - Global.MainForm.LuaConsole1.ClearOutputWindow(); + GlobalWinF.MainForm.LuaConsole1.ClearOutputWindow(); } public string console_getluafunctionslist() { string list = ""; - foreach (LuaDocumentation.LibraryFunction l in Global.MainForm.LuaConsole1.LuaImp.docs.FunctionList) + foreach (LuaDocumentation.LibraryFunction l in GlobalWinF.MainForm.LuaConsole1.LuaImp.docs.FunctionList) { list += l.name + "\n"; } @@ -719,7 +721,7 @@ namespace BizHawk.MultiClient { if (lua_input == null) { - Global.MainForm.LuaConsole1.WriteToOutputWindow("NULL"); + GlobalWinF.MainForm.LuaConsole1.WriteToOutputWindow("NULL"); } else { @@ -754,11 +756,11 @@ namespace BizHawk.MultiClient .AppendLine(); } - Global.MainForm.LuaConsole1.WriteToOutputWindow(sb.ToString()); + GlobalWinF.MainForm.LuaConsole1.WriteToOutputWindow(sb.ToString()); } else { - Global.MainForm.LuaConsole1.WriteToOutputWindow(lua_input.ToString()); + GlobalWinF.MainForm.LuaConsole1.WriteToOutputWindow(lua_input.ToString()); } } } @@ -810,7 +812,7 @@ namespace BizHawk.MultiClient public void gui_clearGraphics() { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; luaSurface.Clear(); } @@ -823,12 +825,12 @@ namespace BizHawk.MultiClient /// public void gui_drawNew() { - luaSurface = Global.DisplayManager.GetLuaSurfaceNative(); + luaSurface = GlobalWinF.DisplayManager.GetLuaSurfaceNative(); } public void gui_drawNewEmu() { - luaSurface = Global.DisplayManager.GetLuaEmuSurfaceEmu(); + luaSurface = GlobalWinF.DisplayManager.GetLuaEmuSurfaceEmu(); } /// @@ -838,21 +840,21 @@ namespace BizHawk.MultiClient /// public void gui_drawFinish() { - Global.DisplayManager.SetLuaSurfaceNativePreOSD(luaSurface); + GlobalWinF.DisplayManager.SetLuaSurfaceNativePreOSD(luaSurface); luaSurface = null; } public void gui_drawFinishEmu() { - Global.DisplayManager.SetLuaSurfaceEmu(luaSurface); + GlobalWinF.DisplayManager.SetLuaSurfaceEmu(luaSurface); luaSurface = null; } Graphics GetGraphics() { var g = luaSurface.GetGraphics(); - int tx = Global.Emulator.CoreComm.ScreenLogicalOffsetX; - int ty = Global.Emulator.CoreComm.ScreenLogicalOffsetY; + int tx = GlobalWinF.Emulator.CoreComm.ScreenLogicalOffsetX; + int ty = GlobalWinF.Emulator.CoreComm.ScreenLogicalOffsetY; if (tx != 0 || ty != 0) { var transform = g.Transform; @@ -898,21 +900,21 @@ namespace BizHawk.MultiClient } else { - dx -= Global.Emulator.CoreComm.ScreenLogicalOffsetX; - dy -= Global.Emulator.CoreComm.ScreenLogicalOffsetY; + dx -= GlobalWinF.Emulator.CoreComm.ScreenLogicalOffsetX; + dy -= GlobalWinF.Emulator.CoreComm.ScreenLogicalOffsetY; } // blah hacks dx *= client_getwindowsize(); dy *= client_getwindowsize(); - Global.OSD.AddGUIText(luaStr.ToString(), dx, dy, alert, GetColor(background), GetColor(forecolor), a); + GlobalWinF.OSD.AddGUIText(luaStr.ToString(), dx, dy, alert, GetColor(background), GetColor(forecolor), a); } #endregion public void gui_addmessage(object luaStr) { - Global.OSD.AddMessage(luaStr.ToString()); + GlobalWinF.OSD.AddMessage(luaStr.ToString()); } public void gui_alert(object luaX, object luaY, object luaStr, object anchor = null) @@ -922,12 +924,12 @@ namespace BizHawk.MultiClient public void gui_cleartext() { - Global.OSD.ClearGUIText(); + GlobalWinF.OSD.ClearGUIText(); } public void gui_drawBezier(LuaTable points, object color) { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; using (var g = GetGraphics()) { try @@ -998,7 +1000,7 @@ namespace BizHawk.MultiClient public void gui_drawEllipse(object X, object Y, object width, object height, object line, object background = null) { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; using (var g = GetGraphics()) { try @@ -1020,7 +1022,7 @@ namespace BizHawk.MultiClient public void gui_drawIcon(object Path, object x, object y, object width = null, object height = null) { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; using (var g = GetGraphics()) { try @@ -1046,7 +1048,7 @@ namespace BizHawk.MultiClient public void gui_drawImage(object Path, object x, object y, object width = null, object height = null) { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; using (var g = GetGraphics()) { try @@ -1069,7 +1071,7 @@ namespace BizHawk.MultiClient public void gui_drawLine(object x1, object y1, object x2, object y2, object color = null) { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; using (var g = GetGraphics()) { try @@ -1086,7 +1088,7 @@ namespace BizHawk.MultiClient public void gui_drawPie(object X, object Y, object width, object height, object startangle, object sweepangle, object line, object background = null) { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; using (var g = GetGraphics()) { try @@ -1109,7 +1111,7 @@ namespace BizHawk.MultiClient public void gui_drawPixel(object X, object Y, object color = null) { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; using (var g = GetGraphics()) { float x = LuaInt(X) + 0.1F; @@ -1126,7 +1128,7 @@ namespace BizHawk.MultiClient public void gui_drawPolygon(LuaTable points, object line, object background = null) { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; //this is a test using (var g = GetGraphics()) { @@ -1181,13 +1183,13 @@ namespace BizHawk.MultiClient public void gui_drawString(object X, object Y, object message, object color = null, object fontsize = null, object fontfamily = null, object fontstyle = null) { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; gui_drawText(X, Y, message, color, fontsize, fontfamily, fontstyle); } public void gui_drawText(object X, object Y, object message, object color = null, object fontsize = null, object fontfamily = null, object fontstyle = null) { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; using (var g = GetGraphics()) { try @@ -1253,25 +1255,25 @@ namespace BizHawk.MultiClient // TODO: error handling for argument count mismatch private void emu_setrenderplanes_do(object[] lua_p) { - if (Global.Emulator is NES) + if (GlobalWinF.Emulator is NES) { - Global.CoreComm.NES_ShowOBJ = Global.Config.NESDispSprites = (bool)lua_p[0]; - Global.CoreComm.NES_ShowBG = Global.Config.NESDispBackground = (bool)lua_p[1]; + GlobalWinF.CoreComm.NES_ShowOBJ = Global.Config.NESDispSprites = (bool)lua_p[0]; + GlobalWinF.CoreComm.NES_ShowBG = Global.Config.NESDispBackground = (bool)lua_p[1]; } - else if (Global.Emulator is Emulation.Consoles.TurboGrafx.PCEngine) + else if (GlobalWinF.Emulator is Emulation.Consoles.TurboGrafx.PCEngine) { - Global.CoreComm.PCE_ShowOBJ1 = Global.Config.PCEDispOBJ1 = (bool)lua_p[0]; - Global.CoreComm.PCE_ShowBG1 = Global.Config.PCEDispBG1 = (bool)lua_p[1]; + GlobalWinF.CoreComm.PCE_ShowOBJ1 = Global.Config.PCEDispOBJ1 = (bool)lua_p[0]; + GlobalWinF.CoreComm.PCE_ShowBG1 = Global.Config.PCEDispBG1 = (bool)lua_p[1]; if (lua_p.Length > 2) { - Global.CoreComm.PCE_ShowOBJ2 = Global.Config.PCEDispOBJ2 = (bool)lua_p[2]; - Global.CoreComm.PCE_ShowBG2 = Global.Config.PCEDispBG2 = (bool)lua_p[3]; + GlobalWinF.CoreComm.PCE_ShowOBJ2 = Global.Config.PCEDispOBJ2 = (bool)lua_p[2]; + GlobalWinF.CoreComm.PCE_ShowBG2 = Global.Config.PCEDispBG2 = (bool)lua_p[3]; } } - else if (Global.Emulator is Emulation.Consoles.Sega.SMS) + else if (GlobalWinF.Emulator is Emulation.Consoles.Sega.SMS) { - Global.CoreComm.SMS_ShowOBJ = Global.Config.SMSDispOBJ = (bool)lua_p[0]; - Global.CoreComm.SMS_ShowBG = Global.Config.SMSDispBG = (bool)lua_p[1]; + GlobalWinF.CoreComm.SMS_ShowOBJ = Global.Config.SMSDispOBJ = (bool)lua_p[0]; + GlobalWinF.CoreComm.SMS_ShowBG = Global.Config.SMSDispBG = (bool)lua_p[1]; } } @@ -1290,7 +1292,7 @@ namespace BizHawk.MultiClient { Global.Config.VSyncThrottle = true; } - Global.MainForm.VsyncMessage(); + GlobalWinF.MainForm.VsyncMessage(); } } @@ -1301,13 +1303,13 @@ namespace BizHawk.MultiClient { if (temp == "0" || temp.ToLower() == "false") { - Global.MainForm.RewindActive = false; - Global.OSD.AddMessage("Rewind suspended"); + GlobalWinF.MainForm.RewindActive = false; + GlobalWinF.OSD.AddMessage("Rewind suspended"); } else { - Global.MainForm.RewindActive = true; - Global.OSD.AddMessage("Rewind enabled"); + GlobalWinF.MainForm.RewindActive = true; + GlobalWinF.OSD.AddMessage("Rewind enabled"); } } } @@ -1320,7 +1322,7 @@ namespace BizHawk.MultiClient public int emu_framecount() { - return Global.Emulator.Frame; + return GlobalWinF.Emulator.Frame; } public void emu_frameskip(object num_frames) @@ -1332,7 +1334,7 @@ namespace BizHawk.MultiClient if (frames > 0) { Global.Config.FrameSkip = frames; - Global.MainForm.FrameSkipMessage(); + GlobalWinF.MainForm.FrameSkipMessage(); } else { @@ -1347,22 +1349,22 @@ namespace BizHawk.MultiClient public string emu_getsystemid() { - return Global.Emulator.SystemId; + return GlobalWinF.Emulator.SystemId; } public bool emu_islagged() { - return Global.Emulator.IsLagFrame; + return GlobalWinF.Emulator.IsLagFrame; } public bool emu_ispaused() { - return Global.MainForm.EmulatorPaused; + return GlobalWinF.MainForm.EmulatorPaused; } public int emu_lagcount() { - return Global.Emulator.LagCount; + return GlobalWinF.Emulator.LagCount; } public void emu_limitframerate(object boolean) @@ -1378,7 +1380,7 @@ namespace BizHawk.MultiClient { Global.Config.ClockThrottle = true; } - Global.MainForm.LimitFrameRateMessage(); + GlobalWinF.MainForm.LimitFrameRateMessage(); } } @@ -1395,7 +1397,7 @@ namespace BizHawk.MultiClient { Global.Config.AutoMinimizeSkipping = true; } - Global.MainForm.MinimizeFrameskipMessage(); + GlobalWinF.MainForm.MinimizeFrameskipMessage(); } } @@ -1403,7 +1405,7 @@ namespace BizHawk.MultiClient { if (luaf != null) { - Global.Emulator.CoreComm.InputCallback = delegate() + GlobalWinF.Emulator.CoreComm.InputCallback = delegate() { try { @@ -1411,19 +1413,19 @@ namespace BizHawk.MultiClient } catch (SystemException e) { - Global.MainForm.LuaConsole1.WriteToOutputWindow( + GlobalWinF.MainForm.LuaConsole1.WriteToOutputWindow( "error running function attached by lua function emu.on_snoop" + "\nError message: " + e.Message); } }; } else - Global.Emulator.CoreComm.InputCallback = null; + GlobalWinF.Emulator.CoreComm.InputCallback = null; } public void emu_pause() { - Global.MainForm.PauseEmulator(); + GlobalWinF.MainForm.PauseEmulator(); } public void emu_setrenderplanes( // For now, it accepts arguments up to 5. @@ -1441,7 +1443,7 @@ namespace BizHawk.MultiClient int speed = Convert.ToInt32(temp); if (speed > 0 && speed < 1000) //arbituarily capping it at 1000% { - Global.MainForm.ClickSpeedItem(speed); + GlobalWinF.MainForm.ClickSpeedItem(speed); } else { @@ -1456,17 +1458,17 @@ namespace BizHawk.MultiClient public void emu_togglepause() { - Global.MainForm.TogglePause(); + GlobalWinF.MainForm.TogglePause(); } public void emu_unpause() { - Global.MainForm.UnpauseEmulator(); + GlobalWinF.MainForm.UnpauseEmulator(); } public void emu_yield() { - Global.DisplayManager.NeedsToPaint = true; + GlobalWinF.DisplayManager.NeedsToPaint = true; currThread.Yield(0); } @@ -1494,7 +1496,7 @@ namespace BizHawk.MultiClient } catch (SystemException e) { - Global.MainForm.LuaConsole1.WriteToOutputWindow( + GlobalWinF.MainForm.LuaConsole1.WriteToOutputWindow( "error running function attached by lua function savestate.registersave" + "\nError message: " + e.Message); } @@ -1515,7 +1517,7 @@ namespace BizHawk.MultiClient } catch (SystemException e) { - Global.MainForm.LuaConsole1.WriteToOutputWindow( + GlobalWinF.MainForm.LuaConsole1.WriteToOutputWindow( "error running function attached by lua function savestate.registerload" + "\nError message: " + e.Message); } @@ -1536,7 +1538,7 @@ namespace BizHawk.MultiClient } catch (SystemException e) { - Global.MainForm.LuaConsole1.WriteToOutputWindow( + GlobalWinF.MainForm.LuaConsole1.WriteToOutputWindow( "error running function attached by lua function emu.registerbefore" + "\nError message: " + e.Message); } @@ -1557,7 +1559,7 @@ namespace BizHawk.MultiClient } catch (SystemException e) { - Global.MainForm.LuaConsole1.WriteToOutputWindow( + GlobalWinF.MainForm.LuaConsole1.WriteToOutputWindow( "error running function attached by lua function emu.registerafter" + "\nError message: " + e.Message); } @@ -1605,8 +1607,8 @@ namespace BizHawk.MultiClient _addr = LuaInt(address); } - Global.Emulator.CoreComm.MemoryCallbackSystem.ReadAddr = _addr; - Global.Emulator.CoreComm.MemoryCallbackSystem.SetReadCallback(delegate(uint addr) + GlobalWinF.Emulator.CoreComm.MemoryCallbackSystem.ReadAddr = _addr; + GlobalWinF.Emulator.CoreComm.MemoryCallbackSystem.SetReadCallback(delegate(uint addr) { try { @@ -1614,7 +1616,7 @@ namespace BizHawk.MultiClient } catch (SystemException e) { - Global.MainForm.LuaConsole1.WriteToOutputWindow( + GlobalWinF.MainForm.LuaConsole1.WriteToOutputWindow( "error running function attached by lua function event.onmemoryread" + "\nError message: " + e.Message); } @@ -1623,7 +1625,7 @@ namespace BizHawk.MultiClient } else { - Global.Emulator.CoreComm.MemoryCallbackSystem.SetReadCallback(null); + GlobalWinF.Emulator.CoreComm.MemoryCallbackSystem.SetReadCallback(null); } } @@ -1642,8 +1644,8 @@ namespace BizHawk.MultiClient _addr = LuaInt(address); } - Global.Emulator.CoreComm.MemoryCallbackSystem.WriteAddr = _addr; - Global.Emulator.CoreComm.MemoryCallbackSystem.SetWriteCallback(delegate(uint addr) + GlobalWinF.Emulator.CoreComm.MemoryCallbackSystem.WriteAddr = _addr; + GlobalWinF.Emulator.CoreComm.MemoryCallbackSystem.SetWriteCallback(delegate(uint addr) { try { @@ -1651,7 +1653,7 @@ namespace BizHawk.MultiClient } catch (SystemException e) { - Global.MainForm.LuaConsole1.WriteToOutputWindow( + GlobalWinF.MainForm.LuaConsole1.WriteToOutputWindow( "error running function attached by lua function event.onmemoryread" + "\nError message: " + e.Message); } @@ -1659,7 +1661,7 @@ namespace BizHawk.MultiClient } else { - Global.Emulator.CoreComm.MemoryCallbackSystem.SetWriteCallback(null); + GlobalWinF.Emulator.CoreComm.MemoryCallbackSystem.SetWriteCallback(null); } } @@ -2108,7 +2110,7 @@ namespace BizHawk.MultiClient public LuaTable input_get() { LuaTable buttons = _lua.NewTable(); - foreach (var kvp in Global.ControllerInputCoalescer.BoolButtons()) + foreach (var kvp in GlobalWinF.ControllerInputCoalescer.BoolButtons()) if (kvp.Value) buttons[kvp.Key] = true; return buttons; @@ -2117,7 +2119,7 @@ namespace BizHawk.MultiClient public LuaTable input_getmouse() { LuaTable buttons = _lua.NewTable(); - Point p = Global.RenderPanel.ScreenToScreen(Control.MousePosition); + Point p = GlobalWinF.RenderPanel.ScreenToScreen(Control.MousePosition); buttons["X"] = p.X; buttons["Y"] = p.Y; buttons[MouseButtons.Left.ToString()] = (Control.MouseButtons & MouseButtons.Left) != 0; @@ -2136,27 +2138,27 @@ namespace BizHawk.MultiClient public LuaTable joypad_get(object controller = null) { LuaTable buttons = _lua.NewTable(); - foreach (string button in Global.ControllerOutput.Source.Type.BoolButtons) + foreach (string button in GlobalWinF.ControllerOutput.Source.Type.BoolButtons) { if (controller == null) { - buttons[button] = Global.ControllerOutput[button]; + buttons[button] = GlobalWinF.ControllerOutput[button]; } else if (button.Length >= 3 && button.Substring(0, 2) == "P" + LuaInt(controller).ToString()) { - buttons[button.Substring(3)] = Global.ControllerOutput["P" + LuaInt(controller) + " " + button.Substring(3)]; + buttons[button.Substring(3)] = GlobalWinF.ControllerOutput["P" + LuaInt(controller) + " " + button.Substring(3)]; } } - foreach (string button in Global.ControllerOutput.Source.Type.FloatControls) + foreach (string button in GlobalWinF.ControllerOutput.Source.Type.FloatControls) { if (controller == null) { - buttons[button] = Global.ControllerOutput.GetFloat(button); + buttons[button] = GlobalWinF.ControllerOutput.GetFloat(button); } else if (button.Length >= 3 && button.Substring(0, 2) == "P" + LuaInt(controller).ToString()) { - buttons[button.Substring(3)] = Global.ControllerOutput.GetFloat("P" + LuaInt(controller) + " " + button.Substring(3)); + buttons[button.Substring(3)] = GlobalWinF.ControllerOutput.GetFloat("P" + LuaInt(controller) + " " + button.Substring(3)); } } @@ -2170,8 +2172,8 @@ namespace BizHawk.MultiClient public LuaTable joypad_getimmediate() { LuaTable buttons = _lua.NewTable(); - foreach (string button in Global.ActiveController.Type.BoolButtons) - buttons[button] = Global.ActiveController[button]; + foreach (string button in GlobalWinF.ActiveController.Type.BoolButtons) + buttons[button] = GlobalWinF.ActiveController[button]; return buttons; } @@ -2213,24 +2215,24 @@ namespace BizHawk.MultiClient { if (controller == null) //Force On { - Global.ClickyVirtualPadController.Click(button.ToString()); - Global.ForceOffAdaptor.SetSticky(button.ToString(), false); + GlobalWinF.ClickyVirtualPadController.Click(button.ToString()); + GlobalWinF.ForceOffAdaptor.SetSticky(button.ToString(), false); } else { - Global.ClickyVirtualPadController.Click("P" + controller + " " + button); - Global.ForceOffAdaptor.SetSticky("P" + controller + " " + button, false); + GlobalWinF.ClickyVirtualPadController.Click("P" + controller + " " + button); + GlobalWinF.ForceOffAdaptor.SetSticky("P" + controller + " " + button, false); } } else if (theValue == false) //Force off { if (controller == null) { - Global.ForceOffAdaptor.SetSticky(button.ToString(), true); + GlobalWinF.ForceOffAdaptor.SetSticky(button.ToString(), true); } else { - Global.ForceOffAdaptor.SetSticky("P" + controller + " " + button, true); + GlobalWinF.ForceOffAdaptor.SetSticky("P" + controller + " " + button, true); } } else @@ -2238,11 +2240,11 @@ namespace BizHawk.MultiClient //Turn everything off if (controller == null) { - Global.ForceOffAdaptor.SetSticky(button.ToString(), false); + GlobalWinF.ForceOffAdaptor.SetSticky(button.ToString(), false); } else { - Global.ForceOffAdaptor.SetSticky("P" + controller + " " + button, false); + GlobalWinF.ForceOffAdaptor.SetSticky("P" + controller + " " + button, false); } } } @@ -2250,13 +2252,13 @@ namespace BizHawk.MultiClient { if (controller == null) { - Global.StickyXORAdapter.SetSticky(button.ToString(), true); - Global.ForceOffAdaptor.SetSticky(button.ToString(), false); + GlobalWinF.StickyXORAdapter.SetSticky(button.ToString(), true); + GlobalWinF.ForceOffAdaptor.SetSticky(button.ToString(), false); } else { - Global.StickyXORAdapter.SetSticky("P" + controller + " " + button, true); - Global.ForceOffAdaptor.SetSticky("P" + controller + " " + button, false); + GlobalWinF.StickyXORAdapter.SetSticky("P" + controller + " " + button, true); + GlobalWinF.ForceOffAdaptor.SetSticky("P" + controller + " " + button, false); } } } @@ -2279,11 +2281,11 @@ namespace BizHawk.MultiClient float theValue = float.Parse(theValueStr); if (controller == null) { - Global.StickyXORAdapter.SetFloat(name.ToString(), theValue); + GlobalWinF.StickyXORAdapter.SetFloat(name.ToString(), theValue); } else { - Global.StickyXORAdapter.SetFloat("P" + controller + " " + name, theValue); + GlobalWinF.StickyXORAdapter.SetFloat("P" + controller + " " + name, theValue); } } catch { } @@ -2349,12 +2351,12 @@ namespace BizHawk.MultiClient private uint MM_R_U8(int addr) { - return Global.Emulator.MainMemory.PeekByte(addr); + return GlobalWinF.Emulator.MainMemory.PeekByte(addr); } private void MM_W_U8(int addr, uint v) { - Global.Emulator.MainMemory.PokeByte(addr, (byte)v); + GlobalWinF.Emulator.MainMemory.PokeByte(addr, (byte)v); } private int U2S(uint u, int size) @@ -2369,7 +2371,7 @@ namespace BizHawk.MultiClient public string mainmemory_getname() { - return Global.Emulator.MainMemory.Name; + return GlobalWinF.Emulator.MainMemory.Name; } public uint mainmemory_readbyte(object lua_addr) @@ -2387,7 +2389,7 @@ namespace BizHawk.MultiClient for (int i = addr; i <= last_addr; i++) { string a = String.Format("{0:X2}", i); - byte v = Global.Emulator.MainMemory.PeekByte(i); + byte v = GlobalWinF.Emulator.MainMemory.PeekByte(i); string vs = String.Format("{0:X2}", (int)v); table[a] = vs; } @@ -2397,7 +2399,7 @@ namespace BizHawk.MultiClient public float mainmemory_readfloat(object lua_addr, bool bigendian) { int addr = LuaInt(lua_addr); - uint val = Global.Emulator.MainMemory.PeekDWord(addr, bigendian ? Endian.Big : Endian.Little); + uint val = GlobalWinF.Emulator.MainMemory.PeekDWord(addr, bigendian ? Endian.Big : Endian.Little); byte[] bytes = BitConverter.GetBytes(val); float _float = BitConverter.ToSingle(bytes, 0); @@ -2418,7 +2420,7 @@ namespace BizHawk.MultiClient int a = LuaInt(address); int v = LuaInt(memoryblock[address]); - Global.Emulator.MainMemory.PokeByte(a, (byte)v); + GlobalWinF.Emulator.MainMemory.PokeByte(a, (byte)v); } } @@ -2428,7 +2430,7 @@ namespace BizHawk.MultiClient float dv = (float)(double)lua_v; byte[] bytes = BitConverter.GetBytes(dv); uint v = BitConverter.ToUInt32(bytes, 0); - Global.Emulator.MainMemory.PokeDWord(addr, v, bigendian ? Endian.Big : Endian.Little); + GlobalWinF.Emulator.MainMemory.PokeDWord(addr, v, bigendian ? Endian.Big : Endian.Little); } @@ -2670,29 +2672,29 @@ namespace BizHawk.MultiClient private uint M_R_U8(int addr) { - return Global.Emulator.MemoryDomains[CurrentMemoryDomain].PeekByte(addr); + return GlobalWinF.Emulator.MemoryDomains[CurrentMemoryDomain].PeekByte(addr); } private void M_W_U8(int addr, uint v) { - Global.Emulator.MemoryDomains[CurrentMemoryDomain].PokeByte(addr, (byte)v); + GlobalWinF.Emulator.MemoryDomains[CurrentMemoryDomain].PokeByte(addr, (byte)v); } #endregion public string memory_getmemorydomainlist() { - return Global.Emulator.MemoryDomains.Aggregate("", (current, t) => current + (t.Name + '\n')); + return GlobalWinF.Emulator.MemoryDomains.Aggregate("", (current, t) => current + (t.Name + '\n')); } public string memory_getcurrentmemorydomain() { - return Global.Emulator.MemoryDomains[CurrentMemoryDomain].Name; + return GlobalWinF.Emulator.MemoryDomains[CurrentMemoryDomain].Name; } public int memory_getcurrentmemorydomainsize() { - return Global.Emulator.MemoryDomains[CurrentMemoryDomain].Size; + return GlobalWinF.Emulator.MemoryDomains[CurrentMemoryDomain].Size; } public uint memory_readbyte(object lua_addr) @@ -2704,7 +2706,7 @@ namespace BizHawk.MultiClient public float memory_readfloat(object lua_addr, bool bigendian) { int addr = LuaInt(lua_addr); - uint val = Global.Emulator.MemoryDomains[CurrentMemoryDomain].PeekDWord(addr, bigendian ? Endian.Big : Endian.Little); + uint val = GlobalWinF.Emulator.MemoryDomains[CurrentMemoryDomain].PeekDWord(addr, bigendian ? Endian.Big : Endian.Little); byte[] bytes = BitConverter.GetBytes(val); float _float = BitConverter.ToSingle(bytes, 0); @@ -2724,7 +2726,7 @@ namespace BizHawk.MultiClient float dv = (float)(double)lua_v; byte[] bytes = BitConverter.GetBytes(dv); uint v = BitConverter.ToUInt32(bytes, 0); - Global.Emulator.MemoryDomains[CurrentMemoryDomain].PokeDWord(addr, v, bigendian ? Endian.Big : Endian.Little); + GlobalWinF.Emulator.MemoryDomains[CurrentMemoryDomain].PokeDWord(addr, v, bigendian ? Endian.Big : Endian.Little); } public bool memory_usememorydomain(object lua_input) @@ -2732,9 +2734,9 @@ namespace BizHawk.MultiClient if (lua_input.GetType() != typeof(string)) return false; - for (int x = 0; x < Global.Emulator.MemoryDomains.Count; x++) + for (int x = 0; x < GlobalWinF.Emulator.MemoryDomains.Count; x++) { - if (Global.Emulator.MemoryDomains[x].Name == lua_input.ToString()) + if (GlobalWinF.Emulator.MemoryDomains[x].Name == lua_input.ToString()) { CurrentMemoryDomain = x; return true; @@ -2933,15 +2935,15 @@ namespace BizHawk.MultiClient public string movie_filename() { - return Global.MovieSession.Movie.Filename; + return GlobalWinF.MovieSession.Movie.Filename; } public LuaTable movie_getinput(object frame) { LuaTable input = _lua.NewTable(); - string s = Global.MovieSession.Movie.GetInput(LuaInt(frame)); - MovieControllerAdapter m = new MovieControllerAdapter { Type = Global.MovieSession.MovieControllerAdapter.Type }; + string s = GlobalWinF.MovieSession.Movie.GetInput(LuaInt(frame)); + MovieControllerAdapter m = new MovieControllerAdapter { Type = GlobalWinF.MovieSession.MovieControllerAdapter.Type }; m.SetControllersAsMnemonic(s); foreach (string button in m.Type.BoolButtons) input[button] = m[button]; @@ -2951,17 +2953,17 @@ namespace BizHawk.MultiClient public bool movie_getreadonly() { - return Global.MainForm.ReadOnly; + return GlobalWinF.MainForm.ReadOnly; } public bool movie_getrerecordcounting() { - return Global.MovieSession.Movie.IsCountingRerecords; + return GlobalWinF.MovieSession.Movie.IsCountingRerecords; } public bool movie_isloaded() { - if (Global.MovieSession.Movie.IsActive) + if (GlobalWinF.MovieSession.Movie.IsActive) { return true; } @@ -2973,9 +2975,9 @@ namespace BizHawk.MultiClient public int movie_length() { - if (Global.MovieSession.Movie.Frames.HasValue) + if (GlobalWinF.MovieSession.Movie.Frames.HasValue) { - return Global.MovieSession.Movie.Frames.Value; + return GlobalWinF.MovieSession.Movie.Frames.Value; } else { @@ -2985,15 +2987,15 @@ namespace BizHawk.MultiClient public string movie_mode() { - if (Global.MovieSession.Movie.IsFinished) + if (GlobalWinF.MovieSession.Movie.IsFinished) { return "FINISHED"; } - else if (Global.MovieSession.Movie.IsPlaying) + else if (GlobalWinF.MovieSession.Movie.IsPlaying) { return "PLAY"; } - else if (Global.MovieSession.Movie.IsRecording) + else if (GlobalWinF.MovieSession.Movie.IsRecording) { return "RECORD"; } @@ -3005,28 +3007,28 @@ namespace BizHawk.MultiClient public string movie_rerecordcount() { - return Global.MovieSession.Movie.Rerecords.ToString(); + return GlobalWinF.MovieSession.Movie.Rerecords.ToString(); } public void movie_setreadonly(object lua_input) { if (lua_input.ToString().ToUpper() == "TRUE" || lua_input.ToString() == "1") - Global.MainForm.SetReadOnly(true); + GlobalWinF.MainForm.SetReadOnly(true); else - Global.MainForm.SetReadOnly(false); + GlobalWinF.MainForm.SetReadOnly(false); } public void movie_setrerecordcounting(object lua_input) { if (lua_input.ToString().ToUpper() == "TRUE" || lua_input.ToString() == "1") - Global.MovieSession.Movie.IsCountingRerecords = true; + GlobalWinF.MovieSession.Movie.IsCountingRerecords = true; else - Global.MovieSession.Movie.IsCountingRerecords = false; + GlobalWinF.MovieSession.Movie.IsCountingRerecords = false; } public void movie_stop() { - Global.MovieSession.Movie.Stop(); + GlobalWinF.MovieSession.Movie.Stop(); } #endregion @@ -3035,21 +3037,21 @@ namespace BizHawk.MultiClient public void nes_addgamegenie(string code) { - if (Global.Emulator is NES) + if (GlobalWinF.Emulator is NES) { NESGameGenie gg = new NESGameGenie(); gg.DecodeGameGenieCode(code); if (gg.Address.HasValue && gg.Value.HasValue) { Watch watch = Watch.GenerateWatch( - Global.Emulator.MemoryDomains[1], + GlobalWinF.Emulator.MemoryDomains[1], gg.Address.Value, Watch.WatchSize.Byte, Watch.DisplayType.Hex, code, false); - Global.CheatList.Add(new Cheat( + GlobalWinF.CheatList.Add(new Cheat( watch, gg.Value.Value, gg.Compare, @@ -3104,14 +3106,14 @@ namespace BizHawk.MultiClient public void nes_removegamegenie(string code) { - if (Global.Emulator is NES) + if (GlobalWinF.Emulator is NES) { NESGameGenie gg = new NESGameGenie(); gg.DecodeGameGenieCode(code); if (gg.Address.HasValue && gg.Value.HasValue) { - var cheats = Global.CheatList.Where(x => x.Address == gg.Address); - Global.CheatList.RemoveRange(cheats); + var cheats = GlobalWinF.CheatList.Where(x => x.Address == gg.Address); + GlobalWinF.CheatList.RemoveRange(cheats); } } } @@ -3119,31 +3121,31 @@ namespace BizHawk.MultiClient public void nes_setallowmorethaneightsprites(bool allow) { Global.Config.NESAllowMoreThanEightSprites = allow; - if (Global.Emulator is NES) + if (GlobalWinF.Emulator is NES) { - (Global.Emulator as NES).CoreComm.NES_UnlimitedSprites = allow; + (GlobalWinF.Emulator as NES).CoreComm.NES_UnlimitedSprites = allow; } } public void nes_setclipleftandright(bool leftandright) { Global.Config.NESClipLeftAndRight = leftandright; - if (Global.Emulator is NES) + if (GlobalWinF.Emulator is NES) { - (Global.Emulator as NES).SetClipLeftAndRight(leftandright); + (GlobalWinF.Emulator as NES).SetClipLeftAndRight(leftandright); } } public void nes_setdispbackground(bool show) { Global.Config.NESDispBackground = show; - Global.MainForm.SyncCoreCommInputSignals(); + GlobalWinF.MainForm.SyncCoreCommInputSignals(); } public void nes_setdispsprites(bool show) { Global.Config.NESDispSprites = show; - Global.MainForm.SyncCoreCommInputSignals(); + GlobalWinF.MainForm.SyncCoreCommInputSignals(); } public void nes_setscanlines(object top, object bottom, bool pal = false) @@ -3180,17 +3182,17 @@ namespace BizHawk.MultiClient Global.Config.NTSC_NESBottomLine = last; } - if (Global.Emulator is NES) + if (GlobalWinF.Emulator is NES) { if (pal) { - (Global.Emulator as NES).PAL_FirstDrawLine = first; - (Global.Emulator as NES).PAL_LastDrawLine = last; + (GlobalWinF.Emulator as NES).PAL_FirstDrawLine = first; + (GlobalWinF.Emulator as NES).PAL_LastDrawLine = last; } else { - (Global.Emulator as NES).NTSC_FirstDrawLine = first; - (Global.Emulator as NES).NTSC_LastDrawLine = last; + (GlobalWinF.Emulator as NES).NTSC_FirstDrawLine = first; + (GlobalWinF.Emulator as NES).NTSC_LastDrawLine = last; } } } @@ -3203,7 +3205,7 @@ namespace BizHawk.MultiClient { if (lua_input is string) { - Global.MainForm.LoadStateFile(lua_input.ToString(), Path.GetFileName(lua_input.ToString()), true); + GlobalWinF.MainForm.LoadStateFile(lua_input.ToString(), Path.GetFileName(lua_input.ToString()), true); } } @@ -3223,7 +3225,7 @@ namespace BizHawk.MultiClient if (x < 0 || x > 9) return; - Global.MainForm.LoadState("QuickSave" + x.ToString(), true); + GlobalWinF.MainForm.LoadState("QuickSave" + x.ToString(), true); } public string savestate_registerload(LuaFunction luaf, object name) @@ -3245,7 +3247,7 @@ namespace BizHawk.MultiClient if (lua_input is string) { string path = lua_input.ToString(); - Global.MainForm.SaveStateFile(path, path, true); + GlobalWinF.MainForm.SaveStateFile(path, path, true); } } @@ -3265,7 +3267,7 @@ namespace BizHawk.MultiClient if (x < 0 || x > 9) return; - Global.MainForm.SaveState("QuickSave" + x.ToString()); + GlobalWinF.MainForm.SaveState("QuickSave" + x.ToString()); } #endregion @@ -3314,42 +3316,42 @@ namespace BizHawk.MultiClient public void snes_setlayer_bg_1(bool value) { - Global.MainForm.SNES_ToggleBG1(value); + GlobalWinF.MainForm.SNES_ToggleBG1(value); } public void snes_setlayer_bg_2(bool value) { - Global.MainForm.SNES_ToggleBG2(value); + GlobalWinF.MainForm.SNES_ToggleBG2(value); } public void snes_setlayer_bg_3(bool value) { - Global.MainForm.SNES_ToggleBG3(value); + GlobalWinF.MainForm.SNES_ToggleBG3(value); } public void snes_setlayer_bg_4(bool value) { - Global.MainForm.SNES_ToggleBG4(value); + GlobalWinF.MainForm.SNES_ToggleBG4(value); } public void snes_setlayer_obj_1(bool value) { - Global.MainForm.SNES_ToggleOBJ1(value); + GlobalWinF.MainForm.SNES_ToggleOBJ1(value); } public void snes_setlayer_obj_2(bool value) { - Global.MainForm.SNES_ToggleOBJ2(value); + GlobalWinF.MainForm.SNES_ToggleOBJ2(value); } public void snes_setlayer_obj_3(bool value) { - Global.MainForm.SNES_ToggleOBJ3(value); + GlobalWinF.MainForm.SNES_ToggleOBJ3(value); } public void snes_setlayer_obj_4(bool value) { - Global.MainForm.SNES_ToggleOBJ4(value); + GlobalWinF.MainForm.SNES_ToggleOBJ4(value); } #endregion diff --git a/BizHawk.MultiClient/tools/Lua/LuaRegisteredFunctionsList.cs b/BizHawk.MultiClient/tools/Lua/LuaRegisteredFunctionsList.cs index 7a55302702..74ba8dbff4 100644 --- a/BizHawk.MultiClient/tools/Lua/LuaRegisteredFunctionsList.cs +++ b/BizHawk.MultiClient/tools/Lua/LuaRegisteredFunctionsList.cs @@ -30,7 +30,7 @@ namespace BizHawk.MultiClient { FunctionView.Items.Clear(); - List nlfs = Global.MainForm.LuaConsole1.LuaImp.RegisteredFunctions.OrderBy(x => x.Event).ThenBy(x => x.Name).ToList(); + List nlfs = GlobalWinF.MainForm.LuaConsole1.LuaImp.RegisteredFunctions.OrderBy(x => x.Event).ThenBy(x => x.Name).ToList(); foreach (NamedLuaFunction nlf in nlfs) { ListViewItem item = new ListViewItem { Text = nlf.Event }; @@ -55,7 +55,7 @@ namespace BizHawk.MultiClient ListView.SelectedIndexCollection indexes = FunctionView.SelectedIndices; if (indexes.Count > 0) { - Global.MainForm.LuaConsole1.LuaImp.RegisteredFunctions[indexes[0]].Call(); + GlobalWinF.MainForm.LuaConsole1.LuaImp.RegisteredFunctions[indexes[0]].Call(); } } @@ -64,8 +64,8 @@ namespace BizHawk.MultiClient ListView.SelectedIndexCollection indexes = FunctionView.SelectedIndices; if (indexes.Count > 0) { - NamedLuaFunction nlf = Global.MainForm.LuaConsole1.LuaImp.RegisteredFunctions[indexes[0]]; - Global.MainForm.LuaConsole1.LuaImp.RegisteredFunctions.Remove(nlf); + NamedLuaFunction nlf = GlobalWinF.MainForm.LuaConsole1.LuaImp.RegisteredFunctions[indexes[0]]; + GlobalWinF.MainForm.LuaConsole1.LuaImp.RegisteredFunctions.Remove(nlf); PopulateListView(); } } diff --git a/BizHawk.MultiClient/tools/Lua/LuaTextBox.cs b/BizHawk.MultiClient/tools/Lua/LuaTextBox.cs index 9dae008d77..b525e60adc 100644 --- a/BizHawk.MultiClient/tools/Lua/LuaTextBox.cs +++ b/BizHawk.MultiClient/tools/Lua/LuaTextBox.cs @@ -1,5 +1,7 @@ using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient.tools { enum BoxType { ALL, SIGNED, UNSIGNED, HEX }; diff --git a/BizHawk.MultiClient/tools/Lua/LuaWinform.Designer.cs b/BizHawk.MultiClient/tools/Lua/LuaWinform.Designer.cs index 97924bcf96..3f4725fb72 100644 --- a/BizHawk.MultiClient/tools/Lua/LuaWinform.Designer.cs +++ b/BizHawk.MultiClient/tools/Lua/LuaWinform.Designer.cs @@ -1,4 +1,4 @@ -namespace BizHawk.MultiClient.tools +namespace BizHawk.MultiClient { partial class LuaWinform { diff --git a/BizHawk.MultiClient/tools/Lua/LuaWinform.cs b/BizHawk.MultiClient/tools/Lua/LuaWinform.cs index 0274036160..31ef3c08db 100644 --- a/BizHawk.MultiClient/tools/Lua/LuaWinform.cs +++ b/BizHawk.MultiClient/tools/Lua/LuaWinform.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Windows.Forms; using LuaInterface; -namespace BizHawk.MultiClient.tools +namespace BizHawk.MultiClient { public partial class LuaWinform : Form { @@ -22,7 +22,7 @@ namespace BizHawk.MultiClient.tools public void CloseThis() { - Global.MainForm.LuaConsole1.LuaImp.WindowClosed(Handle); + GlobalWinF.MainForm.LuaConsole1.LuaImp.WindowClosed(Handle); } public void DoLuaEvent(IntPtr handle) diff --git a/BizHawk.MultiClient/tools/Lua/LuaWriter.cs b/BizHawk.MultiClient/tools/Lua/LuaWriter.cs index a7b6ce86de..55c472f4c6 100644 --- a/BizHawk.MultiClient/tools/Lua/LuaWriter.cs +++ b/BizHawk.MultiClient/tools/Lua/LuaWriter.cs @@ -6,7 +6,8 @@ using System.Text; using System.Windows.Forms; using System.Text.RegularExpressions; using System.IO; -using BizHawk.MultiClient.tools; + +using BizHawk.Client.Core; namespace BizHawk.MultiClient { @@ -433,7 +434,7 @@ namespace BizHawk.MultiClient private void GenerateLibraryRegex() { StringBuilder list = new StringBuilder(); - List Libs = Global.MainForm.LuaConsole1.LuaImp.docs.GetLibraryList(); + List Libs = GlobalWinF.MainForm.LuaConsole1.LuaImp.docs.GetLibraryList(); for (int i = 0; i < Libs.Count; i++) { list.Append(Libs[i]); @@ -564,7 +565,7 @@ namespace BizHawk.MultiClient sfd.FileName = Path.GetFileNameWithoutExtension(currentFile); sfd.InitialDirectory = Path.GetDirectoryName(currentFile); } - else if (!(Global.Emulator is NullEmulator)) + else if (!(GlobalWinF.Emulator is NullEmulator)) { sfd.FileName = PathManager.FilesystemSafeName(Global.Game); sfd.InitialDirectory = PathManager.GetLuaPath(); @@ -576,9 +577,9 @@ namespace BizHawk.MultiClient } sfd.Filter = "Watch Files (*.lua)|*.lua|All Files|*.*"; sfd.RestoreDirectory = true; - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = sfd.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result != DialogResult.OK) return null; var file = new FileInfo(sfd.FileName); @@ -658,7 +659,7 @@ namespace BizHawk.MultiClient string currentword = CurrentWord(); if (IsLibraryWord(currentword)) { - List libfunctions = Global.MainForm.LuaConsole1.LuaImp.docs.GetFunctionsByLibrary(currentword); + List libfunctions = GlobalWinF.MainForm.LuaConsole1.LuaImp.docs.GetFunctionsByLibrary(currentword); // Position autocomplete box near the cursor's current position int x = LuaText.GetPositionFromCharIndex(LuaText.SelectionStart).X + LuaText.Location.X + 5; @@ -782,7 +783,7 @@ namespace BizHawk.MultiClient private bool IsLibraryWord(string word) { - List Libs = Global.MainForm.LuaConsole1.LuaImp.docs.GetLibraryList(); + List Libs = GlobalWinF.MainForm.LuaConsole1.LuaImp.docs.GetLibraryList(); if (Libs.Contains(word)) { return true; diff --git a/BizHawk.MultiClient/tools/Lua/LuaWriterColorConfig.Designer.cs b/BizHawk.MultiClient/tools/Lua/LuaWriterColorConfig.Designer.cs index 470e28603a..6ac03000b9 100644 --- a/BizHawk.MultiClient/tools/Lua/LuaWriterColorConfig.Designer.cs +++ b/BizHawk.MultiClient/tools/Lua/LuaWriterColorConfig.Designer.cs @@ -1,4 +1,4 @@ -namespace BizHawk.MultiClient.tools +namespace BizHawk.MultiClient { partial class LuaWriterColorConfig { diff --git a/BizHawk.MultiClient/tools/Lua/LuaWriterColorConfig.cs b/BizHawk.MultiClient/tools/Lua/LuaWriterColorConfig.cs index 0af412f0d5..5066d9eae9 100644 --- a/BizHawk.MultiClient/tools/Lua/LuaWriterColorConfig.cs +++ b/BizHawk.MultiClient/tools/Lua/LuaWriterColorConfig.cs @@ -2,40 +2,42 @@ using System.Drawing; using System.Windows.Forms; -namespace BizHawk.MultiClient.tools +using BizHawk.Client.Core; + +namespace BizHawk.MultiClient { public partial class LuaWriterColorConfig : Form { - //Get existing global Lua color settings + //Get existing global Lua color settings int TextColor = Global.Config.LuaDefaultTextColor; - int KeyWordColor = Global.Config.LuaKeyWordColor; - int CommentColor = Global.Config.LuaCommentColor; - int StringColor = Global.Config.LuaStringColor; - int SymbolColor = Global.Config.LuaSymbolColor; - int LibraryColor = Global.Config.LuaLibraryColor; + int KeyWordColor = Global.Config.LuaKeyWordColor; + int CommentColor = Global.Config.LuaCommentColor; + int StringColor = Global.Config.LuaStringColor; + int SymbolColor = Global.Config.LuaSymbolColor; + int LibraryColor = Global.Config.LuaLibraryColor; public LuaWriterColorConfig() { InitializeComponent(); } - private void LuaWriterColorConfig_Load(object sender, EventArgs e) - { - //Set the initial colors into the panels + private void LuaWriterColorConfig_Load(object sender, EventArgs e) + { + //Set the initial colors into the panels SetTextColor(TextColor); - SetKeyWordColor(KeyWordColor); - SetCommentColor(CommentColor); - SetStringColor(StringColor); - SetSymbolColor(SymbolColor); - SetLibraryColor(LibraryColor); + SetKeyWordColor(KeyWordColor); + SetCommentColor(CommentColor); + SetStringColor(StringColor); + SetSymbolColor(SymbolColor); + SetLibraryColor(LibraryColor); BoldText.Checked = Global.Config.LuaDefaultTextBold; - BoldKeyWords.Checked = Global.Config.LuaKeyWordBold; - BoldComments.Checked = Global.Config.LuaCommentBold; - BoldStrings.Checked = Global.Config.LuaStringBold; - BoldSymbols.Checked = Global.Config.LuaSymbolBold; - BoldLibraries.Checked = Global.Config.LuaLibraryBold; - } + BoldKeyWords.Checked = Global.Config.LuaKeyWordBold; + BoldComments.Checked = Global.Config.LuaCommentBold; + BoldStrings.Checked = Global.Config.LuaStringBold; + BoldSymbols.Checked = Global.Config.LuaSymbolBold; + BoldLibraries.Checked = Global.Config.LuaLibraryBold; + } private void SetTextColor(int color) { @@ -43,35 +45,35 @@ namespace BizHawk.MultiClient.tools panelText.BackColor = Color.FromArgb(color); //Update panel color with new selection } - private void SetKeyWordColor(int color) - { - KeyWordColor = color; //Set new color - panelKeyWord.BackColor = Color.FromArgb(color); //Update panel color with new selection - } + private void SetKeyWordColor(int color) + { + KeyWordColor = color; //Set new color + panelKeyWord.BackColor = Color.FromArgb(color); //Update panel color with new selection + } - private void SetCommentColor(int color) - { - CommentColor = color; //Set new color - panelComment.BackColor = Color.FromArgb(color); //Update panel color with new selection - } + private void SetCommentColor(int color) + { + CommentColor = color; //Set new color + panelComment.BackColor = Color.FromArgb(color); //Update panel color with new selection + } - private void SetStringColor(int color) - { - StringColor = color; //Set new color - panelString.BackColor = Color.FromArgb(color); //Update panel color with new selection - } + private void SetStringColor(int color) + { + StringColor = color; //Set new color + panelString.BackColor = Color.FromArgb(color); //Update panel color with new selection + } - private void SetSymbolColor(int color) - { - SymbolColor = color; //Set new color - panelSymbol.BackColor = Color.FromArgb(color); //Update panel color with new selection - } + private void SetSymbolColor(int color) + { + SymbolColor = color; //Set new color + panelSymbol.BackColor = Color.FromArgb(color); //Update panel color with new selection + } - private void SetLibraryColor(int color) - { - LibraryColor = color; //Set new color + private void SetLibraryColor(int color) + { + LibraryColor = color; //Set new color panelLibrary.BackColor = Color.FromArgb(color); //Update panel color with new selection - } + } //Pop up color dialog when double-clicked private void panelText_DoubleClick(object sender, EventArgs e) @@ -82,93 +84,93 @@ namespace BizHawk.MultiClient.tools } } - //Pop up color dialog when double-clicked - private void panelKeyWord_DoubleClick(object sender, EventArgs e) - { - if (KeyWordColorDialog.ShowDialog() == DialogResult.OK) - { - SetKeyWordColor(KeyWordColorDialog.Color.ToArgb()); - } - } - - //Pop up color dialog when double-clicked - private void panelComment_DoubleClick(object sender, EventArgs e) - { - if (CommentColorDialog.ShowDialog() == DialogResult.OK) - { - SetCommentColor(CommentColorDialog.Color.ToArgb()); - } - } - - //Pop up color dialog when double-clicked - private void panelString_DoubleClick(object sender, EventArgs e) - { - if (StringColorDialog.ShowDialog() == DialogResult.OK) - { - SetStringColor(StringColorDialog.Color.ToArgb()); - } - } - - //Pop up color dialog when double-clicked - private void panelSymbol_DoubleClick(object sender, EventArgs e) - { - if (SymbolColorDialog.ShowDialog() == DialogResult.OK) - { - SetSymbolColor(SymbolColorDialog.Color.ToArgb()); - } - } - - //Pop up color dialog when double-clicked - private void panelLibrary_DoubleClick(object sender, EventArgs e) - { - if (LibraryColorDialog.ShowDialog() == DialogResult.OK) - { - SetLibraryColor(LibraryColorDialog.Color.ToArgb()); - LibraryColorDialog.Color = Color.FromArgb(10349567); - } - } - - private void OK_Click(object sender, EventArgs e) + //Pop up color dialog when double-clicked + private void panelKeyWord_DoubleClick(object sender, EventArgs e) { - SaveData(); //Save the chosen settings - DialogResult = DialogResult.OK; - Close(); + if (KeyWordColorDialog.ShowDialog() == DialogResult.OK) + { + SetKeyWordColor(KeyWordColorDialog.Color.ToArgb()); + } } - private void SaveData() - { - //Colors - Global.Config.LuaDefaultTextColor = TextColor; - Global.Config.LuaKeyWordColor = KeyWordColor; - Global.Config.LuaCommentColor = CommentColor; - Global.Config.LuaStringColor = StringColor; - Global.Config.LuaSymbolColor = SymbolColor; - Global.Config.LuaLibraryColor = LibraryColor; - - //Bold - Global.Config.LuaDefaultTextBold = BoldText.Checked; - Global.Config.LuaKeyWordBold = BoldKeyWords.Checked; - Global.Config.LuaCommentBold = BoldComments.Checked; - Global.Config.LuaStringBold = BoldStrings.Checked; - Global.Config.LuaSymbolBold = BoldSymbols.Checked; - Global.Config.LuaLibraryBold = BoldLibraries.Checked; - } + //Pop up color dialog when double-clicked + private void panelComment_DoubleClick(object sender, EventArgs e) + { + if (CommentColorDialog.ShowDialog() == DialogResult.OK) + { + SetCommentColor(CommentColorDialog.Color.ToArgb()); + } + } - private void buttonDefaults_Click(object sender, EventArgs e) - { + //Pop up color dialog when double-clicked + private void panelString_DoubleClick(object sender, EventArgs e) + { + if (StringColorDialog.ShowDialog() == DialogResult.OK) + { + SetStringColor(StringColorDialog.Color.ToArgb()); + } + } + + //Pop up color dialog when double-clicked + private void panelSymbol_DoubleClick(object sender, EventArgs e) + { + if (SymbolColorDialog.ShowDialog() == DialogResult.OK) + { + SetSymbolColor(SymbolColorDialog.Color.ToArgb()); + } + } + + //Pop up color dialog when double-clicked + private void panelLibrary_DoubleClick(object sender, EventArgs e) + { + if (LibraryColorDialog.ShowDialog() == DialogResult.OK) + { + SetLibraryColor(LibraryColorDialog.Color.ToArgb()); + LibraryColorDialog.Color = Color.FromArgb(10349567); + } + } + + private void OK_Click(object sender, EventArgs e) + { + SaveData(); //Save the chosen settings + DialogResult = DialogResult.OK; + Close(); + } + + private void SaveData() + { + //Colors + Global.Config.LuaDefaultTextColor = TextColor; + Global.Config.LuaKeyWordColor = KeyWordColor; + Global.Config.LuaCommentColor = CommentColor; + Global.Config.LuaStringColor = StringColor; + Global.Config.LuaSymbolColor = SymbolColor; + Global.Config.LuaLibraryColor = LibraryColor; + + //Bold + Global.Config.LuaDefaultTextBold = BoldText.Checked; + Global.Config.LuaKeyWordBold = BoldKeyWords.Checked; + Global.Config.LuaCommentBold = BoldComments.Checked; + Global.Config.LuaStringBold = BoldStrings.Checked; + Global.Config.LuaSymbolBold = BoldSymbols.Checked; + Global.Config.LuaLibraryBold = BoldLibraries.Checked; + } + + private void buttonDefaults_Click(object sender, EventArgs e) + { SetTextColor(-16777216); - SetKeyWordColor(-16776961); - SetCommentColor(-16744448); - SetStringColor(-8355712); - SetSymbolColor(-16777216); + SetKeyWordColor(-16776961); + SetCommentColor(-16744448); + SetStringColor(-8355712); + SetSymbolColor(-16777216); SetLibraryColor(-16711681); BoldText.Checked = false; - BoldKeyWords.Checked = false; - BoldComments.Checked = false; - BoldStrings.Checked = false; - BoldSymbols.Checked = false; - BoldLibraries.Checked = false; - } - } + BoldKeyWords.Checked = false; + BoldComments.Checked = false; + BoldStrings.Checked = false; + BoldSymbols.Checked = false; + BoldLibraries.Checked = false; + } + } } diff --git a/BizHawk.MultiClient/tools/N64/N64VideoPluginconfig.cs b/BizHawk.MultiClient/tools/N64/N64VideoPluginconfig.cs index 9248d55f48..4fbb16c22f 100644 --- a/BizHawk.MultiClient/tools/N64/N64VideoPluginconfig.cs +++ b/BizHawk.MultiClient/tools/N64/N64VideoPluginconfig.cs @@ -7,6 +7,8 @@ using System.Linq; using System.Text; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class N64VideoPluginconfig : Form @@ -38,7 +40,7 @@ namespace BizHawk.MultiClient Global.Config.N64VideoSizeX = Int32.Parse(strArr[0].Trim()); Global.Config.N64VideoSizeY = Int32.Parse(strArr[1].Trim()); Global.Config.N64VidPlugin = PluginComboBox.Text; - Global.MainForm.FlagNeedsReboot(); //TODO: this won't always be necessary, keep that in mind + GlobalWinF.MainForm.FlagNeedsReboot(); //TODO: this won't always be necessary, keep that in mind //Rice Global.Config.RicePlugin.NormalAlphaBlender = RiceNormalAlphaBlender_CB.Checked; diff --git a/BizHawk.MultiClient/tools/NES/NESDebugger.cs b/BizHawk.MultiClient/tools/NES/NESDebugger.cs index 94f9cd1482..7a4ced4fbe 100644 --- a/BizHawk.MultiClient/tools/NES/NESDebugger.cs +++ b/BizHawk.MultiClient/tools/NES/NESDebugger.cs @@ -4,6 +4,8 @@ using System.Drawing; using System.Windows.Forms; using BizHawk.Emulation.Consoles.Nintendo; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class NESDebugger : Form @@ -38,9 +40,9 @@ namespace BizHawk.MultiClient public void Restart() { - if (!(Global.Emulator is NES)) Close(); + if (!(GlobalWinF.Emulator is NES)) Close(); if (!IsHandleCreated || IsDisposed) return; - _nes = Global.Emulator as NES; + _nes = GlobalWinF.Emulator as NES; } public void UpdateValues() @@ -78,7 +80,7 @@ namespace BizHawk.MultiClient private void NESDebugger_Load(object sender, EventArgs e) { LoadConfigSettings(); - _nes = Global.Emulator as NES; + _nes = GlobalWinF.Emulator as NES; } private void LoadConfigSettings() diff --git a/BizHawk.MultiClient/tools/NES/NESGameGenie.cs b/BizHawk.MultiClient/tools/NES/NESGameGenie.cs index 2776e2b83b..ce1be9793b 100644 --- a/BizHawk.MultiClient/tools/NES/NESGameGenie.cs +++ b/BizHawk.MultiClient/tools/NES/NESGameGenie.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; using System.Globalization; + +using BizHawk.Client.Core; using BizHawk.Emulation.Consoles.Nintendo; namespace BizHawk.MultiClient @@ -351,7 +353,7 @@ namespace BizHawk.MultiClient private void AddCheatClick() { - if (Global.Emulator is NES) + if (GlobalWinF.Emulator is NES) { if (String.IsNullOrWhiteSpace(AddressBox.Text) || (String.IsNullOrWhiteSpace(ValueBox.Text))) { @@ -359,7 +361,7 @@ namespace BizHawk.MultiClient } Watch watch = Watch.GenerateWatch( - Global.Emulator.MemoryDomains[1], /*System Bus*/ + GlobalWinF.Emulator.MemoryDomains[1], /*System Bus*/ AddressBox.ToRawInt(), Watch.WatchSize.Byte, Watch.DisplayType.Hex, @@ -372,13 +374,13 @@ namespace BizHawk.MultiClient compare = CompareBox.ToRawInt(); } - Global.CheatList.Add(new Cheat( + GlobalWinF.CheatList.Add(new Cheat( watch, ValueBox.ToRawInt(), compare, enabled: true)); - Global.MainForm.Cheats_UpdateValues(); + GlobalWinF.MainForm.Cheats_UpdateValues(); } } diff --git a/BizHawk.MultiClient/tools/NES/NESGraphicsConfig.cs b/BizHawk.MultiClient/tools/NES/NESGraphicsConfig.cs index 828d3842d9..98326daba1 100644 --- a/BizHawk.MultiClient/tools/NES/NESGraphicsConfig.cs +++ b/BizHawk.MultiClient/tools/NES/NESGraphicsConfig.cs @@ -3,6 +3,8 @@ using System.Drawing; using System.Windows.Forms; using BizHawk.Emulation.Consoles.Nintendo; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class NESGraphicsConfig : Form @@ -22,7 +24,7 @@ namespace BizHawk.MultiClient private void NESGraphicsConfig_Load(object sender, EventArgs e) { - nes = Global.Emulator as NES; + nes = GlobalWinF.Emulator as NES; LoadStuff(); } @@ -73,7 +75,7 @@ namespace BizHawk.MultiClient { Global.Config.NESPaletteFile = palette.Name; nes.SetPalette(NES.Palettes.Load_FCEUX_Palette(HawkFile.ReadAllBytes(palette.Name))); - Global.OSD.AddMessage("Palette file loaded: " + palette.Name); + GlobalWinF.OSD.AddMessage("Palette file loaded: " + palette.Name); } } } @@ -81,7 +83,7 @@ namespace BizHawk.MultiClient { Global.Config.NESPaletteFile = ""; nes.SetPalette(NES.Palettes.FCEUX_Standard); - Global.OSD.AddMessage("Standard Palette set"); + GlobalWinF.OSD.AddMessage("Standard Palette set"); } Global.Config.NTSC_NESTopLine = (int)NTSC_FirstLineNumeric.Value; diff --git a/BizHawk.MultiClient/tools/NES/NESNameTableViewer.cs b/BizHawk.MultiClient/tools/NES/NESNameTableViewer.cs index d985921586..8b3bbfdd77 100644 --- a/BizHawk.MultiClient/tools/NES/NESNameTableViewer.cs +++ b/BizHawk.MultiClient/tools/NES/NESNameTableViewer.cs @@ -4,6 +4,8 @@ using System.Drawing.Imaging; using System.Windows.Forms; using BizHawk.Emulation.Consoles.Nintendo; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class NESNameTableViewer : Form @@ -35,7 +37,7 @@ namespace BizHawk.MultiClient if (now == false) { - if (Global.Emulator.Frame % RefreshRate.Value != 0) return; + if (GlobalWinF.Emulator.Frame % RefreshRate.Value != 0) return; } BitmapData bmpdata = NameTableView.Nametables.LockBits(new Rectangle(0, 0, 512, 480), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); @@ -105,15 +107,15 @@ namespace BizHawk.MultiClient public void UpdateValues() { if (!IsHandleCreated || IsDisposed) return; - if (!(Global.Emulator is NES)) return; - NES.PPU ppu = (Global.Emulator as NES).ppu; + if (!(GlobalWinF.Emulator is NES)) return; + NES.PPU ppu = (GlobalWinF.Emulator as NES).ppu; ppu.NTViewCallback = Callback; } public void Restart() { - if (!(Global.Emulator is NES)) Close(); - _nes = Global.Emulator as NES; + if (!(GlobalWinF.Emulator is NES)) Close(); + _nes = GlobalWinF.Emulator as NES; Generate(true); } @@ -122,7 +124,7 @@ namespace BizHawk.MultiClient if (Global.Config.NESNameTableSaveWindowPosition && Global.Config.NESNameTableWndx >= 0 && Global.Config.NESNameTableWndy >= 0) Location = new Point(Global.Config.NESNameTableWndx, Global.Config.NESNameTableWndy); - _nes = Global.Emulator as NES; + _nes = GlobalWinF.Emulator as NES; RefreshRate.Value = Global.Config.NESNameTableRefreshRate; Generate(true); } diff --git a/BizHawk.MultiClient/tools/NES/NESPPU.cs b/BizHawk.MultiClient/tools/NES/NESPPU.cs index 5d22c8be2d..ce9175a10b 100644 --- a/BizHawk.MultiClient/tools/NES/NESPPU.cs +++ b/BizHawk.MultiClient/tools/NES/NESPPU.cs @@ -2,6 +2,8 @@ using System.Drawing; using System.Windows.Forms; using System.Globalization; + +using BizHawk.Client.Core; using BizHawk.Emulation.Consoles.Nintendo; namespace BizHawk.MultiClient @@ -50,9 +52,9 @@ namespace BizHawk.MultiClient public void Restart() { - if (!(Global.Emulator is NES)) Close(); + if (!(GlobalWinF.Emulator is NES)) Close(); if (!IsHandleCreated || IsDisposed) return; - _nes = Global.Emulator as NES; + _nes = GlobalWinF.Emulator as NES; Generate(true); } @@ -99,7 +101,7 @@ namespace BizHawk.MultiClient { if (!IsHandleCreated || IsDisposed) return; - if (Global.Emulator.Frame % RefreshRate.Value == 0 || now) + if (GlobalWinF.Emulator.Frame % RefreshRate.Value == 0 || now) { bool Changed = CheckChange(); @@ -231,14 +233,14 @@ namespace BizHawk.MultiClient public void UpdateValues() { if (!IsHandleCreated || IsDisposed) return; - if (!(Global.Emulator is NES)) return; + if (!(GlobalWinF.Emulator is NES)) return; _nes.ppu.PPUViewCallback = Callback; } private void NESPPU_Load(object sender, EventArgs e) { LoadConfigSettings(); - _nes = Global.Emulator as NES; + _nes = GlobalWinF.Emulator as NES; ClearDetails(); RefreshRate.Value = Global.Config.NESPPURefreshRate; Generate(true); diff --git a/BizHawk.MultiClient/tools/NES/NESSoundConfig.cs b/BizHawk.MultiClient/tools/NES/NESSoundConfig.cs index 572054e1ae..dae0998650 100644 --- a/BizHawk.MultiClient/tools/NES/NESSoundConfig.cs +++ b/BizHawk.MultiClient/tools/NES/NESSoundConfig.cs @@ -1,6 +1,8 @@ using System; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class NESSoundConfig : Form @@ -45,7 +47,7 @@ namespace BizHawk.MultiClient Global.Config.NESTriangle = tr; Global.Config.NESNoise = no; Global.Config.NESDMC = dmc; - Global.MainForm.SetNESSoundChannels(); + GlobalWinF.MainForm.SetNESSoundChannels(); Close(); } @@ -75,35 +77,35 @@ namespace BizHawk.MultiClient { label6.Text = trackBar1.Value.ToString(); Global.Config.NESSquare1 = trackBar1.Value; - Global.MainForm.SetNESSoundChannels(); + GlobalWinF.MainForm.SetNESSoundChannels(); } private void trackBar2_ValueChanged(object sender, EventArgs e) { label7.Text = trackBar2.Value.ToString(); Global.Config.NESSquare2 = trackBar2.Value; - Global.MainForm.SetNESSoundChannels(); + GlobalWinF.MainForm.SetNESSoundChannels(); } private void trackBar3_ValueChanged(object sender, EventArgs e) { label8.Text = trackBar3.Value.ToString(); Global.Config.NESTriangle = trackBar3.Value; - Global.MainForm.SetNESSoundChannels(); + GlobalWinF.MainForm.SetNESSoundChannels(); } private void trackBar4_ValueChanged(object sender, EventArgs e) { label9.Text = trackBar4.Value.ToString(); Global.Config.NESNoise = trackBar4.Value; - Global.MainForm.SetNESSoundChannels(); + GlobalWinF.MainForm.SetNESSoundChannels(); } private void trackBar5_ValueChanged(object sender, EventArgs e) { label10.Text = trackBar5.Value.ToString(); Global.Config.NESDMC = trackBar5.Value; - Global.MainForm.SetNESSoundChannels(); + GlobalWinF.MainForm.SetNESSoundChannels(); } } } diff --git a/BizHawk.MultiClient/tools/NES/NameTableViewer.cs b/BizHawk.MultiClient/tools/NES/NameTableViewer.cs index 916d2f0ef9..6cd769ec19 100644 --- a/BizHawk.MultiClient/tools/NES/NameTableViewer.cs +++ b/BizHawk.MultiClient/tools/NES/NameTableViewer.cs @@ -3,6 +3,8 @@ using System.Windows.Forms; using System.IO; using System.Drawing.Imaging; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public sealed class NameTableViewer : Control @@ -74,9 +76,9 @@ namespace BizHawk.MultiClient RestoreDirectory = true }; - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = sfd.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result != DialogResult.OK) { return; diff --git a/BizHawk.MultiClient/tools/NES/PaletteViewer.cs b/BizHawk.MultiClient/tools/NES/PaletteViewer.cs index 66da77995c..b9a2b58c0b 100644 --- a/BizHawk.MultiClient/tools/NES/PaletteViewer.cs +++ b/BizHawk.MultiClient/tools/NES/PaletteViewer.cs @@ -3,6 +3,8 @@ using System.Windows.Forms; using System.IO; using System.Drawing.Imaging; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public sealed class PaletteViewer : Control @@ -81,9 +83,9 @@ namespace BizHawk.MultiClient RestoreDirectory = true }; - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = sfd.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result != DialogResult.OK) return; diff --git a/BizHawk.MultiClient/tools/NES/PatternViewer.cs b/BizHawk.MultiClient/tools/NES/PatternViewer.cs index 181d18dabd..c5b53184c6 100644 --- a/BizHawk.MultiClient/tools/NES/PatternViewer.cs +++ b/BizHawk.MultiClient/tools/NES/PatternViewer.cs @@ -3,6 +3,8 @@ using System.Windows.Forms; using System.IO; using System.Drawing.Imaging; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public sealed class PatternViewer : Control @@ -42,9 +44,9 @@ namespace BizHawk.MultiClient RestoreDirectory = true }; - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = sfd.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result != DialogResult.OK) return; diff --git a/BizHawk.MultiClient/tools/NES/SpriteViewer.cs b/BizHawk.MultiClient/tools/NES/SpriteViewer.cs index 973dc11252..cd55040afa 100644 --- a/BizHawk.MultiClient/tools/NES/SpriteViewer.cs +++ b/BizHawk.MultiClient/tools/NES/SpriteViewer.cs @@ -3,6 +3,8 @@ using System.Windows.Forms; using System.IO; using System.Drawing.Imaging; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public sealed class SpriteViewer : Control @@ -47,9 +49,9 @@ namespace BizHawk.MultiClient RestoreDirectory = true }; - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = sfd.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result != DialogResult.OK) return; diff --git a/BizHawk.MultiClient/tools/PCE/PCEBGViewer.cs b/BizHawk.MultiClient/tools/PCE/PCEBGViewer.cs index c63caafad7..49bdd4ae28 100644 --- a/BizHawk.MultiClient/tools/PCE/PCEBGViewer.cs +++ b/BizHawk.MultiClient/tools/PCE/PCEBGViewer.cs @@ -2,6 +2,8 @@ using System.Drawing; using System.Windows.Forms; using System.Drawing.Imaging; + +using BizHawk.Client.Core; using BizHawk.Emulation.Consoles.TurboGrafx; namespace BizHawk.MultiClient @@ -20,7 +22,7 @@ namespace BizHawk.MultiClient public unsafe void Generate() { - if (Global.Emulator.Frame % RefreshRate.Value != 0) return; + if (GlobalWinF.Emulator.Frame % RefreshRate.Value != 0) return; VDC vdc = VDCtype == 0 ? pce.VDC1 : pce.VDC2; @@ -65,18 +67,18 @@ namespace BizHawk.MultiClient public void Restart() { if (!IsHandleCreated || IsDisposed) return; - if (!(Global.Emulator is PCEngine)) + if (!(GlobalWinF.Emulator is PCEngine)) { Close(); return; } - pce = Global.Emulator as PCEngine; + pce = GlobalWinF.Emulator as PCEngine; } public void UpdateValues() { if (!IsHandleCreated || IsDisposed) return; - if (!(Global.Emulator is PCEngine)) return; + if (!(GlobalWinF.Emulator is PCEngine)) return; Generate(); } @@ -95,7 +97,7 @@ namespace BizHawk.MultiClient private void PCEBGViewer_Load(object sender, EventArgs e) { - pce = Global.Emulator as PCEngine; + pce = GlobalWinF.Emulator as PCEngine; LoadConfigSettings(); if (Global.Config.PCEBGViewerRefreshRate >= RefreshRate.Minimum && Global.Config.PCEBGViewerRefreshRate <= RefreshRate.Maximum) { diff --git a/BizHawk.MultiClient/tools/PCE/PCEGraphicsConfig.cs b/BizHawk.MultiClient/tools/PCE/PCEGraphicsConfig.cs index 7c94bb52eb..177f4c6b78 100644 --- a/BizHawk.MultiClient/tools/PCE/PCEGraphicsConfig.cs +++ b/BizHawk.MultiClient/tools/PCE/PCEGraphicsConfig.cs @@ -1,6 +1,8 @@ using System; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class PCEGraphicsConfig : Form diff --git a/BizHawk.MultiClient/tools/SMS/SMSGraphicsConfig.cs b/BizHawk.MultiClient/tools/SMS/SMSGraphicsConfig.cs index 980c85ae08..750b367859 100644 --- a/BizHawk.MultiClient/tools/SMS/SMSGraphicsConfig.cs +++ b/BizHawk.MultiClient/tools/SMS/SMSGraphicsConfig.cs @@ -1,6 +1,8 @@ using System; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class SMSGraphicsConfig : Form diff --git a/BizHawk.MultiClient/tools/SNES/SNESGameGenie.cs b/BizHawk.MultiClient/tools/SNES/SNESGameGenie.cs index dbb198e149..b25220c4b1 100644 --- a/BizHawk.MultiClient/tools/SNES/SNESGameGenie.cs +++ b/BizHawk.MultiClient/tools/SNES/SNESGameGenie.cs @@ -6,6 +6,8 @@ using System.Globalization; using System.Text.RegularExpressions; using BizHawk.Emulation.Consoles.Nintendo.SNES; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class SNESGameGenie : Form @@ -13,7 +15,7 @@ namespace BizHawk.MultiClient private readonly Dictionary GameGenieTable = new Dictionary(); private bool Processing = false; - public SNESGameGenie() + public SNESGameGenie() { InitializeComponent(); Closing += (o, e) => SaveConfigSettings(); @@ -291,7 +293,7 @@ namespace BizHawk.MultiClient private void AddCheat_Click(object sender, EventArgs e) { - if (Global.Emulator is LibsnesCore) + if (GlobalWinF.Emulator is LibsnesCore) { string NAME; int ADDRESS = 0; @@ -321,9 +323,9 @@ namespace BizHawk.MultiClient VALUE = (byte)(int.Parse(ValueBox.Text, NumberStyles.HexNumber)); } - for (int i = 0; i < Global.Emulator.MemoryDomains.Count; i++) + for (int i = 0; i < GlobalWinF.Emulator.MemoryDomains.Count; i++) { - if (Global.Emulator.MemoryDomains[i].ToString() == "BUS") + if (GlobalWinF.Emulator.MemoryDomains[i].ToString() == "BUS") { sysBusIndex = i; break; @@ -331,7 +333,7 @@ namespace BizHawk.MultiClient } Watch watch = Watch.GenerateWatch( - Global.Emulator.MemoryDomains[sysBusIndex], + GlobalWinF.Emulator.MemoryDomains[sysBusIndex], ADDRESS, Watch.WatchSize.Byte, Watch.DisplayType.Hex, @@ -339,7 +341,7 @@ namespace BizHawk.MultiClient bigEndian: false ); - Global.CheatList.Add(new Cheat( + GlobalWinF.CheatList.Add(new Cheat( watch, VALUE, compare: null, diff --git a/BizHawk.MultiClient/tools/SNES/SNESGraphicsDebugger.cs b/BizHawk.MultiClient/tools/SNES/SNESGraphicsDebugger.cs index 60e924b63d..8f90fe289f 100644 --- a/BizHawk.MultiClient/tools/SNES/SNESGraphicsDebugger.cs +++ b/BizHawk.MultiClient/tools/SNES/SNESGraphicsDebugger.cs @@ -28,6 +28,8 @@ using System.Collections.Generic; using System.Drawing; using System.Reflection; using System.Windows.Forms; + +using BizHawk.Client.Core; using BizHawk.Emulation.Consoles.Nintendo.SNES; using BizHawk.Core; @@ -152,7 +154,7 @@ namespace BizHawk.MultiClient void SyncCore() { - LibsnesCore core = Global.Emulator as LibsnesCore; + LibsnesCore core = GlobalWinF.Emulator as LibsnesCore; if (currentSnesCore != core && currentSnesCore != null) { currentSnesCore.ScanlineHookManager.Unregister(this); @@ -1384,7 +1386,7 @@ namespace BizHawk.MultiClient suppression = false; } - Global.MainForm.SyncCoreCommInputSignals(); + GlobalWinF.MainForm.SyncCoreCommInputSignals(); } private void lblEnPrio0_Click(object sender, EventArgs e) diff --git a/BizHawk.MultiClient/tools/Saturn/SaturnPrefs.Designer.cs b/BizHawk.MultiClient/tools/Saturn/SaturnPrefs.Designer.cs index 14482f5486..0224ae2a20 100644 --- a/BizHawk.MultiClient/tools/Saturn/SaturnPrefs.Designer.cs +++ b/BizHawk.MultiClient/tools/Saturn/SaturnPrefs.Designer.cs @@ -1,4 +1,4 @@ -namespace BizHawk.MultiClient.SATTools +namespace BizHawk.MultiClient { partial class SaturnPrefs { diff --git a/BizHawk.MultiClient/tools/Saturn/SaturnPrefs.cs b/BizHawk.MultiClient/tools/Saturn/SaturnPrefs.cs index c33d9a2dee..1fc1cd4a2c 100644 --- a/BizHawk.MultiClient/tools/Saturn/SaturnPrefs.cs +++ b/BizHawk.MultiClient/tools/Saturn/SaturnPrefs.cs @@ -7,7 +7,9 @@ using System.Linq; using System.Text; using System.Windows.Forms; -namespace BizHawk.MultiClient.SATTools +using BizHawk.Client.Core; + +namespace BizHawk.MultiClient { public partial class SaturnPrefs : Form { diff --git a/BizHawk.MultiClient/tools/StateVisualizer.cs b/BizHawk.MultiClient/tools/StateVisualizer.cs index 827004f2df..5ddc765858 100644 --- a/BizHawk.MultiClient/tools/StateVisualizer.cs +++ b/BizHawk.MultiClient/tools/StateVisualizer.cs @@ -2,13 +2,15 @@ using System.Linq; using System.IO; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { class StateVisualizer { public StateVisualizer() { - TimeLine movietimeline = new TimeLine(Global.MovieSession.Movie.LogDump); + TimeLine movietimeline = new TimeLine(GlobalWinF.MovieSession.Movie.LogDump); Timelines = new List {movietimeline}; diff --git a/BizHawk.MultiClient/tools/TAStudio.Designer.cs b/BizHawk.MultiClient/tools/TAStudio.Designer.cs index 5d41ba3b02..619e99c133 100644 --- a/BizHawk.MultiClient/tools/TAStudio.Designer.cs +++ b/BizHawk.MultiClient/tools/TAStudio.Designer.cs @@ -18,7 +18,7 @@ components.Dispose(); } - Global.MovieSession.Movie.StateCapturing = false; + GlobalWinF.MovieSession.Movie.StateCapturing = false; base.Dispose(disposing); } diff --git a/BizHawk.MultiClient/tools/TAStudio.cs b/BizHawk.MultiClient/tools/TAStudio.cs index 9e0c436c39..34845441b3 100644 --- a/BizHawk.MultiClient/tools/TAStudio.cs +++ b/BizHawk.MultiClient/tools/TAStudio.cs @@ -4,6 +4,8 @@ using System.ComponentModel; using System.Drawing; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class TAStudio : Form @@ -60,7 +62,7 @@ namespace BizHawk.MultiClient { if (!IsHandleCreated || IsDisposed) return; TASView.BlazingFast = true; - if (Global.MovieSession.Movie.IsActive) + if (GlobalWinF.MovieSession.Movie.IsActive) { DisplayList(); } @@ -69,14 +71,14 @@ namespace BizHawk.MultiClient TASView.ItemCount = 0; } - if (Global.MovieSession.Movie.IsPlaying && !Global.MovieSession.Movie.IsFinished) + if (GlobalWinF.MovieSession.Movie.IsPlaying && !GlobalWinF.MovieSession.Movie.IsFinished) { TASView.BlazingFast = false; } - if (Global.Emulator.Frame < stopOnFrame) + if (GlobalWinF.Emulator.Frame < stopOnFrame) { - Global.MainForm.PressFrameAdvance = true; + GlobalWinF.MainForm.PressFrameAdvance = true; } } @@ -97,28 +99,28 @@ namespace BizHawk.MultiClient private void TASView_QueryItemBkColor(int index, int column, ref Color color) { - if (index == 0 && Global.MovieSession.Movie.StateFirstIndex == 0) + if (index == 0 && GlobalWinF.MovieSession.Movie.StateFirstIndex == 0) { if (color != Color.LightGreen) { color = Color.LightGreen; //special case for frame 0. Normally we need to go back an extra frame, but for frame 0 we can reload the rom. } } - else if (Global.MovieSession.Movie.FrameLagged(index)) + else if (GlobalWinF.MovieSession.Movie.FrameLagged(index)) { if (color != Color.Pink) { color = Color.Pink; } } - else if (index > Global.MovieSession.Movie.StateFirstIndex && index <= Global.MovieSession.Movie.StateLastIndex) + else if (index > GlobalWinF.MovieSession.Movie.StateFirstIndex && index <= GlobalWinF.MovieSession.Movie.StateLastIndex) { if (color != Color.LightGreen) { color = Color.LightGreen; } } - if (index == Global.Emulator.Frame) + if (index == GlobalWinF.Emulator.Frame) { if (color != Color.LightBlue) { @@ -132,24 +134,24 @@ namespace BizHawk.MultiClient text = ""; //If this is just for an actual frame and not just the list view cursor at the end - if (Global.MovieSession.Movie.Frames != index) + if (GlobalWinF.MovieSession.Movie.Frames != index) { if (column == 0) text = String.Format("{0:#,##0}", index); if (column == 1) - text = Global.MovieSession.Movie.GetInput(index); + text = GlobalWinF.MovieSession.Movie.GetInput(index); } } private void DisplayList() { - TASView.ItemCount = Global.MovieSession.Movie.RawFrames; - if (Global.MovieSession.Movie.Frames == Global.Emulator.Frame && Global.MovieSession.Movie.StateLastIndex == Global.Emulator.Frame - 1) + TASView.ItemCount = GlobalWinF.MovieSession.Movie.RawFrames; + if (GlobalWinF.MovieSession.Movie.Frames == GlobalWinF.Emulator.Frame && GlobalWinF.MovieSession.Movie.StateLastIndex == GlobalWinF.Emulator.Frame - 1) { //If we're at the end of the movie add one to show the cursor as a blank frame TASView.ItemCount++; } - TASView.ensureVisible(Global.Emulator.Frame - 1); + TASView.ensureVisible(GlobalWinF.Emulator.Frame - 1); } public void Restart() @@ -163,13 +165,13 @@ namespace BizHawk.MultiClient { //TODO: don't engage until new/open project // - Global.MainForm.PauseEmulator(); + GlobalWinF.MainForm.PauseEmulator(); Engaged = true; - Global.OSD.AddMessage("TAStudio engaged"); - if (Global.MovieSession.Movie.IsActive) + GlobalWinF.OSD.AddMessage("TAStudio engaged"); + if (GlobalWinF.MovieSession.Movie.IsActive) { - Global.MovieSession.Movie.StateCapturing = true; - ReadOnlyCheckBox.Checked = Global.MainForm.ReadOnly; + GlobalWinF.MovieSession.Movie.StateCapturing = true; + ReadOnlyCheckBox.Checked = GlobalWinF.MainForm.ReadOnly; } else { @@ -245,36 +247,36 @@ namespace BizHawk.MultiClient private void StopButton_Click(object sender, EventArgs e) { - Global.MainForm.StopMovie(); + GlobalWinF.MainForm.StopMovie(); Restart(); } private void FrameAdvanceButton_Click(object sender, EventArgs e) { - Global.MainForm.PressFrameAdvance = true; + GlobalWinF.MainForm.PressFrameAdvance = true; } private void RewindButton_Click(object sender, EventArgs e) { stopOnFrame = 0; - if (Global.MovieSession.Movie.IsFinished || !Global.MovieSession.Movie.IsActive) + if (GlobalWinF.MovieSession.Movie.IsFinished || !GlobalWinF.MovieSession.Movie.IsActive) { - Global.MainForm.Rewind(1); - if (Global.Emulator.Frame <= Global.MovieSession.Movie.Frames) + GlobalWinF.MainForm.Rewind(1); + if (GlobalWinF.Emulator.Frame <= GlobalWinF.MovieSession.Movie.Frames) { - Global.MovieSession.Movie.SwitchToPlay(); + GlobalWinF.MovieSession.Movie.SwitchToPlay(); } } else { - Global.MovieSession.Movie.RewindToFrame(Global.Emulator.Frame - 1); + GlobalWinF.MovieSession.Movie.RewindToFrame(GlobalWinF.Emulator.Frame - 1); } UpdateValues(); } private void PauseButton_Click(object sender, EventArgs e) { - Global.MainForm.TogglePause(); + GlobalWinF.MainForm.TogglePause(); } private void autoloadToolStripMenuItem_Click(object sender, EventArgs e) @@ -286,22 +288,22 @@ namespace BizHawk.MultiClient { if (ReadOnlyCheckBox.Checked) { - Global.MainForm.SetReadOnly(true); + GlobalWinF.MainForm.SetReadOnly(true); ReadOnlyCheckBox.BackColor = SystemColors.Control; - if (Global.MovieSession.Movie.IsActive) + if (GlobalWinF.MovieSession.Movie.IsActive) { - Global.MovieSession.Movie.SwitchToPlay(); + GlobalWinF.MovieSession.Movie.SwitchToPlay(); toolTip1.SetToolTip(ReadOnlyCheckBox, "Currently Read-Only Mode"); } } else { - Global.MainForm.SetReadOnly(false); + GlobalWinF.MainForm.SetReadOnly(false); ReadOnlyCheckBox.BackColor = Color.LightCoral; - if (Global.MovieSession.Movie.IsActive) + if (GlobalWinF.MovieSession.Movie.IsActive) { - Global.MovieSession.Movie.SwitchToRecord(); + GlobalWinF.MovieSession.Movie.SwitchToRecord(); toolTip1.SetToolTip(ReadOnlyCheckBox, "Currently Read+Write Mode"); } } @@ -309,7 +311,7 @@ namespace BizHawk.MultiClient private void RewindToBeginning_Click(object sender, EventArgs e) { - Global.MainForm.Rewind(Global.Emulator.Frame); + GlobalWinF.MainForm.Rewind(GlobalWinF.Emulator.Frame); DisplayList(); } @@ -318,7 +320,7 @@ namespace BizHawk.MultiClient //TODO: adelikat: I removed the stop on frame feature, so this will keep playing into movie finished mode, need to rebuild that functionality FastFowardToEnd.Checked ^= true; - Global.MainForm.FastForward = FastFowardToEnd.Checked; + GlobalWinF.MainForm.FastForward = FastFowardToEnd.Checked; if (FastFowardToEnd.Checked) { FastForward.Checked = false; @@ -369,17 +371,17 @@ namespace BizHawk.MultiClient private void newProjectToolStripMenuItem_Click(object sender, EventArgs e) { - Global.MainForm.RecordMovie(); + GlobalWinF.MainForm.RecordMovie(); } private void openProjectToolStripMenuItem_Click(object sender, EventArgs e) { - Global.MainForm.PlayMovie(); + GlobalWinF.MainForm.PlayMovie(); } private void saveProjectToolStripMenuItem_Click(object sender, EventArgs e) { - Global.MovieSession.Movie.WriteMovie(); + GlobalWinF.MovieSession.Movie.WriteMovie(); } private void saveProjectAsToolStripMenuItem_Click(object sender, EventArgs e) @@ -388,15 +390,15 @@ namespace BizHawk.MultiClient if ("" != fileName) { - Global.MovieSession.Movie.Filename = fileName; - Global.MovieSession.Movie.WriteMovie(); + GlobalWinF.MovieSession.Movie.Filename = fileName; + GlobalWinF.MovieSession.Movie.WriteMovie(); } } private void FastForward_Click(object sender, EventArgs e) { FastForward.Checked ^= true; - Global.MainForm.FastForward = FastForward.Checked; + GlobalWinF.MainForm.FastForward = FastForward.Checked; if (FastForward.Checked) { TurboFastForward.Checked = false; @@ -406,7 +408,7 @@ namespace BizHawk.MultiClient private void TurboFastForward_Click(object sender, EventArgs e) { - Global.MainForm.TurboFastForward ^= true; + GlobalWinF.MainForm.TurboFastForward ^= true; TurboFastForward.Checked ^= true; if (TurboFastForward.Checked) { @@ -422,16 +424,16 @@ namespace BizHawk.MultiClient private void TASView_DoubleClick(object sender, EventArgs e) { - if (TASView.selectedItem <= Global.MovieSession.Movie.StateLastIndex) + if (TASView.selectedItem <= GlobalWinF.MovieSession.Movie.StateLastIndex) { stopOnFrame = 0; - Global.MovieSession.Movie.RewindToFrame(TASView.selectedItem); + GlobalWinF.MovieSession.Movie.RewindToFrame(TASView.selectedItem); } else { - Global.MovieSession.Movie.RewindToFrame(Global.MovieSession.Movie.StateLastIndex); + GlobalWinF.MovieSession.Movie.RewindToFrame(GlobalWinF.MovieSession.Movie.StateLastIndex); stopOnFrame = TASView.selectedItem; - Global.MainForm.PressFrameAdvance = true; + GlobalWinF.MainForm.PressFrameAdvance = true; } UpdateValues(); @@ -453,14 +455,14 @@ namespace BizHawk.MultiClient { InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPath, null), DefaultExt = "." + Global.Config.MovieExtension, - FileName = Global.MovieSession.Movie.Filename + FileName = GlobalWinF.MovieSession.Movie.Filename }; string filter = "Movie Files (*." + Global.Config.MovieExtension + ")|*." + Global.Config.MovieExtension + "|Savestates|*.state|All Files|*.*"; sfd.Filter = filter; - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = sfd.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result == DialogResult.OK) { return sfd.FileName; @@ -478,11 +480,11 @@ namespace BizHawk.MultiClient if (e.Delta > 0) //Scroll up { - Global.MovieSession.Movie.RewindToFrame(Global.Emulator.Frame - 1); + GlobalWinF.MovieSession.Movie.RewindToFrame(GlobalWinF.Emulator.Frame - 1); } else if (e.Delta < 0) //Scroll down { - Global.MainForm.PressFrameAdvance = true; + GlobalWinF.MainForm.PressFrameAdvance = true; } UpdateValues(); @@ -535,7 +537,7 @@ namespace BizHawk.MultiClient ListView.SelectedIndexCollection list = TASView.SelectedIndices; for (int index = 0; index < list.Count; index++) { - Global.MovieSession.Movie.InsertBlankFrame(list[index]); + GlobalWinF.MovieSession.Movie.InsertBlankFrame(list[index]); } UpdateValues(); @@ -546,7 +548,7 @@ namespace BizHawk.MultiClient ListView.SelectedIndexCollection list = TASView.SelectedIndices; foreach (object t in list) { - Global.MovieSession.Movie.DeleteFrame(list[0]); //TODO: this doesn't allow of non-continuous deletion, instead it should iterate from last to first and remove the iterated value + GlobalWinF.MovieSession.Movie.DeleteFrame(list[0]); //TODO: this doesn't allow of non-continuous deletion, instead it should iterate from last to first and remove the iterated value } UpdateValues(); @@ -557,7 +559,7 @@ namespace BizHawk.MultiClient ListView.SelectedIndexCollection list = TASView.SelectedIndices; for (int index = 0; index < list.Count; index++) { - Global.MovieSession.Movie.InsertFrame(Global.MovieSession.Movie.GetInput(list[index]), list[index]); + GlobalWinF.MovieSession.Movie.InsertFrame(GlobalWinF.MovieSession.Movie.GetInput(list[index]), list[index]); } UpdateValues(); @@ -568,7 +570,7 @@ namespace BizHawk.MultiClient ListView.SelectedIndexCollection list = TASView.SelectedIndices; for (int index = 0; index < list.Count; index++) { - Global.MovieSession.Movie.ClearFrame(list[index]); + GlobalWinF.MovieSession.Movie.ClearFrame(list[index]); } UpdateValues(); @@ -589,7 +591,7 @@ namespace BizHawk.MultiClient int frames = int.Parse(prompt.UserText); for (int i = 0; i < frames; i++) { - Global.MovieSession.Movie.InsertBlankFrame(list[0] + i); + GlobalWinF.MovieSession.Movie.InsertBlankFrame(list[0] + i); } } } @@ -634,7 +636,7 @@ namespace BizHawk.MultiClient ListView.SelectedIndexCollection list = TASView.SelectedIndices; if (list.Count > 0) { - Global.MovieSession.Movie.TruncateMovie(list[0]); + GlobalWinF.MovieSession.Movie.TruncateMovie(list[0]); UpdateValues(); } } @@ -655,7 +657,7 @@ namespace BizHawk.MultiClient ListView.SelectedIndexCollection list = TASView.SelectedIndices; for (int i = 0; i < list.Count; i++) { - ClipboardEntry entry = new ClipboardEntry {Frame = list[i], Inputstr = Global.MovieSession.Movie.GetInput(list[i])}; + ClipboardEntry entry = new ClipboardEntry {Frame = list[i], Inputstr = GlobalWinF.MovieSession.Movie.GetInput(list[i])}; Clipboard.Add(entry); } UpdateSlicerDisplay(); @@ -700,7 +702,7 @@ namespace BizHawk.MultiClient { for (int i = 0; i < Clipboard.Count; i++) { - Global.MovieSession.Movie.ModifyFrame(Clipboard[i].Inputstr, list[0] + i); + GlobalWinF.MovieSession.Movie.ModifyFrame(Clipboard[i].Inputstr, list[0] + i); } } UpdateValues(); @@ -713,7 +715,7 @@ namespace BizHawk.MultiClient { for (int i = 0; i < Clipboard.Count; i++) { - Global.MovieSession.Movie.InsertFrame(Clipboard[i].Inputstr, list[0] + i); + GlobalWinF.MovieSession.Movie.InsertFrame(Clipboard[i].Inputstr, list[0] + i); } } UpdateValues(); @@ -737,9 +739,9 @@ namespace BizHawk.MultiClient Clipboard.Clear(); for (int i = 0; i < list.Count; i++) { - ClipboardEntry entry = new ClipboardEntry {Frame = list[i], Inputstr = Global.MovieSession.Movie.GetInput(list[i])}; + ClipboardEntry entry = new ClipboardEntry {Frame = list[i], Inputstr = GlobalWinF.MovieSession.Movie.GetInput(list[i])}; Clipboard.Add(entry); - Global.MovieSession.Movie.DeleteFrame(list[0]); + GlobalWinF.MovieSession.Movie.DeleteFrame(list[0]); } UpdateValues(); @@ -768,13 +770,13 @@ namespace BizHawk.MultiClient { if (e.Button == MouseButtons.Middle) { - Global.MainForm.TogglePause(); + GlobalWinF.MainForm.TogglePause(); } } private void TAStudio_KeyPress(object sender, KeyPressEventArgs e) { - Global.MainForm.ProcessInput(); + GlobalWinF.MainForm.ProcessInput(); } private void button1_Click(object sender, EventArgs e) diff --git a/BizHawk.MultiClient/tools/TI83/TI83KeyPad.cs b/BizHawk.MultiClient/tools/TI83/TI83KeyPad.cs index b8844c399e..e956966b50 100644 --- a/BizHawk.MultiClient/tools/TI83/TI83KeyPad.cs +++ b/BizHawk.MultiClient/tools/TI83/TI83KeyPad.cs @@ -1,7 +1,9 @@ using System; using System.Drawing; using System.Windows.Forms; + using BizHawk.Emulation.Consoles.Calculator; +using BizHawk.Client.Core; namespace BizHawk.MultiClient { @@ -93,7 +95,7 @@ namespace BizHawk.MultiClient public void Restart() { - if (!(Global.Emulator is TI83)) + if (!(GlobalWinF.Emulator is TI83)) Close(); if (!IsHandleCreated || IsDisposed) return; } @@ -122,247 +124,247 @@ namespace BizHawk.MultiClient private void button42_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("ENTER"); + GlobalWinF.ClickyVirtualPadController.Click("ENTER"); } private void button43_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("DASH"); + GlobalWinF.ClickyVirtualPadController.Click("DASH"); } private void button39_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("2"); + GlobalWinF.ClickyVirtualPadController.Click("2"); } private void ONE_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("1"); + GlobalWinF.ClickyVirtualPadController.Click("1"); } private void THREE_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("3"); + GlobalWinF.ClickyVirtualPadController.Click("3"); } private void FOUR_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("4"); + GlobalWinF.ClickyVirtualPadController.Click("4"); } private void FIVE_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("5"); + GlobalWinF.ClickyVirtualPadController.Click("5"); } private void SIX_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("6"); + GlobalWinF.ClickyVirtualPadController.Click("6"); } private void SEVEN_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("7"); + GlobalWinF.ClickyVirtualPadController.Click("7"); } private void EIGHT_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("8"); + GlobalWinF.ClickyVirtualPadController.Click("8"); } private void NINE_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("9"); + GlobalWinF.ClickyVirtualPadController.Click("9"); } private void ON_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("ON"); + GlobalWinF.ClickyVirtualPadController.Click("ON"); } private void STO_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("STO"); + GlobalWinF.ClickyVirtualPadController.Click("STO"); } private void PLUS_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("PLUS"); + GlobalWinF.ClickyVirtualPadController.Click("PLUS"); } private void LN_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("LN"); + GlobalWinF.ClickyVirtualPadController.Click("LN"); } private void MINUS_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("MINUS"); + GlobalWinF.ClickyVirtualPadController.Click("MINUS"); } private void LOG_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("LOG"); + GlobalWinF.ClickyVirtualPadController.Click("LOG"); } private void MULTIPLY_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("MULTIPLY"); + GlobalWinF.ClickyVirtualPadController.Click("MULTIPLY"); } private void button26_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("SQUARED"); + GlobalWinF.ClickyVirtualPadController.Click("SQUARED"); } private void button25_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("COMMA"); + GlobalWinF.ClickyVirtualPadController.Click("COMMA"); } private void button24_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("PARAOPEN"); + GlobalWinF.ClickyVirtualPadController.Click("PARAOPEN"); } private void button23_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("PARACLOSE"); + GlobalWinF.ClickyVirtualPadController.Click("PARACLOSE"); } private void button22_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("DIVIDE"); + GlobalWinF.ClickyVirtualPadController.Click("DIVIDE"); } private void button17_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("NEG1"); + GlobalWinF.ClickyVirtualPadController.Click("NEG1"); } private void button18_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("SIN"); + GlobalWinF.ClickyVirtualPadController.Click("SIN"); } private void button19_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("COS"); + GlobalWinF.ClickyVirtualPadController.Click("COS"); } private void button20_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("TAN"); + GlobalWinF.ClickyVirtualPadController.Click("TAN"); } private void button21_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("EXP"); + GlobalWinF.ClickyVirtualPadController.Click("EXP"); } private void button12_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("MATH"); + GlobalWinF.ClickyVirtualPadController.Click("MATH"); } private void button13_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("MATRIX"); + GlobalWinF.ClickyVirtualPadController.Click("MATRIX"); } private void button14_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("PRGM"); + GlobalWinF.ClickyVirtualPadController.Click("PRGM"); } private void button15_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("VARS"); + GlobalWinF.ClickyVirtualPadController.Click("VARS"); } private void button16_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("CLEAR"); + GlobalWinF.ClickyVirtualPadController.Click("CLEAR"); } private void button11_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("ALPHA"); + GlobalWinF.ClickyVirtualPadController.Click("ALPHA"); } private void button4_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("X"); + GlobalWinF.ClickyVirtualPadController.Click("X"); } private void button10_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("STAT"); + GlobalWinF.ClickyVirtualPadController.Click("STAT"); } private void button5_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("2ND"); + GlobalWinF.ClickyVirtualPadController.Click("2ND"); } private void button2_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("MODE"); + GlobalWinF.ClickyVirtualPadController.Click("MODE"); } private void button3_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("DEL"); + GlobalWinF.ClickyVirtualPadController.Click("DEL"); } private void button47_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("LEFT"); + GlobalWinF.ClickyVirtualPadController.Click("LEFT"); } private void button49_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("DOWN"); + GlobalWinF.ClickyVirtualPadController.Click("DOWN"); } private void button48_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("RIGHT"); + GlobalWinF.ClickyVirtualPadController.Click("RIGHT"); } private void button50_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("UP"); + GlobalWinF.ClickyVirtualPadController.Click("UP"); } private void button1_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("Y"); + GlobalWinF.ClickyVirtualPadController.Click("Y"); } private void button6_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("WINDOW"); + GlobalWinF.ClickyVirtualPadController.Click("WINDOW"); } private void button7_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("ZOOM"); + GlobalWinF.ClickyVirtualPadController.Click("ZOOM"); } private void button8_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("TRACE"); + GlobalWinF.ClickyVirtualPadController.Click("TRACE"); } private void button9_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("GRAPH"); + GlobalWinF.ClickyVirtualPadController.Click("GRAPH"); } private void PERIOD_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("DOT"); + GlobalWinF.ClickyVirtualPadController.Click("DOT"); } private void showHotkToolStripMenuItem_Click(object sender, EventArgs e) @@ -381,7 +383,7 @@ namespace BizHawk.MultiClient private void ZERO_Click(object sender, EventArgs e) { - Global.ClickyVirtualPadController.Click("0"); + GlobalWinF.ClickyVirtualPadController.Click("0"); } } } diff --git a/BizHawk.MultiClient/tools/ToolBox.cs b/BizHawk.MultiClient/tools/ToolBox.cs index 87ef09d7d7..53831b8ee1 100644 --- a/BizHawk.MultiClient/tools/ToolBox.cs +++ b/BizHawk.MultiClient/tools/ToolBox.cs @@ -1,6 +1,8 @@ using System; using System.Drawing; using System.Windows.Forms; + +using BizHawk.Client.Core; using BizHawk.Emulation.Consoles.Nintendo; using BizHawk.Emulation.Consoles.Calculator; using BizHawk.Emulation.Consoles.Nintendo.SNES; @@ -17,8 +19,8 @@ namespace BizHawk.MultiClient private void ToolBox_Load(object sender, EventArgs e) { - int x = Global.MainForm.Location.X + Global.MainForm.Size.Width; - int y = Global.MainForm.Location.Y; + int x = GlobalWinF.MainForm.Location.X + GlobalWinF.MainForm.Size.Width; + int y = GlobalWinF.MainForm.Location.Y; Location = new Point(x, y); HideShowIcons(); } @@ -30,7 +32,7 @@ namespace BizHawk.MultiClient private void HideShowIcons() { - if (Global.Emulator is NES) + if (GlobalWinF.Emulator is NES) { NESPPU.Visible = true; NESDebugger.Visible = true; @@ -45,7 +47,7 @@ namespace BizHawk.MultiClient NESNameTable.Visible = false; } - if (Global.Emulator is TI83) + if (GlobalWinF.Emulator is TI83) { KeypadTool.Visible = true; } @@ -54,7 +56,7 @@ namespace BizHawk.MultiClient KeypadTool.Visible = false; } - if (Global.Emulator is LibsnesCore) + if (GlobalWinF.Emulator is LibsnesCore) { SNESGraphicsDebuggerButton.Visible = true; SNESGameGenie.Visible = true; @@ -86,88 +88,88 @@ namespace BizHawk.MultiClient private void toolStripButton1_Click(object sender, EventArgs e) { - Global.MainForm.LoadCheatsWindow(); + GlobalWinF.MainForm.LoadCheatsWindow(); } private void toolStripButton2_Click(object sender, EventArgs e) { - Global.MainForm.LoadRamWatch(true); + GlobalWinF.MainForm.LoadRamWatch(true); } private void toolStripButton3_Click(object sender, EventArgs e) { - Global.MainForm.LoadRamSearch(); + GlobalWinF.MainForm.LoadRamSearch(); } private void HexEditor_Click(object sender, EventArgs e) { - Global.MainForm.LoadHexEditor(); + GlobalWinF.MainForm.LoadHexEditor(); } private void toolStripButton5_Click(object sender, EventArgs e) { - Global.MainForm.OpenLuaConsole(); + GlobalWinF.MainForm.OpenLuaConsole(); } private void NESPPU_Click(object sender, EventArgs e) { - Global.MainForm.LoadNESPPU(); + GlobalWinF.MainForm.LoadNESPPU(); } private void NESDebugger_Click(object sender, EventArgs e) { - Global.MainForm.LoadNESDebugger(); + GlobalWinF.MainForm.LoadNESDebugger(); } private void NESGameGenie_Click(object sender, EventArgs e) { - Global.MainForm.LoadGameGenieEC(); + GlobalWinF.MainForm.LoadGameGenieEC(); } private void NESNameTable_Click(object sender, EventArgs e) { - Global.MainForm.LoadNESNameTable(); + GlobalWinF.MainForm.LoadNESNameTable(); } private void KeyPadTool_Click(object sender, EventArgs e) { - if (Global.Emulator is TI83) + if (GlobalWinF.Emulator is TI83) { - Global.MainForm.LoadTI83KeyPad(); + GlobalWinF.MainForm.LoadTI83KeyPad(); } } private void TAStudioButton_Click(object sender, EventArgs e) { - Global.MainForm.LoadTAStudio(); + GlobalWinF.MainForm.LoadTAStudio(); } private void SNESGraphicsDebuggerButton_Click(object sender, EventArgs e) { - if (Global.Emulator is LibsnesCore) + if (GlobalWinF.Emulator is LibsnesCore) { - Global.MainForm.LoadSNESGraphicsDebugger(); + GlobalWinF.MainForm.LoadSNESGraphicsDebugger(); } } private void TAStudioButton_Click_1(object sender, EventArgs e) { - Global.MainForm.LoadVirtualPads(); + GlobalWinF.MainForm.LoadVirtualPads(); } private void SNESGameGenie_Click(object sender, EventArgs e) { - Global.MainForm.LoadGameGenieEC(); + GlobalWinF.MainForm.LoadGameGenieEC(); } private void GGGameGenie_Click(object sender, EventArgs e) { - Global.MainForm.LoadGameGenieEC(); + GlobalWinF.MainForm.LoadGameGenieEC(); } private void GBGameGenie_Click(object sender, EventArgs e) { - Global.MainForm.LoadGameGenieEC(); + GlobalWinF.MainForm.LoadGameGenieEC(); } diff --git a/BizHawk.MultiClient/tools/ToolHelpers.cs b/BizHawk.MultiClient/tools/ToolHelpers.cs index 0061f18092..2fe299aeac 100644 --- a/BizHawk.MultiClient/tools/ToolHelpers.cs +++ b/BizHawk.MultiClient/tools/ToolHelpers.cs @@ -4,6 +4,8 @@ using System.Linq; using System.Text; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { class ToolHelpers @@ -46,24 +48,24 @@ namespace BizHawk.MultiClient public static void HandleLoadError(RecentFiles recent, string path) { - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); DialogResult result = MessageBox.Show("Could not open " + path + "\nRemove from list?", "File not found", MessageBoxButtons.YesNo, MessageBoxIcon.Error); if (result == DialogResult.Yes) { recent.Remove(path); } - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); } public static ToolStripMenuItem[] GenerateMemoryDomainMenuItems(Action SetCallback, string SelectedDomain = "", int? maxSize = null) { var items = new List(); - if (Global.Emulator.MemoryDomains.Any()) + if (GlobalWinF.Emulator.MemoryDomains.Any()) { int counter = 0; - foreach (var domain in Global.Emulator.MemoryDomains) + foreach (var domain in GlobalWinF.Emulator.MemoryDomains) { string temp = domain.ToString(); var item = new ToolStripMenuItem { Text = temp }; @@ -92,9 +94,9 @@ namespace BizHawk.MultiClient public static void PopulateMemoryDomainDropdown(ref ComboBox dropdown, MemoryDomain startDomain) { dropdown.Items.Clear(); - if (Global.Emulator.MemoryDomains.Count > 0) + if (GlobalWinF.Emulator.MemoryDomains.Count > 0) { - foreach (var domain in Global.Emulator.MemoryDomains) + foreach (var domain in GlobalWinF.Emulator.MemoryDomains) { var result = dropdown.Items.Add(domain.ToString()); if (domain.Name == startDomain.Name) @@ -107,16 +109,16 @@ namespace BizHawk.MultiClient public static void UpdateCheatRelatedTools() { - Global.MainForm.RamWatch1.UpdateValues(); - Global.MainForm.HexEditor1.UpdateValues(); - Global.MainForm.Cheats_UpdateValues(); - Global.MainForm.RamSearch1.UpdateValues(); - Global.MainForm.UpdateCheatStatus(); + GlobalWinF.MainForm.RamWatch1.UpdateValues(); + GlobalWinF.MainForm.HexEditor1.UpdateValues(); + GlobalWinF.MainForm.Cheats_UpdateValues(); + GlobalWinF.MainForm.RamSearch1.UpdateValues(); + GlobalWinF.MainForm.UpdateCheatStatus(); } public static void UnfreezeAll() { - Global.CheatList.DisableAll(); + GlobalWinF.CheatList.DisableAll(); UpdateCheatRelatedTools(); } @@ -126,7 +128,7 @@ namespace BizHawk.MultiClient { if (!watch.IsSeparator) { - Global.CheatList.Add( + GlobalWinF.CheatList.Add( new Cheat(watch, watch.Value.Value, compare: null, enabled: true) ); } @@ -141,7 +143,7 @@ namespace BizHawk.MultiClient { if (!watch.IsSeparator) { - Global.CheatList.Remove(watch); + GlobalWinF.CheatList.Remove(watch); } } @@ -150,15 +152,15 @@ namespace BizHawk.MultiClient public static void ViewInHexEditor(MemoryDomain domain, IEnumerable addresses) { - Global.MainForm.LoadHexEditor(); - Global.MainForm.HexEditor1.SetDomain(domain); - Global.MainForm.HexEditor1.SetToAddresses(addresses.ToList()); + GlobalWinF.MainForm.LoadHexEditor(); + GlobalWinF.MainForm.HexEditor1.SetDomain(domain); + GlobalWinF.MainForm.HexEditor1.SetToAddresses(addresses.ToList()); } public static MemoryDomain DomainByName(string name) { //Attempts to find the memory domain by name, if it fails, it defaults to index 0 - foreach (MemoryDomain domain in Global.Emulator.MemoryDomains) + foreach (MemoryDomain domain in GlobalWinF.Emulator.MemoryDomains) { if (domain.Name == name) { @@ -166,7 +168,7 @@ namespace BizHawk.MultiClient } } - return Global.Emulator.MainMemory; + return GlobalWinF.Emulator.MainMemory; } public static void AddColumn(ListView listView, string columnName, bool enabled, int columnWidth) diff --git a/BizHawk.MultiClient/tools/TraceLogger.cs b/BizHawk.MultiClient/tools/TraceLogger.cs index 9041628845..daa83c30ff 100644 --- a/BizHawk.MultiClient/tools/TraceLogger.cs +++ b/BizHawk.MultiClient/tools/TraceLogger.cs @@ -5,6 +5,8 @@ using System.Text; using System.Windows.Forms; using System.IO; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class TraceLogger : Form @@ -29,7 +31,7 @@ namespace BizHawk.MultiClient public void SaveConfigSettings() { - Global.CoreComm.Tracer.Enabled = false; + GlobalWinF.CoreComm.Tracer.Enabled = false; Global.Config.TraceLoggerWndx = Location.X; Global.Config.TraceLoggerWndy = Location.Y; } @@ -60,7 +62,7 @@ namespace BizHawk.MultiClient ClearList(); LoggingEnabled.Checked = true; - Global.CoreComm.Tracer.Enabled = true; + GlobalWinF.CoreComm.Tracer.Enabled = true; SetTracerBoxTitle(); Restart(); } @@ -78,10 +80,10 @@ namespace BizHawk.MultiClient } else { - if (Global.Emulator.CoreComm.CpuTraceAvailable) + if (GlobalWinF.Emulator.CoreComm.CpuTraceAvailable) { ClearList(); - TraceView.Columns[0].Text = Global.Emulator.CoreComm.TraceHeader; + TraceView.Columns[0].Text = GlobalWinF.Emulator.CoreComm.TraceHeader; } else { @@ -104,7 +106,7 @@ namespace BizHawk.MultiClient private void LoggingEnabled_CheckedChanged(object sender, EventArgs e) { - Global.CoreComm.Tracer.Enabled = LoggingEnabled.Checked; + GlobalWinF.CoreComm.Tracer.Enabled = LoggingEnabled.Checked; SetTracerBoxTitle(); } @@ -130,13 +132,13 @@ namespace BizHawk.MultiClient { using (StreamWriter sw = new StreamWriter(LogFile.FullName, true)) { - sw.Write(Global.CoreComm.Tracer.TakeContents()); + sw.Write(GlobalWinF.CoreComm.Tracer.TakeContents()); } } private void LogToWindow() { - string[] instructions = Global.CoreComm.Tracer.TakeContents().Split('\n'); + string[] instructions = GlobalWinF.CoreComm.Tracer.TakeContents().Split('\n'); if (!String.IsNullOrWhiteSpace(instructions[0])) { foreach (string s in instructions) @@ -197,7 +199,7 @@ namespace BizHawk.MultiClient private void SetTracerBoxTitle() { - if (Global.CoreComm.Tracer.Enabled) + if (GlobalWinF.CoreComm.Tracer.Enabled) { if (ToFileRadio.Checked) { @@ -318,10 +320,10 @@ namespace BizHawk.MultiClient sfd.Filter = "Text Files (*.txt)|*.txt|Log Files (*.log)|*.log|All Files|*.*"; sfd.RestoreDirectory = true; - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = sfd.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result != DialogResult.OK) { return null; @@ -339,7 +341,7 @@ namespace BizHawk.MultiClient if (file != null) { DumpListToDisk(file); - Global.OSD.AddMessage("Log dumped to " + file.FullName); + GlobalWinF.OSD.AddMessage("Log dumped to " + file.FullName); } } diff --git a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadA26.cs b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadA26.cs index de0455624e..ec4879601d 100644 --- a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadA26.cs +++ b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadA26.cs @@ -144,29 +144,29 @@ namespace BizHawk.MultiClient private void Buttons_CheckedChanged(object sender, EventArgs e) { - if (Global.Emulator.SystemId != "A26" && Global.Emulator.SystemId != "C64") return; + if (GlobalWinF.Emulator.SystemId != "A26" && GlobalWinF.Emulator.SystemId != "C64") return; if (sender == PU) - Global.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked); else if (sender == PD) - Global.StickyXORAdapter.SetSticky(Controller + " Down", PD.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", PD.Checked); else if (sender == PL) - Global.StickyXORAdapter.SetSticky(Controller + " Left", PL.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Left", PL.Checked); else if (sender == PR) - Global.StickyXORAdapter.SetSticky(Controller + " Right", PR.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Right", PR.Checked); else if (sender == B1) - Global.StickyXORAdapter.SetSticky(Controller + " Button", B1.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Button", B1.Checked); } public override void Clear() { - if (Global.Emulator.SystemId != "A26" && Global.Emulator.SystemId != "C64") return; + if (GlobalWinF.Emulator.SystemId != "A26" && GlobalWinF.Emulator.SystemId != "C64") return; - if (PU.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Up", false); - if (PD.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Down", false); - if (PL.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Left", false); - if (PR.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Right", false); - if (B1.Checked) Global.StickyXORAdapter.SetSticky(Controller + " B", false); + if (PU.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", false); + if (PD.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", false); + if (PL.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Left", false); + if (PR.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Right", false); + if (B1.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " B", false); PU.Checked = false; PD.Checked = false; diff --git a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadA26Control.cs b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadA26Control.cs index ec10b6dbce..36218acf77 100644 --- a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadA26Control.cs +++ b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadA26Control.cs @@ -98,10 +98,10 @@ namespace BizHawk.MultiClient private void Buttons_CheckedChanged(object sender, EventArgs e) { - if (Global.Emulator.SystemId != "A26") return; + if (GlobalWinF.Emulator.SystemId != "A26") return; else if (sender == B1) { - Global.StickyXORAdapter.SetSticky("Reset", B1.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Reset", B1.Checked); if (B1.Checked) { B1.BackColor = Color.Pink; @@ -113,7 +113,7 @@ namespace BizHawk.MultiClient } else if (sender == B2) { - Global.StickyXORAdapter.SetSticky("Select", B2.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Select", B2.Checked); if (B2.Checked) { B2.BackColor = Color.Pink; @@ -127,10 +127,10 @@ namespace BizHawk.MultiClient public override void Clear() { - if (Global.Emulator.SystemId != "A26") return; + if (GlobalWinF.Emulator.SystemId != "A26") return; - if (B1.Checked) Global.StickyXORAdapter.SetSticky("Reset", false); - if (B2.Checked) Global.StickyXORAdapter.SetSticky("Pause", false); + if (B1.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Reset", false); + if (B2.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Pause", false); B1.Checked = false; B2.Checked = false; diff --git a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadA78.cs b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadA78.cs index 1cdaeb27b4..b469629d4a 100644 --- a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadA78.cs +++ b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadA78.cs @@ -71,47 +71,47 @@ namespace BizHawk.MultiClient private void Buttons_CheckedChanged(object sender, EventArgs e) { - if (Global.Emulator.SystemId != "A78") + if (GlobalWinF.Emulator.SystemId != "A78") { return; } else if (sender == PU) { - Global.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked); } else if (sender == PD) { - Global.StickyXORAdapter.SetSticky(Controller + " Down", PD.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", PD.Checked); } else if (sender == PL) { - Global.StickyXORAdapter.SetSticky(Controller + " Left", PL.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Left", PL.Checked); } else if (sender == PR) { - Global.StickyXORAdapter.SetSticky(Controller + " Right", PR.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Right", PR.Checked); } else if (sender == B1) { - Global.StickyXORAdapter.SetSticky(Controller + " Trigger", B1.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Trigger", B1.Checked); } else if (sender == B2) { - Global.StickyXORAdapter.SetSticky(Controller + " Trigger 2", B2.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Trigger 2", B2.Checked); } } public void Clear() { - if (Global.Emulator.SystemId != "A78") return; + if (GlobalWinF.Emulator.SystemId != "A78") return; - if (PU.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Up", false); - if (PD.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Down", false); - if (PL.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Left", false); - if (PR.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Right", false); - if (B1.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Trigger", false); - if (B2.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Trigger 2", false); + if (PU.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", false); + if (PD.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", false); + if (PL.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Left", false); + if (PR.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Right", false); + if (B1.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Trigger", false); + if (B2.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Trigger 2", false); PU.Checked = false; diff --git a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadA78Control.cs b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadA78Control.cs index 03474c0124..c558dbce6d 100644 --- a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadA78Control.cs +++ b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadA78Control.cs @@ -70,36 +70,36 @@ namespace BizHawk.MultiClient private void Buttons_CheckedChanged(object sender, EventArgs e) { - if (Global.Emulator.SystemId != "A78") + if (GlobalWinF.Emulator.SystemId != "A78") { return; } else if (sender == B1) { - Global.StickyXORAdapter.SetSticky("Power", B1.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Power", B1.Checked); } else if (sender == B2) { - Global.StickyXORAdapter.SetSticky("Reset", B2.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Reset", B2.Checked); } else if (sender == B3) { - Global.StickyXORAdapter.SetSticky("Select", B3.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Select", B3.Checked); } else if (sender == B4) { - Global.StickyXORAdapter.SetSticky("Pause", B4.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Pause", B4.Checked); } } public void Clear() { - if (Global.Emulator.SystemId != "A78") return; + if (GlobalWinF.Emulator.SystemId != "A78") return; - if (B1.Checked) Global.StickyXORAdapter.SetSticky("Power", false); - if (B2.Checked) Global.StickyXORAdapter.SetSticky("Reset", false); - if (B3.Checked) Global.StickyXORAdapter.SetSticky("Select", false); - if (B4.Checked) Global.StickyXORAdapter.SetSticky("Pause", false); + if (B1.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Power", false); + if (B2.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Reset", false); + if (B3.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Select", false); + if (B4.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Pause", false); B1.Checked = false; B2.Checked = false; diff --git a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadButton.cs b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadButton.cs index 4c57f6d612..35f6b4ffbb 100644 --- a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadButton.cs +++ b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadButton.cs @@ -45,7 +45,7 @@ namespace BizHawk.MultiClient protected void SetSticky() { - Global.StickyXORAdapter.SetSticky(ControllerButton, Checked); + GlobalWinF.StickyXORAdapter.SetSticky(ControllerButton, Checked); if (Checked == false) { @@ -55,7 +55,7 @@ namespace BizHawk.MultiClient protected void SetAutofireSticky() { - Global.AutofireStickyXORAdapter.SetSticky(ControllerButton, Checked); + GlobalWinF.AutofireStickyXORAdapter.SetSticky(ControllerButton, Checked); if (Checked == false) { @@ -92,8 +92,8 @@ namespace BizHawk.MultiClient _rightClicked = false; ForeColor = Color.Black; Checked = false; - Global.AutofireStickyXORAdapter.SetSticky(ControllerButton, false); - Global.StickyXORAdapter.SetSticky(ControllerButton, false); + GlobalWinF.AutofireStickyXORAdapter.SetSticky(ControllerButton, false); + GlobalWinF.StickyXORAdapter.SetSticky(ControllerButton, false); } } } diff --git a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadC64Keyboard.cs b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadC64Keyboard.cs index cef468a18d..3ef22ead23 100644 --- a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadC64Keyboard.cs +++ b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadC64Keyboard.cs @@ -13,401 +13,401 @@ namespace BizHawk.MultiClient private void Buttons_CheckedChanged(object sender, EventArgs e) { - if (Global.Emulator.SystemId != "C64") + if (GlobalWinF.Emulator.SystemId != "C64") { return; } else if (sender == KF1) { - Global.StickyXORAdapter.SetSticky("Key F1", KF1.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key F1", KF1.Checked); } else if (sender == KF3) { - Global.StickyXORAdapter.SetSticky("Key F3", KF3.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key F3", KF3.Checked); } else if (sender == KF5) { - Global.StickyXORAdapter.SetSticky("Key F5", KF5.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key F5", KF5.Checked); } else if (sender == KF7) { - Global.StickyXORAdapter.SetSticky("Key F7", KF7.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key F7", KF7.Checked); } else if (sender == KLeftArrow) { - Global.StickyXORAdapter.SetSticky("Key Left Arrow", KLeftArrow.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Left Arrow", KLeftArrow.Checked); } else if (sender == K1) { - Global.StickyXORAdapter.SetSticky("Key 1", K1.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key 1", K1.Checked); } else if (sender == K2) { - Global.StickyXORAdapter.SetSticky("Key 2", K2.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key 2", K2.Checked); } else if (sender == K3) { - Global.StickyXORAdapter.SetSticky("Key 3", K3.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key 3", K3.Checked); } else if (sender == K4) { - Global.StickyXORAdapter.SetSticky("Key 4", K4.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key 4", K4.Checked); } else if (sender == K5) { - Global.StickyXORAdapter.SetSticky("Key 5", K5.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key 5", K5.Checked); } else if (sender == K6) { - Global.StickyXORAdapter.SetSticky("Key 6", K6.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key 6", K6.Checked); } else if (sender == K7) { - Global.StickyXORAdapter.SetSticky("Key 7", K7.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key 7", K7.Checked); } else if (sender == K8) { - Global.StickyXORAdapter.SetSticky("Key 8", K8.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key 8", K8.Checked); } else if (sender == K9) { - Global.StickyXORAdapter.SetSticky("Key 9", K9.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key 9", K9.Checked); } else if (sender == K0) { - Global.StickyXORAdapter.SetSticky("Key 0", K0.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key 0", K0.Checked); } else if (sender == KPlus) { - Global.StickyXORAdapter.SetSticky("Key Plus", KPlus.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Plus", KPlus.Checked); } else if (sender == KMinus) { - Global.StickyXORAdapter.SetSticky("Key Minus", KMinus.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Minus", KMinus.Checked); } else if (sender == KPound) { - Global.StickyXORAdapter.SetSticky("Key Pound", KPound.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Pound", KPound.Checked); } else if (sender == KClear) { - Global.StickyXORAdapter.SetSticky("Key Clear/Home", KClear.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Clear/Home", KClear.Checked); } else if (sender == KInsert) { - Global.StickyXORAdapter.SetSticky("Key Insert/Delete", KInsert.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Insert/Delete", KInsert.Checked); } else if (sender == KCtrl) { - Global.StickyXORAdapter.SetSticky("Key Control", KCtrl.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Control", KCtrl.Checked); } else if (sender == KQ) { - Global.StickyXORAdapter.SetSticky("Key Q", KQ.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Q", KQ.Checked); } else if (sender == KW) { - Global.StickyXORAdapter.SetSticky("Key W", KW.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key W", KW.Checked); } else if (sender == KE) { - Global.StickyXORAdapter.SetSticky("Key E", KE.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key E", KE.Checked); } else if (sender == KR) { - Global.StickyXORAdapter.SetSticky("Key R", KR.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key R", KR.Checked); } else if (sender == KT) { - Global.StickyXORAdapter.SetSticky("Key T", KT.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key T", KT.Checked); } else if (sender == KY) { - Global.StickyXORAdapter.SetSticky("Key Y", KY.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Y", KY.Checked); } else if (sender == KU) { - Global.StickyXORAdapter.SetSticky("Key U", KU.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key U", KU.Checked); } else if (sender == KI) { - Global.StickyXORAdapter.SetSticky("Key I", KI.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key I", KI.Checked); } else if (sender == KO) { - Global.StickyXORAdapter.SetSticky("Key O", KO.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key O", KO.Checked); } else if (sender == KP) { - Global.StickyXORAdapter.SetSticky("Key P", KP.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key P", KP.Checked); } else if (sender == KAt) { - Global.StickyXORAdapter.SetSticky("Key At", KAt.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key At", KAt.Checked); } else if (sender == KAsterisk) { - Global.StickyXORAdapter.SetSticky("Key Asterisk", KAsterisk.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Asterisk", KAsterisk.Checked); } else if (sender == KUpArrow) { - Global.StickyXORAdapter.SetSticky("Key Up Arrow", KUpArrow.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Up Arrow", KUpArrow.Checked); } else if (sender == KRST) { - Global.StickyXORAdapter.SetSticky("Key Restore", KRST.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Restore", KRST.Checked); } else if (sender == KRun) { - Global.StickyXORAdapter.SetSticky("Key Run/Stop", KRun.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Run/Stop", KRun.Checked); } else if (sender == KLck) { - Global.StickyXORAdapter.SetSticky("Key Lck", KLck.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Lck", KLck.Checked); } else if (sender == KA) { - Global.StickyXORAdapter.SetSticky("Key A", KA.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key A", KA.Checked); } else if (sender == KS) { - Global.StickyXORAdapter.SetSticky("Key S", KS.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key S", KS.Checked); } else if (sender == KD) { - Global.StickyXORAdapter.SetSticky("Key D", KD.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key D", KD.Checked); } else if (sender == KF) { - Global.StickyXORAdapter.SetSticky("Key F", KF.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key F", KF.Checked); } else if (sender == KG) { - Global.StickyXORAdapter.SetSticky("Key G", KG.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key G", KG.Checked); } else if (sender == KH) { - Global.StickyXORAdapter.SetSticky("Key H", KH.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key H", KH.Checked); } else if (sender == KJ) { - Global.StickyXORAdapter.SetSticky("Key J", KJ.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key J", KJ.Checked); } else if (sender == KK) { - Global.StickyXORAdapter.SetSticky("Key K", KK.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key K", KK.Checked); } else if (sender == KL) { - Global.StickyXORAdapter.SetSticky("Key L", KL.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key L", KL.Checked); } else if (sender == KColon) { - Global.StickyXORAdapter.SetSticky("Key Colon", KColon.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Colon", KColon.Checked); } else if (sender == KSemicolon) { - Global.StickyXORAdapter.SetSticky("Key Semicolon", KSemicolon.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Semicolon", KSemicolon.Checked); } else if (sender == KEquals) { - Global.StickyXORAdapter.SetSticky("Key Equal", KEquals.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Equal", KEquals.Checked); } else if (sender == KReturn) { - Global.StickyXORAdapter.SetSticky("Key Return", KReturn.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Return", KReturn.Checked); } else if (sender == KCommodore) { - Global.StickyXORAdapter.SetSticky("Key Commodore", KCommodore.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Commodore", KCommodore.Checked); } else if (sender == KLeftShift) { - Global.StickyXORAdapter.SetSticky("Key Left Shift", KLeftShift.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Left Shift", KLeftShift.Checked); } else if (sender == KZ) { - Global.StickyXORAdapter.SetSticky("Key Z", KZ.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Z", KZ.Checked); } else if (sender == KX) { - Global.StickyXORAdapter.SetSticky("Key X", KX.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key X", KX.Checked); } else if (sender == KC) { - Global.StickyXORAdapter.SetSticky("Key C", KC.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key C", KC.Checked); } else if (sender == KV) { - Global.StickyXORAdapter.SetSticky("Key V", KV.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key V", KV.Checked); } else if (sender == KB) { - Global.StickyXORAdapter.SetSticky("Key B", KB.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key B", KB.Checked); } else if (sender == KN) { - Global.StickyXORAdapter.SetSticky("Key N", KN.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key N", KN.Checked); } else if (sender == KM) { - Global.StickyXORAdapter.SetSticky("Key M", KM.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key M", KM.Checked); } else if (sender == KComma) { - Global.StickyXORAdapter.SetSticky("Key Comma", KComma.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Comma", KComma.Checked); } else if (sender == KSemicolon) { - Global.StickyXORAdapter.SetSticky("Key Semicolon", KSemicolon.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Semicolon", KSemicolon.Checked); } else if (sender == KEquals) { - Global.StickyXORAdapter.SetSticky("Key Equal", KEquals.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Equal", KEquals.Checked); } else if (sender == KReturn) { - Global.StickyXORAdapter.SetSticky("Key Return", KReturn.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Return", KReturn.Checked); } else if (sender == KCommodore) { - Global.StickyXORAdapter.SetSticky("Key Commodore", KCommodore.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Commodore", KCommodore.Checked); } else if (sender == KLeftShift) { - Global.StickyXORAdapter.SetSticky("Key Left Shift", KLeftShift.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Left Shift", KLeftShift.Checked); } else if (sender == KZ) { - Global.StickyXORAdapter.SetSticky("Key Z", KZ.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Z", KZ.Checked); } else if (sender == KX) { - Global.StickyXORAdapter.SetSticky("Key X", KX.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key X", KX.Checked); } else if (sender == KC) { - Global.StickyXORAdapter.SetSticky("Key C", KC.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key C", KC.Checked); } else if (sender == KV) { - Global.StickyXORAdapter.SetSticky("Key V", KV.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key V", KV.Checked); } else if (sender == KB) { - Global.StickyXORAdapter.SetSticky("Key B", KB.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key B", KB.Checked); } else if (sender == KN) { - Global.StickyXORAdapter.SetSticky("Key N", KN.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key N", KN.Checked); } else if (sender == KM) { - Global.StickyXORAdapter.SetSticky("Key M", KM.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key M", KM.Checked); } else if (sender == KComma) { - Global.StickyXORAdapter.SetSticky("Key Comma", KComma.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Comma", KComma.Checked); } else if (sender == KPeriod) { - Global.StickyXORAdapter.SetSticky("Key Period", KPeriod.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Period", KPeriod.Checked); } else if (sender == KSlash) { - Global.StickyXORAdapter.SetSticky("Key Slash", KSlash.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Slash", KSlash.Checked); } else if (sender == KRightShift) { - Global.StickyXORAdapter.SetSticky("Key Right Shift", KRightShift.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Right Shift", KRightShift.Checked); } else if (sender == KCursorUp) { - Global.StickyXORAdapter.SetSticky("Key Cursor Up/Down", KCursorUp.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Cursor Up/Down", KCursorUp.Checked); } else if (sender == KCursorLeft) { - Global.StickyXORAdapter.SetSticky("Key Cursor Left/Right", KCursorLeft.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Cursor Left/Right", KCursorLeft.Checked); } else if (sender == KSpace) { - Global.StickyXORAdapter.SetSticky("Key Space", KSpace.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Key Space", KSpace.Checked); } } public void Clear() { - if (Global.Emulator.SystemId != "C64") + if (GlobalWinF.Emulator.SystemId != "C64") { return; } else { - if (KF1.Checked) Global.StickyXORAdapter.SetSticky("Key F1", false); - if (KF3.Checked) Global.StickyXORAdapter.SetSticky("Key F3", false); - if (KF5.Checked) Global.StickyXORAdapter.SetSticky("Key F5", false); - if (KF7.Checked) Global.StickyXORAdapter.SetSticky("Key F7", false); - if (KLeftArrow.Checked) Global.StickyXORAdapter.SetSticky("Key Left Arrow", false); - if (K1.Checked) Global.StickyXORAdapter.SetSticky("Key 1", false); - if (K2.Checked) Global.StickyXORAdapter.SetSticky("Key 2", false); - if (K3.Checked) Global.StickyXORAdapter.SetSticky("Key 3", false); - if (K4.Checked) Global.StickyXORAdapter.SetSticky("Key 4", false); - if (K5.Checked) Global.StickyXORAdapter.SetSticky("Key 5", false); - if (K6.Checked) Global.StickyXORAdapter.SetSticky("Key 6", false); - if (K7.Checked) Global.StickyXORAdapter.SetSticky("Key 7", false); - if (K8.Checked) Global.StickyXORAdapter.SetSticky("Key 8", false); - if (K9.Checked) Global.StickyXORAdapter.SetSticky("Key 9", false); - if (K0.Checked) Global.StickyXORAdapter.SetSticky("Key Plus", false); - if (KPlus.Checked) Global.StickyXORAdapter.SetSticky("Key Minus", false); - if (KMinus.Checked) Global.StickyXORAdapter.SetSticky("Key Pound", false); - if (KPound.Checked) Global.StickyXORAdapter.SetSticky("Key Clear/Home", false); - if (KClear.Checked) Global.StickyXORAdapter.SetSticky("Key Insert/Delete", false); - if (KInsert.Checked) Global.StickyXORAdapter.SetSticky("Key Control", false); - if (KCtrl.Checked) Global.StickyXORAdapter.SetSticky("Key Q", false); - if (KQ.Checked) Global.StickyXORAdapter.SetSticky("Key W", false); - if (KW.Checked) Global.StickyXORAdapter.SetSticky("Key E", false); - if (KE.Checked) Global.StickyXORAdapter.SetSticky("Key R", false); - if (KR.Checked) Global.StickyXORAdapter.SetSticky("Key T", false); - if (KT.Checked) Global.StickyXORAdapter.SetSticky("Key Y", false); - if (KY.Checked) Global.StickyXORAdapter.SetSticky("Key U", false); - if (KU.Checked) Global.StickyXORAdapter.SetSticky("Key I", false); - if (KI.Checked) Global.StickyXORAdapter.SetSticky("Key O", false); - if (KO.Checked) Global.StickyXORAdapter.SetSticky("Key P", false); - if (KP.Checked) Global.StickyXORAdapter.SetSticky("Key At", false); - if (KAt.Checked) Global.StickyXORAdapter.SetSticky("Key Asterisk", false); - if (KAsterisk.Checked) Global.StickyXORAdapter.SetSticky("Key Up Arrow", false); - if (KUpArrow.Checked) Global.StickyXORAdapter.SetSticky("Key Restore", false); - if (KRST.Checked) Global.StickyXORAdapter.SetSticky("Key Run/Stop", false); - if (KRun.Checked) Global.StickyXORAdapter.SetSticky("Key Lck", false); - if (KLck.Checked) Global.StickyXORAdapter.SetSticky("Key A", false); - if (KA.Checked) Global.StickyXORAdapter.SetSticky("Key S", false); - if (KS.Checked) Global.StickyXORAdapter.SetSticky("Key D", false); - if (KD.Checked) Global.StickyXORAdapter.SetSticky("Key F", false); - if (KF.Checked) Global.StickyXORAdapter.SetSticky("Key G", false); - if (KG.Checked) Global.StickyXORAdapter.SetSticky("Key H", false); - if (KH.Checked) Global.StickyXORAdapter.SetSticky("Key J", false); - if (KJ.Checked) Global.StickyXORAdapter.SetSticky("Key K", false); - if (KK.Checked) Global.StickyXORAdapter.SetSticky("Key L", false); - if (KL.Checked) Global.StickyXORAdapter.SetSticky("Key Colon", false); - if (KColon.Checked) Global.StickyXORAdapter.SetSticky("Key Semicolon", false); - if (KSemicolon.Checked) Global.StickyXORAdapter.SetSticky("Key Equal", false); - if (KEquals.Checked) Global.StickyXORAdapter.SetSticky("Key Return", false); - if (KReturn.Checked) Global.StickyXORAdapter.SetSticky("Key Commodore", false); - if (KCommodore.Checked) Global.StickyXORAdapter.SetSticky("Key Left Shift", false); - if (KLeftShift.Checked) Global.StickyXORAdapter.SetSticky("Key Z", false); - if (KZ.Checked) Global.StickyXORAdapter.SetSticky("Key X", false); - if (KX.Checked) Global.StickyXORAdapter.SetSticky("Key C", false); - if (KC.Checked) Global.StickyXORAdapter.SetSticky("Key V", false); - if (KV.Checked) Global.StickyXORAdapter.SetSticky("Key B", false); - if (KB.Checked) Global.StickyXORAdapter.SetSticky("Key N", false); - if (KN.Checked) Global.StickyXORAdapter.SetSticky("Key M", false); - if (KM.Checked) Global.StickyXORAdapter.SetSticky("Key Comma", false); - if (KComma.Checked) Global.StickyXORAdapter.SetSticky("Key Period", false); - if (KPeriod.Checked) Global.StickyXORAdapter.SetSticky("Key Slash", false); - if (KSlash.Checked) Global.StickyXORAdapter.SetSticky("Key Right Shift", false); - if (KRightShift.Checked) Global.StickyXORAdapter.SetSticky("Key Cursor Up/Down", false); - if (KCursorUp.Checked) Global.StickyXORAdapter.SetSticky("Key Cursor Left/Right", false); - if (KCursorLeft.Checked) Global.StickyXORAdapter.SetSticky("Key Space", false); + if (KF1.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key F1", false); + if (KF3.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key F3", false); + if (KF5.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key F5", false); + if (KF7.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key F7", false); + if (KLeftArrow.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Left Arrow", false); + if (K1.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key 1", false); + if (K2.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key 2", false); + if (K3.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key 3", false); + if (K4.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key 4", false); + if (K5.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key 5", false); + if (K6.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key 6", false); + if (K7.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key 7", false); + if (K8.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key 8", false); + if (K9.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key 9", false); + if (K0.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Plus", false); + if (KPlus.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Minus", false); + if (KMinus.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Pound", false); + if (KPound.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Clear/Home", false); + if (KClear.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Insert/Delete", false); + if (KInsert.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Control", false); + if (KCtrl.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Q", false); + if (KQ.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key W", false); + if (KW.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key E", false); + if (KE.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key R", false); + if (KR.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key T", false); + if (KT.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Y", false); + if (KY.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key U", false); + if (KU.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key I", false); + if (KI.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key O", false); + if (KO.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key P", false); + if (KP.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key At", false); + if (KAt.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Asterisk", false); + if (KAsterisk.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Up Arrow", false); + if (KUpArrow.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Restore", false); + if (KRST.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Run/Stop", false); + if (KRun.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Lck", false); + if (KLck.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key A", false); + if (KA.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key S", false); + if (KS.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key D", false); + if (KD.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key F", false); + if (KF.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key G", false); + if (KG.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key H", false); + if (KH.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key J", false); + if (KJ.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key K", false); + if (KK.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key L", false); + if (KL.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Colon", false); + if (KColon.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Semicolon", false); + if (KSemicolon.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Equal", false); + if (KEquals.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Return", false); + if (KReturn.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Commodore", false); + if (KCommodore.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Left Shift", false); + if (KLeftShift.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Z", false); + if (KZ.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key X", false); + if (KX.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key C", false); + if (KC.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key V", false); + if (KV.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key B", false); + if (KB.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key N", false); + if (KN.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key M", false); + if (KM.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Comma", false); + if (KComma.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Period", false); + if (KPeriod.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Slash", false); + if (KSlash.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Right Shift", false); + if (KRightShift.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Cursor Up/Down", false); + if (KCursorUp.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Cursor Left/Right", false); + if (KCursorLeft.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Key Space", false); KF1.Checked = false; KF3.Checked = false; diff --git a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadColeco.cs b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadColeco.cs index a7c08c3955..bf5e399572 100644 --- a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadColeco.cs +++ b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadColeco.cs @@ -105,69 +105,69 @@ namespace BizHawk.MultiClient private void Buttons_CheckedChanged(object sender, EventArgs e) { - if (Global.Emulator.SystemId != "Coleco") return; + if (GlobalWinF.Emulator.SystemId != "Coleco") return; if (sender == PU) - Global.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked); else if (sender == PD) - Global.StickyXORAdapter.SetSticky(Controller + " Down", PD.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", PD.Checked); else if (sender == PL) - Global.StickyXORAdapter.SetSticky(Controller + " Left", PL.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Left", PL.Checked); else if (sender == PR) - Global.StickyXORAdapter.SetSticky(Controller + " Right", PR.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Right", PR.Checked); else if (sender == KeyLeft) - Global.StickyXORAdapter.SetSticky(Controller + " L", KeyLeft.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " L", KeyLeft.Checked); else if (sender == KeyRight) - Global.StickyXORAdapter.SetSticky(Controller + " R", KeyRight.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " R", KeyRight.Checked); else if (sender == KP1) - Global.StickyXORAdapter.SetSticky(Controller + " Key1", KP1.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Key1", KP1.Checked); else if (sender == KP2) - Global.StickyXORAdapter.SetSticky(Controller + " Key2", KP2.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Key2", KP2.Checked); else if (sender == KP3) - Global.StickyXORAdapter.SetSticky(Controller + " Key3", KP3.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Key3", KP3.Checked); else if (sender == KP4) - Global.StickyXORAdapter.SetSticky(Controller + " Key4", KP4.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Key4", KP4.Checked); else if (sender == KP5) - Global.StickyXORAdapter.SetSticky(Controller + " Key5", KP5.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Key5", KP5.Checked); else if (sender == KP6) - Global.StickyXORAdapter.SetSticky(Controller + " Key6", KP6.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Key6", KP6.Checked); else if (sender == KP7) - Global.StickyXORAdapter.SetSticky(Controller + " Key7", KP7.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Key7", KP7.Checked); else if (sender == KP8) - Global.StickyXORAdapter.SetSticky(Controller + " Key8", KP8.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Key8", KP8.Checked); else if (sender == KP9) - Global.StickyXORAdapter.SetSticky(Controller + " Key9", KP9.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Key9", KP9.Checked); else if (sender == KPStar) - Global.StickyXORAdapter.SetSticky(Controller + " Star", KPStar.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Star", KPStar.Checked); else if (sender == KP0) - Global.StickyXORAdapter.SetSticky(Controller + " Key0", KP0.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Key0", KP0.Checked); else if (sender == KPPound) - Global.StickyXORAdapter.SetSticky(Controller + " Pound", KPPound.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Pound", KPPound.Checked); } public void Clear() { - if (Global.Emulator.SystemId != "Coleco") return; + if (GlobalWinF.Emulator.SystemId != "Coleco") return; - if (PU.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Up", false); - if (PD.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Down", false); - if (PL.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Left", false); - if (PR.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Right", false); - if (KeyLeft.Checked) Global.StickyXORAdapter.SetSticky(Controller + " L", false); - if (KeyRight.Checked) Global.StickyXORAdapter.SetSticky(Controller + " R", false); - if (KP1.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Key0", false); - if (KP2.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Key1", false); - if (KP3.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Key2", false); - if (KP4.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Key3", false); - if (KP5.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Key4", false); - if (KP6.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Key5", false); - if (KP7.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Key6", false); - if (KP8.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Key7", false); - if (KP9.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Key8", false); - if (KPStar.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Key9", false); - if (KP0.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Star", false); - if (KPPound.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Pound", false); + if (PU.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", false); + if (PD.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", false); + if (PL.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Left", false); + if (PR.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Right", false); + if (KeyLeft.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " L", false); + if (KeyRight.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " R", false); + if (KP1.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Key0", false); + if (KP2.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Key1", false); + if (KP3.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Key2", false); + if (KP4.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Key3", false); + if (KP5.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Key4", false); + if (KP6.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Key5", false); + if (KP7.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Key6", false); + if (KP8.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Key7", false); + if (KP9.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Key8", false); + if (KPStar.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Key9", false); + if (KP0.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Star", false); + if (KPPound.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Pound", false); PU.Checked = false; PD.Checked = false; diff --git a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadForm.cs b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadForm.cs index d69442b706..482880104e 100644 --- a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadForm.cs +++ b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadForm.cs @@ -2,7 +2,9 @@ using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; + using BizHawk.Emulation.Consoles.Nintendo.N64; +using BizHawk.Client.Core; namespace BizHawk.MultiClient { @@ -55,7 +57,7 @@ namespace BizHawk.MultiClient private void LoadPads() { - switch (Global.Emulator.SystemId) + switch (GlobalWinF.Emulator.SystemId) { case "A26": VirtualPadA26 ataripad1 = new VirtualPadA26 {Location = new Point(8, 19), Controller = "P1"}; @@ -206,7 +208,7 @@ namespace BizHawk.MultiClient } //Hack for now - if (Global.Emulator.SystemId == "C64") + if (GlobalWinF.Emulator.SystemId == "C64") { if (Width < 505) { @@ -224,8 +226,8 @@ namespace BizHawk.MultiClient protected override void OnClosed(EventArgs e) { //is this a good idea? - Global.StickyXORAdapter.ClearStickies(); - Global.StickyXORAdapter.ClearStickyFloats(); + GlobalWinF.StickyXORAdapter.ClearStickies(); + GlobalWinF.StickyXORAdapter.ClearStickyFloats(); } public void ClearVirtualPadHolds() @@ -252,12 +254,12 @@ namespace BizHawk.MultiClient { if (!IsHandleCreated || IsDisposed) return; - if (Global.MovieSession.Movie.IsPlaying && !Global.MovieSession.Movie.IsFinished) + if (GlobalWinF.MovieSession.Movie.IsPlaying && !GlobalWinF.MovieSession.Movie.IsFinished) { - string str = Global.MovieSession.Movie.GetInput(Global.Emulator.Frame); + string str = GlobalWinF.MovieSession.Movie.GetInput(GlobalWinF.Emulator.Frame); if (Global.Config.TASUpdatePads && str != "") { - switch (Global.Emulator.SystemId) + switch (GlobalWinF.Emulator.SystemId) { case "NES": Pads[0].SetButtons(str.Substring(3, 8)); @@ -370,7 +372,7 @@ namespace BizHawk.MultiClient public void BumpAnalogValue(int? dx, int? dy) { //TODO: make an analog flag in virtualpads that have it, and check the virtualpads loaded, instead of doing this hardcoded - if (Global.Emulator is N64) + if (GlobalWinF.Emulator is N64) { (Pads[0] as VirtualPadN64).FudgeAnalog(dx, dy); diff --git a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadGB.cs b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadGB.cs index e06bfdd701..bcfd9dfa83 100644 --- a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadGB.cs +++ b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadGB.cs @@ -195,57 +195,57 @@ namespace BizHawk.MultiClient private void Buttons_CheckedChanged(object sender, EventArgs e) { - if (Global.Emulator.SystemId != "GB") + if (GlobalWinF.Emulator.SystemId != "GB") { return; } else if (sender == PU) { - Global.StickyXORAdapter.SetSticky("Up", PU.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Up", PU.Checked); } else if (sender == PD) { - Global.StickyXORAdapter.SetSticky("Down", PD.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Down", PD.Checked); } else if (sender == PL) { - Global.StickyXORAdapter.SetSticky("Left", PL.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Left", PL.Checked); } else if (sender == PR) { - Global.StickyXORAdapter.SetSticky("Right", PR.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Right", PR.Checked); } else if (sender == B1) { - Global.StickyXORAdapter.SetSticky("Select", B1.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Select", B1.Checked); } else if (sender == B2) { - Global.StickyXORAdapter.SetSticky("Start", B2.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Start", B2.Checked); } else if (sender == B3) { - Global.StickyXORAdapter.SetSticky("B", B3.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("B", B3.Checked); } else if (sender == B4) { - Global.StickyXORAdapter.SetSticky("A", B4.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("A", B4.Checked); } } public override void Clear() { - if (Global.Emulator.SystemId != "GB") return; + if (GlobalWinF.Emulator.SystemId != "GB") return; - if (PU.Checked) Global.StickyXORAdapter.SetSticky("Up", false); - if (PD.Checked) Global.StickyXORAdapter.SetSticky("Down", false); - if (PL.Checked) Global.StickyXORAdapter.SetSticky("Left", false); - if (PR.Checked) Global.StickyXORAdapter.SetSticky("Right", false); - if (B1.Checked) Global.StickyXORAdapter.SetSticky("Select", false); - if (B2.Checked) Global.StickyXORAdapter.SetSticky("Start", false); - if (B3.Checked) Global.StickyXORAdapter.SetSticky("B", false); - if (B4.Checked) Global.StickyXORAdapter.SetSticky("A", false); + if (PU.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Up", false); + if (PD.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Down", false); + if (PL.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Left", false); + if (PR.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Right", false); + if (B1.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Select", false); + if (B2.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Start", false); + if (B3.Checked) GlobalWinF.StickyXORAdapter.SetSticky("B", false); + if (B4.Checked) GlobalWinF.StickyXORAdapter.SetSticky("A", false); PU.Checked = false; PD.Checked = false; diff --git a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadGBA.cs b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadGBA.cs index 85f879f876..2974da02af 100644 --- a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadGBA.cs +++ b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadGBA.cs @@ -227,43 +227,43 @@ namespace BizHawk.MultiClient private void Buttons_CheckedChanged(object sender, EventArgs e) { - if (Global.Emulator.SystemId != "GBA") return; + if (GlobalWinF.Emulator.SystemId != "GBA") return; if (sender == PU) - Global.StickyXORAdapter.SetSticky("Up", PU.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Up", PU.Checked); else if (sender == PD) - Global.StickyXORAdapter.SetSticky("Down", PD.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Down", PD.Checked); else if (sender == PL) - Global.StickyXORAdapter.SetSticky("Left", PL.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Left", PL.Checked); else if (sender == PR) - Global.StickyXORAdapter.SetSticky("Right", PR.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Right", PR.Checked); else if (sender == B1) - Global.StickyXORAdapter.SetSticky("Select", B1.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Select", B1.Checked); else if (sender == B2) - Global.StickyXORAdapter.SetSticky("Start", B2.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Start", B2.Checked); else if (sender == B3) - Global.StickyXORAdapter.SetSticky("B", B3.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("B", B3.Checked); else if (sender == B4) - Global.StickyXORAdapter.SetSticky("A", B4.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("A", B4.Checked); else if (sender == B5) - Global.StickyXORAdapter.SetSticky("L", B5.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("L", B5.Checked); else if (sender == B6) - Global.StickyXORAdapter.SetSticky("R", B6.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("R", B6.Checked); } public override void Clear() { - if (Global.Emulator.SystemId != "GBA") return; + if (GlobalWinF.Emulator.SystemId != "GBA") return; - if (PU.Checked) Global.StickyXORAdapter.SetSticky("Up", false); - if (PD.Checked) Global.StickyXORAdapter.SetSticky("Down", false); - if (PL.Checked) Global.StickyXORAdapter.SetSticky("Left", false); - if (PR.Checked) Global.StickyXORAdapter.SetSticky("Right", false); - if (B1.Checked) Global.StickyXORAdapter.SetSticky("Select", false); - if (B2.Checked) Global.StickyXORAdapter.SetSticky("Start", false); - if (B3.Checked) Global.StickyXORAdapter.SetSticky("B", false); - if (B4.Checked) Global.StickyXORAdapter.SetSticky("A", false); - if (B5.Checked) Global.StickyXORAdapter.SetSticky("L", false); - if (B6.Checked) Global.StickyXORAdapter.SetSticky("R", false); + if (PU.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Up", false); + if (PD.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Down", false); + if (PL.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Left", false); + if (PR.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Right", false); + if (B1.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Select", false); + if (B2.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Start", false); + if (B3.Checked) GlobalWinF.StickyXORAdapter.SetSticky("B", false); + if (B4.Checked) GlobalWinF.StickyXORAdapter.SetSticky("A", false); + if (B5.Checked) GlobalWinF.StickyXORAdapter.SetSticky("L", false); + if (B6.Checked) GlobalWinF.StickyXORAdapter.SetSticky("R", false); PU.Checked = false; PD.Checked = false; diff --git a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadGBControl.cs b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadGBControl.cs index 334ff952cc..78d99796b8 100644 --- a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadGBControl.cs +++ b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadGBControl.cs @@ -87,13 +87,13 @@ namespace BizHawk.MultiClient private void Buttons_CheckedChanged(object sender, EventArgs e) { - if (Global.Emulator.SystemId != "GB") + if (GlobalWinF.Emulator.SystemId != "GB") { return; } else if (sender == B1) { - Global.StickyXORAdapter.SetSticky("Power", B1.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Power", B1.Checked); if (B1.Checked) { B1.BackColor = Color.Pink; @@ -107,12 +107,12 @@ namespace BizHawk.MultiClient public override void Clear() { - if (Global.Emulator.SystemId != "GB") + if (GlobalWinF.Emulator.SystemId != "GB") { return; } - if (B1.Checked) Global.StickyXORAdapter.SetSticky("Power", false); + if (B1.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Power", false); B1.Checked = false; } diff --git a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadGen3Button.cs b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadGen3Button.cs index 35be775bfe..78795d2406 100644 --- a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadGen3Button.cs +++ b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadGen3Button.cs @@ -191,37 +191,37 @@ namespace BizHawk.MultiClient private void Buttons_CheckedChanged(object sender, EventArgs e) { - if (Global.Emulator.SystemId != "GEN") return; + if (GlobalWinF.Emulator.SystemId != "GEN") return; if (sender == PU) - Global.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked); else if (sender == PD) - Global.StickyXORAdapter.SetSticky(Controller + " Down", PD.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", PD.Checked); else if (sender == PL) - Global.StickyXORAdapter.SetSticky(Controller + " Left", PL.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Left", PL.Checked); else if (sender == PR) - Global.StickyXORAdapter.SetSticky(Controller + " Right", PR.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Right", PR.Checked); else if (sender == B1) - Global.StickyXORAdapter.SetSticky(Controller + " C", B1.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " C", B1.Checked); else if (sender == B2) - Global.StickyXORAdapter.SetSticky(Controller + " Start", B2.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Start", B2.Checked); else if (sender == B3) - Global.StickyXORAdapter.SetSticky(Controller + " B", B3.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " B", B3.Checked); else if (sender == B4) - Global.StickyXORAdapter.SetSticky(Controller + " A", B4.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " A", B4.Checked); } public override void Clear() { - if (Global.Emulator.SystemId != "GEN") return; + if (GlobalWinF.Emulator.SystemId != "GEN") return; - if (PU.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Up", false); - if (PD.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Down", false); - if (PL.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Left", false); - if (PR.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Right", false); - if (B1.Checked) Global.StickyXORAdapter.SetSticky(Controller + " C", false); - if (B2.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Start", false); - if (B3.Checked) Global.StickyXORAdapter.SetSticky(Controller + " B", false); - if (B4.Checked) Global.StickyXORAdapter.SetSticky(Controller + " A", false); + if (PU.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", false); + if (PD.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", false); + if (PL.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Left", false); + if (PR.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Right", false); + if (B1.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " C", false); + if (B2.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Start", false); + if (B3.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " B", false); + if (B4.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " A", false); PU.Checked = false; PD.Checked = false; diff --git a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadN64.cs b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadN64.cs index e3a617d588..27ca3384da 100644 --- a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadN64.cs +++ b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadN64.cs @@ -4,6 +4,8 @@ using System.Windows.Forms; using System.Collections.Generic; using System.Linq; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class VirtualPadN64 : UserControl, IVirtualPad @@ -72,7 +74,7 @@ namespace BizHawk.MultiClient public void Clear() { - if (Global.Emulator.SystemId != "N64") return; + if (GlobalWinF.Emulator.SystemId != "N64") return; foreach (var button in Buttons) { @@ -165,8 +167,8 @@ namespace BizHawk.MultiClient { int? x = hasValue ? X : (int?)null; int? y = hasValue ? Y : (int?)null; - Global.StickyXORAdapter.SetFloat(Controller + " X Axis", x); - Global.StickyXORAdapter.SetFloat(Controller + " Y Axis", y); + GlobalWinF.StickyXORAdapter.SetFloat(Controller + " X Axis", x); + GlobalWinF.StickyXORAdapter.SetFloat(Controller + " Y Axis", y); AnalogControl1.X = X; AnalogControl1.Y = Y; diff --git a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadN64Control.cs b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadN64Control.cs index aae6868bac..533f41596b 100644 --- a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadN64Control.cs +++ b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadN64Control.cs @@ -110,13 +110,13 @@ namespace BizHawk.MultiClient private void Buttons_CheckedChanged(object sender, EventArgs e) { - if (Global.Emulator.SystemId != "N64") + if (GlobalWinF.Emulator.SystemId != "N64") { return; } else if (sender == B1) { - Global.StickyXORAdapter.SetSticky("Power", B1.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Power", B1.Checked); if (B1.Checked) B1.BackColor = Color.Pink; else @@ -124,7 +124,7 @@ namespace BizHawk.MultiClient } else if (sender == B2) { - Global.StickyXORAdapter.SetSticky("Reset", B2.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Reset", B2.Checked); if (B2.Checked) B2.BackColor = Color.Pink; else @@ -134,12 +134,12 @@ namespace BizHawk.MultiClient public override void Clear() { - if (Global.Emulator.SystemId != "N64") return; + if (GlobalWinF.Emulator.SystemId != "N64") return; B1.Checked = false; B2.Checked = false; - Global.StickyXORAdapter.SetSticky("Reset", false); + GlobalWinF.StickyXORAdapter.SetSticky("Reset", false); } } } diff --git a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadNES.cs b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadNES.cs index e08dbde346..8dea070009 100644 --- a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadNES.cs +++ b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadNES.cs @@ -194,37 +194,37 @@ namespace BizHawk.MultiClient private void Buttons_CheckedChanged(object sender, EventArgs e) { - if (Global.Emulator.SystemId != "NES") return; + if (GlobalWinF.Emulator.SystemId != "NES") return; if (sender == PU) - Global.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked); else if (sender == PD) - Global.StickyXORAdapter.SetSticky(Controller + " Down", PD.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", PD.Checked); else if (sender == PL) - Global.StickyXORAdapter.SetSticky(Controller + " Left", PL.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Left", PL.Checked); else if (sender == PR) - Global.StickyXORAdapter.SetSticky(Controller + " Right", PR.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Right", PR.Checked); else if (sender == B1) - Global.StickyXORAdapter.SetSticky(Controller + " Select", B1.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Select", B1.Checked); else if (sender == B2) - Global.StickyXORAdapter.SetSticky(Controller + " Start", B2.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Start", B2.Checked); else if (sender == B3) - Global.StickyXORAdapter.SetSticky(Controller + " B", B3.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " B", B3.Checked); else if (sender == B4) - Global.StickyXORAdapter.SetSticky(Controller + " A", B4.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " A", B4.Checked); } public override void Clear() { - if (Global.Emulator.SystemId != "NES") return; + if (GlobalWinF.Emulator.SystemId != "NES") return; - if (PU.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Up", false); - if (PD.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Down", false); - if (PL.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Left", false); - if (PR.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Right", false); - if (B1.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Select", false); - if (B2.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Start", false); - if (B3.Checked) Global.StickyXORAdapter.SetSticky(Controller + " B", false); - if (B4.Checked) Global.StickyXORAdapter.SetSticky(Controller + " A", false); + if (PU.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", false); + if (PD.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", false); + if (PL.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Left", false); + if (PR.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Right", false); + if (B1.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Select", false); + if (B2.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Start", false); + if (B3.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " B", false); + if (B4.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " A", false); PU.Checked = false; PD.Checked = false; diff --git a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadNESControl.cs b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadNESControl.cs index 9bab96025e..7ba78c4440 100644 --- a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadNESControl.cs +++ b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadNESControl.cs @@ -110,13 +110,13 @@ namespace BizHawk.MultiClient private void Buttons_CheckedChanged(object sender, EventArgs e) { - if (Global.Emulator.SystemId != "NES") + if (GlobalWinF.Emulator.SystemId != "NES") { return; } else if (sender == B1) { - Global.StickyXORAdapter.SetSticky("Power", B1.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Power", B1.Checked); if (B1.Checked) B1.BackColor = Color.Pink; else @@ -124,7 +124,7 @@ namespace BizHawk.MultiClient } else if (sender == B2) { - Global.StickyXORAdapter.SetSticky("Reset", B2.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Reset", B2.Checked); if (B2.Checked) B2.BackColor = Color.Pink; else @@ -134,12 +134,12 @@ namespace BizHawk.MultiClient public override void Clear() { - if (Global.Emulator.SystemId != "NES") return; + if (GlobalWinF.Emulator.SystemId != "NES") return; B1.Checked = false; B2.Checked = false; - Global.StickyXORAdapter.SetSticky("Reset", false); + GlobalWinF.StickyXORAdapter.SetSticky("Reset", false); } } } diff --git a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadPCE.cs b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadPCE.cs index 02f2e8a2f8..85963a1cbb 100644 --- a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadPCE.cs +++ b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadPCE.cs @@ -194,37 +194,37 @@ namespace BizHawk.MultiClient private void Buttons_CheckedChanged(object sender, EventArgs e) { - if (Global.Emulator.SystemId != "PCE") return; + if (GlobalWinF.Emulator.SystemId != "PCE") return; if (sender == PU) - Global.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked); else if (sender == PD) - Global.StickyXORAdapter.SetSticky(Controller + " Down", PD.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", PD.Checked); else if (sender == PL) - Global.StickyXORAdapter.SetSticky(Controller + " Left", PL.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Left", PL.Checked); else if (sender == PR) - Global.StickyXORAdapter.SetSticky(Controller + " Right", PR.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Right", PR.Checked); else if (sender == B1) - Global.StickyXORAdapter.SetSticky(Controller + " Select", B1.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Select", B1.Checked); else if (sender == B2) - Global.StickyXORAdapter.SetSticky(Controller + " Run", B2.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Run", B2.Checked); else if (sender == B3) - Global.StickyXORAdapter.SetSticky(Controller + " B2", B3.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " B2", B3.Checked); else if (sender == B4) - Global.StickyXORAdapter.SetSticky(Controller + " B1", B4.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " B1", B4.Checked); } public override void Clear() { - if (Global.Emulator.SystemId != "PCE" && Global.Emulator.SystemId != "PCECD" && Global.Emulator.SystemId != "SGX") return; + if (GlobalWinF.Emulator.SystemId != "PCE" && GlobalWinF.Emulator.SystemId != "PCECD" && GlobalWinF.Emulator.SystemId != "SGX") return; - if (PU.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Up", false); - if (PD.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Down", false); - if (PL.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Left", false); - if (PR.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Right", false); - if (B1.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Select", false); - if (B2.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Run", false); - if (B3.Checked) Global.StickyXORAdapter.SetSticky(Controller + " B2", false); - if (B4.Checked) Global.StickyXORAdapter.SetSticky(Controller + " B1", false); + if (PU.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", false); + if (PD.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", false); + if (PL.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Left", false); + if (PR.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Right", false); + if (B1.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Select", false); + if (B2.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Run", false); + if (B3.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " B2", false); + if (B4.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " B1", false); PU.Checked = false; PD.Checked = false; diff --git a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSMS.cs b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSMS.cs index ef49fe0b0e..598f026cdc 100644 --- a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSMS.cs +++ b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSMS.cs @@ -164,32 +164,32 @@ namespace BizHawk.MultiClient private void Buttons_CheckedChanged(object sender, EventArgs e) { - if (Global.Emulator.SystemId != "SMS" && Global.Emulator.SystemId != "GG" && Global.Emulator.SystemId != "SG") return; + if (GlobalWinF.Emulator.SystemId != "SMS" && GlobalWinF.Emulator.SystemId != "GG" && GlobalWinF.Emulator.SystemId != "SG") return; if (sender == PU) - Global.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked); else if (sender == PD) - Global.StickyXORAdapter.SetSticky(Controller + " Down", PD.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", PD.Checked); else if (sender == PL) - Global.StickyXORAdapter.SetSticky(Controller + " Left", PL.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Left", PL.Checked); else if (sender == PR) - Global.StickyXORAdapter.SetSticky(Controller + " Right", PR.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Right", PR.Checked); else if (sender == B1) - Global.StickyXORAdapter.SetSticky(Controller + " B1", B1.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " B1", B1.Checked); else if (sender == B2) - Global.StickyXORAdapter.SetSticky(Controller + " B2", B2.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " B2", B2.Checked); } public override void Clear() { - if (Global.Emulator.SystemId != "SMS" && Global.Emulator.SystemId != "GG" && Global.Emulator.SystemId != "SG") return; + if (GlobalWinF.Emulator.SystemId != "SMS" && GlobalWinF.Emulator.SystemId != "GG" && GlobalWinF.Emulator.SystemId != "SG") return; - if (PU.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Up", false); - if (PD.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Down", false); - if (PL.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Left", false); - if (PR.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Right", false); - if (B1.Checked) Global.StickyXORAdapter.SetSticky(Controller + " B1", false); - if (B2.Checked) Global.StickyXORAdapter.SetSticky(Controller + " B2", false); + if (PU.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", false); + if (PD.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", false); + if (PL.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Left", false); + if (PR.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Right", false); + if (B1.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " B1", false); + if (B2.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " B2", false); PU.Checked = false; PD.Checked = false; diff --git a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSMSControl.cs b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSMSControl.cs index b3fb55a9f5..4a21d152dc 100644 --- a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSMSControl.cs +++ b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSMSControl.cs @@ -98,11 +98,11 @@ namespace BizHawk.MultiClient private void Buttons_CheckedChanged(object sender, EventArgs e) { - if (Global.Emulator.SystemId != "SMS" && Global.Emulator.SystemId != "GG" && Global.Emulator.SystemId != "SG") return; + if (GlobalWinF.Emulator.SystemId != "SMS" && GlobalWinF.Emulator.SystemId != "GG" && GlobalWinF.Emulator.SystemId != "SG") return; else if (sender == B1) { - Global.StickyXORAdapter.SetSticky("Pause", B1.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Pause", B1.Checked); if (B1.Checked) B1.BackColor = Color.Pink; else @@ -110,7 +110,7 @@ namespace BizHawk.MultiClient } else if (sender == B2) { - Global.StickyXORAdapter.SetSticky("Reset", B2.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Reset", B2.Checked); if (B2.Checked) B2.BackColor = Color.Pink; else @@ -120,10 +120,10 @@ namespace BizHawk.MultiClient public override void Clear() { - if (Global.Emulator.SystemId != "SMS" && Global.Emulator.SystemId != "GG" && Global.Emulator.SystemId != "SG") return; + if (GlobalWinF.Emulator.SystemId != "SMS" && GlobalWinF.Emulator.SystemId != "GG" && GlobalWinF.Emulator.SystemId != "SG") return; - if (B1.Checked) Global.StickyXORAdapter.SetSticky("Pause", false); - if (B2.Checked) Global.StickyXORAdapter.SetSticky("Reset", false); + if (B1.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Pause", false); + if (B2.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Reset", false); B1.Checked = false; B2.Checked = false; diff --git a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSNES.cs b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSNES.cs index 910fbf72df..096302d70f 100644 --- a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSNES.cs +++ b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSNES.cs @@ -259,81 +259,81 @@ namespace BizHawk.MultiClient private void Buttons_CheckedChanged(object sender, EventArgs e) { - if (Global.Emulator.SystemId != "SNES") + if (GlobalWinF.Emulator.SystemId != "SNES") { return; } else if (sender == PU) { - Global.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked); } else if (sender == PD) { - Global.StickyXORAdapter.SetSticky(Controller + " Down", PD.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", PD.Checked); } else if (sender == PL) { - Global.StickyXORAdapter.SetSticky(Controller + " Left", PL.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Left", PL.Checked); } else if (sender == PR) { - Global.StickyXORAdapter.SetSticky(Controller + " Right", PR.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Right", PR.Checked); } else if (sender == B1) { - Global.StickyXORAdapter.SetSticky(Controller + " Select", B1.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Select", B1.Checked); } else if (sender == B2) { - Global.StickyXORAdapter.SetSticky(Controller + " Start", B2.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Start", B2.Checked); } else if (sender == B3) { - Global.StickyXORAdapter.SetSticky(Controller + " B", B3.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " B", B3.Checked); } else if (sender == B4) { - Global.StickyXORAdapter.SetSticky(Controller + " A", B4.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " A", B4.Checked); } else if (sender == B5) { - Global.StickyXORAdapter.SetSticky(Controller + " X", B5.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " X", B5.Checked); } else if (sender == B6) { - Global.StickyXORAdapter.SetSticky(Controller + " Y", B6.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Y", B6.Checked); } else if (sender == B7) { - Global.StickyXORAdapter.SetSticky(Controller + " L", B7.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " L", B7.Checked); } else if (sender == B8) { - Global.StickyXORAdapter.SetSticky(Controller + " R", B8.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " R", B8.Checked); } } public override void Clear() { - if (Global.Emulator.SystemId != "SNES") + if (GlobalWinF.Emulator.SystemId != "SNES") { return; } else { - if (PU.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Up", false); - if (PD.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Down", false); - if (PL.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Left", false); - if (PR.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Right", false); - if (B1.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Select", false); - if (B2.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Start", false); - if (B3.Checked) Global.StickyXORAdapter.SetSticky(Controller + " B", false); - if (B4.Checked) Global.StickyXORAdapter.SetSticky(Controller + " A", false); - if (B5.Checked) Global.StickyXORAdapter.SetSticky(Controller + " X", false); - if (B6.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Y", false); - if (B7.Checked) Global.StickyXORAdapter.SetSticky(Controller + " L", false); - if (B8.Checked) Global.StickyXORAdapter.SetSticky(Controller + " R", false); + if (PU.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", false); + if (PD.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", false); + if (PL.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Left", false); + if (PR.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Right", false); + if (B1.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Select", false); + if (B2.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Start", false); + if (B3.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " B", false); + if (B4.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " A", false); + if (B5.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " X", false); + if (B6.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Y", false); + if (B7.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " L", false); + if (B8.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " R", false); PU.Checked = false; PD.Checked = false; diff --git a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSNESControl.cs b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSNESControl.cs index 94ce4bd05c..f3c1a5546f 100644 --- a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSNESControl.cs +++ b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSNESControl.cs @@ -120,13 +120,13 @@ namespace BizHawk.MultiClient private void Buttons_CheckedChanged(object sender, EventArgs e) { - if (Global.Emulator.SystemId != "SNES") + if (GlobalWinF.Emulator.SystemId != "SNES") { return; } else if (sender == B1) { - Global.StickyXORAdapter.SetSticky("Power", B1.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Power", B1.Checked); if (B1.Checked) { B1.BackColor = Color.Pink; @@ -138,7 +138,7 @@ namespace BizHawk.MultiClient } else if (sender == B2) { - Global.StickyXORAdapter.SetSticky("Reset", B2.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Reset", B2.Checked); if (B2.Checked) { B2.BackColor = Color.Pink; @@ -152,14 +152,14 @@ namespace BizHawk.MultiClient public override void Clear() { - if (Global.Emulator.SystemId != "SNES") + if (GlobalWinF.Emulator.SystemId != "SNES") { return; } else { - if (B1.Checked) Global.StickyXORAdapter.SetSticky("Reset", false); - if (B2.Checked) Global.StickyXORAdapter.SetSticky("Power", false); + if (B1.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Reset", false); + if (B2.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Power", false); B1.Checked = false; B2.Checked = false; diff --git a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSaturn.cs b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSaturn.cs index 999ef7fe6e..6d75525189 100644 --- a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSaturn.cs +++ b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSaturn.cs @@ -79,25 +79,25 @@ namespace BizHawk.MultiClient public void Clear() { - if (Global.Emulator.SystemId != "SAT") return; + if (GlobalWinF.Emulator.SystemId != "SAT") return; - if (PU.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Up", false); - if (PD.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Down", false); - if (PL.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Left", false); - if (PR.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Right", false); + if (PU.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", false); + if (PD.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", false); + if (PL.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Left", false); + if (PR.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Right", false); - if (BStart.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Start", false); + if (BStart.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Start", false); - if (BX.Checked) Global.StickyXORAdapter.SetSticky(Controller + " X", false); - if (BY.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Y", false); - if (BZ.Checked) Global.StickyXORAdapter.SetSticky(Controller + " Z", false); + if (BX.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " X", false); + if (BY.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Y", false); + if (BZ.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Z", false); - if (BA.Checked) Global.StickyXORAdapter.SetSticky(Controller + " A", false); - if (BB.Checked) Global.StickyXORAdapter.SetSticky(Controller + " B", false); - if (BC.Checked) Global.StickyXORAdapter.SetSticky(Controller + " C", false); + if (BA.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " A", false); + if (BB.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " B", false); + if (BC.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " C", false); - if (BL.Checked) Global.StickyXORAdapter.SetSticky(Controller + " L", false); - if (BR.Checked) Global.StickyXORAdapter.SetSticky(Controller + " R", false); + if (BL.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " L", false); + if (BR.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " R", false); PU.Checked = false; PD.Checked = false; @@ -137,61 +137,61 @@ namespace BizHawk.MultiClient private void Buttons_CheckedChanged(object sender, EventArgs e) { - if (Global.Emulator.SystemId != "SAT") + if (GlobalWinF.Emulator.SystemId != "SAT") { return; } else if (sender == PU) { - Global.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked); } else if (sender == PD) { - Global.StickyXORAdapter.SetSticky(Controller + " Down", PD.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", PD.Checked); } else if (sender == PL) { - Global.StickyXORAdapter.SetSticky(Controller + " Left", PL.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Left", PL.Checked); } else if (sender == PR) { - Global.StickyXORAdapter.SetSticky(Controller + " Right", PR.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Right", PR.Checked); } else if (sender == BStart) { - Global.StickyXORAdapter.SetSticky(Controller + " Start", BStart.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Start", BStart.Checked); } else if (sender == BX) { - Global.StickyXORAdapter.SetSticky(Controller + " X", BX.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " X", BX.Checked); } else if (sender == BY) { - Global.StickyXORAdapter.SetSticky(Controller + " Y", BY.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Y", BY.Checked); } else if (sender == BZ) { - Global.StickyXORAdapter.SetSticky(Controller + " Z", BZ.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Z", BZ.Checked); } else if (sender == BA) { - Global.StickyXORAdapter.SetSticky(Controller + " A", BA.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " A", BA.Checked); } else if (sender == BB) { - Global.StickyXORAdapter.SetSticky(Controller + " B", BB.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " B", BB.Checked); } else if (sender == BC) { - Global.StickyXORAdapter.SetSticky(Controller + " C", BC.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " C", BC.Checked); } else if (sender == BL) { - Global.StickyXORAdapter.SetSticky(Controller + " L", BL.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " L", BL.Checked); } else if (sender == BR) { - Global.StickyXORAdapter.SetSticky(Controller + " R", BR.Checked); + GlobalWinF.StickyXORAdapter.SetSticky(Controller + " R", BR.Checked); } } } diff --git a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSaturnControl.cs b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSaturnControl.cs index 25c866a2a8..a271f48415 100644 --- a/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSaturnControl.cs +++ b/BizHawk.MultiClient/tools/VirtualPads/VirtualPadSaturnControl.cs @@ -71,26 +71,26 @@ namespace BizHawk.MultiClient private void Buttons_CheckedChanged(object sender, EventArgs e) { - if (Global.Emulator.SystemId != "SAT") + if (GlobalWinF.Emulator.SystemId != "SAT") { return; } else if (sender == B1) { - Global.StickyXORAdapter.SetSticky("Power", B1.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Power", B1.Checked); } else if (sender == B2) { - Global.StickyXORAdapter.SetSticky("Reset", B2.Checked); + GlobalWinF.StickyXORAdapter.SetSticky("Reset", B2.Checked); } } public void Clear() { - if (Global.Emulator.SystemId != "SAT") return; + if (GlobalWinF.Emulator.SystemId != "SAT") return; - if (B1.Checked) Global.StickyXORAdapter.SetSticky("Power", false); - if (B2.Checked) Global.StickyXORAdapter.SetSticky("Reset", false); + if (B1.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Power", false); + if (B2.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Reset", false); B1.Checked = false; B2.Checked = false; diff --git a/BizHawk.MultiClient/tools/Watch/RamPoke.Designer.cs b/BizHawk.MultiClient/tools/Watch/RamPoke.Designer.cs index 4032035dfd..a18cc65249 100644 --- a/BizHawk.MultiClient/tools/Watch/RamPoke.Designer.cs +++ b/BizHawk.MultiClient/tools/Watch/RamPoke.Designer.cs @@ -99,7 +99,7 @@ // // ValueBox // - this.ValueBox.ByteSize = BizHawk.MultiClient.Watch.WatchSize.Byte; + this.ValueBox.ByteSize = BizHawk.Client.Core.Watch.WatchSize.Byte; this.ValueBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; this.ValueBox.Location = new System.Drawing.Point(82, 57); this.ValueBox.MaxLength = 9; @@ -108,7 +108,7 @@ this.ValueBox.Size = new System.Drawing.Size(116, 20); this.ValueBox.TabIndex = 10; this.ValueBox.Text = "0000"; - this.ValueBox.Type = BizHawk.MultiClient.Watch.DisplayType.Hex; + this.ValueBox.Type = BizHawk.Client.Core.Watch.DisplayType.Hex; // // ValueHexLabel // diff --git a/BizHawk.MultiClient/tools/Watch/RamPoke.cs b/BizHawk.MultiClient/tools/Watch/RamPoke.cs index 755a99768c..ba4a53d57e 100644 --- a/BizHawk.MultiClient/tools/Watch/RamPoke.cs +++ b/BizHawk.MultiClient/tools/Watch/RamPoke.cs @@ -4,6 +4,8 @@ using System.Drawing; using System.Linq; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class RamPoke : Form diff --git a/BizHawk.MultiClient/tools/Watch/RamSearch.Designer.cs b/BizHawk.MultiClient/tools/Watch/RamSearch.Designer.cs index 0cc7a03582..747d78f362 100644 --- a/BizHawk.MultiClient/tools/Watch/RamSearch.Designer.cs +++ b/BizHawk.MultiClient/tools/Watch/RamSearch.Designer.cs @@ -1352,7 +1352,7 @@ // this.SpecificValueBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.SpecificValueBox.ByteSize = BizHawk.MultiClient.Watch.WatchSize.Byte; + this.SpecificValueBox.ByteSize = BizHawk.Client.Core.Watch.WatchSize.Byte; this.SpecificValueBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; this.SpecificValueBox.Enabled = false; this.SpecificValueBox.Location = new System.Drawing.Point(114, 38); @@ -1362,7 +1362,7 @@ this.SpecificValueBox.Size = new System.Drawing.Size(72, 20); this.SpecificValueBox.TabIndex = 15; this.SpecificValueBox.Text = "00"; - this.SpecificValueBox.Type = BizHawk.MultiClient.Watch.DisplayType.Hex; + this.SpecificValueBox.Type = BizHawk.Client.Core.Watch.DisplayType.Hex; this.SpecificValueBox.TextChanged += new System.EventHandler(this.CompareToValue_TextChanged); // // RamSearch diff --git a/BizHawk.MultiClient/tools/Watch/RamSearch.cs b/BizHawk.MultiClient/tools/Watch/RamSearch.cs index e1cc60c573..53d1518c87 100644 --- a/BizHawk.MultiClient/tools/Watch/RamSearch.cs +++ b/BizHawk.MultiClient/tools/Watch/RamSearch.cs @@ -10,6 +10,8 @@ using System.Windows.Forms; using System.IO; using System.Globalization; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { /// @@ -107,7 +109,7 @@ namespace BizHawk.MultiClient SpecificValueBox.Type = Settings.Type; MessageLabel.Text = String.Empty; - SpecificAddressBox.MaxLength = IntHelpers.GetNumDigits(Global.Emulator.MainMemory.Size); + SpecificAddressBox.MaxLength = IntHelpers.GetNumDigits(GlobalWinF.Emulator.MainMemory.Size); HardSetSizeDropDown(Settings.Size); PopulateTypeDropDown(); HardSetDisplayTypeDropDown(Settings.Type); @@ -131,7 +133,7 @@ namespace BizHawk.MultiClient { Color nextColor = Color.White; - bool isCheat = Global.CheatList.IsActive(Settings.Domain, Searches[index].Address.Value); + bool isCheat = GlobalWinF.CheatList.IsActive(Settings.Domain, Searches[index].Address.Value); bool isWeeded = Global.Config.RamSearchPreviewMode && !forcePreviewClear && Searches.Preview(Searches[index].Address.Value); if (isCheat) @@ -235,7 +237,7 @@ namespace BizHawk.MultiClient { if (!IsHandleCreated || IsDisposed) return; - Settings.Domain = Global.Emulator.MainMemory; + Settings.Domain = GlobalWinF.Emulator.MainMemory; MessageLabel.Text = "Search restarted"; DoDomainSizeCheck(); NewSearch(); @@ -484,14 +486,14 @@ namespace BizHawk.MultiClient private void SetPlatformAndMemoryDomainLabel() { - MemDomainLabel.Text = Global.Emulator.SystemId + " " + Searches.Domain.Name; + MemDomainLabel.Text = GlobalWinF.Emulator.SystemId + " " + Searches.Domain.Name; } private void SetMemoryDomain(int pos) { - if (pos < Global.Emulator.MemoryDomains.Count) //Sanity check + if (pos < GlobalWinF.Emulator.MemoryDomains.Count) //Sanity check { - Settings.Domain = Global.Emulator.MemoryDomains[pos]; + Settings.Domain = GlobalWinF.Emulator.MemoryDomains[pos]; SetDomainLabel(); SetReboot(true); SpecificAddressBox.MaxLength = IntHelpers.GetNumDigits(Settings.Domain.Size); @@ -786,10 +788,10 @@ namespace BizHawk.MultiClient { if (SelectedIndices.Count > 0) { - Global.MainForm.LoadRamWatch(true); + GlobalWinF.MainForm.LoadRamWatch(true); for (int x = 0; x < SelectedIndices.Count; x++) { - Global.MainForm.RamWatch1.AddWatch(Searches[SelectedIndices[x]]); + GlobalWinF.MainForm.RamWatch1.AddWatch(Searches[SelectedIndices[x]]); } if (Global.Config.RamSearchAlwaysExcludeRamWatch) @@ -808,7 +810,7 @@ namespace BizHawk.MultiClient { if (SelectedIndices.Count > 0) { - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var poke = new RamPoke(); var watches = new List(); @@ -821,13 +823,13 @@ namespace BizHawk.MultiClient poke.InitialLocation = GetPromptPoint(); poke.ShowDialog(); UpdateValues(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); } } private void RemoveRamWatchesFromList() { - Searches.RemoveRange(Global.MainForm.RamWatch1.AddressList); + Searches.RemoveRange(GlobalWinF.MainForm.RamWatch1.AddressList); WatchListView.ItemCount = Searches.Count; SetTotal(); } @@ -872,9 +874,9 @@ namespace BizHawk.MultiClient InputPrompt i = new InputPrompt { Text = "Go to Address" }; i._Location = GetPromptPoint(); i.SetMessage("Enter a hexadecimal value"); - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); i.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (i.UserOK) { @@ -1173,7 +1175,7 @@ namespace BizHawk.MultiClient { if (!watch.IsSeparator) { - if (!Global.CheatList.IsActive(watch.Domain, watch.Address.Value)) + if (!GlobalWinF.CheatList.IsActive(watch.Domain, watch.Address.Value)) { allCheats = false; } @@ -1333,14 +1335,14 @@ namespace BizHawk.MultiClient ViewInHexEditorContextMenuItem.Visible = SelectedIndices.Count > 0; - UnfreezeAllContextMenuItem.Visible = Global.CheatList.ActiveCount > 0; + UnfreezeAllContextMenuItem.Visible = GlobalWinF.CheatList.ActiveCount > 0; - ContextMenuSeparator3.Visible = (SelectedIndices.Count > 0) || (Global.CheatList.ActiveCount > 0); + ContextMenuSeparator3.Visible = (SelectedIndices.Count > 0) || (GlobalWinF.CheatList.ActiveCount > 0); bool allCheats = true; foreach (int index in SelectedIndices) { - if (!Global.CheatList.IsActive(Settings.Domain, Searches[index].Address.Value)) + if (!GlobalWinF.CheatList.IsActive(Settings.Domain, Searches[index].Address.Value)) { allCheats = false; } diff --git a/BizHawk.MultiClient/tools/Watch/RamSearchEngine.cs b/BizHawk.MultiClient/tools/Watch/RamSearchEngine.cs index 0407d36599..a495e95c69 100644 --- a/BizHawk.MultiClient/tools/Watch/RamSearchEngine.cs +++ b/BizHawk.MultiClient/tools/Watch/RamSearchEngine.cs @@ -6,6 +6,8 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { //TODO: move me @@ -1018,7 +1020,7 @@ namespace BizHawk.MultiClient public Settings() { - switch (Global.Emulator.SystemId) + switch (GlobalWinF.Emulator.SystemId) { case "N64": Mode = SearchMode.Fast; @@ -1067,7 +1069,7 @@ namespace BizHawk.MultiClient break; } - Domain = Global.Emulator.MainMemory; + Domain = GlobalWinF.Emulator.MainMemory; CheckMisAligned = false; PreviousType = Watch.PreviousType.LastSearch; } diff --git a/BizHawk.MultiClient/tools/Watch/RamWatch.cs b/BizHawk.MultiClient/tools/Watch/RamWatch.cs index 7c937e2189..73cfdc69b5 100644 --- a/BizHawk.MultiClient/tools/Watch/RamWatch.cs +++ b/BizHawk.MultiClient/tools/Watch/RamWatch.cs @@ -7,6 +7,8 @@ using System.Text; using System.Windows.Forms; using System.IO; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class RamWatch : Form @@ -32,7 +34,7 @@ namespace BizHawk.MultiClient private int defaultWidth; private int defaultHeight; - private readonly WatchList Watches = new WatchList(Global.Emulator.MainMemory); + private readonly WatchList Watches = new WatchList(GlobalWinF.Emulator.MainMemory); private string _sortedColumn = ""; private bool _sortReverse = false; @@ -64,8 +66,8 @@ namespace BizHawk.MultiClient { for (int x = 0; x < Watches.Count; x++) { - bool alert = Watches[x].IsSeparator ? false : Global.CheatList.IsActive(Watches[x].Domain, Watches[x].Address.Value); - Global.OSD.AddGUIText( + bool alert = Watches[x].IsSeparator ? false : GlobalWinF.CheatList.IsActive(Watches[x].Domain, Watches[x].Address.Value); + GlobalWinF.OSD.AddGUIText( Watches[x].ToString(), Global.Config.DispRamWatchx, (Global.Config.DispRamWatchy + (x * 14)), @@ -137,9 +139,9 @@ namespace BizHawk.MultiClient private int GetDomainPos(string name) { //Attempts to find the memory domain by name, if it fails, it defaults to index 0 - for (int i = 0; i < Global.Emulator.MemoryDomains.Count; i++) + for (int i = 0; i < GlobalWinF.Emulator.MemoryDomains.Count; i++) { - if (Global.Emulator.MemoryDomains[i].Name == name) + if (GlobalWinF.Emulator.MemoryDomains[i].Name == name) { return i; } @@ -164,9 +166,9 @@ namespace BizHawk.MultiClient if (Watches.Changes) { - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); DialogResult result = MessageBox.Show("Save Changes?", "Ram Watch", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result == DialogResult.Yes) { Watches.Save(); @@ -269,7 +271,7 @@ namespace BizHawk.MultiClient { color = BackColor; } - else if (Global.CheatList.IsActive(Watches.Domain, Watches[index].Address.Value)) + else if (GlobalWinF.CheatList.IsActive(Watches.Domain, Watches[index].Address.Value)) { color = Color.LightCyan; } @@ -327,7 +329,7 @@ namespace BizHawk.MultiClient private void SetPlatformAndMemoryDomainLabel() { - MemDomainLabel.Text = Global.Emulator.SystemId + " " + Watches.Domain.Name; + MemDomainLabel.Text = GlobalWinF.Emulator.SystemId + " " + Watches.Domain.Name; } private void NewWatchList(bool suppressAsk) @@ -395,9 +397,9 @@ namespace BizHawk.MultiClient private void SetMemoryDomain(int pos) { - if (pos < Global.Emulator.MemoryDomains.Count) //Sanity check + if (pos < GlobalWinF.Emulator.MemoryDomains.Count) //Sanity check { - Watches.Domain = Global.Emulator.MemoryDomains[pos]; + Watches.Domain = GlobalWinF.Emulator.MemoryDomains[pos]; } SetPlatformAndMemoryDomainLabel(); @@ -518,9 +520,9 @@ namespace BizHawk.MultiClient InitialLocation = GetPromptPoint() }; we.SetWatch(Watches.Domain); - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); we.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (we.DialogResult == DialogResult.OK) { @@ -548,7 +550,7 @@ namespace BizHawk.MultiClient } we.SetWatch(Watches.Domain, SelectedWatches, duplicate ? WatchEditor.Mode.Duplicate : WatchEditor.Mode.Edit); - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = we.ShowDialog(); if (result == DialogResult.OK) { @@ -567,7 +569,7 @@ namespace BizHawk.MultiClient } } - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); UpdateValues(); } } @@ -586,13 +588,13 @@ namespace BizHawk.MultiClient poke.SetWatch(SelectedWatches); } - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = poke.ShowDialog(); if (result == DialogResult.OK) { UpdateValues(); } - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); } } @@ -897,7 +899,7 @@ namespace BizHawk.MultiClient { if (!watch.IsSeparator) { - if (!Global.CheatList.IsActive(watch.Domain, watch.Address.Value)) + if (!GlobalWinF.CheatList.IsActive(watch.Domain, watch.Address.Value)) { allCheats = false; } @@ -1029,7 +1031,7 @@ namespace BizHawk.MultiClient if (!Global.Config.DisplayRamWatch) { - Global.OSD.ClearGUIText(); + GlobalWinF.OSD.ClearGUIText(); } else { @@ -1108,7 +1110,7 @@ namespace BizHawk.MultiClient { if (!Watches[i].IsSeparator) { - if (!Global.CheatList.IsActive(Watches[i].Domain, Watches[i].Address.Value)) + if (!GlobalWinF.CheatList.IsActive(Watches[i].Domain, Watches[i].Address.Value)) { allCheats = false; } @@ -1131,7 +1133,7 @@ namespace BizHawk.MultiClient ShowDiffContextMenuItem.Text = Global.Config.RamWatchShowDiffColumn ? "Hide difference value" : "Show difference value"; ShowDomainContextMenuItem.Text = Global.Config.RamWatchShowDomainColumn ? "Hide domain" : "Show domain"; - UnfreezeAllContextMenuItem.Visible = Global.CheatList.ActiveCount > 0; + UnfreezeAllContextMenuItem.Visible = GlobalWinF.CheatList.ActiveCount > 0; ViewInHexEditorContextMenuItem.Visible = SelectedWatches.Count == 1; } @@ -1146,7 +1148,7 @@ namespace BizHawk.MultiClient var selected = SelectedWatches; if (selected.Any()) { - Global.MainForm.LoadHexEditor(); + GlobalWinF.MainForm.LoadHexEditor(); if (selected.Select(x => x.Domain).Distinct().Count() > 1) { diff --git a/BizHawk.MultiClient/tools/Watch/Watch.cs b/BizHawk.MultiClient/tools/Watch/Watch.cs deleted file mode 100644 index 93f04961b1..0000000000 --- a/BizHawk.MultiClient/tools/Watch/Watch.cs +++ /dev/null @@ -1,930 +0,0 @@ -using System; -using System.Globalization; -using System.Collections.Generic; - -namespace BizHawk.MultiClient -{ - 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 }; - public enum PreviousType { Original = 0, LastSearch = 1, LastFrame = 2, LastChange = 3 }; - - public static string DisplayTypeToString(DisplayType type) - { - switch (type) - { - default: - return type.ToString(); - case DisplayType.FixedPoint_12_4: - return "Fixed Point 12.4"; - case DisplayType.FixedPoint_20_12: - return "Fixed Point 20.12"; - } - } - - public static DisplayType StringToDisplayType(string name) - { - switch (name) - { - default: - return (DisplayType)Enum.Parse(typeof(DisplayType), name); - case "Fixed Point 12.4": - return DisplayType.FixedPoint_12_4; - case "Fixed Point 20.12": - return DisplayType.FixedPoint_20_12; - } - } - - protected int _address; - protected MemoryDomain _domain; - protected DisplayType _type; - protected bool _bigEndian; - protected int _changecount; - protected string _notes = String.Empty; - - public abstract int? Value { get; } - public abstract string ValueString { get; } - public abstract WatchSize Size { get; } - - public abstract int? Previous { get; } - public abstract string PreviousStr { get; } - public abstract void ResetPrevious(); - - public abstract bool Poke(string value); - - public virtual DisplayType Type { get { return _type; } set { _type = value; } } - public virtual bool BigEndian { get { return _bigEndian; } set { _bigEndian = value; } } - - public MemoryDomain Domain { get { return _domain; } } - - public string DomainName { get { return _domain != null ? _domain.Name : String.Empty; } } - - public virtual int? Address { get { return _address; } } - - public virtual string AddressString { get { return _address.ToString(AddressFormatStr); } } - - public virtual bool IsSeparator { get { return false; } } - - public char SizeAsChar - { - get - { - switch (Size) - { - default: - case WatchSize.Separator: - return 'S'; - case WatchSize.Byte: - return 'b'; - case WatchSize.Word: - return 'w'; - case WatchSize.DWord: - return 'd'; - } - } - } - - public static WatchSize SizeFromChar(char c) - { - switch (c) - { - default: - case 'S': - return WatchSize.Separator; - case 'b': - return WatchSize.Byte; - case 'w': - return WatchSize.Word; - case 'd': - return WatchSize.DWord; - } - } - - public char TypeAsChar - { - get - { - switch (Type) - { - default: - case DisplayType.Separator: - return '_'; - case DisplayType.Unsigned: - return 's'; - case DisplayType.Signed: - return 'u'; - case DisplayType.Hex: - return 'h'; - case DisplayType.Binary: - return 'b'; - case DisplayType.FixedPoint_12_4: - return '1'; - case DisplayType.FixedPoint_20_12: - return '2'; - case DisplayType.Float: - return 'f'; - } - } - } - - public static DisplayType DisplayTypeFromChar(char c) - { - switch (c) - { - default: - case '_': - return DisplayType.Separator; - case 'u': - return DisplayType.Unsigned; - case 's': - return DisplayType.Signed; - case 'h': - return DisplayType.Hex; - case 'b': - return DisplayType.Binary; - case '1': - return DisplayType.FixedPoint_12_4; - case '2': - return DisplayType.FixedPoint_20_12; - case 'f': - return DisplayType.Float; - } - } - - public string AddressFormatStr - { - get - { - if (_domain != null) - { - return "X" + IntHelpers.GetNumDigits(_domain.Size - 1).ToString(); - } - else - { - return ""; - } - } - } - - protected byte GetByte() - { - return _domain.PeekByte(_address); - } - - protected ushort GetWord() - { - return _domain.PeekWord(_address, _bigEndian ? Endian.Big : Endian.Little); - } - - protected uint GetDWord() - { - return _domain.PeekDWord(_address, _bigEndian ? Endian.Big : Endian.Little); - } - - protected void PokeByte(byte val) - { - _domain.PokeByte(_address, val); - } - - protected void PokeWord(ushort val) - { - _domain.PokeWord(_address, val, _bigEndian ? Endian.Big : Endian.Little); - } - - protected void PokeDWord(uint val) - { - _domain.PokeDWord(_address, val, _bigEndian ? Endian.Big : Endian.Little); - } - - public void ClearChangeCount() { _changecount = 0; } - - public string Notes { get { return _notes; } set { _notes = value; } } - - public static Watch GenerateWatch(MemoryDomain domain, int address, WatchSize size, DisplayType type, string notes, bool bigEndian) - { - switch (size) - { - default: - case WatchSize.Separator: - return SeparatorWatch.Instance; - case WatchSize.Byte: - return new ByteWatch(domain, address, type, bigEndian, notes); - case WatchSize.Word: - return new WordWatch(domain, address, type, bigEndian, notes); - case WatchSize.DWord: - return new DWordWatch(domain, address, type, bigEndian, notes); - } - } - - public static Watch GenerateWatch(MemoryDomain domain, int address, WatchSize size, DisplayType type, bool bigendian, int prev, int changecount) - { - switch (size) - { - default: - case WatchSize.Separator: - return SeparatorWatch.Instance; - case WatchSize.Byte: - return new ByteWatch(domain, address, type, bigendian, (byte)prev, changecount); - case WatchSize.Word: - return new WordWatch(domain, address, type, bigendian, (ushort)prev, changecount); - case WatchSize.DWord: - return new DWordWatch(domain, address, type, bigendian, (uint)prev, changecount); - } - } - - public static List AvailableTypes(WatchSize size) - { - switch (size) - { - default: - case WatchSize.Separator: - return SeparatorWatch.ValidTypes; - case WatchSize.Byte: - return ByteWatch.ValidTypes; - case WatchSize.Word: - return WordWatch.ValidTypes; - case WatchSize.DWord: - return DWordWatch.ValidTypes; - } - } - - public int ChangeCount { get { return _changecount; } } - - public abstract string Diff { get; } - - public abstract void Update(); - } - - public sealed class SeparatorWatch : Watch - { - public static SeparatorWatch Instance - { - get { return new SeparatorWatch(); } - } - - public override int? Address - { - get { return null; } - } - - public override int? Value - { - get { return null; } - } - - public override int? Previous - { - get { return null; } - } - - public override string AddressString - { - get { return String.Empty; } - } - - public override string ValueString - { - get { return String.Empty; } - } - - public override string PreviousStr - { - get { return String.Empty; } - } - - public override string ToString() - { - return "----"; - } - - public override bool IsSeparator - { - get { return true; } - } - - public override WatchSize Size - { - get { return WatchSize.Separator; } - } - - public static List ValidTypes - { - get { return new List { DisplayType.Separator }; } - } - - public override DisplayType Type - { - get { return DisplayType.Separator; } - } - - public override bool Poke(string value) - { - return false; - } - - public override void ResetPrevious() - { - return; - } - - public override string Diff { get { return String.Empty; } } - - public override void Update() { return; } - } - - public sealed class ByteWatch : Watch - { - private byte _previous; - private byte _value; - - public ByteWatch(MemoryDomain domain, int address, DisplayType type, bool bigEndian, string notes) - { - _address = address; - _domain = domain; - _value = _previous = GetByte(); - if (Watch.AvailableTypes(WatchSize.Byte).Contains(type)) - { - _type = type; - } - _bigEndian = bigEndian; - if (notes != null) - { - Notes = notes; - } - } - - public ByteWatch(MemoryDomain domain, int address, DisplayType type, bool bigEndian, byte prev, int changeCount, string notes = null) - : this(domain, address, type, bigEndian, notes) - { - _previous = prev; - _changecount = changeCount; - } - - public override int? Address - { - get { return _address; } - } - - public override int? Value - { - get { return GetByte(); } - } - - public override string ValueString - { - get { return FormatValue(GetByte()); } - } - - public override int? Previous - { - get { return _previous; } - } - - public override string PreviousStr - { - get { return FormatValue(_previous); } - } - - public override void ResetPrevious() - { - _previous = GetByte(); - } - - public override string ToString() - { - return Notes + ": " + ValueString; - } - - public override bool IsSeparator - { - get { return false; } - } - - public override WatchSize Size - { - get { return WatchSize.Byte; } - } - - public static List ValidTypes - { - get - { - return new List - { - DisplayType.Unsigned, DisplayType.Signed, DisplayType.Hex, DisplayType.Binary - }; - } - } - - public string FormatValue(byte val) - { - switch (Type) - { - default: - case DisplayType.Unsigned: - return val.ToString(); - case DisplayType.Signed: - return ((sbyte)val).ToString(); - case DisplayType.Hex: - return String.Format("{0:X2}", val); - case DisplayType.Binary: - return Convert.ToString(val, 2).PadLeft(8, '0').Insert(4, " "); - } - } - - public override bool Poke(string value) - { - try - { - byte val = 0; - switch (Type) - { - case DisplayType.Unsigned: - if (InputValidate.IsValidUnsignedNumber(value)) - { - val = (byte)int.Parse(value); - } - else - { - return false; - } - break; - case DisplayType.Signed: - if (InputValidate.IsValidSignedNumber(value)) - { - val = (byte)(sbyte)int.Parse(value); - } - else - { - return false; - } - break; - case DisplayType.Hex: - if (InputValidate.IsValidHexNumber(value)) - { - val = (byte)int.Parse(value, NumberStyles.HexNumber); - } - else - { - return false; - } - break; - case DisplayType.Binary: - if (InputValidate.IsValidBinaryNumber(value)) - { - val = (byte)Convert.ToInt32(value, 2); - } - else - { - return false; - } - break; - } - - PokeByte(val); - return true; - } - catch - { - return false; - } - } - - public override string Diff - { - get - { - string diff = String.Empty; - int diffVal = _value - _previous; - if (diffVal > 0) - { - diff = "+"; - } - else if (diffVal < 0) - { - diff = "-"; - } - return diff + FormatValue((byte)(_previous - _value)); - } - } - - public override void Update() - { - switch (Global.Config.RamWatchDefinePrevious) - { - case PreviousType.Original: - return; - case PreviousType.LastChange: - var temp = _value; - _value = GetByte(); - if (_value != temp) - { - _previous = _value; - _changecount++; - } - break; - case PreviousType.LastFrame: - _previous = _value; - _value = GetByte(); - if (_value != Previous) - { - _changecount++; - } - break; - } - } - } - - public sealed class WordWatch : Watch - { - private ushort _previous; - private ushort _value; - - public WordWatch(MemoryDomain domain, int address, DisplayType type, bool bigEndian, string notes) - { - _domain = domain; - _address = address; - _value = _previous = GetWord(); - - if (Watch.AvailableTypes(WatchSize.Word).Contains(type)) - { - _type = type; - } - _bigEndian = bigEndian; - - if (notes != null) - { - Notes = notes; - } - } - - public WordWatch(MemoryDomain domain, int address, DisplayType type, bool bigEndian, ushort prev, int changeCount, string notes = null) - : this(domain, address, type, bigEndian, notes) - { - _previous = prev; - _changecount = changeCount; - } - - public override int? Value - { - get { return GetWord(); } - } - - public override int? Previous - { - get { return _previous; } - } - - public override string PreviousStr - { - get { return FormatValue(_previous); } - } - - public override void ResetPrevious() - { - _previous = GetWord(); - } - - public override WatchSize Size - { - get { return WatchSize.Word; } - } - - public static List ValidTypes - { - get - { - return new List - { - DisplayType.Unsigned, DisplayType.Signed, DisplayType.Hex, DisplayType.FixedPoint_12_4, DisplayType.Binary - }; - } - } - - public override string ValueString - { - get { return FormatValue(GetWord()); } - } - - public override string ToString() - { - return Notes + ": " + ValueString; - } - - public string FormatValue(ushort val) - { - switch (Type) - { - default: - case DisplayType.Unsigned: - return val.ToString(); - case DisplayType.Signed: - return ((short)val).ToString(); - case DisplayType.Hex: - return String.Format("{0:X4}", val); - case DisplayType.FixedPoint_12_4: - return String.Format("{0:F4}", (val / 16.0)); - case DisplayType.Binary: - return Convert.ToString(val, 2).PadLeft(16, '0').Insert(8, " ").Insert(4, " ").Insert(14, " "); - } - } - - public override bool Poke(string value) - { - try - { - ushort val = 0; - switch (Type) - { - case DisplayType.Unsigned: - if (InputValidate.IsValidUnsignedNumber(value)) - { - val = (ushort)int.Parse(value); - } - else - { - return false; - } - break; - case DisplayType.Signed: - if (InputValidate.IsValidSignedNumber(value)) - { - val = (ushort)(short)int.Parse(value); - } - else - { - return false; - } - break; - case DisplayType.Hex: - if (InputValidate.IsValidHexNumber(value)) - { - val = (ushort)int.Parse(value, NumberStyles.HexNumber); - } - else - { - return false; - } - break; - case DisplayType.Binary: - if (InputValidate.IsValidBinaryNumber(value)) - { - val = (ushort)Convert.ToInt32(value, 2); - } - else - { - return false; - } - break; - case DisplayType.FixedPoint_12_4: - if (InputValidate.IsValidFixedPointNumber(value)) - { - val = (ushort)(double.Parse(value) * 16.0); - } - else - { - return false; - } - break; - } - PokeWord(val); - return true; - } - catch - { - return false; - } - } - - public override string Diff - { - get { return FormatValue((ushort)(_previous - _value)); } - } - - public override void Update() - { - switch (Global.Config.RamWatchDefinePrevious) - { - case PreviousType.Original: - return; - case PreviousType.LastChange: - var temp = _value; - _value = GetWord(); - - if (_value != temp) - { - _previous = temp; - _changecount++; - } - break; - case PreviousType.LastFrame: - _previous = _value; - _value = GetWord(); - if (_value != Previous) - { - _changecount++; - } - break; - } - } - } - - public sealed class DWordWatch : Watch - { - private uint _value; - private uint _previous; - - public DWordWatch(MemoryDomain domain, int address, DisplayType type, bool bigEndian, string notes) - { - _domain = domain; - _address = address; - _value = _previous = GetDWord(); - - if (Watch.AvailableTypes(WatchSize.DWord).Contains(type)) - { - _type = type; - } - _bigEndian = bigEndian; - - if (notes != null) - { - Notes = notes; - } - } - - public DWordWatch(MemoryDomain domain, int address, DisplayType type, bool bigEndian, uint prev, int changeCount, string notes = null) - : this(domain, address, type, bigEndian, notes) - { - _previous = prev; - _changecount = changeCount; - _type = type; - _bigEndian = bigEndian; - } - - public override int? Value - { - get { return (int)GetDWord(); } - } - - public override int? Previous - { - get { return (int)_previous; } - } - - public override string PreviousStr - { - get { return FormatValue(_previous); } - } - - public override void ResetPrevious() - { - _previous = GetWord(); - } - - public override WatchSize Size - { - get { return WatchSize.DWord; } - } - - public static List ValidTypes - { - get - { - return new List - { - DisplayType.Unsigned, DisplayType.Signed, DisplayType.Hex, DisplayType.FixedPoint_20_12, DisplayType.Float - }; - } - } - - public override string ValueString - { - get { return FormatValue(GetDWord()); } - } - - public override string ToString() - { - return Notes + ": " + ValueString; - } - - public string FormatValue(uint val) - { - switch (Type) - { - default: - case DisplayType.Unsigned: - return val.ToString(); - case DisplayType.Signed: - return ((int)val).ToString(); - case DisplayType.Hex: - return String.Format("{0:X8}", val); - case DisplayType.FixedPoint_20_12: - return String.Format("{0:0.######}", (val / 4096.0)); - case DisplayType.Float: - byte[] bytes = BitConverter.GetBytes(val); - float _float = BitConverter.ToSingle(bytes, 0); - return String.Format("{0:0.######}", _float); - } - } - - public override bool Poke(string value) - { - try - { - uint val = 0; - switch (Type) - { - case DisplayType.Unsigned: - if (InputValidate.IsValidUnsignedNumber(value)) - { - val = (uint)int.Parse(value); - } - else - { - return false; - } - break; - case DisplayType.Signed: - if (InputValidate.IsValidSignedNumber(value)) - { - val = (uint)int.Parse(value); - } - else - { - return false; - } - break; - case DisplayType.Hex: - if (InputValidate.IsValidHexNumber(value)) - { - val = (uint)int.Parse(value, NumberStyles.HexNumber); - } - else - { - return false; - } - break; - case DisplayType.FixedPoint_20_12: - if (InputValidate.IsValidFixedPointNumber(value)) - { - val = (uint)(int)(double.Parse(value) * 4096.0); - } - else - { - return false; - } - break; - case DisplayType.Float: - if (InputValidate.IsValidDecimalNumber(value)) - { - byte[] bytes = BitConverter.GetBytes(float.Parse(value)); - val = BitConverter.ToUInt32(bytes, 0); - } - else - { - return false; - } - break; - } - PokeDWord(val); - return true; - } - catch - { - return false; - } - } - - public override string Diff - { - get { return FormatValue(_previous - _value); } - } - - public override void Update() - { - switch (Global.Config.RamWatchDefinePrevious) - { - case PreviousType.Original: - return; - case PreviousType.LastChange: - var temp = _value; - _value = GetDWord(); - if (_value != temp) - { - _previous = _value; - _changecount++; - } - break; - case PreviousType.LastFrame: - _previous = _value; - _value = GetDWord(); - if (_value != Previous) - { - _changecount++; - } - break; - } - } - } -} diff --git a/BizHawk.MultiClient/tools/Watch/WatchEditor.cs b/BizHawk.MultiClient/tools/Watch/WatchEditor.cs index 2a20dd13fa..96af86e45d 100644 --- a/BizHawk.MultiClient/tools/Watch/WatchEditor.cs +++ b/BizHawk.MultiClient/tools/Watch/WatchEditor.cs @@ -4,6 +4,8 @@ using System.Drawing; using System.Linq; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public partial class WatchEditor : Form @@ -92,7 +94,7 @@ namespace BizHawk.MultiClient _watchList.AddRange(watches); } _mode = mode; - ToolHelpers.PopulateMemoryDomainDropdown(ref DomainDropDown, domain ?? Global.Emulator.MainMemory); + ToolHelpers.PopulateMemoryDomainDropdown(ref DomainDropDown, domain ?? GlobalWinF.Emulator.MainMemory); SetTitle(); } @@ -117,7 +119,7 @@ namespace BizHawk.MultiClient { if (!_loading) { - var domain = Global.Emulator.MemoryDomains.FirstOrDefault(d => d.Name == DomainDropDown.SelectedItem.ToString()); + var domain = GlobalWinF.Emulator.MemoryDomains.FirstOrDefault(d => d.Name == DomainDropDown.SelectedItem.ToString()); if (domain != null) { AddressBox.SetHexProperties(domain.Size); @@ -175,8 +177,8 @@ namespace BizHawk.MultiClient } } - var domain = Global.Emulator.MemoryDomains.FirstOrDefault(d => d.Name == DomainDropDown.SelectedItem.ToString()) ?? - Global.Emulator.MainMemory; + var domain = GlobalWinF.Emulator.MemoryDomains.FirstOrDefault(d => d.Name == DomainDropDown.SelectedItem.ToString()) ?? + GlobalWinF.Emulator.MainMemory; BigEndianCheckBox.Checked = domain.Endian == Endian.Big; } @@ -196,7 +198,7 @@ namespace BizHawk.MultiClient { default: case Mode.New: - var domain = Global.Emulator.MemoryDomains.FirstOrDefault(d => d.Name == DomainDropDown.SelectedItem.ToString()); + var domain = GlobalWinF.Emulator.MemoryDomains.FirstOrDefault(d => d.Name == DomainDropDown.SelectedItem.ToString()); var address = AddressBox.ToRawInt(); var notes = NotesBox.Text; var type = Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString()); diff --git a/BizHawk.MultiClient/tools/Watch/WatchList.cs b/BizHawk.MultiClient/tools/Watch/WatchList.cs index 6d785d758c..2d40c8e0d1 100644 --- a/BizHawk.MultiClient/tools/Watch/WatchList.cs +++ b/BizHawk.MultiClient/tools/Watch/WatchList.cs @@ -6,6 +6,8 @@ using System.Linq; using System.Text; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { public class WatchList : IEnumerable @@ -347,7 +349,7 @@ namespace BizHawk.MultiClient StringBuilder sb = new StringBuilder(); sb .Append("Domain ").AppendLine(_domain.Name) - .Append("SystemID ").AppendLine(Global.Emulator.SystemId); + .Append("SystemID ").AppendLine(GlobalWinF.Emulator.SystemId); foreach (Watch w in _watchList) { @@ -449,7 +451,7 @@ namespace BizHawk.MultiClient //Temporary, rename if kept int addr; bool bigEndian; - MemoryDomain memDomain = Global.Emulator.MainMemory; + MemoryDomain memDomain = GlobalWinF.Emulator.MainMemory; string temp = line.Substring(0, line.IndexOf('\t')); try @@ -494,7 +496,7 @@ namespace BizHawk.MultiClient startIndex = line.IndexOf('\t') + 1; line = line.Substring(startIndex, line.Length - startIndex); //Domain temp = line.Substring(0, line.IndexOf('\t')); - memDomain = Global.Emulator.MemoryDomains[GetDomainPos(temp)]; + memDomain = GlobalWinF.Emulator.MemoryDomains[GetDomainPos(temp)]; } startIndex = line.IndexOf('\t') + 1; @@ -508,7 +510,7 @@ namespace BizHawk.MultiClient type, notes, bigEndian)); - _domain = Global.Emulator.MemoryDomains[GetDomainPos(domain)]; + _domain = GlobalWinF.Emulator.MemoryDomains[GetDomainPos(domain)]; } } @@ -527,9 +529,9 @@ namespace BizHawk.MultiClient private static int GetDomainPos(string name) { //Attempts to find the memory domain by name, if it fails, it defaults to index 0 - for (int x = 0; x < Global.Emulator.MemoryDomains.Count; x++) + for (int x = 0; x < GlobalWinF.Emulator.MemoryDomains.Count; x++) { - if (Global.Emulator.MemoryDomains[x].Name == name) + if (GlobalWinF.Emulator.MemoryDomains[x].Name == name) return x; } return 0; @@ -544,9 +546,9 @@ namespace BizHawk.MultiClient ofd.Filter = "Watch Files (*.wch)|*.wch|All Files|*.*"; ofd.RestoreDirectory = true; - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = ofd.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result != DialogResult.OK) return null; var file = new FileInfo(ofd.FileName); @@ -561,7 +563,7 @@ namespace BizHawk.MultiClient sfd.FileName = Path.GetFileNameWithoutExtension(currentFile); sfd.InitialDirectory = Path.GetDirectoryName(currentFile); } - else if (!(Global.Emulator is NullEmulator)) + else if (!(GlobalWinF.Emulator is NullEmulator)) { sfd.FileName = PathManager.FilesystemSafeName(Global.Game); sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.WatchPath, null); @@ -573,9 +575,9 @@ namespace BizHawk.MultiClient } sfd.Filter = "Watch Files (*.wch)|*.wch|All Files|*.*"; sfd.RestoreDirectory = true; - Global.Sound.StopSound(); + GlobalWinF.Sound.StopSound(); var result = sfd.ShowDialog(); - Global.Sound.StartSound(); + GlobalWinF.Sound.StartSound(); if (result != DialogResult.OK) return null; var file = new FileInfo(sfd.FileName); diff --git a/BizHawk.MultiClient/tools/Watch/WatchValueBox.cs b/BizHawk.MultiClient/tools/Watch/WatchValueBox.cs index fdbb5f1750..25a392fcab 100644 --- a/BizHawk.MultiClient/tools/Watch/WatchValueBox.cs +++ b/BizHawk.MultiClient/tools/Watch/WatchValueBox.cs @@ -1,6 +1,9 @@ using System; using System.Globalization; using System.Windows.Forms; + +using BizHawk.Client.Core; + namespace BizHawk.MultiClient { class WatchValueBox : TextBox, INumberBox diff --git a/BizHawk.Util/BizHawk.Util.csproj b/BizHawk.Util/BizHawk.Util.csproj index 7ef47c9e30..0f0043c09a 100644 --- a/BizHawk.Util/BizHawk.Util.csproj +++ b/BizHawk.Util/BizHawk.Util.csproj @@ -119,15 +119,12 @@ Form - - Form QuickProgressPopup.cs - Component @@ -190,6 +187,12 @@ true + + + {24A0AA3C-B25F-4197-B23D-476D6462DBA0} + Client.Core + + "$(SolutionDir)subwcrev.bat" "$(ProjectDir)" diff --git a/BizHawk.Util/HexTextBox.cs b/BizHawk.Util/HexTextBox.cs index 73289e5637..b0cab50ac6 100644 --- a/BizHawk.Util/HexTextBox.cs +++ b/BizHawk.Util/HexTextBox.cs @@ -2,6 +2,8 @@ using System.Globalization; using System.Windows.Forms; +using BizHawk.Client.Core; + namespace BizHawk { public interface INumberBox diff --git a/BizHawk.sln b/BizHawk.sln index 6475cf59a6..ca621aa86c 100644 --- a/BizHawk.sln +++ b/BizHawk.sln @@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BizHawk.PCE_Debugger", "Biz EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LuaHawk", "LuaHawk\LuaHawk.csproj", "{B7FA7300-52DF-4A3F-84EF-D69E40CF60AF}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client.Core", "Client.Core\Client.Core.csproj", "{24A0AA3C-B25F-4197-B23D-476D6462DBA0}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -105,6 +107,18 @@ Global {B7FA7300-52DF-4A3F-84EF-D69E40CF60AF}.Release|Win32.ActiveCfg = Release|x86 {B7FA7300-52DF-4A3F-84EF-D69E40CF60AF}.Release|x86.ActiveCfg = Release|x86 {B7FA7300-52DF-4A3F-84EF-D69E40CF60AF}.Release|x86.Build.0 = Release|x86 + {24A0AA3C-B25F-4197-B23D-476D6462DBA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {24A0AA3C-B25F-4197-B23D-476D6462DBA0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {24A0AA3C-B25F-4197-B23D-476D6462DBA0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {24A0AA3C-B25F-4197-B23D-476D6462DBA0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {24A0AA3C-B25F-4197-B23D-476D6462DBA0}.Debug|Win32.ActiveCfg = Debug|Any CPU + {24A0AA3C-B25F-4197-B23D-476D6462DBA0}.Debug|x86.ActiveCfg = Debug|Any CPU + {24A0AA3C-B25F-4197-B23D-476D6462DBA0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {24A0AA3C-B25F-4197-B23D-476D6462DBA0}.Release|Any CPU.Build.0 = Release|Any CPU + {24A0AA3C-B25F-4197-B23D-476D6462DBA0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {24A0AA3C-B25F-4197-B23D-476D6462DBA0}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {24A0AA3C-B25F-4197-B23D-476D6462DBA0}.Release|Win32.ActiveCfg = Release|Any CPU + {24A0AA3C-B25F-4197-B23D-476D6462DBA0}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Client.Core/Client.Core.csproj b/Client.Core/Client.Core.csproj new file mode 100644 index 0000000000..314ecf9b0b --- /dev/null +++ b/Client.Core/Client.Core.csproj @@ -0,0 +1,71 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {24A0AA3C-B25F-4197-B23D-476D6462DBA0} + Library + Properties + Client.Core + Client.Core + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + + + + + + {197D4314-8A9F-49BA-977D-54ACEFAEB6BA} + BizHawk.Emulation + + + + + \ No newline at end of file diff --git a/BizHawk.Util/InputValidate.cs b/Client.Core/InputValidate.cs similarity index 95% rename from BizHawk.Util/InputValidate.cs rename to Client.Core/InputValidate.cs index 3252c880d6..c2f3241c9f 100644 --- a/BizHawk.Util/InputValidate.cs +++ b/Client.Core/InputValidate.cs @@ -1,6 +1,6 @@ using System.Text; -namespace BizHawk +namespace BizHawk.Client.Core { /// /// Includes helper functions to validate user input diff --git a/BizHawk.Util/KeyTurbo.cs b/Client.Core/KeyTurbo.cs similarity index 87% rename from BizHawk.Util/KeyTurbo.cs rename to Client.Core/KeyTurbo.cs index 6fe6eb6ed6..955ce0ca1e 100644 --- a/BizHawk.Util/KeyTurbo.cs +++ b/Client.Core/KeyTurbo.cs @@ -1,4 +1,4 @@ -namespace BizHawk +namespace BizHawk.Client.Core { public class TurboKey { diff --git a/Client.Core/Properties/AssemblyInfo.cs b/Client.Core/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..e72bc09e09 --- /dev/null +++ b/Client.Core/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Client.Core")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Client.Core")] +[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("8281b376-a1d5-4157-97b8-dab7246ef4c8")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/BizHawk.MultiClient/RecentFiles.cs b/Client.Core/RecentFiles.cs similarity index 94% rename from BizHawk.MultiClient/RecentFiles.cs rename to Client.Core/RecentFiles.cs index f7f016b4f2..ac227aedfb 100644 --- a/BizHawk.MultiClient/RecentFiles.cs +++ b/Client.Core/RecentFiles.cs @@ -3,7 +3,7 @@ using System.Collections; using System.Collections.Generic; using System.Linq; -namespace BizHawk.MultiClient +namespace BizHawk.Client.Core { public class RecentFiles : IEnumerable { diff --git a/BizHawk.Util/StringHelpers.cs b/Client.Core/StringHelpers.cs similarity index 92% rename from BizHawk.Util/StringHelpers.cs rename to Client.Core/StringHelpers.cs index ef55c81fd9..2c290748ea 100644 --- a/BizHawk.Util/StringHelpers.cs +++ b/Client.Core/StringHelpers.cs @@ -1,7 +1,7 @@ using System; using System.Linq; -namespace BizHawk +namespace BizHawk.Client.Core { public static class StringHelpers {