move Config.DisableScriptsOnLoad to a lua console setting, and pass it into LuaFileList
This commit is contained in:
parent
6c9b42a526
commit
324a50a0bb
|
@ -69,7 +69,7 @@ namespace BizHawk.Client.Common
|
||||||
return base.RemoveAll(match);
|
return base.RemoveAll(match);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool LoadLuaSession(string path)
|
public bool LoadLuaSession(string path, bool disableOnLoad)
|
||||||
{
|
{
|
||||||
var file = new FileInfo(path);
|
var file = new FileInfo(path);
|
||||||
if (file.Exists)
|
if (file.Exists)
|
||||||
|
@ -95,7 +95,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
Add(new LuaFile(scriptPath)
|
Add(new LuaFile(scriptPath)
|
||||||
{
|
{
|
||||||
State = !Global.Config.DisableLuaScriptsOnLoad && line.Substring(0, 1) == "1"
|
State = !disableOnLoad && line.Substring(0, 1) == "1"
|
||||||
? LuaFile.RunState.Running
|
? LuaFile.RunState.Running
|
||||||
: LuaFile.RunState.Disabled
|
: LuaFile.RunState.Disabled
|
||||||
});
|
});
|
||||||
|
|
|
@ -59,6 +59,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public bool ToggleAllIfNoneSelected { get; set; } = true;
|
public bool ToggleAllIfNoneSelected { get; set; } = true;
|
||||||
|
|
||||||
public int SplitDistance { get; set; }
|
public int SplitDistance { get; set; }
|
||||||
|
|
||||||
|
public bool DisableLuaScriptsOnLoad { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConfigPersist]
|
[ConfigPersist]
|
||||||
|
@ -511,7 +513,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public bool LoadLuaSession(string path)
|
public bool LoadLuaSession(string path)
|
||||||
{
|
{
|
||||||
var result = LuaImp.ScriptList.LoadLuaSession(path);
|
var result = LuaImp.ScriptList.LoadLuaSession(path, Settings.DisableLuaScriptsOnLoad);
|
||||||
|
|
||||||
RunLuaScripts();
|
RunLuaScripts();
|
||||||
UpdateDialog();
|
UpdateDialog();
|
||||||
|
@ -664,7 +666,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
if (load)
|
if (load)
|
||||||
{
|
{
|
||||||
if (!LuaImp.ScriptList.LoadLuaSession(path))
|
if (!LuaImp.ScriptList.LoadLuaSession(path, Settings.DisableLuaScriptsOnLoad))
|
||||||
{
|
{
|
||||||
Config.RecentLuaSession.HandleLoadError(path);
|
Config.RecentLuaSession.HandleLoadError(path);
|
||||||
}
|
}
|
||||||
|
@ -770,7 +772,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
var result = ofd.ShowHawkDialog();
|
var result = ofd.ShowHawkDialog();
|
||||||
if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(ofd.FileName))
|
if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(ofd.FileName))
|
||||||
{
|
{
|
||||||
LuaImp.ScriptList.LoadLuaSession(ofd.FileName);
|
LuaImp.ScriptList.LoadLuaSession(ofd.FileName, Settings.DisableLuaScriptsOnLoad);
|
||||||
RunLuaScripts();
|
RunLuaScripts();
|
||||||
UpdateDialog();
|
UpdateDialog();
|
||||||
LuaImp.ScriptList.Changes = false;
|
LuaImp.ScriptList.Changes = false;
|
||||||
|
@ -1301,7 +1303,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
else if (Path.GetExtension(path)?.ToLower() == ".luases")
|
else if (Path.GetExtension(path)?.ToLower() == ".luases")
|
||||||
{
|
{
|
||||||
LuaImp.ScriptList.LoadLuaSession(path);
|
LuaImp.ScriptList.LoadLuaSession(path, Settings.DisableLuaScriptsOnLoad);
|
||||||
RunLuaScripts();
|
RunLuaScripts();
|
||||||
UpdateDialog();
|
UpdateDialog();
|
||||||
LuaImp.ScriptList.Changes = false;
|
LuaImp.ScriptList.Changes = false;
|
||||||
|
|
Loading…
Reference in New Issue