Adding lua function lists.
This commit is contained in:
parent
8814385916
commit
122b35f6c3
|
@ -12,10 +12,47 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
Lua lua = new Lua();
|
Lua lua = new Lua();
|
||||||
LuaConsole Caller;
|
LuaConsole Caller;
|
||||||
|
public static string[] EmuFunctions = new string[] {
|
||||||
|
"frameadvance",
|
||||||
|
"pause",
|
||||||
|
"unpause",
|
||||||
|
"speedmode",
|
||||||
|
"framecount",
|
||||||
|
"lagcount",
|
||||||
|
"islagged",
|
||||||
|
"registerbefore",
|
||||||
|
"registerafter",
|
||||||
|
"register"
|
||||||
|
};
|
||||||
public static string[] MemoryFunctions = new string[] {
|
public static string[] MemoryFunctions = new string[] {
|
||||||
"readbyte",
|
"readbyte",
|
||||||
"writebyte"};
|
"readbytesigned",
|
||||||
|
"readword",
|
||||||
|
"readwordsigned",
|
||||||
|
"readdword",
|
||||||
|
"readdwordsigned",
|
||||||
|
"readbyterange",
|
||||||
|
"writebyte",
|
||||||
|
"writeword",
|
||||||
|
"writedword",
|
||||||
|
"registerwrite",
|
||||||
|
"registerread",
|
||||||
|
};
|
||||||
|
public static string[] SaveStateFunctions = new string[] {
|
||||||
|
"create",
|
||||||
|
"save",
|
||||||
|
"load",
|
||||||
|
"write"
|
||||||
|
};
|
||||||
|
public static string[] MovieFunctions = new string[] {
|
||||||
|
"mode",
|
||||||
|
"rerecordcount",
|
||||||
|
"stop"
|
||||||
|
};
|
||||||
|
public static string[] JoypadFunctions = new string[] {
|
||||||
|
"set",
|
||||||
|
"get",
|
||||||
|
};
|
||||||
public LuaImplementation(LuaConsole passed)
|
public LuaImplementation(LuaConsole passed)
|
||||||
{
|
{
|
||||||
Caller = passed.get();
|
Caller = passed.get();
|
||||||
|
@ -23,19 +60,24 @@ namespace BizHawk.MultiClient
|
||||||
lua.NewTable("memory");
|
lua.NewTable("memory");
|
||||||
for (int i = 0; i < MemoryFunctions.Length; i++)
|
for (int i = 0; i < MemoryFunctions.Length; i++)
|
||||||
{
|
{
|
||||||
lua.RegisterFunction("memory." + MemoryFunctions[i], this, this.GetType().GetMethod(MemoryFunctions[i]));
|
lua.RegisterFunction("memory." + MemoryFunctions[i], this, this.GetType().GetMethod("memory_"+MemoryFunctions[i]));
|
||||||
}
|
}
|
||||||
|
lua.NewTable("joypad");
|
||||||
|
for (int i = 0; i < JoypadFunctions.Length; i++)
|
||||||
|
{
|
||||||
|
lua.RegisterFunction("joypad." + MemoryFunctions[i], this, this.GetType().GetMethod("joypad_"+JoypadFunctions[i]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DoLuaFile(string File)
|
public void DoLuaFile(string File)
|
||||||
{
|
{
|
||||||
lua.DoFile(File);
|
|
||||||
}
|
}
|
||||||
public void print(string s)
|
public void print(string s)
|
||||||
{
|
{
|
||||||
Caller.AddText(string.Format(s));
|
Caller.AddText(string.Format(s));
|
||||||
}
|
}
|
||||||
public string readbyte(object lua_input)
|
public string memory_readbyte(object lua_input)
|
||||||
{
|
{
|
||||||
|
|
||||||
byte x;
|
byte x;
|
||||||
|
@ -52,9 +94,24 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public void writebyte(object lua_input)
|
public void memory_writebyte(object lua_input)
|
||||||
{
|
{
|
||||||
Global.Emulator.MainMemory.PokeByte((int)lua_input, (byte)lua_input);
|
Global.Emulator.MainMemory.PokeByte((int)lua_input, (byte)lua_input);
|
||||||
}
|
}
|
||||||
|
public void joypad_get(object lua_input)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
public void joypad_set(object lua_input)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
public string movie_rerecordcount()
|
||||||
|
{
|
||||||
|
return "No";
|
||||||
|
}
|
||||||
|
public void movie_stop()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue