Rename PlatformEmuLuaLibrary and implementations
EmuLuaLibrary was too close to EmulationLuaLibrary. These classes are containers, they're not in the LuaLibraryBase inheritance heirarchy.
This commit is contained in:
parent
e514dfd117
commit
3d532078a5
|
@ -563,6 +563,8 @@
|
||||||
<Compile Update="tools/Lua/LuaWinform.cs" SubType="Form" />
|
<Compile Update="tools/Lua/LuaWinform.cs" SubType="Form" />
|
||||||
<Compile Update="tools/Lua/LuaWinform.Designer.cs" DependentUpon="LuaWinform.cs" />
|
<Compile Update="tools/Lua/LuaWinform.Designer.cs" DependentUpon="LuaWinform.cs" />
|
||||||
<EmbeddedResource Update="tools/Lua/LuaWinform.resx" DependentUpon="LuaWinform.cs" />
|
<EmbeddedResource Update="tools/Lua/LuaWinform.resx" DependentUpon="LuaWinform.cs" />
|
||||||
|
<Compile Update="tools/Lua/UnixLuaLibraries.cs" DependentUpon="LuaLibraries.cs" />
|
||||||
|
<Compile Update="tools/Lua/Win32LuaLibraries.cs" DependentUpon="LuaLibraries.cs" />
|
||||||
<Compile Update="tools/Macros/MacroInput.ButtonSelect.cs" SubType="Form" />
|
<Compile Update="tools/Macros/MacroInput.ButtonSelect.cs" SubType="Form" />
|
||||||
<Compile Update="tools/Macros/MacroInput.cs" SubType="Form" />
|
<Compile Update="tools/Macros/MacroInput.cs" SubType="Form" />
|
||||||
<Compile Update="tools/Macros/MacroInput.Designer.cs" DependentUpon="MacroInput.cs" />
|
<Compile Update="tools/Macros/MacroInput.Designer.cs" DependentUpon="MacroInput.cs" />
|
||||||
|
|
|
@ -111,7 +111,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
_defaultSplitDistance = splitContainer1.SplitterDistance;
|
_defaultSplitDistance = splitContainer1.SplitterDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlatformEmuLuaLibrary LuaImp { get; private set; }
|
public LuaLibraries LuaImp { get; private set; }
|
||||||
|
|
||||||
public bool UpdateBefore => true;
|
public bool UpdateBefore => true;
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentScripts = LuaImp?.ScriptList; // Temp fix for now
|
var currentScripts = LuaImp?.ScriptList; // Temp fix for now
|
||||||
LuaImp = OSTailoredCode.IsUnixHost ? (PlatformEmuLuaLibrary) new NotReallyLuaLibrary() : new EmuLuaLibrary(Emulator.ServiceProvider, MainForm);
|
LuaImp = OSTailoredCode.IsUnixHost ? (LuaLibraries) new UnixLuaLibraries() : new Win32LuaLibraries(Emulator.ServiceProvider, MainForm);
|
||||||
LuaImp.ScriptList.AddRange(currentScripts ?? Enumerable.Empty<LuaFile>());
|
LuaImp.ScriptList.AddRange(currentScripts ?? Enumerable.Empty<LuaFile>());
|
||||||
|
|
||||||
InputBox.AutoCompleteCustomSource.AddRange(LuaImp.Docs.Select(a => $"{a.Library}.{a.Name}").ToArray());
|
InputBox.AutoCompleteCustomSource.AddRange(LuaImp.Docs.Select(a => $"{a.Library}.{a.Name}").ToArray());
|
||||||
|
|
|
@ -8,7 +8,7 @@ using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
namespace BizHawk.Client.EmuHawk
|
namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public abstract class PlatformEmuLuaLibrary
|
public abstract class LuaLibraries
|
||||||
{
|
{
|
||||||
public readonly LuaDocumentation Docs = new LuaDocumentation();
|
public readonly LuaDocumentation Docs = new LuaDocumentation();
|
||||||
public abstract LuaFunctionList RegisteredFunctions { get; }
|
public abstract LuaFunctionList RegisteredFunctions { get; }
|
||||||
|
@ -29,7 +29,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public abstract void EndLuaDrawing();
|
public abstract void EndLuaDrawing();
|
||||||
public abstract void ExecuteString(string command);
|
public abstract void ExecuteString(string command);
|
||||||
public abstract void Restart(IEmulatorServiceProvider newServiceProvider);
|
public abstract void Restart(IEmulatorServiceProvider newServiceProvider);
|
||||||
public abstract EmuLuaLibrary.ResumeResult ResumeScript(LuaFile lf);
|
public abstract Win32LuaLibraries.ResumeResult ResumeScript(LuaFile lf);
|
||||||
public abstract void SpawnAndSetFileThread(string pathToLoad, LuaFile lf);
|
public abstract void SpawnAndSetFileThread(string pathToLoad, LuaFile lf);
|
||||||
public abstract void StartLuaDrawing();
|
public abstract void StartLuaDrawing();
|
||||||
public abstract void WindowClosed(IntPtr handle);
|
public abstract void WindowClosed(IntPtr handle);
|
|
@ -10,11 +10,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public List<LuaEvent> ControlEvents { get; } = new List<LuaEvent>();
|
public List<LuaEvent> ControlEvents { get; } = new List<LuaEvent>();
|
||||||
|
|
||||||
private readonly PlatformEmuLuaLibrary _luaImp;
|
private readonly LuaLibraries _luaImp;
|
||||||
private readonly string _currentDirectory = Environment.CurrentDirectory;
|
private readonly string _currentDirectory = Environment.CurrentDirectory;
|
||||||
private readonly LuaFile _ownerFile;
|
private readonly LuaFile _ownerFile;
|
||||||
|
|
||||||
public LuaWinform(LuaFile ownerFile, PlatformEmuLuaLibrary luaImp)
|
public LuaWinform(LuaFile ownerFile, LuaLibraries luaImp)
|
||||||
{
|
{
|
||||||
_ownerFile = ownerFile;
|
_ownerFile = ownerFile;
|
||||||
_luaImp = luaImp;
|
_luaImp = luaImp;
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Methods intentionally blank.
|
/// Methods intentionally blank.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class NotReallyLuaLibrary : PlatformEmuLuaLibrary
|
public sealed class UnixLuaLibraries : LuaLibraries
|
||||||
{
|
{
|
||||||
public override void CallExitEvent(LuaFile lf)
|
public override void CallExitEvent(LuaFile lf)
|
||||||
{
|
{
|
||||||
|
@ -39,8 +39,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public override void Restart(IEmulatorServiceProvider newServiceProvider)
|
public override void Restart(IEmulatorServiceProvider newServiceProvider)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
private static readonly EmuLuaLibrary.ResumeResult EmptyResumeResult = new EmuLuaLibrary.ResumeResult();
|
private static readonly Win32LuaLibraries.ResumeResult EmptyResumeResult = new Win32LuaLibraries.ResumeResult();
|
||||||
public override EmuLuaLibrary.ResumeResult ResumeScript(LuaFile lf)
|
public override Win32LuaLibraries.ResumeResult ResumeScript(LuaFile lf)
|
||||||
{
|
{
|
||||||
return EmptyResumeResult;
|
return EmptyResumeResult;
|
||||||
}
|
}
|
|
@ -13,16 +13,16 @@ using BizHawk.Client.Common;
|
||||||
|
|
||||||
namespace BizHawk.Client.EmuHawk
|
namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public class EmuLuaLibrary : PlatformEmuLuaLibrary
|
public class Win32LuaLibraries : LuaLibraries
|
||||||
{
|
{
|
||||||
private readonly MainForm _mainForm;
|
private readonly MainForm _mainForm;
|
||||||
public EmuLuaLibrary()
|
public Win32LuaLibraries()
|
||||||
{
|
{
|
||||||
// if (NLua.Lua.WhichLua == "NLua")
|
// if (NLua.Lua.WhichLua == "NLua")
|
||||||
_lua["keepalives"] = _lua.NewTable();
|
_lua["keepalives"] = _lua.NewTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EmuLuaLibrary(IEmulatorServiceProvider serviceProvider, MainForm mainForm)
|
public Win32LuaLibraries(IEmulatorServiceProvider serviceProvider, MainForm mainForm)
|
||||||
: this()
|
: this()
|
||||||
{
|
{
|
||||||
_mainForm = mainForm;
|
_mainForm = mainForm;
|
||||||
|
@ -49,7 +49,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
// Register lua libraries
|
// Register lua libraries
|
||||||
foreach (var lib in Assembly.Load("BizHawk.Client.Common").GetTypes()
|
foreach (var lib in Assembly.Load("BizHawk.Client.Common").GetTypes()
|
||||||
.Concat(Assembly.GetAssembly(typeof(EmuLuaLibrary)).GetTypes())
|
.Concat(Assembly.GetAssembly(typeof(Win32LuaLibraries)).GetTypes())
|
||||||
.Where(t => typeof(LuaLibraryBase).IsAssignableFrom(t) && t.IsSealed && ServiceInjector.IsAvailable(serviceProvider, t)))
|
.Where(t => typeof(LuaLibraryBase).IsAssignableFrom(t) && t.IsSealed && ServiceInjector.IsAvailable(serviceProvider, t)))
|
||||||
{
|
{
|
||||||
bool addLibrary = true;
|
bool addLibrary = true;
|
Loading…
Reference in New Issue