lua - fix client library being null on null emulator
This commit is contained in:
parent
4abe3f7932
commit
63ef4125dc
|
@ -21,7 +21,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
[RequiredService]
|
[RequiredService]
|
||||||
private IEmulator Emulator { get; set; }
|
private IEmulator Emulator { get; set; }
|
||||||
|
|
||||||
[RequiredService]
|
[OptionalService]
|
||||||
private IVideoProvider VideoProvider { get; set; }
|
private IVideoProvider VideoProvider { get; set; }
|
||||||
|
|
||||||
public MainForm MainForm { get; set; }
|
public MainForm MainForm { get; set; }
|
||||||
|
@ -68,14 +68,14 @@ namespace BizHawk.Client.EmuHawk
|
||||||
[LuaMethod("bufferheight", "Gets the visible height of the emu display surface (the core video output). This excludes the gameExtraPadding you've set.")]
|
[LuaMethod("bufferheight", "Gets the visible height of the emu display surface (the core video output). This excludes the gameExtraPadding you've set.")]
|
||||||
public int BufferHeight()
|
public int BufferHeight()
|
||||||
{
|
{
|
||||||
return VideoProvider.BufferHeight;
|
return VideoProvider?.BufferHeight ?? NullVideo.Instance.BufferHeight; // TODO: consider exposing the video provider from mainform, so it can decide NullVideo is the correct substitute
|
||||||
}
|
}
|
||||||
|
|
||||||
[LuaMethodExample("local inclibuf = client.bufferwidth( );")]
|
[LuaMethodExample("local inclibuf = client.bufferwidth( );")]
|
||||||
[LuaMethod("bufferwidth", "Gets the visible width of the emu display surface (the core video output). This excludes the gameExtraPadding you've set.")]
|
[LuaMethod("bufferwidth", "Gets the visible width of the emu display surface (the core video output). This excludes the gameExtraPadding you've set.")]
|
||||||
public int BufferWidth()
|
public int BufferWidth()
|
||||||
{
|
{
|
||||||
return VideoProvider.BufferWidth;
|
return VideoProvider?.BufferWidth ?? NullVideo.Instance.BufferWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
[LuaMethodExample("client.clearautohold( );")]
|
[LuaMethodExample("client.clearautohold( );")]
|
||||||
|
|
Loading…
Reference in New Issue