From 3b120e7184748054721d93c5a2041db857992384 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Mon, 30 Nov 2020 20:17:37 +1000 Subject: [PATCH] Delegate ClientLuaLibrary.GetWindowSize/SetWindowSize to ApiHawk the impls were the same but for getting the global config --- .../tools/Lua/Libraries/ClientLuaLibrary.cs | 21 ++----------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/ClientLuaLibrary.cs b/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/ClientLuaLibrary.cs index fb89e3bd3f..9ca0b21052 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/ClientLuaLibrary.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/ClientLuaLibrary.cs @@ -109,11 +109,7 @@ namespace BizHawk.Client.EmuHawk [LuaMethodExample("local incliget = client.getwindowsize( );")] [LuaMethod("getwindowsize", "Gets the main window's size Possible values are 1, 2, 3, 4, 5, and 10")] - public int GetWindowSize() - { - //TODO delegate to APIs.EmuClient (impl's copy of Emulator is weird) - return GlobalWin.Config.TargetZoomFactors[Emulator.SystemId]; - } + public int GetWindowSize() => APIs.EmuClient.GetWindowSize(); [LuaMethodExample("client.SetGameExtraPadding( 5, 10, 15, 20 );")] [LuaMethod("SetGameExtraPadding", "Sets the extra padding added to the 'emu' surface so that you can draw HUD elements in predictable placements")] @@ -218,20 +214,7 @@ namespace BizHawk.Client.EmuHawk [LuaMethodExample("client.setwindowsize( 100 );")] [LuaMethod("setwindowsize", "Sets the main window's size to the give value. Accepted values are 1, 2, 3, 4, 5, and 10")] - public void SetWindowSize(int size) - { - //TODO delegate to APIs.EmuClient (impl's copy of Emulator is weird) - if (size == 1 || size == 2 || size == 3 || size == 4 || size == 5 || size == 10) - { - GlobalWin.Config.TargetZoomFactors[Emulator.SystemId] = size; - MainForm.FrameBufferResized(); - MainForm.AddOnScreenMessage($"Window size set to {size}x"); - } - else - { - Log("Invalid window size"); - } - } + public void SetWindowSize(int size) => APIs.EmuClient.SetWindowSize(size); [LuaMethodExample("client.speedmode( 75 );")] [LuaMethod("speedmode", "Sets the speed of the emulator (in terms of percent)")]