Lua - implement savestate.registersave()

This commit is contained in:
andres.delikat 2012-03-27 21:09:36 +00:00
parent 83fe222ba9
commit 0330e1f742
2 changed files with 24 additions and 1 deletions

View File

@ -22,6 +22,22 @@ namespace BizHawk.MultiClient
private int CurrentMemoryDomain = 0; //Main memory by default private int CurrentMemoryDomain = 0; //Main memory by default
public bool FrameAdvanceRequested; public bool FrameAdvanceRequested;
Lua currThread; Lua currThread;
LuaFunction savestate_registersavefunc;
public void SavestateRegisterSave()
{
if (savestate_registersavefunc != null)
{
try
{
savestate_registersavefunc.Call();
}
catch
{
Global.RenderPanel.AddMessage("error running function attached by lua function savestate.registersave");
}
}
}
public LuaImplementation(LuaConsole passed) public LuaImplementation(LuaConsole passed)
{ {
@ -285,6 +301,7 @@ namespace BizHawk.MultiClient
"loadslot", "loadslot",
"save", "save",
"load", "load",
"registersave",
}; };
public static string[] MovieFunctions = new string[] { public static string[] MovieFunctions = new string[] {
@ -1073,6 +1090,11 @@ namespace BizHawk.MultiClient
} }
} }
public void savestate_registersave(LuaFunction luaf)
{
savestate_registersavefunc = luaf;
}
//---------------------------------------------------- //----------------------------------------------------
//Movie library //Movie library
//---------------------------------------------------- //----------------------------------------------------

View File

@ -1892,6 +1892,7 @@ namespace BizHawk.MultiClient
public void SaveStateFile(StreamWriter writer, string name, bool fromLua) public void SaveStateFile(StreamWriter writer, string name, bool fromLua)
{ {
LuaConsole1.LuaImp.SavestateRegisterSave();
Global.Emulator.SaveStateText(writer); Global.Emulator.SaveStateText(writer);
HandleMovieSaveState(writer); HandleMovieSaveState(writer);
if (Global.Config.SaveScreenshotWithStates) if (Global.Config.SaveScreenshotWithStates)