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
public bool FrameAdvanceRequested;
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)
{
@ -285,6 +301,7 @@ namespace BizHawk.MultiClient
"loadslot",
"save",
"load",
"registersave",
};
public static string[] MovieFunctions = new string[] {
@ -297,7 +314,7 @@ namespace BizHawk.MultiClient
"getreadonly",
"setreadonly",
//"rerecordcounting",
"getinput",
"getinput",
};
public static string[] InputFunctions = new string[] {
@ -1073,6 +1090,11 @@ namespace BizHawk.MultiClient
}
}
public void savestate_registersave(LuaFunction luaf)
{
savestate_registersavefunc = luaf;
}
//----------------------------------------------------
//Movie library
//----------------------------------------------------

View File

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