Replace config bool `UseNLua` w/ enum
This commit is contained in:
parent
d3c04bcd4e
commit
e58f2811dc
|
@ -142,8 +142,15 @@ namespace BizHawk.Client.Common
|
|||
/// </summary>
|
||||
public int FlushSaveRamFrames;
|
||||
|
||||
//check CurrentDomain_AssemblyResolve if you change the defaults or name of this key
|
||||
public bool UseNLua = false; // Whether or not to use a good, reliable, memory-leak-free lua interface that is slower than the original luainterface
|
||||
public enum ELuaEngine
|
||||
{
|
||||
/// <remarks>Don't change this member's ordinal (don't reorder) without changing <c>BizHawk.Client.EmuHawk.Program.CurrentDomain_AssemblyResolve</c></remarks>
|
||||
LuaPlusLuaInterface,
|
||||
NLuaPlusKopiLua
|
||||
}
|
||||
|
||||
/// <remarks>Don't rename this without changing <c>BizHawk.Client.EmuHawk.Program.CurrentDomain_AssemblyResolve</c></remarks>
|
||||
public ELuaEngine LuaEngine = ELuaEngine.LuaPlusLuaInterface;
|
||||
|
||||
public bool TurboSeek { get; set; }
|
||||
|
||||
|
|
|
@ -318,8 +318,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
var configPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "config.ini");
|
||||
if (!EXE_PROJECT.OSTailoredCode.IsUnixHost // LuaInterface is not currently working on Mono
|
||||
&& File.Exists(configPath)
|
||||
&& (Array.Find(File.ReadAllLines(configPath), line => line.Contains(" \"UseNLua\": ")) ?? string.Empty)
|
||||
.Contains("false"))
|
||||
&& (Array.Find(File.ReadAllLines(configPath), line => line.Contains(" \"LuaEngine\": ")) ?? string.Empty)
|
||||
.Contains("0"))
|
||||
{
|
||||
requested = "LuaInterface";
|
||||
}
|
||||
|
|
|
@ -64,8 +64,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
cbMoviesOnDisk.Checked = Global.Config.MoviesOnDisk;
|
||||
cbMoviesInAWE.Checked = Global.Config.MoviesInAWE;
|
||||
|
||||
NLuaRadio.Checked = Global.Config.UseNLua;
|
||||
LuaInterfaceRadio.Checked = !Global.Config.UseNLua;
|
||||
switch (Global.Config.LuaEngine)
|
||||
{
|
||||
case Config.ELuaEngine.LuaPlusLuaInterface:
|
||||
LuaInterfaceRadio.Checked = true;
|
||||
break;
|
||||
case Config.ELuaEngine.NLuaPlusKopiLua:
|
||||
NLuaRadio.Checked = true;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
if (LogConsole.ConsoleVisible)
|
||||
{
|
||||
|
@ -101,13 +110,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
Global.Config.MoviesOnDisk = cbMoviesOnDisk.Checked;
|
||||
Global.Config.MoviesInAWE = cbMoviesInAWE.Checked;
|
||||
|
||||
bool changedLua = Global.Config.UseNLua != NLuaRadio.Checked;
|
||||
Global.Config.UseNLua = NLuaRadio.Checked;
|
||||
var prevLuaEngine = Global.Config.LuaEngine;
|
||||
if (LuaInterfaceRadio.Checked) Global.Config.LuaEngine = Config.ELuaEngine.LuaPlusLuaInterface;
|
||||
else if (NLuaRadio.Checked) Global.Config.LuaEngine = Config.ELuaEngine.NLuaPlusKopiLua;
|
||||
|
||||
Close();
|
||||
DialogResult = DialogResult.OK;
|
||||
GlobalWin.OSD.AddMessage("Custom configurations saved.");
|
||||
if(changedLua) GlobalWin.OSD.AddMessage("Restart emulator for Lua change to take effect");
|
||||
if (prevLuaEngine != Global.Config.LuaEngine) GlobalWin.OSD.AddMessage("Restart emulator for Lua change to take effect");
|
||||
}
|
||||
|
||||
private void CancelBtn_Click(object sender, EventArgs e)
|
||||
|
|
Loading…
Reference in New Issue