Make lua library dependent services private
This commit is contained in:
parent
82ee945782
commit
7f269d25df
|
@ -17,25 +17,25 @@ namespace BizHawk.Client.Common
|
|||
public sealed class EmulatorLuaLibrary : LuaLibraryBase
|
||||
{
|
||||
[RequiredService]
|
||||
public IEmulator Emulator { get; set; }
|
||||
private IEmulator Emulator { get; set; }
|
||||
|
||||
[OptionalService]
|
||||
public IDebuggable DebuggableCore { get; set; }
|
||||
private IDebuggable DebuggableCore { get; set; }
|
||||
|
||||
[OptionalService]
|
||||
public IDisassemblable DisassemblableCore { get; set; }
|
||||
private IDisassemblable DisassemblableCore { get; set; }
|
||||
|
||||
[OptionalService]
|
||||
private IMemoryDomains MemoryDomains { get; set; }
|
||||
|
||||
[OptionalService]
|
||||
public IInputPollable InputPollableCore { get; set; }
|
||||
private IInputPollable InputPollableCore { get; set; }
|
||||
|
||||
[OptionalService]
|
||||
public IRegionable RegionableCore { get; set; }
|
||||
private IRegionable RegionableCore { get; set; }
|
||||
|
||||
[OptionalService]
|
||||
public IBoardInfo BoardInfo { get; set; }
|
||||
private IBoardInfo BoardInfo { get; set; }
|
||||
|
||||
public Action FrameAdvanceCallback { get; set; }
|
||||
public Action YieldCallback { get; set; }
|
||||
|
|
|
@ -14,13 +14,13 @@ namespace BizHawk.Client.Common
|
|||
public sealed class EventLuaLibrary : LuaLibraryBase
|
||||
{
|
||||
[OptionalService]
|
||||
public IInputPollable InputPollableCore { get; set; }
|
||||
private IInputPollable InputPollableCore { get; set; }
|
||||
|
||||
[OptionalService]
|
||||
public IDebuggable DebuggableCore { get; set; }
|
||||
private IDebuggable DebuggableCore { get; set; }
|
||||
|
||||
[RequiredService]
|
||||
public IEmulator Emulator { get; set; }
|
||||
private IEmulator Emulator { get; set; }
|
||||
|
||||
private readonly LuaFunctionList _luaFunctions = new LuaFunctionList();
|
||||
|
||||
|
|
|
@ -7,11 +7,8 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
public sealed class GameInfoLuaLibrary : LuaLibraryBase
|
||||
{
|
||||
[RequiredService]
|
||||
public IEmulator Emulator { get; set; }
|
||||
|
||||
[OptionalService]
|
||||
public IBoardInfo BoardInfo { get; set; }
|
||||
private IBoardInfo BoardInfo { get; set; }
|
||||
|
||||
public GameInfoLuaLibrary(Lua lua)
|
||||
: base(lua) { }
|
||||
|
|
|
@ -21,17 +21,17 @@ namespace BizHawk.Client.Common
|
|||
: base(lua) { }
|
||||
|
||||
[OptionalService]
|
||||
private NES _neshawk { get; set; }
|
||||
private NES Neshawk { get; set; }
|
||||
|
||||
[OptionalService]
|
||||
private QuickNES _quicknes { get; set; }
|
||||
private QuickNES Quicknes { get; set; }
|
||||
|
||||
[OptionalService]
|
||||
private IMemoryDomains _memoryDomains { get; set; }
|
||||
private IMemoryDomains MemoryDomains { get; set; }
|
||||
|
||||
private bool NESAvailable => _neshawk != null || _quicknes != null;
|
||||
private bool NESAvailable => Neshawk != null || Quicknes != null;
|
||||
|
||||
private bool HasMemoryDOmains => _memoryDomains != null;
|
||||
private bool HasMemoryDOmains => MemoryDomains != null;
|
||||
|
||||
public NesLuaLibrary(Lua lua, Action<string> logOutputCallback)
|
||||
: base(lua, logOutputCallback) { }
|
||||
|
@ -46,7 +46,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
var decoder = new NESGameGenieDecoder(code);
|
||||
var watch = Watch.GenerateWatch(
|
||||
_memoryDomains["System Bus"],
|
||||
MemoryDomains["System Bus"],
|
||||
decoder.Address,
|
||||
WatchSize.Byte,
|
||||
DisplayType.Hex,
|
||||
|
@ -64,14 +64,14 @@ namespace BizHawk.Client.Common
|
|||
"getallowmorethaneightsprites", "Gets the NES setting 'Allow more than 8 sprites per scanline' value")]
|
||||
public bool GetAllowMoreThanEightSprites()
|
||||
{
|
||||
if (_quicknes != null)
|
||||
if (Quicknes != null)
|
||||
{
|
||||
return _quicknes.GetSettings().NumSprites != 8;
|
||||
return Quicknes.GetSettings().NumSprites != 8;
|
||||
}
|
||||
|
||||
if (_neshawk != null)
|
||||
if (Neshawk != null)
|
||||
{
|
||||
return _neshawk.GetSettings().AllowMoreThanEightSprites;
|
||||
return Neshawk.GetSettings().AllowMoreThanEightSprites;
|
||||
}
|
||||
|
||||
throw new InvalidOperationException();
|
||||
|
@ -81,16 +81,16 @@ namespace BizHawk.Client.Common
|
|||
"getbottomscanline", "Gets the current value for the bottom scanline value")]
|
||||
public int GetBottomScanline(bool pal = false)
|
||||
{
|
||||
if (_quicknes != null)
|
||||
if (Quicknes != null)
|
||||
{
|
||||
return _quicknes.GetSettings().ClipTopAndBottom ? 231 : 239;
|
||||
return Quicknes.GetSettings().ClipTopAndBottom ? 231 : 239;
|
||||
}
|
||||
|
||||
if (_neshawk != null)
|
||||
if (Neshawk != null)
|
||||
{
|
||||
return pal
|
||||
? _neshawk.GetSettings().PAL_BottomLine
|
||||
: _neshawk.GetSettings().NTSC_BottomLine;
|
||||
? Neshawk.GetSettings().PAL_BottomLine
|
||||
: Neshawk.GetSettings().NTSC_BottomLine;
|
||||
}
|
||||
|
||||
throw new InvalidOperationException();
|
||||
|
@ -100,14 +100,14 @@ namespace BizHawk.Client.Common
|
|||
"getclipleftandright", "Gets the current value for the Clip Left and Right sides option")]
|
||||
public bool GetClipLeftAndRight()
|
||||
{
|
||||
if (_quicknes != null)
|
||||
if (Quicknes != null)
|
||||
{
|
||||
return _quicknes.GetSettings().ClipLeftAndRight;
|
||||
return Quicknes.GetSettings().ClipLeftAndRight;
|
||||
}
|
||||
|
||||
if (_neshawk != null)
|
||||
if (Neshawk != null)
|
||||
{
|
||||
return _neshawk.GetSettings().ClipLeftAndRight;
|
||||
return Neshawk.GetSettings().ClipLeftAndRight;
|
||||
}
|
||||
|
||||
throw new InvalidOperationException();
|
||||
|
@ -117,14 +117,14 @@ namespace BizHawk.Client.Common
|
|||
"getdispbackground", "Indicates whether or not the bg layer is being displayed")]
|
||||
public bool GetDisplayBackground()
|
||||
{
|
||||
if (_quicknes != null)
|
||||
if (Quicknes != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_neshawk != null)
|
||||
if (Neshawk != null)
|
||||
{
|
||||
return _neshawk.GetSettings().DispBackground;
|
||||
return Neshawk.GetSettings().DispBackground;
|
||||
}
|
||||
|
||||
throw new InvalidOperationException();
|
||||
|
@ -134,14 +134,14 @@ namespace BizHawk.Client.Common
|
|||
"getdispsprites", "Indicates whether or not sprites are being displayed")]
|
||||
public bool GetDisplaySprites()
|
||||
{
|
||||
if (_quicknes != null)
|
||||
if (Quicknes != null)
|
||||
{
|
||||
return _quicknes.GetSettings().NumSprites > 0;
|
||||
return Quicknes.GetSettings().NumSprites > 0;
|
||||
}
|
||||
|
||||
if (_neshawk != null)
|
||||
if (Neshawk != null)
|
||||
{
|
||||
return _neshawk.GetSettings().DispSprites;
|
||||
return Neshawk.GetSettings().DispSprites;
|
||||
}
|
||||
|
||||
throw new InvalidOperationException();
|
||||
|
@ -151,16 +151,16 @@ namespace BizHawk.Client.Common
|
|||
"gettopscanline", "Gets the current value for the top scanline value")]
|
||||
public int GetTopScanline(bool pal = false)
|
||||
{
|
||||
if (_quicknes != null)
|
||||
if (Quicknes != null)
|
||||
{
|
||||
return _quicknes.GetSettings().ClipTopAndBottom ? 8 : 0;
|
||||
return Quicknes.GetSettings().ClipTopAndBottom ? 8 : 0;
|
||||
}
|
||||
|
||||
if (_neshawk != null)
|
||||
if (Neshawk != null)
|
||||
{
|
||||
return pal
|
||||
? _neshawk.GetSettings().PAL_TopLine
|
||||
: _neshawk.GetSettings().NTSC_TopLine;
|
||||
? Neshawk.GetSettings().PAL_TopLine
|
||||
: Neshawk.GetSettings().NTSC_TopLine;
|
||||
}
|
||||
|
||||
throw new InvalidOperationException();
|
||||
|
@ -182,17 +182,17 @@ namespace BizHawk.Client.Common
|
|||
"setallowmorethaneightsprites", "Sets the NES setting 'Allow more than 8 sprites per scanline'")]
|
||||
public void SetAllowMoreThanEightSprites(bool allow)
|
||||
{
|
||||
if (_neshawk != null)
|
||||
if (Neshawk != null)
|
||||
{
|
||||
var s = _neshawk.GetSettings();
|
||||
var s = Neshawk.GetSettings();
|
||||
s.AllowMoreThanEightSprites = allow;
|
||||
_neshawk.PutSettings(s);
|
||||
Neshawk.PutSettings(s);
|
||||
}
|
||||
else if (_quicknes != null)
|
||||
else if (Quicknes != null)
|
||||
{
|
||||
var s = _quicknes.GetSettings();
|
||||
var s = Quicknes.GetSettings();
|
||||
s.NumSprites = allow ? 64 : 8;
|
||||
_quicknes.PutSettings(s);
|
||||
Quicknes.PutSettings(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,17 +200,17 @@ namespace BizHawk.Client.Common
|
|||
"setclipleftandright", "Sets the Clip Left and Right sides option")]
|
||||
public void SetClipLeftAndRight(bool leftandright)
|
||||
{
|
||||
if (_neshawk != null)
|
||||
if (Neshawk != null)
|
||||
{
|
||||
var s = _neshawk.GetSettings();
|
||||
var s = Neshawk.GetSettings();
|
||||
s.ClipLeftAndRight = leftandright;
|
||||
_neshawk.PutSettings(s);
|
||||
Neshawk.PutSettings(s);
|
||||
}
|
||||
else if (_quicknes != null)
|
||||
else if (Quicknes != null)
|
||||
{
|
||||
var s = _quicknes.GetSettings();
|
||||
var s = Quicknes.GetSettings();
|
||||
s.ClipLeftAndRight = leftandright;
|
||||
_quicknes.PutSettings(s);
|
||||
Quicknes.PutSettings(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,11 +218,11 @@ namespace BizHawk.Client.Common
|
|||
"setdispbackground", "Sets whether or not the background layer will be displayed")]
|
||||
public void SetDisplayBackground(bool show)
|
||||
{
|
||||
if (_neshawk != null)
|
||||
if (Neshawk != null)
|
||||
{
|
||||
var s = _neshawk.GetSettings();
|
||||
var s = Neshawk.GetSettings();
|
||||
s.DispBackground = show;
|
||||
_neshawk.PutSettings(s);
|
||||
Neshawk.PutSettings(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,17 +230,17 @@ namespace BizHawk.Client.Common
|
|||
"setdispsprites", "Sets whether or not sprites will be displayed")]
|
||||
public void SetDisplaySprites(bool show)
|
||||
{
|
||||
if (_neshawk != null)
|
||||
if (Neshawk != null)
|
||||
{
|
||||
var s = _neshawk.GetSettings();
|
||||
var s = Neshawk.GetSettings();
|
||||
s.DispSprites = show;
|
||||
_neshawk.PutSettings(s);
|
||||
Neshawk.PutSettings(s);
|
||||
}
|
||||
else if (_quicknes != null)
|
||||
else if (Quicknes != null)
|
||||
{
|
||||
var s = _quicknes.GetSettings();
|
||||
var s = Quicknes.GetSettings();
|
||||
s.NumSprites = show ? 8 : 0;
|
||||
_quicknes.PutSettings(s);
|
||||
Quicknes.PutSettings(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ namespace BizHawk.Client.Common
|
|||
"setscanlines", "sets the top and bottom scanlines to be drawn (same values as in the graphics options dialog). Top must be in the range of 0 to 127, bottom must be between 128 and 239. Not supported in the Quick Nes core")]
|
||||
public void SetScanlines(int top, int bottom, bool pal = false)
|
||||
{
|
||||
if (_neshawk != null)
|
||||
if (Neshawk != null)
|
||||
{
|
||||
if (top > 127)
|
||||
{
|
||||
|
@ -268,7 +268,7 @@ namespace BizHawk.Client.Common
|
|||
bottom = 128;
|
||||
}
|
||||
|
||||
var s = _neshawk.GetSettings();
|
||||
var s = Neshawk.GetSettings();
|
||||
|
||||
if (pal)
|
||||
{
|
||||
|
@ -281,7 +281,7 @@ namespace BizHawk.Client.Common
|
|||
s.NTSC_BottomLine = bottom;
|
||||
}
|
||||
|
||||
_neshawk.PutSettings(s);
|
||||
Neshawk.PutSettings(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,10 +15,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
public sealed class EmuHawkLuaLibrary : LuaLibraryBase
|
||||
{
|
||||
[RequiredService]
|
||||
public IEmulator Emulator { get; set; }
|
||||
private IEmulator Emulator { get; set; }
|
||||
|
||||
[RequiredService]
|
||||
public IVideoProvider VideoProvider { get; set; }
|
||||
private IVideoProvider VideoProvider { get; set; }
|
||||
|
||||
private readonly Dictionary<int, string> _filterMappings = new Dictionary<int, string>
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public sealed class GuiLuaLibrary : LuaLibraryBase
|
||||
{
|
||||
[RequiredService]
|
||||
public IEmulator Emulator { get; set; }
|
||||
private IEmulator Emulator { get; set; }
|
||||
|
||||
public GuiLuaLibrary(Lua lua)
|
||||
: base(lua) { }
|
||||
|
|
Loading…
Reference in New Issue