rename LuaMethodAttributes to LuaMethodAttribute so as not to be a bad person

This commit is contained in:
adelikat 2017-07-10 14:02:00 -05:00
parent 0f686a0de1
commit 9581ce6a93
27 changed files with 372 additions and 538 deletions

View File

@ -16,92 +16,92 @@ namespace BizHawk.Client.Common
public override string Name => "bit"; public override string Name => "bit";
[LuaMethodAttributes("band", "Bitwise AND of 'val' against 'amt'")] [LuaMethod("band", "Bitwise AND of 'val' against 'amt'")]
public static uint Band(uint val, uint amt) public static uint Band(uint val, uint amt)
{ {
return val & amt; return val & amt;
} }
[LuaMethodAttributes("bnot", "Bitwise NOT of 'val' against 'amt'")] [LuaMethod("bnot", "Bitwise NOT of 'val' against 'amt'")]
public static uint Bnot(uint val) public static uint Bnot(uint val)
{ {
return ~val; return ~val;
} }
[LuaMethodAttributes("bor", "Bitwise OR of 'val' against 'amt'")] [LuaMethod("bor", "Bitwise OR of 'val' against 'amt'")]
public static uint Bor(uint val, uint amt) public static uint Bor(uint val, uint amt)
{ {
return val | amt; return val | amt;
} }
[LuaMethodAttributes("bxor", "Bitwise XOR of 'val' against 'amt'")] [LuaMethod("bxor", "Bitwise XOR of 'val' against 'amt'")]
public static uint Bxor(uint val, uint amt) public static uint Bxor(uint val, uint amt)
{ {
return val ^ amt; return val ^ amt;
} }
[LuaMethodAttributes("lshift", "Logical shift left of 'val' by 'amt' bits")] [LuaMethod("lshift", "Logical shift left of 'val' by 'amt' bits")]
public static uint Lshift(uint val, int amt) public static uint Lshift(uint val, int amt)
{ {
return val << amt; return val << amt;
} }
[LuaMethodAttributes("rol", "Left rotate 'val' by 'amt' bits")] [LuaMethod("rol", "Left rotate 'val' by 'amt' bits")]
public static uint Rol(uint val, int amt) public static uint Rol(uint val, int amt)
{ {
return (val << amt) | (val >> (32 - amt)); return (val << amt) | (val >> (32 - amt));
} }
[LuaMethodAttributes("ror", "Right rotate 'val' by 'amt' bits")] [LuaMethod("ror", "Right rotate 'val' by 'amt' bits")]
public static uint Ror(uint val, int amt) public static uint Ror(uint val, int amt)
{ {
return (val >> amt) | (val << (32 - amt)); return (val >> amt) | (val << (32 - amt));
} }
[LuaMethodAttributes("rshift", "Logical shift right of 'val' by 'amt' bits")] [LuaMethod("rshift", "Logical shift right of 'val' by 'amt' bits")]
public static uint Rshift(uint val, int amt) public static uint Rshift(uint val, int amt)
{ {
return (uint)(val >> amt); return (uint)(val >> amt);
} }
[LuaMethodAttributes("arshift", "Arithmetic shift right of 'val' by 'amt' bits")] [LuaMethod("arshift", "Arithmetic shift right of 'val' by 'amt' bits")]
public static int Arshift(int val, int amt) public static int Arshift(int val, int amt)
{ {
return val >> amt; return val >> amt;
} }
[LuaMethodAttributes("check", "Returns result of bit 'pos' being set in 'num'")] [LuaMethod("check", "Returns result of bit 'pos' being set in 'num'")]
public static bool Check(long num, int pos) public static bool Check(long num, int pos)
{ {
return (num & (1 << pos)) != 0; return (num & (1 << pos)) != 0;
} }
[LuaMethodAttributes("set", "Sets the bit 'pos' in 'num'")] [LuaMethod("set", "Sets the bit 'pos' in 'num'")]
public static uint Set(uint num, int pos) public static uint Set(uint num, int pos)
{ {
return (uint)(num | (uint)1 << pos); return (uint)(num | (uint)1 << pos);
} }
[LuaMethodAttributes("clear", "Clears the bit 'pos' in 'num'")] [LuaMethod("clear", "Clears the bit 'pos' in 'num'")]
public static long Clear(uint num, int pos) public static long Clear(uint num, int pos)
{ {
return num & ~(1 << pos); return num & ~(1 << pos);
} }
[LuaMethodAttributes("byteswap_16", "Byte swaps 'short', i.e. bit.byteswap_16(0xFF00) would return 0x00FF")] [LuaMethod("byteswap_16", "Byte swaps 'short', i.e. bit.byteswap_16(0xFF00) would return 0x00FF")]
public static ushort Byteswap16(ushort val) public static ushort Byteswap16(ushort val)
{ {
return (ushort)((val & 0xFFU) << 8 | (val & 0xFF00U) >> 8); return (ushort)((val & 0xFFU) << 8 | (val & 0xFF00U) >> 8);
} }
[LuaMethodAttributes("byteswap_32", "Byte swaps 'dword'")] [LuaMethod("byteswap_32", "Byte swaps 'dword'")]
public static uint Byteswap32(uint val) public static uint Byteswap32(uint val)
{ {
return (val & 0x000000FFU) << 24 | (val & 0x0000FF00U) << 8 | return (val & 0x000000FFU) << 24 | (val & 0x0000FF00U) << 8 |
(val & 0x00FF0000U) >> 8 | (val & 0xFF000000U) >> 24; (val & 0x00FF0000U) >> 8 | (val & 0xFF000000U) >> 24;
} }
[LuaMethodAttributes("byteswap_64", "Byte swaps 'long'")] [LuaMethod("byteswap_64", "Byte swaps 'long'")]
public static ulong Byteswap64(ulong val) public static ulong Byteswap64(ulong val)
{ {
return (val & 0x00000000000000FFUL) << 56 | (val & 0x000000000000FF00UL) << 40 | return (val & 0x00000000000000FFUL) << 56 | (val & 0x000000000000FF00UL) << 40 |

View File

@ -48,25 +48,25 @@ namespace BizHawk.Client.Common
public override string Name => "emu"; public override string Name => "emu";
[LuaMethodAttributes("displayvsync", "Sets the display vsync property of the emulator")] [LuaMethod("displayvsync", "Sets the display vsync property of the emulator")]
public static void DisplayVsync(bool enabled) public static void DisplayVsync(bool enabled)
{ {
Global.Config.VSync = enabled; Global.Config.VSync = enabled;
} }
[LuaMethodAttributes("frameadvance", "Signals to the emulator to resume emulation. Necessary for any lua script while loop or else the emulator will freeze!")] [LuaMethod("frameadvance", "Signals to the emulator to resume emulation. Necessary for any lua script while loop or else the emulator will freeze!")]
public void FrameAdvance() public void FrameAdvance()
{ {
FrameAdvanceCallback(); FrameAdvanceCallback();
} }
[LuaMethodAttributes("framecount", "Returns the current frame count")] [LuaMethod("framecount", "Returns the current frame count")]
public int FrameCount() public int FrameCount()
{ {
return Emulator.Frame; return Emulator.Frame;
} }
[LuaMethodAttributes("disassemble", "Returns the disassembly object (disasm string and length int) for the given PC address. Uses System Bus domain if no domain name provided")] [LuaMethod("disassemble", "Returns the disassembly object (disasm string and length int) for the given PC address. Uses System Bus domain if no domain name provided")]
public object Disassemble(uint pc, string name = "") public object Disassemble(uint pc, string name = "")
{ {
try try
@ -95,8 +95,7 @@ namespace BizHawk.Client.Common
} }
// TODO: what about 64 bit registers? // TODO: what about 64 bit registers?
[LuaMethodAttributes( [LuaMethod("getregister", "returns the value of a cpu register or flag specified by name. For a complete list of possible registers or flags for a given core, use getregisters")]
"getregister", "returns the value of a cpu register or flag specified by name. For a complete list of possible registers or flags for a given core, use getregisters")]
public int GetRegister(string name) public int GetRegister(string name)
{ {
try try
@ -118,8 +117,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodAttributes( [LuaMethod("getregisters", "returns the complete set of available flags and registers for a given core")]
"getregisters", "returns the complete set of available flags and registers for a given core")]
public LuaTable GetRegisters() public LuaTable GetRegisters()
{ {
var table = Lua.NewTable(); var table = Lua.NewTable();
@ -144,7 +142,7 @@ namespace BizHawk.Client.Common
return table; return table;
} }
[LuaMethodAttributes("setregister", "sets the given register name to the given value")] [LuaMethod("setregister", "sets the given register name to the given value")]
public void SetRegister(string register, int value) public void SetRegister(string register, int value)
{ {
try try
@ -162,7 +160,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodAttributes("totalexecutedcycles", "gets the total number of executed cpu cycles")] [LuaMethod("totalexecutedcycles", "gets the total number of executed cpu cycles")]
public int TotalExecutedycles() public int TotalExecutedycles()
{ {
try try
@ -182,13 +180,13 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodAttributes("getsystemid", "Returns the ID string of the current core loaded. Note: No ROM loaded will return the string NULL")] [LuaMethod("getsystemid", "Returns the ID string of the current core loaded. Note: No ROM loaded will return the string NULL")]
public static string GetSystemId() public static string GetSystemId()
{ {
return Global.Game.System; return Global.Game.System;
} }
[LuaMethodAttributes("islagged", "Returns whether or not the current frame is a lag frame")] [LuaMethod("islagged", "Returns whether or not the current frame is a lag frame")]
public bool IsLagged() public bool IsLagged()
{ {
if (InputPollableCore != null) if (InputPollableCore != null)
@ -200,7 +198,7 @@ namespace BizHawk.Client.Common
return false; return false;
} }
[LuaMethodAttributes("setislagged", "Sets the lag flag for the current frame. If no value is provided, it will default to true")] [LuaMethod("setislagged", "Sets the lag flag for the current frame. If no value is provided, it will default to true")]
public void SetIsLagged(bool value = true) public void SetIsLagged(bool value = true)
{ {
if (InputPollableCore != null) if (InputPollableCore != null)
@ -213,7 +211,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodAttributes("lagcount", "Returns the current lag count")] [LuaMethod("lagcount", "Returns the current lag count")]
public int LagCount() public int LagCount()
{ {
if (InputPollableCore != null) if (InputPollableCore != null)
@ -225,7 +223,7 @@ namespace BizHawk.Client.Common
return 0; return 0;
} }
[LuaMethodAttributes("setlagcount", "Sets the current lag count")] [LuaMethod("setlagcount", "Sets the current lag count")]
public void SetLagCount(int count) public void SetLagCount(int count)
{ {
if (InputPollableCore != null) if (InputPollableCore != null)
@ -238,19 +236,19 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodAttributes("limitframerate", "sets the limit framerate property of the emulator")] [LuaMethod("limitframerate", "sets the limit framerate property of the emulator")]
public static void LimitFramerate(bool enabled) public static void LimitFramerate(bool enabled)
{ {
Global.Config.ClockThrottle = enabled; Global.Config.ClockThrottle = enabled;
} }
[LuaMethodAttributes("minimizeframeskip", "Sets the autominimizeframeskip value of the emulator")] [LuaMethod("minimizeframeskip", "Sets the autominimizeframeskip value of the emulator")]
public static void MinimizeFrameskip(bool enabled) public static void MinimizeFrameskip(bool enabled)
{ {
Global.Config.AutoMinimizeSkipping = enabled; Global.Config.AutoMinimizeSkipping = enabled;
} }
[LuaMethodAttributes("setrenderplanes", "Toggles the drawing of sprites and background planes. Set to false or nil to disable a pane, anything else will draw them")] [LuaMethod("setrenderplanes", "Toggles the drawing of sprites and background planes. Set to false or nil to disable a pane, anything else will draw them")]
public void SetRenderPlanes(params bool[] luaParam) public void SetRenderPlanes(params bool[] luaParam)
{ {
if (Emulator is NES) if (Emulator is NES)
@ -324,13 +322,13 @@ namespace BizHawk.Client.Common
return true; return true;
} }
[LuaMethodAttributes("yield", "allows a script to run while emulation is paused and interact with the gui/main window in realtime ")] [LuaMethod("yield", "allows a script to run while emulation is paused and interact with the gui/main window in realtime ")]
public void Yield() public void Yield()
{ {
YieldCallback(); YieldCallback();
} }
[LuaMethodAttributes("getdisplaytype", "returns the display type (PAL vs NTSC) that the emulator is currently running in")] [LuaMethod("getdisplaytype", "returns the display type (PAL vs NTSC) that the emulator is currently running in")]
public string GetDisplayType() public string GetDisplayType()
{ {
if (RegionableCore != null) if (RegionableCore != null)
@ -341,7 +339,7 @@ namespace BizHawk.Client.Common
return ""; return "";
} }
[LuaMethodAttributes("getboardname", "returns (if available) the board name of the loaded ROM")] [LuaMethod("getboardname", "returns (if available) the board name of the loaded ROM")]
public string GetBoardName() public string GetBoardName()
{ {
if (BoardInfo != null) if (BoardInfo != null)

View File

@ -156,8 +156,7 @@ namespace BizHawk.Client.Common
#endregion #endregion
[LuaMethodAttributes( [LuaMethod("onframeend", "Calls the given lua function at the end of each frame, after all emulation and drawing has completed. Note: this is the default behavior of lua scripts")]
"onframeend", "Calls the given lua function at the end of each frame, after all emulation and drawing has completed. Note: this is the default behavior of lua scripts")]
public string OnFrameEnd(LuaFunction luaf, string name = null) public string OnFrameEnd(LuaFunction luaf, string name = null)
{ {
var nlf = new NamedLuaFunction(luaf, "OnFrameEnd", LogOutputCallback, CurrentThread, name); var nlf = new NamedLuaFunction(luaf, "OnFrameEnd", LogOutputCallback, CurrentThread, name);
@ -165,8 +164,7 @@ namespace BizHawk.Client.Common
return nlf.Guid.ToString(); return nlf.Guid.ToString();
} }
[LuaMethodAttributes( [LuaMethod("onframestart", "Calls the given lua function at the beginning of each frame before any emulation and drawing occurs")]
"onframestart", "Calls the given lua function at the beginning of each frame before any emulation and drawing occurs")]
public string OnFrameStart(LuaFunction luaf, string name = null) public string OnFrameStart(LuaFunction luaf, string name = null)
{ {
var nlf = new NamedLuaFunction(luaf, "OnFrameStart", LogOutputCallback, CurrentThread, name); var nlf = new NamedLuaFunction(luaf, "OnFrameStart", LogOutputCallback, CurrentThread, name);
@ -174,8 +172,7 @@ namespace BizHawk.Client.Common
return nlf.Guid.ToString(); return nlf.Guid.ToString();
} }
[LuaMethodAttributes( [LuaMethod("oninputpoll", "Calls the given lua function after each time the emulator core polls for input")]
"oninputpoll", "Calls the given lua function after each time the emulator core polls for input")]
public string OnInputPoll(LuaFunction luaf, string name = null) public string OnInputPoll(LuaFunction luaf, string name = null)
{ {
var nlf = new NamedLuaFunction(luaf, "OnInputPoll", LogOutputCallback, CurrentThread, name); var nlf = new NamedLuaFunction(luaf, "OnInputPoll", LogOutputCallback, CurrentThread, name);
@ -204,8 +201,7 @@ namespace BizHawk.Client.Common
Log($"Error: {Emulator.Attributes().CoreName} does not yet implement input polling callbacks"); Log($"Error: {Emulator.Attributes().CoreName} does not yet implement input polling callbacks");
} }
[LuaMethodAttributes( [LuaMethod("onloadstate", "Fires after a state is loaded. Receives a lua function name, and registers it to the event immediately following a successful savestate event")]
"onloadstate", "Fires after a state is loaded. Receives a lua function name, and registers it to the event immediately following a successful savestate event")]
public string OnLoadState(LuaFunction luaf, string name = null) public string OnLoadState(LuaFunction luaf, string name = null)
{ {
var nlf = new NamedLuaFunction(luaf, "OnSavestateLoad", LogOutputCallback, CurrentThread, name); var nlf = new NamedLuaFunction(luaf, "OnSavestateLoad", LogOutputCallback, CurrentThread, name);
@ -213,7 +209,7 @@ namespace BizHawk.Client.Common
return nlf.Guid.ToString(); return nlf.Guid.ToString();
} }
[LuaMethodAttributes("onmemoryexecute", "Fires after the given address is executed by the core")] [LuaMethod("onmemoryexecute", "Fires after the given address is executed by the core")]
public string OnMemoryExecute(LuaFunction luaf, uint address, string name = null) public string OnMemoryExecute(LuaFunction luaf, uint address, string name = null)
{ {
try try
@ -244,8 +240,7 @@ namespace BizHawk.Client.Common
return Guid.Empty.ToString(); return Guid.Empty.ToString();
} }
[LuaMethodAttributes( [LuaMethod("onmemoryread", "Fires after the given address is read by the core. If no address is given, it will attach to every memory read")]
"onmemoryread", "Fires after the given address is read by the core. If no address is given, it will attach to every memory read")]
public string OnMemoryRead(LuaFunction luaf, uint? address = null, string name = null) public string OnMemoryRead(LuaFunction luaf, uint? address = null, string name = null)
{ {
try try
@ -275,8 +270,7 @@ namespace BizHawk.Client.Common
return Guid.Empty.ToString(); return Guid.Empty.ToString();
} }
[LuaMethodAttributes( [LuaMethod("onmemorywrite", "Fires after the given address is written by the core. If no address is given, it will attach to every memory write")]
"onmemorywrite", "Fires after the given address is written by the core. If no address is given, it will attach to every memory write")]
public string OnMemoryWrite(LuaFunction luaf, uint? address = null, string name = null) public string OnMemoryWrite(LuaFunction luaf, uint? address = null, string name = null)
{ {
try try
@ -306,7 +300,7 @@ namespace BizHawk.Client.Common
return Guid.Empty.ToString(); return Guid.Empty.ToString();
} }
[LuaMethodAttributes("onsavestate", "Fires after a state is saved")] [LuaMethod("onsavestate", "Fires after a state is saved")]
public string OnSaveState(LuaFunction luaf, string name = null) public string OnSaveState(LuaFunction luaf, string name = null)
{ {
var nlf = new NamedLuaFunction(luaf, "OnSavestateSave", LogOutputCallback, CurrentThread, name); var nlf = new NamedLuaFunction(luaf, "OnSavestateSave", LogOutputCallback, CurrentThread, name);
@ -314,7 +308,7 @@ namespace BizHawk.Client.Common
return nlf.Guid.ToString(); return nlf.Guid.ToString();
} }
[LuaMethodAttributes("onexit", "Fires after the calling script has stopped")] [LuaMethod("onexit", "Fires after the calling script has stopped")]
public string OnExit(LuaFunction luaf, string name = null) public string OnExit(LuaFunction luaf, string name = null)
{ {
var nlf = new NamedLuaFunction(luaf, "OnExit", LogOutputCallback, CurrentThread, name); var nlf = new NamedLuaFunction(luaf, "OnExit", LogOutputCallback, CurrentThread, name);
@ -322,8 +316,7 @@ namespace BizHawk.Client.Common
return nlf.Guid.ToString(); return nlf.Guid.ToString();
} }
[LuaMethodAttributes( [LuaMethod("unregisterbyid", "Removes the registered function that matches the guid. If a function is found and remove the function will return true. If unable to find a match, the function will return false.")]
"unregisterbyid", "Removes the registered function that matches the guid. If a function is found and remove the function will return true. If unable to find a match, the function will return false.")]
public bool UnregisterById(string guid) public bool UnregisterById(string guid)
{ {
foreach (var nlf in _luaFunctions.Where(nlf => nlf.Guid.ToString() == guid.ToString())) foreach (var nlf in _luaFunctions.Where(nlf => nlf.Guid.ToString() == guid.ToString()))
@ -335,8 +328,7 @@ namespace BizHawk.Client.Common
return false; return false;
} }
[LuaMethodAttributes( [LuaMethod("unregisterbyname", "Removes the first registered function that matches Name. If a function is found and remove the function will return true. If unable to find a match, the function will return false.")]
"unregisterbyname", "Removes the first registered function that matches Name. If a function is found and remove the function will return true. If unable to find a match, the function will return false.")]
public bool UnregisterByName(string name) public bool UnregisterByName(string name)
{ {
foreach (var nlf in _luaFunctions.Where(nlf => nlf.Name == name)) foreach (var nlf in _luaFunctions.Where(nlf => nlf.Name == name))

View File

@ -18,8 +18,7 @@ namespace BizHawk.Client.Common
public override string Name => "gameinfo"; public override string Name => "gameinfo";
[LuaMethodAttributes( [LuaMethod("getromname", "returns the path of the currently loaded rom, if a rom is loaded")]
"getromname", "returns the path of the currently loaded rom, if a rom is loaded")]
public string GetRomName() public string GetRomName()
{ {
if (Global.Game != null) if (Global.Game != null)
@ -30,8 +29,7 @@ namespace BizHawk.Client.Common
return ""; return "";
} }
[LuaMethodAttributes( [LuaMethod("getromhash", "returns the hash of the currently loaded rom, if a rom is loaded")]
"getromhash", "returns the hash of the currently loaded rom, if a rom is loaded")]
public string GetRomHash() public string GetRomHash()
{ {
if (Global.Game != null) if (Global.Game != null)
@ -42,8 +40,7 @@ namespace BizHawk.Client.Common
return ""; return "";
} }
[LuaMethodAttributes( [LuaMethod("indatabase", "returns whether or not the currently loaded rom is in the game database")]
"indatabase", "returns whether or not the currently loaded rom is in the game database")]
public bool InDatabase() public bool InDatabase()
{ {
if (Global.Game != null) if (Global.Game != null)
@ -54,8 +51,7 @@ namespace BizHawk.Client.Common
return false; return false;
} }
[LuaMethodAttributes( [LuaMethod("getstatus", "returns the game database status of the currently loaded rom. Statuses are for example: GoodDump, BadDump, Hack, Unknown, NotInDatabase")]
"getstatus", "returns the game database status of the currently loaded rom. Statuses are for example: GoodDump, BadDump, Hack, Unknown, NotInDatabase")]
public string GetStatus() public string GetStatus()
{ {
if (Global.Game != null) if (Global.Game != null)
@ -66,8 +62,7 @@ namespace BizHawk.Client.Common
return ""; return "";
} }
[LuaMethodAttributes( [LuaMethod("isstatusbad", "returns the currently loaded rom's game database status is considered 'bad'")]
"isstatusbad", "returns the currently loaded rom's game database status is considered 'bad'")]
public bool IsStatusBad() public bool IsStatusBad()
{ {
if (Global.Game != null) if (Global.Game != null)
@ -78,15 +73,13 @@ namespace BizHawk.Client.Common
return true; return true;
} }
[LuaMethodAttributes( [LuaMethod("getboardtype", "returns identifying information about the 'mapper' or similar capability used for this game. empty if no such useful distinction can be drawn")]
"getboardtype", "returns identifying information about the 'mapper' or similar capability used for this game. empty if no such useful distinction can be drawn")]
public string GetBoardType() public string GetBoardType()
{ {
return BoardInfo?.BoardName ?? ""; return BoardInfo?.BoardName ?? "";
} }
[LuaMethodAttributes( [LuaMethod("getoptions", "returns the game options for the currently loaded rom. Options vary per platform")]
"getoptions", "returns the game options for the currently loaded rom. Options vary per platform")]
public LuaTable GetOptions() public LuaTable GetOptions()
{ {
var options = Lua.NewTable(); var options = Lua.NewTable();

View File

@ -37,33 +37,25 @@ namespace BizHawk.Client.Common
Genesis?.PutSettings(settings); Genesis?.PutSettings(settings);
} }
[LuaMethodAttributes( [LuaMethod("getlayer_bga", "Returns whether the bg layer A is displayed")]
"getlayer_bga",
"Returns whether the bg layer A is displayed")]
public bool GetLayerBgA() public bool GetLayerBgA()
{ {
return GetSettings().DrawBGA; return GetSettings().DrawBGA;
} }
[LuaMethodAttributes( [LuaMethod("getlayer_bgb", "Returns whether the bg layer B is displayed")]
"getlayer_bgb",
"Returns whether the bg layer B is displayed")]
public bool GetLayerBgB() public bool GetLayerBgB()
{ {
return GetSettings().DrawBGB; return GetSettings().DrawBGB;
} }
[LuaMethodAttributes( [LuaMethod("getlayer_bgw", "Returns whether the bg layer W is displayed")]
"getlayer_bgw",
"Returns whether the bg layer W is displayed")]
public bool GetLayerBgW() public bool GetLayerBgW()
{ {
return GetSettings().DrawBGW; return GetSettings().DrawBGW;
} }
[LuaMethodAttributes( [LuaMethod("setlayer_bga", "Sets whether the bg layer A is displayed")]
"setlayer_bga",
"Sets whether the bg layer A is displayed")]
public void SetLayerBgA(bool value) public void SetLayerBgA(bool value)
{ {
var s = GetSettings(); var s = GetSettings();
@ -71,9 +63,7 @@ namespace BizHawk.Client.Common
PutSettings(s); PutSettings(s);
} }
[LuaMethodAttributes( [LuaMethod("setlayer_bgb", "Sets whether the bg layer B is displayed")]
"setlayer_bgb",
"Sets whether the bg layer B is displayed")]
public void SetLayerBgB(bool value) public void SetLayerBgB(bool value)
{ {
var s = GetSettings(); var s = GetSettings();
@ -81,9 +71,7 @@ namespace BizHawk.Client.Common
PutSettings(s); PutSettings(s);
} }
[LuaMethodAttributes( [LuaMethod("setlayer_bgw", "Sets whether the bg layer W is displayed")]
"setlayer_bgw",
"Sets whether the bg layer W is displayed")]
public void SetLayerBgW(bool value) public void SetLayerBgW(bool value)
{ {
var s = GetSettings(); var s = GetSettings();

View File

@ -13,8 +13,7 @@ namespace BizHawk.Client.Common
public override string Name => "joypad"; public override string Name => "joypad";
[LuaMethodAttributes( [LuaMethod("get", "returns a lua table of the controller buttons pressed. If supplied, it will only return a table of buttons for the given controller")]
"get", "returns a lua table of the controller buttons pressed. If supplied, it will only return a table of buttons for the given controller")]
public LuaTable Get(int? controller = null) public LuaTable Get(int? controller = null)
{ {
var buttons = Lua.NewTable(); var buttons = Lua.NewTable();
@ -51,8 +50,7 @@ namespace BizHawk.Client.Common
} }
// TODO: what about float controls? // TODO: what about float controls?
[LuaMethodAttributes( [LuaMethod("getimmediate", "returns a lua table of any controller buttons currently pressed by the user")]
"getimmediate", "returns a lua table of any controller buttons currently pressed by the user")]
public LuaTable GetImmediate() public LuaTable GetImmediate()
{ {
var buttons = Lua.NewTable(); var buttons = Lua.NewTable();
@ -64,8 +62,7 @@ namespace BizHawk.Client.Common
return buttons; return buttons;
} }
[LuaMethodAttributes( [LuaMethod("setfrommnemonicstr", "sets the given buttons to their provided values for the current frame, string will be interpretted the same way an entry from a movie input log would be")]
"setfrommnemonicstr", "sets the given buttons to their provided values for the current frame, string will be interpretted the same way an entry from a movie input log would be")]
public void SetFromMnemonicStr(string inputLogEntry) public void SetFromMnemonicStr(string inputLogEntry)
{ {
try try
@ -89,8 +86,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodAttributes( [LuaMethod("set", "sets the given buttons to their provided values for the current frame")]
"set", "sets the given buttons to their provided values for the current frame")]
public void Set(LuaTable buttons, int? controller = null) public void Set(LuaTable buttons, int? controller = null)
{ {
try try
@ -154,8 +150,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodAttributes( [LuaMethod("setanalog", "sets the given analog controls to their provided values for the current frame. Note that unlike set() there is only the logic of overriding with the given value.")]
"setanalog", "sets the given analog controls to their provided values for the current frame. Note that unlike set() there is only the logic of overriding with the given value.")]
public void SetAnalog(LuaTable controls, object controller = null) public void SetAnalog(LuaTable controls, object controller = null)
{ {
try try

View File

@ -37,13 +37,13 @@ namespace BizHawk.Client.Common
#region Unique Library Methods #region Unique Library Methods
[LuaMethodAttributes("getname", "returns the name of the domain defined as main memory for the given core")] [LuaMethod("getname", "returns the name of the domain defined as main memory for the given core")]
public string GetName() public string GetName()
{ {
return Domain.Name; return Domain.Name;
} }
[LuaMethodAttributes("getcurrentmemorydomainsize", "Returns the number of bytes of the domain defined as main memory")] [LuaMethod("getcurrentmemorydomainsize", "Returns the number of bytes of the domain defined as main memory")]
public uint GetSize() public uint GetSize()
{ {
return (uint)Domain.Size; return (uint)Domain.Size;
@ -53,40 +53,37 @@ namespace BizHawk.Client.Common
#region Common Special and Legacy Methods #region Common Special and Legacy Methods
[LuaMethodAttributes("readbyte", "gets the value from the given address as an unsigned byte")] [LuaMethod("readbyte", "gets the value from the given address as an unsigned byte")]
public uint ReadByte(int addr) public uint ReadByte(int addr)
{ {
return ReadUnsignedByte(addr); return ReadUnsignedByte(addr);
} }
[LuaMethodAttributes("writebyte", "Writes the given value to the given address as an unsigned byte")] [LuaMethod("writebyte", "Writes the given value to the given address as an unsigned byte")]
public void WriteByte(int addr, uint value) public void WriteByte(int addr, uint value)
{ {
WriteUnsignedByte(addr, value); WriteUnsignedByte(addr, value);
} }
[LuaMethodAttributes( [LuaMethod("readbyterange", "Reads the address range that starts from address, and is length long. Returns the result into a table of key value pairs (where the address is the key).")]
"readbyterange", "Reads the address range that starts from address, and is length long. Returns the result into a table of key value pairs (where the address is the key).")]
public LuaTable ReadByteRange(int addr, int length) public LuaTable ReadByteRange(int addr, int length)
{ {
return base.ReadByteRange(addr, length); return base.ReadByteRange(addr, length);
} }
[LuaMethodAttributes("writebyterange", "Writes the given values to the given addresses as unsigned bytes")] [LuaMethod("writebyterange", "Writes the given values to the given addresses as unsigned bytes")]
public void WriteByteRange(LuaTable memoryblock) public void WriteByteRange(LuaTable memoryblock)
{ {
base.WriteByteRange(memoryblock); base.WriteByteRange(memoryblock);
} }
[LuaMethodAttributes( [LuaMethod("readfloat", "Reads the given address as a 32-bit float value from the main memory domain with th e given endian")]
"readfloat", "Reads the given address as a 32-bit float value from the main memory domain with th e given endian")]
public float ReadFloat(int addr, bool bigendian) public float ReadFloat(int addr, bool bigendian)
{ {
return base.ReadFloat(addr, bigendian); return base.ReadFloat(addr, bigendian);
} }
[LuaMethodAttributes( [LuaMethod("writefloat", "Writes the given 32-bit float value to the given address and endian")]
"writefloat", "Writes the given 32-bit float value to the given address and endian")]
public void WriteFloat(int addr, double value, bool bigendian) public void WriteFloat(int addr, double value, bool bigendian)
{ {
base.WriteFloat(addr, value, bigendian); base.WriteFloat(addr, value, bigendian);
@ -96,25 +93,25 @@ namespace BizHawk.Client.Common
#region 1 Byte #region 1 Byte
[LuaMethodAttributes("read_s8", "read signed byte")] [LuaMethod("read_s8", "read signed byte")]
public int ReadS8(int addr) public int ReadS8(int addr)
{ {
return (sbyte)ReadUnsignedByte(addr); return (sbyte)ReadUnsignedByte(addr);
} }
[LuaMethodAttributes("write_s8", "write signed byte")] [LuaMethod("write_s8", "write signed byte")]
public void WriteS8(int addr, uint value) public void WriteS8(int addr, uint value)
{ {
WriteUnsignedByte(addr, value); WriteUnsignedByte(addr, value);
} }
[LuaMethodAttributes("read_u8", "read unsigned byte")] [LuaMethod("read_u8", "read unsigned byte")]
public uint ReadU8(int addr) public uint ReadU8(int addr)
{ {
return ReadUnsignedByte(addr); return ReadUnsignedByte(addr);
} }
[LuaMethodAttributes("write_u8", "write unsigned byte")] [LuaMethod("write_u8", "write unsigned byte")]
public void WriteU8(int addr, uint value) public void WriteU8(int addr, uint value)
{ {
WriteUnsignedByte(addr, value); WriteUnsignedByte(addr, value);
@ -124,49 +121,49 @@ namespace BizHawk.Client.Common
#region 2 Byte #region 2 Byte
[LuaMethodAttributes("read_s16_le", "read signed 2 byte value, little endian")] [LuaMethod("read_s16_le", "read signed 2 byte value, little endian")]
public int ReadS16Little(int addr) public int ReadS16Little(int addr)
{ {
return ReadSignedLittleCore(addr, 2); return ReadSignedLittleCore(addr, 2);
} }
[LuaMethodAttributes("write_s16_le", "write signed 2 byte value, little endian")] [LuaMethod("write_s16_le", "write signed 2 byte value, little endian")]
public void WriteS16Little(int addr, int value) public void WriteS16Little(int addr, int value)
{ {
WriteSignedLittle(addr, value, 2); WriteSignedLittle(addr, value, 2);
} }
[LuaMethodAttributes("read_s16_be", "read signed 2 byte value, big endian")] [LuaMethod("read_s16_be", "read signed 2 byte value, big endian")]
public int ReadS16Big(int addr) public int ReadS16Big(int addr)
{ {
return ReadSignedBig(addr, 2); return ReadSignedBig(addr, 2);
} }
[LuaMethodAttributes("write_s16_be", "write signed 2 byte value, big endian")] [LuaMethod("write_s16_be", "write signed 2 byte value, big endian")]
public void WriteS16Big(int addr, int value) public void WriteS16Big(int addr, int value)
{ {
WriteSignedBig(addr, value, 2); WriteSignedBig(addr, value, 2);
} }
[LuaMethodAttributes("read_u16_le", "read unsigned 2 byte value, little endian")] [LuaMethod("read_u16_le", "read unsigned 2 byte value, little endian")]
public uint ReadU16Little(int addr) public uint ReadU16Little(int addr)
{ {
return ReadSignedLittle(addr, 2); return ReadSignedLittle(addr, 2);
} }
[LuaMethodAttributes("write_u16_le", "write unsigned 2 byte value, little endian")] [LuaMethod("write_u16_le", "write unsigned 2 byte value, little endian")]
public void WriteU16Little(int addr, uint value) public void WriteU16Little(int addr, uint value)
{ {
WriteUnsignedLittle(addr, value, 2); WriteUnsignedLittle(addr, value, 2);
} }
[LuaMethodAttributes("read_u16_be", "read unsigned 2 byte value, big endian")] [LuaMethod("read_u16_be", "read unsigned 2 byte value, big endian")]
public uint ReadU16Big(int addr) public uint ReadU16Big(int addr)
{ {
return ReadUnsignedBig(addr, 2); return ReadUnsignedBig(addr, 2);
} }
[LuaMethodAttributes("write_u16_be", "write unsigned 2 byte value, big endian")] [LuaMethod("write_u16_be", "write unsigned 2 byte value, big endian")]
public void WriteU16Big(int addr, uint value) public void WriteU16Big(int addr, uint value)
{ {
WriteUnsignedBig(addr, value, 2); WriteUnsignedBig(addr, value, 2);
@ -176,49 +173,49 @@ namespace BizHawk.Client.Common
#region 3 Byte #region 3 Byte
[LuaMethodAttributes("read_s24_le", "read signed 24 bit value, little endian")] [LuaMethod("read_s24_le", "read signed 24 bit value, little endian")]
public int ReadS24Little(int addr) public int ReadS24Little(int addr)
{ {
return ReadSignedLittleCore(addr, 3); return ReadSignedLittleCore(addr, 3);
} }
[LuaMethodAttributes("write_s24_le", "write signed 24 bit value, little endian")] [LuaMethod("write_s24_le", "write signed 24 bit value, little endian")]
public void WriteS24Little(int addr, int value) public void WriteS24Little(int addr, int value)
{ {
WriteSignedLittle(addr, value, 3); WriteSignedLittle(addr, value, 3);
} }
[LuaMethodAttributes("read_s24_be", "read signed 24 bit value, big endian")] [LuaMethod("read_s24_be", "read signed 24 bit value, big endian")]
public int ReadS24Big(int addr) public int ReadS24Big(int addr)
{ {
return ReadSignedBig(addr, 3); return ReadSignedBig(addr, 3);
} }
[LuaMethodAttributes("write_s24_be", "write signed 24 bit value, big endian")] [LuaMethod("write_s24_be", "write signed 24 bit value, big endian")]
public void WriteS24Big(int addr, int value) public void WriteS24Big(int addr, int value)
{ {
WriteSignedBig(addr, value, 3); WriteSignedBig(addr, value, 3);
} }
[LuaMethodAttributes("read_u24_le", "read unsigned 24 bit value, little endian")] [LuaMethod("read_u24_le", "read unsigned 24 bit value, little endian")]
public uint ReadU24Little(int addr) public uint ReadU24Little(int addr)
{ {
return ReadSignedLittle(addr, 3); return ReadSignedLittle(addr, 3);
} }
[LuaMethodAttributes("write_u24_le", "write unsigned 24 bit value, little endian")] [LuaMethod("write_u24_le", "write unsigned 24 bit value, little endian")]
public void WriteU24Little(int addr, uint value) public void WriteU24Little(int addr, uint value)
{ {
WriteUnsignedLittle(addr, value, 3); WriteUnsignedLittle(addr, value, 3);
} }
[LuaMethodAttributes("read_u24_be", "read unsigned 24 bit value, big endian")] [LuaMethod("read_u24_be", "read unsigned 24 bit value, big endian")]
public uint ReadU24Big(int addr) public uint ReadU24Big(int addr)
{ {
return ReadUnsignedBig(addr, 3); return ReadUnsignedBig(addr, 3);
} }
[LuaMethodAttributes("write_u24_be", "write unsigned 24 bit value, big endian")] [LuaMethod("write_u24_be", "write unsigned 24 bit value, big endian")]
public void WriteU24Big(int addr, uint value) public void WriteU24Big(int addr, uint value)
{ {
WriteUnsignedBig(addr, value, 3); WriteUnsignedBig(addr, value, 3);
@ -228,49 +225,49 @@ namespace BizHawk.Client.Common
#region 4 Byte #region 4 Byte
[LuaMethodAttributes("read_s32_le", "read signed 4 byte value, little endian")] [LuaMethod("read_s32_le", "read signed 4 byte value, little endian")]
public int ReadS32Little(int addr) public int ReadS32Little(int addr)
{ {
return ReadSignedLittleCore(addr, 4); return ReadSignedLittleCore(addr, 4);
} }
[LuaMethodAttributes("write_s32_le", "write signed 4 byte value, little endian")] [LuaMethod("write_s32_le", "write signed 4 byte value, little endian")]
public void WriteS32Little(int addr, int value) public void WriteS32Little(int addr, int value)
{ {
WriteSignedLittle(addr, value, 4); WriteSignedLittle(addr, value, 4);
} }
[LuaMethodAttributes("read_s32_be", "read signed 4 byte value, big endian")] [LuaMethod("read_s32_be", "read signed 4 byte value, big endian")]
public int ReadS32Big(int addr) public int ReadS32Big(int addr)
{ {
return ReadSignedBig(addr, 4); return ReadSignedBig(addr, 4);
} }
[LuaMethodAttributes("write_s32_be", "write signed 4 byte value, big endian")] [LuaMethod("write_s32_be", "write signed 4 byte value, big endian")]
public void WriteS32Big(int addr, int value) public void WriteS32Big(int addr, int value)
{ {
WriteSignedBig(addr, value, 4); WriteSignedBig(addr, value, 4);
} }
[LuaMethodAttributes("read_u32_le", "read unsigned 4 byte value, little endian")] [LuaMethod("read_u32_le", "read unsigned 4 byte value, little endian")]
public uint ReadU32Little(int addr) public uint ReadU32Little(int addr)
{ {
return ReadSignedLittle(addr, 4); return ReadSignedLittle(addr, 4);
} }
[LuaMethodAttributes("write_u32_le", "write unsigned 4 byte value, little endian")] [LuaMethod("write_u32_le", "write unsigned 4 byte value, little endian")]
public void WriteU32Little(int addr, uint value) public void WriteU32Little(int addr, uint value)
{ {
WriteUnsignedLittle(addr, value, 4); WriteUnsignedLittle(addr, value, 4);
} }
[LuaMethodAttributes("read_u32_be", "read unsigned 4 byte value, big endian")] [LuaMethod("read_u32_be", "read unsigned 4 byte value, big endian")]
public uint ReadU32Big(int addr) public uint ReadU32Big(int addr)
{ {
return ReadUnsignedBig(addr, 4); return ReadUnsignedBig(addr, 4);
} }
[LuaMethodAttributes("write_u32_be", "write unsigned 4 byte value, big endian")] [LuaMethod("write_u32_be", "write unsigned 4 byte value, big endian")]
public void WriteU32Big(int addr, uint value) public void WriteU32Big(int addr, uint value)
{ {
WriteUnsignedBig(addr, value, 4); WriteUnsignedBig(addr, value, 4);

View File

@ -48,8 +48,7 @@ namespace BizHawk.Client.Common
#region Unique Library Methods #region Unique Library Methods
[LuaMethodAttributes( [LuaMethod("getmemorydomainlist", "Returns a string of the memory domains for the loaded platform core. List will be a single string delimited by line feeds")]
"getmemorydomainlist", "Returns a string of the memory domains for the loaded platform core. List will be a single string delimited by line feeds")]
public LuaTable GetMemoryDomainList() public LuaTable GetMemoryDomainList()
{ {
var table = Lua.NewTable(); var table = Lua.NewTable();
@ -64,8 +63,7 @@ namespace BizHawk.Client.Common
return table; return table;
} }
[LuaMethodAttributes( [LuaMethod("getmemorydomainsize", "Returns the number of bytes of the specified memory domain. If no domain is specified, or the specified domain doesn't exist, returns the current domain size")]
"getmemorydomainsize", "Returns the number of bytes of the specified memory domain. If no domain is specified, or the specified domain doesn't exist, returns the current domain size")]
public uint GetMemoryDomainSize(string name = "") public uint GetMemoryDomainSize(string name = "")
{ {
if (string.IsNullOrEmpty(name)) if (string.IsNullOrEmpty(name))
@ -76,22 +74,19 @@ namespace BizHawk.Client.Common
return (uint)DomainList[VerifyMemoryDomain(name)].Size; return (uint)DomainList[VerifyMemoryDomain(name)].Size;
} }
[LuaMethodAttributes( [LuaMethod("getcurrentmemorydomain", "Returns a string name of the current memory domain selected by Lua. The default is Main memory")]
"getcurrentmemorydomain", "Returns a string name of the current memory domain selected by Lua. The default is Main memory")]
public string GetCurrentMemoryDomain() public string GetCurrentMemoryDomain()
{ {
return Domain.Name; return Domain.Name;
} }
[LuaMethodAttributes( [LuaMethod("getcurrentmemorydomainsize", "Returns the number of bytes of the current memory domain selected by Lua. The default is Main memory")]
"getcurrentmemorydomainsize", "Returns the number of bytes of the current memory domain selected by Lua. The default is Main memory")]
public uint GetCurrentMemoryDomainSize() public uint GetCurrentMemoryDomainSize()
{ {
return (uint)Domain.Size; return (uint)Domain.Size;
} }
[LuaMethodAttributes( [LuaMethod("usememorydomain", "Attempts to set the current memory domain to the given domain. If the name does not match a valid memory domain, the function returns false, else it returns true")]
"usememorydomain", "Attempts to set the current memory domain to the given domain. If the name does not match a valid memory domain, the function returns false, else it returns true")]
public bool UseMemoryDomain(string domain) public bool UseMemoryDomain(string domain)
{ {
try try
@ -117,37 +112,37 @@ namespace BizHawk.Client.Common
#region Common Special and Legacy Methods #region Common Special and Legacy Methods
[LuaMethodAttributes("readbyte", "gets the value from the given address as an unsigned byte")] [LuaMethod("readbyte", "gets the value from the given address as an unsigned byte")]
public uint ReadByte(int addr, string domain = null) public uint ReadByte(int addr, string domain = null)
{ {
return ReadUnsignedByte(addr, domain); return ReadUnsignedByte(addr, domain);
} }
[LuaMethodAttributes("writebyte", "Writes the given value to the given address as an unsigned byte")] [LuaMethod("writebyte", "Writes the given value to the given address as an unsigned byte")]
public void WriteByte(int addr, uint value, string domain = null) public void WriteByte(int addr, uint value, string domain = null)
{ {
WriteUnsignedByte(addr, value, domain); WriteUnsignedByte(addr, value, domain);
} }
[LuaMethodAttributes("readbyterange", "Reads the address range that starts from address, and is length long. Returns the result into a table of key value pairs (where the address is the key).")] [LuaMethod("readbyterange", "Reads the address range that starts from address, and is length long. Returns the result into a table of key value pairs (where the address is the key).")]
public new LuaTable ReadByteRange(int addr, int length, string domain = null) public new LuaTable ReadByteRange(int addr, int length, string domain = null)
{ {
return base.ReadByteRange(addr, length, domain); return base.ReadByteRange(addr, length, domain);
} }
[LuaMethodAttributes("writebyterange", "Writes the given values to the given addresses as unsigned bytes")] [LuaMethod("writebyterange", "Writes the given values to the given addresses as unsigned bytes")]
public new void WriteByteRange(LuaTable memoryblock, string domain = null) public new void WriteByteRange(LuaTable memoryblock, string domain = null)
{ {
base.WriteByteRange(memoryblock, domain); base.WriteByteRange(memoryblock, domain);
} }
[LuaMethodAttributes("readfloat", "Reads the given address as a 32-bit float value from the main memory domain with th e given endian")] [LuaMethod("readfloat", "Reads the given address as a 32-bit float value from the main memory domain with th e given endian")]
public new float ReadFloat(int addr, bool bigendian, string domain = null) public new float ReadFloat(int addr, bool bigendian, string domain = null)
{ {
return base.ReadFloat(addr, bigendian, domain); return base.ReadFloat(addr, bigendian, domain);
} }
[LuaMethodAttributes("writefloat", "Writes the given 32-bit float value to the given address and endian")] [LuaMethod("writefloat", "Writes the given 32-bit float value to the given address and endian")]
public new void WriteFloat(int addr, double value, bool bigendian, string domain = null) public new void WriteFloat(int addr, double value, bool bigendian, string domain = null)
{ {
base.WriteFloat(addr, value, bigendian, domain); base.WriteFloat(addr, value, bigendian, domain);
@ -157,25 +152,25 @@ namespace BizHawk.Client.Common
#region 1 Byte #region 1 Byte
[LuaMethodAttributes("read_s8", "read signed byte")] [LuaMethod("read_s8", "read signed byte")]
public int ReadS8(int addr, string domain = null) public int ReadS8(int addr, string domain = null)
{ {
return (sbyte)ReadUnsignedByte(addr, domain); return (sbyte)ReadUnsignedByte(addr, domain);
} }
[LuaMethodAttributes("write_s8", "write signed byte")] [LuaMethod("write_s8", "write signed byte")]
public void WriteS8(int addr, uint value, string domain = null) public void WriteS8(int addr, uint value, string domain = null)
{ {
WriteUnsignedByte(addr, value, domain); WriteUnsignedByte(addr, value, domain);
} }
[LuaMethodAttributes("read_u8", "read unsigned byte")] [LuaMethod("read_u8", "read unsigned byte")]
public uint ReadU8(int addr, string domain = null) public uint ReadU8(int addr, string domain = null)
{ {
return ReadUnsignedByte(addr, domain); return ReadUnsignedByte(addr, domain);
} }
[LuaMethodAttributes("write_u8", "write unsigned byte")] [LuaMethod("write_u8", "write unsigned byte")]
public void WriteU8(int addr, uint value, string domain = null) public void WriteU8(int addr, uint value, string domain = null)
{ {
WriteUnsignedByte(addr, value, domain); WriteUnsignedByte(addr, value, domain);
@ -185,49 +180,49 @@ namespace BizHawk.Client.Common
#region 2 Byte #region 2 Byte
[LuaMethodAttributes("read_s16_le", "read signed 2 byte value, little endian")] [LuaMethod("read_s16_le", "read signed 2 byte value, little endian")]
public int ReadS16Little(int addr, string domain = null) public int ReadS16Little(int addr, string domain = null)
{ {
return ReadSignedLittleCore(addr, 2, domain); return ReadSignedLittleCore(addr, 2, domain);
} }
[LuaMethodAttributes("write_s16_le", "write signed 2 byte value, little endian")] [LuaMethod("write_s16_le", "write signed 2 byte value, little endian")]
public void WriteS16Little(int addr, int value, string domain = null) public void WriteS16Little(int addr, int value, string domain = null)
{ {
WriteSignedLittle(addr, value, 2, domain); WriteSignedLittle(addr, value, 2, domain);
} }
[LuaMethodAttributes("read_s16_be", "read signed 2 byte value, big endian")] [LuaMethod("read_s16_be", "read signed 2 byte value, big endian")]
public int ReadS16Big(int addr, string domain = null) public int ReadS16Big(int addr, string domain = null)
{ {
return ReadSignedBig(addr, 2, domain); return ReadSignedBig(addr, 2, domain);
} }
[LuaMethodAttributes("write_s16_be", "write signed 2 byte value, big endian")] [LuaMethod("write_s16_be", "write signed 2 byte value, big endian")]
public void WriteS16Big(int addr, int value, string domain = null) public void WriteS16Big(int addr, int value, string domain = null)
{ {
WriteSignedBig(addr, value, 2, domain); WriteSignedBig(addr, value, 2, domain);
} }
[LuaMethodAttributes("read_u16_le", "read unsigned 2 byte value, little endian")] [LuaMethod("read_u16_le", "read unsigned 2 byte value, little endian")]
public uint ReadU16Little(int addr, string domain = null) public uint ReadU16Little(int addr, string domain = null)
{ {
return ReadUnsignedLittle(addr, 2, domain); return ReadUnsignedLittle(addr, 2, domain);
} }
[LuaMethodAttributes("write_u16_le", "write unsigned 2 byte value, little endian")] [LuaMethod("write_u16_le", "write unsigned 2 byte value, little endian")]
public void WriteU16Little(int addr, uint value, string domain = null) public void WriteU16Little(int addr, uint value, string domain = null)
{ {
WriteUnsignedLittle(addr, value, 2, domain); WriteUnsignedLittle(addr, value, 2, domain);
} }
[LuaMethodAttributes("read_u16_be", "read unsigned 2 byte value, big endian")] [LuaMethod("read_u16_be", "read unsigned 2 byte value, big endian")]
public uint ReadU16Big(int addr, string domain = null) public uint ReadU16Big(int addr, string domain = null)
{ {
return ReadUnsignedBig(addr, 2, domain); return ReadUnsignedBig(addr, 2, domain);
} }
[LuaMethodAttributes("write_u16_be", "write unsigned 2 byte value, big endian")] [LuaMethod("write_u16_be", "write unsigned 2 byte value, big endian")]
public void WriteU16Big(int addr, uint value, string domain = null) public void WriteU16Big(int addr, uint value, string domain = null)
{ {
WriteUnsignedBig(addr, value, 2, domain); WriteUnsignedBig(addr, value, 2, domain);
@ -237,49 +232,49 @@ namespace BizHawk.Client.Common
#region 3 Byte #region 3 Byte
[LuaMethodAttributes("read_s24_le", "read signed 24 bit value, little endian")] [LuaMethod("read_s24_le", "read signed 24 bit value, little endian")]
public int ReadS24Little(int addr, string domain = null) public int ReadS24Little(int addr, string domain = null)
{ {
return ReadSignedLittleCore(addr, 3, domain); return ReadSignedLittleCore(addr, 3, domain);
} }
[LuaMethodAttributes("write_s24_le", "write signed 24 bit value, little endian")] [LuaMethod("write_s24_le", "write signed 24 bit value, little endian")]
public void WriteS24Little(int addr, int value, string domain = null) public void WriteS24Little(int addr, int value, string domain = null)
{ {
WriteSignedLittle(addr, value, 3, domain); WriteSignedLittle(addr, value, 3, domain);
} }
[LuaMethodAttributes("read_s24_be", "read signed 24 bit value, big endian")] [LuaMethod("read_s24_be", "read signed 24 bit value, big endian")]
public int ReadS24Big(int addr, string domain = null) public int ReadS24Big(int addr, string domain = null)
{ {
return ReadSignedBig(addr, 3, domain); return ReadSignedBig(addr, 3, domain);
} }
[LuaMethodAttributes("write_s24_be", "write signed 24 bit value, big endian")] [LuaMethod("write_s24_be", "write signed 24 bit value, big endian")]
public void WriteS24Big(int addr, int value, string domain = null) public void WriteS24Big(int addr, int value, string domain = null)
{ {
WriteSignedBig(addr, value, 3, domain); WriteSignedBig(addr, value, 3, domain);
} }
[LuaMethodAttributes("read_u24_le", "read unsigned 24 bit value, little endian")] [LuaMethod("read_u24_le", "read unsigned 24 bit value, little endian")]
public uint ReadU24Little(int addr, string domain = null) public uint ReadU24Little(int addr, string domain = null)
{ {
return ReadUnsignedLittle(addr, 3, domain); return ReadUnsignedLittle(addr, 3, domain);
} }
[LuaMethodAttributes("write_u24_le", "write unsigned 24 bit value, little endian")] [LuaMethod("write_u24_le", "write unsigned 24 bit value, little endian")]
public void WriteU24Little(int addr, uint value, string domain = null) public void WriteU24Little(int addr, uint value, string domain = null)
{ {
WriteUnsignedLittle(addr, value, 3, domain); WriteUnsignedLittle(addr, value, 3, domain);
} }
[LuaMethodAttributes("read_u24_be", "read unsigned 24 bit value, big endian")] [LuaMethod("read_u24_be", "read unsigned 24 bit value, big endian")]
public uint ReadU24Big(int addr, string domain = null) public uint ReadU24Big(int addr, string domain = null)
{ {
return ReadUnsignedBig(addr, 3, domain); return ReadUnsignedBig(addr, 3, domain);
} }
[LuaMethodAttributes("write_u24_be", "write unsigned 24 bit value, big endian")] [LuaMethod("write_u24_be", "write unsigned 24 bit value, big endian")]
public void WriteU24Big(int addr, uint value, string domain = null) public void WriteU24Big(int addr, uint value, string domain = null)
{ {
WriteUnsignedBig(addr, value, 3, domain); WriteUnsignedBig(addr, value, 3, domain);
@ -289,49 +284,49 @@ namespace BizHawk.Client.Common
#region 4 Byte #region 4 Byte
[LuaMethodAttributes("read_s32_le", "read signed 4 byte value, little endian")] [LuaMethod("read_s32_le", "read signed 4 byte value, little endian")]
public int ReadS32Little(int addr, string domain = null) public int ReadS32Little(int addr, string domain = null)
{ {
return ReadSignedLittleCore(addr, 4, domain); return ReadSignedLittleCore(addr, 4, domain);
} }
[LuaMethodAttributes("write_s32_le", "write signed 4 byte value, little endian")] [LuaMethod("write_s32_le", "write signed 4 byte value, little endian")]
public void WriteS32Little(int addr, int value, string domain = null) public void WriteS32Little(int addr, int value, string domain = null)
{ {
WriteSignedLittle(addr, value, 4, domain); WriteSignedLittle(addr, value, 4, domain);
} }
[LuaMethodAttributes("read_s32_be", "read signed 4 byte value, big endian")] [LuaMethod("read_s32_be", "read signed 4 byte value, big endian")]
public int ReadS32Big(int addr, string domain = null) public int ReadS32Big(int addr, string domain = null)
{ {
return ReadSignedBig(addr, 4, domain); return ReadSignedBig(addr, 4, domain);
} }
[LuaMethodAttributes("write_s32_be", "write signed 4 byte value, big endian")] [LuaMethod("write_s32_be", "write signed 4 byte value, big endian")]
public void WriteS32Big(int addr, int value, string domain = null) public void WriteS32Big(int addr, int value, string domain = null)
{ {
WriteSignedBig(addr, value, 4, domain); WriteSignedBig(addr, value, 4, domain);
} }
[LuaMethodAttributes("read_u32_le", "read unsigned 4 byte value, little endian")] [LuaMethod("read_u32_le", "read unsigned 4 byte value, little endian")]
public uint ReadU32Little(int addr, string domain = null) public uint ReadU32Little(int addr, string domain = null)
{ {
return ReadUnsignedLittle(addr, 4, domain); return ReadUnsignedLittle(addr, 4, domain);
} }
[LuaMethodAttributes("write_u32_le", "write unsigned 4 byte value, little endian")] [LuaMethod("write_u32_le", "write unsigned 4 byte value, little endian")]
public void WriteU32Little(int addr, uint value, string domain = null) public void WriteU32Little(int addr, uint value, string domain = null)
{ {
WriteUnsignedLittle(addr, value, 4, domain); WriteUnsignedLittle(addr, value, 4, domain);
} }
[LuaMethodAttributes("read_u32_be", "read unsigned 4 byte value, big endian")] [LuaMethod("read_u32_be", "read unsigned 4 byte value, big endian")]
public uint ReadU32Big(int addr, string domain = null) public uint ReadU32Big(int addr, string domain = null)
{ {
return ReadUnsignedBig(addr, 4, domain); return ReadUnsignedBig(addr, 4, domain);
} }
[LuaMethodAttributes("write_u32_be", "write unsigned 4 byte value, big endian")] [LuaMethod("write_u32_be", "write unsigned 4 byte value, big endian")]
public void WriteU32Big(int addr, uint value, string domain = null) public void WriteU32Big(int addr, uint value, string domain = null)
{ {
WriteUnsignedBig(addr, value, 4, domain); WriteUnsignedBig(addr, value, 4, domain);

View File

@ -23,8 +23,7 @@ namespace BizHawk.Client.Common
private readonly Dictionary<Guid, byte[]> _memorySavestates = new Dictionary<Guid, byte[]>(); private readonly Dictionary<Guid, byte[]> _memorySavestates = new Dictionary<Guid, byte[]>();
[LuaMethodAttributes( [LuaMethod("savecorestate", "creates a core savestate and stores it in memory. Note: a core savestate is only the raw data from the core, and not extras such as movie input logs, or framebuffers. Returns a unique identifer for the savestate")]
"savecorestate", "creates a core savestate and stores it in memory. Note: a core savestate is only the raw data from the core, and not extras such as movie input logs, or framebuffers. Returns a unique identifer for the savestate")]
public string SaveCoreStateToMemory() public string SaveCoreStateToMemory()
{ {
var guid = Guid.NewGuid(); var guid = Guid.NewGuid();
@ -35,7 +34,7 @@ namespace BizHawk.Client.Common
return guid.ToString(); return guid.ToString();
} }
[LuaMethodAttributes("loadcorestate", "loads an in memory state with the given identifier")] [LuaMethod("loadcorestate", "loads an in memory state with the given identifier")]
public void LoadCoreStateFromMemory(string identifier) public void LoadCoreStateFromMemory(string identifier)
{ {
var guid = new Guid(identifier); var guid = new Guid(identifier);
@ -56,14 +55,14 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodAttributes("removestate", "removes the savestate with the given identifier from memory")] [LuaMethod("removestate", "removes the savestate with the given identifier from memory")]
public void DeleteState(string identifier) public void DeleteState(string identifier)
{ {
var guid = new Guid(identifier); var guid = new Guid(identifier);
_memorySavestates.Remove(guid); _memorySavestates.Remove(guid);
} }
[LuaMethodAttributes("clearstatesfrommemory", "clears all savestates stored in memory")] [LuaMethod("clearstatesfrommemory", "clears all savestates stored in memory")]
public void ClearInMemoryStates() public void ClearInMemoryStates()
{ {
_memorySavestates.Clear(); _memorySavestates.Clear();

View File

@ -14,33 +14,25 @@ namespace BizHawk.Client.Common
public override string Name => "movie"; public override string Name => "movie";
[LuaMethodAttributes( [LuaMethod("startsfromsavestate", "Returns whether or not the movie is a savestate-anchored movie")]
"startsfromsavestate",
"Returns whether or not the movie is a savestate-anchored movie")]
public bool StartsFromSavestate() public bool StartsFromSavestate()
{ {
return Global.MovieSession.Movie.IsActive && Global.MovieSession.Movie.StartsFromSavestate; return Global.MovieSession.Movie.IsActive && Global.MovieSession.Movie.StartsFromSavestate;
} }
[LuaMethodAttributes( [LuaMethod("startsfromsaveram", "Returns whether or not the movie is a saveram-anchored movie")]
"startsfromsaveram",
"Returns whether or not the movie is a saveram-anchored movie")]
public bool StartsFromSaveram() public bool StartsFromSaveram()
{ {
return Global.MovieSession.Movie.IsActive && Global.MovieSession.Movie.StartsFromSaveRam; return Global.MovieSession.Movie.IsActive && Global.MovieSession.Movie.StartsFromSaveRam;
} }
[LuaMethodAttributes( [LuaMethod("filename", "Returns the file name including path of the currently loaded movie")]
"filename",
"Returns the file name including path of the currently loaded movie")]
public static string Filename() public static string Filename()
{ {
return Global.MovieSession.Movie.Filename; return Global.MovieSession.Movie.Filename;
} }
[LuaMethodAttributes( [LuaMethod("getinput", "Returns a table of buttons pressed on a given frame of the loaded movie")]
"getinput",
"Returns a table of buttons pressed on a given frame of the loaded movie")]
public LuaTable GetInput(int frame) public LuaTable GetInput(int frame)
{ {
if (!Global.MovieSession.Movie.IsActive) if (!Global.MovieSession.Movie.IsActive)
@ -71,9 +63,7 @@ namespace BizHawk.Client.Common
return input; return input;
} }
[LuaMethodAttributes( [LuaMethod("getinputasmnemonic", "Returns the input of a given frame of the loaded movie in a raw inputlog string")]
"getinputasmnemonic",
"Returns the input of a given frame of the loaded movie in a raw inputlog string")]
public string GetInputAsMnemonic(int frame) public string GetInputAsMnemonic(int frame)
{ {
if (Global.MovieSession.Movie.IsActive && frame < Global.MovieSession.Movie.InputLogLength) if (Global.MovieSession.Movie.IsActive && frame < Global.MovieSession.Movie.InputLogLength)
@ -86,49 +76,37 @@ namespace BizHawk.Client.Common
return ""; return "";
} }
[LuaMethodAttributes( [LuaMethod("getreadonly", "Returns true if the movie is in read-only mode, false if in read+write")]
"getreadonly",
"Returns true if the movie is in read-only mode, false if in read+write")]
public static bool GetReadOnly() public static bool GetReadOnly()
{ {
return Global.MovieSession.ReadOnly; return Global.MovieSession.ReadOnly;
} }
[LuaMethodAttributes( [LuaMethod("getrerecordcount", "Gets the rerecord count of the current movie.")]
"getrerecordcount",
"Gets the rerecord count of the current movie.")]
public static ulong GetRerecordCount() public static ulong GetRerecordCount()
{ {
return Global.MovieSession.Movie.Rerecords; return Global.MovieSession.Movie.Rerecords;
} }
[LuaMethodAttributes( [LuaMethod("getrerecordcounting", "Returns whether or not the current movie is incrementing rerecords on loadstate")]
"getrerecordcounting",
"Returns whether or not the current movie is incrementing rerecords on loadstate")]
public static bool GetRerecordCounting() public static bool GetRerecordCounting()
{ {
return Global.MovieSession.Movie.IsCountingRerecords; return Global.MovieSession.Movie.IsCountingRerecords;
} }
[LuaMethodAttributes( [LuaMethod("isloaded", "Returns true if a movie is loaded in memory (play, record, or finished modes), false if not (inactive mode)")]
"isloaded",
"Returns true if a movie is loaded in memory (play, record, or finished modes), false if not (inactive mode)")]
public static bool IsLoaded() public static bool IsLoaded()
{ {
return Global.MovieSession.Movie.IsActive; return Global.MovieSession.Movie.IsActive;
} }
[LuaMethodAttributes( [LuaMethod("length", "Returns the total number of frames of the loaded movie")]
"length",
"Returns the total number of frames of the loaded movie")]
public static double Length() public static double Length()
{ {
return Global.MovieSession.Movie.FrameCount; return Global.MovieSession.Movie.FrameCount;
} }
[LuaMethodAttributes( [LuaMethod("mode", "Returns the mode of the current movie. Possible modes: \"PLAY\", \"RECORD\", \"FINISHED\", \"INACTIVE\"")]
"mode",
"Returns the mode of the current movie. Possible modes: \"PLAY\", \"RECORD\", \"FINISHED\", \"INACTIVE\"")]
public static string Mode() public static string Mode()
{ {
if (Global.MovieSession.Movie.IsFinished) if (Global.MovieSession.Movie.IsFinished)
@ -149,17 +127,13 @@ namespace BizHawk.Client.Common
return "INACTIVE"; return "INACTIVE";
} }
[LuaMethodAttributes( [LuaMethod("rerecordcount", "[Deprecated] Alias of getrerecordcount")]
"rerecordcount",
"[Deprecated] Alias of getrerecordcount")]
public static string RerecordCount() public static string RerecordCount()
{ {
return GetRerecordCount().ToString(); return GetRerecordCount().ToString();
} }
[LuaMethodAttributes( [LuaMethod("save", "Saves the current movie to the disc. If the filename is provided (no extension or path needed), the movie is saved under the specified name to the current movie directory. The filename may contain a subdirectory, it will be created if it doesn't exist. Existing files won't get overwritten.")]
"save",
"Saves the current movie to the disc. If the filename is provided (no extension or path needed), the movie is saved under the specified name to the current movie directory. The filename may contain a subdirectory, it will be created if it doesn't exist. Existing files won't get overwritten.")]
public void Save(string filename = "") public void Save(string filename = "")
{ {
if (!Global.MovieSession.Movie.IsActive) if (!Global.MovieSession.Movie.IsActive)
@ -183,17 +157,13 @@ namespace BizHawk.Client.Common
Global.MovieSession.Movie.Save(); Global.MovieSession.Movie.Save();
} }
[LuaMethodAttributes( [LuaMethod("setreadonly", "Sets the read-only state to the given value. true for read only, false for read+write")]
"setreadonly",
"Sets the read-only state to the given value. true for read only, false for read+write")]
public static void SetReadOnly(bool readOnly) public static void SetReadOnly(bool readOnly)
{ {
Global.MovieSession.ReadOnly = readOnly; Global.MovieSession.ReadOnly = readOnly;
} }
[LuaMethodAttributes( [LuaMethod("setrerecordcount", "Sets the rerecord count of the current movie.")]
"setrerecordcount",
"Sets the rerecord count of the current movie.")]
public static void SetRerecordCount(double count) public static void SetRerecordCount(double count)
{ {
// Lua numbers are always double, integer precision holds up // Lua numbers are always double, integer precision holds up
@ -208,25 +178,19 @@ namespace BizHawk.Client.Common
Global.MovieSession.Movie.Rerecords = (ulong)count; Global.MovieSession.Movie.Rerecords = (ulong)count;
} }
[LuaMethodAttributes( [LuaMethod("setrerecordcounting", "Sets whether or not the current movie will increment the rerecord counter on loadstate")]
"setrerecordcounting",
"Sets whether or not the current movie will increment the rerecord counter on loadstate")]
public static void SetRerecordCounting(bool counting) public static void SetRerecordCounting(bool counting)
{ {
Global.MovieSession.Movie.IsCountingRerecords = counting; Global.MovieSession.Movie.IsCountingRerecords = counting;
} }
[LuaMethodAttributes( [LuaMethod("stop", "Stops the current movie")]
"stop",
"Stops the current movie")]
public static void Stop() public static void Stop()
{ {
Global.MovieSession.Movie.Stop(); Global.MovieSession.Movie.Stop();
} }
[LuaMethodAttributes( [LuaMethod("getfps", "If a movie is loaded, gets the frames per second used by the movie to determine the movie length time")]
"getfps",
"If a movie is loaded, gets the frames per second used by the movie to determine the movie length time")]
public static double GetFps() public static double GetFps()
{ {
if (Global.MovieSession.Movie.IsActive) if (Global.MovieSession.Movie.IsActive)
@ -242,9 +206,7 @@ namespace BizHawk.Client.Common
return 0.0; return 0.0;
} }
[LuaMethodAttributes( [LuaMethod("getheader", "If a movie is active, will return the movie header as a lua table")]
"getheader",
"If a movie is active, will return the movie header as a lua table")]
public LuaTable GetHeader() public LuaTable GetHeader()
{ {
var luaTable = Lua.NewTable(); var luaTable = Lua.NewTable();
@ -259,9 +221,7 @@ namespace BizHawk.Client.Common
return luaTable; return luaTable;
} }
[LuaMethodAttributes( [LuaMethod("getcomments", "If a movie is active, will return the movie comments as a lua table")]
"getcomments",
"If a movie is active, will return the movie comments as a lua table")]
public LuaTable GetComments() public LuaTable GetComments()
{ {
var luaTable = Lua.NewTable(); var luaTable = Lua.NewTable();
@ -276,9 +236,7 @@ namespace BizHawk.Client.Common
return luaTable; return luaTable;
} }
[LuaMethodAttributes( [LuaMethod("getsubtitles", "If a movie is active, will return the movie subtitles as a lua table")]
"getsubtitles",
"If a movie is active, will return the movie subtitles as a lua table")]
public LuaTable GetSubtitles() public LuaTable GetSubtitles()
{ {
var luaTable = Lua.NewTable(); var luaTable = Lua.NewTable();

View File

@ -38,8 +38,7 @@ namespace BizHawk.Client.Common
public override string Name => "nes"; public override string Name => "nes";
[LuaMethodAttributes( [LuaMethod("addgamegenie", "Adds the specified game genie code. If an NES game is not currently loaded or the code is not a valid game genie code, this will have no effect")]
"addgamegenie", "Adds the specified game genie code. If an NES game is not currently loaded or the code is not a valid game genie code, this will have no effect")]
public void AddGameGenie(string code) public void AddGameGenie(string code)
{ {
if (NESAvailable && HasMemoryDOmains) if (NESAvailable && HasMemoryDOmains)
@ -60,8 +59,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodAttributes( [LuaMethod("getallowmorethaneightsprites", "Gets the NES setting 'Allow more than 8 sprites per scanline' value")]
"getallowmorethaneightsprites", "Gets the NES setting 'Allow more than 8 sprites per scanline' value")]
public bool GetAllowMoreThanEightSprites() public bool GetAllowMoreThanEightSprites()
{ {
if (Quicknes != null) if (Quicknes != null)
@ -77,8 +75,7 @@ namespace BizHawk.Client.Common
throw new InvalidOperationException(); throw new InvalidOperationException();
} }
[LuaMethodAttributes( [LuaMethod("getbottomscanline", "Gets the current value for the bottom scanline value")]
"getbottomscanline", "Gets the current value for the bottom scanline value")]
public int GetBottomScanline(bool pal = false) public int GetBottomScanline(bool pal = false)
{ {
if (Quicknes != null) if (Quicknes != null)
@ -96,8 +93,7 @@ namespace BizHawk.Client.Common
throw new InvalidOperationException(); throw new InvalidOperationException();
} }
[LuaMethodAttributes( [LuaMethod("getclipleftandright", "Gets the current value for the Clip Left and Right sides option")]
"getclipleftandright", "Gets the current value for the Clip Left and Right sides option")]
public bool GetClipLeftAndRight() public bool GetClipLeftAndRight()
{ {
if (Quicknes != null) if (Quicknes != null)
@ -113,8 +109,7 @@ namespace BizHawk.Client.Common
throw new InvalidOperationException(); throw new InvalidOperationException();
} }
[LuaMethodAttributes( [LuaMethod("getdispbackground", "Indicates whether or not the bg layer is being displayed")]
"getdispbackground", "Indicates whether or not the bg layer is being displayed")]
public bool GetDisplayBackground() public bool GetDisplayBackground()
{ {
if (Quicknes != null) if (Quicknes != null)
@ -130,8 +125,7 @@ namespace BizHawk.Client.Common
throw new InvalidOperationException(); throw new InvalidOperationException();
} }
[LuaMethodAttributes( [LuaMethod("getdispsprites", "Indicates whether or not sprites are being displayed")]
"getdispsprites", "Indicates whether or not sprites are being displayed")]
public bool GetDisplaySprites() public bool GetDisplaySprites()
{ {
if (Quicknes != null) if (Quicknes != null)
@ -147,8 +141,7 @@ namespace BizHawk.Client.Common
throw new InvalidOperationException(); throw new InvalidOperationException();
} }
[LuaMethodAttributes( [LuaMethod("gettopscanline", "Gets the current value for the top scanline value")]
"gettopscanline", "Gets the current value for the top scanline value")]
public int GetTopScanline(bool pal = false) public int GetTopScanline(bool pal = false)
{ {
if (Quicknes != null) if (Quicknes != null)
@ -166,8 +159,7 @@ namespace BizHawk.Client.Common
throw new InvalidOperationException(); throw new InvalidOperationException();
} }
[LuaMethodAttributes( [LuaMethod("removegamegenie", "Removes the specified game genie code. If an NES game is not currently loaded or the code is not a valid game genie code, this will have no effect")]
"removegamegenie", "Removes the specified game genie code. If an NES game is not currently loaded or the code is not a valid game genie code, this will have no effect")]
public void RemoveGameGenie(string code) public void RemoveGameGenie(string code)
{ {
if (NESAvailable) if (NESAvailable)
@ -178,8 +170,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodAttributes( [LuaMethod("setallowmorethaneightsprites", "Sets the NES setting 'Allow more than 8 sprites per scanline'")]
"setallowmorethaneightsprites", "Sets the NES setting 'Allow more than 8 sprites per scanline'")]
public void SetAllowMoreThanEightSprites(bool allow) public void SetAllowMoreThanEightSprites(bool allow)
{ {
if (Neshawk != null) if (Neshawk != null)
@ -196,8 +187,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodAttributes( [LuaMethod("setclipleftandright", "Sets the Clip Left and Right sides option")]
"setclipleftandright", "Sets the Clip Left and Right sides option")]
public void SetClipLeftAndRight(bool leftandright) public void SetClipLeftAndRight(bool leftandright)
{ {
if (Neshawk != null) if (Neshawk != null)
@ -214,8 +204,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodAttributes( [LuaMethod("setdispbackground", "Sets whether or not the background layer will be displayed")]
"setdispbackground", "Sets whether or not the background layer will be displayed")]
public void SetDisplayBackground(bool show) public void SetDisplayBackground(bool show)
{ {
if (Neshawk != null) if (Neshawk != null)
@ -226,8 +215,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodAttributes( [LuaMethod("setdispsprites", "Sets whether or not sprites will be displayed")]
"setdispsprites", "Sets whether or not sprites will be displayed")]
public void SetDisplaySprites(bool show) public void SetDisplaySprites(bool show)
{ {
if (Neshawk != null) if (Neshawk != null)
@ -244,8 +232,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodAttributes( [LuaMethod("setscanlines", "sets the top and bottom scanlines to be drawn (same values as in the graphics options dialog). Top must be in the range of 0 to 127, bottom must be between 128 and 239. Not supported in the Quick Nes core")]
"setscanlines", "sets the top and bottom scanlines to be drawn (same values as in the graphics options dialog). Top must be in the range of 0 to 127, bottom must be between 128 and 239. Not supported in the Quick Nes core")]
public void SetScanlines(int top, int bottom, bool pal = false) public void SetScanlines(int top, int bottom, bool pal = false)
{ {
if (Neshawk != null) if (Neshawk != null)

View File

@ -35,55 +35,55 @@ namespace BizHawk.Client.Common
Snes?.PutSettings(settings); Snes?.PutSettings(settings);
} }
[LuaMethodAttributes("getlayer_bg_1", "Returns whether the bg 1 layer is displayed")] [LuaMethod("getlayer_bg_1", "Returns whether the bg 1 layer is displayed")]
public bool GetLayerBg1() public bool GetLayerBg1()
{ {
return GetSettings().ShowBG1_1; return GetSettings().ShowBG1_1;
} }
[LuaMethodAttributes("getlayer_bg_2", "Returns whether the bg 2 layer is displayed")] [LuaMethod("getlayer_bg_2", "Returns whether the bg 2 layer is displayed")]
public bool GetLayerBg2() public bool GetLayerBg2()
{ {
return GetSettings().ShowBG2_1; return GetSettings().ShowBG2_1;
} }
[LuaMethodAttributes("getlayer_bg_3", "Returns whether the bg 3 layer is displayed")] [LuaMethod("getlayer_bg_3", "Returns whether the bg 3 layer is displayed")]
public bool GetLayerBg3() public bool GetLayerBg3()
{ {
return GetSettings().ShowBG3_1; return GetSettings().ShowBG3_1;
} }
[LuaMethodAttributes("getlayer_bg_4", "Returns whether the bg 4 layer is displayed")] [LuaMethod("getlayer_bg_4", "Returns whether the bg 4 layer is displayed")]
public bool GetLayerBg4() public bool GetLayerBg4()
{ {
return GetSettings().ShowBG4_1; return GetSettings().ShowBG4_1;
} }
[LuaMethodAttributes("getlayer_obj_1", "Returns whether the obj 1 layer is displayed")] [LuaMethod("getlayer_obj_1", "Returns whether the obj 1 layer is displayed")]
public bool GetLayerObj1() public bool GetLayerObj1()
{ {
return GetSettings().ShowOBJ_0; return GetSettings().ShowOBJ_0;
} }
[LuaMethodAttributes("getlayer_obj_2", "Returns whether the obj 2 layer is displayed")] [LuaMethod("getlayer_obj_2", "Returns whether the obj 2 layer is displayed")]
public bool GetLayerObj2() public bool GetLayerObj2()
{ {
return GetSettings().ShowOBJ_1; return GetSettings().ShowOBJ_1;
} }
[LuaMethodAttributes("getlayer_obj_3", "Returns whether the obj 3 layer is displayed")] [LuaMethod("getlayer_obj_3", "Returns whether the obj 3 layer is displayed")]
public bool GetLayerObj3() public bool GetLayerObj3()
{ {
return GetSettings().ShowOBJ_2; return GetSettings().ShowOBJ_2;
} }
[LuaMethodAttributes("getlayer_obj_4", "Returns whether the obj 4 layer is displayed")] [LuaMethod("getlayer_obj_4", "Returns whether the obj 4 layer is displayed")]
public bool GetLayerObj4() public bool GetLayerObj4()
{ {
return GetSettings().ShowOBJ_3; return GetSettings().ShowOBJ_3;
} }
[LuaMethodAttributes("setlayer_bg_1", "Sets whether the bg 1 layer is displayed")] [LuaMethod("setlayer_bg_1", "Sets whether the bg 1 layer is displayed")]
public void SetLayerBg1(bool value) public void SetLayerBg1(bool value)
{ {
var s = GetSettings(); var s = GetSettings();
@ -91,7 +91,7 @@ namespace BizHawk.Client.Common
PutSettings(s); PutSettings(s);
} }
[LuaMethodAttributes("setlayer_bg_2", "Sets whether the bg 2 layer is displayed")] [LuaMethod("setlayer_bg_2", "Sets whether the bg 2 layer is displayed")]
public void SetLayerBg2(bool value) public void SetLayerBg2(bool value)
{ {
var s = GetSettings(); var s = GetSettings();
@ -99,7 +99,7 @@ namespace BizHawk.Client.Common
PutSettings(s); PutSettings(s);
} }
[LuaMethodAttributes("setlayer_bg_3", "Sets whether the bg 3 layer is displayed")] [LuaMethod("setlayer_bg_3", "Sets whether the bg 3 layer is displayed")]
public void SetLayerBg3(bool value) public void SetLayerBg3(bool value)
{ {
var s = GetSettings(); var s = GetSettings();
@ -107,7 +107,7 @@ namespace BizHawk.Client.Common
PutSettings(s); PutSettings(s);
} }
[LuaMethodAttributes("setlayer_bg_4", "Sets whether the bg 4 layer is displayed")] [LuaMethod("setlayer_bg_4", "Sets whether the bg 4 layer is displayed")]
public void SetLayerBg4(bool value) public void SetLayerBg4(bool value)
{ {
var s = GetSettings(); var s = GetSettings();
@ -115,7 +115,7 @@ namespace BizHawk.Client.Common
PutSettings(s); PutSettings(s);
} }
[LuaMethodAttributes("setlayer_obj_1", "Sets whether the obj 1 layer is displayed")] [LuaMethod("setlayer_obj_1", "Sets whether the obj 1 layer is displayed")]
public void SetLayerObj1(bool value) public void SetLayerObj1(bool value)
{ {
var s = GetSettings(); var s = GetSettings();
@ -123,7 +123,7 @@ namespace BizHawk.Client.Common
PutSettings(s); PutSettings(s);
} }
[LuaMethodAttributes("setlayer_obj_2", "Sets whether the obj 2 layer is displayed")] [LuaMethod("setlayer_obj_2", "Sets whether the obj 2 layer is displayed")]
public void SetLayerObj2(bool value) public void SetLayerObj2(bool value)
{ {
var s = GetSettings(); var s = GetSettings();
@ -131,7 +131,7 @@ namespace BizHawk.Client.Common
PutSettings(s); PutSettings(s);
} }
[LuaMethodAttributes("setlayer_obj_3", "Sets whether the obj 3 layer is displayed")] [LuaMethod("setlayer_obj_3", "Sets whether the obj 3 layer is displayed")]
public void SetLayerObj3(bool value) public void SetLayerObj3(bool value)
{ {
var s = GetSettings(); var s = GetSettings();
@ -139,7 +139,7 @@ namespace BizHawk.Client.Common
PutSettings(s); PutSettings(s);
} }
[LuaMethodAttributes("setlayer_obj_4", "Sets whether the obj 4 layer is displayed")] [LuaMethod("setlayer_obj_4", "Sets whether the obj 4 layer is displayed")]
public void SetLayerObj4(bool value) public void SetLayerObj4(bool value)
{ {
var s = GetSettings(); var s = GetSettings();

View File

@ -21,7 +21,7 @@ namespace BizHawk.Client.Common
SQLiteConnection m_dbConnection; SQLiteConnection m_dbConnection;
string connectionString; string connectionString;
[LuaMethodAttributes("createdatabase","Creates a SQLite Database. Name should end with .db")] [LuaMethod("createdatabase","Creates a SQLite Database. Name should end with .db")]
public string CreateDatabase(string name) public string CreateDatabase(string name)
{ {
try try
@ -37,7 +37,7 @@ namespace BizHawk.Client.Common
} }
[LuaMethodAttributes("opendatabase", "Opens a SQLite database. Name should end with .db")] [LuaMethod("opendatabase", "Opens a SQLite database. Name should end with .db")]
public string OpenDatabase(string name) public string OpenDatabase(string name)
{ {
try try
@ -60,7 +60,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodAttributes("writecommand", "Runs a SQLite write command which includes CREATE,INSERT, UPDATE. " + [LuaMethod("writecommand", "Runs a SQLite write command which includes CREATE,INSERT, UPDATE. " +
"Ex: create TABLE rewards (ID integer PRIMARY KEY, action VARCHAR(20)) ")] "Ex: create TABLE rewards (ID integer PRIMARY KEY, action VARCHAR(20)) ")]
public string WriteCommand(string query="") public string WriteCommand(string query="")
{ {
@ -90,7 +90,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodAttributes("readcommand", "Run a SQLite read command which includes Select. Returns all rows into a LuaTable." + [LuaMethod("readcommand", "Run a SQLite read command which includes Select. Returns all rows into a LuaTable." +
"Ex: select * from rewards")] "Ex: select * from rewards")]
public dynamic ReadCommand(string query="") public dynamic ReadCommand(string query="")
{ {

View File

@ -17,8 +17,7 @@ namespace BizHawk.Client.Common
public StringLuaLibrary(Lua lua, Action<string> logOutputCallback) public StringLuaLibrary(Lua lua, Action<string> logOutputCallback)
: base(lua, logOutputCallback) { } : base(lua, logOutputCallback) { }
[LuaMethodAttributes( [LuaMethod("hex", "Converts the number to a string representation of the hexadecimal value of the given number")]
"hex", "Converts the number to a string representation of the hexadecimal value of the given number")]
public static string Hex(long num) public static string Hex(long num)
{ {
var hex = $"{num:X}"; var hex = $"{num:X}";
@ -30,8 +29,7 @@ namespace BizHawk.Client.Common
return hex; return hex;
} }
[LuaMethodAttributes( [LuaMethod("binary", "Converts the number to a string representation of the binary value of the given number")]
"binary", "Converts the number to a string representation of the binary value of the given number")]
public static string Binary(long num) public static string Binary(long num)
{ {
var binary = Convert.ToString(num, 2); var binary = Convert.ToString(num, 2);
@ -39,8 +37,7 @@ namespace BizHawk.Client.Common
return binary; return binary;
} }
[LuaMethodAttributes( [LuaMethod("octal", "Converts the number to a string representation of the octal value of the given number")]
"octal", "Converts the number to a string representation of the octal value of the given number")]
public static string Octal(long num) public static string Octal(long num)
{ {
var octal = Convert.ToString(num, 8); var octal = Convert.ToString(num, 8);
@ -52,8 +49,7 @@ namespace BizHawk.Client.Common
return octal; return octal;
} }
[LuaMethodAttributes( [LuaMethod("trim", "returns a string that trims whitespace on the left and right ends of the string")]
"trim", "returns a string that trims whitespace on the left and right ends of the string")]
public static string Trim(string str) public static string Trim(string str)
{ {
if (string.IsNullOrEmpty(str)) if (string.IsNullOrEmpty(str))
@ -64,8 +60,7 @@ namespace BizHawk.Client.Common
return str.Trim(); return str.Trim();
} }
[LuaMethodAttributes( [LuaMethod("replace", "Returns a string that replaces all occurances of str2 in str1 with the value of replace")]
"replace", "Returns a string that replaces all occurances of str2 in str1 with the value of replace")]
public static string Replace(string str, string str2, string replace) public static string Replace(string str, string str2, string replace)
{ {
if (string.IsNullOrEmpty(str)) if (string.IsNullOrEmpty(str))
@ -76,7 +71,7 @@ namespace BizHawk.Client.Common
return str.Replace(str2, replace); return str.Replace(str2, replace);
} }
[LuaMethodAttributes("toupper", "Returns an uppercase version of the given string")] [LuaMethod("toupper", "Returns an uppercase version of the given string")]
public static string ToUpper(string str) public static string ToUpper(string str)
{ {
if (string.IsNullOrEmpty(str)) if (string.IsNullOrEmpty(str))
@ -87,7 +82,7 @@ namespace BizHawk.Client.Common
return str.ToUpper(); return str.ToUpper();
} }
[LuaMethodAttributes("tolower", "Returns an lowercase version of the given string")] [LuaMethod("tolower", "Returns an lowercase version of the given string")]
public static string ToLower(string str) public static string ToLower(string str)
{ {
if (string.IsNullOrEmpty(str)) if (string.IsNullOrEmpty(str))
@ -98,8 +93,7 @@ namespace BizHawk.Client.Common
return str.ToLower(); return str.ToLower();
} }
[LuaMethodAttributes( [LuaMethod("substring", "Returns a string that represents a substring of str starting at position for the specified length")]
"substring", "Returns a string that represents a substring of str starting at position for the specified length")]
public static string SubString(string str, int position, int length) public static string SubString(string str, int position, int length)
{ {
if (string.IsNullOrEmpty(str)) if (string.IsNullOrEmpty(str))
@ -110,8 +104,7 @@ namespace BizHawk.Client.Common
return str.Substring(position, length); return str.Substring(position, length);
} }
[LuaMethodAttributes( [LuaMethod("remove", "Returns a string that represents str with the given position and count removed")]
"remove", "Returns a string that represents str with the given position and count removed")]
public static string Remove(string str, int position, int count) public static string Remove(string str, int position, int count)
{ {
if (string.IsNullOrEmpty(str)) if (string.IsNullOrEmpty(str))
@ -122,7 +115,7 @@ namespace BizHawk.Client.Common
return str.Remove(position, count); return str.Remove(position, count);
} }
[LuaMethodAttributes("contains", "Returns whether or not str contains str2")] [LuaMethod("contains", "Returns whether or not str contains str2")]
public static bool Contains(string str, string str2) public static bool Contains(string str, string str2)
{ {
if (string.IsNullOrEmpty(str)) if (string.IsNullOrEmpty(str))
@ -133,7 +126,7 @@ namespace BizHawk.Client.Common
return str.Contains(str2); return str.Contains(str2);
} }
[LuaMethodAttributes("startswith", "Returns whether str starts with str2")] [LuaMethod("startswith", "Returns whether str starts with str2")]
public static bool StartsWith(string str, string str2) public static bool StartsWith(string str, string str2)
{ {
if (string.IsNullOrEmpty(str)) if (string.IsNullOrEmpty(str))
@ -144,7 +137,7 @@ namespace BizHawk.Client.Common
return str.StartsWith(str2); return str.StartsWith(str2);
} }
[LuaMethodAttributes("endswith", "Returns whether str ends wth str2")] [LuaMethod("endswith", "Returns whether str ends wth str2")]
public static bool EndsWith(string str, string str2) public static bool EndsWith(string str, string str2)
{ {
if (string.IsNullOrEmpty(str)) if (string.IsNullOrEmpty(str))
@ -155,8 +148,7 @@ namespace BizHawk.Client.Common
return str.EndsWith(str2); return str.EndsWith(str2);
} }
[LuaMethodAttributes( [LuaMethod("split", "Splits str based on separator into a LuaTable. Separator must be one character!. Same functionality as .NET string.Split() using the RemoveEmptyEntries option")]
"split", "Splits str based on separator into a LuaTable. Separator must be one character!. Same functionality as .NET string.Split() using the RemoveEmptyEntries option")]
public LuaTable Split(string str, string separator) public LuaTable Split(string str, string separator)
{ {
var table = Lua.NewTable(); var table = Lua.NewTable();

View File

@ -18,17 +18,13 @@ namespace BizHawk.Client.EmuHawk
public override string Name => "userdata"; public override string Name => "userdata";
[LuaMethodAttributes( [LuaMethod("set", "adds or updates the data with the given key with the given value")]
"set",
"adds or updates the data with the given key with the given value")]
public void Set(string name, object value) public void Set(string name, object value)
{ {
Global.UserBag[name] = value; Global.UserBag[name] = value;
} }
[LuaMethodAttributes( [LuaMethod("get", "gets the data with the given key, if the key does not exist it will return nil")]
"get",
"gets the data with the given key, if the key does not exist it will return nil")]
public object Get(string key) public object Get(string key)
{ {
if (Global.UserBag.ContainsKey(key)) if (Global.UserBag.ContainsKey(key))
@ -39,25 +35,19 @@ namespace BizHawk.Client.EmuHawk
return null; return null;
} }
[LuaMethodAttributes( [LuaMethod("clear", "clears all user data")]
"clear",
"clears all user data")]
public void Clear() public void Clear()
{ {
Global.UserBag.Clear(); Global.UserBag.Clear();
} }
[LuaMethodAttributes( [LuaMethod("remove", "remove the data with the given key. Returns true if the element is successfully found and removed; otherwise, false.")]
"remove",
"remove the data with the given key. Returns true if the element is successfully found and removed; otherwise, false.")]
public bool Remove(string key) public bool Remove(string key)
{ {
return Global.UserBag.Remove(key); return Global.UserBag.Remove(key);
} }
[LuaMethodAttributes( [LuaMethod("containskey", "returns whether or not there is an entry for the given key")]
"containskey",
"returns whether or not there is an entry for the given key")]
public bool ContainsKey(string key) public bool ContainsKey(string key)
{ {
return Global.UserBag.ContainsKey(key); return Global.UserBag.ContainsKey(key);

View File

@ -3,9 +3,9 @@
namespace BizHawk.Client.Common namespace BizHawk.Client.Common
{ {
[AttributeUsage(AttributeTargets.Method)] [AttributeUsage(AttributeTargets.Method)]
public class LuaMethodAttributes : Attribute public class LuaMethodAttribute : Attribute
{ {
public LuaMethodAttributes(string name, string description) public LuaMethodAttribute(string name, string description)
{ {
Name = name; Name = name;
Description = description; Description = description;
@ -16,9 +16,9 @@ namespace BizHawk.Client.Common
} }
[AttributeUsage(AttributeTargets.Class)] [AttributeUsage(AttributeTargets.Class)]
public class LuaLibraryAttributes : Attribute public class LuaLibraryAttribute : Attribute
{ {
public LuaLibraryAttributes(bool released) public LuaLibraryAttribute(bool released)
{ {
Released = released; Released = released;
} }

View File

@ -161,13 +161,13 @@ __Types and notation__
public class LibraryFunction public class LibraryFunction
{ {
private readonly LuaMethodAttributes _luaAttributes; private readonly LuaMethodAttribute _luaAttributes;
private readonly MethodInfo _method; private readonly MethodInfo _method;
public LibraryFunction(string library, string libraryDescription, MethodInfo method) public LibraryFunction(string library, string libraryDescription, MethodInfo method)
{ {
_luaAttributes = method.GetCustomAttributes(typeof(LuaMethodAttributes), false) _luaAttributes = method.GetCustomAttributes(typeof(LuaMethodAttribute), false)
.First() as LuaMethodAttributes; .First() as LuaMethodAttribute;
_method = method; _method = method;
Library = library; Library = library;

View File

@ -96,7 +96,7 @@ namespace BizHawk.Client.Common
{ {
Lua.NewTable(Name); Lua.NewTable(Name);
var luaAttr = typeof(LuaMethodAttributes); var luaAttr = typeof(LuaMethodAttribute);
var methods = GetType() var methods = GetType()
.GetMethods() .GetMethods()
@ -104,7 +104,7 @@ namespace BizHawk.Client.Common
foreach (var method in methods) foreach (var method in methods)
{ {
var luaMethodAttr = (LuaMethodAttributes)method.GetCustomAttributes(luaAttr, false).First(); var luaMethodAttr = (LuaMethodAttribute)method.GetCustomAttributes(luaAttr, false).First();
var luaName = Name + "." + luaMethodAttr.Name; var luaName = Name + "." + luaMethodAttr.Name;
Lua.RegisterFunction(luaName, this, method); Lua.RegisterFunction(luaName, this, method);

View File

@ -36,67 +36,63 @@ namespace BizHawk.Client.EmuHawk
public override string Name => "client"; public override string Name => "client";
[LuaMethodAttributes("exit", "Closes the emulator")] [LuaMethod("exit", "Closes the emulator")]
public void CloseEmulator() public void CloseEmulator()
{ {
GlobalWin.MainForm.CloseEmulator(); GlobalWin.MainForm.CloseEmulator();
} }
[LuaMethodAttributes("exitCode", "Closes the emulator and returns the provided code")] [LuaMethod("exitCode", "Closes the emulator and returns the provided code")]
public void CloseEmulatorWithCode(int exitCode) public void CloseEmulatorWithCode(int exitCode)
{ {
GlobalWin.MainForm.CloseEmulator(exitCode); GlobalWin.MainForm.CloseEmulator(exitCode);
} }
[LuaMethodAttributes( [LuaMethod("borderheight", "Gets the current height in pixels of the letter/pillarbox area (top side only) around the emu display surface, excluding the gameExtraPadding you've set. This function (the whole lot of them) should be renamed or refactored since the padding areas have got more complex.")]
"borderheight", "Gets the current height in pixels of the letter/pillarbox area (top side only) around the emu display surface, excluding the gameExtraPadding you've set. This function (the whole lot of them) should be renamed or refactored since the padding areas have got more complex.")]
public static int BorderHeight() public static int BorderHeight()
{ {
var point = new System.Drawing.Point(0, 0); var point = new System.Drawing.Point(0, 0);
return GlobalWin.DisplayManager.TransformPoint(point).Y; return GlobalWin.DisplayManager.TransformPoint(point).Y;
} }
[LuaMethodAttributes( [LuaMethod("borderwidth", "Gets the current width in pixels of the letter/pillarbox area (left side only) around the emu display surface, excluding the gameExtraPadding you've set. This function (the whole lot of them) should be renamed or refactored since the padding areas have got more complex.")]
"borderwidth", "Gets the current width in pixels of the letter/pillarbox area (left side only) around the emu display surface, excluding the gameExtraPadding you've set. This function (the whole lot of them) should be renamed or refactored since the padding areas have got more complex.")]
public static int BorderWidth() public static int BorderWidth()
{ {
var point = new System.Drawing.Point(0, 0); var point = new System.Drawing.Point(0, 0);
return GlobalWin.DisplayManager.TransformPoint(point).X; return GlobalWin.DisplayManager.TransformPoint(point).X;
} }
[LuaMethodAttributes( [LuaMethod("bufferheight", "Gets the visible height of the emu display surface (the core video output). This excludes the gameExtraPadding you've set.")]
"bufferheight", "Gets the visible height of the emu display surface (the core video output). This excludes the gameExtraPadding you've set.")]
public int BufferHeight() public int BufferHeight()
{ {
return VideoProvider.BufferHeight; return VideoProvider.BufferHeight;
} }
[LuaMethodAttributes( [LuaMethod("bufferwidth", "Gets the visible width of the emu display surface (the core video output). This excludes the gameExtraPadding you've set.")]
"bufferwidth", "Gets the visible width of the emu display surface (the core video output). This excludes the gameExtraPadding you've set.")]
public int BufferWidth() public int BufferWidth()
{ {
return VideoProvider.BufferWidth; return VideoProvider.BufferWidth;
} }
[LuaMethodAttributes("clearautohold", "Clears all autohold keys")] [LuaMethod("clearautohold", "Clears all autohold keys")]
public void ClearAutohold() public void ClearAutohold()
{ {
GlobalWin.MainForm.ClearHolds(); GlobalWin.MainForm.ClearHolds();
} }
[LuaMethodAttributes("closerom", "Closes the loaded Rom")] [LuaMethod("closerom", "Closes the loaded Rom")]
public static void CloseRom() public static void CloseRom()
{ {
GlobalWin.MainForm.CloseRom(); GlobalWin.MainForm.CloseRom();
} }
[LuaMethodAttributes("enablerewind", "Sets whether or not the rewind feature is enabled")] [LuaMethod("enablerewind", "Sets whether or not the rewind feature is enabled")]
public void EnableRewind(bool enabled) public void EnableRewind(bool enabled)
{ {
GlobalWin.MainForm.EnableRewind(enabled); GlobalWin.MainForm.EnableRewind(enabled);
} }
[LuaMethodAttributes("frameskip", "Sets the frame skip value of the client UI")] [LuaMethod("frameskip", "Sets the frame skip value of the client UI")]
public void FrameSkip(int numFrames) public void FrameSkip(int numFrames)
{ {
if (numFrames > 0) if (numFrames > 0)
@ -110,111 +106,111 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("gettargetscanlineintensity", "Gets the current scanline intensity setting, used for the scanline display filter")] [LuaMethod("gettargetscanlineintensity", "Gets the current scanline intensity setting, used for the scanline display filter")]
public static int GetTargetScanlineIntensity() public static int GetTargetScanlineIntensity()
{ {
return Global.Config.TargetScanlineFilterIntensity; return Global.Config.TargetScanlineFilterIntensity;
} }
[LuaMethodAttributes("getwindowsize", "Gets the main window's size Possible values are 1, 2, 3, 4, 5, and 10")] [LuaMethod("getwindowsize", "Gets the main window's size Possible values are 1, 2, 3, 4, 5, and 10")]
public int GetWindowSize() public int GetWindowSize()
{ {
return Global.Config.TargetZoomFactors[Emulator.SystemId]; return Global.Config.TargetZoomFactors[Emulator.SystemId];
} }
[LuaMethodAttributes("SetGameExtraPadding", "Sets the extra padding added to the 'emu' surface so that you can draw HUD elements in predictable placements")] [LuaMethod("SetGameExtraPadding", "Sets the extra padding added to the 'emu' surface so that you can draw HUD elements in predictable placements")]
public static void SetGameExtraPadding(int left, int top, int right, int bottom) public static void SetGameExtraPadding(int left, int top, int right, int bottom)
{ {
GlobalWin.DisplayManager.GameExtraPadding = new System.Windows.Forms.Padding(left, top, right, bottom); GlobalWin.DisplayManager.GameExtraPadding = new System.Windows.Forms.Padding(left, top, right, bottom);
GlobalWin.MainForm.FrameBufferResized(); GlobalWin.MainForm.FrameBufferResized();
} }
[LuaMethodAttributes("SetSoundOn", "Sets the state of the Sound On toggle")] [LuaMethod("SetSoundOn", "Sets the state of the Sound On toggle")]
public static void SetSoundOn(bool enable) public static void SetSoundOn(bool enable)
{ {
Global.Config.SoundEnabled = enable; Global.Config.SoundEnabled = enable;
} }
[LuaMethodAttributes("GetSoundOn", "Gets the state of the Sound On toggle")] [LuaMethod("GetSoundOn", "Gets the state of the Sound On toggle")]
public static bool GetSoundOn() public static bool GetSoundOn()
{ {
return Global.Config.SoundEnabled; return Global.Config.SoundEnabled;
} }
[LuaMethodAttributes("SetClientExtraPadding", "Sets the extra padding added to the 'native' surface so that you can draw HUD elements in predictable placements")] [LuaMethod("SetClientExtraPadding", "Sets the extra padding added to the 'native' surface so that you can draw HUD elements in predictable placements")]
public static void SetClientExtraPadding(int left, int top, int right, int bottom) public static void SetClientExtraPadding(int left, int top, int right, int bottom)
{ {
GlobalWin.DisplayManager.ClientExtraPadding = new System.Windows.Forms.Padding(left, top, right, bottom); GlobalWin.DisplayManager.ClientExtraPadding = new System.Windows.Forms.Padding(left, top, right, bottom);
GlobalWin.MainForm.FrameBufferResized(); GlobalWin.MainForm.FrameBufferResized();
} }
[LuaMethodAttributes("ispaused", "Returns true if emulator is paused, otherwise, false")] [LuaMethod("ispaused", "Returns true if emulator is paused, otherwise, false")]
public static bool IsPaused() public static bool IsPaused()
{ {
return GlobalWin.MainForm.EmulatorPaused; return GlobalWin.MainForm.EmulatorPaused;
} }
[LuaMethodAttributes("opencheats", "opens the Cheats dialog")] [LuaMethod("opencheats", "opens the Cheats dialog")]
public static void OpenCheats() public static void OpenCheats()
{ {
GlobalWin.Tools.Load<Cheats>(); GlobalWin.Tools.Load<Cheats>();
} }
[LuaMethodAttributes("openhexeditor", "opens the Hex Editor dialog")] [LuaMethod("openhexeditor", "opens the Hex Editor dialog")]
public static void OpenHexEditor() public static void OpenHexEditor()
{ {
GlobalWin.Tools.Load<HexEditor>(); GlobalWin.Tools.Load<HexEditor>();
} }
[LuaMethodAttributes("openramwatch", "opens the RAM Watch dialog")] [LuaMethod("openramwatch", "opens the RAM Watch dialog")]
public static void OpenRamWatch() public static void OpenRamWatch()
{ {
GlobalWin.Tools.LoadRamWatch(loadDialog: true); GlobalWin.Tools.LoadRamWatch(loadDialog: true);
} }
[LuaMethodAttributes("openramsearch", "opens the RAM Search dialog")] [LuaMethod("openramsearch", "opens the RAM Search dialog")]
public static void OpenRamSearch() public static void OpenRamSearch()
{ {
GlobalWin.Tools.Load<RamSearch>(); GlobalWin.Tools.Load<RamSearch>();
} }
[LuaMethodAttributes("openrom", "opens the Open ROM dialog")] [LuaMethod("openrom", "opens the Open ROM dialog")]
public static void OpenRom(string path) public static void OpenRom(string path)
{ {
GlobalWin.MainForm.LoadRom(path, new MainForm.LoadRomArgs { OpenAdvanced = new OpenAdvanced_OpenRom() }); GlobalWin.MainForm.LoadRom(path, new MainForm.LoadRomArgs { OpenAdvanced = new OpenAdvanced_OpenRom() });
} }
[LuaMethodAttributes("opentasstudio", "opens the TAStudio dialog")] [LuaMethod("opentasstudio", "opens the TAStudio dialog")]
public static void OpenTasStudio() public static void OpenTasStudio()
{ {
GlobalWin.Tools.Load<TAStudio>(); GlobalWin.Tools.Load<TAStudio>();
} }
[LuaMethodAttributes("opentoolbox", "opens the Toolbox Dialog")] [LuaMethod("opentoolbox", "opens the Toolbox Dialog")]
public static void OpenToolBox() public static void OpenToolBox()
{ {
GlobalWin.Tools.Load<ToolBox>(); GlobalWin.Tools.Load<ToolBox>();
} }
[LuaMethodAttributes("opentracelogger", "opens the tracelogger if it is available for the given core")] [LuaMethod("opentracelogger", "opens the tracelogger if it is available for the given core")]
public static void OpenTraceLogger() public static void OpenTraceLogger()
{ {
GlobalWin.Tools.Load<TraceLogger>(); GlobalWin.Tools.Load<TraceLogger>();
} }
[LuaMethodAttributes("pause", "Pauses the emulator")] [LuaMethod("pause", "Pauses the emulator")]
public static void Pause() public static void Pause()
{ {
GlobalWin.MainForm.PauseEmulator(); GlobalWin.MainForm.PauseEmulator();
} }
[LuaMethodAttributes("pause_av", "If currently capturing Audio/Video, this will suspend the record. Frames will not be captured into the AV until client.unpause_av() is called")] [LuaMethod("pause_av", "If currently capturing Audio/Video, this will suspend the record. Frames will not be captured into the AV until client.unpause_av() is called")]
public static void PauseAv() public static void PauseAv()
{ {
GlobalWin.MainForm.PauseAvi = true; GlobalWin.MainForm.PauseAvi = true;
} }
[LuaMethodAttributes("reboot_core", "Reboots the currently loaded core")] [LuaMethod("reboot_core", "Reboots the currently loaded core")]
public static void RebootCore() public static void RebootCore()
{ {
((LuaConsole)GlobalWin.Tools.Get<LuaConsole>()).LuaImp.IsRebootingCore = true; ((LuaConsole)GlobalWin.Tools.Get<LuaConsole>()).LuaImp.IsRebootingCore = true;
@ -222,13 +218,13 @@ namespace BizHawk.Client.EmuHawk
((LuaConsole)GlobalWin.Tools.Get<LuaConsole>()).LuaImp.IsRebootingCore = false; ((LuaConsole)GlobalWin.Tools.Get<LuaConsole>()).LuaImp.IsRebootingCore = false;
} }
[LuaMethodAttributes("screenheight", "Gets the current height in pixels of the emulator's drawing area")] [LuaMethod("screenheight", "Gets the current height in pixels of the emulator's drawing area")]
public static int ScreenHeight() public static int ScreenHeight()
{ {
return GlobalWin.MainForm.PresentationPanel.NativeSize.Height; return GlobalWin.MainForm.PresentationPanel.NativeSize.Height;
} }
[LuaMethodAttributes("screenshot", "if a parameter is passed it will function as the Screenshot As menu item of EmuHawk, else it will function as the Screenshot menu item")] [LuaMethod("screenshot", "if a parameter is passed it will function as the Screenshot As menu item of EmuHawk, else it will function as the Screenshot menu item")]
public static void Screenshot(string path = null) public static void Screenshot(string path = null)
{ {
if (path == null) if (path == null)
@ -241,31 +237,31 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("screenshottoclipboard", "Performs the same function as EmuHawk's Screenshot To Clipboard menu item")] [LuaMethod("screenshottoclipboard", "Performs the same function as EmuHawk's Screenshot To Clipboard menu item")]
public static void ScreenshotToClipboard() public static void ScreenshotToClipboard()
{ {
GlobalWin.MainForm.TakeScreenshotToClipboard(); GlobalWin.MainForm.TakeScreenshotToClipboard();
} }
[LuaMethodAttributes("settargetscanlineintensity", "Sets the current scanline intensity setting, used for the scanline display filter")] [LuaMethod("settargetscanlineintensity", "Sets the current scanline intensity setting, used for the scanline display filter")]
public static void SetTargetScanlineIntensity(int val) public static void SetTargetScanlineIntensity(int val)
{ {
Global.Config.TargetScanlineFilterIntensity = val; Global.Config.TargetScanlineFilterIntensity = val;
} }
[LuaMethodAttributes("setscreenshotosd", "Sets the screenshot Capture OSD property of the client")] [LuaMethod("setscreenshotosd", "Sets the screenshot Capture OSD property of the client")]
public static void SetScreenshotOSD(bool value) public static void SetScreenshotOSD(bool value)
{ {
Global.Config.Screenshot_CaptureOSD = value; Global.Config.Screenshot_CaptureOSD = value;
} }
[LuaMethodAttributes("screenwidth", "Gets the current width in pixels of the emulator's drawing area")] [LuaMethod("screenwidth", "Gets the current width in pixels of the emulator's drawing area")]
public static int ScreenWidth() public static int ScreenWidth()
{ {
return GlobalWin.MainForm.PresentationPanel.NativeSize.Width; return GlobalWin.MainForm.PresentationPanel.NativeSize.Width;
} }
[LuaMethodAttributes("setwindowsize", "Sets the main window's size to the give value. Accepted values are 1, 2, 3, 4, 5, and 10")] [LuaMethod("setwindowsize", "Sets the main window's size to the give value. Accepted values are 1, 2, 3, 4, 5, and 10")]
public void SetWindowSize(int size) public void SetWindowSize(int size)
{ {
if (size == 1 || size == 2 || size == 3 || size == 4 || size == 5 || size == 10) if (size == 1 || size == 2 || size == 3 || size == 4 || size == 5 || size == 10)
@ -280,7 +276,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("speedmode", "Sets the speed of the emulator (in terms of percent)")] [LuaMethod("speedmode", "Sets the speed of the emulator (in terms of percent)")]
public void SpeedMode(int percent) public void SpeedMode(int percent)
{ {
if (percent > 0 && percent < 6400) if (percent > 0 && percent < 6400)
@ -293,51 +289,51 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("togglepause", "Toggles the current pause state")] [LuaMethod("togglepause", "Toggles the current pause state")]
public static void TogglePause() public static void TogglePause()
{ {
GlobalWin.MainForm.TogglePause(); GlobalWin.MainForm.TogglePause();
} }
[LuaMethodAttributes("transformPointX", "Transforms an x-coordinate in emulator space to an x-coordinate in client space")] [LuaMethod("transformPointX", "Transforms an x-coordinate in emulator space to an x-coordinate in client space")]
public static int TransformPointX(int x) public static int TransformPointX(int x)
{ {
var point = new System.Drawing.Point(x, 0); var point = new System.Drawing.Point(x, 0);
return GlobalWin.DisplayManager.TransformPoint(point).X; return GlobalWin.DisplayManager.TransformPoint(point).X;
} }
[LuaMethodAttributes("transformPointY", "Transforms an y-coordinate in emulator space to an y-coordinate in client space")] [LuaMethod("transformPointY", "Transforms an y-coordinate in emulator space to an y-coordinate in client space")]
public static int TransformPointY(int y) public static int TransformPointY(int y)
{ {
var point = new System.Drawing.Point(0, y); var point = new System.Drawing.Point(0, y);
return GlobalWin.DisplayManager.TransformPoint(point).Y; return GlobalWin.DisplayManager.TransformPoint(point).Y;
} }
[LuaMethodAttributes("unpause", "Unpauses the emulator")] [LuaMethod("unpause", "Unpauses the emulator")]
public static void Unpause() public static void Unpause()
{ {
GlobalWin.MainForm.UnpauseEmulator(); GlobalWin.MainForm.UnpauseEmulator();
} }
[LuaMethodAttributes("unpause_av", "If currently capturing Audio/Video this resumes capturing")] [LuaMethod("unpause_av", "If currently capturing Audio/Video this resumes capturing")]
public static void UnpauseAv() public static void UnpauseAv()
{ {
GlobalWin.MainForm.PauseAvi = false; GlobalWin.MainForm.PauseAvi = false;
} }
[LuaMethodAttributes("xpos", "Returns the x value of the screen position where the client currently sits")] [LuaMethod("xpos", "Returns the x value of the screen position where the client currently sits")]
public static int Xpos() public static int Xpos()
{ {
return GlobalWin.MainForm.DesktopLocation.X; return GlobalWin.MainForm.DesktopLocation.X;
} }
[LuaMethodAttributes("ypos", "Returns the y value of the screen position where the client currently sits")] [LuaMethod("ypos", "Returns the y value of the screen position where the client currently sits")]
public static int Ypos() public static int Ypos()
{ {
return GlobalWin.MainForm.DesktopLocation.Y; return GlobalWin.MainForm.DesktopLocation.Y;
} }
[LuaMethodAttributes("getavailabletools", "Returns a list of the tools currently open")] [LuaMethod("getavailabletools", "Returns a list of the tools currently open")]
public LuaTable GetAvailableTools() public LuaTable GetAvailableTools()
{ {
var t = Lua.NewTable(); var t = Lua.NewTable();
@ -350,8 +346,7 @@ namespace BizHawk.Client.EmuHawk
return t; return t;
} }
[LuaMethodAttributes( [LuaMethod("gettool", "Returns an object that represents a tool of the given name (not case sensitive). If the tool is not open, it will be loaded if available. Use gettools to get a list of names")]
"gettool", "Returns an object that represents a tool of the given name (not case sensitive). If the tool is not open, it will be loaded if available. Use gettools to get a list of names")]
public LuaTable GetTool(string name) public LuaTable GetTool(string name)
{ {
var toolType = ReflectionUtil.GetTypeByName(name) var toolType = ReflectionUtil.GetTypeByName(name)
@ -373,8 +368,7 @@ namespace BizHawk.Client.EmuHawk
return null; return null;
} }
[LuaMethodAttributes( [LuaMethod("createinstance", "returns a default instance of the given type of object if it exists (not case sensitive). Note: This will only work on objects which have a parameterless constructor. If no suitable type is found, or the type does not have a parameterless constructor, then nil is returned")]
"createinstance", "returns a default instance of the given type of object if it exists (not case sensitive). Note: This will only work on objects which have a parameterless constructor. If no suitable type is found, or the type does not have a parameterless constructor, then nil is returned")]
public LuaTable CreateInstance(string name) public LuaTable CreateInstance(string name)
{ {
var possibleTypes = ReflectionUtil.GetTypeByName(name); var possibleTypes = ReflectionUtil.GetTypeByName(name);
@ -388,13 +382,13 @@ namespace BizHawk.Client.EmuHawk
return null; return null;
} }
[LuaMethodAttributes("displaymessages", "sets whether or not on screen messages will display")] [LuaMethod("displaymessages", "sets whether or not on screen messages will display")]
public void DisplayMessages(bool value) public void DisplayMessages(bool value)
{ {
Global.Config.DisplayMessages = value; Global.Config.DisplayMessages = value;
} }
[LuaMethodAttributes("saveram", "flushes save ram to disk")] [LuaMethod("saveram", "flushes save ram to disk")]
public void SaveRam() public void SaveRam()
{ {
GlobalWin.MainForm.FlushSaveRAM(); GlobalWin.MainForm.FlushSaveRAM();

View File

@ -18,7 +18,7 @@ namespace BizHawk.Client.EmuHawk
public override string Name => "console"; public override string Name => "console";
[LuaMethodAttributes("clear", "clears the output box of the Lua Console window")] [LuaMethod("clear", "clears the output box of the Lua Console window")]
public static void Clear() public static void Clear()
{ {
if (GlobalWin.Tools.Has<LuaConsole>()) if (GlobalWin.Tools.Has<LuaConsole>())
@ -27,7 +27,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("getluafunctionslist", "returns a list of implemented functions")] [LuaMethod("getluafunctionslist", "returns a list of implemented functions")]
public static string GetLuaFunctionsList() public static string GetLuaFunctionsList()
{ {
var list = new StringBuilder(); var list = new StringBuilder();
@ -39,7 +39,7 @@ namespace BizHawk.Client.EmuHawk
return list.ToString(); return list.ToString();
} }
[LuaMethodAttributes("log", "Outputs the given object to the output box on the Lua Console dialog. Note: Can accept a LuaTable")] [LuaMethod("log", "Outputs the given object to the output box on the Lua Console dialog. Note: Can accept a LuaTable")]
public static void Log(params object[] outputs) public static void Log(params object[] outputs)
{ {
if (GlobalWin.Tools.Has<LuaConsole>()) if (GlobalWin.Tools.Has<LuaConsole>())
@ -57,7 +57,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("writeline", "Outputs the given object to the output box on the Lua Console dialog. Note: Can accept a LuaTable")] [LuaMethod("writeline", "Outputs the given object to the output box on the Lua Console dialog. Note: Can accept a LuaTable")]
public static void WriteLine(params object[] outputs) public static void WriteLine(params object[] outputs)
{ {
if (GlobalWin.Tools.Has<LuaConsole>()) if (GlobalWin.Tools.Has<LuaConsole>())
@ -66,7 +66,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("write", "Outputs the given object to the output box on the Lua Console dialog. Note: Can accept a LuaTable")] [LuaMethod("write", "Outputs the given object to the output box on the Lua Console dialog. Note: Can accept a LuaTable")]
public static void Write(params object[] outputs) public static void Write(params object[] outputs)
{ {
LogWithSeparator("", "", outputs); LogWithSeparator("", "", outputs);

View File

@ -61,7 +61,7 @@ namespace BizHawk.Client.EmuHawk
#endregion #endregion
[LuaMethodAttributes("addclick", "adds the given lua function as a click event to the given control")] [LuaMethod("addclick", "adds the given lua function as a click event to the given control")]
public void AddClick(int handle, LuaFunction clickEvent) public void AddClick(int handle, LuaFunction clickEvent)
{ {
var ptr = new IntPtr(handle); var ptr = new IntPtr(handle);
@ -77,8 +77,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes( [LuaMethod("button", "Creates a button control on the given form. The caption property will be the text value on the button. clickEvent is the name of a Lua function that will be invoked when the button is clicked. x, and y are the optional location parameters for the position of the button within the given form. The function returns the handle of the created button. Width and Height are optional, if not specified they will be a default size")]
"button", "Creates a button control on the given form. The caption property will be the text value on the button. clickEvent is the name of a Lua function that will be invoked when the button is clicked. x, and y are the optional location parameters for the position of the button within the given form. The function returns the handle of the created button. Width and Height are optional, if not specified they will be a default size")]
public int Button( public int Button(
int formHandle, int formHandle,
string caption, string caption,
@ -112,8 +111,7 @@ namespace BizHawk.Client.EmuHawk
return (int)button.Handle; return (int)button.Handle;
} }
[LuaMethodAttributes( [LuaMethod("checkbox", "Creates a checkbox control on the given form. The caption property will be the text of the checkbox. x and y are the optional location parameters for the position of the checkbox within the form")]
"checkbox", "Creates a checkbox control on the given form. The caption property will be the text of the checkbox. x and y are the optional location parameters for the position of the checkbox within the form")]
public int Checkbox(int formHandle, string caption, int? x = null, int? y = null) public int Checkbox(int formHandle, string caption, int? x = null, int? y = null)
{ {
var form = GetForm(formHandle); var form = GetForm(formHandle);
@ -134,7 +132,7 @@ namespace BizHawk.Client.EmuHawk
return (int)checkbox.Handle; return (int)checkbox.Handle;
} }
[LuaMethodAttributes("clearclicks", "Removes all click events from the given widget at the specified handle")] [LuaMethod("clearclicks", "Removes all click events from the given widget at the specified handle")]
public void ClearClicks(int handle) public void ClearClicks(int handle)
{ {
var ptr = new IntPtr(handle); var ptr = new IntPtr(handle);
@ -154,7 +152,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("destroy", "Closes and removes a Lua created form with the specified handle. If a dialog was found and removed true is returned, else false")] [LuaMethod("destroy", "Closes and removes a Lua created form with the specified handle. If a dialog was found and removed true is returned, else false")]
public bool Destroy(int handle) public bool Destroy(int handle)
{ {
var ptr = new IntPtr(handle); var ptr = new IntPtr(handle);
@ -171,7 +169,7 @@ namespace BizHawk.Client.EmuHawk
return false; return false;
} }
[LuaMethodAttributes("destroyall", "Closes and removes all Lua created dialogs")] [LuaMethod("destroyall", "Closes and removes all Lua created dialogs")]
public void DestroyAll() public void DestroyAll()
{ {
for (var i = _luaForms.Count - 1; i >= 0; i--) for (var i = _luaForms.Count - 1; i >= 0; i--)
@ -180,8 +178,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes( [LuaMethod("dropdown", "Creates a dropdown (with a ComboBoxStyle of DropDownList) control on the given form. Dropdown items are passed via a lua table. Only the values will be pulled for the dropdown items, the keys are irrelevant. Items will be sorted alphabetically. x and y are the optional location parameters, and width and height are the optional size parameters.")]
"dropdown", "Creates a dropdown (with a ComboBoxStyle of DropDownList) control on the given form. Dropdown items are passed via a lua table. Only the values will be pulled for the dropdown items, the keys are irrelevant. Items will be sorted alphabetically. x and y are the optional location parameters, and width and height are the optional size parameters.")]
public int Dropdown( public int Dropdown(
int formHandle, int formHandle,
LuaTable items, LuaTable items,
@ -215,7 +212,7 @@ namespace BizHawk.Client.EmuHawk
return (int)dropdown.Handle; return (int)dropdown.Handle;
} }
[LuaMethodAttributes("getproperty", "returns a string representation of the value of a property of the widget at the given handle")] [LuaMethod("getproperty", "returns a string representation of the value of a property of the widget at the given handle")]
public string GetProperty(int handle, string property) public string GetProperty(int handle, string property)
{ {
try try
@ -245,7 +242,7 @@ namespace BizHawk.Client.EmuHawk
return ""; return "";
} }
[LuaMethodAttributes("gettext", "Returns the text property of a given form or control")] [LuaMethod("gettext", "Returns the text property of a given form or control")]
public string GetText(int handle) public string GetText(int handle)
{ {
try try
@ -280,7 +277,7 @@ namespace BizHawk.Client.EmuHawk
return ""; return "";
} }
[LuaMethodAttributes("ischecked", "Returns the given checkbox's checked property")] [LuaMethod("ischecked", "Returns the given checkbox's checked property")]
public bool IsChecked(int handle) public bool IsChecked(int handle)
{ {
var ptr = new IntPtr(handle); var ptr = new IntPtr(handle);
@ -308,8 +305,7 @@ namespace BizHawk.Client.EmuHawk
return false; return false;
} }
[LuaMethodAttributes( [LuaMethod("label", "Creates a label control on the given form. The caption property is the text of the label. x, and y are the optional location parameters for the position of the label within the given form. The function returns the handle of the created label. Width and Height are optional, if not specified they will be a default size.")]
"label", "Creates a label control on the given form. The caption property is the text of the label. x, and y are the optional location parameters for the position of the label within the given form. The function returns the handle of the created label. Width and Height are optional, if not specified they will be a default size.")]
public int Label( public int Label(
int formHandle, int formHandle,
string caption, string caption,
@ -347,8 +343,7 @@ namespace BizHawk.Client.EmuHawk
return (int)label.Handle; return (int)label.Handle;
} }
[LuaMethodAttributes( [LuaMethod("newform", "creates a new default dialog, if both width and height are specified it will create a dialog of the specified size. If title is specified it will be the caption of the dialog, else the dialog caption will be 'Lua Dialog'. The function will return an int representing the handle of the dialog created.")]
"newform", "creates a new default dialog, if both width and height are specified it will create a dialog of the specified size. If title is specified it will be the caption of the dialog, else the dialog caption will be 'Lua Dialog'. The function will return an int representing the handle of the dialog created.")]
public int NewForm(int? width = null, int? height = null, string title = null, LuaFunction onClose = null) public int NewForm(int? width = null, int? height = null, string title = null, LuaFunction onClose = null)
{ {
var form = new LuaWinform(CurrentThread); var form = new LuaWinform(CurrentThread);
@ -382,8 +377,7 @@ namespace BizHawk.Client.EmuHawk
return (int)form.Handle; return (int)form.Handle;
} }
[LuaMethodAttributes( [LuaMethod("openfile", "Creates a standard openfile dialog with optional parameters for the filename, directory, and filter. The return value is the directory that the user picked. If they chose to cancel, it will return an empty string")]
"openfile", "Creates a standard openfile dialog with optional parameters for the filename, directory, and filter. The return value is the directory that the user picked. If they chose to cancel, it will return an empty string")]
public string OpenFile(string fileName = null, string initialDirectory = null, string filter = "All files (*.*)|*.*") public string OpenFile(string fileName = null, string initialDirectory = null, string filter = "All files (*.*)|*.*")
{ {
// filterext format ex: "Image Files(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|All files (*.*)|*.*" // filterext format ex: "Image Files(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|All files (*.*)|*.*"
@ -412,7 +406,7 @@ namespace BizHawk.Client.EmuHawk
return ""; return "";
} }
[LuaMethodAttributes("setdropdownitems", "Sets the items for a given dropdown box")] [LuaMethod("setdropdownitems", "Sets the items for a given dropdown box")]
public void SetDropdownItems(int handle, LuaTable items) public void SetDropdownItems(int handle, LuaTable items)
{ {
try try
@ -447,7 +441,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("setlocation", "Sets the location of a control or form by passing in the handle of the created object")] [LuaMethod("setlocation", "Sets the location of a control or form by passing in the handle of the created object")]
public void SetLocation(int handle, int x, int y) public void SetLocation(int handle, int x, int y)
{ {
var ptr = new IntPtr(handle); var ptr = new IntPtr(handle);
@ -470,7 +464,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("setproperty", "Attempts to set the given property of the widget with the given value. Note: not all properties will be able to be represented for the control to accept")] [LuaMethod("setproperty", "Attempts to set the given property of the widget with the given value. Note: not all properties will be able to be represented for the control to accept")]
public void SetProperty(int handle, string property, object value) public void SetProperty(int handle, string property, object value)
{ {
var ptr = new IntPtr(handle); var ptr = new IntPtr(handle);
@ -525,13 +519,13 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("createcolor", "Creates a color object useful with setproperty")] [LuaMethod("createcolor", "Creates a color object useful with setproperty")]
public Color CreateColor(int r, int g, int b, int a) public Color CreateColor(int r, int g, int b, int a)
{ {
return Color.FromArgb(a, r, g, b); return Color.FromArgb(a, r, g, b);
} }
[LuaMethodAttributes("setsize", "TODO")] [LuaMethod("setsize", "TODO")]
public void SetSize(int handle, int width, int height) public void SetSize(int handle, int width, int height)
{ {
var ptr = new IntPtr(handle); var ptr = new IntPtr(handle);
@ -554,7 +548,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("settext", "Sets the text property of a control or form by passing in the handle of the created object")] [LuaMethod("settext", "Sets the text property of a control or form by passing in the handle of the created object")]
public void Settext(int handle, string caption) public void Settext(int handle, string caption)
{ {
var ptr = new IntPtr(handle); var ptr = new IntPtr(handle);
@ -577,8 +571,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes( [LuaMethod("textbox", "Creates a textbox control on the given form. The caption property will be the initial value of the textbox (default is empty). Width and Height are option, if not specified they will be a default size of 100, 20. Type is an optional property to restrict the textbox input. The available options are HEX, SIGNED, and UNSIGNED. Passing it null or any other value will set it to no restriction. x, and y are the optional location parameters for the position of the textbox within the given form. The function returns the handle of the created textbox. If true, the multiline will enable the standard winform multi-line property. If true, the fixedWidth options will create a fixed width font. Scrollbars is an optional property to specify which scrollbars to display. The available options are Vertical, Horizontal, Both, and None. Scrollbars are only shown on a multiline textbox")]
"textbox", "Creates a textbox control on the given form. The caption property will be the initial value of the textbox (default is empty). Width and Height are option, if not specified they will be a default size of 100, 20. Type is an optional property to restrict the textbox input. The available options are HEX, SIGNED, and UNSIGNED. Passing it null or any other value will set it to no restriction. x, and y are the optional location parameters for the position of the textbox within the given form. The function returns the handle of the created textbox. If true, the multiline will enable the standard winform multi-line property. If true, the fixedWidth options will create a fixed width font. Scrollbars is an optional property to specify which scrollbars to display. The available options are Vertical, Horizontal, Both, and None. Scrollbars are only shown on a multiline textbox")]
public int Textbox( public int Textbox(
int formHandle, int formHandle,
string caption = null, string caption = null,

View File

@ -45,8 +45,7 @@ namespace BizHawk.Client.EmuHawk
public bool SurfaceIsNull => _luaSurface == null; public bool SurfaceIsNull => _luaSurface == null;
[LuaMethodAttributes( [LuaMethod("DrawNew", "Changes drawing target to the specified lua surface name. This may clobber any previous drawing to this surface (pass false if you don't want it to)")]
"DrawNew", "Changes drawing target to the specified lua surface name. This may clobber any previous drawing to this surface (pass false if you don't want it to)")]
public void DrawNew(string name, bool? clear = true) public void DrawNew(string name, bool? clear = true)
{ {
try try
@ -60,7 +59,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("DrawFinish", "Finishes drawing to the current lua surface and causes it to get displayed.")] [LuaMethod("DrawFinish", "Finishes drawing to the current lua surface and causes it to get displayed.")]
public void DrawFinish() public void DrawFinish()
{ {
if (_luaSurface != null) if (_luaSurface != null)
@ -127,45 +126,44 @@ namespace BizHawk.Client.EmuHawk
#endregion #endregion
[LuaMethodAttributes("addmessage", "Adds a message to the OSD's message area")] [LuaMethod("addmessage", "Adds a message to the OSD's message area")]
public void AddMessage(string message) public void AddMessage(string message)
{ {
GlobalWin.OSD.AddMessage(message); GlobalWin.OSD.AddMessage(message);
} }
[LuaMethodAttributes("clearGraphics", "clears all lua drawn graphics from the screen")] [LuaMethod("clearGraphics", "clears all lua drawn graphics from the screen")]
public void ClearGraphics() public void ClearGraphics()
{ {
_luaSurface.Clear(); _luaSurface.Clear();
DrawFinish(); DrawFinish();
} }
[LuaMethodAttributes("cleartext", "clears all text created by gui.text()")] [LuaMethod("cleartext", "clears all text created by gui.text()")]
public static void ClearText() public static void ClearText()
{ {
GlobalWin.OSD.ClearGUIText(); GlobalWin.OSD.ClearGUIText();
} }
[LuaMethodAttributes("defaultForeground", "Sets the default foreground color to use in drawing methods, white by default")] [LuaMethod("defaultForeground", "Sets the default foreground color to use in drawing methods, white by default")]
public void SetDefaultForegroundColor(Color color) public void SetDefaultForegroundColor(Color color)
{ {
_defaultForeground = color; _defaultForeground = color;
} }
[LuaMethodAttributes("defaultBackground", "Sets the default background color to use in drawing methods, transparent by default")] [LuaMethod("defaultBackground", "Sets the default background color to use in drawing methods, transparent by default")]
public void SetDefaultBackgroundColor(Color color) public void SetDefaultBackgroundColor(Color color)
{ {
_defaultBackground = color; _defaultBackground = color;
} }
[LuaMethodAttributes("defaultTextBackground", "Sets the default backgroiund color to use in text drawing methods, half-transparent black by default")] [LuaMethod("defaultTextBackground", "Sets the default backgroiund color to use in text drawing methods, half-transparent black by default")]
public void SetDefaultTextBackground(Color color) public void SetDefaultTextBackground(Color color)
{ {
_defaultTextBackground = color; _defaultTextBackground = color;
} }
[LuaMethodAttributes( [LuaMethod("defaultPixelFont", "Sets the default font to use in gui.pixelText(). Two font families are available, \"fceux\" and \"gens\" (or \"0\" and \"1\" respectively), \"gens\" is used by default")]
"defaultPixelFont", "Sets the default font to use in gui.pixelText(). Two font families are available, \"fceux\" and \"gens\" (or \"0\" and \"1\" respectively), \"gens\" is used by default")]
public void SetDefaultTextBackground(string fontfamily) public void SetDefaultTextBackground(string fontfamily)
{ {
switch (fontfamily) switch (fontfamily)
@ -184,7 +182,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("drawBezier", "Draws a Bezier curve using the table of coordinates provided in the given color")] [LuaMethod("drawBezier", "Draws a Bezier curve using the table of coordinates provided in the given color")]
public void DrawBezier(LuaTable points, Color color) public void DrawBezier(LuaTable points, Color color)
{ {
using (var g = GetGraphics()) using (var g = GetGraphics())
@ -213,8 +211,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes( [LuaMethod("drawBox", "Draws a rectangle on screen from x1/y1 to x2/y2. Same as drawRectangle except it receives two points intead of a point and width/height")]
"drawBox", "Draws a rectangle on screen from x1/y1 to x2/y2. Same as drawRectangle except it receives two points intead of a point and width/height")]
public void DrawBox(int x, int y, int x2, int y2, Color? line = null, Color? background = null) public void DrawBox(int x, int y, int x2, int y2, Color? line = null, Color? background = null)
{ {
using (var g = GetGraphics()) using (var g = GetGraphics())
@ -257,8 +254,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes( [LuaMethod("drawEllipse", "Draws an ellipse at the given coordinates and the given width and height. Line is the color of the ellipse. Background is the optional fill color")]
"drawEllipse", "Draws an ellipse at the given coordinates and the given width and height. Line is the color of the ellipse. Background is the optional fill color")]
public void DrawEllipse(int x, int y, int width, int height, Color? line = null, Color? background = null) public void DrawEllipse(int x, int y, int width, int height, Color? line = null, Color? background = null)
{ {
using (var g = GetGraphics()) using (var g = GetGraphics())
@ -282,8 +278,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes( [LuaMethod("drawIcon", "draws an Icon (.ico) file from the given path at the given coordinate. width and height are optional. If specified, it will resize the image accordingly")]
"drawIcon", "draws an Icon (.ico) file from the given path at the given coordinate. width and height are optional. If specified, it will resize the image accordingly")]
public void DrawIcon(string path, int x, int y, int? width = null, int? height = null) public void DrawIcon(string path, int x, int y, int? width = null, int? height = null)
{ {
using (var g = GetGraphics()) using (var g = GetGraphics())
@ -309,8 +304,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes( [LuaMethod("drawImage", "draws an image file from the given path at the given coordinate. width and height are optional. If specified, it will resize the image accordingly")]
"drawImage", "draws an image file from the given path at the given coordinate. width and height are optional. If specified, it will resize the image accordingly")]
public void DrawImage(string path, int x, int y, int? width = null, int? height = null, bool cache = true) public void DrawImage(string path, int x, int y, int? width = null, int? height = null, bool cache = true)
{ {
if (!File.Exists(path)) if (!File.Exists(path))
@ -339,8 +333,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes( [LuaMethod("clearImageCache", "clears the image cache that is built up by using gui.drawImage, also releases the file handle for cached images")]
"clearImageCache", "clears the image cache that is built up by using gui.drawImage, also releases the file handle for cached images")]
public void ClearImageCache() public void ClearImageCache()
{ {
foreach (var image in _imageCache) foreach (var image in _imageCache)
@ -351,8 +344,7 @@ namespace BizHawk.Client.EmuHawk
_imageCache.Clear(); _imageCache.Clear();
} }
[LuaMethodAttributes( [LuaMethod("drawImageRegion", "draws a given region of an image file from the given path at the given coordinate, and optionally with the given size")]
"drawImageRegion", "draws a given region of an image file from the given path at the given coordinate, and optionally with the given size")]
public void DrawImageRegion(string path, int source_x, int source_y, int source_width, int source_height, int dest_x, int dest_y, int? dest_width = null, int? dest_height = null) public void DrawImageRegion(string path, int source_x, int source_y, int source_width, int source_height, int dest_x, int dest_y, int? dest_width = null, int? dest_height = null)
{ {
if (!File.Exists(path)) if (!File.Exists(path))
@ -380,8 +372,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes( [LuaMethod("drawLine", "Draws a line from the first coordinate pair to the 2nd. Color is optional (if not specified it will be drawn black)")]
"drawLine", "Draws a line from the first coordinate pair to the 2nd. Color is optional (if not specified it will be drawn black)")]
public void DrawLine(int x1, int y1, int x2, int y2, Color? color = null) public void DrawLine(int x1, int y1, int x2, int y2, Color? color = null)
{ {
using (var g = GetGraphics()) using (var g = GetGraphics())
@ -390,14 +381,14 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("drawAxis", "Draws an axis of the specified size at the coordinate pair.)")] [LuaMethod("drawAxis", "Draws an axis of the specified size at the coordinate pair.)")]
public void DrawAxis(int x, int y, int size, Color? color = null) public void DrawAxis(int x, int y, int size, Color? color = null)
{ {
DrawLine(x + size, y, x - size, y, color); DrawLine(x + size, y, x - size, y, color);
DrawLine(x, y + size, x, y - size, color); DrawLine(x, y + size, x, y - size, color);
} }
[LuaMethodAttributes("drawPie", "draws a Pie shape at the given coordinates and the given width and height")] [LuaMethod("drawPie", "draws a Pie shape at the given coordinates and the given width and height")]
public void DrawPie( public void DrawPie(
int x, int x,
int y, int y,
@ -421,8 +412,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes( [LuaMethod("drawPixel", "Draws a single pixel at the given coordinates in the given color. Color is optional (if not specified it will be drawn black)")]
"drawPixel", "Draws a single pixel at the given coordinates in the given color. Color is optional (if not specified it will be drawn black)")]
public void DrawPixel(int x, int y, Color? color = null) public void DrawPixel(int x, int y, Color? color = null)
{ {
using (var g = GetGraphics()) using (var g = GetGraphics())
@ -438,8 +428,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes( [LuaMethod("drawPolygon", "Draws a polygon using the table of coordinates specified in points. This should be a table of tables(each of size 2). Line is the color of the polygon. Background is the optional fill color")]
"drawPolygon", "Draws a polygon using the table of coordinates specified in points. This should be a table of tables(each of size 2). Line is the color of the polygon. Background is the optional fill color")]
public void DrawPolygon(LuaTable points, Color? line = null, Color? background = null) public void DrawPolygon(LuaTable points, Color? line = null, Color? background = null)
{ {
using (var g = GetGraphics()) using (var g = GetGraphics())
@ -468,8 +457,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes( [LuaMethod("drawRectangle", "Draws a rectangle at the given coordinate and the given width and height. Line is the color of the box. Background is the optional fill color")]
"drawRectangle", "Draws a rectangle at the given coordinate and the given width and height. Line is the color of the box. Background is the optional fill color")]
public void DrawRectangle(int x, int y, int width, int height, Color? line = null, Color? background = null) public void DrawRectangle(int x, int y, int width, int height, Color? line = null, Color? background = null)
{ {
using (var g = GetGraphics()) using (var g = GetGraphics())
@ -483,7 +471,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("drawString", "Alias of gui.drawText()")] [LuaMethod("drawString", "Alias of gui.drawText()")]
public void DrawString( public void DrawString(
int x, int x,
int y, int y,
@ -499,8 +487,7 @@ namespace BizHawk.Client.EmuHawk
DrawText(x, y, message, forecolor, backcolor, fontsize, fontfamily, fontstyle, horizalign, vertalign); DrawText(x, y, message, forecolor, backcolor, fontsize, fontfamily, fontstyle, horizalign, vertalign);
} }
[LuaMethodAttributes( [LuaMethod("drawText", "Draws the given message in the emulator screen space (like all draw functions) at the given x,y coordinates and the given color. The default color is white. A fontfamily can be specified and is monospace generic if none is specified (font family options are the same as the .NET FontFamily class). The fontsize default is 12. The default font style is regular. Font style options are regular, bold, italic, strikethrough, underline. Horizontal alignment options are left (default), center, or right. Vertical alignment options are bottom (default), middle, or top. Alignment options specify which ends of the text will be drawn at the x and y coordinates.")]
"drawText", "Draws the given message in the emulator screen space (like all draw functions) at the given x,y coordinates and the given color. The default color is white. A fontfamily can be specified and is monospace generic if none is specified (font family options are the same as the .NET FontFamily class). The fontsize default is 12. The default font style is regular. Font style options are regular, bold, italic, strikethrough, underline. Horizontal alignment options are left (default), center, or right. Vertical alignment options are bottom (default), middle, or top. Alignment options specify which ends of the text will be drawn at the x and y coordinates.")]
public void DrawText( public void DrawText(
int x, int x,
int y, int y,
@ -595,9 +582,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes( [LuaMethod("pixelText", "Draws the given message in the emulator screen space (like all draw functions) at the given x,y coordinates and the given color. The default color is white. Two font families are available, \"fceux\" and \"gens\" (or \"0\" and \"1\" respectively), both are monospace and have the same size as in the emulaors they've been taken from. If no font family is specified, it uses \"gens\" font, unless that's overridden via gui.defaultPixelFont()")]
"pixelText",
"Draws the given message in the emulator screen space (like all draw functions) at the given x,y coordinates and the given color. The default color is white. Two font families are available, \"fceux\" and \"gens\" (or \"0\" and \"1\" respectively), both are monospace and have the same size as in the emulaors they've been taken from. If no font family is specified, it uses \"gens\" font, unless that's overridden via gui.defaultPixelFont()")]
public void DrawText( public void DrawText(
int x, int x,
int y, int y,
@ -651,8 +636,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes( [LuaMethod("text", "Displays the given text on the screen at the given coordinates. Optional Foreground color. The optional anchor flag anchors the text to one of the four corners. Anchor flag parameters: topleft, topright, bottomleft, bottomright")]
"text", "Displays the given text on the screen at the given coordinates. Optional Foreground color. The optional anchor flag anchors the text to one of the four corners. Anchor flag parameters: topleft, topright, bottomleft, bottomright")]
public void Text( public void Text(
int x, int x,
int y, int y,
@ -693,7 +677,7 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.OSD.AddGUIText(message, x, y, Color.Black, forecolor ?? Color.White, a); GlobalWin.OSD.AddGUIText(message, x, y, Color.Black, forecolor ?? Color.White, a);
} }
[LuaMethodAttributes("createcanvas", "Creates a canvas of the given size.")] [LuaMethod("createcanvas", "Creates a canvas of the given size.")]
public LuaTable Text(int width, int height) public LuaTable Text(int width, int height)
{ {
var canvas = new LuaCanvas(width, height); var canvas = new LuaCanvas(width, height);

View File

@ -17,8 +17,7 @@ namespace BizHawk.Client.EmuHawk
public override string Name => "input"; public override string Name => "input";
[LuaMethodAttributes( [LuaMethod("get", "Returns a lua table of all the buttons the user is currently pressing on their keyboard and gamepads\nAll buttons that are pressed have their key values set to true; all others remain nil.")]
"get", "Returns a lua table of all the buttons the user is currently pressing on their keyboard and gamepads\nAll buttons that are pressed have their key values set to true; all others remain nil.")]
public LuaTable Get() public LuaTable Get()
{ {
var buttons = Lua.NewTable(); var buttons = Lua.NewTable();
@ -30,8 +29,7 @@ namespace BizHawk.Client.EmuHawk
return buttons; return buttons;
} }
[LuaMethodAttributes( [LuaMethod("getmouse", "Returns a lua table of the mouse X/Y coordinates and button states. Table keys are X, Y, Left, Middle, Right, XButton1, XButton2, Wheel.")]
"getmouse", "Returns a lua table of the mouse X/Y coordinates and button states. Table keys are X, Y, Left, Middle, Right, XButton1, XButton2, Wheel.")]
public LuaTable GetMouse() public LuaTable GetMouse()
{ {
var buttons = Lua.NewTable(); var buttons = Lua.NewTable();

View File

@ -17,7 +17,7 @@ namespace BizHawk.Client.EmuHawk
public override string Name => "savestate"; public override string Name => "savestate";
[LuaMethodAttributes("load", "Loads a savestate with the given path")] [LuaMethod("load", "Loads a savestate with the given path")]
public void Load(string path) public void Load(string path)
{ {
if (!File.Exists(path)) if (!File.Exists(path))
@ -30,7 +30,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("loadslot", "Loads the savestate at the given slot number (must be an integer between 0 and 9)")] [LuaMethod("loadslot", "Loads the savestate at the given slot number (must be an integer between 0 and 9)")]
public void LoadSlot(int slotNum) public void LoadSlot(int slotNum)
{ {
if (slotNum >= 0 && slotNum <= 9) if (slotNum >= 0 && slotNum <= 9)
@ -39,13 +39,13 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("save", "Saves a state at the given path")] [LuaMethod("save", "Saves a state at the given path")]
public void Save(string path) public void Save(string path)
{ {
GlobalWin.MainForm.SaveState(path, path, true); GlobalWin.MainForm.SaveState(path, path, true);
} }
[LuaMethodAttributes("saveslot", "Saves a state at the given save slot (must be an integer between 0 and 9)")] [LuaMethod("saveslot", "Saves a state at the given save slot (must be an integer between 0 and 9)")]
public void SaveSlot(int slotNum) public void SaveSlot(int slotNum)
{ {
if (slotNum >= 0 && slotNum <= 9) if (slotNum >= 0 && slotNum <= 9)

View File

@ -8,7 +8,7 @@ using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Description("A library for manipulating the Tastudio dialog of the EmuHawk client")] [Description("A library for manipulating the Tastudio dialog of the EmuHawk client")]
[LuaLibraryAttributes(released: true)] [LuaLibrary(released: true)]
public sealed class TastudioLuaLibrary : LuaLibraryBase public sealed class TastudioLuaLibrary : LuaLibraryBase
{ {
public TastudioLuaLibrary(Lua lua) public TastudioLuaLibrary(Lua lua)
@ -21,19 +21,19 @@ namespace BizHawk.Client.EmuHawk
private TAStudio Tastudio => GlobalWin.Tools.Get<TAStudio>() as TAStudio; private TAStudio Tastudio => GlobalWin.Tools.Get<TAStudio>() as TAStudio;
[LuaMethodAttributes("engaged", "returns whether or not tastudio is currently engaged (active)")] [LuaMethod("engaged", "returns whether or not tastudio is currently engaged (active)")]
public bool Engaged() public bool Engaged()
{ {
return GlobalWin.Tools.Has<TAStudio>(); // TODO: eventually tastudio should have an engaged flag return GlobalWin.Tools.Has<TAStudio>(); // TODO: eventually tastudio should have an engaged flag
} }
[LuaMethodAttributes("getrecording", "returns whether or not TAStudio is in recording mode")] [LuaMethod("getrecording", "returns whether or not TAStudio is in recording mode")]
public bool GetRecording() public bool GetRecording()
{ {
return Tastudio.TasPlaybackBox.RecordingMode; return Tastudio.TasPlaybackBox.RecordingMode;
} }
[LuaMethodAttributes("setrecording", "sets the recording mode on/off depending on the parameter")] [LuaMethod("setrecording", "sets the recording mode on/off depending on the parameter")]
public void SetRecording(bool val) public void SetRecording(bool val)
{ {
if (Tastudio.TasPlaybackBox.RecordingMode != val) if (Tastudio.TasPlaybackBox.RecordingMode != val)
@ -42,13 +42,13 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("togglerecording", "toggles tastudio recording mode on/off depending on its current state")] [LuaMethod("togglerecording", "toggles tastudio recording mode on/off depending on its current state")]
public void SetRecording() public void SetRecording()
{ {
Tastudio.ToggleReadOnly(); Tastudio.ToggleReadOnly();
} }
[LuaMethodAttributes("setbranchtext", "adds the given message to the existing branch, or to the branch that will be created next if branch index is not specified")] [LuaMethod("setbranchtext", "adds the given message to the existing branch, or to the branch that will be created next if branch index is not specified")]
public void SetBranchText(string text, int? index = null) public void SetBranchText(string text, int? index = null)
{ {
if (index != null) if (index != null)
@ -61,7 +61,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("getmarker", "returns the marker text at the given frame, or an empty string if there is no marker for the given frame")] [LuaMethod("getmarker", "returns the marker text at the given frame, or an empty string if there is no marker for the given frame")]
public string GetMarker(int frame) public string GetMarker(int frame)
{ {
if (Engaged()) if (Engaged())
@ -76,7 +76,7 @@ namespace BizHawk.Client.EmuHawk
return ""; return "";
} }
[LuaMethodAttributes("removemarker", "if there is a marker for the given frame, it will be removed")] [LuaMethod("removemarker", "if there is a marker for the given frame, it will be removed")]
public void RemoveMarker(int frame) public void RemoveMarker(int frame)
{ {
if (Engaged()) if (Engaged())
@ -90,7 +90,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("setmarker", "Adds or sets a marker at the given frame, with an optional message")] [LuaMethod("setmarker", "Adds or sets a marker at the given frame, with an optional message")]
public void SetMarker(int frame, string message = null) public void SetMarker(int frame, string message = null)
{ {
if (Engaged()) if (Engaged())
@ -108,7 +108,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("islag", "Returns whether or not the given frame was a lag frame, null if unknown")] [LuaMethod("islag", "Returns whether or not the given frame was a lag frame, null if unknown")]
public bool? IsLag(int frame) public bool? IsLag(int frame)
{ {
if (Engaged()) if (Engaged())
@ -122,7 +122,7 @@ namespace BizHawk.Client.EmuHawk
return null; return null;
} }
[LuaMethodAttributes("setlag", "Sets the lag information for the given frame, if the frame does not exist in the lag log, it will be added. If the value is null, the lag information for that frame will be removed")] [LuaMethod("setlag", "Sets the lag information for the given frame, if the frame does not exist in the lag log, it will be added. If the value is null, the lag information for that frame will be removed")]
public void SetLag(int frame, bool? value) public void SetLag(int frame, bool? value)
{ {
if (Engaged()) if (Engaged())
@ -131,7 +131,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("hasstate", "Returns whether or not the given frame has a savestate associated with it")] [LuaMethod("hasstate", "Returns whether or not the given frame has a savestate associated with it")]
public bool HasState(int frame) public bool HasState(int frame)
{ {
if (Engaged()) if (Engaged())
@ -145,7 +145,7 @@ namespace BizHawk.Client.EmuHawk
return false; return false;
} }
[LuaMethodAttributes("setplayback", "Seeks the given frame (a number) or marker (a string)")] [LuaMethod("setplayback", "Seeks the given frame (a number) or marker (a string)")]
public void SetPlayback(object frame) public void SetPlayback(object frame)
{ {
if (Engaged()) if (Engaged())
@ -173,8 +173,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes( [LuaMethod("onqueryitembg", "called during the background draw event of the tastudio listview. luaf must be a function that takes 2 params: index, column. The first is the integer row index of the listview, and the 2nd is the string column name. luaf should return a value that can be parsed into a .NET Color object (string color name, or integer value)")]
"onqueryitembg", "called during the background draw event of the tastudio listview. luaf must be a function that takes 2 params: index, column. The first is the integer row index of the listview, and the 2nd is the string column name. luaf should return a value that can be parsed into a .NET Color object (string color name, or integer value)")]
public void OnQueryItemBg(LuaFunction luaf) public void OnQueryItemBg(LuaFunction luaf)
{ {
if (Engaged()) if (Engaged())
@ -194,8 +193,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes( [LuaMethod("onqueryitemtext", "called during the text draw event of the tastudio listview. luaf must be a function that takes 2 params: index, column. The first is the integer row index of the listview, and the 2nd is the string column name. luaf should return a value that can be parsed into a .NET Color object (string color name, or integer value)")]
"onqueryitemtext", "called during the text draw event of the tastudio listview. luaf must be a function that takes 2 params: index, column. The first is the integer row index of the listview, and the 2nd is the string column name. luaf should return a value that can be parsed into a .NET Color object (string color name, or integer value)")]
public void OnQueryItemText(LuaFunction luaf) public void OnQueryItemText(LuaFunction luaf)
{ {
if (Engaged()) if (Engaged())
@ -209,8 +207,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes( [LuaMethod("onqueryitemicon", "called during the icon draw event of the tastudio listview. luaf must be a function that takes 2 params: index, column. The first is the integer row index of the listview, and the 2nd is the string column name. luaf should return a value that can be parsed into a .NET Color object (string color name, or integer value)")]
"onqueryitemicon", "called during the icon draw event of the tastudio listview. luaf must be a function that takes 2 params: index, column. The first is the integer row index of the listview, and the 2nd is the string column name. luaf should return a value that can be parsed into a .NET Color object (string color name, or integer value)")]
public void OnQueryItemIcon(LuaFunction luaf) public void OnQueryItemIcon(LuaFunction luaf)
{ {
if (Engaged()) if (Engaged())
@ -230,7 +227,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("ongreenzoneinvalidated", "called whenever the greenzone is invalidated and returns the first frame that was invalidated")] [LuaMethod("ongreenzoneinvalidated", "called whenever the greenzone is invalidated and returns the first frame that was invalidated")]
public void OnGreenzoneInvalidated(LuaFunction luaf) public void OnGreenzoneInvalidated(LuaFunction luaf)
{ {
if (Engaged()) if (Engaged())
@ -242,7 +239,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("getselection", "gets the currently selected frames")] [LuaMethod("getselection", "gets the currently selected frames")]
public LuaTable GetSelection() public LuaTable GetSelection()
{ {
LuaTable table = Lua.NewTable(); LuaTable table = Lua.NewTable();
@ -260,7 +257,7 @@ namespace BizHawk.Client.EmuHawk
return table; return table;
} }
[LuaMethodAttributes("insertframes", "inserts the given number of blank frames at the given insertion frame")] [LuaMethod("insertframes", "inserts the given number of blank frames at the given insertion frame")]
public void InsertNumFrames(int insertionFrame, int numberOfFrames) public void InsertNumFrames(int insertionFrame, int numberOfFrames)
{ {
if (Engaged()) if (Engaged())
@ -276,7 +273,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes("deleteframes", "deletes the given number of blank frames beginning at the given frame")] [LuaMethod("deleteframes", "deletes the given number of blank frames beginning at the given frame")]
public void DeleteFrames(int beginningFrame, int numberOfFrames) public void DeleteFrames(int beginningFrame, int numberOfFrames)
{ {
if (Engaged()) if (Engaged())

View File

@ -47,10 +47,10 @@ namespace BizHawk.Client.EmuHawk
foreach (var lib in libs) foreach (var lib in libs)
{ {
bool addLibrary = true; bool addLibrary = true;
var attributes = lib.GetCustomAttributes(typeof(LuaLibraryAttributes), false); var attributes = lib.GetCustomAttributes(typeof(LuaLibraryAttribute), false);
if (attributes.Any()) if (attributes.Any())
{ {
addLibrary = VersionInfo.DeveloperBuild || (attributes.First() as LuaLibraryAttributes).Released; addLibrary = VersionInfo.DeveloperBuild || (attributes.First() as LuaLibraryAttribute).Released;
} }
if (addLibrary) if (addLibrary)
@ -73,7 +73,7 @@ namespace BizHawk.Client.EmuHawk
var methods = luaCanvas var methods = luaCanvas
.GetMethods() .GetMethods()
.Where(m => m.GetCustomAttributes(typeof(LuaMethodAttributes), false).Any()); .Where(m => m.GetCustomAttributes(typeof(LuaMethodAttribute), false).Any());
foreach (var method in methods) foreach (var method in methods)
{ {

View File

@ -59,37 +59,37 @@ namespace BizHawk.Client.EmuHawk
_graphics = Graphics.FromImage(pictureBox.Image); _graphics = Graphics.FromImage(pictureBox.Image);
} }
[LuaMethodAttributes("SetTitle", "Sets the canvas window title")] [LuaMethod("SetTitle", "Sets the canvas window title")]
public void SetTitle(string title) public void SetTitle(string title)
{ {
Text = title; Text = title;
} }
[LuaMethodAttributes("Clear", "Clears the canvas")] [LuaMethod("Clear", "Clears the canvas")]
public void Clear(Color color) public void Clear(Color color)
{ {
_graphics.Clear(color); _graphics.Clear(color);
} }
[LuaMethodAttributes("Refresh", "Redraws the canvas")] [LuaMethod("Refresh", "Redraws the canvas")]
public new void Refresh() public new void Refresh()
{ {
pictureBox.Refresh(); pictureBox.Refresh();
} }
[LuaMethodAttributes("defaultForeground", "Sets the default foreground color to use in drawing methods, white by default")] [LuaMethod("defaultForeground", "Sets the default foreground color to use in drawing methods, white by default")]
public void SetDefaultForegroundColor(Color color) public void SetDefaultForegroundColor(Color color)
{ {
_defaultForeground = color; _defaultForeground = color;
} }
[LuaMethodAttributes("defaultBackground", "Sets the default background color to use in drawing methods, transparent by default")] [LuaMethod("defaultBackground", "Sets the default background color to use in drawing methods, transparent by default")]
public void SetDefaultBackgroundColor(Color color) public void SetDefaultBackgroundColor(Color color)
{ {
_defaultBackground = color; _defaultBackground = color;
} }
[LuaMethodAttributes("drawBezier", "Draws a Bezier curve using the table of coordinates provided in the given color")] [LuaMethod("drawBezier", "Draws a Bezier curve using the table of coordinates provided in the given color")]
public void DrawBezier(LuaTable points, Color color) public void DrawBezier(LuaTable points, Color color)
{ {
try try
@ -116,8 +116,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes( [LuaMethod("drawBox", "Draws a rectangle on screen from x1/y1 to x2/y2. Same as drawRectangle except it receives two points intead of a point and width/height")]
"drawBox", "Draws a rectangle on screen from x1/y1 to x2/y2. Same as drawRectangle except it receives two points intead of a point and width/height")]
public void DrawBox(int x, int y, int x2, int y2, Color? line = null, Color? background = null) public void DrawBox(int x, int y, int x2, int y2, Color? line = null, Color? background = null)
{ {
try try
@ -157,8 +156,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes( [LuaMethod("drawEllipse", "Draws an ellipse at the given coordinates and the given width and height. Line is the color of the ellipse. Background is the optional fill color")]
"drawEllipse", "Draws an ellipse at the given coordinates and the given width and height. Line is the color of the ellipse. Background is the optional fill color")]
public void DrawEllipse(int x, int y, int width, int height, Color? line = null, Color? background = null) public void DrawEllipse(int x, int y, int width, int height, Color? line = null, Color? background = null)
{ {
try try
@ -179,8 +177,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes( [LuaMethod("drawIcon", "draws an Icon (.ico) file from the given path at the given coordinate. width and height are optional. If specified, it will resize the image accordingly")]
"drawIcon", "draws an Icon (.ico) file from the given path at the given coordinate. width and height are optional. If specified, it will resize the image accordingly")]
public void DrawIcon(string path, int x, int y, int? width = null, int? height = null) public void DrawIcon(string path, int x, int y, int? width = null, int? height = null)
{ {
try try
@ -204,8 +201,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes( [LuaMethod("drawImage", "draws an image file from the given path at the given coordinate. width and height are optional. If specified, it will resize the image accordingly")]
"drawImage", "draws an image file from the given path at the given coordinate. width and height are optional. If specified, it will resize the image accordingly")]
public void DrawImage(string path, int x, int y, int? width = null, int? height = null, bool cache = true) public void DrawImage(string path, int x, int y, int? width = null, int? height = null, bool cache = true)
{ {
if (!File.Exists(path)) if (!File.Exists(path))
@ -231,8 +227,7 @@ namespace BizHawk.Client.EmuHawk
_graphics.DrawImage(img, x, y, width ?? img.Width, height ?? img.Height); _graphics.DrawImage(img, x, y, width ?? img.Width, height ?? img.Height);
} }
[LuaMethodAttributes( [LuaMethod("clearImageCache", "clears the image cache that is built up by using gui.drawImage, also releases the file handle for cached images")]
"clearImageCache", "clears the image cache that is built up by using gui.drawImage, also releases the file handle for cached images")]
public void ClearImageCache() public void ClearImageCache()
{ {
foreach (var image in _imageCache) foreach (var image in _imageCache)
@ -243,8 +238,7 @@ namespace BizHawk.Client.EmuHawk
_imageCache.Clear(); _imageCache.Clear();
} }
[LuaMethodAttributes( [LuaMethod("drawImageRegion", "draws a given region of an image file from the given path at the given coordinate, and optionally with the given size")]
"drawImageRegion", "draws a given region of an image file from the given path at the given coordinate, and optionally with the given size")]
public void DrawImageRegion(string path, int source_x, int source_y, int source_width, int source_height, int dest_x, int dest_y, int? dest_width = null, int? dest_height = null) public void DrawImageRegion(string path, int source_x, int source_y, int source_width, int source_height, int dest_x, int dest_y, int? dest_width = null, int? dest_height = null)
{ {
if (!File.Exists(path)) if (!File.Exists(path))
@ -269,31 +263,27 @@ namespace BizHawk.Client.EmuHawk
_graphics.DrawImage(img, destRect, source_x, source_y, source_width, source_height, GraphicsUnit.Pixel); _graphics.DrawImage(img, destRect, source_x, source_y, source_width, source_height, GraphicsUnit.Pixel);
} }
[LuaMethodAttributes( [LuaMethod("drawLine", "Draws a line from the first coordinate pair to the 2nd. Color is optional (if not specified it will be drawn black)")]
"drawLine", "Draws a line from the first coordinate pair to the 2nd. Color is optional (if not specified it will be drawn black)")]
public void DrawLine(int x1, int y1, int x2, int y2, Color? color = null) public void DrawLine(int x1, int y1, int x2, int y2, Color? color = null)
{ {
_graphics.DrawLine(GetPen(color ?? _defaultForeground), x1, y1, x2, y2); _graphics.DrawLine(GetPen(color ?? _defaultForeground), x1, y1, x2, y2);
} }
[LuaMethodAttributes("drawAxis", "Draws an axis of the specified size at the coordinate pair.)")] [LuaMethod("drawAxis", "Draws an axis of the specified size at the coordinate pair.)")]
public void DrawAxis(int x, int y, int size, Color? color = null) public void DrawAxis(int x, int y, int size, Color? color = null)
{ {
DrawLine(x + size, y, x - size, y, color); DrawLine(x + size, y, x - size, y, color);
DrawLine(x, y + size, x, y - size, color); DrawLine(x, y + size, x, y - size, color);
} }
[LuaMethodAttributes( [LuaMethod("drawArc", "draws a Arc shape at the given coordinates and the given width and height")]
"drawArc",
"draws a Arc shape at the given coordinates and the given width and height"
)]
public void DrawArc(int x, int y, int width, int height, int startangle, int sweepangle, Color? line = null) public void DrawArc(int x, int y, int width, int height, int startangle, int sweepangle, Color? line = null)
{ {
var pen = new Pen(line.HasValue ? line.Value : Color.Black); var pen = new Pen(line.HasValue ? line.Value : Color.Black);
_graphics.DrawArc(pen, x, y, width, height, startangle, sweepangle); _graphics.DrawArc(pen, x, y, width, height, startangle, sweepangle);
} }
[LuaMethodAttributes("drawPie", "draws a Pie shape at the given coordinates and the given width and height")] [LuaMethod("drawPie", "draws a Pie shape at the given coordinates and the given width and height")]
public void DrawPie( public void DrawPie(
int x, int x,
int y, int y,
@ -314,8 +304,7 @@ namespace BizHawk.Client.EmuHawk
_graphics.DrawPie(GetPen(line ?? _defaultForeground), x + 1, y + 1, width - 1, height - 1, startangle, sweepangle); _graphics.DrawPie(GetPen(line ?? _defaultForeground), x + 1, y + 1, width - 1, height - 1, startangle, sweepangle);
} }
[LuaMethodAttributes( [LuaMethod("drawPixel", "Draws a single pixel at the given coordinates in the given color. Color is optional (if not specified it will be drawn black)")]
"drawPixel", "Draws a single pixel at the given coordinates in the given color. Color is optional (if not specified it will be drawn black)")]
public void DrawPixel(int x, int y, Color? color = null) public void DrawPixel(int x, int y, Color? color = null)
{ {
try try
@ -329,8 +318,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodAttributes( [LuaMethod("drawPolygon", "Draws a polygon using the table of coordinates specified in points. This should be a table of tables(each of size 2). Line is the color of the polygon. Background is the optional fill color")]
"drawPolygon", "Draws a polygon using the table of coordinates specified in points. This should be a table of tables(each of size 2). Line is the color of the polygon. Background is the optional fill color")]
public void DrawPolygon(LuaTable points, Color? line = null, Color? background = null) public void DrawPolygon(LuaTable points, Color? line = null, Color? background = null)
{ {
try try
@ -358,9 +346,7 @@ namespace BizHawk.Client.EmuHawk
} }
[LuaMethodAttributes( [LuaMethod("DrawRectangle", "Draws a rectangle at the given coordinate and the given width and height. Line is the color of the box. Background is the optional fill color")]
"DrawRectangle",
"Draws a rectangle at the given coordinate and the given width and height. Line is the color of the box. Background is the optional fill color")]
public void DrawRectangle(int x, int y, int width, int height, Color? outline = null, Color? fill = null) public void DrawRectangle(int x, int y, int width, int height, Color? outline = null, Color? fill = null)
{ {
if (fill.HasValue) if (fill.HasValue)
@ -373,9 +359,7 @@ namespace BizHawk.Client.EmuHawk
_graphics.DrawRectangle(pen, x, y, width, height); _graphics.DrawRectangle(pen, x, y, width, height);
} }
[LuaMethodAttributes( [LuaMethod("DrawText", "Draws the given message at the given x,y coordinates and the given color. The default color is white. A fontfamily can be specified and is monospace generic if none is specified (font family options are the same as the .NET FontFamily class). The fontsize default is 12. The default font style is regular. Font style options are regular, bold, italic, strikethrough, underline. Horizontal alignment options are left (default), center, or right. Vertical alignment options are bottom (default), middle, or top. Alignment options specify which ends of the text will be drawn at the x and y coordinates.")]
"DrawText",
"Draws the given message at the given x,y coordinates and the given color. The default color is white. A fontfamily can be specified and is monospace generic if none is specified (font family options are the same as the .NET FontFamily class). The fontsize default is 12. The default font style is regular. Font style options are regular, bold, italic, strikethrough, underline. Horizontal alignment options are left (default), center, or right. Vertical alignment options are bottom (default), middle, or top. Alignment options specify which ends of the text will be drawn at the x and y coordinates.")]
public void DrawText(int x, int y, string message, Color? color = null, int? fontsize = null, string fontfamily = null, string fontstyle = null) public void DrawText(int x, int y, string message, Color? color = null, int? fontsize = null, string fontfamily = null, string fontstyle = null)
{ {
var family = FontFamily.GenericMonospace; var family = FontFamily.GenericMonospace;