LUa - whack now unused code

This commit is contained in:
adelikat 2014-01-26 16:21:20 +00:00
parent 5f9757d7d0
commit 91fdad9d45
18 changed files with 16 additions and 422 deletions

View File

@ -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",

View File

@ -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;

View File

@ -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<string> LogOutputCallback { get; set; }
public Lua CurrentThread { get; set; }

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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);

View File

@ -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<string> LogOutputCallback { get; set; }
private void Log(string message)

View File

@ -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",

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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",

View File

@ -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();
}