Merge remote-tracking branch 'remotes/origin/pr/1131''

This commit is contained in:
zeromus 2018-03-13 20:37:48 -04:00
commit 2203270868
24 changed files with 504 additions and 26 deletions

View File

@ -16,84 +16,98 @@ namespace BizHawk.Client.Common
public override string Name => "bit"; public override string Name => "bit";
[LuaMethodExample("band", "local uibitban = bit.band( 1000, 4 );")]
[LuaMethod("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;
} }
[LuaMethodExample("bnot", "local uibitbno = bit.bnot( 1000 );")]
[LuaMethod("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;
} }
[LuaMethodExample("bor", "local uibitbor = bit.bor( 1000, 4 );")]
[LuaMethod("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;
} }
[LuaMethodExample("bxor", "local uibitbxo = bit.bxor( 1000, 4 );")]
[LuaMethod("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;
} }
[LuaMethodExample("lshift", "local uibitlsh = bit.lshift( 1000, -4 );")]
[LuaMethod("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;
} }
[LuaMethodExample("rol", "local uibitrol = bit.rol( 1000, -4 );")]
[LuaMethod("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));
} }
[LuaMethodExample("ror", "local uibitror = bit.ror( 1000, -4 );")]
[LuaMethod("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));
} }
[LuaMethodExample("rshift", "local uibitrsh = bit.rshift( 1000, -4 );")]
[LuaMethod("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);
} }
[LuaMethodExample("arshift", "local inbitars = bit.arshift( -1000, -4 );")]
[LuaMethod("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;
} }
[LuaMethodExample("check", "if ( bit.check( -12345, 35 ) ) then\r\n\tconsole.log( \"Returns result of bit 'pos' being set in 'num'\" );\r\nend;")]
[LuaMethod("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;
} }
[LuaMethodExample("set", "local uibitset = bit.set( 25, 35 );")]
[LuaMethod("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);
} }
[LuaMethodExample("clear", "local lobitcle = bit.clear( 25, 35 );")]
[LuaMethod("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);
} }
[LuaMethodExample("byteswap_16", "local usbitbyt = bit.byteswap_16( 100 );")]
[LuaMethod("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);
} }
[LuaMethodExample("byteswap_32", "local uibitbyt = bit.byteswap_32( 1000 );")]
[LuaMethod("byteswap_32", "Byte swaps 'dword'")] [LuaMethod("byteswap_32", "Byte swaps 'dword'")]
public static uint Byteswap32(uint val) public static uint Byteswap32(uint val)
{ {
@ -101,6 +115,7 @@ namespace BizHawk.Client.Common
(val & 0x00FF0000U) >> 8 | (val & 0xFF000000U) >> 24; (val & 0x00FF0000U) >> 8 | (val & 0xFF000000U) >> 24;
} }
[LuaMethodExample("byteswap_64", "local ulbitbyt = bit.byteswap_64( 10000 );")]
[LuaMethod("byteswap_64", "Byte swaps 'long'")] [LuaMethod("byteswap_64", "Byte swaps 'long'")]
public static ulong Byteswap64(ulong val) public static ulong Byteswap64(ulong val)
{ {

View File

@ -48,24 +48,28 @@ namespace BizHawk.Client.Common
public override string Name => "emu"; public override string Name => "emu";
[LuaMethodExample("displayvsync", "emu.displayvsync( true );")]
[LuaMethod("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;
} }
[LuaMethodExample("frameadvance", "emu.frameadvance( );")]
[LuaMethod("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();
} }
[LuaMethodExample("framecount", "local inemufra = emu.framecount( );")]
[LuaMethod("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;
} }
[LuaMethodExample("disassemble", "local obemudis = emu.disassemble( 0x8000 );")]
[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")] [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 = "")
{ {
@ -95,6 +99,7 @@ namespace BizHawk.Client.Common
} }
// TODO: what about 64 bit registers? // TODO: what about 64 bit registers?
[LuaMethodExample("getregister", "local inemuget = emu.getregister( emu.getregisters( )[ 0 ] );")]
[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")] [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")]
public int GetRegister(string name) public int GetRegister(string name)
{ {
@ -117,6 +122,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodExample("getregisters", "local nlemuget = emu.getregisters( );")]
[LuaMethod("getregisters", "returns the complete set of available flags and registers for a given core")] [LuaMethod("getregisters", "returns the complete set of available flags and registers for a given core")]
public LuaTable GetRegisters() public LuaTable GetRegisters()
{ {
@ -142,6 +148,7 @@ namespace BizHawk.Client.Common
return table; return table;
} }
[LuaMethodExample("setregister", "emu.setregister( emu.getregisters( )[ 0 ], -1000 );")]
[LuaMethod("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)
{ {
@ -160,6 +167,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodExample("totalexecutedcycles", "local inemutot = emu.totalexecutedcycles( );")]
[LuaMethod("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()
{ {
@ -180,12 +188,14 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodExample("getsystemid", "local stemuget = emu.getsystemid( );")]
[LuaMethod("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;
} }
[LuaMethodExample("islagged", "if ( emu.islagged( ) ) then\r\n\tconsole.log( \"Returns whether or not the current frame is a lag frame\" );\r\nend;")]
[LuaMethod("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()
{ {
@ -198,6 +208,7 @@ namespace BizHawk.Client.Common
return false; return false;
} }
[LuaMethodExample("setislagged", "emu.setislagged( true );")]
[LuaMethod("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)
{ {
@ -211,6 +222,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodExample("lagcount", "local inemulag = emu.lagcount( );")]
[LuaMethod("lagcount", "Returns the current lag count")] [LuaMethod("lagcount", "Returns the current lag count")]
public int LagCount() public int LagCount()
{ {
@ -223,6 +235,7 @@ namespace BizHawk.Client.Common
return 0; return 0;
} }
[LuaMethodExample("setlagcount", "emu.setlagcount( 50 );")]
[LuaMethod("setlagcount", "Sets the current lag count")] [LuaMethod("setlagcount", "Sets the current lag count")]
public void SetLagCount(int count) public void SetLagCount(int count)
{ {
@ -236,18 +249,21 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodExample("limitframerate", "emu.limitframerate( true );")]
[LuaMethod("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;
} }
[LuaMethodExample("minimizeframeskip", "emu.minimizeframeskip( true );")]
[LuaMethod("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;
} }
[LuaMethodExample("setrenderplanes", "emu.setrenderplanes( true, false );")]
[LuaMethod("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)
{ {
@ -322,12 +338,14 @@ namespace BizHawk.Client.Common
return true; return true;
} }
[LuaMethodExample("yield", "emu.yield( );")]
[LuaMethod("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();
} }
[LuaMethodExample("getdisplaytype", "local stemuget = emu.getdisplaytype();")]
[LuaMethod("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()
{ {
@ -339,6 +357,7 @@ namespace BizHawk.Client.Common
return ""; return "";
} }
[LuaMethodExample("getboardname", "local stemuget = emu.getboardname();")]
[LuaMethod("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()
{ {

View File

@ -159,6 +159,8 @@ namespace BizHawk.Client.Common
#endregion #endregion
[LuaMethodExample("onframeend", "local steveonf = event.onframeend(\r\n\tfunction()\r\n\t\tconsole.log( \"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\" );\r\n\tend\r\n\t, \"Frame name\" );")]
[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")] [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")]
public string OnFrameEnd(LuaFunction luaf, string name = null) public string OnFrameEnd(LuaFunction luaf, string name = null)
{ {
@ -167,6 +169,7 @@ namespace BizHawk.Client.Common
return nlf.Guid.ToString(); return nlf.Guid.ToString();
} }
[LuaMethodExample("onframestart", "local steveonf = event.onframestart(\r\n\tfunction()\r\n\t\tconsole.log( \"Calls the given lua function at the beginning of each frame before any emulation and drawing occurs\" );\r\n\tend\r\n\t, \"Frame name\" );")]
[LuaMethod("onframestart", "Calls the given lua function at the beginning of each frame before any emulation and drawing occurs")] [LuaMethod("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)
{ {
@ -175,6 +178,7 @@ namespace BizHawk.Client.Common
return nlf.Guid.ToString(); return nlf.Guid.ToString();
} }
[LuaMethodExample("oninputpoll", "local steveoni = event.oninputpoll(\r\n\tfunction()\r\n\t\tconsole.log( \"Calls the given lua function after each time the emulator core polls for input\" );\r\n\tend\r\n\t, \"Frame name\" );")]
[LuaMethod("oninputpoll", "Calls the given lua function after each time the emulator core polls for input")] [LuaMethod("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)
{ {
@ -204,6 +208,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");
} }
[LuaMethodExample("onloadstate", "local steveonl = event.onloadstate(\r\n\tfunction()\r\n\tconsole.log( \"Fires after a state is loaded. Receives a lua function name, and registers it to the event immediately following a successful savestate event\" );\r\nend\", \"Frame name\" );")]
[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")] [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")]
public string OnLoadState(LuaFunction luaf, string name = null) public string OnLoadState(LuaFunction luaf, string name = null)
{ {
@ -212,6 +217,7 @@ namespace BizHawk.Client.Common
return nlf.Guid.ToString(); return nlf.Guid.ToString();
} }
[LuaMethodExample("onmemoryexecute", "local steveonm = event.onmemoryexecute(\r\n\tfunction()\r\n\t\tconsole.log( \"Fires after the given address is executed by the core\" );\r\n\tend\r\n\t, 0x200, \"Frame name\", \"System Bus\" );")]
[LuaMethod("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, string domain = null) public string OnMemoryExecute(LuaFunction luaf, uint address, string name = null, string domain = null)
{ {
@ -251,6 +257,7 @@ namespace BizHawk.Client.Common
return Guid.Empty.ToString(); return Guid.Empty.ToString();
} }
[LuaMethodExample("onmemoryread", "local steveonm = event.onmemoryread(\r\n\tfunction()\r\n\t\tconsole.log( \"Fires after the given address is read by the core. If no address is given, it will attach to every memory read\" );\r\n\tend\r\n\t, 0x200, \"Frame name\" );")]
[LuaMethod("onmemoryread", "Fires after the given address is read by the core. If no address is given, it will attach to every memory read")] [LuaMethod("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, string domain = null) public string OnMemoryRead(LuaFunction luaf, uint? address = null, string name = null, string domain = null)
{ {
@ -289,6 +296,7 @@ namespace BizHawk.Client.Common
return Guid.Empty.ToString(); return Guid.Empty.ToString();
} }
[LuaMethodExample("onmemorywrite", "local steveonm = event.onmemorywrite(\r\n\tfunction()\r\n\t\tconsole.log( \"Fires after the given address is written by the core. If no address is given, it will attach to every memory write\" );\r\n\tend\r\n\t, 0x200, \"Frame name\" );")]
[LuaMethod("onmemorywrite", "Fires after the given address is written by the core. If no address is given, it will attach to every memory write")] [LuaMethod("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, string domain = null) public string OnMemoryWrite(LuaFunction luaf, uint? address = null, string name = null, string domain = null)
{ {
@ -327,6 +335,7 @@ namespace BizHawk.Client.Common
return Guid.Empty.ToString(); return Guid.Empty.ToString();
} }
[LuaMethodExample("onsavestate", "local steveons = event.onsavestate(\r\n\tfunction()\r\n\t\tconsole.log( \"Fires after a state is saved\" );\r\n\tend\r\n\t, \"Frame name\" );")]
[LuaMethod("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)
{ {
@ -335,6 +344,7 @@ namespace BizHawk.Client.Common
return nlf.Guid.ToString(); return nlf.Guid.ToString();
} }
[LuaMethodExample("onexit", "local steveone = event.onexit(\r\n\tfunction()\r\n\t\tconsole.log( \"Fires after the calling script has stopped\" );\r\n\tend\r\n\t, \"Frame name\" );")]
[LuaMethod("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)
{ {
@ -343,6 +353,7 @@ namespace BizHawk.Client.Common
return nlf.Guid.ToString(); return nlf.Guid.ToString();
} }
[LuaMethodExample("unregisterbyid", "if ( event.unregisterbyid( \"4d1810b7 - 0d28 - 4acb - 9d8b - d87721641551\" ) ) then\r\n\tconsole.log( \"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.\" );\r\nend;")]
[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.")] [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.")]
public bool UnregisterById(string guid) public bool UnregisterById(string guid)
{ {
@ -355,6 +366,7 @@ namespace BizHawk.Client.Common
return false; return false;
} }
[LuaMethodExample("unregisterbyname", "if ( event.unregisterbyname( \"Function name\" ) ) then\r\n\tconsole.log( \"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.\" );\r\nend;")]
[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.")] [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.")]
public bool UnregisterByName(string name) public bool UnregisterByName(string name)
{ {

View File

@ -18,6 +18,7 @@ namespace BizHawk.Client.Common
public override string Name => "gameinfo"; public override string Name => "gameinfo";
[LuaMethodExample("getromname", "local stgamget = gameinfo.getromname( );")]
[LuaMethod("getromname", "returns the path of the currently loaded rom, if a rom is loaded")] [LuaMethod("getromname", "returns the path of the currently loaded rom, if a rom is loaded")]
public string GetRomName() public string GetRomName()
{ {
@ -29,6 +30,7 @@ namespace BizHawk.Client.Common
return ""; return "";
} }
[LuaMethodExample("getromhash", "local stgamget = gameinfo.getromhash( );")]
[LuaMethod("getromhash", "returns the hash of the currently loaded rom, if a rom is loaded")] [LuaMethod("getromhash", "returns the hash of the currently loaded rom, if a rom is loaded")]
public string GetRomHash() public string GetRomHash()
{ {
@ -40,6 +42,7 @@ namespace BizHawk.Client.Common
return ""; return "";
} }
[LuaMethodExample("indatabase", "if ( gameinfo.indatabase( ) ) then\r\n\tconsole.log( \"returns whether or not the currently loaded rom is in the game database\" );\r\nend;")]
[LuaMethod("indatabase", "returns whether or not the currently loaded rom is in the game database")] [LuaMethod("indatabase", "returns whether or not the currently loaded rom is in the game database")]
public bool InDatabase() public bool InDatabase()
{ {
@ -51,6 +54,7 @@ namespace BizHawk.Client.Common
return false; return false;
} }
[LuaMethodExample("getstatus", "local stgamget = gameinfo.getstatus( );")]
[LuaMethod("getstatus", "returns the game database status of the currently loaded rom. Statuses are for example: GoodDump, BadDump, Hack, Unknown, NotInDatabase")] [LuaMethod("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()
{ {
@ -62,6 +66,7 @@ namespace BizHawk.Client.Common
return ""; return "";
} }
[LuaMethodExample("isstatusbad", "if ( gameinfo.isstatusbad( ) ) then\r\n\tconsole.log( \"returns the currently loaded rom's game database status is considered 'bad'\" );\r\nend;")]
[LuaMethod("isstatusbad", "returns the currently loaded rom's game database status is considered 'bad'")] [LuaMethod("isstatusbad", "returns the currently loaded rom's game database status is considered 'bad'")]
public bool IsStatusBad() public bool IsStatusBad()
{ {
@ -73,12 +78,14 @@ namespace BizHawk.Client.Common
return true; return true;
} }
[LuaMethodExample("getboardtype", "local stgamget = gameinfo.getboardtype( );")]
[LuaMethod("getboardtype", "returns identifying information about the 'mapper' or similar capability used for this game. empty if no such useful distinction can be drawn")] [LuaMethod("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 ?? "";
} }
[LuaMethodExample("getoptions", "local nlgamget = gameinfo.getoptions( );")]
[LuaMethod("getoptions", "returns the game options for the currently loaded rom. Options vary per platform")] [LuaMethod("getoptions", "returns the game options for the currently loaded rom. Options vary per platform")]
public LuaTable GetOptions() public LuaTable GetOptions()
{ {

View File

@ -37,24 +37,28 @@ namespace BizHawk.Client.Common
Genesis?.PutSettings(settings); Genesis?.PutSettings(settings);
} }
[LuaMethodExample("getlayer_bga", "if ( genesis.getlayer_bga( ) ) then\r\n\tconsole.log( \"Returns whether the bg layer A is displayed\" );\r\nend;")]
[LuaMethod("getlayer_bga", "Returns whether the bg layer A is displayed")] [LuaMethod("getlayer_bga", "Returns whether the bg layer A is displayed")]
public bool GetLayerBgA() public bool GetLayerBgA()
{ {
return GetSettings().DrawBGA; return GetSettings().DrawBGA;
} }
[LuaMethodExample("getlayer_bgb", "if ( genesis.getlayer_bgb( ) ) then\r\n\tconsole.log( \"Returns whether the bg layer B is displayed\" );\r\nend;")]
[LuaMethod("getlayer_bgb", "Returns whether the bg layer B is displayed")] [LuaMethod("getlayer_bgb", "Returns whether the bg layer B is displayed")]
public bool GetLayerBgB() public bool GetLayerBgB()
{ {
return GetSettings().DrawBGB; return GetSettings().DrawBGB;
} }
[LuaMethodExample("getlayer_bgw", "if ( genesis.getlayer_bgw( ) ) then\r\n\tconsole.log( \"Returns whether the bg layer W is displayed\" );\r\nend;")]
[LuaMethod("getlayer_bgw", "Returns whether the bg layer W is displayed")] [LuaMethod("getlayer_bgw", "Returns whether the bg layer W is displayed")]
public bool GetLayerBgW() public bool GetLayerBgW()
{ {
return GetSettings().DrawBGW; return GetSettings().DrawBGW;
} }
[LuaMethodExample("setlayer_bga", "genesis.setlayer_bga( true );")]
[LuaMethod("setlayer_bga", "Sets whether the bg layer A is displayed")] [LuaMethod("setlayer_bga", "Sets whether the bg layer A is displayed")]
public void SetLayerBgA(bool value) public void SetLayerBgA(bool value)
{ {
@ -63,6 +67,7 @@ namespace BizHawk.Client.Common
PutSettings(s); PutSettings(s);
} }
[LuaMethodExample("setlayer_bgb", "genesis.setlayer_bgb( true );")]
[LuaMethod("setlayer_bgb", "Sets whether the bg layer B is displayed")] [LuaMethod("setlayer_bgb", "Sets whether the bg layer B is displayed")]
public void SetLayerBgB(bool value) public void SetLayerBgB(bool value)
{ {
@ -71,6 +76,7 @@ namespace BizHawk.Client.Common
PutSettings(s); PutSettings(s);
} }
[LuaMethodExample("setlayer_bgw", "genesis.setlayer_bgw( true );")]
[LuaMethod("setlayer_bgw", "Sets whether the bg layer W is displayed")] [LuaMethod("setlayer_bgw", "Sets whether the bg layer W is displayed")]
public void SetLayerBgW(bool value) public void SetLayerBgW(bool value)
{ {

View File

@ -13,6 +13,7 @@ namespace BizHawk.Client.Common
public override string Name => "joypad"; public override string Name => "joypad";
[LuaMethodExample("get", "local nljoyget = joypad.get( 1 );")]
[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")] [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")]
public LuaTable Get(int? controller = null) public LuaTable Get(int? controller = null)
{ {
@ -50,6 +51,7 @@ namespace BizHawk.Client.Common
} }
// TODO: what about float controls? // TODO: what about float controls?
[LuaMethodExample("getimmediate", "local nljoyget = joypad.getimmediate( );")]
[LuaMethod("getimmediate", "returns a lua table of any controller buttons currently pressed by the user")] [LuaMethod("getimmediate", "returns a lua table of any controller buttons currently pressed by the user")]
public LuaTable GetImmediate() public LuaTable GetImmediate()
{ {
@ -62,6 +64,7 @@ namespace BizHawk.Client.Common
return buttons; return buttons;
} }
[LuaMethodExample("setfrommnemonicstr", "joypad.setfrommnemonicstr( \"| 0, 0, 0, 100,...R..B....|\" );")]
[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")] [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")]
public void SetFromMnemonicStr(string inputLogEntry) public void SetFromMnemonicStr(string inputLogEntry)
{ {
@ -86,6 +89,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodExample("set", "joypad.set( { [\"Left\"] = true, [ \"A\" ] = true, [ \"B\" ] = true } );")]
[LuaMethod("set", "sets the given buttons to their provided values for the current frame")] [LuaMethod("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)
{ {
@ -150,6 +154,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodExample("setanalog", "joypad.setanalog( { [ \"Tilt X\" ] = true, [ \"Tilt Y\" ] = false } );")]
[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.")] [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.")]
public void SetAnalog(LuaTable controls, object controller = null) public void SetAnalog(LuaTable controls, object controller = null)
{ {

View File

@ -37,12 +37,14 @@ namespace BizHawk.Client.Common
#region Unique Library Methods #region Unique Library Methods
[LuaMethodExample("getname", "local stmaiget = mainmemory.getname( );")]
[LuaMethod("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;
} }
[LuaMethodExample("getcurrentmemorydomainsize", "local uimaiget = mainmemory.getcurrentmemorydomainsize( );")]
[LuaMethod("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()
{ {
@ -53,36 +55,42 @@ namespace BizHawk.Client.Common
#region Common Special and Legacy Methods #region Common Special and Legacy Methods
[LuaMethodExample("readbyte", "local uimairea = mainmemory.readbyte( 0x100 );")]
[LuaMethod("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);
} }
[LuaMethodExample("writebyte", "mainmemory.writebyte( 0x100, 1000 );")]
[LuaMethod("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);
} }
[LuaMethodExample("readbyterange", "local nlmairea = mainmemory.readbyterange( 0x100, 64 );")]
[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).")] [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 LuaTable ReadByteRange(int addr, int length) public LuaTable ReadByteRange(int addr, int length)
{ {
return base.ReadByteRange(addr, length); return base.ReadByteRange(addr, length);
} }
[LuaMethodExample("writebyterange", "")]
[LuaMethod("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);
} }
[LuaMethodExample("readfloat", "local simairea = mainmemory.readfloat(0x100, false);")]
[LuaMethod("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 float ReadFloat(int addr, bool bigendian) public float ReadFloat(int addr, bool bigendian)
{ {
return base.ReadFloat(addr, bigendian); return base.ReadFloat(addr, bigendian);
} }
[LuaMethodExample("writefloat", "mainmemory.writefloat( 0x100, 10.0, false );")]
[LuaMethod("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 void WriteFloat(int addr, double value, bool bigendian) public void WriteFloat(int addr, double value, bool bigendian)
{ {
@ -93,24 +101,28 @@ namespace BizHawk.Client.Common
#region 1 Byte #region 1 Byte
[LuaMethodExample("read_s8", "local inmairea = mainmemory.read_s8( 0x100 );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_s8", "mainmemory.write_s8( 0x100, 1000 );")]
[LuaMethod("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);
} }
[LuaMethodExample("read_u8", "local uimairea = mainmemory.read_u8( 0x100 );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_u8", "mainmemory.write_u8( 0x100, 1000 );")]
[LuaMethod("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)
{ {
@ -121,48 +133,56 @@ namespace BizHawk.Client.Common
#region 2 Byte #region 2 Byte
[LuaMethodExample("read_s16_le", "local inmairea = mainmemory.read_s16_le( 0x100 );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_s16_le", "mainmemory.write_s16_le( 0x100, -1000 );")]
[LuaMethod("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);
} }
[LuaMethodExample("read_s16_be", "local inmairea = mainmemory.read_s16_be( 0x100 );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_s16_be", "mainmemory.write_s16_be( 0x100, -1000 );")]
[LuaMethod("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);
} }
[LuaMethodExample("read_u16_le", "local uimairea = mainmemory.read_u16_le( 0x100 );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_u16_le", "mainmemory.write_u16_le( 0x100, 1000 );")]
[LuaMethod("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);
} }
[LuaMethodExample("read_u16_be", "local uimairea = mainmemory.read_u16_be( 0x100 );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_u16_be", "mainmemory.write_u16_be( 0x100, 1000 );")]
[LuaMethod("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)
{ {
@ -173,48 +193,56 @@ namespace BizHawk.Client.Common
#region 3 Byte #region 3 Byte
[LuaMethodExample("read_s24_le", "local inmairea = mainmemory.read_s24_le( 0x100 );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_s24_le", "mainmemory.write_s24_le( 0x100, -1000 );")]
[LuaMethod("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);
} }
[LuaMethodExample("read_s24_be", "local inmairea = mainmemory.read_s24_be( 0x100 );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_s24_be", "mainmemory.write_s24_be( 0x100, -1000 );")]
[LuaMethod("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);
} }
[LuaMethodExample("read_u24_le", "local uimairea = mainmemory.read_u24_le( 0x100 );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_u24_le", "mainmemory.write_u24_le( 0x100, 1000 );")]
[LuaMethod("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);
} }
[LuaMethodExample("read_u24_be", "local uimairea = mainmemory.read_u24_be( 0x100 );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_u24_be", "mainmemory.write_u24_be( 0x100, 1000 );")]
[LuaMethod("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)
{ {
@ -225,48 +253,56 @@ namespace BizHawk.Client.Common
#region 4 Byte #region 4 Byte
[LuaMethodExample("read_s32_le", "local inmairea = mainmemory.read_s32_le( 0x100 );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_s32_le", "mainmemory.write_s32_le( 0x100, -1000 );")]
[LuaMethod("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);
} }
[LuaMethodExample("read_s32_be", "local inmairea = mainmemory.read_s32_be( 0x100 );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_s32_be", "mainmemory.write_s32_be( 0x100, -1000 );")]
[LuaMethod("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);
} }
[LuaMethodExample("read_u32_le", "local uimairea = mainmemory.read_u32_le( 0x100 );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_u32_le", "mainmemory.write_u32_le( 0x100, 1000 );")]
[LuaMethod("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);
} }
[LuaMethodExample("read_u32_be", "local uimairea = mainmemory.read_u32_be( 0x100 );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_u32_be", "mainmemory.write_u32_be( 0x100, 1000 );")]
[LuaMethod("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)
{ {

View File

@ -49,6 +49,7 @@ namespace BizHawk.Client.Common
#region Unique Library Methods #region Unique Library Methods
[LuaMethodExample("getmemorydomainlist", "local nlmemget = memory.getmemorydomainlist();")]
[LuaMethod("getmemorydomainlist", "Returns a string of the memory domains for the loaded platform core. List will be a single string delimited by line feeds")] [LuaMethod("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()
{ {
@ -64,6 +65,7 @@ namespace BizHawk.Client.Common
return table; return table;
} }
[LuaMethodExample("getmemorydomainsize", "local uimemget = memory.getmemorydomainsize( mainmemory.getname( ) );")]
[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")] [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")]
public uint GetMemoryDomainSize(string name = "") public uint GetMemoryDomainSize(string name = "")
{ {
@ -75,18 +77,21 @@ namespace BizHawk.Client.Common
return (uint)DomainList[VerifyMemoryDomain(name)].Size; return (uint)DomainList[VerifyMemoryDomain(name)].Size;
} }
[LuaMethodExample("getcurrentmemorydomain", "local stmemget = memory.getcurrentmemorydomain( );")]
[LuaMethod("getcurrentmemorydomain", "Returns a string name of the current memory domain selected by Lua. The default is Main memory")] [LuaMethod("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;
} }
[LuaMethodExample("getcurrentmemorydomainsize", "local uimemget = memory.getcurrentmemorydomainsize( );")]
[LuaMethod("getcurrentmemorydomainsize", "Returns the number of bytes of the current memory domain selected by Lua. The default is Main memory")] [LuaMethod("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;
} }
[LuaMethodExample("usememorydomain", "if ( memory.usememorydomain( mainmemory.getname( ) ) ) then\r\n\tconsole.log( \"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\" );\r\nend;")]
[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")] [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")]
public bool UseMemoryDomain(string domain) public bool UseMemoryDomain(string domain)
{ {
@ -109,6 +114,7 @@ namespace BizHawk.Client.Common
return false; return false;
} }
[LuaMethodExample("hash_region", "local stmemhas = memory.hash_region( 0x100, 50, mainmemory.getname( ) );")]
[LuaMethod("hash_region", "Returns a hash as a string of a region of memory, starting from addr, through count bytes. If the domain is unspecified, it uses the current region.")] [LuaMethod("hash_region", "Returns a hash as a string of a region of memory, starting from addr, through count bytes. If the domain is unspecified, it uses the current region.")]
public string HashRegion(int addr, int count, string domain = null) public string HashRegion(int addr, int count, string domain = null)
{ {
@ -144,36 +150,42 @@ namespace BizHawk.Client.Common
#region Common Special and Legacy Methods #region Common Special and Legacy Methods
[LuaMethodExample("readbyte", "local uimemrea = memory.readbyte( 0x100, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("writebyte", "memory.writebyte( 0x100, 1000, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("readbyterange", "local nlmemrea = memory.readbyterange( 0x100, 30, mainmemory.getname( ) );")]
[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).")] [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);
} }
[LuaMethodExample("writebyterange", "")]
[LuaMethod("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);
} }
[LuaMethodExample("readfloat", "local simemrea = memory.readfloat( 0x100, false, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("writefloat", "memory.writefloat( 0x100, 10.0, false, mainmemory.getname( ) );")]
[LuaMethod("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)
{ {
@ -184,24 +196,28 @@ namespace BizHawk.Client.Common
#region 1 Byte #region 1 Byte
[LuaMethodExample("read_s8", "local inmemrea = memory.read_s8( 0x100, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_s8", "memory.write_s8( 0x100, 1000, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("read_u8", "local uimemrea = memory.read_u8( 0x100, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_u8", "memory.write_u8( 0x100, 1000, mainmemory.getname( ) );")]
[LuaMethod("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)
{ {
@ -212,48 +228,56 @@ namespace BizHawk.Client.Common
#region 2 Byte #region 2 Byte
[LuaMethodExample("read_s16_le", "local inmemrea = memory.read_s16_le( 0x100, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_s16_le", "memory.write_s16_le( 0x100, -1000, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("read_s16_be", "local inmemrea = memory.read_s16_be( 0x100, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_s16_be", "memory.write_s16_be( 0x100, -1000, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("read_u16_le", "local uimemrea = memory.read_u16_le( 0x100, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_u16_le", "memory.write_u16_le( 0x100, 1000, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("read_u16_be", "local uimemrea = memory.read_u16_be( 0x100, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_u16_be", "memory.write_u16_be( 0x100, 1000, mainmemory.getname( ) );")]
[LuaMethod("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)
{ {
@ -264,48 +288,56 @@ namespace BizHawk.Client.Common
#region 3 Byte #region 3 Byte
[LuaMethodExample("read_s24_le", "local inmemrea = memory.read_s24_le( 0x100, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_s24_le", "memory.write_s24_le( 0x100, -1000, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("read_s24_be", "local inmemrea = memory.read_s24_be( 0x100, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_s24_be", "memory.write_s24_be( 0x100, -1000, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("read_u24_le", "local uimemrea = memory.read_u24_le( 0x100, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_u24_le", "memory.write_u24_le( 0x100, 1000, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("read_u24_be", "local uimemrea = memory.read_u24_be( 0x100, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_u24_be", "memory.write_u24_be( 0x100, 1000, mainmemory.getname( ) );")]
[LuaMethod("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)
{ {
@ -316,48 +348,56 @@ namespace BizHawk.Client.Common
#region 4 Byte #region 4 Byte
[LuaMethodExample("read_s32_le", "local inmemrea = memory.read_s32_le( 0x100, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_s32_le", "memory.write_s32_le( 0x100, -1000, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("read_s32_be", "local inmemrea = memory.read_s32_be( 0x100, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_s32_be", "memory.write_s32_be( 0x100, -1000, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("read_u32_le", "local uimemrea = memory.read_u32_le( 0x100, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_u32_le", "memory.write_u32_le( 0x100, 1000, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("read_u32_be", "local uimemrea = memory.read_u32_be( 0x100, mainmemory.getname( ) );")]
[LuaMethod("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);
} }
[LuaMethodExample("write_u32_be", "memory.write_u32_be( 0x100, 1000, mainmemory.getname( ) );")]
[LuaMethod("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)
{ {

View File

@ -23,6 +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[]>();
[LuaMethodExample("savecorestate", "local mmsvstsvcst = memorysavestate.savecorestate( );")]
[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")] [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")]
public string SaveCoreStateToMemory() public string SaveCoreStateToMemory()
{ {
@ -34,6 +35,7 @@ namespace BizHawk.Client.Common
return guid.ToString(); return guid.ToString();
} }
[LuaMethodExample("loadcorestate", "memorysavestate.loadcorestate( \"3fcf120f-0778-43fd-b2c5-460fb7d34184\" );")]
[LuaMethod("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)
{ {
@ -55,6 +57,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodExample("removestate", "memorysavestate.removestate( \"3fcf120f-0778-43fd-b2c5-460fb7d34184\" );")]
[LuaMethod("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)
{ {
@ -62,6 +65,7 @@ namespace BizHawk.Client.Common
_memorySavestates.Remove(guid); _memorySavestates.Remove(guid);
} }
[LuaMethodExample("clearstatesfrommemory", "memorysavestate.clearstatesfrommemory( );")]
[LuaMethod("clearstatesfrommemory", "clears all savestates stored in memory")] [LuaMethod("clearstatesfrommemory", "clears all savestates stored in memory")]
public void ClearInMemoryStates() public void ClearInMemoryStates()
{ {

View File

@ -14,24 +14,28 @@ namespace BizHawk.Client.Common
public override string Name => "movie"; public override string Name => "movie";
[LuaMethodExample("startsfromsavestate", "if ( movie.startsfromsavestate( ) ) then\r\n\tconsole.log( \"Returns whether or not the movie is a savestate-anchored movie\" );\r\nend;")]
[LuaMethod("startsfromsavestate", "Returns whether or not the movie is a savestate-anchored movie")] [LuaMethod("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;
} }
[LuaMethodExample("startsfromsaveram", "if ( movie.startsfromsaveram( ) ) then\r\n\tconsole.log( \"Returns whether or not the movie is a saveram-anchored movie\" );\r\nend;")]
[LuaMethod("startsfromsaveram", "Returns whether or not the movie is a saveram-anchored movie")] [LuaMethod("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;
} }
[LuaMethodExample("filename", "local stmovfil = movie.filename( );")]
[LuaMethod("filename", "Returns the file name including path of the currently loaded movie")] [LuaMethod("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;
} }
[LuaMethodExample("getinput", "local nlmovget = movie.getinput( 500 );")]
[LuaMethod("getinput", "Returns a table of buttons pressed on a given frame of the loaded movie")] [LuaMethod("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)
{ {
@ -63,6 +67,7 @@ namespace BizHawk.Client.Common
return input; return input;
} }
[LuaMethodExample("getinputasmnemonic", "local stmovget = movie.getinputasmnemonic( 500 );")]
[LuaMethod("getinputasmnemonic", "Returns the input of a given frame of the loaded movie in a raw inputlog string")] [LuaMethod("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)
{ {
@ -76,36 +81,42 @@ namespace BizHawk.Client.Common
return ""; return "";
} }
[LuaMethodExample("getreadonly", "if ( movie.getreadonly( ) ) then\r\n\tconsole.log( \"Returns true if the movie is in read-only mode, false if in read+write\" );\r\nend;")]
[LuaMethod("getreadonly", "Returns true if the movie is in read-only mode, false if in read+write")] [LuaMethod("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;
} }
[LuaMethodExample("getrerecordcount", "local ulmovget = movie.getrerecordcount();")]
[LuaMethod("getrerecordcount", "Gets the rerecord count of the current movie.")] [LuaMethod("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;
} }
[LuaMethodExample("getrerecordcounting", "if ( movie.getrerecordcounting( ) ) then\r\n\tconsole.log( \"Returns whether or not the current movie is incrementing rerecords on loadstate\" );\r\nend;")]
[LuaMethod("getrerecordcounting", "Returns whether or not the current movie is incrementing rerecords on loadstate")] [LuaMethod("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;
} }
[LuaMethodExample("isloaded", "if ( movie.isloaded( ) ) then\r\n\tconsole.log( \"Returns true if a movie is loaded in memory ( play, record, or finished modes ), false if not ( inactive mode )\" );\r\nend;")]
[LuaMethod("isloaded", "Returns true if a movie is loaded in memory (play, record, or finished modes), false if not (inactive mode)")] [LuaMethod("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;
} }
[LuaMethodExample("length", "local domovlen = movie.length( );")]
[LuaMethod("length", "Returns the total number of frames of the loaded movie")] [LuaMethod("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;
} }
[LuaMethodExample("mode", "local stmovmod = movie.mode( );")]
[LuaMethod("mode", "Returns the mode of the current movie. Possible modes: \"PLAY\", \"RECORD\", \"FINISHED\", \"INACTIVE\"")] [LuaMethod("mode", "Returns the mode of the current movie. Possible modes: \"PLAY\", \"RECORD\", \"FINISHED\", \"INACTIVE\"")]
public static string Mode() public static string Mode()
{ {
@ -127,6 +138,7 @@ namespace BizHawk.Client.Common
return "INACTIVE"; return "INACTIVE";
} }
[LuaMethodExample("save", "movie.save( \"C:\\moviename.ext\" );")]
[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.")] [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.")]
public void Save(string filename = "") public void Save(string filename = "")
{ {
@ -151,12 +163,14 @@ namespace BizHawk.Client.Common
Global.MovieSession.Movie.Save(); Global.MovieSession.Movie.Save();
} }
[LuaMethodExample("setreadonly", "movie.setreadonly( false );")]
[LuaMethod("setreadonly", "Sets the read-only state to the given value. true for read only, false for read+write")] [LuaMethod("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;
} }
[LuaMethodExample("setrerecordcount", "movie.setrerecordcount( 20.0 );")]
[LuaMethod("setrerecordcount", "Sets the rerecord count of the current movie.")] [LuaMethod("setrerecordcount", "Sets the rerecord count of the current movie.")]
public static void SetRerecordCount(double count) public static void SetRerecordCount(double count)
{ {
@ -172,18 +186,21 @@ namespace BizHawk.Client.Common
Global.MovieSession.Movie.Rerecords = (ulong)count; Global.MovieSession.Movie.Rerecords = (ulong)count;
} }
[LuaMethodExample("setrerecordcounting", "movie.setrerecordcounting( true );")]
[LuaMethod("setrerecordcounting", "Sets whether or not the current movie will increment the rerecord counter on loadstate")] [LuaMethod("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;
} }
[LuaMethodExample("stop", "movie.stop( );")]
[LuaMethod("stop", "Stops the current movie")] [LuaMethod("stop", "Stops the current movie")]
public static void Stop() public static void Stop()
{ {
Global.MovieSession.Movie.Stop(); Global.MovieSession.Movie.Stop();
} }
[LuaMethodExample("getfps", "local domovget = movie.getfps( );")]
[LuaMethod("getfps", "If a movie is loaded, gets the frames per second used by the movie to determine the movie length time")] [LuaMethod("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()
{ {
@ -200,6 +217,7 @@ namespace BizHawk.Client.Common
return 0.0; return 0.0;
} }
[LuaMethodExample("getheader", "local nlmovget = movie.getheader( );")]
[LuaMethod("getheader", "If a movie is active, will return the movie header as a lua table")] [LuaMethod("getheader", "If a movie is active, will return the movie header as a lua table")]
public LuaTable GetHeader() public LuaTable GetHeader()
{ {
@ -215,6 +233,7 @@ namespace BizHawk.Client.Common
return luaTable; return luaTable;
} }
[LuaMethodExample("getcomments", "local nlmovget = movie.getcomments( );")]
[LuaMethod("getcomments", "If a movie is active, will return the movie comments as a lua table")] [LuaMethod("getcomments", "If a movie is active, will return the movie comments as a lua table")]
public LuaTable GetComments() public LuaTable GetComments()
{ {
@ -230,6 +249,7 @@ namespace BizHawk.Client.Common
return luaTable; return luaTable;
} }
[LuaMethodExample("getsubtitles", "local nlmovget = movie.getsubtitles( );")]
[LuaMethod("getsubtitles", "If a movie is active, will return the movie subtitles as a lua table")] [LuaMethod("getsubtitles", "If a movie is active, will return the movie subtitles as a lua table")]
public LuaTable GetSubtitles() public LuaTable GetSubtitles()
{ {

View File

@ -38,6 +38,7 @@ namespace BizHawk.Client.Common
public override string Name => "nes"; public override string Name => "nes";
[LuaMethodExample("addgamegenie", "nes.addgamegenie( \"GXXZZLVI\" );")]
[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")] [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")]
public void AddGameGenie(string code) public void AddGameGenie(string code)
{ {
@ -59,6 +60,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodExample("getallowmorethaneightsprites", "if ( nes.getallowmorethaneightsprites( ) ) then\r\n\tconsole.log( \"Gets the NES setting 'Allow more than 8 sprites per scanline' value\" );\r\nend;")]
[LuaMethod("getallowmorethaneightsprites", "Gets the NES setting 'Allow more than 8 sprites per scanline' value")] [LuaMethod("getallowmorethaneightsprites", "Gets the NES setting 'Allow more than 8 sprites per scanline' value")]
public bool GetAllowMoreThanEightSprites() public bool GetAllowMoreThanEightSprites()
{ {
@ -75,6 +77,7 @@ namespace BizHawk.Client.Common
throw new InvalidOperationException(); throw new InvalidOperationException();
} }
[LuaMethodExample("getbottomscanline", "local innesget = nes.getbottomscanline( false );")]
[LuaMethod("getbottomscanline", "Gets the current value for the bottom scanline value")] [LuaMethod("getbottomscanline", "Gets the current value for the bottom scanline value")]
public int GetBottomScanline(bool pal = false) public int GetBottomScanline(bool pal = false)
{ {
@ -93,6 +96,7 @@ namespace BizHawk.Client.Common
throw new InvalidOperationException(); throw new InvalidOperationException();
} }
[LuaMethodExample("getclipleftandright", "if ( nes.getclipleftandright( ) ) then\r\n\tconsole.log( \"Gets the current value for the Clip Left and Right sides option\" );\r\nend;")]
[LuaMethod("getclipleftandright", "Gets the current value for the Clip Left and Right sides option")] [LuaMethod("getclipleftandright", "Gets the current value for the Clip Left and Right sides option")]
public bool GetClipLeftAndRight() public bool GetClipLeftAndRight()
{ {
@ -109,6 +113,7 @@ namespace BizHawk.Client.Common
throw new InvalidOperationException(); throw new InvalidOperationException();
} }
[LuaMethodExample("getdispbackground", "if ( nes.getdispbackground( ) ) then\r\n\tconsole.log( \"Indicates whether or not the bg layer is being displayed\" );\r\nend;")]
[LuaMethod("getdispbackground", "Indicates whether or not the bg layer is being displayed")] [LuaMethod("getdispbackground", "Indicates whether or not the bg layer is being displayed")]
public bool GetDisplayBackground() public bool GetDisplayBackground()
{ {
@ -125,6 +130,7 @@ namespace BizHawk.Client.Common
throw new InvalidOperationException(); throw new InvalidOperationException();
} }
[LuaMethodExample("getdispsprites", "if ( nes.getdispsprites( ) ) then\r\n\tconsole.log( \"Indicates whether or not sprites are being displayed\" );\r\nend;")]
[LuaMethod("getdispsprites", "Indicates whether or not sprites are being displayed")] [LuaMethod("getdispsprites", "Indicates whether or not sprites are being displayed")]
public bool GetDisplaySprites() public bool GetDisplaySprites()
{ {
@ -141,6 +147,7 @@ namespace BizHawk.Client.Common
throw new InvalidOperationException(); throw new InvalidOperationException();
} }
[LuaMethodExample("gettopscanline", "local innesget = nes.gettopscanline(false);")]
[LuaMethod("gettopscanline", "Gets the current value for the top scanline value")] [LuaMethod("gettopscanline", "Gets the current value for the top scanline value")]
public int GetTopScanline(bool pal = false) public int GetTopScanline(bool pal = false)
{ {
@ -159,6 +166,7 @@ namespace BizHawk.Client.Common
throw new InvalidOperationException(); throw new InvalidOperationException();
} }
[LuaMethodExample("removegamegenie", "nes.removegamegenie( \"GXXZZLVI\" );")]
[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")] [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")]
public void RemoveGameGenie(string code) public void RemoveGameGenie(string code)
{ {
@ -170,6 +178,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodExample("setallowmorethaneightsprites", "nes.setallowmorethaneightsprites( true );")]
[LuaMethod("setallowmorethaneightsprites", "Sets the NES setting 'Allow more than 8 sprites per scanline'")] [LuaMethod("setallowmorethaneightsprites", "Sets the NES setting 'Allow more than 8 sprites per scanline'")]
public void SetAllowMoreThanEightSprites(bool allow) public void SetAllowMoreThanEightSprites(bool allow)
{ {
@ -187,6 +196,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodExample("setclipleftandright", "nes.setclipleftandright( true );")]
[LuaMethod("setclipleftandright", "Sets the Clip Left and Right sides option")] [LuaMethod("setclipleftandright", "Sets the Clip Left and Right sides option")]
public void SetClipLeftAndRight(bool leftandright) public void SetClipLeftAndRight(bool leftandright)
{ {
@ -204,6 +214,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodExample("setdispbackground", "nes.setdispbackground( true );")]
[LuaMethod("setdispbackground", "Sets whether or not the background layer will be displayed")] [LuaMethod("setdispbackground", "Sets whether or not the background layer will be displayed")]
public void SetDisplayBackground(bool show) public void SetDisplayBackground(bool show)
{ {
@ -215,6 +226,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodExample("setdispsprites", "nes.setdispsprites( true );")]
[LuaMethod("setdispsprites", "Sets whether or not sprites will be displayed")] [LuaMethod("setdispsprites", "Sets whether or not sprites will be displayed")]
public void SetDisplaySprites(bool show) public void SetDisplaySprites(bool show)
{ {
@ -232,6 +244,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodExample("setscanlines", "nes.setscanlines( 10, 20, false );")]
[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")] [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")]
public void SetScanlines(int top, int bottom, bool pal = false) public void SetScanlines(int top, int bottom, bool pal = false)
{ {

View File

@ -35,54 +35,63 @@ namespace BizHawk.Client.Common
Snes?.PutSettings(settings); Snes?.PutSettings(settings);
} }
[LuaMethodExample("getlayer_bg_1", "if ( snes.getlayer_bg_1( ) ) then\r\n\tconsole.log( \"Returns whether the bg 1 layer is displayed\" );\r\nend;")]
[LuaMethod("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;
} }
[LuaMethodExample("getlayer_bg_2", "if ( snes.getlayer_bg_2( ) ) then\r\n\tconsole.log( \"Returns whether the bg 2 layer is displayed\" );\r\nend;")]
[LuaMethod("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;
} }
[LuaMethodExample("getlayer_bg_3", "if ( snes.getlayer_bg_3( ) ) then\r\n\tconsole.log( \"Returns whether the bg 3 layer is displayed\" );\r\nend;")]
[LuaMethod("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;
} }
[LuaMethodExample("getlayer_bg_4", "if ( snes.getlayer_bg_4( ) ) then\r\n\tconsole.log( \"Returns whether the bg 4 layer is displayed\" );\r\nend;")]
[LuaMethod("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;
} }
[LuaMethodExample("getlayer_obj_1", "if ( snes.getlayer_obj_1( ) ) then\r\n\tconsole.log( \"Returns whether the obj 1 layer is displayed\" );\r\nend;")]
[LuaMethod("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;
} }
[LuaMethodExample("getlayer_obj_2", "if ( snes.getlayer_obj_2( ) ) then\r\n\tconsole.log( \"Returns whether the obj 2 layer is displayed\" );\r\nend;")]
[LuaMethod("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;
} }
[LuaMethodExample("getlayer_obj_3", "if ( snes.getlayer_obj_3( ) ) then\r\n\tconsole.log( \"Returns whether the obj 3 layer is displayed\" );\r\nend;")]
[LuaMethod("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;
} }
[LuaMethodExample("getlayer_obj_4", "if ( snes.getlayer_obj_4( ) ) then\r\n\tconsole.log( \"Returns whether the obj 4 layer is displayed\" );\r\nend;")]
[LuaMethod("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;
} }
[LuaMethodExample("setlayer_bg_1", "snes.setlayer_bg_1( true );")]
[LuaMethod("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)
{ {
@ -91,6 +100,7 @@ namespace BizHawk.Client.Common
PutSettings(s); PutSettings(s);
} }
[LuaMethodExample("setlayer_bg_2", "snes.setlayer_bg_2( true );")]
[LuaMethod("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)
{ {
@ -99,6 +109,7 @@ namespace BizHawk.Client.Common
PutSettings(s); PutSettings(s);
} }
[LuaMethodExample("setlayer_bg_3", "snes.setlayer_bg_3( true );")]
[LuaMethod("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)
{ {
@ -107,6 +118,7 @@ namespace BizHawk.Client.Common
PutSettings(s); PutSettings(s);
} }
[LuaMethodExample("setlayer_bg_4", "snes.setlayer_bg_4( true );")]
[LuaMethod("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)
{ {
@ -115,6 +127,7 @@ namespace BizHawk.Client.Common
PutSettings(s); PutSettings(s);
} }
[LuaMethodExample("setlayer_obj_1", "snes.setlayer_obj_1( true );")]
[LuaMethod("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)
{ {
@ -123,6 +136,7 @@ namespace BizHawk.Client.Common
PutSettings(s); PutSettings(s);
} }
[LuaMethodExample("setlayer_obj_2", "snes.setlayer_obj_2( true );")]
[LuaMethod("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)
{ {
@ -131,6 +145,7 @@ namespace BizHawk.Client.Common
PutSettings(s); PutSettings(s);
} }
[LuaMethodExample("setlayer_obj_3", "snes.setlayer_obj_3( true );")]
[LuaMethod("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)
{ {
@ -139,6 +154,7 @@ namespace BizHawk.Client.Common
PutSettings(s); PutSettings(s);
} }
[LuaMethodExample("setlayer_obj_4", "snes.setlayer_obj_4( true );")]
[LuaMethod("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)
{ {

View File

@ -21,6 +21,7 @@ namespace BizHawk.Client.Common
SQLiteConnection m_dbConnection; SQLiteConnection m_dbConnection;
string connectionString; string connectionString;
[LuaMethodExample("createdatabase", "local stSQLcre = SQL.createdatabase( \"eg_db\" );")]
[LuaMethod("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)
{ {
@ -37,6 +38,7 @@ namespace BizHawk.Client.Common
} }
[LuaMethodExample("opendatabase", "local stSQLope = SQL.opendatabase( \"eg_db\" );")]
[LuaMethod("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)
{ {
@ -60,6 +62,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodExample("writecommand", "local stSQLwri = SQL.writecommand( \"CREATE TABLE eg_tab ( eg_tab_id integer PRIMARY KEY, eg_tab_row_name text NOT NULL ); INSERT INTO eg_tab ( eg_tab_id, eg_tab_row_name ) VALUES ( 1, 'Example table row' );\" );")]
[LuaMethod("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,6 +93,7 @@ namespace BizHawk.Client.Common
} }
} }
[LuaMethodExample("readcommand", "local obSQLrea = SQL.readcommand( \"SELECT * FROM eg_tab WHERE eg_tab_id = 1;\" );")]
[LuaMethod("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,6 +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) { }
[LuaMethodExample("hex", "local stbizhex = bizstring.hex( -12345 );")]
[LuaMethod("hex", "Converts the number to a string representation of the hexadecimal value of the given number")] [LuaMethod("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)
{ {
@ -29,6 +30,7 @@ namespace BizHawk.Client.Common
return hex; return hex;
} }
[LuaMethodExample("binary", "local stbizbin = bizstring.binary( -12345 );")]
[LuaMethod("binary", "Converts the number to a string representation of the binary value of the given number")] [LuaMethod("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)
{ {
@ -37,6 +39,7 @@ namespace BizHawk.Client.Common
return binary; return binary;
} }
[LuaMethodExample("octal", "local stbizoct = bizstring.octal( -12345 );")]
[LuaMethod("octal", "Converts the number to a string representation of the octal value of the given number")] [LuaMethod("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)
{ {
@ -49,6 +52,7 @@ namespace BizHawk.Client.Common
return octal; return octal;
} }
[LuaMethodExample("trim", "local stbiztri = bizstring.trim( \"Some trim string\t \" );")]
[LuaMethod("trim", "returns a string that trims whitespace on the left and right ends of the string")] [LuaMethod("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)
{ {
@ -60,6 +64,7 @@ namespace BizHawk.Client.Common
return str.Trim(); return str.Trim();
} }
[LuaMethodExample("replace", "local stbizrep = bizstring.replace( \"Some string\", \"Some\", \"Replaced\" );")]
[LuaMethod("replace", "Returns a string that replaces all occurances of str2 in str1 with the value of replace")] [LuaMethod("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)
{ {
@ -71,6 +76,7 @@ namespace BizHawk.Client.Common
return str.Replace(str2, replace); return str.Replace(str2, replace);
} }
[LuaMethodExample("toupper", "local stbiztou = bizstring.toupper( \"Some string\" );")]
[LuaMethod("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)
{ {
@ -82,6 +88,7 @@ namespace BizHawk.Client.Common
return str.ToUpper(); return str.ToUpper();
} }
[LuaMethodExample("tolower", "local stbiztol = bizstring.tolower( \"Some string\" );")]
[LuaMethod("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)
{ {
@ -93,6 +100,7 @@ namespace BizHawk.Client.Common
return str.ToLower(); return str.ToLower();
} }
[LuaMethodExample("substring", "local stbizsub = bizstring.substring( \"Some string\", 6, 3 );")]
[LuaMethod("substring", "Returns a string that represents a substring of str starting at position for the specified length")] [LuaMethod("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)
{ {
@ -104,6 +112,7 @@ namespace BizHawk.Client.Common
return str.Substring(position, length); return str.Substring(position, length);
} }
[LuaMethodExample("remove", "local stbizrem = bizstring.remove( \"Some string\", 4, 5 );")]
[LuaMethod("remove", "Returns a string that represents str with the given position and count removed")] [LuaMethod("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)
{ {
@ -115,6 +124,7 @@ namespace BizHawk.Client.Common
return str.Remove(position, count); return str.Remove(position, count);
} }
[LuaMethodExample("contains", "if ( bizstring.contains( \"Some string\", \"Some\") ) then\r\n\tconsole.log( \"Returns whether or not str contains str2\" );\r\nend;")]
[LuaMethod("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)
{ {
@ -126,6 +136,7 @@ namespace BizHawk.Client.Common
return str.Contains(str2); return str.Contains(str2);
} }
[LuaMethodExample("startswith", "if ( bizstring.startswith( \"Some string\", \"Some\") ) then\r\n\tconsole.log( \"Returns whether str starts with str2\" );\r\nend;")]
[LuaMethod("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)
{ {
@ -137,6 +148,7 @@ namespace BizHawk.Client.Common
return str.StartsWith(str2); return str.StartsWith(str2);
} }
[LuaMethodExample("endswith", "if ( bizstring.endswith( \"Some string\", \"string\") ) then\r\n\tconsole.log( \"Returns whether str ends wth str2\" );\r\nend;")]
[LuaMethod("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)
{ {
@ -148,6 +160,7 @@ namespace BizHawk.Client.Common
return str.EndsWith(str2); return str.EndsWith(str2);
} }
[LuaMethodExample("split", "local nlbizspl = bizstring.split( \"Some, string\", \", \" );")]
[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")] [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")]
public LuaTable Split(string str, string separator) public LuaTable Split(string str, string separator)
{ {

View File

@ -18,6 +18,7 @@ namespace BizHawk.Client.EmuHawk
public override string Name => "userdata"; public override string Name => "userdata";
[LuaMethodExample("set", "userdata.set(\"Unique key\", \"Current key data\");")]
[LuaMethod("set", "adds or updates the data with the given key with the given value")] [LuaMethod("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)
{ {
@ -33,6 +34,7 @@ namespace BizHawk.Client.EmuHawk
Global.UserBag[name] = value; Global.UserBag[name] = value;
} }
[LuaMethodExample("get", "local obuseget = userdata.get( \"Unique key\" );")]
[LuaMethod("get", "gets the data with the given key, if the key does not exist it will return nil")] [LuaMethod("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)
{ {
@ -44,18 +46,21 @@ namespace BizHawk.Client.EmuHawk
return null; return null;
} }
[LuaMethodExample("clear", "userdata.clear( );")]
[LuaMethod("clear", "clears all user data")] [LuaMethod("clear", "clears all user data")]
public void Clear() public void Clear()
{ {
Global.UserBag.Clear(); Global.UserBag.Clear();
} }
[LuaMethodExample("remove", "if ( userdata.remove( \"Unique key\" ) ) then\r\n\tconsole.log( \"remove the data with the given key.Returns true if the element is successfully found and removed; otherwise, false.\" );\r\nend;")]
[LuaMethod("remove", "remove the data with the given key. Returns true if the element is successfully found and removed; otherwise, false.")] [LuaMethod("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);
} }
[LuaMethodExample("containskey", "if ( userdata.containskey( \"Unique key\" ) ) then\r\n\tconsole.log( \"returns whether or not there is an entry for the given key\" );\r\nend;")]
[LuaMethod("containskey", "returns whether or not there is an entry for the given key")] [LuaMethod("containskey", "returns whether or not there is an entry for the given key")]
public bool ContainsKey(string key) public bool ContainsKey(string key)
{ {

View File

@ -0,0 +1,28 @@
using System;
namespace BizHawk.Client.Common
{
[AttributeUsage(AttributeTargets.Method)]
public class LuaMethodExample : Attribute
{
public LuaMethodExample(string name, string example)
{
Name = name;
Example = example;
}
public string Name { get; }
public string Example { get; }
}
[AttributeUsage(AttributeTargets.Class)]
public class LuaLibraryExample : Attribute
{
public LuaLibraryExample(bool released)
{
Released = released;
}
public bool Released { get; }
}
}

View File

@ -36,18 +36,21 @@ namespace BizHawk.Client.EmuHawk
public override string Name => "client"; public override string Name => "client";
[LuaMethodExample("exit", "client.exit( );")]
[LuaMethod("exit", "Closes the emulator")] [LuaMethod("exit", "Closes the emulator")]
public void CloseEmulator() public void CloseEmulator()
{ {
GlobalWin.MainForm.CloseEmulator(); GlobalWin.MainForm.CloseEmulator();
} }
[LuaMethodExample("exitCode", "client.exitCode( 0 );")]
[LuaMethod("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);
} }
[LuaMethodExample("borderheight", "local inclibor = client.borderheight( );")]
[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.")] [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.")]
public static int BorderHeight() public static int BorderHeight()
{ {
@ -55,6 +58,7 @@ namespace BizHawk.Client.EmuHawk
return GlobalWin.DisplayManager.TransformPoint(point).Y; return GlobalWin.DisplayManager.TransformPoint(point).Y;
} }
[LuaMethodExample("borderwidth", "local inclibor = client.borderwidth( );")]
[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.")] [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.")]
public static int BorderWidth() public static int BorderWidth()
{ {
@ -62,36 +66,42 @@ namespace BizHawk.Client.EmuHawk
return GlobalWin.DisplayManager.TransformPoint(point).X; return GlobalWin.DisplayManager.TransformPoint(point).X;
} }
[LuaMethodExample("bufferheight", "local inclibuf = client.bufferheight( );")]
[LuaMethod("bufferheight", "Gets the visible height of the emu display surface (the core video output). This excludes the gameExtraPadding you've set.")] [LuaMethod("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;
} }
[LuaMethodExample("bufferwidth", "local inclibuf = client.bufferwidth( );")]
[LuaMethod("bufferwidth", "Gets the visible width of the emu display surface (the core video output). This excludes the gameExtraPadding you've set.")] [LuaMethod("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;
} }
[LuaMethodExample("clearautohold", "client.clearautohold( );")]
[LuaMethod("clearautohold", "Clears all autohold keys")] [LuaMethod("clearautohold", "Clears all autohold keys")]
public void ClearAutohold() public void ClearAutohold()
{ {
GlobalWin.MainForm.ClearHolds(); GlobalWin.MainForm.ClearHolds();
} }
[LuaMethodExample("closerom", "client.closerom( );")]
[LuaMethod("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();
} }
[LuaMethodExample("enablerewind", "client.enablerewind( true );")]
[LuaMethod("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);
} }
[LuaMethodExample("frameskip", "client.frameskip( 8 );")]
[LuaMethod("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)
{ {
@ -106,18 +116,21 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("gettargetscanlineintensity", "local incliget = client.gettargetscanlineintensity( );")]
[LuaMethod("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;
} }
[LuaMethodExample("getwindowsize", "local incliget = client.getwindowsize( );")]
[LuaMethod("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];
} }
[LuaMethodExample("SetGameExtraPadding", "client.SetGameExtraPadding( 5, 10, 15, 20 );")]
[LuaMethod("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)
{ {
@ -125,18 +138,21 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.MainForm.FrameBufferResized(); GlobalWin.MainForm.FrameBufferResized();
} }
[LuaMethodExample("SetSoundOn", "client.SetSoundOn( true );")]
[LuaMethod("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;
} }
[LuaMethodExample("GetSoundOn", "if ( client.GetSoundOn( ) ) then\r\n\tconsole.log( \"Gets the state of the Sound On toggle\" );\r\nend;")]
[LuaMethod("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;
} }
[LuaMethodExample("SetClientExtraPadding", "client.SetClientExtraPadding( 5, 10, 15, 20 );")]
[LuaMethod("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)
{ {
@ -144,48 +160,56 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.MainForm.FrameBufferResized(); GlobalWin.MainForm.FrameBufferResized();
} }
[LuaMethodExample("ispaused", "if ( client.ispaused( ) ) then\r\n\tconsole.log( \"Returns true if emulator is paused, otherwise, false\" );\r\nend;")]
[LuaMethod("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;
} }
[LuaMethodExample("isturbo", "if ( client.client.isturbo( ) ) then\r\n\tconsole.log( \"Returns true if emulator is in turbo mode, otherwise, false\" );\r\nend;")]
[LuaMethod("isturbo", "Returns true if emulator is in turbo mode, otherwise, false")] [LuaMethod("isturbo", "Returns true if emulator is in turbo mode, otherwise, false")]
public static bool IsTurbo() public static bool IsTurbo()
{ {
return GlobalWin.MainForm.IsTurboing; return GlobalWin.MainForm.IsTurboing;
} }
[LuaMethodExample("isseeking", "if ( client.isseeking( ) ) then\r\n\tconsole.log( \"Returns true if emulator is seeking, otherwise, false\" );\r\nend;")]
[LuaMethod("isseeking", "Returns true if emulator is seeking, otherwise, false")] [LuaMethod("isseeking", "Returns true if emulator is seeking, otherwise, false")]
public static bool IsSeeking() public static bool IsSeeking()
{ {
return GlobalWin.MainForm.IsSeeking; return GlobalWin.MainForm.IsSeeking;
} }
[LuaMethodExample("opencheats", "client.opencheats( );")]
[LuaMethod("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>();
} }
[LuaMethodExample("openhexeditor", "client.openhexeditor( );")]
[LuaMethod("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>();
} }
[LuaMethodExample("openramwatch", "client.openramwatch( );")]
[LuaMethod("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);
} }
[LuaMethodExample("openramsearch", "client.openramsearch( );")]
[LuaMethod("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>();
} }
[LuaMethodExample("openrom", "client.openrom( \"C:\\\" );")]
[LuaMethod("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)
{ {
@ -193,36 +217,42 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.MainForm.LoadRom(path, new MainForm.LoadRomArgs { OpenAdvanced = ioa }); GlobalWin.MainForm.LoadRom(path, new MainForm.LoadRomArgs { OpenAdvanced = ioa });
} }
[LuaMethodExample("opentasstudio", "client.opentasstudio( );")]
[LuaMethod("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>();
} }
[LuaMethodExample("opentoolbox", "client.opentoolbox( );")]
[LuaMethod("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>();
} }
[LuaMethodExample("opentracelogger", "client.opentracelogger( );")]
[LuaMethod("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>();
} }
[LuaMethodExample("pause", "client.pause( );")]
[LuaMethod("pause", "Pauses the emulator")] [LuaMethod("pause", "Pauses the emulator")]
public static void Pause() public static void Pause()
{ {
GlobalWin.MainForm.PauseEmulator(); GlobalWin.MainForm.PauseEmulator();
} }
[LuaMethodExample("pause_av", "client.pause_av( );")]
[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")] [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;
} }
[LuaMethodExample("reboot_core", "client.reboot_core( );")]
[LuaMethod("reboot_core", "Reboots the currently loaded core")] [LuaMethod("reboot_core", "Reboots the currently loaded core")]
public static void RebootCore() public static void RebootCore()
{ {
@ -231,12 +261,14 @@ namespace BizHawk.Client.EmuHawk
((LuaConsole)GlobalWin.Tools.Get<LuaConsole>()).LuaImp.IsRebootingCore = false; ((LuaConsole)GlobalWin.Tools.Get<LuaConsole>()).LuaImp.IsRebootingCore = false;
} }
[LuaMethodExample("screenheight", "local incliscr = client.screenheight( );")]
[LuaMethod("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;
} }
[LuaMethodExample("screenshot", "client.screenshot( \"C:\\\" );")]
[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")] [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)
{ {
@ -250,30 +282,35 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("screenshottoclipboard", "client.screenshottoclipboard( );")]
[LuaMethod("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();
} }
[LuaMethodExample("settargetscanlineintensity", "client.settargetscanlineintensity( -1000 );")]
[LuaMethod("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;
} }
[LuaMethodExample("setscreenshotosd", "client.setscreenshotosd( true );")]
[LuaMethod("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;
} }
[LuaMethodExample("screenwidth", "local incliscr = client.screenwidth( );")]
[LuaMethod("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;
} }
[LuaMethodExample("setwindowsize", "client.setwindowsize( 100 );")]
[LuaMethod("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)
{ {
@ -289,6 +326,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("speedmode", "client.speedmode( 75 );")]
[LuaMethod("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)
{ {
@ -302,12 +340,14 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("togglepause", "client.togglepause( );")]
[LuaMethod("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();
} }
[LuaMethodExample("transformPointX", "local inclitra = client.transformPointX( 16 );")]
[LuaMethod("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)
{ {
@ -315,6 +355,7 @@ namespace BizHawk.Client.EmuHawk
return GlobalWin.DisplayManager.TransformPoint(point).X; return GlobalWin.DisplayManager.TransformPoint(point).X;
} }
[LuaMethodExample("transformPointY", "local inclitra = client.transformPointY( 32 );")]
[LuaMethod("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)
{ {
@ -322,30 +363,35 @@ namespace BizHawk.Client.EmuHawk
return GlobalWin.DisplayManager.TransformPoint(point).Y; return GlobalWin.DisplayManager.TransformPoint(point).Y;
} }
[LuaMethodExample("unpause", "client.unpause( );")]
[LuaMethod("unpause", "Unpauses the emulator")] [LuaMethod("unpause", "Unpauses the emulator")]
public static void Unpause() public static void Unpause()
{ {
GlobalWin.MainForm.UnpauseEmulator(); GlobalWin.MainForm.UnpauseEmulator();
} }
[LuaMethodExample("unpause_av", "client.unpause_av( );")]
[LuaMethod("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;
} }
[LuaMethodExample("xpos", "local inclixpo = client.xpos( );")]
[LuaMethod("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;
} }
[LuaMethodExample("ypos", "local incliypo = client.ypos( );")]
[LuaMethod("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;
} }
[LuaMethodExample("getavailabletools", "local nlcliget = client.getavailabletools( );")]
[LuaMethod("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()
{ {
@ -359,6 +405,7 @@ namespace BizHawk.Client.EmuHawk
return t; return t;
} }
[LuaMethodExample("gettool", "local nlcliget = client.gettool( \"Tool name\" );")]
[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")] [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")]
public LuaTable GetTool(string name) public LuaTable GetTool(string name)
{ {
@ -381,6 +428,7 @@ namespace BizHawk.Client.EmuHawk
return null; return null;
} }
[LuaMethodExample("createinstance", "local nlclicre = client.createinstance( \"objectname\" );")]
[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")] [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")]
public LuaTable CreateInstance(string name) public LuaTable CreateInstance(string name)
{ {
@ -395,12 +443,14 @@ namespace BizHawk.Client.EmuHawk
return null; return null;
} }
[LuaMethodExample("displaymessages", "client.displaymessages( true );")]
[LuaMethod("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;
} }
[LuaMethodExample("saveram", "client.saveram( );")]
[LuaMethod("saveram", "flushes save ram to disk")] [LuaMethod("saveram", "flushes save ram to disk")]
public void SaveRam() public void SaveRam()
{ {

View File

@ -18,6 +18,7 @@ namespace BizHawk.Client.EmuHawk
public override string Name => "console"; public override string Name => "console";
[LuaMethodExample("clear", "console.clear( );")]
[LuaMethod("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()
{ {
@ -27,6 +28,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("getluafunctionslist", "local stconget = console.getluafunctionslist( );")]
[LuaMethod("getluafunctionslist", "returns a list of implemented functions")] [LuaMethod("getluafunctionslist", "returns a list of implemented functions")]
public static string GetLuaFunctionsList() public static string GetLuaFunctionsList()
{ {
@ -39,6 +41,7 @@ namespace BizHawk.Client.EmuHawk
return list.ToString(); return list.ToString();
} }
[LuaMethodExample("log", "console.log( \"New log.\" );")]
[LuaMethod("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)
{ {
@ -57,6 +60,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("writeline", "console.writeline( \"New log line.\" );")]
[LuaMethod("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)
{ {
@ -66,6 +70,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("write", "console.write( \"New log message.\" );")]
[LuaMethod("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)
{ {

View File

@ -62,6 +62,7 @@ namespace BizHawk.Client.EmuHawk
#endregion #endregion
[LuaMethodExample("addclick", "forms.addclick( 332, function()\r\n\tconsole.log( \"adds the given lua function as a click event to the given control\" );\r\nend );")]
[LuaMethod("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)
{ {
@ -78,6 +79,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("button", "local inforbut = forms.button( 333, \"Caption\", function()\r\n\tconsole.log( \"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\" );\r\nend, 2, 48, 18, 24 );")]
[LuaMethod( [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(
@ -113,6 +115,7 @@ namespace BizHawk.Client.EmuHawk
return (int)button.Handle; return (int)button.Handle;
} }
[LuaMethodExample("checkbox", "local inforche = forms.checkbox( 333, \"Caption\", 2, 48 );")]
[LuaMethod( [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)
@ -135,6 +138,7 @@ namespace BizHawk.Client.EmuHawk
return (int)checkbox.Handle; return (int)checkbox.Handle;
} }
[LuaMethodExample("clearclicks", "forms.clearclicks( 332 );")]
[LuaMethod("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)
{ {
@ -155,6 +159,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("destroy", "if ( forms.destroy( 332 ) ) then\r\n\tconsole.log( \"Closes and removes a Lua created form with the specified handle. If a dialog was found and removed true is returned, else false\" );\r\nend;")]
[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")] [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)
{ {
@ -172,6 +177,7 @@ namespace BizHawk.Client.EmuHawk
return false; return false;
} }
[LuaMethodExample("destroyall", "forms.destroyall();")]
[LuaMethod("destroyall", "Closes and removes all Lua created dialogs")] [LuaMethod("destroyall", "Closes and removes all Lua created dialogs")]
public void DestroyAll() public void DestroyAll()
{ {
@ -181,6 +187,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("dropdown", "local infordro = forms.dropdown(333, { \"item 1\", \"item2\" }, 2, 48, 18, 24);")]
[LuaMethod( [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(
@ -216,6 +223,7 @@ namespace BizHawk.Client.EmuHawk
return (int)dropdown.Handle; return (int)dropdown.Handle;
} }
[LuaMethodExample("getproperty", "local stforget = forms.getproperty(332, \"Property\");")]
[LuaMethod("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)
{ {
@ -246,6 +254,7 @@ namespace BizHawk.Client.EmuHawk
return ""; return "";
} }
[LuaMethodExample("gettext", "local stforget = forms.gettext(332);")]
[LuaMethod("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)
{ {
@ -281,6 +290,7 @@ namespace BizHawk.Client.EmuHawk
return ""; return "";
} }
[LuaMethodExample("ischecked", "if ( forms.ischecked( 332 ) ) then\r\n\tconsole.log( \"Returns the given checkbox's checked property\" );\r\nend;")]
[LuaMethod("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)
{ {
@ -309,6 +319,7 @@ namespace BizHawk.Client.EmuHawk
return false; return false;
} }
[LuaMethodExample("label", "local inforlab = forms.label( 333, \"Caption\", 2, 48, 18, 24, false );")]
[LuaMethod( [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(
@ -348,6 +359,7 @@ namespace BizHawk.Client.EmuHawk
return (int)label.Handle; return (int)label.Handle;
} }
[LuaMethodExample("newform", "local infornew = forms.newform( 18, 24, \"Title\", function()\r\n\tconsole.log( \"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.\" );\r\nend );")]
[LuaMethod( [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)
@ -383,6 +395,7 @@ namespace BizHawk.Client.EmuHawk
return (int)form.Handle; return (int)form.Handle;
} }
[LuaMethodExample("openfile", "local stforope = forms.openfile( \"C:\\filename.bin\", \"C:\\\", \"All files ( *.* )|*.*\");")]
[LuaMethod( [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 (*.*)|*.*")
@ -413,6 +426,7 @@ namespace BizHawk.Client.EmuHawk
return ""; return "";
} }
[LuaMethodExample("pictureBox", "local inforpic = forms.pictureBox( 333, 2, 48, 18, 24 );")]
[LuaMethod( [LuaMethod(
"pictureBox", "pictureBox",
"Creates a new drawing area in the form. Optionally the location in the form as well as the size of the drawing area can be specified. Returns the handle the component can be refered to with.")] "Creates a new drawing area in the form. Optionally the location in the form as well as the size of the drawing area can be specified. Returns the handle the component can be refered to with.")]
@ -444,6 +458,7 @@ namespace BizHawk.Client.EmuHawk
#region LuaPictureBox Methods #region LuaPictureBox Methods
[LuaMethodExample("clear", "forms.clear( 334, 0x000000FF );")]
[LuaMethod( [LuaMethod(
"clear", "clear",
"Clears the canvas")] "Clears the canvas")]
@ -475,6 +490,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("refresh", "forms.refresh( 334 );")]
[LuaMethod( [LuaMethod(
"refresh", "refresh",
"Redraws the canvas")] "Redraws the canvas")]
@ -506,6 +522,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("setDefaultForegroundColor", "forms.setDefaultForegroundColor( 334, 0xFFFFFFFF );")]
[LuaMethod( [LuaMethod(
"setDefaultForegroundColor", "setDefaultForegroundColor",
"Sets the default foreground color to use in drawing methods, white by default")] "Sets the default foreground color to use in drawing methods, white by default")]
@ -537,6 +554,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("setDefaultBackgroundColor", "forms.setDefaultBackgroundColor( 334, 0x000000FF );")]
[LuaMethod( [LuaMethod(
"setDefaultBackgroundColor", "setDefaultBackgroundColor",
"Sets the default background color to use in drawing methods, transparent by default")] "Sets the default background color to use in drawing methods, transparent by default")]
@ -568,6 +586,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("setDefaultTextBackground", "forms.setDefaultTextBackground( 334, 0x000000FF );")]
[LuaMethod( [LuaMethod(
"setDefaultTextBackground", "setDefaultTextBackground",
"Sets the default backgroiund color to use in text drawing methods, half-transparent black by default")] "Sets the default backgroiund color to use in text drawing methods, half-transparent black by default")]
@ -599,6 +618,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawBezier", "forms.drawBezier( 334, { { 5, 10 }, { 10, 10 }, { 10, 20 }, { 5, 20 } }, 0x000000FF );")]
[LuaMethod( [LuaMethod(
"drawBezier", "drawBezier",
"Draws a Bezier curve using the table of coordinates provided in the given color")] "Draws a Bezier curve using the table of coordinates provided in the given color")]
@ -630,6 +650,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawBox", "forms.drawBox( 334, 16, 32, 162, 322, 0x007F00FF, 0x7F7F7FFF );")]
[LuaMethod( [LuaMethod(
"drawBox", "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")] "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")]
@ -661,6 +682,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawEllipse", "forms.drawEllipse( 334, 16, 32, 77, 99, 0x007F00FF, 0x7F7F7FFF );")]
[LuaMethod( [LuaMethod(
"drawEllipse", "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")] "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")]
@ -692,6 +714,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawIcon", "forms.drawIcon( 334, \"C:\\icon.ico\", 16, 32, 18, 24 );")]
[LuaMethod( [LuaMethod(
"drawIcon", "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")] "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")]
@ -723,6 +746,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawImage", "forms.drawImage( 334, \"C:\\image.png\", 16, 32, 18, 24, false );")]
[LuaMethod( [LuaMethod(
"drawImage", "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")] "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")]
@ -759,6 +783,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("clearImageCache", "forms.clearImageCache( 334 );")]
[LuaMethod( [LuaMethod(
"clearImageCache", "clearImageCache",
"clears the image cache that is built up by using gui.drawImage, also releases the file handle for cached images")] "clears the image cache that is built up by using gui.drawImage, also releases the file handle for cached images")]
@ -790,6 +815,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawImageRegion", "forms.drawImageRegion( 334, \"C:\\image.bmp\", 11, 22, 33, 44, 21, 43, 34, 45 );")]
[LuaMethod( [LuaMethod(
"drawImageRegion", "drawImageRegion",
"draws a given region of an image file from the given path at the given coordinate, and optionally with the given size")] "draws a given region of an image file from the given path at the given coordinate, and optionally with the given size")]
@ -826,6 +852,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawLine", "forms.drawLine( 334, 161, 321, 162, 322, 0xFFFFFFFF );")]
[LuaMethod( [LuaMethod(
"drawLine", "drawLine",
"Draws a line from the first coordinate pair to the 2nd. Color is optional (if not specified it will be drawn black)")] "Draws a line from the first coordinate pair to the 2nd. Color is optional (if not specified it will be drawn black)")]
@ -857,6 +884,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawAxis", "forms.drawAxis( 334, 16, 32, int size, 0xFFFFFFFF );")]
[LuaMethod( [LuaMethod(
"drawAxis", "drawAxis",
"Draws an axis of the specified size at the coordinate pair.)")] "Draws an axis of the specified size at the coordinate pair.)")]
@ -888,6 +916,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawArc", "forms.drawArc( 334, 16, 32, 77, 99, 180, 90, 0x007F00FF );")]
[LuaMethod( [LuaMethod(
"drawArc", "drawArc",
"draws a Arc shape at the given coordinates and the given width and height" "draws a Arc shape at the given coordinates and the given width and height"
@ -920,6 +949,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawPie", "forms.drawPie( 334, 16, 32, 77, 99, 180, 90, 0x007F00FF, 0x7F7F7FFF );")]
[LuaMethod( [LuaMethod(
"drawPie", "drawPie",
"draws a Pie shape at the given coordinates and the given width and height")] "draws a Pie shape at the given coordinates and the given width and height")]
@ -960,6 +990,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawPixel", "forms.drawPixel( 334, 16, 32, 0xFFFFFFFF );")]
[LuaMethod( [LuaMethod(
"drawPixel", "drawPixel",
"Draws a single pixel at the given coordinates in the given color. Color is optional (if not specified it will be drawn black)")] "Draws a single pixel at the given coordinates in the given color. Color is optional (if not specified it will be drawn black)")]
@ -991,6 +1022,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawPolygon", "forms.drawPolygon( 334, { { 5, 10 }, { 10, 10 }, { 10, 20 }, { 5, 20 } }, 0x007F00FF, 0x7F7F7FFF );")]
[LuaMethod( [LuaMethod(
"drawPolygon", "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")] "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")]
@ -1023,6 +1055,7 @@ namespace BizHawk.Client.EmuHawk
} }
[LuaMethodExample("drawRectangle", "forms.drawRectangle( 334, 16, 32, 77, 99, 0x007F00FF, 0x7F7F7FFF );")]
[LuaMethod( [LuaMethod(
"drawRectangle", "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")] "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")]
@ -1054,6 +1087,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawString", "forms.drawString( 334, 16, 32, \"Some message\", 0x7F0000FF, 0x00007FFF, 8, \"Arial Narrow\", \"bold\", \"center\", \"middle\" );")]
[LuaMethod( [LuaMethod(
"drawString", "drawString",
"Alias of DrawText()")] "Alias of DrawText()")]
@ -1096,6 +1130,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawText", "forms.drawText( 334, 16, 32, \"Some message\", 0x7F0000FF, 0x00007FFF, 8, \"Arial Narrow\", \"bold\", \"center\", \"middle\" );")]
[LuaMethod( [LuaMethod(
"drawText", "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.")] "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.")]
@ -1139,6 +1174,7 @@ namespace BizHawk.Client.EmuHawk
} }
// It'd be great if these were simplified into 1 function, but I cannot figure out how to return a LuaTable from this class // It'd be great if these were simplified into 1 function, but I cannot figure out how to return a LuaTable from this class
[LuaMethodExample("getMouseX", "local inforget = forms.getMouseX( 334 );")]
[LuaMethod( [LuaMethod(
"getMouseX", "getMouseX",
"Returns an integer representation of the mouse X coordinate relative to the PictureBox.")] "Returns an integer representation of the mouse X coordinate relative to the PictureBox.")]
@ -1173,6 +1209,7 @@ namespace BizHawk.Client.EmuHawk
return 0; return 0;
} }
[LuaMethodExample("getMouseY", "local inforget = forms.getMouseY( 334 );")]
[LuaMethod( [LuaMethod(
"getMouseY", "getMouseY",
"Returns an integer representation of the mouse Y coordinate relative to the PictureBox.")] "Returns an integer representation of the mouse Y coordinate relative to the PictureBox.")]
@ -1209,6 +1246,7 @@ namespace BizHawk.Client.EmuHawk
#endregion #endregion
[LuaMethodExample("setdropdownitems", "forms.setdropdownitems( 332, { \"item1\", \"item2\" } );")]
[LuaMethod("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)
{ {
@ -1244,6 +1282,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("setlocation", "forms.setlocation( 332, 16, 32 );")]
[LuaMethod("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)
{ {
@ -1267,6 +1306,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("setproperty", "forms.setproperty( 332, \"Property\", \"Property value\" );")]
[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")] [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)
{ {
@ -1322,12 +1362,14 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("createcolor", "local coforcre = forms.createcolor( 0x7F, 0x3F, 0x1F, 0xCF );")]
[LuaMethod("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);
} }
[LuaMethodExample("setsize", "forms.setsize( 332, 77, 99 );")]
[LuaMethod("setsize", "TODO")] [LuaMethod("setsize", "TODO")]
public void SetSize(int handle, int width, int height) public void SetSize(int handle, int width, int height)
{ {
@ -1351,6 +1393,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("settext", "forms.settext( 332, \"Caption\" );")]
[LuaMethod("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)
{ {
@ -1374,6 +1417,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("textbox", "local infortex = forms.textbox( 333, \"Caption\", 18, 24, \"HEX\", 2, 48, true, false, \"Both\" );")]
[LuaMethod( [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(

View File

@ -45,6 +45,7 @@ namespace BizHawk.Client.EmuHawk
public bool SurfaceIsNull => _luaSurface == null; public bool SurfaceIsNull => _luaSurface == null;
[LuaMethodExample("DrawNew", "gui.DrawNew( \"native\", false );")]
[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)")] [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)")]
public void DrawNew(string name, bool? clear = true) public void DrawNew(string name, bool? clear = true)
{ {
@ -59,6 +60,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("DrawFinish", "gui.DrawFinish( );")]
[LuaMethod("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()
{ {
@ -126,12 +128,14 @@ namespace BizHawk.Client.EmuHawk
#endregion #endregion
[LuaMethodExample("addmessage", "gui.addmessage( \"Some message\" );")]
[LuaMethod("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);
} }
[LuaMethodExample("clearGraphics", "gui.clearGraphics( );")]
[LuaMethod("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()
{ {
@ -139,30 +143,35 @@ namespace BizHawk.Client.EmuHawk
DrawFinish(); DrawFinish();
} }
[LuaMethodExample("cleartext", "gui.cleartext( );")]
[LuaMethod("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();
} }
[LuaMethodExample("defaultForeground", "gui.defaultForeground( 0x000000FF );")]
[LuaMethod("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;
} }
[LuaMethodExample("defaultBackground", "gui.defaultBackground( 0xFFFFFFFF );")]
[LuaMethod("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;
} }
[LuaMethodExample("defaultTextBackground", "gui.defaultTextBackground( 0x000000FF );")]
[LuaMethod("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;
} }
[LuaMethodExample("defaultPixelFont", "gui.defaultPixelFont( \"Arial Narrow\");")]
[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")] [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")]
public void SetDefaultTextBackground(string fontfamily) public void SetDefaultTextBackground(string fontfamily)
{ {
@ -182,6 +191,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawBezier", "gui.drawBezier( { { 5, 10 }, { 10, 10 }, { 10, 20 }, { 5, 20 } }, 0x000000FF );")]
[LuaMethod("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)
{ {
@ -211,6 +221,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawBox", "gui.drawBox( 16, 32, 162, 322, 0x007F00FF, 0x7F7F7FFF );")]
[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")] [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")]
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)
{ {
@ -254,6 +265,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawEllipse", "gui.drawEllipse( 16, 32, 77, 99, 0x007F00FF, 0x7F7F7FFF );")]
[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")] [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")]
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)
{ {
@ -278,6 +290,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawIcon", "gui.drawIcon( \"C:\\sample.ico\", 16, 32, 18, 24 );")]
[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")] [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")]
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)
{ {
@ -304,6 +317,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawImage", "gui.drawImage( \"C:\\sample.bmp\", 16, 32, 18, 24, false );")]
[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")] [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")]
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)
{ {
@ -333,6 +347,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("clearImageCache", "gui.clearImageCache( );")]
[LuaMethod("clearImageCache", "clears the image cache that is built up by using gui.drawImage, also releases the file handle for cached images")] [LuaMethod("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()
{ {
@ -344,6 +359,7 @@ namespace BizHawk.Client.EmuHawk
_imageCache.Clear(); _imageCache.Clear();
} }
[LuaMethodExample("drawImageRegion", "gui.drawImageRegion( \"C:\\sample.png\", 11, 22, 33, 44, 21, 43, 34, 45 );")]
[LuaMethod("drawImageRegion", "draws a given region of an image file from the given path at the given coordinate, and optionally with the given size")] [LuaMethod("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)
{ {
@ -372,6 +388,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawLine", "gui.drawLine( 161, 321, 162, 322, 0xFFFFFFFF );")]
[LuaMethod("drawLine", "Draws a line from the first coordinate pair to the 2nd. Color is optional (if not specified it will be drawn black)")] [LuaMethod("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)
{ {
@ -381,6 +398,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawAxis", "gui.drawAxis( 16, 32, 15, 0xFFFFFFFF );")]
[LuaMethod("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)
{ {
@ -388,6 +406,7 @@ namespace BizHawk.Client.EmuHawk
DrawLine(x, y + size, x, y - size, color); DrawLine(x, y + size, x, y - size, color);
} }
[LuaMethodExample("drawPie", "gui.drawPie( 16, 32, 77, 99, 180, 90, 0x007F00FF, 0x7F7F7FFF );")]
[LuaMethod("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,
@ -412,6 +431,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawPixel", "gui.drawPixel( 16, 32, 0xFFFFFFFF );")]
[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)")] [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)")]
public void DrawPixel(int x, int y, Color? color = null) public void DrawPixel(int x, int y, Color? color = null)
{ {
@ -428,6 +448,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawPolygon", "gui.drawPolygon( { { 5, 10 }, { 10, 10 }, { 10, 20 }, { 5, 20 } }, 0x007F00FF, 0x7F7F7FFF );")]
[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")] [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")]
public void DrawPolygon(LuaTable points, Color? line = null, Color? background = null) public void DrawPolygon(LuaTable points, Color? line = null, Color? background = null)
{ {
@ -457,6 +478,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawRectangle", "gui.drawRectangle( 16, 32, 77, 99, 0x007F00FF, 0x7F7F7FFF );")]
[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")] [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")]
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)
{ {
@ -471,6 +493,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("drawString", "gui.drawString( 16, 32, \"Some message\", 0x7F0000FF, 0x00007FFF, 8, \"Arial Narrow\", \"bold\", \"center\", \"middle\" );")]
[LuaMethod("drawString", "Alias of gui.drawText()")] [LuaMethod("drawString", "Alias of gui.drawText()")]
public void DrawString( public void DrawString(
int x, int x,
@ -487,6 +510,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);
} }
[LuaMethodExample("drawText", "gui.drawText( 16, 32, \"Some message\", 0x7F0000FF, 0x00007FFF, 8, \"Arial Narrow\", \"bold\", \"center\", \"middle\" );")]
[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.")] [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.")]
public void DrawText( public void DrawText(
int x, int x,
@ -582,6 +606,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("pixelText", "gui.pixelText( 16, 32, \"Some message\", 0x7F0000FF, 0x00007FFF, \"Arial Narrow\" );")]
[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()")] [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()")]
public void DrawText( public void DrawText(
int x, int x,
@ -636,6 +661,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("text", "gui.text( 16, 32, \"Some message\", 0x7F0000FF, \"bottomleft\" );")]
[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")] [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")]
public void Text( public void Text(
int x, int x,
@ -677,6 +703,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);
} }
[LuaMethodExample("createcanvas", "local nlguicre = gui.createcanvas( 77, 99, 2, 48 );")]
[LuaMethod("createcanvas", "Creates a canvas of the given size and, if specified, the given coordinates.")] [LuaMethod("createcanvas", "Creates a canvas of the given size and, if specified, the given coordinates.")]
public LuaTable Text(int width, int height, int? x = null, int? y = null) public LuaTable Text(int width, int height, int? x = null, int? y = null)
{ {

View File

@ -17,6 +17,7 @@ namespace BizHawk.Client.EmuHawk
public override string Name => "input"; public override string Name => "input";
[LuaMethodExample("get", "local nlinpget = input.get( );")]
[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.")] [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.")]
public LuaTable Get() public LuaTable Get()
{ {
@ -29,6 +30,7 @@ namespace BizHawk.Client.EmuHawk
return buttons; return buttons;
} }
[LuaMethodExample("getmouse", "local nlinpget = input.getmouse( );")]
[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.")] [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.")]
public LuaTable GetMouse() public LuaTable GetMouse()
{ {

View File

@ -17,6 +17,7 @@ namespace BizHawk.Client.EmuHawk
public override string Name => "savestate"; public override string Name => "savestate";
[LuaMethodExample("load", "savestate.load( \"C:\\state.bin\" );")]
[LuaMethod("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)
{ {
@ -30,6 +31,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("loadslot", "savestate.loadslot( 7 );")]
[LuaMethod("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)
{ {
@ -39,12 +41,14 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("save", "savestate.save( \"C:\\state.bin\" );")]
[LuaMethod("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);
} }
[LuaMethodExample("saveslot", "savestate.saveslot( 7 );")]
[LuaMethod("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)
{ {

View File

@ -49,18 +49,21 @@ namespace BizHawk.Client.EmuHawk
private List<PendingChanges> changeList = new List<PendingChanges>(); //TODO: Initialize it to empty list on a script reload, and have each script have it's own list private List<PendingChanges> changeList = new List<PendingChanges>(); //TODO: Initialize it to empty list on a script reload, and have each script have it's own list
[LuaMethodExample("engaged", "if ( tastudio.engaged( ) ) then\r\n\tconsole.log( \"returns whether or not tastudio is currently engaged ( active )\" );\r\nend;")]
[LuaMethod("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
} }
[LuaMethodExample("getrecording", "if ( tastudio.getrecording( ) ) then\r\n\tconsole.log( \"returns whether or not TAStudio is in recording mode\" );\r\nend;")]
[LuaMethod("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;
} }
[LuaMethodExample("setrecording", "tastudio.setrecording( true );")]
[LuaMethod("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)
{ {
@ -70,12 +73,14 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("togglerecording", "tastudio.togglerecording( );")]
[LuaMethod("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();
} }
[LuaMethodExample("setbranchtext", "tastudio.setbranchtext( \"Some text\", 1 );")]
[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")] [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)
{ {
@ -89,6 +94,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("getmarker", "local sttasget = tastudio.getmarker( 500 );")]
[LuaMethod("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)
{ {
@ -104,6 +110,7 @@ namespace BizHawk.Client.EmuHawk
return ""; return "";
} }
[LuaMethodExample("removemarker", "tastudio.removemarker( 500 );")]
[LuaMethod("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)
{ {
@ -118,6 +125,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("setmarker", "tastudio.setmarker( 500, \"Some message\" );")]
[LuaMethod("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)
{ {
@ -136,6 +144,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("islag", "local botasisl = tastudio.islag( 500 );")]
[LuaMethod("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)
{ {
@ -150,6 +159,7 @@ namespace BizHawk.Client.EmuHawk
return null; return null;
} }
[LuaMethodExample("setlag", "tastudio.setlag( 500, true );")]
[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")] [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)
{ {
@ -159,6 +169,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("hasstate", "if ( tastudio.hasstate( 500 ) ) then\r\n\tconsole.log( \"Returns whether or not the given frame has a savestate associated with it\" );\r\nend;")]
[LuaMethod("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)
{ {
@ -173,6 +184,7 @@ namespace BizHawk.Client.EmuHawk
return false; return false;
} }
[LuaMethodExample("setplayback", "tastudio.setplayback( 1500 );")]
[LuaMethod("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)
{ {
@ -201,6 +213,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("onqueryitembg", "tastudio.onqueryitembg( function( currentindex, itemname )\r\n\tconsole.log( \"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)\" );\r\nend );")]
[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)")] [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)")]
public void OnQueryItemBg(LuaFunction luaf) public void OnQueryItemBg(LuaFunction luaf)
{ {
@ -221,6 +234,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("onqueryitemtext", "tastudio.onqueryitemtext( function( currentindex, itemname )\r\n\tconsole.log( \"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)\" );\r\nend );")]
[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)")] [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)")]
public void OnQueryItemText(LuaFunction luaf) public void OnQueryItemText(LuaFunction luaf)
{ {
@ -235,6 +249,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("onqueryitemicon", "tastudio.onqueryitemicon( function( currentindex, itemname )\r\n\tconsole.log( \"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)\" );\r\nend );")]
[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)")] [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)")]
public void OnQueryItemIcon(LuaFunction luaf) public void OnQueryItemIcon(LuaFunction luaf)
{ {
@ -255,6 +270,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("ongreenzoneinvalidated", "tastudio.ongreenzoneinvalidated( function( currentindex, itemname )\r\n\tconsole.log( \"called whenever the greenzone is invalidated and returns the first frame that was invalidated\" );\r\nend );")]
[LuaMethod("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)
{ {
@ -267,6 +283,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("onbranchload", "tastudio.ongreenzoneinvalidated( function( currentindex, itemname )\r\n\tconsole.log( \"called whenever the greenzone is invalidated and returns the first frame that was invalidated\" );\r\nend );")]
[LuaMethod("onbranchload", "called whenever a branch is loaded. luaf must be a function that takes the integer branch index as a parameter")] [LuaMethod("onbranchload", "called whenever a branch is loaded. luaf must be a function that takes the integer branch index as a parameter")]
public void OnBranchLoad(LuaFunction luaf) public void OnBranchLoad(LuaFunction luaf)
{ {
@ -279,6 +296,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("onbranchsave", "")]
[LuaMethod("onbranchsave", "called whenever a branch is created or updated. luaf must be a function that takes the integer branch index as a parameter")] [LuaMethod("onbranchsave", "called whenever a branch is created or updated. luaf must be a function that takes the integer branch index as a parameter")]
public void OnBranchSave(LuaFunction luaf) public void OnBranchSave(LuaFunction luaf)
{ {
@ -291,6 +309,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("onbranchremove", "")]
[LuaMethod("onbranchremove", "called whenever a branch is removed. luaf must be a function that takes the integer branch index as a parameter")] [LuaMethod("onbranchremove", "called whenever a branch is removed. luaf must be a function that takes the integer branch index as a parameter")]
public void OnBranchRemove(LuaFunction luaf) public void OnBranchRemove(LuaFunction luaf)
{ {
@ -303,6 +322,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("getselection", "local nltasget = tastudio.getselection( );")]
[LuaMethod("getselection", "gets the currently selected frames")] [LuaMethod("getselection", "gets the currently selected frames")]
public LuaTable GetSelection() public LuaTable GetSelection()
{ {
@ -328,6 +348,7 @@ namespace BizHawk.Client.EmuHawk
public string Text { get; set; } public string Text { get; set; }
} }
[LuaMethodExample("getbranches", "local nltasget = tastudio.getbranches( );")]
[LuaMethod("getbranches", "Returns a list of the current tastudio branches. Each entry will have the Id, Frame, and Text properties of the branch")] [LuaMethod("getbranches", "Returns a list of the current tastudio branches. Each entry will have the Id, Frame, and Text properties of the branch")]
public LuaTable GetBranches() public LuaTable GetBranches()
{ {
@ -353,6 +374,7 @@ namespace BizHawk.Client.EmuHawk
} }
[LuaMethodExample("getbranchinput", "local nltasget = tastudio.getbranchinput( \"97021544-2454-4483-824f-47f75e7fcb6a\", 500 );")]
[LuaMethod("getbranchinput", "Gets the controller state of the given frame with the given branch identifier")] [LuaMethod("getbranchinput", "Gets the controller state of the given frame with the given branch identifier")]
public LuaTable GetBranchInput(string branchId, int frame) public LuaTable GetBranchInput(string branchId, int frame)
{ {
@ -390,6 +412,7 @@ namespace BizHawk.Client.EmuHawk
return table; return table;
} }
[LuaMethodExample("submitinputchange", "")]
[LuaMethod("submitinputchange", "")] [LuaMethod("submitinputchange", "")]
public void SubmitInputChange(int frame, string button, bool value) public void SubmitInputChange(int frame, string button, bool value)
{ {
@ -430,6 +453,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("submitanalogchange", "")]
[LuaMethod("submitanalogchange", "")] [LuaMethod("submitanalogchange", "")]
public void SubmitAnalogChange(int frame, string button, float value) public void SubmitAnalogChange(int frame, string button, float value)
{ {
@ -470,6 +494,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("submitinsertframes", "")]
[LuaMethod("submitinsertframes", "")] [LuaMethod("submitinsertframes", "")]
public void SubmitInsertFrames(int frame, int number) public void SubmitInsertFrames(int frame, int number)
{ {
@ -488,6 +513,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("submitdeleteframes", "")]
[LuaMethod("submitdeleteframes", "")] [LuaMethod("submitdeleteframes", "")]
public void SubmitDeleteFrames(int frame, int number) public void SubmitDeleteFrames(int frame, int number)
{ {
@ -506,6 +532,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("applyinputchanges", "")]
[LuaMethod("applyinputchanges", "")] [LuaMethod("applyinputchanges", "")]
public void ApplyInputChanges() public void ApplyInputChanges()
{ {
@ -547,6 +574,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample("clearinputchanges", "")]
[LuaMethod("clearinputchanges", "")] [LuaMethod("clearinputchanges", "")]
public void ClearInputChanges() public void ClearInputChanges()
{ {

View File

@ -33,6 +33,9 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample(
"setTitle",
"LuaCanvas.setTitle( \"Title\" );")]
[LuaMethod( [LuaMethod(
"setTitle", "setTitle",
"Sets the canvas window title")] "Sets the canvas window title")]
@ -41,6 +44,9 @@ namespace BizHawk.Client.EmuHawk
Text = title; Text = title;
} }
[LuaMethodExample(
"setLocation",
"LuaCanvas.setLocation( 16, 32 );")]
[LuaMethod( [LuaMethod(
"setLocation", "setLocation",
"Sets the location of the canvas window")] "Sets the location of the canvas window")]
@ -51,6 +57,9 @@ namespace BizHawk.Client.EmuHawk
Top = (int)y; Top = (int)y;
} }
[LuaMethodExample(
"clear",
"LuaCanvas.clear( 0x000000FF );")]
[LuaMethod( [LuaMethod(
"clear", "clear",
"Clears the canvas")] "Clears the canvas")]
@ -59,6 +68,9 @@ namespace BizHawk.Client.EmuHawk
luaPictureBox.Clear(color); luaPictureBox.Clear(color);
} }
[LuaMethodExample(
"refresh",
"LuaCanvas.refresh( );")]
[LuaMethod( [LuaMethod(
"refresh", "refresh",
"Redraws the canvas")] "Redraws the canvas")]
@ -67,6 +79,9 @@ namespace BizHawk.Client.EmuHawk
luaPictureBox.Refresh(); luaPictureBox.Refresh();
} }
[LuaMethodExample(
"setDefaultForegroundColor",
"LuaCanvas.setDefaultForegroundColor( 0x000000FF );")]
[LuaMethod( [LuaMethod(
"setDefaultForegroundColor", "setDefaultForegroundColor",
"Sets the default foreground color to use in drawing methods, white by default")] "Sets the default foreground color to use in drawing methods, white by default")]
@ -75,6 +90,9 @@ namespace BizHawk.Client.EmuHawk
luaPictureBox.SetDefaultForegroundColor(color); luaPictureBox.SetDefaultForegroundColor(color);
} }
[LuaMethodExample(
"setDefaultBackgroundColor",
"LuaCanvas.setDefaultBackgroundColor( 0x000000FF );")]
[LuaMethod( [LuaMethod(
"setDefaultBackgroundColor", "setDefaultBackgroundColor",
"Sets the default background color to use in drawing methods, transparent by default")] "Sets the default background color to use in drawing methods, transparent by default")]
@ -83,6 +101,9 @@ namespace BizHawk.Client.EmuHawk
luaPictureBox.SetDefaultBackgroundColor(color); luaPictureBox.SetDefaultBackgroundColor(color);
} }
[LuaMethodExample(
"setDefaultTextBackground",
"LuaCanvas.setDefaultTextBackground( 0x000000FF );")]
[LuaMethod( [LuaMethod(
"setDefaultTextBackground", "setDefaultTextBackground",
"Sets the default backgroiund color to use in text drawing methods, half-transparent black by default")] "Sets the default backgroiund color to use in text drawing methods, half-transparent black by default")]
@ -91,6 +112,9 @@ namespace BizHawk.Client.EmuHawk
luaPictureBox.SetDefaultTextBackground(color); luaPictureBox.SetDefaultTextBackground(color);
} }
[LuaMethodExample(
"drawBezier",
"LuaCanvas.drawBezier( { { 5, 10 }, { 10, 10 }, { 10, 20 }, { 5, 20 } }, 0x000000FF );")]
[LuaMethod( [LuaMethod(
"drawBezier", "drawBezier",
"Draws a Bezier curve using the table of coordinates provided in the given color")] "Draws a Bezier curve using the table of coordinates provided in the given color")]
@ -107,6 +131,9 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample(
"drawBox",
"LuaCanvas.drawBox( 16, 32, 162, 322, 0x007F00FF, 0x7F7F7FFF );")]
[LuaMethod( [LuaMethod(
"drawBox", "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")] "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")]
@ -123,6 +150,9 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample(
"drawEllipse",
"LuaCanvas.drawEllipse( 16, 32, 77, 99, 0x007F00FF, 0x7F7F7FFF );")]
[LuaMethod( [LuaMethod(
"drawEllipse", "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")] "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")]
@ -139,6 +169,9 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample(
"drawIcon",
"LuaCanvas.drawIcon( \"C:\\icon.ico\", 16, 32, 18, 24 );")]
[LuaMethod( [LuaMethod(
"drawIcon", "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")] "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")]
@ -155,6 +188,9 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample(
"drawImage",
"LuaCanvas.drawImage( \"C:\\image.bmp\", 16, 32, 18, 24, false );")]
[LuaMethod( [LuaMethod(
"drawImage", "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")] "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")]
@ -169,6 +205,9 @@ namespace BizHawk.Client.EmuHawk
luaPictureBox.DrawImage(path, x, y, width, height, cache); luaPictureBox.DrawImage(path, x, y, width, height, cache);
} }
[LuaMethodExample(
"clearImageCache",
"LuaCanvas.clearImageCache( );")]
[LuaMethod( [LuaMethod(
"clearImageCache", "clearImageCache",
"clears the image cache that is built up by using gui.drawImage, also releases the file handle for cached images")] "clears the image cache that is built up by using gui.drawImage, also releases the file handle for cached images")]
@ -177,6 +216,9 @@ namespace BizHawk.Client.EmuHawk
luaPictureBox.ClearImageCache(); luaPictureBox.ClearImageCache();
} }
[LuaMethodExample(
"drawImageRegion",
"LuaCanvas.drawImageRegion( \"C:\\image.png\", 11, 22, 33, 44, 21, 43, 34, 45 );")]
[LuaMethod( [LuaMethod(
"drawImageRegion", "drawImageRegion",
"draws a given region of an image file from the given path at the given coordinate, and optionally with the given size")] "draws a given region of an image file from the given path at the given coordinate, and optionally with the given size")]
@ -191,6 +233,9 @@ namespace BizHawk.Client.EmuHawk
luaPictureBox.DrawImageRegion(path, source_x, source_y, source_width, source_height, dest_x, dest_y, dest_width, dest_height); luaPictureBox.DrawImageRegion(path, source_x, source_y, source_width, source_height, dest_x, dest_y, dest_width, dest_height);
} }
[LuaMethodExample(
"drawLine",
"LuaCanvas.drawLine( 161, 321, 162, 322, 0xFFFFFFFF );")]
[LuaMethod( [LuaMethod(
"drawLine", "drawLine",
"Draws a line from the first coordinate pair to the 2nd. Color is optional (if not specified it will be drawn black)")] "Draws a line from the first coordinate pair to the 2nd. Color is optional (if not specified it will be drawn black)")]
@ -199,6 +244,9 @@ namespace BizHawk.Client.EmuHawk
luaPictureBox.DrawLine(x1, y1, x2, y2, color); luaPictureBox.DrawLine(x1, y1, x2, y2, color);
} }
[LuaMethodExample(
"drawAxis",
"LuaCanvas.drawAxis( 16, 32, int size, 0xFFFFFFFF );")]
[LuaMethod( [LuaMethod(
"drawAxis", "drawAxis",
"Draws an axis of the specified size at the coordinate pair.)")] "Draws an axis of the specified size at the coordinate pair.)")]
@ -207,6 +255,9 @@ namespace BizHawk.Client.EmuHawk
luaPictureBox.DrawAxis(x, y, size, color); luaPictureBox.DrawAxis(x, y, size, color);
} }
[LuaMethodExample(
"drawArc",
"LuaCanvas.drawArc( 16, 32, 77, 99, 180, 90, 0x007F00FF );")]
[LuaMethod( [LuaMethod(
"drawArc", "drawArc",
"draws a Arc shape at the given coordinates and the given width and height" "draws a Arc shape at the given coordinates and the given width and height"
@ -216,6 +267,9 @@ namespace BizHawk.Client.EmuHawk
luaPictureBox.DrawArc(x, y, width, height, startangle, sweepangle, line); luaPictureBox.DrawArc(x, y, width, height, startangle, sweepangle, line);
} }
[LuaMethodExample(
"drawPie",
"LuaCanvas.drawPie( 16, 32, 77, 99, 180, 90, 0x007F00FF, 0x7F7F7FFF );")]
[LuaMethod( [LuaMethod(
"drawPie", "drawPie",
"draws a Pie shape at the given coordinates and the given width and height")] "draws a Pie shape at the given coordinates and the given width and height")]
@ -232,6 +286,9 @@ namespace BizHawk.Client.EmuHawk
luaPictureBox.DrawPie(x, y, width, height, startangle, sweepangle, line, background); luaPictureBox.DrawPie(x, y, width, height, startangle, sweepangle, line, background);
} }
[LuaMethodExample(
"drawPixel",
"LuaCanvas.drawPixel( 16, 32, 0xFFFFFFFF );")]
[LuaMethod( [LuaMethod(
"drawPixel", "drawPixel",
"Draws a single pixel at the given coordinates in the given color. Color is optional (if not specified it will be drawn black)")] "Draws a single pixel at the given coordinates in the given color. Color is optional (if not specified it will be drawn black)")]
@ -248,6 +305,9 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[LuaMethodExample(
"drawPolygon",
"LuaCanvas.drawPolygon( { 10, 0x007F00FF, 0x7F7F7FFF );")]
[LuaMethod( [LuaMethod(
"drawPolygon", "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")] "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")]
@ -265,6 +325,9 @@ namespace BizHawk.Client.EmuHawk
} }
[LuaMethodExample(
"drawRectangle",
"LuaCanvas.drawRectangle( 16, 32, 77, 99, 0x007F00FF, 0x7F7F7FFF );")]
[LuaMethod( [LuaMethod(
"drawRectangle", "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")] "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")]
@ -273,6 +336,9 @@ namespace BizHawk.Client.EmuHawk
luaPictureBox.DrawRectangle(x, y, width, height, line, background); luaPictureBox.DrawRectangle(x, y, width, height, line, background);
} }
[LuaMethodExample(
"drawString",
"LuaCanvas.drawString( 16, 32, \"Some message\", 0x7F0000FF, 0x00007FFF, 8, \"Arial Narrow\", \"bold\", \"center\", \"middle\" );")]
[LuaMethod( [LuaMethod(
"drawString", "drawString",
"Alias of DrawText()")] "Alias of DrawText()")]
@ -291,6 +357,9 @@ namespace BizHawk.Client.EmuHawk
luaPictureBox.DrawText(x, y, message, forecolor, backcolor, fontsize, fontfamily, fontstyle, horizalign, vertalign); luaPictureBox.DrawText(x, y, message, forecolor, backcolor, fontsize, fontfamily, fontstyle, horizalign, vertalign);
} }
[LuaMethodExample(
"drawText",
"LuaCanvas.drawText( 16, 32, \"Some message\", 0x7F0000FF, 0x00007FFF, 8, \"Arial Narrow\", \"bold\", \"center\", \"middle\" );")]
[LuaMethod( [LuaMethod(
"drawText", "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.")] "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.")]
@ -311,6 +380,9 @@ namespace BizHawk.Client.EmuHawk
// It'd be great if these were simplified into 1 function, but I cannot figure out how to return a LuaTable from this class // It'd be great if these were simplified into 1 function, but I cannot figure out how to return a LuaTable from this class
[LuaMethodExample(
"getMouseX",
"local inLuaget = LuaCanvas.getMouseX( );")]
[LuaMethod( [LuaMethod(
"getMouseX", "getMouseX",
"Returns an integer representation of the mouse X coordinate relative to the canvas window.")] "Returns an integer representation of the mouse X coordinate relative to the canvas window.")]
@ -320,6 +392,9 @@ namespace BizHawk.Client.EmuHawk
return position.X; return position.X;
} }
[LuaMethodExample(
"getMouseY",
"local inLuaget = LuaCanvas.getMouseY( );")]
[LuaMethod( [LuaMethod(
"getMouseY", "getMouseY",
"Returns an integer representation of the mouse Y coordinate relative to the canvas window.")] "Returns an integer representation of the mouse Y coordinate relative to the canvas window.")]