From db7150642a0385e5a97cc891fb85c2380b4f9ca5 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Sun, 17 Jan 2021 23:35:05 +1000 Subject: [PATCH] Remove ClientApi, deprecated in favour of IEmuClientApi --- src/BizHawk.Client.EmuHawk/Api/ApiManager.cs | 8 +- src/BizHawk.Client.EmuHawk/Api/ClientApi.cs | 208 ------------------- 2 files changed, 2 insertions(+), 214 deletions(-) delete mode 100644 src/BizHawk.Client.EmuHawk/Api/ClientApi.cs diff --git a/src/BizHawk.Client.EmuHawk/Api/ApiManager.cs b/src/BizHawk.Client.EmuHawk/Api/ApiManager.cs index beae1623c7..c11cea8866 100644 --- a/src/BizHawk.Client.EmuHawk/Api/ApiManager.cs +++ b/src/BizHawk.Client.EmuHawk/Api/ApiManager.cs @@ -78,12 +78,8 @@ namespace BizHawk.Client.EmuHawk ToolManager toolManager, Config config, IEmulator emulator, - IGameInfo game) - { - _container = Register(serviceProvider, Console.WriteLine, mainForm, displayManager, inputManager, movieSession, toolManager, config, emulator, game); - ClientApi.EmuClient = _container.EmuClient; - return new BasicApiProvider(_container); - } + IGameInfo game + ) => new BasicApiProvider(_container = Register( serviceProvider, Console.WriteLine, mainForm, displayManager, inputManager, movieSession, toolManager, config, emulator, game)); public static ApiContainer RestartLua( IEmulatorServiceProvider serviceProvider, diff --git a/src/BizHawk.Client.EmuHawk/Api/ClientApi.cs b/src/BizHawk.Client.EmuHawk/Api/ClientApi.cs deleted file mode 100644 index 1363d4eec3..0000000000 --- a/src/BizHawk.Client.EmuHawk/Api/ClientApi.cs +++ /dev/null @@ -1,208 +0,0 @@ -using System; -using System.Drawing; - -using BizHawk.Client.Common; -using BizHawk.Emulation.Common; - -namespace BizHawk.Client.EmuHawk -{ - public static class ClientApi - { - public static IEmuClientApi EmuClient { get; set; } - - /// - public static event BeforeQuickLoadEventHandler BeforeQuickLoad - { - add => EmuClient.BeforeQuickLoad += value; - remove => EmuClient.BeforeQuickLoad -= value; - } - - /// - public static event BeforeQuickSaveEventHandler BeforeQuickSave - { - add => EmuClient.BeforeQuickSave += value; - remove => EmuClient.BeforeQuickSave -= value; - } - - /// - public static event EventHandler RomLoaded - { - add => EmuClient.RomLoaded += value; - remove => EmuClient.RomLoaded -= value; - } - - /// - public static event StateLoadedEventHandler StateLoaded - { - add => EmuClient.StateLoaded += value; - remove => EmuClient.StateLoaded -= value; - } - - /// - public static event StateSavedEventHandler StateSaved - { - add => EmuClient.StateSaved += value; - remove => EmuClient.StateSaved -= value; - } - - /// - public static int BorderHeight() => EmuClient.BorderHeight(); - - /// - public static int BorderWidth() => EmuClient.BorderWidth(); - - /// - public static int BufferHeight() => EmuClient.BufferHeight(); - - /// - public static int BufferWidth() => EmuClient.BufferWidth(); - - /// - public static void ClearAutohold() => EmuClient.ClearAutohold(); - - /// - public static void CloseEmulator() => EmuClient.CloseEmulator(); - - /// - public static void CloseEmulatorWithCode(int exitCode) => EmuClient.CloseEmulator(exitCode); - - /// - public static void CloseRom() => EmuClient.CloseRom(); - - /// - public static void DisplayMessages(bool value) => EmuClient.DisplayMessages(value); - - /// - public static void DoFrameAdvance() => EmuClient.DoFrameAdvance(); - - /// - public static void DoFrameAdvanceAndUnpause() => EmuClient.DoFrameAdvanceAndUnpause(); - - /// - public static void EnableRewind(bool enabled) => EmuClient.EnableRewind(enabled); - - /// - public static void FrameSkip(int numFrames) => EmuClient.FrameSkip(numFrames); - - /// - public static Joypad GetInput(int player) => EmuClient.GetInput(player); - - /// - public static bool GetSoundOn() => EmuClient.GetSoundOn(); - - /// - public static int GetTargetScanlineIntensity() => EmuClient.GetTargetScanlineIntensity(); - - /// - public static int GetWindowSize() => EmuClient.GetWindowSize(); - - /// - public static void InvisibleEmulation(bool invisible) => EmuClient.InvisibleEmulation(invisible); - - /// - public static bool IsPaused() => EmuClient.IsPaused(); - - /// - public static bool IsSeeking() => EmuClient.IsSeeking(); - - /// - public static bool IsTurbo() => EmuClient.IsTurbo(); - - /// - public static void LoadState(string name) => EmuClient.LoadState(name); - - /// - public static void OnBeforeQuickLoad(object sender, string quickSaveSlotName, out bool eventHandled) => EmuClient.OnBeforeQuickLoad(sender, quickSaveSlotName, out eventHandled); - - /// - public static void OnBeforeQuickSave(object sender, string quickSaveSlotName, out bool eventHandled) => EmuClient.OnBeforeQuickSave(sender, quickSaveSlotName, out eventHandled); - - public static void OnRomLoaded(IEmulator emu) {} - - /// - public static void OnStateLoaded(object sender, string stateName) => EmuClient.OnStateLoaded(sender, stateName); - - /// - public static void OnStateSaved(object sender, string stateName) => EmuClient.OnStateSaved(sender, stateName); - - /// - public static void OpenRom(string path) => EmuClient.OpenRom(path); - - /// - public static void Pause() => EmuClient.Pause(); - - /// - public static void PauseAv() => EmuClient.PauseAv(); - - /// - public static void RebootCore() => EmuClient.RebootCore(); - - /// - public static void SaveRam() => EmuClient.SaveRam(); - - /// - public static void SaveState(string name) => EmuClient.SaveState(name); - - /// - public static int ScreenHeight() => EmuClient.ScreenHeight(); - - /// - public static void Screenshot(string path = null) => EmuClient.Screenshot(path); - - /// - public static void ScreenshotToClipboard() => EmuClient.ScreenshotToClipboard(); - - /// - public static int ScreenWidth() => EmuClient.ScreenWidth(); - - /// - public static void SeekFrame(int frame) => EmuClient.SeekFrame(frame); - - /// - public static void SetExtraPadding(int left, int top = 0, int right = 0, int bottom = 0) => EmuClient.SetClientExtraPadding(left, top, right, bottom); - - /// - public static void SetGameExtraPadding(int left, int top = 0, int right = 0, int bottom = 0) => EmuClient.SetGameExtraPadding(left, top, right, bottom); - - /// - public static void SetInput(int player, Joypad joypad) => EmuClient.SetInput(player, joypad); - - /// - public static void SetScreenshotOSD(bool value) => EmuClient.SetScreenshotOSD(value); - - /// - public static void SetSoundOn(bool enable) => EmuClient.SetSoundOn(enable); - - /// - public static void SetTargetScanlineIntensity(int val) => EmuClient.SetTargetScanlineIntensity(val); - - /// - public static void SetWindowSize(int size) => EmuClient.SetWindowSize(size); - - /// - public static void SpeedMode(int percent) => EmuClient.SpeedMode(percent); - - /// - public static void TogglePause() => EmuClient.TogglePause(); - - /// - public static Point TransformPoint(Point point) => EmuClient.TransformPoint(point); - - /// - public static void Unpause() => EmuClient.Unpause(); - - /// - public static void UnpauseAv() => EmuClient.UnpauseAv(); - - /// - public static void UnpauseEmulation() => Unpause(); - - public static void UpdateEmulatorAndVP(IEmulator emu = null) {} - - /// - public static int Xpos() => EmuClient.Xpos(); - - /// - public static int Ypos() => EmuClient.Ypos(); - } -}