Lua - savestate.registerload() implemented

This commit is contained in:
andres.delikat 2012-03-27 21:17:20 +00:00
parent be807c3def
commit 655af69326
2 changed files with 23 additions and 0 deletions

View File

@ -23,6 +23,7 @@ namespace BizHawk.MultiClient
public bool FrameAdvanceRequested;
Lua currThread;
LuaFunction savestate_registersavefunc;
LuaFunction savestate_registerloadfunc;
public void SavestateRegisterSave()
{
@ -39,6 +40,21 @@ namespace BizHawk.MultiClient
}
}
public void SavestateRegisterLoad()
{
if (savestate_registerloadfunc != null)
{
try
{
savestate_registerloadfunc.Call();
}
catch
{
Global.RenderPanel.AddMessage("error running function attached by lua function savestate.registerload");
}
}
}
public LuaImplementation(LuaConsole passed)
{
LuaWait = new AutoResetEvent(false);
@ -302,6 +318,7 @@ namespace BizHawk.MultiClient
"save",
"load",
"registersave",
"registerload",
};
public static string[] MovieFunctions = new string[] {
@ -1095,6 +1112,11 @@ namespace BizHawk.MultiClient
savestate_registersavefunc = luaf;
}
public void savestate_registerload(LuaFunction luaf)
{
savestate_registerloadfunc = luaf;
}
//----------------------------------------------------
//Movie library
//----------------------------------------------------

View File

@ -1938,6 +1938,7 @@ namespace BizHawk.MultiClient
public void LoadStateFile(string path, string name)
{
LuaConsole1.LuaImp.SavestateRegisterLoad();
if (HandleMovieLoadState(path))
{
var reader = new StreamReader(path);