From e99bc9ba413266bf0e8c1fba355f4874196e160f Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 4 Dec 2016 12:37:29 -0600 Subject: [PATCH] use the Emulator property instead of Global.Emulator in some lua library files --- .../tools/Lua/Libraries/EmuLuaLibrary.Client.cs | 7 ++++--- .../tools/Lua/Libraries/EmuLuaLibrary.Gui.cs | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Client.cs b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Client.cs index cfe2846f7f..bd53d0dad2 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Client.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Client.cs @@ -16,6 +16,7 @@ namespace BizHawk.Client.EmuHawk { [RequiredService] public IEmulator Emulator { get; set; } + [RequiredService] public IVideoProvider VideoProvider { get; set; } @@ -155,9 +156,9 @@ namespace BizHawk.Client.EmuHawk "getwindowsize", "Gets the main window's size Possible values are 1, 2, 3, 4, 5, and 10" )] - public static int GetWindowSize() + public int GetWindowSize() { - return Global.Config.TargetZoomFactors[Global.Emulator.SystemId]; + return Global.Config.TargetZoomFactors[Emulator.SystemId]; } [LuaMethodAttributes( @@ -378,7 +379,7 @@ namespace BizHawk.Client.EmuHawk { if (size == 1 || size == 2 || size == 3 || size == 4 || size == 5 || size == 10) { - Global.Config.TargetZoomFactors[Global.Emulator.SystemId] = size; + Global.Config.TargetZoomFactors[Emulator.SystemId] = size; GlobalWin.MainForm.FrameBufferResized(); GlobalWin.OSD.AddMessage("Window size set to " + size + "x"); } diff --git a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Gui.cs b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Gui.cs index b77cae8108..f6e0561790 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Gui.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Gui.cs @@ -123,8 +123,8 @@ namespace BizHawk.Client.EmuHawk var g = _luaSurface == null ? Graphics.FromImage(_nullGraphicsBitmap) : _luaSurface.GetGraphics(); //we don't like CoreComm, right? Someone should find a different way to do this then. - var tx = Global.Emulator.CoreComm.ScreenLogicalOffsetX; - var ty = Global.Emulator.CoreComm.ScreenLogicalOffsetY; + var tx = Emulator.CoreComm.ScreenLogicalOffsetX; + var ty = Emulator.CoreComm.ScreenLogicalOffsetY; if (tx != 0 || ty != 0) { var transform = g.Transform; @@ -706,8 +706,8 @@ namespace BizHawk.Client.EmuHawk } else { - x -= Global.Emulator.CoreComm.ScreenLogicalOffsetX; - y -= Global.Emulator.CoreComm.ScreenLogicalOffsetY; + x -= Emulator.CoreComm.ScreenLogicalOffsetX; + y -= Emulator.CoreComm.ScreenLogicalOffsetY; } GlobalWin.OSD.AddGUIText(message, x, y, Color.Black, forecolor ?? Color.White, a);