From 91fdad9d45a800b3d3bae65ca083b80461f157ed Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 26 Jan 2014 16:21:20 +0000 Subject: [PATCH] LUa - whack now unused code --- .../lua/EmuLuaLibrary.Bit.cs | 23 ---------- .../lua/EmuLuaLibrary.Emu.cs | 21 --------- .../lua/EmuLuaLibrary.Events.cs | 19 -------- .../lua/EmuLuaLibrary.Joypad.cs | 13 ------ .../lua/EmuLuaLibrary.MainMemory.cs | 45 ------------------ .../lua/EmuLuaLibrary.Memory.cs | 46 ------------------- .../lua/EmuLuaLibrary.Movie.cs | 20 -------- .../lua/EmuLuaLibrary.NES.cs | 22 --------- .../lua/EmuLuaLibrary.SNES.cs | 25 ---------- .../lua/EmuLuaLibrary.String.cs | 20 -------- BizHawk.Client.Common/lua/LuaLibraryBase.cs | 18 -------- .../Lua/Libraries/EmuLuaLibrary.Client.cs | 44 ------------------ .../Lua/Libraries/EmuLuaLibrary.Console.cs | 13 ------ .../Lua/Libraries/EmuLuaLibrary.Forms.cs | 27 ----------- .../tools/Lua/Libraries/EmuLuaLibrary.Gui.cs | 26 ----------- .../Lua/Libraries/EmuLuaLibrary.Input.cs | 11 ----- .../Lua/Libraries/EmuLuaLibrary.Savestate.cs | 13 ------ .../tools/Lua/Libraries/EmuLuaLibrary.cs | 32 ++++++------- 18 files changed, 16 insertions(+), 422 deletions(-) diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.Bit.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.Bit.cs index 7b56b5750f..f275d8eda2 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.Bit.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.Bit.cs @@ -5,29 +5,6 @@ namespace BizHawk.Client.Common public class BitLuaLibrary : LuaLibraryBase { public override string Name { get { return "bit"; } } - public override string[] Functions - { - get - { - return new[] - { - "Band", - "Bnot", - "Bor", - "Bxor", - "Lshift", - "Rol", - "Ror", - "Rshift", - "Check", - "Set", - "Clear", - "Byteswap_16", - "Byteswap_32", - "Byteswap_64" - }; - } - } [LuaMethodAttributes( "band", diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.Emu.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.Emu.cs index 273f3b030d..9cd49fe881 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.Emu.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.Emu.cs @@ -21,27 +21,6 @@ namespace BizHawk.Client.Common } public override string Name { get { return "emu"; } } - public override string[] Functions - { - get - { - return new[] - { - "displayvsync", - "frameadvance", - "framecount", - "getregister", - "getregisters", - "getsystemid", - "islagged", - "lagcount", - "limitframerate", - "minimizeframeskip", - "setrenderplanes", - "yield" - }; - } - } private readonly Lua _lua; private readonly Action _frameAdvanceCallback; diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.Events.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.Events.cs index ba62c4cb46..602e52a585 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.Events.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.Events.cs @@ -13,25 +13,6 @@ namespace BizHawk.Client.Common } public override string Name { get { return "event"; } } - public override string[] Functions - { - get - { - return new[] - { - "onframeend", - "onframestart", - "oninputpoll", - "onloadstate", - "onmemoryexecute", - "onmemoryread", - "onmemorywrite", - "onsavestate", - "unregisterbyid", - "unregisterbyname" - }; - } - } public Action LogOutputCallback { get; set; } public Lua CurrentThread { get; set; } diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.Joypad.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.Joypad.cs index 6883714d93..91808b0f97 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.Joypad.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.Joypad.cs @@ -11,19 +11,6 @@ namespace BizHawk.Client.Common } public override string Name { get { return "joypad"; } } - public override string[] Functions - { - get - { - return new[] - { - "get", - "getimmediate", - "set", - "setanalog" - }; - } - } private readonly Lua _lua; diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.MainMemory.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.MainMemory.cs index 9dbe63ac1c..4e5c97b9c2 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.MainMemory.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.MainMemory.cs @@ -13,51 +13,6 @@ namespace BizHawk.Client.Common } public override string Name { get { return "mainmemory"; } } - public override string[] Functions - { - get - { - return new[] - { - "getname", - "readbyte", - "readbyterange", - "readfloat", - "writebyte", - "writebyterange", - "writefloat", - - "read_s8", - "read_u8", - "read_s16_le", - "read_s24_le", - "read_s32_le", - "read_u16_le", - "read_u24_le", - "read_u32_le", - "read_s16_be", - "read_s24_be", - "read_s32_be", - "read_u16_be", - "read_u24_be", - "read_u32_be", - "write_s8", - "write_u8", - "write_s16_le", - "write_s24_le", - "write_s32_le", - "write_u16_le", - "write_u24_le", - "write_u32_le", - "write_s16_be", - "write_s24_be", - "write_s32_be", - "write_u16_be", - "write_u24_be", - "write_u32_be" - }; - } - } private readonly Lua _lua; diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.Memory.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.Memory.cs index 88cfd8a570..def227c6ca 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.Memory.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.Memory.cs @@ -6,52 +6,6 @@ namespace BizHawk.Client.Common public class MemoryLuaLibrary : LuaLibraryBase { public override string Name { get { return "memory"; } } - public override string[] Functions - { - get - { - return new[] - { - "getcurrentmemorydomain", - "getcurrentmemorydomainsize", - "getmemorydomainlist", - "readbyte", - "readfloat", - "usememorydomain", - "writebyte", - "writefloat", - - "read_s8", - "read_u8", - "read_s16_le", - "read_s24_le", - "read_s32_le", - "read_u16_le", - "read_u24_le", - "read_u32_le", - "read_s16_be", - "read_s24_be", - "read_s32_be", - "read_u16_be", - "read_u24_be", - "read_u32_be", - "write_s8", - "write_u8", - "write_s16_le", - "write_s24_le", - "write_s32_le", - "write_u16_le", - "write_u24_le", - "write_u32_le", - "write_s16_be", - "write_s24_be", - "write_s32_be", - "write_u16_be", - "write_u24_be", - "write_u32_be" - }; - } - } private int _currentMemoryDomain; // Main memory by default diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.Movie.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.Movie.cs index bb49c492ea..0c26aaf53e 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.Movie.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.Movie.cs @@ -10,26 +10,6 @@ namespace BizHawk.Client.Common } public override string Name { get { return "movie"; } } - public override string[] Functions - { - get - { - return new[] - { - "filename", - "getinput", - "getreadonly", - "getrerecordcounting", - "isloaded", - "length", - "mode", - "rerecordcount", - "setreadonly", - "setrerecordcounting", - "stop" - }; - } - } private readonly Lua _lua; diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.NES.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.NES.cs index fdc1295d91..fd89995f59 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.NES.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.NES.cs @@ -10,28 +10,6 @@ namespace BizHawk.Client.Common // automatically bring out all of the settings to a lua table, with names. that // would be completely arbitrary and would remove the whole requirement for this mess public override string Name { get { return "nes"; } } - public override string[] Functions - { - get - { - return new[] - { - "addgamegenie", - "getallowmorethaneightsprites", - "getbottomscanline", - "getclipleftandright", - "getdispbackground", - "getdispsprites", - "gettopscanline", - "removegamegenie", - "setallowmorethaneightsprites", - "setclipleftandright", - "setdispbackground", - "setdispsprites", - "setscanlines" - }; - } - } [LuaMethodAttributes( "addgamegenie", diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.SNES.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.SNES.cs index 145c32758c..c8d5bb7043 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.SNES.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.SNES.cs @@ -5,31 +5,6 @@ namespace BizHawk.Client.Common public class SNESLuaLibrary : LuaLibraryBase { public override string Name { get { return "snes"; } } - public override string[] Functions - { - get - { - return new[] - { - "getlayer_bg_1", - "getlayer_bg_2", - "getlayer_bg_3", - "getlayer_bg_4", - "getlayer_obj_1", - "getlayer_obj_2", - "getlayer_obj_3", - "getlayer_obj_4", - "setlayer_bg_1", - "setlayer_bg_2", - "setlayer_bg_3", - "setlayer_bg_4", - "setlayer_obj_1", - "setlayer_obj_2", - "setlayer_obj_3", - "setlayer_obj_4" - }; - } - } [LuaMethodAttributes( "getlayer_bg_1", diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.String.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.String.cs index aca9a3a57a..23be65f89a 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.String.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.String.cs @@ -4,26 +4,6 @@ namespace BizHawk.Client.Common public class StringLuaLibrary : LuaLibraryBase { public override string Name { get { return "string"; } } - public override string[] Functions - { - get - { - return new[] - { - "binary", - "hex", - "octal", - "trim", - "replace", - "toupper", - "tolower", - "startswith", - "substring", - "contains", - "endswith" - }; - } - } [LuaMethodAttributes( "hex", diff --git a/BizHawk.Client.Common/lua/LuaLibraryBase.cs b/BizHawk.Client.Common/lua/LuaLibraryBase.cs index 432e0242e7..4932218514 100644 --- a/BizHawk.Client.Common/lua/LuaLibraryBase.cs +++ b/BizHawk.Client.Common/lua/LuaLibraryBase.cs @@ -8,26 +8,8 @@ namespace BizHawk.Client.Common public abstract class LuaLibraryBase { public abstract string Name { get; } - public abstract string[] Functions { get; } public virtual void LuaRegister(Lua lua, ILuaDocumentation docs = null) - { - lua.NewTable(Name); - foreach (var methodName in Functions) - { - var func = Name + "." + methodName; - var method = GetType().GetMethod(Name + "_" + methodName); - lua.RegisterFunction(func, this, method); - - if (docs != null) - { - docs.Add(Name, methodName, method, String.Empty); - } - } - } - - // TODO: eventually only use this, and rename it - public virtual void LuaRegisterNew(Lua lua, ILuaDocumentation docs = null) { lua.NewTable(Name); diff --git a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Client.cs b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Client.cs index c6028d4cf8..5aadc3b697 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Client.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Client.cs @@ -24,50 +24,6 @@ namespace BizHawk.Client.EmuHawk public EmuHawkLuaLibrary() { } public override string Name { get { return "client"; } } - public override string[] Functions - { - get - { - return new[] - { - "clearautohold", - "closerom", - "enablerewind", - "frameskip", - "getdisplayfilter", - "gettargetscanlineintensity", - "getwindowsize", - "ispaused", - "opencheats", - "openhexeditor", - "openramwatch", - "openramsearch", - "openrom", - "opentasstudio", - "opentoolbox", - "opentracelogger", - "paint", - "pause", - "pause_av", - "reboot_core", - "screenheight", - "screenshot", - "screenshottoclipboard", - "screenwidth", - "setdisplayfilter", - "setscreenshotosd", - "settargetscanlineintensity", - "setwindowsize", - "speedmode", - "togglepause", - "unpause", - "unpause_av", - "xpos", - "ypos" - }; - } - } - public Action LogOutputCallback { get; set; } private void Log(string message) diff --git a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Console.cs b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Console.cs index 697ad5455e..e688db5493 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Console.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Console.cs @@ -10,19 +10,6 @@ namespace BizHawk.Client.EmuHawk public class ConsoleLuaLibrary : LuaLibraryBase { public override string Name { get { return "console"; } } - public override string[] Functions - { - get - { - return new[] - { - "clear", - "getluafunctionslist", - "log", - "output" - }; - } - } [LuaMethodAttributes( "clear", diff --git a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Forms.cs b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Forms.cs index eceaff2abf..de6c131770 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Forms.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Forms.cs @@ -13,33 +13,6 @@ namespace BizHawk.Client.EmuHawk { // TODO: replace references to ConsoleLuaLibrary.Log with a callback that is passed in public override string Name { get { return "forms"; } } - public override string[] Functions - { - get - { - return new[] - { - "addclick", - "button", - "checkbox", - "clearclicks", - "destroy", - "destroyall", - "dropdown", - "getproperty", - "gettext", - "ischecked", - "label", - "newform", - "openfile", - "setlocation", - "setproperty", - "setsize", - "settext", - "textbox" - }; - } - } #region Forms Library Helpers diff --git a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Gui.cs b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Gui.cs index 7006581d1d..df062564ae 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Gui.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Gui.cs @@ -11,32 +11,6 @@ namespace BizHawk.Client.EmuHawk public class GuiLuaLibrary : LuaLibraryBase { public override string Name { get { return "gui"; } } - public override string[] Functions - { - get - { - return new[] - { - "addmessage", - "alert", - "clearGraphics", - "cleartext", - "drawBezier", - "drawBox", - "drawEllipse", - "drawIcon", - "drawImage", - "drawLine", - "drawPie", - "drawPixel", - "drawPolygon", - "drawRectangle", - "drawString", - "drawText", - "text" - }; - } - } #region Gui API diff --git a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Input.cs b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Input.cs index 6fae3834fd..1d10a0b878 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Input.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Input.cs @@ -14,17 +14,6 @@ namespace BizHawk.Client.EmuHawk } public override string Name { get { return "input"; } } - public override string[] Functions - { - get - { - return new[] - { - "get", - "getmouse" - }; - } - } private readonly Lua _lua; diff --git a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Savestate.cs b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Savestate.cs index 0f7bffd5ef..542af1654b 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Savestate.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Savestate.cs @@ -6,19 +6,6 @@ namespace BizHawk.Client.EmuHawk public class SavestateLuaLibrary : LuaLibraryBase { public override string Name { get { return "savestate"; } } - public override string[] Functions - { - get - { - return new[] - { - "load", - "loadslot", - "save", - "saveslot" - }; - } - } [LuaMethodAttributes( "load", diff --git a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.cs b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.cs index 64a6265461..cbf4c16b62 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.cs @@ -80,28 +80,28 @@ namespace BizHawk.Client.EmuHawk { lua.RegisterFunction("print", this, GetType().GetMethod("Print")); - new BitLuaLibrary().LuaRegisterNew(lua, Docs); - new EmuHawkLuaLibrary(ConsoleLuaLibrary.Log).LuaRegisterNew(lua, Docs); - new ConsoleLuaLibrary().LuaRegisterNew(lua, Docs); + new BitLuaLibrary().LuaRegister(lua, Docs); + new EmuHawkLuaLibrary(ConsoleLuaLibrary.Log).LuaRegister(lua, Docs); + new ConsoleLuaLibrary().LuaRegister(lua, Docs); new EmulatorLuaLibrary( _lua, Frameadvance, EmuYield - ).LuaRegisterNew(lua, Docs); + ).LuaRegister(lua, Docs); - _eventLibrary.LuaRegisterNew(lua, Docs); - _formsLibrary.LuaRegisterNew(lua, Docs); - _guiLibrary.LuaRegisterNew(lua, Docs); - new InputLuaLibrary(_lua).LuaRegisterNew(lua, Docs); - new JoypadLuaLibrary(_lua).LuaRegisterNew(lua, Docs); - new MemoryLuaLibrary().LuaRegisterNew(lua, Docs); - new MainMemoryLuaLibrary(_lua).LuaRegisterNew(lua, Docs); - new MovieLuaLibrary(_lua).LuaRegisterNew(lua, Docs); - new NESLuaLibrary().LuaRegisterNew(lua, Docs); - new SavestateLuaLibrary().LuaRegisterNew(lua, Docs); - new SNESLuaLibrary().LuaRegisterNew(lua, Docs); - new StringLuaLibrary().LuaRegisterNew(lua, Docs); + _eventLibrary.LuaRegister(lua, Docs); + _formsLibrary.LuaRegister(lua, Docs); + _guiLibrary.LuaRegister(lua, Docs); + new InputLuaLibrary(_lua).LuaRegister(lua, Docs); + new JoypadLuaLibrary(_lua).LuaRegister(lua, Docs); + new MemoryLuaLibrary().LuaRegister(lua, Docs); + new MainMemoryLuaLibrary(_lua).LuaRegister(lua, Docs); + new MovieLuaLibrary(_lua).LuaRegister(lua, Docs); + new NESLuaLibrary().LuaRegister(lua, Docs); + new SavestateLuaLibrary().LuaRegister(lua, Docs); + new SNESLuaLibrary().LuaRegister(lua, Docs); + new StringLuaLibrary().LuaRegister(lua, Docs); Docs.Sort(); }