use the Emulator property instead of Global.Emulator in some lua library files

This commit is contained in:
adelikat 2016-12-04 12:37:29 -06:00
parent b11a76f739
commit e99bc9ba41
2 changed files with 8 additions and 7 deletions

View File

@ -16,6 +16,7 @@ namespace BizHawk.Client.EmuHawk
{ {
[RequiredService] [RequiredService]
public IEmulator Emulator { get; set; } public IEmulator Emulator { get; set; }
[RequiredService] [RequiredService]
public IVideoProvider VideoProvider { get; set; } public IVideoProvider VideoProvider { get; set; }
@ -155,9 +156,9 @@ namespace BizHawk.Client.EmuHawk
"getwindowsize", "getwindowsize",
"Gets the main window's size Possible values are 1, 2, 3, 4, 5, and 10" "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( [LuaMethodAttributes(
@ -378,7 +379,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (size == 1 || size == 2 || size == 3 || size == 4 || size == 5 || size == 10) 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.MainForm.FrameBufferResized();
GlobalWin.OSD.AddMessage("Window size set to " + size + "x"); GlobalWin.OSD.AddMessage("Window size set to " + size + "x");
} }

View File

@ -123,8 +123,8 @@ namespace BizHawk.Client.EmuHawk
var g = _luaSurface == null ? Graphics.FromImage(_nullGraphicsBitmap) : _luaSurface.GetGraphics(); 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. //we don't like CoreComm, right? Someone should find a different way to do this then.
var tx = Global.Emulator.CoreComm.ScreenLogicalOffsetX; var tx = Emulator.CoreComm.ScreenLogicalOffsetX;
var ty = Global.Emulator.CoreComm.ScreenLogicalOffsetY; var ty = Emulator.CoreComm.ScreenLogicalOffsetY;
if (tx != 0 || ty != 0) if (tx != 0 || ty != 0)
{ {
var transform = g.Transform; var transform = g.Transform;
@ -706,8 +706,8 @@ namespace BizHawk.Client.EmuHawk
} }
else else
{ {
x -= Global.Emulator.CoreComm.ScreenLogicalOffsetX; x -= Emulator.CoreComm.ScreenLogicalOffsetX;
y -= Global.Emulator.CoreComm.ScreenLogicalOffsetY; y -= Emulator.CoreComm.ScreenLogicalOffsetY;
} }
GlobalWin.OSD.AddGUIText(message, x, y, Color.Black, forecolor ?? Color.White, a); GlobalWin.OSD.AddGUIText(message, x, y, Color.Black, forecolor ?? Color.White, a);