diff --git a/BizHawk.Client.EmuHawk/MainForm.Events.cs b/BizHawk.Client.EmuHawk/MainForm.Events.cs index 5670df0607..7e2f6fb75d 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -43,8 +43,8 @@ namespace BizHawk.Client.EmuHawk SaveSlotSubMenu.Enabled = Emulator.HasSavestates(); - OpenRomMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Open ROM"].Bindings; - CloseRomMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Close ROM"].Bindings; + OpenRomMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Open ROM"].Bindings; + CloseRomMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Close ROM"].Bindings; MovieSubMenu.Enabled = CloseRomMenuItem.Enabled = @@ -69,7 +69,7 @@ namespace BizHawk.Client.EmuHawk { RecentRomSubMenu.DropDownItems.Clear(); RecentRomSubMenu.DropDownItems.AddRange( - Global.Config.RecentRoms.RecentMenu(LoadRomFromRecent, true, true)); + Config.RecentRoms.RecentMenu(LoadRomFromRecent, true, true)); } private void SaveStateSubMenu_DropDownOpened(object sender, EventArgs e) @@ -124,34 +124,34 @@ namespace BizHawk.Client.EmuHawk SaveState9MenuItem.Font.Size, _stateSlots.HasSlot(9) ? (FontStyle.Italic | FontStyle.Bold) : FontStyle.Regular); - SaveState1MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Save State 1"].Bindings; - SaveState2MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Save State 2"].Bindings; - SaveState3MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Save State 3"].Bindings; - SaveState4MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Save State 4"].Bindings; - SaveState5MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Save State 5"].Bindings; - SaveState6MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Save State 6"].Bindings; - SaveState7MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Save State 7"].Bindings; - SaveState8MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Save State 8"].Bindings; - SaveState9MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Save State 9"].Bindings; - SaveState0MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Save State 0"].Bindings; - SaveNamedStateMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Save Named State"].Bindings; + SaveState1MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Save State 1"].Bindings; + SaveState2MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Save State 2"].Bindings; + SaveState3MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Save State 3"].Bindings; + SaveState4MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Save State 4"].Bindings; + SaveState5MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Save State 5"].Bindings; + SaveState6MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Save State 6"].Bindings; + SaveState7MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Save State 7"].Bindings; + SaveState8MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Save State 8"].Bindings; + SaveState9MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Save State 9"].Bindings; + SaveState0MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Save State 0"].Bindings; + SaveNamedStateMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Save Named State"].Bindings; } private void LoadStateSubMenu_DropDownOpened(object sender, EventArgs e) { - LoadState1MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Load State 1"].Bindings; - LoadState2MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Load State 2"].Bindings; - LoadState3MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Load State 3"].Bindings; - LoadState4MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Load State 4"].Bindings; - LoadState5MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Load State 5"].Bindings; - LoadState6MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Load State 6"].Bindings; - LoadState7MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Load State 7"].Bindings; - LoadState8MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Load State 8"].Bindings; - LoadState9MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Load State 9"].Bindings; - LoadState0MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Load State 0"].Bindings; - LoadNamedStateMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Load Named State"].Bindings; + LoadState1MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Load State 1"].Bindings; + LoadState2MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Load State 2"].Bindings; + LoadState3MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Load State 3"].Bindings; + LoadState4MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Load State 4"].Bindings; + LoadState5MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Load State 5"].Bindings; + LoadState6MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Load State 6"].Bindings; + LoadState7MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Load State 7"].Bindings; + LoadState8MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Load State 8"].Bindings; + LoadState9MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Load State 9"].Bindings; + LoadState0MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Load State 0"].Bindings; + LoadNamedStateMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Load Named State"].Bindings; - AutoloadLastSlotMenuItem.Checked = Global.Config.AutoLoadLastSaveSlot; + AutoloadLastSlotMenuItem.Checked = Config.AutoLoadLastSaveSlot; LoadState1MenuItem.Enabled = _stateSlots.HasSlot(1); LoadState2MenuItem.Enabled = _stateSlots.HasSlot(2); @@ -167,20 +167,20 @@ namespace BizHawk.Client.EmuHawk private void SaveSlotSubMenu_DropDownOpened(object sender, EventArgs e) { - SelectSlot0MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Select State 0"].Bindings; - SelectSlot1MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Select State 1"].Bindings; - SelectSlot2MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Select State 2"].Bindings; - SelectSlot3MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Select State 3"].Bindings; - SelectSlot4MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Select State 4"].Bindings; - SelectSlot5MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Select State 5"].Bindings; - SelectSlot6MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Select State 6"].Bindings; - SelectSlot7MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Select State 7"].Bindings; - SelectSlot8MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Select State 8"].Bindings; - SelectSlot9MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Select State 9"].Bindings; - PreviousSlotMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Previous Slot"].Bindings; - NextSlotMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Next Slot"].Bindings; - SaveToCurrentSlotMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Quick Save"].Bindings; - LoadCurrentSlotMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Quick Load"].Bindings; + SelectSlot0MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Select State 0"].Bindings; + SelectSlot1MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Select State 1"].Bindings; + SelectSlot2MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Select State 2"].Bindings; + SelectSlot3MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Select State 3"].Bindings; + SelectSlot4MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Select State 4"].Bindings; + SelectSlot5MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Select State 5"].Bindings; + SelectSlot6MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Select State 6"].Bindings; + SelectSlot7MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Select State 7"].Bindings; + SelectSlot8MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Select State 8"].Bindings; + SelectSlot9MenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Select State 9"].Bindings; + PreviousSlotMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Previous Slot"].Bindings; + NextSlotMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Next Slot"].Bindings; + SaveToCurrentSlotMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Quick Save"].Bindings; + LoadCurrentSlotMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Quick Load"].Bindings; SelectSlot0MenuItem.Checked = false; SelectSlot1MenuItem.Checked = false; @@ -194,7 +194,7 @@ namespace BizHawk.Client.EmuHawk SelectSlot9MenuItem.Checked = false; SelectSlot1MenuItem.Checked = false; - switch (Global.Config.SaveSlot) + switch (Config.SaveSlot) { case 0: SelectSlot0MenuItem.Checked = true; @@ -231,7 +231,7 @@ namespace BizHawk.Client.EmuHawk private void SaveRAMSubMenu_DropDownOpened(object sender, EventArgs e) { - FlushSaveRAMMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Flush SaveRAM"].Bindings; + FlushSaveRAMMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Flush SaveRAM"].Bindings; } private void MovieSubMenu_DropDownOpened(object sender, EventArgs e) @@ -245,46 +245,46 @@ namespace BizHawk.Client.EmuHawk = Global.MovieSession.Movie.IsActive; ReadonlyMenuItem.Checked = Global.MovieSession.ReadOnly; - AutomaticallyBackupMoviesMenuItem.Checked = Global.Config.EnableBackupMovies; - FullMovieLoadstatesMenuItem.Checked = Global.Config.VBAStyleMovieLoadState; + AutomaticallyBackupMoviesMenuItem.Checked = Config.EnableBackupMovies; + FullMovieLoadstatesMenuItem.Checked = Config.VBAStyleMovieLoadState; - ReadonlyMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Toggle read-only"].Bindings; - RecordMovieMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Record Movie"].Bindings; - PlayMovieMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Play Movie"].Bindings; - StopMovieMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Stop Movie"].Bindings; - PlayFromBeginningMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Play from beginning"].Bindings; - SaveMovieMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Save Movie"].Bindings; + ReadonlyMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Toggle read-only"].Bindings; + RecordMovieMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Record Movie"].Bindings; + PlayMovieMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Play Movie"].Bindings; + StopMovieMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Stop Movie"].Bindings; + PlayFromBeginningMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Play from beginning"].Bindings; + SaveMovieMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Save Movie"].Bindings; } private void RecentMovieSubMenu_DropDownOpened(object sender, EventArgs e) { RecentMovieSubMenu.DropDownItems.Clear(); RecentMovieSubMenu.DropDownItems.AddRange( - Global.Config.RecentMovies.RecentMenu(LoadMoviesFromRecent, true)); + Config.RecentMovies.RecentMenu(LoadMoviesFromRecent, true)); } private void MovieEndSubMenu_DropDownOpened(object sender, EventArgs e) { - MovieEndFinishMenuItem.Checked = Global.Config.MovieEndAction == MovieEndAction.Finish; - MovieEndRecordMenuItem.Checked = Global.Config.MovieEndAction == MovieEndAction.Record; - MovieEndStopMenuItem.Checked = Global.Config.MovieEndAction == MovieEndAction.Stop; - MovieEndPauseMenuItem.Checked = Global.Config.MovieEndAction == MovieEndAction.Pause; + MovieEndFinishMenuItem.Checked = Config.MovieEndAction == MovieEndAction.Finish; + MovieEndRecordMenuItem.Checked = Config.MovieEndAction == MovieEndAction.Record; + MovieEndStopMenuItem.Checked = Config.MovieEndAction == MovieEndAction.Stop; + MovieEndPauseMenuItem.Checked = Config.MovieEndAction == MovieEndAction.Pause; // Arguably an IControlMainForm property should be set here, but in reality only Tastudio is ever going to interfere with this logic MovieEndFinishMenuItem.Enabled = MovieEndRecordMenuItem.Enabled = MovieEndStopMenuItem.Enabled = MovieEndPauseMenuItem.Enabled = - !GlobalWin.Tools.Has(); + !Tools.Has(); } private void AVSubMenu_DropDownOpened(object sender, EventArgs e) { - ConfigAndRecordAVMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Record A/V"].Bindings; - StopAVIMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Stop A/V"].Bindings; - CaptureOSDMenuItem.Checked = Global.Config.AVI_CaptureOSD; + ConfigAndRecordAVMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Record A/V"].Bindings; + StopAVIMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Stop A/V"].Bindings; + CaptureOSDMenuItem.Checked = Config.AVI_CaptureOSD; - RecordAVMenuItem.Enabled = !string.IsNullOrEmpty(Global.Config.VideoWriter) && _currAviWriter == null; + RecordAVMenuItem.Enabled = !string.IsNullOrEmpty(Config.VideoWriter) && _currAviWriter == null; if (_currAviWriter == null) { @@ -300,10 +300,10 @@ namespace BizHawk.Client.EmuHawk private void ScreenshotSubMenu_DropDownOpening(object sender, EventArgs e) { - ScreenshotCaptureOSDMenuItem1.Checked = Global.Config.Screenshot_CaptureOSD; - ScreenshotMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Screenshot"].Bindings; - ScreenshotClipboardMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["ScreenshotToClipboard"].Bindings; - ScreenshotClientClipboardMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Screen Client to Clipboard"].Bindings; + ScreenshotCaptureOSDMenuItem1.Checked = Config.Screenshot_CaptureOSD; + ScreenshotMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Screenshot"].Bindings; + ScreenshotClipboardMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["ScreenshotToClipboard"].Bindings; + ScreenshotClientClipboardMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Screen Client to Clipboard"].Bindings; } private void OpenRomMenuItem_Click(object sender, EventArgs e) @@ -323,7 +323,7 @@ namespace BizHawk.Client.EmuHawk { var argsNoGame = new LoadRomArgs { - OpenAdvanced = new OpenAdvanced_LibretroNoGame(Global.Config.LibretroCore) + OpenAdvanced = new OpenAdvanced_LibretroNoGame(Config.LibretroCore) }; LoadRom("", argsNoGame); return; @@ -370,7 +370,7 @@ namespace BizHawk.Client.EmuHawk } var file = new FileInfo(ofd.FileName); - Global.Config.LastRomPath = file.DirectoryName; + Config.LastRomPath = file.DirectoryName; _lastOpenRomFilter = ofd.FilterIndex; /*************************/ @@ -416,21 +416,21 @@ namespace BizHawk.Client.EmuHawk private void AutoloadLastSlotMenuItem_Click(object sender, EventArgs e) { - Global.Config.AutoLoadLastSaveSlot ^= true; + Config.AutoLoadLastSaveSlot ^= true; } private void SelectSlotMenuItems_Click(object sender, EventArgs e) { - if (sender == SelectSlot0MenuItem) Global.Config.SaveSlot = 0; - else if (sender == SelectSlot1MenuItem) Global.Config.SaveSlot = 1; - else if (sender == SelectSlot2MenuItem) Global.Config.SaveSlot = 2; - else if (sender == SelectSlot3MenuItem) Global.Config.SaveSlot = 3; - else if (sender == SelectSlot4MenuItem) Global.Config.SaveSlot = 4; - else if (sender == SelectSlot5MenuItem) Global.Config.SaveSlot = 5; - else if (sender == SelectSlot6MenuItem) Global.Config.SaveSlot = 6; - else if (sender == SelectSlot7MenuItem) Global.Config.SaveSlot = 7; - else if (sender == SelectSlot8MenuItem) Global.Config.SaveSlot = 8; - else if (sender == SelectSlot9MenuItem) Global.Config.SaveSlot = 9; + if (sender == SelectSlot0MenuItem) Config.SaveSlot = 0; + else if (sender == SelectSlot1MenuItem) Config.SaveSlot = 1; + else if (sender == SelectSlot2MenuItem) Config.SaveSlot = 2; + else if (sender == SelectSlot3MenuItem) Config.SaveSlot = 3; + else if (sender == SelectSlot4MenuItem) Config.SaveSlot = 4; + else if (sender == SelectSlot5MenuItem) Config.SaveSlot = 5; + else if (sender == SelectSlot6MenuItem) Config.SaveSlot = 6; + else if (sender == SelectSlot7MenuItem) Config.SaveSlot = 7; + else if (sender == SelectSlot8MenuItem) Config.SaveSlot = 8; + else if (sender == SelectSlot9MenuItem) Config.SaveSlot = 9; UpdateStatusSlots(); SaveSlotSelectedMessage(); @@ -448,12 +448,12 @@ namespace BizHawk.Client.EmuHawk private void SaveToCurrentSlotMenuItem_Click(object sender, EventArgs e) { - SaveQuickSave($"QuickSave{Global.Config.SaveSlot}"); + SaveQuickSave($"QuickSave{Config.SaveSlot}"); } private void LoadCurrentSlotMenuItem_Click(object sender, EventArgs e) { - LoadQuickSave($"QuickSave{Global.Config.SaveSlot}"); + LoadQuickSave($"QuickSave{Config.SaveSlot}"); } private void FlushSaveRAMMenuItem_Click(object sender, EventArgs e) @@ -542,21 +542,21 @@ namespace BizHawk.Client.EmuHawk var file = ToolFormBase.SaveFileDialog( filename, - PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null), + PathManager.MakeAbsolutePath(Config.PathEntries.MoviesPathFragment, null), "Movie Files", Global.MovieSession.Movie.PreferredExtension); if (file != null) { Global.MovieSession.Movie.Filename = file.FullName; - Global.Config.RecentMovies.Add(Global.MovieSession.Movie.Filename); + Config.RecentMovies.Add(Global.MovieSession.Movie.Filename); SaveMovie(); } } private void StopMovieWithoutSavingMenuItem_Click(object sender, EventArgs e) { - if (Global.Config.EnableBackupMovies) + if (Config.EnableBackupMovies) { Global.MovieSession.Movie.SaveBackup(); } @@ -566,32 +566,32 @@ namespace BizHawk.Client.EmuHawk private void AutomaticMovieBackupMenuItem_Click(object sender, EventArgs e) { - Global.Config.EnableBackupMovies ^= true; + Config.EnableBackupMovies ^= true; } private void FullMovieLoadstatesMenuItem_Click(object sender, EventArgs e) { - Global.Config.VBAStyleMovieLoadState ^= true; + Config.VBAStyleMovieLoadState ^= true; } private void MovieEndFinishMenuItem_Click(object sender, EventArgs e) { - Global.Config.MovieEndAction = MovieEndAction.Finish; + Config.MovieEndAction = MovieEndAction.Finish; } private void MovieEndRecordMenuItem_Click(object sender, EventArgs e) { - Global.Config.MovieEndAction = MovieEndAction.Record; + Config.MovieEndAction = MovieEndAction.Record; } private void MovieEndStopMenuItem_Click(object sender, EventArgs e) { - Global.Config.MovieEndAction = MovieEndAction.Stop; + Config.MovieEndAction = MovieEndAction.Stop; } private void MovieEndPauseMenuItem_Click(object sender, EventArgs e) { - Global.Config.MovieEndAction = MovieEndAction.Pause; + Config.MovieEndAction = MovieEndAction.Pause; } private void ConfigAndRecordAVMenuItem_Click(object sender, EventArgs e) @@ -616,7 +616,7 @@ namespace BizHawk.Client.EmuHawk private void CaptureOSDMenuItem_Click(object sender, EventArgs e) { - Global.Config.AVI_CaptureOSD ^= true; + Config.AVI_CaptureOSD ^= true; } private void ScreenshotMenuItem_Click(object sender, EventArgs e) @@ -653,12 +653,12 @@ namespace BizHawk.Client.EmuHawk private void ScreenshotCaptureOSDMenuItem_Click(object sender, EventArgs e) { - Global.Config.Screenshot_CaptureOSD ^= true; + Config.Screenshot_CaptureOSD ^= true; } private void ExitMenuItem_Click(object sender, EventArgs e) { - if (GlobalWin.Tools.AskSave()) + if (Tools.AskSave()) { Close(); } @@ -689,10 +689,10 @@ namespace BizHawk.Client.EmuHawk HardResetMenuItem.Enabled = Emulator.ControllerDefinition.BoolButtons.Contains("Power") && (!Global.MovieSession.Movie.IsPlaying || Global.MovieSession.Movie.IsFinished); - PauseMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Pause"].Bindings; - RebootCoreMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Reboot Core"].Bindings; - SoftResetMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Soft Reset"].Bindings; - HardResetMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Hard Reset"].Bindings; + PauseMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Pause"].Bindings; + RebootCoreMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Reboot Core"].Bindings; + SoftResetMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Soft Reset"].Bindings; + HardResetMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Hard Reset"].Bindings; } private void PauseMenuItem_Click(object sender, EventArgs e) @@ -732,25 +732,25 @@ namespace BizHawk.Client.EmuHawk private void ViewSubMenu_DropDownOpened(object sender, EventArgs e) { - DisplayFPSMenuItem.Checked = Global.Config.DisplayFPS; - DisplayFrameCounterMenuItem.Checked = Global.Config.DisplayFrameCounter; - DisplayLagCounterMenuItem.Checked = Global.Config.DisplayLagCounter; - DisplayInputMenuItem.Checked = Global.Config.DisplayInput; - DisplayRerecordCountMenuItem.Checked = Global.Config.DisplayRerecordCount; - DisplaySubtitlesMenuItem.Checked = Global.Config.DisplaySubtitles; + DisplayFPSMenuItem.Checked = Config.DisplayFPS; + DisplayFrameCounterMenuItem.Checked = Config.DisplayFrameCounter; + DisplayLagCounterMenuItem.Checked = Config.DisplayLagCounter; + DisplayInputMenuItem.Checked = Config.DisplayInput; + DisplayRerecordCountMenuItem.Checked = Config.DisplayRerecordCount; + DisplaySubtitlesMenuItem.Checked = Config.DisplaySubtitles; - DisplayFPSMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Display FPS"].Bindings; - DisplayFrameCounterMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Frame Counter"].Bindings; - DisplayLagCounterMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Lag Counter"].Bindings; - DisplayInputMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Input Display"].Bindings; - SwitchToFullscreenMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Full Screen"].Bindings; + DisplayFPSMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Display FPS"].Bindings; + DisplayFrameCounterMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Frame Counter"].Bindings; + DisplayLagCounterMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Lag Counter"].Bindings; + DisplayInputMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Input Display"].Bindings; + SwitchToFullscreenMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Full Screen"].Bindings; - DisplayStatusBarMenuItem.Checked = Global.Config.DispChrome_StatusBarWindowed; - DisplayLogWindowMenuItem.Checked = Global.Config.ShowLogWindow; + DisplayStatusBarMenuItem.Checked = Config.DispChrome_StatusBarWindowed; + DisplayLogWindowMenuItem.Checked = Config.ShowLogWindow; DisplayLagCounterMenuItem.Enabled = Emulator.CanPollInput(); - DisplayMessagesMenuItem.Checked = Global.Config.DisplayMessages; + DisplayMessagesMenuItem.Checked = Config.DisplayMessages; } private void WindowSizeSubMenu_DropDownOpened(object sender, EventArgs e) @@ -761,7 +761,7 @@ namespace BizHawk.Client.EmuHawk x4MenuItem.Checked = x5MenuItem.Checked = false; - switch (Global.Config.TargetZoomFactors[Emulator.SystemId]) + switch (Config.TargetZoomFactors[Emulator.SystemId]) { case 1: x1MenuItem.Checked = true; @@ -786,12 +786,12 @@ namespace BizHawk.Client.EmuHawk private void WindowSize_Click(object sender, EventArgs e) { - if (sender == x1MenuItem) Global.Config.TargetZoomFactors[Emulator.SystemId] = 1; - if (sender == x2MenuItem) Global.Config.TargetZoomFactors[Emulator.SystemId] = 2; - if (sender == x3MenuItem) Global.Config.TargetZoomFactors[Emulator.SystemId] = 3; - if (sender == x4MenuItem) Global.Config.TargetZoomFactors[Emulator.SystemId] = 4; - if (sender == x5MenuItem) Global.Config.TargetZoomFactors[Emulator.SystemId] = 5; - if (sender == mzMenuItem) Global.Config.TargetZoomFactors[Emulator.SystemId] = 10; + if (sender == x1MenuItem) Config.TargetZoomFactors[Emulator.SystemId] = 1; + if (sender == x2MenuItem) Config.TargetZoomFactors[Emulator.SystemId] = 2; + if (sender == x3MenuItem) Config.TargetZoomFactors[Emulator.SystemId] = 3; + if (sender == x4MenuItem) Config.TargetZoomFactors[Emulator.SystemId] = 4; + if (sender == x5MenuItem) Config.TargetZoomFactors[Emulator.SystemId] = 5; + if (sender == mzMenuItem) Config.TargetZoomFactors[Emulator.SystemId] = 10; FrameBufferResized(); } @@ -823,30 +823,30 @@ namespace BizHawk.Client.EmuHawk private void DisplayRerecordsMenuItem_Click(object sender, EventArgs e) { - Global.Config.DisplayRerecordCount ^= true; + Config.DisplayRerecordCount ^= true; } private void DisplaySubtitlesMenuItem_Click(object sender, EventArgs e) { - Global.Config.DisplaySubtitles ^= true; + Config.DisplaySubtitles ^= true; } private void DisplayStatusBarMenuItem_Click(object sender, EventArgs e) { - Global.Config.DispChrome_StatusBarWindowed ^= true; + Config.DispChrome_StatusBarWindowed ^= true; SetStatusBar(); } private void DisplayMessagesMenuItem_Click(object sender, EventArgs e) { - Global.Config.DisplayMessages ^= true; + Config.DisplayMessages ^= true; } private void DisplayLogWindowMenuItem_Click(object sender, EventArgs e) { - Global.Config.ShowLogWindow ^= true; + Config.ShowLogWindow ^= true; - if (Global.Config.ShowLogWindow) + if (Config.ShowLogWindow) { LogConsole.ShowConsole(); } @@ -868,41 +868,41 @@ namespace BizHawk.Client.EmuHawk private void FrameSkipMenuItem_DropDownOpened(object sender, EventArgs e) { - MinimizeSkippingMenuItem.Checked = Global.Config.AutoMinimizeSkipping; - ClockThrottleMenuItem.Checked = Global.Config.ClockThrottle; - VsyncThrottleMenuItem.Checked = Global.Config.VSyncThrottle; - NeverSkipMenuItem.Checked = Global.Config.FrameSkip == 0; - Frameskip1MenuItem.Checked = Global.Config.FrameSkip == 1; - Frameskip2MenuItem.Checked = Global.Config.FrameSkip == 2; - Frameskip3MenuItem.Checked = Global.Config.FrameSkip == 3; - Frameskip4MenuItem.Checked = Global.Config.FrameSkip == 4; - Frameskip5MenuItem.Checked = Global.Config.FrameSkip == 5; - Frameskip6MenuItem.Checked = Global.Config.FrameSkip == 6; - Frameskip7MenuItem.Checked = Global.Config.FrameSkip == 7; - Frameskip8MenuItem.Checked = Global.Config.FrameSkip == 8; - Frameskip9MenuItem.Checked = Global.Config.FrameSkip == 9; + MinimizeSkippingMenuItem.Checked = Config.AutoMinimizeSkipping; + ClockThrottleMenuItem.Checked = Config.ClockThrottle; + VsyncThrottleMenuItem.Checked = Config.VSyncThrottle; + NeverSkipMenuItem.Checked = Config.FrameSkip == 0; + Frameskip1MenuItem.Checked = Config.FrameSkip == 1; + Frameskip2MenuItem.Checked = Config.FrameSkip == 2; + Frameskip3MenuItem.Checked = Config.FrameSkip == 3; + Frameskip4MenuItem.Checked = Config.FrameSkip == 4; + Frameskip5MenuItem.Checked = Config.FrameSkip == 5; + Frameskip6MenuItem.Checked = Config.FrameSkip == 6; + Frameskip7MenuItem.Checked = Config.FrameSkip == 7; + Frameskip8MenuItem.Checked = Config.FrameSkip == 8; + Frameskip9MenuItem.Checked = Config.FrameSkip == 9; MinimizeSkippingMenuItem.Enabled = !NeverSkipMenuItem.Checked; if (!MinimizeSkippingMenuItem.Enabled) { MinimizeSkippingMenuItem.Checked = true; } - AudioThrottleMenuItem.Enabled = Global.Config.SoundEnabled; - AudioThrottleMenuItem.Checked = Global.Config.SoundThrottle; - VsyncEnabledMenuItem.Checked = Global.Config.VSync; + AudioThrottleMenuItem.Enabled = Config.SoundEnabled; + AudioThrottleMenuItem.Checked = Config.SoundThrottle; + VsyncEnabledMenuItem.Checked = Config.VSync; - Speed100MenuItem.Checked = Global.Config.SpeedPercent == 100; - Speed100MenuItem.Image = (Global.Config.SpeedPercentAlternate == 100) ? Properties.Resources.FastForward : null; - Speed150MenuItem.Checked = Global.Config.SpeedPercent == 150; - Speed150MenuItem.Image = (Global.Config.SpeedPercentAlternate == 150) ? Properties.Resources.FastForward : null; - Speed400MenuItem.Checked = Global.Config.SpeedPercent == 400; - Speed400MenuItem.Image = (Global.Config.SpeedPercentAlternate == 400) ? Properties.Resources.FastForward : null; - Speed200MenuItem.Checked = Global.Config.SpeedPercent == 200; - Speed200MenuItem.Image = (Global.Config.SpeedPercentAlternate == 200) ? Properties.Resources.FastForward : null; - Speed75MenuItem.Checked = Global.Config.SpeedPercent == 75; - Speed75MenuItem.Image = (Global.Config.SpeedPercentAlternate == 75) ? Properties.Resources.FastForward : null; - Speed50MenuItem.Checked = Global.Config.SpeedPercent == 50; - Speed50MenuItem.Image = (Global.Config.SpeedPercentAlternate == 50) ? Properties.Resources.FastForward : null; + Speed100MenuItem.Checked = Config.SpeedPercent == 100; + Speed100MenuItem.Image = (Config.SpeedPercentAlternate == 100) ? Properties.Resources.FastForward : null; + Speed150MenuItem.Checked = Config.SpeedPercent == 150; + Speed150MenuItem.Image = (Config.SpeedPercentAlternate == 150) ? Properties.Resources.FastForward : null; + Speed400MenuItem.Checked = Config.SpeedPercent == 400; + Speed400MenuItem.Image = (Config.SpeedPercentAlternate == 400) ? Properties.Resources.FastForward : null; + Speed200MenuItem.Checked = Config.SpeedPercent == 200; + Speed200MenuItem.Image = (Config.SpeedPercentAlternate == 200) ? Properties.Resources.FastForward : null; + Speed75MenuItem.Checked = Config.SpeedPercent == 75; + Speed75MenuItem.Image = (Config.SpeedPercentAlternate == 75) ? Properties.Resources.FastForward : null; + Speed50MenuItem.Checked = Config.SpeedPercent == 50; + Speed50MenuItem.Image = (Config.SpeedPercentAlternate == 50) ? Properties.Resources.FastForward : null; Speed50MenuItem.Enabled = Speed75MenuItem.Enabled = @@ -910,14 +910,14 @@ namespace BizHawk.Client.EmuHawk Speed150MenuItem.Enabled = Speed200MenuItem.Enabled = Speed400MenuItem.Enabled = - Global.Config.ClockThrottle; + Config.ClockThrottle; miUnthrottled.Checked = _unthrottled; } private void KeyPriorityMenuItem_DropDownOpened(object sender, EventArgs e) { - switch (Global.Config.Input_Hotkey_OverrideOptions) + switch (Config.Input_Hotkey_OverrideOptions) { default: case 0: @@ -940,13 +940,13 @@ namespace BizHawk.Client.EmuHawk private void CoreToolStripMenuItem_DropDownOpened(object sender, EventArgs e) { - quickNESToolStripMenuItem.Checked = Global.Config.NES_InQuickNES; - nesHawkToolStripMenuItem.Checked = !Global.Config.NES_InQuickNES; + quickNESToolStripMenuItem.Checked = Config.NES_InQuickNES; + nesHawkToolStripMenuItem.Checked = !Config.NES_InQuickNES; } private void ControllersMenuItem_Click(object sender, EventArgs e) { - using var controller = new ControllerConfig(Emulator, Global.Config); + using var controller = new ControllerConfig(Emulator, Config); if (controller.ShowDialog().IsOk()) { AddOnScreenMessage("Controller settings saved"); @@ -961,7 +961,7 @@ namespace BizHawk.Client.EmuHawk private void HotkeysMenuItem_Click(object sender, EventArgs e) { - using var hotkeyConfig = new HotkeyConfig(Global.Config); + using var hotkeyConfig = new HotkeyConfig(Config); if (hotkeyConfig.ShowDialog().IsOk()) { AddOnScreenMessage("Hotkey settings saved"); @@ -1000,13 +1000,13 @@ namespace BizHawk.Client.EmuHawk private void PathsMenuItem_Click(object sender, EventArgs e) { - using var form = new PathConfig(Global.Config); + using var form = new PathConfig(Config); form.ShowDialog(); } private void SoundMenuItem_Click(object sender, EventArgs e) { - using var form = new SoundConfig(Global.Config); + using var form = new SoundConfig(Config); if (form.ShowDialog().IsOk()) { RewireSound(); @@ -1015,7 +1015,7 @@ namespace BizHawk.Client.EmuHawk private void AutofireMenuItem_Click(object sender, EventArgs e) { - using var form = new AutofireConfig(Global.Config, Global.AutoFireController, Global.AutofireStickyXORAdapter); + using var form = new AutofireConfig(Config, Global.AutoFireController, Global.AutofireStickyXORAdapter); var result = form.ShowDialog(); AddOnScreenMessage(result.IsOk() ? "Autofire settings saved" @@ -1033,7 +1033,7 @@ namespace BizHawk.Client.EmuHawk private void FileExtensionsMenuItem_Click(object sender, EventArgs e) { - using var form = new FileExtensionPreferences(Global.Config); + using var form = new FileExtensionPreferences(Config); var result = form.ShowDialog(); AddOnScreenMessage(result.IsOk() ? "Rom Extension Preferences changed" @@ -1042,20 +1042,20 @@ namespace BizHawk.Client.EmuHawk private void CustomizeMenuItem_Click(object sender, EventArgs e) { - using var form = new EmuHawkOptions(this, Global.Config); + using var form = new EmuHawkOptions(this, Config); form.ShowDialog(); } private void ProfilesMenuItem_Click(object sender, EventArgs e) { - using var form = new ProfileConfig(this, Emulator, Global.Config); + using var form = new ProfileConfig(this, Emulator, Config); if (form.ShowDialog().IsOk()) { AddOnScreenMessage("Profile settings saved"); // We hide the FirstBoot items since the user setup a Profile // Is it a bad thing to do this constantly? - Global.Config.FirstBoot = false; + Config.FirstBoot = false; ProfileFirstBootLabel.Visible = false; } else @@ -1066,18 +1066,18 @@ namespace BizHawk.Client.EmuHawk private void ClockThrottleMenuItem_Click(object sender, EventArgs e) { - Global.Config.ClockThrottle ^= true; - if (Global.Config.ClockThrottle) + Config.ClockThrottle ^= true; + if (Config.ClockThrottle) { - var old = Global.Config.SoundThrottle; - Global.Config.SoundThrottle = false; + var old = Config.SoundThrottle; + Config.SoundThrottle = false; if (old) { RewireSound(); } - old = Global.Config.VSyncThrottle; - Global.Config.VSyncThrottle = false; + old = Config.VSyncThrottle; + Config.VSyncThrottle = false; if (old) { PresentationPanel.Resized = true; @@ -1089,13 +1089,13 @@ namespace BizHawk.Client.EmuHawk private void AudioThrottleMenuItem_Click(object sender, EventArgs e) { - Global.Config.SoundThrottle ^= true; + Config.SoundThrottle ^= true; RewireSound(); - if (Global.Config.SoundThrottle) + if (Config.SoundThrottle) { - Global.Config.ClockThrottle = false; - var old = Global.Config.VSyncThrottle; - Global.Config.VSyncThrottle = false; + Config.ClockThrottle = false; + var old = Config.VSyncThrottle; + Config.VSyncThrottle = false; if (old) { PresentationPanel.Resized = true; @@ -1107,22 +1107,22 @@ namespace BizHawk.Client.EmuHawk private void VsyncThrottleMenuItem_Click(object sender, EventArgs e) { - Global.Config.VSyncThrottle ^= true; + Config.VSyncThrottle ^= true; PresentationPanel.Resized = true; - if (Global.Config.VSyncThrottle) + if (Config.VSyncThrottle) { - Global.Config.ClockThrottle = false; - var old = Global.Config.SoundThrottle; - Global.Config.SoundThrottle = false; + Config.ClockThrottle = false; + var old = Config.SoundThrottle; + Config.SoundThrottle = false; if (old) { RewireSound(); } } - if (!Global.Config.VSync) + if (!Config.VSync) { - Global.Config.VSync = true; + Config.VSync = true; VsyncMessage(); } @@ -1131,8 +1131,8 @@ namespace BizHawk.Client.EmuHawk private void VsyncEnabledMenuItem_Click(object sender, EventArgs e) { - Global.Config.VSync ^= true; - if (!Global.Config.VSyncThrottle) // when vsync throttle is on, vsync is forced to on, so no change to make here + Config.VSync ^= true; + if (!Config.VSyncThrottle) // when vsync throttle is on, vsync is forced to on, so no change to make here { PresentationPanel.Resized = true; } @@ -1148,19 +1148,19 @@ namespace BizHawk.Client.EmuHawk private void MinimizeSkippingMenuItem_Click(object sender, EventArgs e) { - Global.Config.AutoMinimizeSkipping ^= true; + Config.AutoMinimizeSkipping ^= true; } - private void NeverSkipMenuItem_Click(object sender, EventArgs e) { Global.Config.FrameSkip = 0; FrameSkipMessage(); } - private void Frameskip1MenuItem_Click(object sender, EventArgs e) { Global.Config.FrameSkip = 1; FrameSkipMessage(); } - private void Frameskip2MenuItem_Click(object sender, EventArgs e) { Global.Config.FrameSkip = 2; FrameSkipMessage(); } - private void Frameskip3MenuItem_Click(object sender, EventArgs e) { Global.Config.FrameSkip = 3; FrameSkipMessage(); } - private void Frameskip4MenuItem_Click(object sender, EventArgs e) { Global.Config.FrameSkip = 4; FrameSkipMessage(); } - private void Frameskip5MenuItem_Click(object sender, EventArgs e) { Global.Config.FrameSkip = 5; FrameSkipMessage(); } - private void Frameskip6MenuItem_Click(object sender, EventArgs e) { Global.Config.FrameSkip = 6; FrameSkipMessage(); } - private void Frameskip7MenuItem_Click(object sender, EventArgs e) { Global.Config.FrameSkip = 7; FrameSkipMessage(); } - private void Frameskip8MenuItem_Click(object sender, EventArgs e) { Global.Config.FrameSkip = 8; FrameSkipMessage(); } - private void Frameskip9MenuItem_Click(object sender, EventArgs e) { Global.Config.FrameSkip = 9; FrameSkipMessage(); } + private void NeverSkipMenuItem_Click(object sender, EventArgs e) { Config.FrameSkip = 0; FrameSkipMessage(); } + private void Frameskip1MenuItem_Click(object sender, EventArgs e) { Config.FrameSkip = 1; FrameSkipMessage(); } + private void Frameskip2MenuItem_Click(object sender, EventArgs e) { Config.FrameSkip = 2; FrameSkipMessage(); } + private void Frameskip3MenuItem_Click(object sender, EventArgs e) { Config.FrameSkip = 3; FrameSkipMessage(); } + private void Frameskip4MenuItem_Click(object sender, EventArgs e) { Config.FrameSkip = 4; FrameSkipMessage(); } + private void Frameskip5MenuItem_Click(object sender, EventArgs e) { Config.FrameSkip = 5; FrameSkipMessage(); } + private void Frameskip6MenuItem_Click(object sender, EventArgs e) { Config.FrameSkip = 6; FrameSkipMessage(); } + private void Frameskip7MenuItem_Click(object sender, EventArgs e) { Config.FrameSkip = 7; FrameSkipMessage(); } + private void Frameskip8MenuItem_Click(object sender, EventArgs e) { Config.FrameSkip = 8; FrameSkipMessage(); } + private void Frameskip9MenuItem_Click(object sender, EventArgs e) { Config.FrameSkip = 9; FrameSkipMessage(); } private void Speed50MenuItem_Click(object sender, EventArgs e) { ClickSpeedItem(50); } private void Speed75MenuItem_Click(object sender, EventArgs e) { ClickSpeedItem(75); } @@ -1171,39 +1171,39 @@ namespace BizHawk.Client.EmuHawk private void BothHkAndControllerMenuItem_Click(object sender, EventArgs e) { - Global.Config.Input_Hotkey_OverrideOptions = 0; + Config.Input_Hotkey_OverrideOptions = 0; UpdateKeyPriorityIcon(); } private void InputOverHkMenuItem_Click(object sender, EventArgs e) { - Global.Config.Input_Hotkey_OverrideOptions = 1; + Config.Input_Hotkey_OverrideOptions = 1; UpdateKeyPriorityIcon(); } private void HkOverInputMenuItem_Click(object sender, EventArgs e) { - Global.Config.Input_Hotkey_OverrideOptions = 2; + Config.Input_Hotkey_OverrideOptions = 2; UpdateKeyPriorityIcon(); } private void CoresSubMenu_DropDownOpened(object sender, EventArgs e) { - GBInSGBMenuItem.Checked = Global.Config.GB_AsSGB; - allowGameDBCoreOverridesToolStripMenuItem.Checked = Global.Config.CoreForcingViaGameDB; + GBInSGBMenuItem.Checked = Config.GB_AsSGB; + allowGameDBCoreOverridesToolStripMenuItem.Checked = Config.CoreForcingViaGameDB; } private void NesCoreSubMenu_DropDownOpened(object sender, EventArgs e) { - QuicknesCoreMenuItem.Checked = Global.Config.NES_InQuickNES; - NesCoreMenuItem.Checked = !Global.Config.NES_InQuickNES && !Global.Config.UseSubNESHawk; - SubNesHawkMenuItem.Checked = Global.Config.UseSubNESHawk; + QuicknesCoreMenuItem.Checked = Config.NES_InQuickNES; + NesCoreMenuItem.Checked = !Config.NES_InQuickNES && !Config.UseSubNESHawk; + SubNesHawkMenuItem.Checked = Config.UseSubNESHawk; } private void NesCorePick_Click(object sender, EventArgs e) { - Global.Config.NES_InQuickNES ^= true; - Global.Config.UseSubNESHawk = false; + Config.NES_InQuickNES ^= true; + Config.UseSubNESHawk = false; if (Emulator.SystemId == "NES") { @@ -1213,8 +1213,8 @@ namespace BizHawk.Client.EmuHawk private void SubNesCorePick_Click(object sender, EventArgs e) { - Global.Config.UseSubNESHawk = true; - Global.Config.NES_InQuickNES = false; + Config.UseSubNESHawk = true; + Config.NES_InQuickNES = false; if (!Emulator.IsNull()) { @@ -1224,13 +1224,13 @@ namespace BizHawk.Client.EmuHawk private void CoreSNESSubMenu_DropDownOpened(object sender, EventArgs e) { - Coresnes9xMenuItem.Checked = Global.Config.SNES_InSnes9x; - CorebsnesMenuItem.Checked = !Global.Config.SNES_InSnes9x; + Coresnes9xMenuItem.Checked = Config.SNES_InSnes9x; + CorebsnesMenuItem.Checked = !Config.SNES_InSnes9x; } private void CoreSnesToggle_Click(object sender, EventArgs e) { - Global.Config.SNES_InSnes9x ^= true; + Config.SNES_InSnes9x ^= true; if (Emulator.SystemId == "SNES") { @@ -1240,13 +1240,13 @@ namespace BizHawk.Client.EmuHawk private void GbaCoreSubMenu_DropDownOpened(object sender, EventArgs e) { - VbaNextCoreMenuItem.Checked = !Global.Config.GBA_UsemGBA; - MgbaCoreMenuItem.Checked = Global.Config.GBA_UsemGBA; + VbaNextCoreMenuItem.Checked = !Config.GBA_UsemGBA; + MgbaCoreMenuItem.Checked = Config.GBA_UsemGBA; } private void GbaCorePick_Click(object sender, EventArgs e) { - Global.Config.GBA_UsemGBA ^= true; + Config.GBA_UsemGBA ^= true; if (Emulator.SystemId == "GBA") { FlagNeedsReboot(); @@ -1255,19 +1255,19 @@ namespace BizHawk.Client.EmuHawk private void SGBCoreSubmenu_DropDownOpened(object sender, EventArgs e) { - SgbBsnesMenuItem.Checked = Global.Config.SGB_UseBsnes; - SgbSameBoyMenuItem.Checked = !Global.Config.SGB_UseBsnes; + SgbBsnesMenuItem.Checked = Config.SGB_UseBsnes; + SgbSameBoyMenuItem.Checked = !Config.SGB_UseBsnes; } private void GBCoreSubmenu_DropDownOpened(object sender, EventArgs e) { - GBGambatteMenuItem.Checked = !Global.Config.GB_UseGBHawk; - GBGBHawkMenuItem.Checked = Global.Config.GB_UseGBHawk; + GBGambatteMenuItem.Checked = !Config.GB_UseGBHawk; + GBGBHawkMenuItem.Checked = Config.GB_UseGBHawk; } private void SgbCorePick_Click(object sender, EventArgs e) { - Global.Config.SGB_UseBsnes ^= true; + Config.SGB_UseBsnes ^= true; // TODO: only flag if one of these cores if (!Emulator.IsNull()) { @@ -1277,7 +1277,7 @@ namespace BizHawk.Client.EmuHawk private void GBCorePick_Click(object sender, EventArgs e) { - Global.Config.GB_UseGBHawk ^= true; + Config.GB_UseGBHawk ^= true; // TODO: only flag if one of these cores if (!Emulator.IsNull()) { @@ -1287,7 +1287,7 @@ namespace BizHawk.Client.EmuHawk private void GbInSgbMenuItem_Click(object sender, EventArgs e) { - Global.Config.GB_AsSGB ^= true; + Config.GB_AsSGB ^= true; if (!Emulator.IsNull()) { @@ -1297,7 +1297,7 @@ namespace BizHawk.Client.EmuHawk private void AllowGameDBCoreOverridesToolStripMenuItem_Click(object sender, EventArgs e) { - Global.Config.CoreForcingViaGameDB ^= true; + Config.CoreForcingViaGameDB ^= true; } private void N64VideoPluginSettingsMenuItem_Click(object sender, EventArgs e) @@ -1336,7 +1336,7 @@ namespace BizHawk.Client.EmuHawk private void LoadConfigMenuItem_Click(object sender, EventArgs e) { Global.Config = ConfigService.Load(PathManager.DefaultIniPath); - Global.Config.ResolveDefaults(); + Config.ResolveDefaults(); InitControls(); // rebind hotkeys AddOnScreenMessage($"Config file loaded: {PathManager.DefaultIniPath}"); } @@ -1354,7 +1354,7 @@ namespace BizHawk.Client.EmuHawk if (ofd.ShowHawkDialog().IsOk()) { Global.Config = ConfigService.Load(ofd.FileName); - Global.Config.ResolveDefaults(); + Config.ResolveDefaults(); InitControls(); // rebind hotkeys AddOnScreenMessage($"Config file loaded: {ofd.FileName}"); } @@ -1366,32 +1366,32 @@ namespace BizHawk.Client.EmuHawk private void ToolsSubMenu_DropDownOpened(object sender, EventArgs e) { - ToolBoxMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["ToolBox"].Bindings; - RamWatchMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["RAM Watch"].Bindings; - RamSearchMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["RAM Search"].Bindings; - HexEditorMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Hex Editor"].Bindings; - LuaConsoleMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Lua Console"].Bindings; - CheatsMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Cheats"].Bindings; - TAStudioMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["TAStudio"].Bindings; - VirtualPadMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Virtual Pad"].Bindings; - TraceLoggerMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Trace Logger"].Bindings; - TraceLoggerMenuItem.Enabled = GlobalWin.Tools.IsAvailable(); - CodeDataLoggerMenuItem.Enabled = GlobalWin.Tools.IsAvailable(); + ToolBoxMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["ToolBox"].Bindings; + RamWatchMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["RAM Watch"].Bindings; + RamSearchMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["RAM Search"].Bindings; + HexEditorMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Hex Editor"].Bindings; + LuaConsoleMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Lua Console"].Bindings; + CheatsMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Cheats"].Bindings; + TAStudioMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["TAStudio"].Bindings; + VirtualPadMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Virtual Pad"].Bindings; + TraceLoggerMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Trace Logger"].Bindings; + TraceLoggerMenuItem.Enabled = Tools.IsAvailable(); + CodeDataLoggerMenuItem.Enabled = Tools.IsAvailable(); - TAStudioMenuItem.Enabled = GlobalWin.Tools.IsAvailable(); + TAStudioMenuItem.Enabled = Tools.IsAvailable(); - CheatsMenuItem.Enabled = GlobalWin.Tools.IsAvailable(); - HexEditorMenuItem.Enabled = GlobalWin.Tools.IsAvailable(); - RamSearchMenuItem.Enabled = GlobalWin.Tools.IsAvailable(); - RamWatchMenuItem.Enabled = GlobalWin.Tools.IsAvailable(); + CheatsMenuItem.Enabled = Tools.IsAvailable(); + HexEditorMenuItem.Enabled = Tools.IsAvailable(); + RamSearchMenuItem.Enabled = Tools.IsAvailable(); + RamWatchMenuItem.Enabled = Tools.IsAvailable(); - DebuggerMenuItem.Enabled = GlobalWin.Tools.IsAvailable(); + DebuggerMenuItem.Enabled = Tools.IsAvailable(); batchRunnerToolStripMenuItem.Visible = VersionInfo.DeveloperBuild; - BasicBotMenuItem.Enabled = GlobalWin.Tools.IsAvailable(); + BasicBotMenuItem.Enabled = Tools.IsAvailable(); - gameSharkConverterToolStripMenuItem.Enabled = GlobalWin.Tools.IsAvailable(); + gameSharkConverterToolStripMenuItem.Enabled = Tools.IsAvailable(); } private void ExternalToolToolStripMenuItem_DropDownOpening(object sender, EventArgs e) @@ -1404,7 +1404,7 @@ namespace BizHawk.Client.EmuHawk { item.Click += delegate { - GlobalWin.Tools.Load((string)item.Tag); + Tools.Load((string)item.Tag); }; } else @@ -1423,17 +1423,17 @@ namespace BizHawk.Client.EmuHawk private void ToolBoxMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void RamWatchMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.LoadRamWatch(true); + Tools.LoadRamWatch(true); } private void RamSearchMenuItem_Click(object sender, EventArgs e) { - var ramSearch = GlobalWin.Tools.Load(); + var ramSearch = Tools.Load(); if (OSTailoredCode.IsUnixHost) { // this is apparently needed for weird mono-forms-on-different-thread issues @@ -1456,57 +1456,57 @@ namespace BizHawk.Client.EmuHawk return; } - GlobalWin.Tools.Load(); + Tools.Load(); } private void HexEditorMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void TraceLoggerMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void DebuggerMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void CodeDataLoggerMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void MacroToolMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void VirtualPadMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void BasicBotMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void CheatsMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void CheatCodeConverterMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void MultidiskBundlerMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void BatchRunnerToolStripMenuItem_Click(object sender, EventArgs e) @@ -1521,13 +1521,13 @@ namespace BizHawk.Client.EmuHawk private void QuickNesToolStripMenuItem_Click(object sender, EventArgs e) { - Global.Config.NES_InQuickNES = true; + Config.NES_InQuickNES = true; FlagNeedsReboot(); } private void NesHawkToolStripMenuItem_Click(object sender, EventArgs e) { - Global.Config.NES_InQuickNES = false; + Config.NES_InQuickNES = false; FlagNeedsReboot(); } @@ -1541,16 +1541,16 @@ namespace BizHawk.Client.EmuHawk (Emulator is NES nes && nes.IsVS) || (Emulator is SubNESHawk sub && sub.IsVs); - NESSoundChannelsMenuItem.Enabled = GlobalWin.Tools.IsAvailable(); + NESSoundChannelsMenuItem.Enabled = Tools.IsAvailable(); MovieSettingsMenuItem.Enabled = (Emulator is NES || Emulator is SubNESHawk) && !Global.MovieSession.Movie.IsActive; - NesControllerSettingsMenuItem.Enabled = GlobalWin.Tools.IsAvailable() + NesControllerSettingsMenuItem.Enabled = Tools.IsAvailable() && !Global.MovieSession.Movie.IsActive; barcodeReaderToolStripMenuItem.Enabled = ServiceInjector.IsAvailable(Emulator.ServiceProvider, typeof(BarcodeEntry)); - musicRipperToolStripMenuItem.Enabled = GlobalWin.Tools.IsAvailable(); + musicRipperToolStripMenuItem.Enabled = Tools.IsAvailable(); } private void FdsControlsMenuItem_DropDownOpened(object sender, EventArgs e) @@ -1575,22 +1575,22 @@ namespace BizHawk.Client.EmuHawk private void NesPPUViewerMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void NESNametableViewerMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void MusicRipperMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void NESGameGenieCodesMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.LoadGameGenieEc(); + Tools.LoadGameGenieEc(); } private void NESGraphicSettingsMenuItem_Click(object sender, EventArgs e) @@ -1614,7 +1614,7 @@ namespace BizHawk.Client.EmuHawk private void NESSoundChannelsMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void VsSettingsMenuItem_Click(object sender, EventArgs e) @@ -1714,7 +1714,7 @@ namespace BizHawk.Client.EmuHawk private void BarcodeReaderMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } #endregion @@ -1752,17 +1752,17 @@ namespace BizHawk.Client.EmuHawk private void PceBgViewerMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void PceTileViewerMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void PceSoundDebuggerMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void PCEAlwaysPerformSpriteLimitMenuItem_Click(object sender, EventArgs e) @@ -1963,12 +1963,12 @@ namespace BizHawk.Client.EmuHawk private void GGGameGenieMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.LoadGameGenieEc(); + Tools.LoadGameGenieEc(); } private void SmsVdpViewerMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void SMSControllerStandardToolStripMenuItem_Click(object sender, EventArgs e) @@ -2012,17 +2012,17 @@ namespace BizHawk.Client.EmuHawk private void TI83SubMenu_DropDownOpened(object sender, EventArgs e) { - AutoloadKeypadMenuItem.Checked = Global.Config.TI83autoloadKeyPad; + AutoloadKeypadMenuItem.Checked = Config.TI83autoloadKeyPad; } private void KeypadMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void AutoloadKeypadMenuItem_Click(object sender, EventArgs e) { - Global.Config.TI83autoloadKeyPad ^= true; + Config.TI83autoloadKeyPad ^= true; } private void LoadTIFileMenuItem_Click(object sender, EventArgs e) @@ -2107,7 +2107,7 @@ namespace BizHawk.Client.EmuHawk private void GBSubMenu_DropDownOpened(object sender, EventArgs e) { - LoadGBInSGBMenuItem.Checked = Global.Config.GB_AsSGB; + LoadGBInSGBMenuItem.Checked = Config.GB_AsSGB; } private void GBCoreSettingsMenuItem_Click(object sender, EventArgs e) @@ -2129,17 +2129,17 @@ namespace BizHawk.Client.EmuHawk private void GbGpuViewerMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void GBGameGenieMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.LoadGameGenieEc(); + Tools.LoadGameGenieEc(); } private void GBPrinterViewerMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } #endregion @@ -2153,25 +2153,25 @@ namespace BizHawk.Client.EmuHawk private void GbaGpuViewerMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void UsemGBAMenuItem_Click(object sender, EventArgs e) { - Global.Config.GBA_UsemGBA = true; + Config.GBA_UsemGBA = true; FlagNeedsReboot(); } private void UseVbaNextMenuItem_Click(object sender, EventArgs e) { - Global.Config.GBA_UsemGBA = false; + Config.GBA_UsemGBA = false; FlagNeedsReboot(); } private void GBACoreSelectionSubMenu_DropDownOpened(object sender, EventArgs e) { - GBAmGBAMenuItem.Checked = Global.Config.GBA_UsemGBA; - GBAVBANextMenuItem.Checked = !Global.Config.GBA_UsemGBA; + GBAmGBAMenuItem.Checked = Config.GBA_UsemGBA; + GBAVBANextMenuItem.Checked = !Config.GBA_UsemGBA; } #endregion @@ -2205,7 +2205,7 @@ namespace BizHawk.Client.EmuHawk private void PSXDiscControlsMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load().ScrollToPadSchema("Console"); + Tools.Load().ScrollToPadSchema("Console"); } private void PSXHashDiscsToolStripMenuItem_Click(object sender, EventArgs e) @@ -2223,7 +2223,7 @@ namespace BizHawk.Client.EmuHawk if (((LibsnesCore)Emulator).IsSGB) { SnesGBInSGBMenuItem.Visible = true; - SnesGBInSGBMenuItem.Checked = Global.Config.GB_AsSGB; + SnesGBInSGBMenuItem.Checked = Config.GB_AsSGB; } else { @@ -2244,18 +2244,18 @@ namespace BizHawk.Client.EmuHawk private void SnesGfxDebuggerMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void SnesGbInSgbMenuItem_Click(object sender, EventArgs e) { - Global.Config.GB_AsSGB ^= true; + Config.GB_AsSGB ^= true; FlagNeedsReboot(); } private void SnesGameGenieMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.LoadGameGenieEc(); + Tools.LoadGameGenieEc(); } private void SnesOptionsMenuItem_Click(object sender, EventArgs e) @@ -2317,7 +2317,7 @@ namespace BizHawk.Client.EmuHawk N64ExpansionSlotMenuItem.Enabled = !Global.MovieSession.Movie.IsActive; - N64CircularAnalogRangeMenuItem.Checked = Global.Config.N64UseCircularAnalogConstraint; + N64CircularAnalogRangeMenuItem.Checked = Config.N64UseCircularAnalogConstraint; var s = ((N64)Emulator).GetSettings(); MupenStyleLagMenuItem.Checked = s.UseMupenStyleLag; @@ -2328,7 +2328,7 @@ namespace BizHawk.Client.EmuHawk private void N64PluginSettingsMenuItem_Click(object sender, EventArgs e) { - using var form = new N64VideoPluginConfig(this, Global.Config, Emulator); + using var form = new N64VideoPluginConfig(this, Config, Emulator); if (form.ShowDialog().IsOk()) { if (Emulator.IsNull()) @@ -2357,7 +2357,7 @@ namespace BizHawk.Client.EmuHawk private void N64CircularAnalogRangeMenuItem_Click(object sender, EventArgs e) { - Global.Config.N64UseCircularAnalogConstraint ^= true; + Config.N64UseCircularAnalogConstraint ^= true; } private void MupenStyleLagMenuItem_Click(object sender, EventArgs e) @@ -2454,7 +2454,7 @@ namespace BizHawk.Client.EmuHawk private void GenVdpViewerMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void GenesisSettingsMenuItem_Click(object sender, EventArgs e) @@ -2464,7 +2464,7 @@ namespace BizHawk.Client.EmuHawk private void GenesisGameGenieEcDc_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } #endregion @@ -2905,7 +2905,7 @@ namespace BizHawk.Client.EmuHawk private void FeaturesMenuItem_Click(object sender, EventArgs e) { - GlobalWin.Tools.Load(); + Tools.Load(); } private void AboutMenuItem_Click(object sender, EventArgs e) @@ -2981,8 +2981,8 @@ namespace BizHawk.Client.EmuHawk ContextSeparator_AfterROM.Visible = OpenRomContextMenuItem.Visible || LoadLastRomContextMenuItem.Visible; - LoadLastRomContextMenuItem.Enabled = !Global.Config.RecentRoms.Empty; - LoadLastMovieContextMenuItem.Enabled = !Global.Config.RecentMovies.Empty; + LoadLastRomContextMenuItem.Enabled = !Config.RecentRoms.Empty; + LoadLastMovieContextMenuItem.Enabled = !Config.RecentMovies.Empty; if (Global.MovieSession.Movie.IsActive) { @@ -2998,19 +2998,19 @@ namespace BizHawk.Client.EmuHawk } } - var file = new FileInfo($"{PathManager.SaveStatePrefix(Global.Game)}.QuickSave{Global.Config.SaveSlot}.State.bak"); + var file = new FileInfo($"{PathManager.SaveStatePrefix(Global.Game)}.QuickSave{Config.SaveSlot}.State.bak"); if (file.Exists) { UndoSavestateContextMenuItem.Enabled = true; - if (_stateSlots.IsRedo(Global.Config.SaveSlot)) + if (_stateSlots.IsRedo(Config.SaveSlot)) { - UndoSavestateContextMenuItem.Text = $"Redo Save to slot {Global.Config.SaveSlot}"; + UndoSavestateContextMenuItem.Text = $"Redo Save to slot {Config.SaveSlot}"; UndoSavestateContextMenuItem.Image = Properties.Resources.redo; } else { - UndoSavestateContextMenuItem.Text = $"Undo Save to slot {Global.Config.SaveSlot}"; + UndoSavestateContextMenuItem.Text = $"Undo Save to slot {Config.SaveSlot}"; UndoSavestateContextMenuItem.Image = Properties.Resources.undo; } } @@ -3037,7 +3037,7 @@ namespace BizHawk.Client.EmuHawk SavestateTypeDefaultContextMenuItem.Checked = false; SavestateBinaryContextMenuItem.Checked = false; SavestateTextContextMenuItem.Checked = false; - switch (Global.Config.SaveStateType) + switch (Config.SaveStateType) { case Config.SaveStateTypeE.Binary: SavestateBinaryContextMenuItem.Checked = true; @@ -3053,7 +3053,7 @@ namespace BizHawk.Client.EmuHawk private void DisplayConfigMenuItem_Click(object sender, EventArgs e) { - using var window = new DisplayConfig(Global.Config); + using var window = new DisplayConfig(Config); if (window.ShowDialog().IsOk()) { GlobalWin.DisplayManager.RefreshUserShader(); @@ -3068,12 +3068,12 @@ namespace BizHawk.Client.EmuHawk private void LoadLastRomContextMenuItem_Click(object sender, EventArgs e) { - LoadRomFromRecent(Global.Config.RecentRoms.MostRecent); + LoadRomFromRecent(Config.RecentRoms.MostRecent); } private void LoadLastMovieContextMenuItem_Click(object sender, EventArgs e) { - LoadMoviesFromRecent(Global.Config.RecentMovies.MostRecent); + LoadMoviesFromRecent(Config.RecentMovies.MostRecent); } private void BackupMovieContextMenuItem_Click(object sender, EventArgs e) @@ -3140,8 +3140,8 @@ namespace BizHawk.Client.EmuHawk private void UndoSavestateContextMenuItem_Click(object sender, EventArgs e) { - _stateSlots.SwapBackupSavestate($"{PathManager.SaveStatePrefix(Global.Game)}.QuickSave{Global.Config.SaveSlot}.State"); - AddOnScreenMessage($"Save slot {Global.Config.SaveSlot} restored."); + _stateSlots.SwapBackupSavestate($"{PathManager.SaveStatePrefix(Global.Game)}.QuickSave{Config.SaveSlot}.State"); + AddOnScreenMessage($"Save slot {Config.SaveSlot} restored."); } private void ClearSramContextMenuItem_Click(object sender, EventArgs e) @@ -3199,17 +3199,17 @@ namespace BizHawk.Client.EmuHawk private void KeyPriorityStatusLabel_Click(object sender, EventArgs e) { - switch (Global.Config.Input_Hotkey_OverrideOptions) + switch (Config.Input_Hotkey_OverrideOptions) { default: case 0: - Global.Config.Input_Hotkey_OverrideOptions = 1; + Config.Input_Hotkey_OverrideOptions = 1; break; case 1: - Global.Config.Input_Hotkey_OverrideOptions = 2; + Config.Input_Hotkey_OverrideOptions = 2; break; case 2: - Global.Config.Input_Hotkey_OverrideOptions = 0; + Config.Input_Hotkey_OverrideOptions = 0; break; } @@ -3220,7 +3220,7 @@ namespace BizHawk.Client.EmuHawk { if (CheatStatusButton.Visible) { - GlobalWin.Tools.Load(); + Tools.Load(); } } @@ -3228,9 +3228,9 @@ namespace BizHawk.Client.EmuHawk { // We do not check if the user is actually setting a profile here. // This is intentional. - using var profileForm = new ProfileConfig(this, Emulator, Global.Config); + using var profileForm = new ProfileConfig(this, Emulator, Config); profileForm.ShowDialog(); - Global.Config.FirstBoot = false; + Config.FirstBoot = false; ProfileFirstBootLabel.Visible = false; } @@ -3248,7 +3248,7 @@ namespace BizHawk.Client.EmuHawk { GlobalWin.Sound.StopSound(); DialogResult result = MessageBox.Show(this, - $"Version {Global.Config.Update_LatestVersion} is now available. Would you like to open the BizHawk homepage?\r\n\r\nClick \"No\" to hide the update notification for this version.", + $"Version {Config.Update_LatestVersion} is now available. Would you like to open the BizHawk homepage?\r\n\r\nClick \"No\" to hide the update notification for this version.", "New Version Available", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); GlobalWin.Sound.StartSound(); @@ -3274,7 +3274,7 @@ namespace BizHawk.Client.EmuHawk private void MainForm_Activated(object sender, EventArgs e) { - if (!Global.Config.RunInBackground) + if (!Config.RunInBackground) { if (!_wasPaused) { @@ -3287,7 +3287,7 @@ namespace BizHawk.Client.EmuHawk private void MainForm_Deactivate(object sender, EventArgs e) { - if (!Global.Config.RunInBackground) + if (!Config.RunInBackground) { if (EmulatorPaused) { @@ -3300,7 +3300,7 @@ namespace BizHawk.Client.EmuHawk private void TimerMouseIdle_Tick(object sender, EventArgs e) { - if (_inFullscreen && Global.Config.DispChrome_Fullscreen_AutohideMouse) + if (_inFullscreen && Config.DispChrome_Fullscreen_AutohideMouse) { AutohideCursor(true); } @@ -3324,7 +3324,7 @@ namespace BizHawk.Client.EmuHawk public void MainForm_MouseClick(object sender, MouseEventArgs e) { AutohideCursor(false); - if (Global.Config.ShowContextMenu && e.Button == MouseButtons.Right) + if (Config.ShowContextMenu && e.Button == MouseButtons.Right) { MainFormContextMenu.Show( PointToScreen(new Point(e.X, e.Y + MainformMenu.Height))); @@ -3338,21 +3338,21 @@ namespace BizHawk.Client.EmuHawk private void MainForm_Shown(object sender, EventArgs e) { - if (Emulator is TI83 && Global.Config.TI83autoloadKeyPad) + if (Emulator is TI83 && Config.TI83autoloadKeyPad) { - GlobalWin.Tools.Load(); + Tools.Load(); } - GlobalWin.Tools.AutoLoad(); + Tools.AutoLoad(); - if (Global.Config.RecentWatches.AutoLoad) + if (Config.RecentWatches.AutoLoad) { - GlobalWin.Tools.LoadRamWatch(!Global.Config.DisplayRamWatch); + Tools.LoadRamWatch(!Config.DisplayRamWatch); } - if (Global.Config.RecentCheats.AutoLoad) + if (Config.RecentCheats.AutoLoad) { - GlobalWin.Tools.Load(); + Tools.Load(); } HandlePlatformMenus(); @@ -3367,7 +3367,7 @@ namespace BizHawk.Client.EmuHawk private void MainformMenu_MenuActivate(object sender, EventArgs e) { HandlePlatformMenus(); - if (Global.Config.PauseWhenMenuActivated) + if (Config.PauseWhenMenuActivated) { _wasPaused = EmulatorPaused; _didMenuPause = true; diff --git a/BizHawk.Client.EmuHawk/MainForm.Hotkey.cs b/BizHawk.Client.EmuHawk/MainForm.Hotkey.cs index 95cf0315a8..72d8d7ddd8 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Hotkey.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Hotkey.cs @@ -30,10 +30,10 @@ namespace BizHawk.Client.EmuHawk HardReset(); break; case "Quick Load": - LoadQuickSave($"QuickSave{Global.Config.SaveSlot}"); + LoadQuickSave($"QuickSave{Config.SaveSlot}"); break; case "Quick Save": - SaveQuickSave($"QuickSave{Global.Config.SaveSlot}"); + SaveQuickSave($"QuickSave{Config.SaveSlot}"); break; case "Clear Autohold": ClearAutohold(); @@ -44,7 +44,7 @@ namespace BizHawk.Client.EmuHawk case "Screen Raw to Clipboard": // Ctrl+C clash. any tool that has such acc must check this. // maybe check if mainform has focus instead? - if (GlobalWin.Tools.IsLoaded() && GlobalWin.Tools.Get().ContainsFocus) + if (Tools.IsLoaded() && Tools.Get().ContainsFocus) { break; } @@ -64,7 +64,7 @@ namespace BizHawk.Client.EmuHawk CloseRom(); break; case "Load Last ROM": - LoadRomFromRecent(Global.Config.RecentRoms.MostRecent); + LoadRomFromRecent(Config.RecentRoms.MostRecent); break; case "Flush SaveRAM": FlushSaveRAM(); @@ -125,8 +125,8 @@ namespace BizHawk.Client.EmuHawk RebootCore(); break; case "Toggle Skip Lag Frame": - Global.Config.SkipLagFrame ^= true; - AddOnScreenMessage($"Skip Lag Frames toggled {(Global.Config.SkipLagFrame ? "On" : "Off")}"); + Config.SkipLagFrame ^= true; + AddOnScreenMessage($"Skip Lag Frames toggled {(Config.SkipLagFrame ? "On" : "Off")}"); break; case "Toggle Key Priority": ToggleKeyPriority(); @@ -135,102 +135,102 @@ namespace BizHawk.Client.EmuHawk // Save States case "Save State 0": SaveQuickSave("QuickSave0"); - Global.Config.SaveSlot = 0; + Config.SaveSlot = 0; UpdateStatusSlots(); break; case "Save State 1": SaveQuickSave("QuickSave1"); - Global.Config.SaveSlot = 1; + Config.SaveSlot = 1; UpdateStatusSlots(); break; case "Save State 2": SaveQuickSave("QuickSave2"); - Global.Config.SaveSlot = 2; + Config.SaveSlot = 2; UpdateStatusSlots(); break; case "Save State 3": SaveQuickSave("QuickSave3"); - Global.Config.SaveSlot = 3; + Config.SaveSlot = 3; UpdateStatusSlots(); break; case "Save State 4": SaveQuickSave("QuickSave4"); - Global.Config.SaveSlot = 4; + Config.SaveSlot = 4; UpdateStatusSlots(); break; case "Save State 5": SaveQuickSave("QuickSave5"); - Global.Config.SaveSlot = 5; + Config.SaveSlot = 5; UpdateStatusSlots(); break; case "Save State 6": SaveQuickSave("QuickSave6"); - Global.Config.SaveSlot = 6; + Config.SaveSlot = 6; UpdateStatusSlots(); break; case "Save State 7": SaveQuickSave("QuickSave7"); - Global.Config.SaveSlot = 7; + Config.SaveSlot = 7; UpdateStatusSlots(); break; case "Save State 8": SaveQuickSave("QuickSave8"); - Global.Config.SaveSlot = 8; + Config.SaveSlot = 8; UpdateStatusSlots(); break; case "Save State 9": SaveQuickSave("QuickSave9"); - Global.Config.SaveSlot = 9; + Config.SaveSlot = 9; UpdateStatusSlots(); break; case "Load State 0": LoadQuickSave("QuickSave0"); - Global.Config.SaveSlot = 0; + Config.SaveSlot = 0; UpdateStatusSlots(); break; case "Load State 1": LoadQuickSave("QuickSave1"); - Global.Config.SaveSlot = 1; + Config.SaveSlot = 1; UpdateStatusSlots(); break; case "Load State 2": LoadQuickSave("QuickSave2"); - Global.Config.SaveSlot = 2; + Config.SaveSlot = 2; UpdateStatusSlots(); break; case "Load State 3": LoadQuickSave("QuickSave3"); - Global.Config.SaveSlot = 3; + Config.SaveSlot = 3; UpdateStatusSlots(); break; case "Load State 4": LoadQuickSave("QuickSave4"); - Global.Config.SaveSlot = 4; + Config.SaveSlot = 4; UpdateStatusSlots(); break; case "Load State 5": LoadQuickSave("QuickSave5"); - Global.Config.SaveSlot = 5; + Config.SaveSlot = 5; UpdateStatusSlots(); break; case "Load State 6": LoadQuickSave("QuickSave6"); - Global.Config.SaveSlot = 6; + Config.SaveSlot = 6; UpdateStatusSlots(); break; case "Load State 7": LoadQuickSave("QuickSave7"); - Global.Config.SaveSlot = 7; + Config.SaveSlot = 7; UpdateStatusSlots(); break; case "Load State 8": LoadQuickSave("QuickSave8"); - Global.Config.SaveSlot = 8; + Config.SaveSlot = 8; UpdateStatusSlots(); break; case "Load State 9": LoadQuickSave("QuickSave9"); - Global.Config.SaveSlot = 9; + Config.SaveSlot = 9; UpdateStatusSlots(); break; @@ -317,22 +317,22 @@ namespace BizHawk.Client.EmuHawk // Tools case "RAM Watch": - GlobalWin.Tools.LoadRamWatch(true); + Tools.LoadRamWatch(true); break; case "RAM Search": - GlobalWin.Tools.Load(); + Tools.Load(); break; case "Hex Editor": - GlobalWin.Tools.Load(); + Tools.Load(); break; case "Trace Logger": - GlobalWin.Tools.Load(); + Tools.Load(); break; case "Lua Console": OpenLuaConsole(); break; case "Cheats": - GlobalWin.Tools.Load(); + Tools.Load(); break; case "Toggle All Cheats": if (Global.CheatList.Any()) @@ -357,20 +357,20 @@ namespace BizHawk.Client.EmuHawk break; case "TAStudio": - GlobalWin.Tools.Load(); + Tools.Load(); break; case "ToolBox": - GlobalWin.Tools.Load(); + Tools.Load(); break; case "Virtual Pad": - GlobalWin.Tools.Load(); + Tools.Load(); break; // RAM Search case "Do Search": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.RamSearch.DoSearch(); + Tools.RamSearch.DoSearch(); } else { @@ -379,9 +379,9 @@ namespace BizHawk.Client.EmuHawk break; case "New Search": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.RamSearch.NewSearch(); + Tools.RamSearch.NewSearch(); } else { @@ -390,9 +390,9 @@ namespace BizHawk.Client.EmuHawk break; case "Previous Compare To": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.RamSearch.NextCompareTo(reverse: true); + Tools.RamSearch.NextCompareTo(reverse: true); } else { @@ -401,9 +401,9 @@ namespace BizHawk.Client.EmuHawk break; case "Next Compare To": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.RamSearch.NextCompareTo(); + Tools.RamSearch.NextCompareTo(); } else { @@ -412,9 +412,9 @@ namespace BizHawk.Client.EmuHawk break; case "Previous Operator": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.RamSearch.NextOperator(reverse: true); + Tools.RamSearch.NextOperator(reverse: true); } else { @@ -423,9 +423,9 @@ namespace BizHawk.Client.EmuHawk break; case "Next Operator": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.RamSearch.NextOperator(); + Tools.RamSearch.NextOperator(); } else { @@ -436,9 +436,9 @@ namespace BizHawk.Client.EmuHawk // TAStudio case "Add Branch": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.AddBranchExternal(); + Tools.TAStudio.AddBranchExternal(); } else { @@ -447,9 +447,9 @@ namespace BizHawk.Client.EmuHawk break; case "Delete Branch": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.RemoveBranchExternal(); + Tools.TAStudio.RemoveBranchExternal(); } else { @@ -458,10 +458,10 @@ namespace BizHawk.Client.EmuHawk break; case "Show Cursor": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.SetVisibleIndex(); - GlobalWin.Tools.TAStudio.RefreshDialog(); + Tools.TAStudio.SetVisibleIndex(); + Tools.TAStudio.RefreshDialog(); } else { @@ -470,9 +470,9 @@ namespace BizHawk.Client.EmuHawk break; case "Toggle Follow Cursor": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.TasPlaybackBox.FollowCursor ^= true; + Tools.TAStudio.TasPlaybackBox.FollowCursor ^= true; } else { @@ -481,9 +481,9 @@ namespace BizHawk.Client.EmuHawk break; case "Toggle Auto-Restore": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.TasPlaybackBox.AutoRestore ^= true; + Tools.TAStudio.TasPlaybackBox.AutoRestore ^= true; } else { @@ -492,9 +492,9 @@ namespace BizHawk.Client.EmuHawk break; case "Toggle Turbo Seek": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.TasPlaybackBox.TurboSeek ^= true; + Tools.TAStudio.TasPlaybackBox.TurboSeek ^= true; } else { @@ -503,9 +503,9 @@ namespace BizHawk.Client.EmuHawk break; case "Undo": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.UndoExternal(); + Tools.TAStudio.UndoExternal(); } else { @@ -514,9 +514,9 @@ namespace BizHawk.Client.EmuHawk break; case "Redo": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.RedoExternal(); + Tools.TAStudio.RedoExternal(); } else { @@ -525,9 +525,9 @@ namespace BizHawk.Client.EmuHawk break; case "Select between Markers": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.SelectBetweenMarkersExternal(); + Tools.TAStudio.SelectBetweenMarkersExternal(); } else { @@ -536,9 +536,9 @@ namespace BizHawk.Client.EmuHawk break; case "Select All": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.SelectAllExternal(); + Tools.TAStudio.SelectAllExternal(); } else { @@ -547,9 +547,9 @@ namespace BizHawk.Client.EmuHawk break; case "Reselect Clip.": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.ReselectClipboardExternal(); + Tools.TAStudio.ReselectClipboardExternal(); } else { @@ -558,9 +558,9 @@ namespace BizHawk.Client.EmuHawk break; case "Clear Frames": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.ClearFramesExternal(); + Tools.TAStudio.ClearFramesExternal(); } else { @@ -569,9 +569,9 @@ namespace BizHawk.Client.EmuHawk break; case "Insert Frame": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.InsertFrameExternal(); + Tools.TAStudio.InsertFrameExternal(); } else { @@ -580,9 +580,9 @@ namespace BizHawk.Client.EmuHawk break; case "Insert # Frames": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.InsertNumFramesExternal(); + Tools.TAStudio.InsertNumFramesExternal(); } else { @@ -590,9 +590,9 @@ namespace BizHawk.Client.EmuHawk } break; case "Delete Frames": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.DeleteFramesExternal(); + Tools.TAStudio.DeleteFramesExternal(); } else { @@ -601,9 +601,9 @@ namespace BizHawk.Client.EmuHawk break; case "Clone Frames": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.CloneFramesExternal(); + Tools.TAStudio.CloneFramesExternal(); } else { @@ -612,9 +612,9 @@ namespace BizHawk.Client.EmuHawk break; case "Analog Increment": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.AnalogIncrementByOne(); + Tools.TAStudio.AnalogIncrementByOne(); } else { @@ -623,9 +623,9 @@ namespace BizHawk.Client.EmuHawk break; case "Analog Decrement": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.AnalogDecrementByOne(); + Tools.TAStudio.AnalogDecrementByOne(); } else { @@ -634,9 +634,9 @@ namespace BizHawk.Client.EmuHawk break; case "Analog Incr. by 10": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.AnalogIncrementByTen(); + Tools.TAStudio.AnalogIncrementByTen(); } else { @@ -645,9 +645,9 @@ namespace BizHawk.Client.EmuHawk break; case "Analog Decr. by 10": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.AnalogDecrementByTen(); + Tools.TAStudio.AnalogDecrementByTen(); } else { @@ -656,9 +656,9 @@ namespace BizHawk.Client.EmuHawk break; case "Analog Maximum": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.AnalogMax(); + Tools.TAStudio.AnalogMax(); } else { @@ -667,9 +667,9 @@ namespace BizHawk.Client.EmuHawk break; case "Analog Minimum": - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.AnalogMin(); + Tools.TAStudio.AnalogMin(); } else { @@ -728,28 +728,28 @@ namespace BizHawk.Client.EmuHawk // Analog case "Y Up Small": - GlobalWin.Tools.VirtualPad.BumpAnalogValue(null, Global.Config.Analog_SmallChange); + Tools.VirtualPad.BumpAnalogValue(null, Config.Analog_SmallChange); break; case "Y Up Large": - GlobalWin.Tools.VirtualPad.BumpAnalogValue(null, Global.Config.Analog_LargeChange); + Tools.VirtualPad.BumpAnalogValue(null, Config.Analog_LargeChange); break; case "Y Down Small": - GlobalWin.Tools.VirtualPad.BumpAnalogValue(null, -Global.Config.Analog_SmallChange); + Tools.VirtualPad.BumpAnalogValue(null, -Config.Analog_SmallChange); break; case "Y Down Large": - GlobalWin.Tools.VirtualPad.BumpAnalogValue(null, -Global.Config.Analog_LargeChange); + Tools.VirtualPad.BumpAnalogValue(null, -Config.Analog_LargeChange); break; case "X Up Small": - GlobalWin.Tools.VirtualPad.BumpAnalogValue(Global.Config.Analog_SmallChange, null); + Tools.VirtualPad.BumpAnalogValue(Config.Analog_SmallChange, null); break; case "X Up Large": - GlobalWin.Tools.VirtualPad.BumpAnalogValue(Global.Config.Analog_LargeChange, null); + Tools.VirtualPad.BumpAnalogValue(Config.Analog_LargeChange, null); break; case "X Down Small": - GlobalWin.Tools.VirtualPad.BumpAnalogValue(-Global.Config.Analog_SmallChange, null); + Tools.VirtualPad.BumpAnalogValue(-Config.Analog_SmallChange, null); break; case "X Down Large": - GlobalWin.Tools.VirtualPad.BumpAnalogValue(-Global.Config.Analog_LargeChange, null); + Tools.VirtualPad.BumpAnalogValue(-Config.Analog_LargeChange, null); break; } diff --git a/BizHawk.Client.EmuHawk/MainForm.Movie.cs b/BizHawk.Client.EmuHawk/MainForm.Movie.cs index 354ad3e424..15748cbff1 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Movie.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Movie.cs @@ -34,23 +34,23 @@ namespace BizHawk.Client.EmuHawk if (Global.MovieSession.PreviousNES_InQuickNES.HasValue) { - Global.Config.NES_InQuickNES = Global.MovieSession.PreviousNES_InQuickNES.Value; + Config.NES_InQuickNES = Global.MovieSession.PreviousNES_InQuickNES.Value; Global.MovieSession.PreviousNES_InQuickNES = null; } if (Global.MovieSession.PreviousSNES_InSnes9x.HasValue) { - Global.Config.SNES_InSnes9x = Global.MovieSession.PreviousSNES_InSnes9x.Value; + Config.SNES_InSnes9x = Global.MovieSession.PreviousSNES_InSnes9x.Value; Global.MovieSession.PreviousSNES_InSnes9x = null; } if (Global.MovieSession.PreviousGBA_UsemGBA.HasValue) { - Global.Config.GBA_UsemGBA = Global.MovieSession.PreviousGBA_UsemGBA.Value; + Config.GBA_UsemGBA = Global.MovieSession.PreviousGBA_UsemGBA.Value; Global.MovieSession.PreviousGBA_UsemGBA = null; } - Global.Config.RecentMovies.Add(movie.Filename); + Config.RecentMovies.Add(movie.Filename); if (Emulator.HasSavestates() && movie.StartsFromSavestate) { @@ -85,7 +85,7 @@ namespace BizHawk.Client.EmuHawk SetMainformMovieInfo(); - GlobalWin.Tools.Restart(); + Tools.Restart(); if (Global.MovieSession.Movie.Hash != Global.Game.Hash) diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index ab314dac0c..bcadaecaab 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -57,7 +57,7 @@ namespace BizHawk.Client.EmuHawk _linkCableOn = Properties.Resources.connect_16x16; _linkCableOff = Properties.Resources.noconnect_16x16; UpdateCoreStatusBarButton(); - if (Global.Config.FirstBoot) + if (Config.FirstBoot) { ProfileFirstBootLabel.Visible = true; } @@ -223,7 +223,7 @@ namespace BizHawk.Client.EmuHawk InitializeComponent(); SetImages(); Global.Game = GameInfo.NullInstance; - if (Global.Config.ShowLogWindow) + if (Config.ShowLogWindow) { LogConsole.ShowConsole(); DisplayLogWindowMenuItem.Checked = true; @@ -287,11 +287,11 @@ namespace BizHawk.Client.EmuHawk Closing += (o, e) => { - if (GlobalWin.Tools.AskSave()) + if (Tools.AskSave()) { // zero 03-nov-2015 - close game after other steps. tools might need to unhook themselves from a core. Global.MovieSession.Movie.Stop(); - GlobalWin.Tools.Close(); + Tools.Close(); CloseGame(); // does this need to be last for any particular reason? do tool dialogs persist settings when closing? @@ -349,14 +349,14 @@ namespace BizHawk.Client.EmuHawk catch { string message = "Couldn't initialize sound device! Try changing the output method in Sound config."; - if (Global.Config.SoundOutputMethod == Config.ESoundOutputMethod.DirectSound) + if (Config.SoundOutputMethod == Config.ESoundOutputMethod.DirectSound) { message = "Couldn't initialize DirectSound! Things may go poorly for you. Try changing your sound driver to 44.1khz instead of 48khz in mmsys.cpl."; } MessageBox.Show(message, "Initialization Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - Global.Config.SoundOutputMethod = Config.ESoundOutputMethod.Dummy; + Config.SoundOutputMethod = Config.ESoundOutputMethod.Dummy; GlobalWin.Sound = new Sound(Handle); } @@ -366,19 +366,19 @@ namespace BizHawk.Client.EmuHawk RewireSound(); // Workaround for windows, location is -32000 when minimized, if they close it during this time, that's what gets saved - if (Global.Config.MainWndx == -32000) + if (Config.MainWndx == -32000) { - Global.Config.MainWndx = 0; + Config.MainWndx = 0; } - if (Global.Config.MainWndy == -32000) + if (Config.MainWndy == -32000) { - Global.Config.MainWndy = 0; + Config.MainWndy = 0; } - if (Global.Config.MainWndx != -1 && Global.Config.MainWndy != -1 && Global.Config.SaveWindowPosition) + if (Config.MainWndx != -1 && Config.MainWndy != -1 && Config.SaveWindowPosition) { - Location = new Point(Global.Config.MainWndx, Global.Config.MainWndy); + Location = new Point(Config.MainWndx, Config.MainWndy); } if (_argParser.cmdRom != null) @@ -391,14 +391,14 @@ namespace BizHawk.Client.EmuHawk MessageBox.Show($"Failed to load {_argParser.cmdRom} specified on commandline"); } } - else if (Global.Config.RecentRoms.AutoLoad && !Global.Config.RecentRoms.Empty) + else if (Config.RecentRoms.AutoLoad && !Config.RecentRoms.Empty) { - LoadRomFromRecent(Global.Config.RecentRoms.MostRecent); + LoadRomFromRecent(Config.RecentRoms.MostRecent); } if (_argParser.audiosync.HasValue) { - Global.Config.VideoWriterAudioSync = _argParser.audiosync.Value; + Config.VideoWriterAudioSync = _argParser.audiosync.Value; } if (_argParser.cmdMovie != null) @@ -429,13 +429,13 @@ namespace BizHawk.Client.EmuHawk else { StartNewMovie(movie, false); - Global.Config.RecentMovies.Add(_argParser.cmdMovie); + Config.RecentMovies.Add(_argParser.cmdMovie); } _suppressSyncSettingsWarning = false; } } - else if (Global.Config.RecentMovies.AutoLoad && !Global.Config.RecentMovies.Empty) + else if (Config.RecentMovies.AutoLoad && !Config.RecentMovies.Empty) { if (Global.Game.IsNullInstance()) { @@ -445,18 +445,18 @@ namespace BizHawk.Client.EmuHawk // If user picked a game, then do the autoload logic if (!Global.Game.IsNullInstance()) { - if (File.Exists(Global.Config.RecentMovies.MostRecent)) + if (File.Exists(Config.RecentMovies.MostRecent)) { - StartNewMovie(MovieService.Get(Global.Config.RecentMovies.MostRecent), false); + StartNewMovie(MovieService.Get(Config.RecentMovies.MostRecent), false); } else { - Global.Config.RecentMovies.HandleLoadError(Global.Config.RecentMovies.MostRecent); + Config.RecentMovies.HandleLoadError(Config.RecentMovies.MostRecent); } } } - if (_argParser.startFullscreen || Global.Config.StartFullscreen) + if (_argParser.startFullscreen || Config.StartFullscreen) { _needsFullscreenOnLoad = true; } @@ -471,27 +471,27 @@ namespace BizHawk.Client.EmuHawk { LoadQuickSave($"QuickSave{_argParser.cmdLoadSlot}"); } - else if (Global.Config.AutoLoadLastSaveSlot) + else if (Config.AutoLoadLastSaveSlot) { - LoadQuickSave($"QuickSave{Global.Config.SaveSlot}"); + LoadQuickSave($"QuickSave{Config.SaveSlot}"); } } //start Lua Console if requested in the command line arguments if (_argParser.luaConsole) { - GlobalWin.Tools.Load(); + Tools.Load(); } //load Lua Script if requested in the command line arguments if (_argParser.luaScript != null) { if (OSTailoredCode.IsUnixHost) Console.WriteLine($"The Lua environment can currently only be created on Windows, {_argParser.luaScript} will not be loaded."); - else GlobalWin.Tools.LuaConsole.LoadLuaFile(_argParser.luaScript); + else Tools.LuaConsole.LoadLuaFile(_argParser.luaScript); } SetStatusBar(); - if (Global.Config.StartPaused) + if (Config.StartPaused) { PauseEmulator(); } @@ -555,7 +555,7 @@ namespace BizHawk.Client.EmuHawk Global.ActiveController.LatchFromPhysical(Global.ControllerInputCoalescer); Global.ActiveController.ApplyAxisConstraints( - (Emulator is N64 && Global.Config.N64UseCircularAnalogConstraint) ? "Natural Circle" : null); + (Emulator is N64 && Config.N64UseCircularAnalogConstraint) ? "Natural Circle" : null); Global.ActiveController.OR_FromLogical(Global.ClickyVirtualPadController); Global.AutoFireController.LatchFromPhysical(Global.ControllerInputCoalescer); @@ -573,9 +573,9 @@ namespace BizHawk.Client.EmuHawk // autohold/autofire must not be affected by the following inputs Global.ActiveController.Overrides(Global.ButtonOverrideAdaptor); - if (GlobalWin.Tools.Has() && !SuppressLua) + if (Tools.Has() && !SuppressLua) { - GlobalWin.Tools.LuaConsole.ResumeScripts(false); + Tools.LuaConsole.ResumeScripts(false); } StepRunLoop_Core(); @@ -596,7 +596,7 @@ namespace BizHawk.Client.EmuHawk break; } - if (Global.Config.DispSpeedupFeatures != 0) + if (Config.DispSpeedupFeatures != 0) { Thread.Sleep(0); } @@ -712,15 +712,15 @@ namespace BizHawk.Client.EmuHawk if (value == null) // TODO: make an Event handler instead, but the logic here is that after turbo seeking, tools will want to do a real update when the emulator finally pauses { - bool skipScripts = !(Global.Config.TurboSeek && !Global.Config.RunLuaDuringTurbo && !SuppressLua); - GlobalWin.Tools.UpdateToolsBefore(skipScripts); - GlobalWin.Tools.UpdateToolsAfter(skipScripts); + bool skipScripts = !(Config.TurboSeek && !Config.RunLuaDuringTurbo && !SuppressLua); + Tools.UpdateToolsBefore(skipScripts); + Tools.UpdateToolsAfter(skipScripts); } } } public bool IsSeeking => PauseOnFrame.HasValue; - private bool IsTurboSeeking => PauseOnFrame.HasValue && Global.Config.TurboSeek; + private bool IsTurboSeeking => PauseOnFrame.HasValue && Config.TurboSeek; public bool IsTurboing => Global.ClientControls["Turbo"] || IsTurboSeeking; #endregion @@ -737,9 +737,9 @@ namespace BizHawk.Client.EmuHawk Global.StickyXORAdapter.ClearStickies(); Global.AutofireStickyXORAdapter.ClearStickies(); - if (GlobalWin.Tools.Has()) + if (Tools.Has()) { - GlobalWin.Tools.VirtualPad.ClearVirtualPadHolds(); + Tools.VirtualPad.ClearVirtualPadHolds(); } } @@ -780,16 +780,16 @@ namespace BizHawk.Client.EmuHawk } // if no form is active on this process, then the background input setting applies - if (ActiveForm == null && Global.Config.AcceptBackgroundInput) + if (ActiveForm == null && Config.AcceptBackgroundInput) { - return Global.Config.AcceptBackgroundInputControllerOnly ? Input.AllowInput.OnlyController : Input.AllowInput.All; + return Config.AcceptBackgroundInputControllerOnly ? Input.AllowInput.OnlyController : Input.AllowInput.All; } return Input.AllowInput.None; } - // TODO: make this an actual property, set it when loading a Rom, and pass it dialogs, etc - // This is a quick hack to reduce the dependency on Global.Emulator + // TODO: make these actual properties + // This is a quick hack to reduce the dependency on Globals private IEmulator Emulator { get => Global.Emulator; @@ -806,6 +806,9 @@ namespace BizHawk.Client.EmuHawk private ISoundProvider _currentSoundProvider = new NullSound(44100 / 60); // Reasonable default until we have a core instance + private Config Config => Global.Config; + private ToolManager Tools => GlobalWin.Tools; + protected override void OnActivated(EventArgs e) { base.OnActivated(e); @@ -866,7 +869,7 @@ namespace BizHawk.Client.EmuHawk // adelikat 02-dec-2012 - implemented options for how to handle controller vs hotkey conflicts. This is primarily motivated by computer emulation and thus controller being nearly the entire keyboard bool handled; - switch (Global.Config.Input_Hotkey_OverrideOptions) + switch (Config.Input_Hotkey_OverrideOptions) { default: case 0: // Both allowed @@ -972,9 +975,9 @@ namespace BizHawk.Client.EmuHawk SetPauseStatusBarIcon(); // TODO: have tastudio set a pause status change callback, or take control over pause - if (GlobalWin.Tools.Has()) + if (Tools.Has()) { - GlobalWin.Tools.UpdateValues(); + Tools.UpdateValues(); } } @@ -988,7 +991,7 @@ namespace BizHawk.Client.EmuHawk public void TakeScreenshotToClipboard() { - using (var bb = Global.Config.Screenshot_CaptureOSD ? CaptureOSD() : MakeScreenshotImage()) + using (var bb = Config.Screenshot_CaptureOSD ? CaptureOSD() : MakeScreenshotImage()) { using var img = bb.ToSysdrawingBitmap(); Clipboard.SetImage(img); @@ -999,7 +1002,7 @@ namespace BizHawk.Client.EmuHawk private void TakeScreenshotClientToClipboard() { - using (var bb = GlobalWin.DisplayManager.RenderOffscreen(_currentVideoProvider, Global.Config.Screenshot_CaptureOSD)) + using (var bb = GlobalWin.DisplayManager.RenderOffscreen(_currentVideoProvider, Config.Screenshot_CaptureOSD)) { using var img = bb.ToSysdrawingBitmap(); Clipboard.SetImage(img); @@ -1038,7 +1041,7 @@ namespace BizHawk.Client.EmuHawk fi.Directory.Create(); } - using (var bb = Global.Config.Screenshot_CaptureOSD ? CaptureOSD() : MakeScreenshotImage()) + using (var bb = Config.Screenshot_CaptureOSD ? CaptureOSD() : MakeScreenshotImage()) { using var img = bb.ToSysdrawingBitmap(); img.Save(fi.FullName, ImageFormat.Png); @@ -1056,7 +1059,7 @@ namespace BizHawk.Client.EmuHawk // run this entire thing exactly twice, since the first resize may adjust the menu stacking for (int i = 0; i < 2; i++) { - int zoom = Global.Config.TargetZoomFactors[Emulator.SystemId]; + int zoom = Config.TargetZoomFactors[Emulator.SystemId]; var area = Screen.FromControl(this).WorkingArea; int borderWidth = Size.Width - PresentationPanel.Control.Size.Width; @@ -1103,23 +1106,23 @@ namespace BizHawk.Client.EmuHawk { // TODO - maybe apply a hack tracked during fullscreen here to override it FormBorderStyle = FormBorderStyle.None; - MainMenuStrip.Visible = Global.Config.DispChrome_MenuFullscreen && !_argParser._chromeless; - MainStatusBar.Visible = Global.Config.DispChrome_StatusBarFullscreen && !_argParser._chromeless; + MainMenuStrip.Visible = Config.DispChrome_MenuFullscreen && !_argParser._chromeless; + MainStatusBar.Visible = Config.DispChrome_StatusBarFullscreen && !_argParser._chromeless; } else { - MainStatusBar.Visible = Global.Config.DispChrome_StatusBarWindowed && !_argParser._chromeless; - MainMenuStrip.Visible = Global.Config.DispChrome_MenuWindowed && !_argParser._chromeless; - MaximizeBox = MinimizeBox = Global.Config.DispChrome_CaptionWindowed && !_argParser._chromeless; - if (Global.Config.DispChrome_FrameWindowed == 0 || _argParser._chromeless) + MainStatusBar.Visible = Config.DispChrome_StatusBarWindowed && !_argParser._chromeless; + MainMenuStrip.Visible = Config.DispChrome_MenuWindowed && !_argParser._chromeless; + MaximizeBox = MinimizeBox = Config.DispChrome_CaptionWindowed && !_argParser._chromeless; + if (Config.DispChrome_FrameWindowed == 0 || _argParser._chromeless) { FormBorderStyle = FormBorderStyle.None; } - else if (Global.Config.DispChrome_FrameWindowed == 1) + else if (Config.DispChrome_FrameWindowed == 1) { FormBorderStyle = FormBorderStyle.SizableToolWindow; } - else if (Global.Config.DispChrome_FrameWindowed == 2) + else if (Config.DispChrome_FrameWindowed == 2) { FormBorderStyle = FormBorderStyle.Sizable; } @@ -1151,8 +1154,8 @@ namespace BizHawk.Client.EmuHawk // At any rate, we can solve this by adding a 1px black border around the GL control // Please note: It is important to do this before resizing things, otherwise momentarily a GL control without WS_BORDER will be at the magic dimensions and cause the flakeout if (!OSTailoredCode.IsUnixHost - && Global.Config.DispFullscreenHacks - && Global.Config.DispMethod == Config.EDispMethod.OpenGL) + && Config.DispFullscreenHacks + && Config.DispMethod == Config.EDispMethod.OpenGL) { // ATTENTION: this causes the StatusBar to not work well, since the backcolor is now set to black instead of SystemColors.Control. // It seems that some StatusBar elements composite with the backcolor. @@ -1201,7 +1204,7 @@ namespace BizHawk.Client.EmuHawk private void OpenLuaConsole() { - GlobalWin.Tools.Load(); + Tools.Load(); } public void NotifyLogWindowClosing() @@ -1234,17 +1237,17 @@ namespace BizHawk.Client.EmuHawk private void ThrottleMessage() { string ttype = ":(none)"; - if (Global.Config.SoundThrottle) + if (Config.SoundThrottle) { ttype = ":Sound"; } - if (Global.Config.VSyncThrottle) + if (Config.VSyncThrottle) { - ttype = $":Vsync{(Global.Config.VSync ? "[ena]" : "[dis]")}"; + ttype = $":Vsync{(Config.VSync ? "[ena]" : "[dis]")}"; } - if (Global.Config.ClockThrottle) + if (Config.ClockThrottle) { ttype = ":Clock"; } @@ -1257,7 +1260,7 @@ namespace BizHawk.Client.EmuHawk public void FrameSkipMessage() { - AddOnScreenMessage($"Frameskipping set to {Global.Config.FrameSkip}"); + AddOnScreenMessage($"Frameskipping set to {Config.FrameSkip}"); } public void UpdateCheatStatus() @@ -1398,10 +1401,10 @@ namespace BizHawk.Client.EmuHawk { using var ofd = new OpenFileDialog(); - if (Global.Config.LibretroCore != null) + if (Config.LibretroCore != null) { - ofd.FileName = Path.GetFileName(Global.Config.LibretroCore); - ofd.InitialDirectory = Path.GetDirectoryName(Global.Config.LibretroCore); + ofd.FileName = Path.GetFileName(Config.LibretroCore); + ofd.InitialDirectory = Path.GetDirectoryName(Config.LibretroCore); } else { @@ -1420,7 +1423,7 @@ namespace BizHawk.Client.EmuHawk return false; } - Global.Config.LibretroCore = ofd.FileName; + Config.LibretroCore = ofd.FileName; return true; } @@ -1502,7 +1505,7 @@ namespace BizHawk.Client.EmuHawk { if (!_inFullscreen) { - MainStatusBar.Visible = Global.Config.DispChrome_StatusBarWindowed; + MainStatusBar.Visible = Config.DispChrome_StatusBarWindowed; PerformLayout(); FrameBufferResized(); } @@ -1520,7 +1523,7 @@ namespace BizHawk.Client.EmuHawk } // we need to display FPS somewhere, in this case - if (Global.Config.DispSpeedupFeatures == 0) + if (Config.DispSpeedupFeatures == 0) { str += $"({_lastFps:0} fps) - "; } @@ -1547,7 +1550,7 @@ namespace BizHawk.Client.EmuHawk } } - if (!Global.Config.DispChrome_CaptionWindowed || _argParser._chromeless) + if (!Config.DispChrome_CaptionWindowed || _argParser._chromeless) { str = ""; } @@ -1561,17 +1564,17 @@ namespace BizHawk.Client.EmuHawk AddOnScreenMessage("Autohold keys cleared"); } - private static void UpdateToolsLoadstate() + private void UpdateToolsLoadstate() { - if (GlobalWin.Tools.Has()) + if (Tools.Has()) { - GlobalWin.Tools.SNESGraphicsDebugger.UpdateToolsLoadstate(); + Tools.SNESGraphicsDebugger.UpdateToolsLoadstate(); } } private void UpdateToolsAfter(bool fromLua = false) { - GlobalWin.Tools.UpdateToolsAfter(fromLua); + Tools.UpdateToolsAfter(fromLua); HandleToggleLightAndLink(); } @@ -1647,7 +1650,7 @@ namespace BizHawk.Client.EmuHawk { try // zero says: this is sort of sketchy... but this is no time for rearchitecting { - if (Global.Config.AutosaveSaveRAM) + if (Config.AutosaveSaveRAM) { var saveram = new FileInfo(PathManager.SaveRamPath(Global.Game)); var autosave = new FileInfo(PathManager.AutoSaveRamPath(Global.Game)); @@ -1686,7 +1689,7 @@ namespace BizHawk.Client.EmuHawk } Emulator.AsSaveRam().StoreSaveRam(sram); - AutoFlushSaveRamIn = Global.Config.FlushSaveRamFrames; + AutoFlushSaveRamIn = Config.FlushSaveRamFrames; } catch (IOException) { @@ -1703,7 +1706,7 @@ namespace BizHawk.Client.EmuHawk if (autosave) { path = PathManager.AutoSaveRamPath(Global.Game); - AutoFlushSaveRamIn = Global.Config.FlushSaveRamFrames; + AutoFlushSaveRamIn = Config.FlushSaveRamFrames; } else { @@ -1738,7 +1741,7 @@ namespace BizHawk.Client.EmuHawk if (file.Exists) { - if (Global.Config.BackupSaveram) + if (Config.BackupSaveram) { if (backupFile.Exists) { @@ -1769,7 +1772,7 @@ namespace BizHawk.Client.EmuHawk } else { - bool useAsyncMode = _currentSoundProvider.CanProvideAsync && !Global.Config.SoundThrottle; + bool useAsyncMode = _currentSoundProvider.CanProvideAsync && !Config.SoundThrottle; _currentSoundProvider.SetSyncMode(useAsyncMode ? SyncSoundMode.Async : SyncSoundMode.Sync); GlobalWin.Sound.SetInputPin(_currentSoundProvider); } @@ -1954,10 +1957,10 @@ namespace BizHawk.Client.EmuHawk new ControllerDefinition { Name = "Emulator Frontend Controls", - BoolButtons = Global.Config.HotkeyBindings.Select(x => x.DisplayName).ToList() + BoolButtons = Config.HotkeyBindings.Select(x => x.DisplayName).ToList() }); - foreach (var b in Global.Config.HotkeyBindings) + foreach (var b in Config.HotkeyBindings) { controls.BindMulti(b.DisplayName, b.Bindings); } @@ -1976,7 +1979,7 @@ namespace BizHawk.Client.EmuHawk } else { - Global.Config.RecentMovies.HandleLoadError(path); + Config.RecentMovies.HandleLoadError(path); } } @@ -1994,7 +1997,7 @@ namespace BizHawk.Client.EmuHawk if (!LoadRom(romPath, args)) { - Global.Config.RecentRoms.HandleLoadError(romPath, rom); + Config.RecentRoms.HandleLoadError(romPath, rom); } } @@ -2039,11 +2042,11 @@ namespace BizHawk.Client.EmuHawk var fastForward = Global.ClientControls["Fast Forward"] || FastForward; var turbo = IsTurboing; - int speedPercent = fastForward ? Global.Config.SpeedPercentAlternate : Global.Config.SpeedPercent; + int speedPercent = fastForward ? Config.SpeedPercentAlternate : Config.SpeedPercent; if (rewind) { - speedPercent = Math.Max(speedPercent * Global.Config.RewindSpeedMultiplier / Global.Rewinder.RewindFrequency, 5); + speedPercent = Math.Max(speedPercent * Config.RewindSpeedMultiplier / Global.Rewinder.RewindFrequency, 5); } Global.DisableSecondaryThrottling = _unthrottled || turbo || fastForward || rewind; @@ -2054,20 +2057,20 @@ namespace BizHawk.Client.EmuHawk _throttle.signal_unthrottle = _unthrottled || turbo; // zero 26-mar-2016 - vsync and vsync throttle here both is odd, but see comments elsewhere about triple buffering - _throttle.signal_overrideSecondaryThrottle = (fastForward || rewind) && (Global.Config.SoundThrottle || Global.Config.VSyncThrottle || Global.Config.VSync); + _throttle.signal_overrideSecondaryThrottle = (fastForward || rewind) && (Config.SoundThrottle || Config.VSyncThrottle || Config.VSync); _throttle.SetSpeedPercent(speedPercent); } private void SetSpeedPercentAlternate(int value) { - Global.Config.SpeedPercentAlternate = value; + Config.SpeedPercentAlternate = value; SyncThrottle(); AddOnScreenMessage($"Alternate Speed: {value}%"); } private void SetSpeedPercent(int value) { - Global.Config.SpeedPercent = value; + Config.SpeedPercent = value; SyncThrottle(); AddOnScreenMessage($"Speed: {value}%"); } @@ -2113,7 +2116,7 @@ namespace BizHawk.Client.EmuHawk private void SaveSlotSelectedMessage() { - int slot = Global.Config.SaveSlot; + int slot = Config.SaveSlot; string emptyPart = _stateSlots.HasSlot(slot) ? "" : " (empty)"; string message = $"Slot {slot}{emptyPart} selected."; AddOnScreenMessage(message); @@ -2121,7 +2124,7 @@ namespace BizHawk.Client.EmuHawk private void Render() { - if (Global.Config.DispSpeedupFeatures == 0) + if (Config.DispSpeedupFeatures == 0) { return; } @@ -2319,7 +2322,7 @@ namespace BizHawk.Client.EmuHawk } else { - e.Settings = Global.Config.GetCoreSyncSettings(e.Core); + e.Settings = Config.GetCoreSyncSettings(e.Core); // Only show this nag if the core actually has sync settings, not all cores do if (e.Settings != null && !_suppressSyncSettingsWarning) @@ -2334,13 +2337,13 @@ namespace BizHawk.Client.EmuHawk } else { - e.Settings = Global.Config.GetCoreSyncSettings(e.Core); + e.Settings = Config.GetCoreSyncSettings(e.Core); } } - private static void CoreSettings(object sender, RomLoader.SettingsLoadArgs e) + private void CoreSettings(object sender, RomLoader.SettingsLoadArgs e) { - e.Settings = Global.Config.GetCoreSettings(e.Core); + e.Settings = Config.GetCoreSettings(e.Core); } /// @@ -2374,25 +2377,25 @@ namespace BizHawk.Client.EmuHawk private void SaveConfig(string path = "") { - if (Global.Config.SaveWindowPosition) + if (Config.SaveWindowPosition) { - if (Global.Config.MainWndx != -32000) // When minimized location is -32000, don't save this into the config file! + if (Config.MainWndx != -32000) // When minimized location is -32000, don't save this into the config file! { - Global.Config.MainWndx = Location.X; + Config.MainWndx = Location.X; } - if (Global.Config.MainWndy != -32000) + if (Config.MainWndy != -32000) { - Global.Config.MainWndy = Location.Y; + Config.MainWndy = Location.Y; } } else { - Global.Config.MainWndx = -1; - Global.Config.MainWndy = -1; + Config.MainWndx = -1; + Config.MainWndy = -1; } - if (Global.Config.ShowLogWindow) + if (Config.ShowLogWindow) { LogConsole.SaveConfigSettings(); } @@ -2402,56 +2405,56 @@ namespace BizHawk.Client.EmuHawk path = PathManager.DefaultIniPath; } - ConfigService.Save(path, Global.Config); + ConfigService.Save(path, Config); } - private static void ToggleFps() + private void ToggleFps() { - Global.Config.DisplayFPS ^= true; + Config.DisplayFPS ^= true; } - private static void ToggleFrameCounter() + private void ToggleFrameCounter() { - Global.Config.DisplayFrameCounter ^= true; + Config.DisplayFrameCounter ^= true; } - private static void ToggleLagCounter() + private void ToggleLagCounter() { - Global.Config.DisplayLagCounter ^= true; + Config.DisplayLagCounter ^= true; } - private static void ToggleInputDisplay() + private void ToggleInputDisplay() { - Global.Config.DisplayInput ^= true; + Config.DisplayInput ^= true; } - private static void ToggleSound() + private void ToggleSound() { - Global.Config.SoundEnabled ^= true; + Config.SoundEnabled ^= true; GlobalWin.Sound.StopSound(); GlobalWin.Sound.StartSound(); } private void VolumeUp() { - Global.Config.SoundVolume += 10; - if (Global.Config.SoundVolume > 100) + Config.SoundVolume += 10; + if (Config.SoundVolume > 100) { - Global.Config.SoundVolume = 100; + Config.SoundVolume = 100; } - AddOnScreenMessage($"Volume {Global.Config.SoundVolume}"); + AddOnScreenMessage($"Volume {Config.SoundVolume}"); } private void VolumeDown() { - Global.Config.SoundVolume -= 10; - if (Global.Config.SoundVolume < 0) + Config.SoundVolume -= 10; + if (Config.SoundVolume < 0) { - Global.Config.SoundVolume = 0; + Config.SoundVolume = 0; } - AddOnScreenMessage($"Volume {Global.Config.SoundVolume}"); + AddOnScreenMessage($"Volume {Config.SoundVolume}"); } private void SoftReset() @@ -2483,7 +2486,7 @@ namespace BizHawk.Client.EmuHawk private Color SlotForeColor(int slot) { return _stateSlots.HasSlot(slot) - ? Global.Config.SaveSlot == slot + ? Config.SaveSlot == slot ? SystemColors.HighlightText : SystemColors.WindowText : SystemColors.GrayText; @@ -2491,7 +2494,7 @@ namespace BizHawk.Client.EmuHawk private Color SlotBackColor(int slot) { - return Global.Config.SaveSlot == slot + return Config.SaveSlot == slot ? SystemColors.Highlight : SystemColors.Control; } @@ -2545,55 +2548,55 @@ namespace BizHawk.Client.EmuHawk private void IncreaseWindowSize() { - switch (Global.Config.TargetZoomFactors[Emulator.SystemId]) + switch (Config.TargetZoomFactors[Emulator.SystemId]) { case 1: - Global.Config.TargetZoomFactors[Emulator.SystemId] = 2; + Config.TargetZoomFactors[Emulator.SystemId] = 2; break; case 2: - Global.Config.TargetZoomFactors[Emulator.SystemId] = 3; + Config.TargetZoomFactors[Emulator.SystemId] = 3; break; case 3: - Global.Config.TargetZoomFactors[Emulator.SystemId] = 4; + Config.TargetZoomFactors[Emulator.SystemId] = 4; break; case 4: - Global.Config.TargetZoomFactors[Emulator.SystemId] = 5; + Config.TargetZoomFactors[Emulator.SystemId] = 5; break; case 5: - Global.Config.TargetZoomFactors[Emulator.SystemId] = 10; + Config.TargetZoomFactors[Emulator.SystemId] = 10; break; case 10: return; } - AddOnScreenMessage($"Screensize set to {Global.Config.TargetZoomFactors[Emulator.SystemId]}x"); + AddOnScreenMessage($"Screensize set to {Config.TargetZoomFactors[Emulator.SystemId]}x"); FrameBufferResized(); } private void DecreaseWindowSize() { - switch (Global.Config.TargetZoomFactors[Emulator.SystemId]) + switch (Config.TargetZoomFactors[Emulator.SystemId]) { case 1: return; case 2: - Global.Config.TargetZoomFactors[Emulator.SystemId] = 1; + Config.TargetZoomFactors[Emulator.SystemId] = 1; break; case 3: - Global.Config.TargetZoomFactors[Emulator.SystemId] = 2; + Config.TargetZoomFactors[Emulator.SystemId] = 2; break; case 4: - Global.Config.TargetZoomFactors[Emulator.SystemId] = 3; + Config.TargetZoomFactors[Emulator.SystemId] = 3; break; case 5: - Global.Config.TargetZoomFactors[Emulator.SystemId] = 4; + Config.TargetZoomFactors[Emulator.SystemId] = 4; break; case 10: - Global.Config.TargetZoomFactors[Emulator.SystemId] = 5; + Config.TargetZoomFactors[Emulator.SystemId] = 5; return; } - AddOnScreenMessage($"Screensize set to {Global.Config.TargetZoomFactors[Emulator.SystemId]}x"); + AddOnScreenMessage($"Screensize set to {Config.TargetZoomFactors[Emulator.SystemId]}x"); FrameBufferResized(); } @@ -2601,13 +2604,13 @@ namespace BizHawk.Client.EmuHawk private void IncreaseSpeed() { - if (!Global.Config.ClockThrottle) + if (!Config.ClockThrottle) { AddOnScreenMessage("Unable to change speed, please switch to clock throttle"); return; } - var oldp = Global.Config.SpeedPercent; + var oldp = Config.SpeedPercent; int newp; int i = 0; @@ -2623,13 +2626,13 @@ namespace BizHawk.Client.EmuHawk private void DecreaseSpeed() { - if (!Global.Config.ClockThrottle) + if (!Config.ClockThrottle) { AddOnScreenMessage("Unable to change speed, please switch to clock throttle"); return; } - var oldp = Global.Config.SpeedPercent; + var oldp = Config.SpeedPercent; int newp; int i = _speedPercents.Length - 1; @@ -2702,7 +2705,7 @@ namespace BizHawk.Client.EmuHawk private void UpdateKeyPriorityIcon() { - switch (Global.Config.Input_Hotkey_OverrideOptions) + switch (Config.Input_Hotkey_OverrideOptions) { default: case 0: @@ -2722,19 +2725,19 @@ namespace BizHawk.Client.EmuHawk private void ToggleModePokeMode() { - Global.Config.MoviePlaybackPokeMode ^= true; - AddOnScreenMessage($"Movie Poke mode {(Global.Config.MoviePlaybackPokeMode ? "enabled" : "disabled")}"); + Config.MoviePlaybackPokeMode ^= true; + AddOnScreenMessage($"Movie Poke mode {(Config.MoviePlaybackPokeMode ? "enabled" : "disabled")}"); } private void ToggleBackgroundInput() { - Global.Config.AcceptBackgroundInput ^= true; - AddOnScreenMessage($"Background Input {(Global.Config.AcceptBackgroundInput ? "enabled" : "disabled")}"); + Config.AcceptBackgroundInput ^= true; + AddOnScreenMessage($"Background Input {(Config.AcceptBackgroundInput ? "enabled" : "disabled")}"); } private void VsyncMessage() { - AddOnScreenMessage($"Display Vsync set to {(Global.Config.VSync ? "on" : "off")}"); + AddOnScreenMessage($"Display Vsync set to {(Config.VSync ? "on" : "off")}"); } private static bool StateErrorAskUser(string title, string message) @@ -2825,14 +2828,14 @@ namespace BizHawk.Client.EmuHawk private void ToggleKeyPriority() { - Global.Config.Input_Hotkey_OverrideOptions++; - if (Global.Config.Input_Hotkey_OverrideOptions > 2) + Config.Input_Hotkey_OverrideOptions++; + if (Config.Input_Hotkey_OverrideOptions > 2) { - Global.Config.Input_Hotkey_OverrideOptions = 0; + Config.Input_Hotkey_OverrideOptions = 0; } UpdateKeyPriorityIcon(); - switch (Global.Config.Input_Hotkey_OverrideOptions) + switch (Config.Input_Hotkey_OverrideOptions) { case 0: AddOnScreenMessage("Key priority set to Both Hotkey and Input"); @@ -2892,9 +2895,9 @@ namespace BizHawk.Client.EmuHawk var currentTimestamp = Stopwatch.GetTimestamp(); double frameAdvanceTimestampDeltaMs = (double)(currentTimestamp - _frameAdvanceTimestamp) / Stopwatch.Frequency * 1000.0; - bool frameProgressTimeElapsed = frameAdvanceTimestampDeltaMs >= Global.Config.FrameProgressDelayMs; + bool frameProgressTimeElapsed = frameAdvanceTimestampDeltaMs >= Config.FrameProgressDelayMs; - if (Global.Config.SkipLagFrame && IsLagFrame && frameProgressTimeElapsed && Emulator.Frame > 0) + if (Config.SkipLagFrame && IsLagFrame && frameProgressTimeElapsed && Emulator.Frame > 0) { runFrame = true; } @@ -2963,18 +2966,18 @@ namespace BizHawk.Client.EmuHawk Global.ClickyVirtualPadController.FrameTick(); Global.ButtonOverrideAdaptor.FrameTick(); - if (GlobalWin.Tools.Has() && !SuppressLua) + if (Tools.Has() && !SuppressLua) { - GlobalWin.Tools.LuaConsole.LuaImp.CallFrameBeforeEvent(); + Tools.LuaConsole.LuaImp.CallFrameBeforeEvent(); } if (IsTurboing) { - GlobalWin.Tools.FastUpdateBefore(); + Tools.FastUpdateBefore(); } else { - GlobalWin.Tools.UpdateToolsBefore(); + Tools.UpdateToolsBefore(); } if (!InvisibleEmulation) @@ -2983,15 +2986,15 @@ namespace BizHawk.Client.EmuHawk } // Set volume, if enabled - if (Global.Config.SoundEnabledNormal && !InvisibleEmulation) + if (Config.SoundEnabledNormal && !InvisibleEmulation) { - atten = Global.Config.SoundVolume / 100.0f; + atten = Config.SoundVolume / 100.0f; if (isFastForwardingOrRewinding) { - if (Global.Config.SoundEnabledRWFF) + if (Config.SoundEnabledRWFF) { - atten *= Global.Config.SoundVolumeRWFF / 100.0f; + atten *= Config.SoundVolumeRWFF / 100.0f; } else { @@ -3000,7 +3003,7 @@ namespace BizHawk.Client.EmuHawk } // Mute if using Frame Advance/Frame Progress - if (_runloopFrameAdvance && Global.Config.MuteFrameAdvance) + if (_runloopFrameAdvance && Config.MuteFrameAdvance) { atten = 0; } @@ -3008,7 +3011,7 @@ namespace BizHawk.Client.EmuHawk Global.MovieSession.HandleMovieOnFrameLoop(); - if (Global.Config.AutosaveSaveRAM) + if (Config.AutosaveSaveRAM) { if (AutoFlushSaveRamIn-- <= 0) { @@ -3016,7 +3019,7 @@ namespace BizHawk.Client.EmuHawk } } // why not skip audio if the user doesn't want sound - bool renderSound = (Global.Config.SoundEnabled && !IsTurboing) + bool renderSound = (Config.SoundEnabled && !IsTurboing) || (_currAviWriter?.UsesAudio ?? false); if (!renderSound) { @@ -3040,7 +3043,7 @@ namespace BizHawk.Client.EmuHawk Global.CheatList.Pulse(); - if (IsLagFrame && Global.Config.AutofireLagFrames) + if (IsLagFrame && Config.AutofireLagFrames) { Global.AutoFireController.IncrementStarts(); } @@ -3049,14 +3052,14 @@ namespace BizHawk.Client.EmuHawk PressFrameAdvance = false; - if (GlobalWin.Tools.Has() && !SuppressLua) + if (Tools.Has() && !SuppressLua) { - GlobalWin.Tools.LuaConsole.LuaImp.CallFrameAfterEvent(); + Tools.LuaConsole.LuaImp.CallFrameAfterEvent(); } if (IsTurboing) { - GlobalWin.Tools.FastUpdateAfter(SuppressLua); + Tools.FastUpdateAfter(SuppressLua); } else { @@ -3075,11 +3078,11 @@ namespace BizHawk.Client.EmuHawk UpdateFpsDisplay(currentTimestamp, isRewinding, isFastForwarding); } - if (GlobalWin.Tools.IsLoaded() && - GlobalWin.Tools.TAStudio.LastPositionFrame == Emulator.Frame) + if (Tools.IsLoaded() && + Tools.TAStudio.LastPositionFrame == Emulator.Frame) { if (PauseOnFrame.HasValue && - PauseOnFrame.Value <= GlobalWin.Tools.TAStudio.LastPositionFrame) + PauseOnFrame.Value <= Tools.TAStudio.LastPositionFrame) { TasMovieRecord record = (Global.MovieSession.Movie as TasMovie)[Emulator.Frame]; if (!record.Lagged.HasValue && IsSeeking) @@ -3094,9 +3097,9 @@ namespace BizHawk.Client.EmuHawk if (IsSeeking && Emulator.Frame == PauseOnFrame.Value) { PauseEmulator(); - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.StopSeeking(); + Tools.TAStudio.StopSeeking(); } PauseOnFrame = null; } @@ -3148,7 +3151,7 @@ namespace BizHawk.Client.EmuHawk GlobalWin.OSD.Fps = fpsString; // need to refresh window caption in this case - if (Global.Config.DispSpeedupFeatures == 0) + if (Config.DispSpeedupFeatures == 0) { SetWindowText(); } @@ -3196,12 +3199,12 @@ namespace BizHawk.Client.EmuHawk // select IVideoWriter to use IVideoWriter aw; - if (string.IsNullOrEmpty(videoWriterName) && !string.IsNullOrEmpty(Global.Config.VideoWriter)) + if (string.IsNullOrEmpty(videoWriterName) && !string.IsNullOrEmpty(Config.VideoWriter)) { - videoWriterName = Global.Config.VideoWriter; + videoWriterName = Config.VideoWriter; } - _dumpaudiosync = Global.Config.VideoWriterAudioSync; + _dumpaudiosync = Config.VideoWriterAudioSync; if (unattended && !string.IsNullOrEmpty(videoWriterName)) { aw = VideoWriterInventory.GetVideoWriter(videoWriterName); @@ -3212,7 +3215,7 @@ namespace BizHawk.Client.EmuHawk VideoWriterInventory.GetAllWriters(), this, Emulator, - Global.Config, + Config, out _avwriterResizew, out _avwriterResizeh, out _avwriterpad, @@ -3262,7 +3265,7 @@ namespace BizHawk.Client.EmuHawk { // THIS IS REALLY SLOPPY! // PLEASE REDO ME TO NOT CARE WHICH AVWRITER IS USED! - if (usingAvi && !string.IsNullOrEmpty(Global.Config.AVICodecToken)) + if (usingAvi && !string.IsNullOrEmpty(Config.AVICodecToken)) { aw.SetDefaultVideoCodecToken(); } @@ -3306,12 +3309,12 @@ namespace BizHawk.Client.EmuHawk if (Global.Game != null) { sfd.FileName = $"{PathManager.FilesystemSafeName(Global.Game)}.{ext}"; // don't use Path.ChangeExtension, it might wreck game names with dots in them - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.AvPathFragment, null); + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Config.PathEntries.AvPathFragment, null); } else { sfd.FileName = "NULL"; - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.AvPathFragment, null); + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Config.PathEntries.AvPathFragment, null); } sfd.Filter = string.Format("{0} (*.{0})|*.{0}|All Files|*.*", ext); @@ -3430,7 +3433,7 @@ namespace BizHawk.Client.EmuHawk Bitmap bmpin = null; try { - bbin = Global.Config.AVI_CaptureOSD + bbin = Config.AVI_CaptureOSD ? CaptureOSD() : new BitmapBuffer(_currentVideoProvider.BufferWidth, _currentVideoProvider.BufferHeight, _currentVideoProvider.GetVideoBuffer()); @@ -3464,7 +3467,7 @@ namespace BizHawk.Client.EmuHawk } else { - if (Global.Config.AVI_CaptureOSD) + if (Config.AVI_CaptureOSD) { output = new BitmapBufferVideoProvider(CaptureOSD()); disposableOutput = (IDisposable)output; @@ -3600,7 +3603,7 @@ namespace BizHawk.Client.EmuHawk if (args.OpenAdvanced is OpenAdvanced_OpenRom) { var leftPart = path.Split('|')[0]; - Global.Config.LastRomPath = Path.GetFullPath(Path.GetDirectoryName(leftPart)); + Config.LastRomPath = Path.GetFullPath(Path.GetDirectoryName(leftPart)); } return true; @@ -3635,7 +3638,7 @@ namespace BizHawk.Client.EmuHawk // it is then up to the core itself to override its own local DeterministicEmulation setting bool deterministic = args.Deterministic ?? Global.MovieSession.QueuedMovie != null; - if (!GlobalWin.Tools.AskSave()) + if (!Tools.AskSave()) { return false; } @@ -3675,7 +3678,7 @@ namespace BizHawk.Client.EmuHawk // if it wasn't already specified, use the current default if (ioa_retro.CorePath == null) { - ioa_retro.CorePath = Global.Config.LibretroCore; + ioa_retro.CorePath = Config.LibretroCore; } nextComm.LaunchLibretroCore = ioa_retro.CorePath; @@ -3792,12 +3795,12 @@ namespace BizHawk.Client.EmuHawk // restarts the lua console if a different rom is loaded. // im not really a fan of how this is done.. - if (Global.Config.RecentRoms.Empty || Global.Config.RecentRoms.MostRecent != openAdvancedArgs) + if (Config.RecentRoms.Empty || Config.RecentRoms.MostRecent != openAdvancedArgs) { - GlobalWin.Tools.Restart(); + Tools.Restart(); } - Global.Config.RecentRoms.Add(openAdvancedArgs); + Config.RecentRoms.Add(openAdvancedArgs); JumpLists.AddRecentItem(openAdvancedArgs, ioa.DisplayName); // Don't load Save Ram if a movie is being loaded @@ -3807,16 +3810,16 @@ namespace BizHawk.Client.EmuHawk { LoadSaveRam(); } - else if (Global.Config.AutosaveSaveRAM && File.Exists(PathManager.AutoSaveRamPath(loader.Game))) + else if (Config.AutosaveSaveRAM && File.Exists(PathManager.AutoSaveRamPath(loader.Game))) { AddOnScreenMessage("AutoSaveRAM found, but SaveRAM was not saved"); } } ApiManager.Restart(Emulator.ServiceProvider); - GlobalWin.Tools.Restart(); + Tools.Restart(); - if (Global.Config.LoadCheatFileByGame) + if (Config.LoadCheatFileByGame) { Global.CheatList.SetDefaultFileName(ToolManager.GenerateDefaultCheatFilename()); if (Global.CheatList.AttemptToLoadCheatFile()) @@ -3842,9 +3845,9 @@ namespace BizHawk.Client.EmuHawk RewireSound(); ToolFormBase.UpdateCheatRelatedTools(null, null); - if (Global.Config.AutoLoadLastSaveSlot && _stateSlots.HasSlot(Global.Config.SaveSlot)) + if (Config.AutoLoadLastSaveSlot && _stateSlots.HasSlot(Config.SaveSlot)) { - LoadQuickSave($"QuickSave{Global.Config.SaveSlot}"); + LoadQuickSave($"QuickSave{Config.SaveSlot}"); } if (Global.FirmwareManager.RecentlyServed.Count > 0) @@ -3901,13 +3904,13 @@ namespace BizHawk.Client.EmuHawk if (settable.HasSettings) { - Global.Config.PutCoreSettings(settable.GetSettings(), t); + Config.PutCoreSettings(settable.GetSettings(), t); } if (settable.HasSyncSettings && !Global.MovieSession.Movie.IsActive) { // don't trample config with loaded-from-movie settings - Global.Config.PutCoreSyncSettings(settable.GetSyncSettings(), t); + Config.PutCoreSyncSettings(settable.GetSyncSettings(), t); } } @@ -3951,9 +3954,9 @@ namespace BizHawk.Client.EmuHawk Global.Rewinder.Uninitialize(); - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.Get().Restart(); + Tools.Get().Restart(); } Global.CheatList.SaveOnClose(); @@ -3975,7 +3978,7 @@ namespace BizHawk.Client.EmuHawk { // This gets called after Close Game gets called. // Tested with NESHawk and SMB3 (U) - if (GlobalWin.Tools.AskSave()) + if (Tools.AskSave()) { CloseGame(clearSram); var coreComm = CreateCoreComm(); @@ -3983,7 +3986,7 @@ namespace BizHawk.Client.EmuHawk Emulator = new NullEmulator(coreComm); Global.Game = GameInfo.NullInstance; - GlobalWin.Tools.Restart(); + Tools.Restart(); ApiManager.Restart(Emulator.ServiceProvider); RewireSound(); ClearHolds(); @@ -4014,7 +4017,7 @@ namespace BizHawk.Client.EmuHawk if (start) { StartNewMovie(result.Movie, false); - Global.Config.RecentMovies.Add(result.Movie.Filename); + Config.RecentMovies.Add(result.Movie.Filename); } } @@ -4083,13 +4086,13 @@ namespace BizHawk.Client.EmuHawk GlobalWin.OSD.ClearGuiText(); ClientApi.OnStateLoaded(this, userFriendlyStateName); - if (GlobalWin.Tools.Has()) + if (Tools.Has()) { - GlobalWin.Tools.LuaConsole.LuaImp.CallLoadStateEvent(userFriendlyStateName); + Tools.LuaConsole.LuaImp.CallLoadStateEvent(userFriendlyStateName); } SetMainformMovieInfo(); - GlobalWin.Tools.UpdateToolsBefore(fromLua); + Tools.UpdateToolsBefore(fromLua); UpdateToolsAfter(fromLua); UpdateToolsLoadstate(); Global.AutoFireController.ClearStarts(); @@ -4206,16 +4209,16 @@ namespace BizHawk.Client.EmuHawk } // Make backup first - if (Global.Config.BackupSavestates) + if (Config.BackupSavestates) { Util.TryMoveBackupFile(path, $"{path}.bak"); } SaveState(path, quickSlotName, fromLua, suppressOSD); - if (GlobalWin.Tools.Has()) + if (Tools.Has()) { - GlobalWin.Tools.LuaConsole.LuaImp.CallSaveStateEvent(quickSlotName); + Tools.LuaConsole.LuaImp.CallSaveStateEvent(quickSlotName); } } @@ -4228,9 +4231,9 @@ namespace BizHawk.Client.EmuHawk // allow named state export for tastudio, since it's safe, unlike loading one // todo: make it not save laglog in that case - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.NamedStatePending = true; + Tools.TAStudio.NamedStatePending = true; } if (IsSavestateSlave) @@ -4262,9 +4265,9 @@ namespace BizHawk.Client.EmuHawk SaveState(sfd.FileName, sfd.FileName); } - if (GlobalWin.Tools.IsLoaded()) + if (Tools.IsLoaded()) { - GlobalWin.Tools.TAStudio.NamedStatePending = false; + Tools.TAStudio.NamedStatePending = false; } } @@ -4315,7 +4318,7 @@ namespace BizHawk.Client.EmuHawk } } - Global.Config.SaveSlot = slot; + Config.SaveSlot = slot; SaveSlotSelectedMessage(); UpdateStatusSlots(); } @@ -4334,17 +4337,17 @@ namespace BizHawk.Client.EmuHawk } } - if (Global.Config.SaveSlot == 0) + if (Config.SaveSlot == 0) { - Global.Config.SaveSlot = 9; // Wrap to end of slot list + Config.SaveSlot = 9; // Wrap to end of slot list } - else if (Global.Config.SaveSlot > 9) + else if (Config.SaveSlot > 9) { - Global.Config.SaveSlot = 9; // Meh, just in case + Config.SaveSlot = 9; // Meh, just in case } else { - Global.Config.SaveSlot--; + Config.SaveSlot--; } SaveSlotSelectedMessage(); @@ -4365,17 +4368,17 @@ namespace BizHawk.Client.EmuHawk } } - if (Global.Config.SaveSlot >= 9) + if (Config.SaveSlot >= 9) { - Global.Config.SaveSlot = 0; // Wrap to beginning of slot list + Config.SaveSlot = 0; // Wrap to beginning of slot list } - else if (Global.Config.SaveSlot < 0) + else if (Config.SaveSlot < 0) { - Global.Config.SaveSlot = 0; // Meh, just in case + Config.SaveSlot = 0; // Meh, just in case } else { - Global.Config.SaveSlot++; + Config.SaveSlot++; } SaveSlotSelectedMessage(); @@ -4448,7 +4451,7 @@ namespace BizHawk.Client.EmuHawk else { double timestampDeltaMs = (double)(currentTimestamp - _frameRewindTimestamp) / Stopwatch.Frequency * 1000.0; - isRewinding = timestampDeltaMs >= Global.Config.FrameProgressDelayMs; + isRewinding = timestampDeltaMs >= Config.FrameProgressDelayMs; // clear this flag once we get out of the progress stage if (isRewinding) @@ -4497,7 +4500,7 @@ namespace BizHawk.Client.EmuHawk else { double timestampDeltaMs = (double)(currentTimestamp - _frameRewindTimestamp) / Stopwatch.Frequency * 1000.0; - isRewinding = timestampDeltaMs >= Global.Config.FrameProgressDelayMs; + isRewinding = timestampDeltaMs >= Config.FrameProgressDelayMs; } } else