Lua - start work to implement lua.get/setrerecordingcounting functions

This commit is contained in:
andres.delikat 2012-03-29 03:09:46 +00:00
parent de7bd1f346
commit 50e357f345
2 changed files with 28 additions and 13 deletions

View File

@ -24,7 +24,7 @@ namespace BizHawk.MultiClient
Lua currThread;
LuaFunction savestate_registersavefunc;
LuaFunction savestate_registerloadfunc;
public void SavestateRegisterSave(string name)
{
if (savestate_registersavefunc != null)
@ -332,7 +332,8 @@ namespace BizHawk.MultiClient
"filename",
"getreadonly",
"setreadonly",
//"rerecordcounting",
"getrerecordcounting",
"setrerecordcounting",
"getinput",
};
@ -1173,10 +1174,6 @@ namespace BizHawk.MultiClient
public void movie_setreadonly(object lua_input)
{
int x = 0;
x++;
int y = x;
if (lua_input.ToString().ToUpper() == "TRUE" || lua_input.ToString() == "1")
Global.MainForm.SetReadOnly(true);
else
@ -1191,12 +1188,24 @@ namespace BizHawk.MultiClient
MovieControllerAdapter m = new MovieControllerAdapter();
m.Type = Global.MovieSession.MovieControllerAdapter.Type;
m.SetControllersAsMnemonic(s);
foreach (string button in m.Type.BoolButtons)
input[button] = m[button];
foreach (string button in m.Type.BoolButtons)
input[button] = m[button];
return input;
}
public bool getrerecordcounting()
{
return Global.MovieSession.Movie.RerecordCounting;
}
public void setrerecordcounting(object lua_input)
{
if (lua_input.ToString().ToUpper() == "TRUE" || lua_input.ToString() == "1")
Global.MovieSession.Movie.RerecordCounting = true;
else
Global.MovieSession.Movie.RerecordCounting = false;
}
//----------------------------------------------------
//Input library
//----------------------------------------------------
@ -1217,9 +1226,9 @@ namespace BizHawk.MultiClient
public LuaTable joypad_get(object controller)
{
LuaTable buttons = lua.NewTable();
foreach (string button in Global.ControllerOutput.Source.Type.BoolButtons)
if (button.Substring(0, 2) == "P" + LuaInt(controller).ToString())
buttons[button] = Global.ControllerOutput[button];
foreach (string button in Global.ControllerOutput.Source.Type.BoolButtons)
if (button.Substring(0, 2) == "P" + LuaInt(controller).ToString())
buttons[button] = Global.ControllerOutput[button];
//zero 23-mar-2012 - wtf is this??????
buttons["clear"] = null;

View File

@ -21,6 +21,7 @@ namespace BizHawk.MultiClient
public MOVIEMODE Mode { get; private set; }
public int Rerecords { get; private set; }
private int Frames;
public bool RerecordCounting { get; set; }
private MovieLog Log = new MovieLog();
private int lastLog;
@ -36,6 +37,7 @@ namespace BizHawk.MultiClient
this.Filename = filename;
IsText = true;
Frames = 0;
RerecordCounting = true;
StartsFromSavestate = false;
if (filename.Length > 0)
Loaded = true;
@ -49,6 +51,7 @@ namespace BizHawk.MultiClient
Frames = 0;
StartsFromSavestate = false;
Loaded = false;
RerecordCounting = true;
}
public string SysID()
@ -438,8 +441,11 @@ namespace BizHawk.MultiClient
public void IncrementRerecords()
{
Rerecords++;
Header.UpdateRerecordCount(Rerecords);
if (RerecordCounting)
{
Rerecords++;
Header.UpdateRerecordCount(Rerecords);
}
}
public void SetRerecords(int value)