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