diff --git a/BizHawk.MultiClient/LuaImplementation.cs b/BizHawk.MultiClient/LuaImplementation.cs index a78242066e..7c337efc56 100644 --- a/BizHawk.MultiClient/LuaImplementation.cs +++ b/BizHawk.MultiClient/LuaImplementation.cs @@ -12,10 +12,47 @@ namespace BizHawk.MultiClient { Lua lua = new Lua(); LuaConsole Caller; - + public static string[] EmuFunctions = new string[] { + "frameadvance", + "pause", + "unpause", + "speedmode", + "framecount", + "lagcount", + "islagged", + "registerbefore", + "registerafter", + "register" + }; public static string[] MemoryFunctions = new string[] { - "readbyte", - "writebyte"}; + "readbyte", + "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) { Caller = passed.get(); @@ -23,19 +60,24 @@ namespace BizHawk.MultiClient lua.NewTable("memory"); 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) { - lua.DoFile(File); + } public void print(string s) { Caller.AddText(string.Format(s)); } - public string readbyte(object lua_input) + public string memory_readbyte(object lua_input) { 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); } + public void joypad_get(object lua_input) + { + + } + public void joypad_set(object lua_input) + { + + } + public string movie_rerecordcount() + { + return "No"; + } + public void movie_stop() + { + } } }