Remove `[Lua*StringParam]` as they're no longer relevant
fixes 45fbdb484
This commit is contained in:
parent
5c0143d6f6
commit
5197c36a5d
|
@ -90,7 +90,6 @@ namespace BizHawk.Client.Common
|
|||
=> APIs.EmuClient.FrameSkip(numFrames);
|
||||
|
||||
[LuaMethod("get_lua_engine", "returns the name of the Lua engine currently in use")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string GetLuaEngine()
|
||||
=> _luaLibsImpl.EngineName;
|
||||
|
||||
|
@ -199,7 +198,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("client.openrom( \"C:\\\" );")]
|
||||
[LuaMethod("openrom", "opens the Open ROM dialog")]
|
||||
public void OpenRom([LuaArbitraryStringParam] string path)
|
||||
public void OpenRom(string path)
|
||||
{
|
||||
_luaLibsImpl.IsRebootingCore = true;
|
||||
APIs.EmuClient.OpenRom(path);
|
||||
|
@ -247,7 +246,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("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")]
|
||||
public void Screenshot([LuaArbitraryStringParam] string path = null)
|
||||
public void Screenshot(string path = null)
|
||||
=> APIs.EmuClient.Screenshot(path);
|
||||
|
||||
[LuaMethodExample("client.screenshottoclipboard( );")]
|
||||
|
@ -282,7 +281,6 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local curSpeed = client.getconfig().SpeedPercent")]
|
||||
[LuaMethod("getconfig", "gets the current config settings object")]
|
||||
[return: LuaArbitraryStringParam] // too hard to do properly
|
||||
public object GetConfig()
|
||||
=> ((EmulationApi) APIs.Emulation).ForbiddenConfigReference;
|
||||
|
||||
|
@ -323,7 +321,6 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local incbhver = client.getversion( );")]
|
||||
[LuaMethod("getversion", "Returns the current stable BizHawk version")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public static string GetVersion()
|
||||
{
|
||||
return VersionInfo.MainVersion;
|
||||
|
@ -331,14 +328,12 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local nlcliget = client.getavailabletools( );")]
|
||||
[LuaMethod("getavailabletools", "Returns a list of the tools currently open")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public LuaTable GetAvailableTools()
|
||||
=> _th.EnumerateToLuaTable(APIs.Tool.AvailableTools.Select(tool => tool.Name.ToLower()), indexFrom: 0);
|
||||
|
||||
[LuaMethodExample("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")]
|
||||
[return: LuaArbitraryStringParam] // too hard to do properly
|
||||
public LuaTable GetTool([LuaASCIIStringParam] string name)
|
||||
public LuaTable GetTool(string name)
|
||||
{
|
||||
var selectedTool = APIs.Tool.GetTool(name);
|
||||
return selectedTool == null ? null : _th.ObjectToTable(selectedTool);
|
||||
|
@ -346,8 +341,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("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")]
|
||||
[return: LuaArbitraryStringParam] // too hard to do properly
|
||||
public LuaTable CreateInstance([LuaASCIIStringParam] string name)
|
||||
public LuaTable CreateInstance(string name)
|
||||
{
|
||||
var instance = APIs.Tool.CreateInstance(name);
|
||||
return instance == null ? null : _th.ObjectToTable(instance);
|
||||
|
@ -390,7 +384,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("client.addcheat(\"NNNPAK\");")]
|
||||
[LuaMethod("addcheat", "adds a cheat code, if supported")]
|
||||
public void AddCheat([LuaASCIIStringParam] string code)
|
||||
public void AddCheat(string code)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(code))
|
||||
{
|
||||
|
@ -419,7 +413,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("client.removecheat(\"NNNPAK\");")]
|
||||
[LuaMethod("removecheat", "removes a cheat, if it already exists")]
|
||||
public void RemoveCheat([LuaASCIIStringParam] string code)
|
||||
public void RemoveCheat(string code)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(code))
|
||||
{
|
||||
|
|
|
@ -20,7 +20,6 @@ namespace BizHawk.Client.Common
|
|||
|
||||
//TO DO: not fully working yet!
|
||||
[LuaMethod("getluafunctionslist", "returns a list of implemented functions")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public static string GetLuaFunctionsList()
|
||||
{
|
||||
var list = new StringBuilder();
|
||||
|
@ -36,7 +35,6 @@ namespace BizHawk.Client.Common
|
|||
=> APIs.Comm.Sockets.Connected;
|
||||
|
||||
[LuaMethod("socketServerScreenShot", "sends a screenshot to the Socket server")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public string SocketServerScreenShot()
|
||||
{
|
||||
CheckSocketServer();
|
||||
|
@ -44,7 +42,6 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
[LuaMethod("socketServerScreenShotResponse", "sends a screenshot to the Socket server and retrieves the response")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public string SocketServerScreenShotResponse()
|
||||
{
|
||||
CheckSocketServer();
|
||||
|
@ -52,7 +49,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
[LuaMethod("socketServerSend", "sends a string to the Socket server")]
|
||||
public int SocketServerSend([LuaArbitraryStringParam] string SendString)
|
||||
public int SocketServerSend(string SendString)
|
||||
{
|
||||
if (!CheckSocketServer())
|
||||
{
|
||||
|
@ -69,7 +66,6 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
[LuaMethod("socketServerResponse", "Receives a message from the Socket server. Since BizHawk 2.6.2, all responses must be of the form $\"{msg.Length:D} {msg}\" i.e. prefixed with the length in base-10 and a space.")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public string SocketServerResponse()
|
||||
{
|
||||
CheckSocketServer();
|
||||
|
@ -90,7 +86,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
[LuaMethod("socketServerSetIp", "sets the IP address of the Lua socket server")]
|
||||
public void SocketServerSetIp([LuaASCIIStringParam] string ip)
|
||||
public void SocketServerSetIp(string ip)
|
||||
{
|
||||
CheckSocketServer();
|
||||
APIs.Comm.Sockets.IP = ip;
|
||||
|
@ -104,7 +100,6 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
[LuaMethod("socketServerGetIp", "returns the IP address of the Lua socket server")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string SocketServerGetIp()
|
||||
{
|
||||
return APIs.Comm.Sockets?.IP;
|
||||
|
@ -117,7 +112,6 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
[LuaMethod("socketServerGetInfo", "returns the IP and port of the Lua socket server")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string SocketServerGetInfo()
|
||||
{
|
||||
return CheckSocketServer()
|
||||
|
@ -138,11 +132,10 @@ namespace BizHawk.Client.Common
|
|||
|
||||
// All MemoryMappedFile related methods
|
||||
[LuaMethod("mmfSetFilename", "Sets the filename for the screenshots")]
|
||||
public void MmfSetFilename([LuaArbitraryStringParam] string filename)
|
||||
public void MmfSetFilename(string filename)
|
||||
=> APIs.Comm.MMF.Filename = filename;
|
||||
|
||||
[LuaMethod("mmfGetFilename", "Gets the filename for the screenshots")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public string MmfGetFilename()
|
||||
=> APIs.Comm.MMF.Filename;
|
||||
|
||||
|
@ -151,41 +144,39 @@ namespace BizHawk.Client.Common
|
|||
=> APIs.Comm.MMF.ScreenShotToFile();
|
||||
|
||||
[LuaMethod("mmfWrite", "Writes a string to a memory mapped file")]
|
||||
public int MmfWrite([LuaArbitraryStringParam] string mmf_filename, [LuaArbitraryStringParam] string outputString)
|
||||
public int MmfWrite(string mmf_filename, string outputString)
|
||||
=> APIs.Comm.MMF.WriteToFile(mmf_filename, outputString);
|
||||
|
||||
[LuaMethod("mmfWriteBytes", "Write bytes to a memory mapped file")]
|
||||
public int MmfWriteBytes([LuaArbitraryStringParam] string mmf_filename, LuaTable byteArray)
|
||||
public int MmfWriteBytes(string mmf_filename, LuaTable byteArray)
|
||||
=> APIs.Comm.MMF.WriteToFile(mmf_filename, _th.EnumerateValues<long>(byteArray).Select(l => (byte) l).ToArray());
|
||||
|
||||
[LuaMethod("mmfCopyFromMemory", "Copy a section of the memory to a memory mapped file")]
|
||||
public int MmfCopyFromMemory(
|
||||
[LuaArbitraryStringParam] string mmf_filename,
|
||||
string mmf_filename,
|
||||
long addr,
|
||||
int length,
|
||||
[LuaASCIIStringParam] string domain)
|
||||
string domain)
|
||||
=> APIs.Comm.MMF.WriteToFile(mmf_filename, APIs.Memory.ReadByteRange(addr, length, domain).ToArray());
|
||||
|
||||
[LuaMethod("mmfCopyToMemory", "Copy a memory mapped file to a section of the memory")]
|
||||
public void MmfCopyToMemory(
|
||||
[LuaArbitraryStringParam] string mmf_filename,
|
||||
string mmf_filename,
|
||||
long addr,
|
||||
int length,
|
||||
[LuaASCIIStringParam] string domain)
|
||||
string domain)
|
||||
=> APIs.Memory.WriteByteRange(addr, new List<byte>(APIs.Comm.MMF.ReadBytesFromFile(mmf_filename, length)), domain);
|
||||
|
||||
[LuaMethod("mmfRead", "Reads a string from a memory mapped file")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public string MmfRead([LuaArbitraryStringParam] string mmf_filename, int expectedSize)
|
||||
public string MmfRead(string mmf_filename, int expectedSize)
|
||||
=> APIs.Comm.MMF.ReadFromFile(mmf_filename, expectedSize);
|
||||
|
||||
[LuaMethod("mmfReadBytes", "Reads bytes from a memory mapped file")]
|
||||
public LuaTable MmfReadBytes([LuaArbitraryStringParam] string mmf_filename, int expectedSize)
|
||||
public LuaTable MmfReadBytes(string mmf_filename, int expectedSize)
|
||||
=> _th.ListToTable(APIs.Comm.MMF.ReadBytesFromFile(mmf_filename, expectedSize), indexFrom: 0);
|
||||
|
||||
// All HTTP related methods
|
||||
[LuaMethod("httpTest", "tests HTTP connections")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public string HttpTest()
|
||||
{
|
||||
_ = APIs.Comm.HTTP!; // to match previous behaviour
|
||||
|
@ -193,7 +184,6 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
[LuaMethod("httpTestGet", "tests the HTTP GET connection")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public string HttpTestGet()
|
||||
{
|
||||
CheckHttp();
|
||||
|
@ -201,23 +191,20 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
[LuaMethod("httpGet", "makes a HTTP GET request")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public string HttpGet([LuaArbitraryStringParam] string url)
|
||||
public string HttpGet(string url)
|
||||
{
|
||||
CheckHttp();
|
||||
return APIs.Comm.HTTP?.ExecGet(url);
|
||||
}
|
||||
|
||||
[LuaMethod("httpPost", "makes a HTTP POST request")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public string HttpPost([LuaArbitraryStringParam] string url, [LuaArbitraryStringParam] string payload)
|
||||
public string HttpPost(string url, string payload)
|
||||
{
|
||||
CheckHttp();
|
||||
return APIs.Comm.HTTP?.ExecPost(url, payload);
|
||||
}
|
||||
|
||||
[LuaMethod("httpPostScreenshot", "HTTP POST screenshot")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public string HttpPostScreenshot()
|
||||
{
|
||||
CheckHttp();
|
||||
|
@ -232,21 +219,20 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
[LuaMethod("httpSetPostUrl", "Sets HTTP POST URL")]
|
||||
public void HttpSetPostUrl([LuaArbitraryStringParam] string url)
|
||||
public void HttpSetPostUrl(string url)
|
||||
{
|
||||
CheckHttp();
|
||||
APIs.Comm.HTTP.PostUrl = url;
|
||||
}
|
||||
|
||||
[LuaMethod("httpSetGetUrl", "Sets HTTP GET URL")]
|
||||
public void HttpSetGetUrl([LuaArbitraryStringParam] string url)
|
||||
public void HttpSetGetUrl(string url)
|
||||
{
|
||||
CheckHttp();
|
||||
APIs.Comm.HTTP.GetUrl = url;
|
||||
}
|
||||
|
||||
[LuaMethod("httpGetPostUrl", "Gets HTTP POST URL")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public string HttpGetPostUrl()
|
||||
{
|
||||
CheckHttp();
|
||||
|
@ -254,7 +240,6 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
[LuaMethod("httpGetGetUrl", "Gets HTTP GET URL")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public string HttpGetGetUrl()
|
||||
{
|
||||
CheckHttp();
|
||||
|
@ -272,8 +257,7 @@ namespace BizHawk.Client.Common
|
|||
#if ENABLE_WEBSOCKETS
|
||||
[LuaMethod("ws_open", "Opens a websocket and returns the id so that it can be retrieved later.")]
|
||||
[LuaMethodExample("local ws_id = comm.ws_open(\"wss://echo.websocket.org\");")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string WebSocketOpen([LuaArbitraryStringParam] string uri)
|
||||
public string WebSocketOpen(string uri)
|
||||
{
|
||||
var wsServer = APIs.Comm.WebSockets;
|
||||
if (wsServer == null)
|
||||
|
@ -289,8 +273,8 @@ namespace BizHawk.Client.Common
|
|||
[LuaMethod("ws_send", "Send a message to a certain websocket id (boolean flag endOfMessage)")]
|
||||
[LuaMethodExample("local ws = comm.ws_send(ws_id, \"some message\", true);")]
|
||||
public void WebSocketSend(
|
||||
[LuaASCIIStringParam] string guid,
|
||||
[LuaArbitraryStringParam] string content,
|
||||
string guid,
|
||||
string content,
|
||||
bool endOfMessage)
|
||||
{
|
||||
if (_websockets.TryGetValue(Guid.Parse(guid), out var wrapper)) wrapper.Send(content, endOfMessage);
|
||||
|
@ -298,15 +282,14 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethod("ws_receive", "Receive a message from a certain websocket id and a maximum number of bytes to read")]
|
||||
[LuaMethodExample("local ws = comm.ws_receive(ws_id, str_len);")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public string WebSocketReceive([LuaASCIIStringParam] string guid, int bufferCap)
|
||||
public string WebSocketReceive(string guid, int bufferCap)
|
||||
=> _websockets.TryGetValue(Guid.Parse(guid), out var wrapper)
|
||||
? wrapper.Receive(bufferCap)
|
||||
: null;
|
||||
|
||||
[LuaMethod("ws_get_status", "Get a websocket's status")]
|
||||
[LuaMethodExample("local ws_status = comm.ws_get_status(ws_id);")]
|
||||
public int? WebSocketGetStatus([LuaASCIIStringParam] string guid)
|
||||
public int? WebSocketGetStatus(string guid)
|
||||
=> _websockets.TryGetValue(Guid.Parse(guid), out var wrapper)
|
||||
? (int) wrapper.State
|
||||
: (int?) null;
|
||||
|
@ -314,9 +297,9 @@ namespace BizHawk.Client.Common
|
|||
[LuaMethod("ws_close", "Close a websocket connection with a close status")]
|
||||
[LuaMethodExample("local ws_status = comm.ws_close(ws_id, close_status);")]
|
||||
public void WebSocketClose(
|
||||
[LuaASCIIStringParam] string guid,
|
||||
string guid,
|
||||
WebSocketCloseStatus status,
|
||||
[LuaArbitraryStringParam] string closeMessage)
|
||||
string closeMessage)
|
||||
{
|
||||
if (_websockets.TryGetValue(Guid.Parse(guid), out var wrapper)) wrapper.Close(status, closeMessage);
|
||||
}
|
||||
|
|
|
@ -38,8 +38,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("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")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public LuaTable Disassemble(uint pc, [LuaASCIIStringParam] string name = "")
|
||||
public LuaTable Disassemble(uint pc, string name = "")
|
||||
{
|
||||
var (disasm, length) = APIs.Emulation.Disassemble(pc, name);
|
||||
if (length is 0) return null;
|
||||
|
@ -52,18 +51,17 @@ namespace BizHawk.Client.Common
|
|||
// TODO: what about 64 bit registers?
|
||||
[LuaMethodExample("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")]
|
||||
public int GetRegister([LuaASCIIStringParam] string name)
|
||||
public int GetRegister(string name)
|
||||
=> (int?) APIs.Emulation.GetRegister(name) ?? 0;
|
||||
|
||||
[LuaMethodExample("local nlemuget = emu.getregisters( );")]
|
||||
[LuaMethod("getregisters", "returns the complete set of available flags and registers for a given core")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public LuaTable GetRegisters()
|
||||
=> _th.DictToTable(APIs.Emulation.GetRegisters());
|
||||
|
||||
[LuaMethodExample("emu.setregister( emu.getregisters( )[ 0 ], -1000 );")]
|
||||
[LuaMethod("setregister", "sets the given register name to the given value")]
|
||||
public void SetRegister([LuaASCIIStringParam] string register, int value)
|
||||
public void SetRegister(string register, int value)
|
||||
=> APIs.Emulation.SetRegister(register, value);
|
||||
|
||||
[LuaMethodExample("local inemutot = emu.totalexecutedcycles( );")]
|
||||
|
@ -73,7 +71,6 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local stemuget = emu.getsystemid( );")]
|
||||
[LuaMethod("getsystemid", "Returns the ID string of the current core loaded. Note: No ROM loaded will return the string NULL")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string GetSystemId()
|
||||
=> APIs.Emulation.GetSystemId();
|
||||
|
||||
|
@ -121,19 +118,16 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local stemuget = emu.getdisplaytype();")]
|
||||
[LuaMethod("getdisplaytype", "returns the display type (PAL vs NTSC) that the emulator is currently running in")]
|
||||
[return: LuaEnumStringParam]
|
||||
public string GetDisplayType()
|
||||
=> APIs.Emulation.GetDisplayType();
|
||||
|
||||
[LuaMethodExample("local stemuget = emu.getboardname();")]
|
||||
[LuaMethod("getboardname", "returns (if available) the board name of the loaded ROM")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string GetBoardName()
|
||||
=> APIs.Emulation.GetBoardName();
|
||||
|
||||
[LuaDeprecatedMethod]
|
||||
[LuaMethod("getluacore", "returns the name of the Lua core currently in use")]
|
||||
[return: LuaEnumStringParam]
|
||||
public string GetLuaBackend()
|
||||
{
|
||||
Log("Deprecated function emu.getluacore() used, replace the call with client.get_lua_engine().");
|
||||
|
|
|
@ -17,13 +17,11 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local stgamget = gameinfo.getromname( );")]
|
||||
[LuaMethod("getromname", "returns the name of the currently loaded rom, if a rom is loaded")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public string GetRomName()
|
||||
=> APIs.Emulation.GetGameInfo()?.Name ?? string.Empty;
|
||||
|
||||
[LuaMethodExample("local stgamget = gameinfo.getromhash( );")]
|
||||
[LuaMethod("getromhash", "returns the hash of the currently loaded rom, if a rom is loaded")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string GetRomHash()
|
||||
=> APIs.Emulation.GetGameInfo()?.Hash ?? string.Empty;
|
||||
|
||||
|
@ -34,7 +32,6 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("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")]
|
||||
[return: LuaEnumStringParam]
|
||||
public string GetStatus()
|
||||
=> (APIs.Emulation.GetGameInfo()?.Status)?.ToString();
|
||||
|
||||
|
@ -45,13 +42,11 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("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")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public string GetBoardType()
|
||||
=> APIs.Emulation.GetBoardName();
|
||||
|
||||
[LuaMethodExample("local nlgamget = gameinfo.getoptions( );")]
|
||||
[LuaMethod("getoptions", "returns the game options for the currently loaded rom. Options vary per platform")]
|
||||
[return: LuaASCIIStringParam] // these had better be just flags and not anything localised --yoshi
|
||||
public LuaTable GetOptions()
|
||||
=> _th.DictToTable(APIs.Emulation.GetGameOptions());
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace BizHawk.Client.Common
|
|||
#pragma warning disable CS0612
|
||||
[LuaDeprecatedMethod]
|
||||
[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([LuaEnumStringParam] string name, bool? clear = true)
|
||||
public void DrawNew(string name, bool? clear = true)
|
||||
=> APIs.Gui.DrawNew(name, clear ?? true);
|
||||
|
||||
[LuaDeprecatedMethod]
|
||||
|
@ -34,12 +34,12 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("gui.addmessage( \"Some message\" );")]
|
||||
[LuaMethod("addmessage", "Adds a message to the OSD's message area")]
|
||||
public void AddMessage([LuaArbitraryStringParam] string message)
|
||||
public void AddMessage(string message)
|
||||
=> APIs.Gui.AddMessage(message);
|
||||
|
||||
[LuaMethodExample("gui.clearGraphics( );")]
|
||||
[LuaMethod("clearGraphics", "clears all lua drawn graphics from the screen")]
|
||||
public void ClearGraphics([LuaEnumStringParam] string surfaceName = null)
|
||||
public void ClearGraphics(string surfaceName = null)
|
||||
=> APIs.Gui.ClearGraphics(surfaceID: UseOrFallback(surfaceName));
|
||||
|
||||
[LuaMethodExample("gui.cleartext( );")]
|
||||
|
@ -64,7 +64,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("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")]
|
||||
public void SetDefaultPixelFont([LuaASCIIStringParam] string fontfamily)
|
||||
public void SetDefaultPixelFont(string fontfamily)
|
||||
=> APIs.Gui.SetDefaultPixelFont(fontfamily);
|
||||
|
||||
[LuaMethodExample("gui.drawBezier( { { 5, 10 }, { 10, 10 }, { 10, 20 }, { 5, 20 } }, 0x000000FF );")]
|
||||
|
@ -72,7 +72,7 @@ namespace BizHawk.Client.Common
|
|||
public void DrawBezier(
|
||||
LuaTable points,
|
||||
[LuaColorParam] object color,
|
||||
[LuaEnumStringParam] string surfaceName = null)
|
||||
string surfaceName = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -105,7 +105,7 @@ namespace BizHawk.Client.Common
|
|||
int y2,
|
||||
[LuaColorParam] object line = null,
|
||||
[LuaColorParam] object background = null,
|
||||
[LuaEnumStringParam] string surfaceName = null)
|
||||
string surfaceName = null)
|
||||
=> APIs.Gui.DrawBox(x, y, x2, y2, _th.SafeParseColor(line), _th.SafeParseColor(background), surfaceID: UseOrFallback(surfaceName));
|
||||
|
||||
[LuaMethodExample("gui.drawEllipse( 16, 32, 77, 99, 0x007F00FF, 0x7F7F7FFF );")]
|
||||
|
@ -117,30 +117,30 @@ namespace BizHawk.Client.Common
|
|||
int height,
|
||||
[LuaColorParam] object line = null,
|
||||
[LuaColorParam] object background = null,
|
||||
[LuaEnumStringParam] string surfaceName = null)
|
||||
string surfaceName = null)
|
||||
=> APIs.Gui.DrawEllipse(x, y, width, height, _th.SafeParseColor(line), _th.SafeParseColor(background), surfaceID: UseOrFallback(surfaceName));
|
||||
|
||||
[LuaMethodExample("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")]
|
||||
public void DrawIcon(
|
||||
[LuaArbitraryStringParam] string path,
|
||||
string path,
|
||||
int x,
|
||||
int y,
|
||||
int? width = null,
|
||||
int? height = null,
|
||||
[LuaEnumStringParam] string surfaceName = null)
|
||||
string surfaceName = null)
|
||||
=> APIs.Gui.DrawIcon(path, x, y, width, height, surfaceID: UseOrFallback(surfaceName));
|
||||
|
||||
[LuaMethodExample("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")]
|
||||
public void DrawImage(
|
||||
[LuaArbitraryStringParam] string path,
|
||||
string path,
|
||||
int x,
|
||||
int y,
|
||||
int? width = null,
|
||||
int? height = null,
|
||||
bool cache = true,
|
||||
[LuaEnumStringParam] string surfaceName = null)
|
||||
string surfaceName = null)
|
||||
=> APIs.Gui.DrawImage(path, x, y, width, height, cache, surfaceID: UseOrFallback(surfaceName));
|
||||
|
||||
[LuaMethodExample("gui.clearImageCache( );")]
|
||||
|
@ -151,7 +151,7 @@ namespace BizHawk.Client.Common
|
|||
[LuaMethodExample("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")]
|
||||
public void DrawImageRegion(
|
||||
[LuaArbitraryStringParam] string path,
|
||||
string path,
|
||||
int source_x,
|
||||
int source_y,
|
||||
int source_width,
|
||||
|
@ -160,7 +160,7 @@ namespace BizHawk.Client.Common
|
|||
int dest_y,
|
||||
int? dest_width = null,
|
||||
int? dest_height = null,
|
||||
[LuaEnumStringParam] string surfaceName = null)
|
||||
string surfaceName = null)
|
||||
=> APIs.Gui.DrawImageRegion(path, source_x, source_y, source_width, source_height, dest_x, dest_y, dest_width, dest_height, surfaceID: UseOrFallback(surfaceName));
|
||||
|
||||
[LuaMethodExample("gui.drawLine( 161, 321, 162, 322, 0xFFFFFFFF );")]
|
||||
|
@ -171,7 +171,7 @@ namespace BizHawk.Client.Common
|
|||
int x2,
|
||||
int y2,
|
||||
[LuaColorParam] object color = null,
|
||||
[LuaEnumStringParam] string surfaceName = null)
|
||||
string surfaceName = null)
|
||||
=> APIs.Gui.DrawLine(x1, y1, x2, y2, _th.SafeParseColor(color), surfaceID: UseOrFallback(surfaceName));
|
||||
|
||||
[LuaMethodExample("gui.drawAxis( 16, 32, 15, 0xFFFFFFFF );")]
|
||||
|
@ -181,7 +181,7 @@ namespace BizHawk.Client.Common
|
|||
int y,
|
||||
int size,
|
||||
[LuaColorParam] object color = null,
|
||||
[LuaEnumStringParam] string surfaceName = null)
|
||||
string surfaceName = null)
|
||||
=> APIs.Gui.DrawAxis(x, y, size, _th.SafeParseColor(color), surfaceID: UseOrFallback(surfaceName));
|
||||
|
||||
[LuaMethodExample("gui.drawPie( 16, 32, 77, 99, 180, 90, 0x007F00FF, 0x7F7F7FFF );")]
|
||||
|
@ -195,7 +195,7 @@ namespace BizHawk.Client.Common
|
|||
int sweepangle,
|
||||
[LuaColorParam] object line = null,
|
||||
[LuaColorParam] object background = null,
|
||||
[LuaEnumStringParam] string surfaceName = null)
|
||||
string surfaceName = null)
|
||||
=> APIs.Gui.DrawPie(x, y, width, height, startangle, sweepangle, _th.SafeParseColor(line), _th.SafeParseColor(background), surfaceID: UseOrFallback(surfaceName));
|
||||
|
||||
[LuaMethodExample("gui.drawPixel( 16, 32, 0xFFFFFFFF );")]
|
||||
|
@ -204,7 +204,7 @@ namespace BizHawk.Client.Common
|
|||
int x,
|
||||
int y,
|
||||
[LuaColorParam] object color = null,
|
||||
[LuaEnumStringParam] string surfaceName = null)
|
||||
string surfaceName = null)
|
||||
=> APIs.Gui.DrawPixel(x, y, _th.SafeParseColor(color), surfaceID: UseOrFallback(surfaceName));
|
||||
|
||||
[LuaMethodExample("gui.drawPolygon( { { 5, 10 }, { 10, 10 }, { 10, 20 }, { 5, 20 } }, 10, 30, 0x007F00FF, 0x7F7F7FFF );")]
|
||||
|
@ -215,7 +215,7 @@ namespace BizHawk.Client.Common
|
|||
int? offsetY = null,
|
||||
[LuaColorParam] object line = null,
|
||||
[LuaColorParam] object background = null,
|
||||
[LuaEnumStringParam] string surfaceName = null)
|
||||
string surfaceName = null)
|
||||
{
|
||||
var pointsList = _th.EnumerateValues<LuaTable>(points)
|
||||
.Select(table => _th.EnumerateValues<long>(table).ToList()).ToList();
|
||||
|
@ -245,7 +245,7 @@ namespace BizHawk.Client.Common
|
|||
int height,
|
||||
[LuaColorParam] object line = null,
|
||||
[LuaColorParam] object background = null,
|
||||
[LuaEnumStringParam] string surfaceName = null)
|
||||
string surfaceName = null)
|
||||
=> APIs.Gui.DrawRectangle(x, y, width, height, _th.SafeParseColor(line), _th.SafeParseColor(background), surfaceID: UseOrFallback(surfaceName));
|
||||
|
||||
[LuaMethodExample("gui.drawString( 16, 32, \"Some message\", 0x7F0000FF, 0x00007FFF, 8, \"Arial Narrow\", \"bold\", \"center\", \"middle\" );")]
|
||||
|
@ -253,15 +253,15 @@ namespace BizHawk.Client.Common
|
|||
public void DrawString(
|
||||
int x,
|
||||
int y,
|
||||
[LuaArbitraryStringParam] string message,
|
||||
string message,
|
||||
[LuaColorParam] object forecolor = null,
|
||||
[LuaColorParam] object backcolor = null,
|
||||
int? fontsize = null,
|
||||
[LuaASCIIStringParam] string fontfamily = null,
|
||||
[LuaEnumStringParam] string fontstyle = null,
|
||||
[LuaEnumStringParam] string horizalign = null,
|
||||
[LuaEnumStringParam] string vertalign = null,
|
||||
[LuaEnumStringParam] string surfaceName = null)
|
||||
string fontfamily = null,
|
||||
string fontstyle = null,
|
||||
string horizalign = null,
|
||||
string vertalign = null,
|
||||
string surfaceName = null)
|
||||
{
|
||||
DrawText(x, y, message, _th.SafeParseColor(forecolor), _th.SafeParseColor(backcolor), fontsize, fontfamily, fontstyle, horizalign, vertalign, surfaceName: surfaceName);
|
||||
}
|
||||
|
@ -271,15 +271,15 @@ namespace BizHawk.Client.Common
|
|||
public void DrawText(
|
||||
int x,
|
||||
int y,
|
||||
[LuaArbitraryStringParam] string message,
|
||||
string message,
|
||||
[LuaColorParam] object forecolor = null,
|
||||
[LuaColorParam] object backcolor = null,
|
||||
int? fontsize = null,
|
||||
[LuaASCIIStringParam] string fontfamily = null,
|
||||
[LuaEnumStringParam] string fontstyle = null,
|
||||
[LuaEnumStringParam] string horizalign = null,
|
||||
[LuaEnumStringParam] string vertalign = null,
|
||||
[LuaEnumStringParam] string surfaceName = null)
|
||||
string fontfamily = null,
|
||||
string fontstyle = null,
|
||||
string horizalign = null,
|
||||
string vertalign = null,
|
||||
string surfaceName = null)
|
||||
=> APIs.Gui.DrawString(x, y, message, _th.SafeParseColor(forecolor), _th.SafeParseColor(backcolor), fontsize, fontfamily, fontstyle, horizalign, vertalign, surfaceID: UseOrFallback(surfaceName));
|
||||
|
||||
[LuaMethodExample("gui.pixelText( 16, 32, \"Some message\", 0x7F0000FF, 0x00007FFF, \"Arial Narrow\" );")]
|
||||
|
@ -287,11 +287,11 @@ namespace BizHawk.Client.Common
|
|||
public void DrawText(
|
||||
int x,
|
||||
int y,
|
||||
[LuaArbitraryStringParam] string message,
|
||||
string message,
|
||||
[LuaColorParam] object forecolor = null,
|
||||
[LuaColorParam] object backcolor = null,
|
||||
[LuaASCIIStringParam] string fontfamily = null,
|
||||
[LuaEnumStringParam] string surfaceName = null)
|
||||
string fontfamily = null,
|
||||
string surfaceName = null)
|
||||
=> APIs.Gui.DrawText(x, y, message, _th.SafeParseColor(forecolor), _th.SafeParseColor(backcolor) ?? APIs.Gui.GetDefaultTextBackground().Value, fontfamily, surfaceID: UseOrFallback(surfaceName));
|
||||
|
||||
[LuaMethodExample("gui.text( 16, 32, \"Some message\", 0x7F0000FF, \"bottomleft\" );")]
|
||||
|
@ -299,20 +299,19 @@ namespace BizHawk.Client.Common
|
|||
public void Text(
|
||||
int x,
|
||||
int y,
|
||||
[LuaArbitraryStringParam] string message,
|
||||
string message,
|
||||
[LuaColorParam] object forecolor = null,
|
||||
[LuaEnumStringParam] string anchor = null)
|
||||
string anchor = null)
|
||||
=> APIs.Gui.Text(x, y, message, _th.SafeParseColor(forecolor), anchor);
|
||||
|
||||
[LuaMethodExample("local nlguicre = gui.createcanvas( 77, 99, 2, 48 );")]
|
||||
[LuaMethod("createcanvas", "Creates a canvas of the given size and, if specified, the given coordinates.")]
|
||||
[return: LuaArbitraryStringParam] // too hard to do properly
|
||||
public LuaTable Text(int width, int height, int? x = null, int? y = null)
|
||||
=> CreateLuaCanvasCallback(width, height, x, y);
|
||||
|
||||
[LuaMethodExample("gui.use_surface( \"client\" );")]
|
||||
[LuaMethod("use_surface", "Stores the name of a surface to draw on, so you don't need to pass it to every draw function. The default is \"emucore\", and the other valid value is \"client\".")]
|
||||
public void UseSurface([LuaEnumStringParam] string surfaceName)
|
||||
public void UseSurface(string surfaceName)
|
||||
{
|
||||
if (surfaceName == null)
|
||||
{
|
||||
|
|
|
@ -14,14 +14,12 @@ namespace BizHawk.Client.Common
|
|||
#pragma warning disable CS0612
|
||||
[LuaMethodExample("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.")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public LuaTable Get()
|
||||
=> _th.DictToTable(APIs.Input.Get());
|
||||
#pragma warning restore CS0612
|
||||
|
||||
[LuaMethodExample("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.")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public LuaTable GetMouse()
|
||||
=> _th.DictToTable(APIs.Input.GetMouse());
|
||||
}
|
||||
|
|
|
@ -16,30 +16,27 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("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")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public LuaTable Get(int? controller = null)
|
||||
=> _th.DictToTable(APIs.Joypad.Get(controller));
|
||||
|
||||
[LuaMethodExample("local nljoyget = joypad.getwithmovie( 1 );")]
|
||||
[LuaMethod("getwithmovie", "returns a lua table of the controller buttons pressed, including ones pressed by the current movie. If supplied, it will only return a table of buttons for the given controller")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public LuaTable GetWithMovie(int? controller = null)
|
||||
=> _th.DictToTable(APIs.Joypad.GetWithMovie(controller));
|
||||
|
||||
[LuaMethodExample("local nljoyget = joypad.getimmediate( );")]
|
||||
[LuaMethod("getimmediate", "returns a lua table of any controller buttons currently pressed by the user")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public LuaTable GetImmediate(int? controller = null)
|
||||
=> _th.DictToTable(APIs.Joypad.GetImmediate(controller));
|
||||
|
||||
[LuaMethodExample("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 interpreted the same way an entry from a movie input log would be")]
|
||||
public void SetFromMnemonicStr([LuaASCIIStringParam] string inputLogEntry)
|
||||
public void SetFromMnemonicStr(string inputLogEntry)
|
||||
=> APIs.Joypad.SetFromMnemonicStr(inputLogEntry);
|
||||
|
||||
[LuaMethodExample("joypad.set( { [\"Left\"] = true, [ \"A\" ] = true, [ \"B\" ] = true } );")]
|
||||
[LuaMethod("set", "sets the given buttons to their provided values for the current frame")]
|
||||
public void Set([LuaArbitraryStringParam] LuaTable buttons, int? controller = null)
|
||||
public void Set(LuaTable buttons, int? controller = null)
|
||||
{
|
||||
var dict = new Dictionary<string, bool>();
|
||||
foreach (var (k, v) in _th.EnumerateEntries<object, object>(buttons))
|
||||
|
@ -51,7 +48,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("joypad.setanalog( { [ \"Tilt X\" ] = -63, [ \"Tilt Y\" ] = 127 } );")]
|
||||
[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([LuaArbitraryStringParam] LuaTable controls, int? controller = null)
|
||||
public void SetAnalog(LuaTable controls, int? controller = null)
|
||||
{
|
||||
var dict = new Dictionary<string, int?>();
|
||||
foreach (var (k, v) in _th.EnumerateEntries<object, object>(controls))
|
||||
|
|
|
@ -18,18 +18,16 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("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")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public LuaTable GetMemoryDomainList()
|
||||
=> _th.ListToTable((List<string>) APIs.Memory.GetMemoryDomainList(), indexFrom: 0); //HACK cast will succeed as long as impl. returns .Select<T, string>().ToList() as IROC<string>
|
||||
|
||||
[LuaMethodExample("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")]
|
||||
public uint GetMemoryDomainSize([LuaASCIIStringParam] string name = "")
|
||||
public uint GetMemoryDomainSize(string name = "")
|
||||
=> APIs.Memory.GetMemoryDomainSize(name);
|
||||
|
||||
[LuaMethodExample("local stmemget = memory.getcurrentmemorydomain( );")]
|
||||
[LuaMethod("getcurrentmemorydomain", "Returns a string name of the current memory domain selected by Lua. The default is Main memory")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string GetCurrentMemoryDomain()
|
||||
=> APIs.Memory.GetCurrentMemoryDomain();
|
||||
|
||||
|
@ -40,43 +38,42 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("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")]
|
||||
public bool UseMemoryDomain([LuaASCIIStringParam] string domain)
|
||||
public bool UseMemoryDomain(string domain)
|
||||
=> APIs.Memory.UseMemoryDomain(domain);
|
||||
|
||||
[LuaMethodExample("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.")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string HashRegion(long addr, int count, [LuaASCIIStringParam] string domain = null)
|
||||
public string HashRegion(long addr, int count, string domain = null)
|
||||
=> APIs.Memory.HashRegion(addr, count, domain);
|
||||
|
||||
[LuaMethodExample("local uimemrea = memory.readbyte( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("readbyte", "gets the value from the given address as an unsigned byte")]
|
||||
public uint ReadByte(long addr, [LuaASCIIStringParam] string domain = null)
|
||||
public uint ReadByte(long addr, string domain = null)
|
||||
=> APIs.Memory.ReadByte(addr, domain);
|
||||
|
||||
[LuaMethodExample("memory.writebyte( 0x100, 1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("writebyte", "Writes the given value to the given address as an unsigned byte")]
|
||||
public void WriteByte(long addr, uint value, [LuaASCIIStringParam] string domain = null)
|
||||
public void WriteByte(long addr, uint value, string domain = null)
|
||||
=> APIs.Memory.WriteByte(addr, value, domain);
|
||||
|
||||
[LuaDeprecatedMethod]
|
||||
[LuaMethod("readbyterange", "Reads the address range that starts from address, and is length long. Returns a zero-indexed table containing the read values (an array of bytes.)")]
|
||||
public LuaTable ReadByteRange(long addr, int length, [LuaASCIIStringParam] string domain = null)
|
||||
public LuaTable ReadByteRange(long addr, int length, string domain = null)
|
||||
=> _th.ListToTable(APIs.Memory.ReadByteRange(addr, length, domain), indexFrom: 0);
|
||||
|
||||
[LuaMethodExample("local bytes = memory.read_bytes_as_array(0x100, 30, \"WRAM\");")]
|
||||
[LuaMethod("read_bytes_as_array", "Reads length bytes starting at addr into an array-like table (1-indexed).")]
|
||||
public LuaTable ReadBytesAsArray(long addr, int length, [LuaASCIIStringParam] string domain = null)
|
||||
public LuaTable ReadBytesAsArray(long addr, int length, string domain = null)
|
||||
=> _th.ListToTable(APIs.Memory.ReadByteRange(addr, length, domain));
|
||||
|
||||
[LuaMethodExample("local bytes = memory.read_bytes_as_dict(0x100, 30, \"WRAM\");")]
|
||||
[LuaMethod("read_bytes_as_dict", "Reads length bytes starting at addr into a dict-like table (where the keys are the addresses, relative to the start of the domain).")]
|
||||
public LuaTable ReadBytesAsDict(long addr, int length, [LuaASCIIStringParam] string domain = null)
|
||||
public LuaTable ReadBytesAsDict(long addr, int length, string domain = null)
|
||||
=> _th.MemoryBlockToTable(APIs.Memory.ReadByteRange(addr, length, domain), addr);
|
||||
|
||||
[LuaDeprecatedMethod]
|
||||
[LuaMethod("writebyterange", "Writes the given values to the given addresses as unsigned bytes")]
|
||||
public void WriteByteRange(LuaTable memoryblock, [LuaASCIIStringParam] string domain = null)
|
||||
public void WriteByteRange(LuaTable memoryblock, string domain = null)
|
||||
{
|
||||
#if true
|
||||
WriteBytesAsDict(memoryblock, domain);
|
||||
|
@ -105,12 +102,12 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("memory.write_bytes_as_array(0x100, { 0xAB, 0x12, 0xCD, 0x34 });")]
|
||||
[LuaMethod("write_bytes_as_array", "Writes sequential bytes starting at addr.")]
|
||||
public void WriteBytesAsArray(long addr, LuaTable bytes, [LuaASCIIStringParam] string domain = null)
|
||||
public void WriteBytesAsArray(long addr, LuaTable bytes, string domain = null)
|
||||
=> APIs.Memory.WriteByteRange(addr, _th.EnumerateValues<long>(bytes).Select(l => (byte) l).ToList(), domain);
|
||||
|
||||
[LuaMethodExample("memory.write_bytes_as_dict({ [0x100] = 0xAB, [0x104] = 0xCD, [0x106] = 0x12, [0x107] = 0x34, [0x108] = 0xEF });")]
|
||||
[LuaMethod("write_bytes_as_dict", "Writes bytes at arbitrary addresses (the keys of the given table are the addresses, relative to the start of the domain).")]
|
||||
public void WriteBytesAsDict(LuaTable addrMap, [LuaASCIIStringParam] string domain = null)
|
||||
public void WriteBytesAsDict(LuaTable addrMap, string domain = null)
|
||||
{
|
||||
foreach (var (addr, v) in _th.EnumerateEntries<long, long>(addrMap))
|
||||
{
|
||||
|
@ -120,7 +117,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("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")]
|
||||
public float ReadFloat(long addr, bool bigendian, [LuaASCIIStringParam] string domain = null)
|
||||
public float ReadFloat(long addr, bool bigendian, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian(bigendian);
|
||||
return APIs.Memory.ReadFloat(addr, domain);
|
||||
|
@ -128,7 +125,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("memory.writefloat( 0x100, 10.0, false, mainmemory.getname( ) );")]
|
||||
[LuaMethod("writefloat", "Writes the given 32-bit float value to the given address and endian")]
|
||||
public void WriteFloat(long addr, double value, bool bigendian, [LuaASCIIStringParam] string domain = null)
|
||||
public void WriteFloat(long addr, double value, bool bigendian, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian(bigendian);
|
||||
APIs.Memory.WriteFloat(addr, value, domain);
|
||||
|
@ -136,27 +133,27 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local inmemrea = memory.read_s8( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_s8", "read signed byte")]
|
||||
public int ReadS8(long addr, [LuaASCIIStringParam] string domain = null)
|
||||
public int ReadS8(long addr, string domain = null)
|
||||
=> APIs.Memory.ReadS8(addr, domain);
|
||||
|
||||
[LuaMethodExample("memory.write_s8( 0x100, 1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_s8", "write signed byte")]
|
||||
public void WriteS8(long addr, uint value, [LuaASCIIStringParam] string domain = null)
|
||||
public void WriteS8(long addr, uint value, string domain = null)
|
||||
=> APIs.Memory.WriteS8(addr, unchecked((int) value), domain);
|
||||
|
||||
[LuaMethodExample("local uimemrea = memory.read_u8( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_u8", "read unsigned byte")]
|
||||
public uint ReadU8(long addr, [LuaASCIIStringParam] string domain = null)
|
||||
public uint ReadU8(long addr, string domain = null)
|
||||
=> APIs.Memory.ReadU8(addr, domain);
|
||||
|
||||
[LuaMethodExample("memory.write_u8( 0x100, 1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_u8", "write unsigned byte")]
|
||||
public void WriteU8(long addr, uint value, [LuaASCIIStringParam] string domain = null)
|
||||
public void WriteU8(long addr, uint value, string domain = null)
|
||||
=> APIs.Memory.WriteU8(addr, value, domain);
|
||||
|
||||
[LuaMethodExample("local inmemrea = memory.read_s16_le( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_s16_le", "read signed 2 byte value, little endian")]
|
||||
public int ReadS16Little(long addr, [LuaASCIIStringParam] string domain = null)
|
||||
public int ReadS16Little(long addr, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian(false);
|
||||
return APIs.Memory.ReadS16(addr, domain);
|
||||
|
@ -164,7 +161,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("memory.write_s16_le( 0x100, -1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_s16_le", "write signed 2 byte value, little endian")]
|
||||
public void WriteS16Little(long addr, int value, [LuaASCIIStringParam] string domain = null)
|
||||
public void WriteS16Little(long addr, int value, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian(false);
|
||||
APIs.Memory.WriteS16(addr, value, domain);
|
||||
|
@ -172,7 +169,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local inmemrea = memory.read_s16_be( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_s16_be", "read signed 2 byte value, big endian")]
|
||||
public int ReadS16Big(long addr, [LuaASCIIStringParam] string domain = null)
|
||||
public int ReadS16Big(long addr, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian();
|
||||
return APIs.Memory.ReadS16(addr, domain);
|
||||
|
@ -180,7 +177,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("memory.write_s16_be( 0x100, -1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_s16_be", "write signed 2 byte value, big endian")]
|
||||
public void WriteS16Big(long addr, int value, [LuaASCIIStringParam] string domain = null)
|
||||
public void WriteS16Big(long addr, int value, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian();
|
||||
APIs.Memory.WriteS16(addr, value, domain);
|
||||
|
@ -188,7 +185,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local uimemrea = memory.read_u16_le( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_u16_le", "read unsigned 2 byte value, little endian")]
|
||||
public uint ReadU16Little(long addr, [LuaASCIIStringParam] string domain = null)
|
||||
public uint ReadU16Little(long addr, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian(false);
|
||||
return APIs.Memory.ReadU16(addr, domain);
|
||||
|
@ -196,7 +193,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("memory.write_u16_le( 0x100, 1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_u16_le", "write unsigned 2 byte value, little endian")]
|
||||
public void WriteU16Little(long addr, uint value, [LuaASCIIStringParam] string domain = null)
|
||||
public void WriteU16Little(long addr, uint value, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian(false);
|
||||
APIs.Memory.WriteU16(addr, value, domain);
|
||||
|
@ -204,7 +201,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local uimemrea = memory.read_u16_be( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_u16_be", "read unsigned 2 byte value, big endian")]
|
||||
public uint ReadU16Big(long addr, [LuaASCIIStringParam] string domain = null)
|
||||
public uint ReadU16Big(long addr, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian();
|
||||
return APIs.Memory.ReadU16(addr, domain);
|
||||
|
@ -212,7 +209,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("memory.write_u16_be( 0x100, 1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_u16_be", "write unsigned 2 byte value, big endian")]
|
||||
public void WriteU16Big(long addr, uint value, [LuaASCIIStringParam] string domain = null)
|
||||
public void WriteU16Big(long addr, uint value, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian();
|
||||
APIs.Memory.WriteU16(addr, value, domain);
|
||||
|
@ -220,7 +217,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local inmemrea = memory.read_s24_le( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_s24_le", "read signed 24 bit value, little endian")]
|
||||
public int ReadS24Little(long addr, [LuaASCIIStringParam] string domain = null)
|
||||
public int ReadS24Little(long addr, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian(false);
|
||||
return APIs.Memory.ReadS24(addr, domain);
|
||||
|
@ -228,7 +225,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("memory.write_s24_le( 0x100, -1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_s24_le", "write signed 24 bit value, little endian")]
|
||||
public void WriteS24Little(long addr, int value, [LuaASCIIStringParam] string domain = null)
|
||||
public void WriteS24Little(long addr, int value, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian(false);
|
||||
APIs.Memory.WriteS24(addr, value, domain);
|
||||
|
@ -236,7 +233,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local inmemrea = memory.read_s24_be( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_s24_be", "read signed 24 bit value, big endian")]
|
||||
public int ReadS24Big(long addr, [LuaASCIIStringParam] string domain = null)
|
||||
public int ReadS24Big(long addr, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian();
|
||||
return APIs.Memory.ReadS24(addr, domain);
|
||||
|
@ -244,7 +241,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("memory.write_s24_be( 0x100, -1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_s24_be", "write signed 24 bit value, big endian")]
|
||||
public void WriteS24Big(long addr, int value, [LuaASCIIStringParam] string domain = null)
|
||||
public void WriteS24Big(long addr, int value, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian();
|
||||
APIs.Memory.WriteS24(addr, value, domain);
|
||||
|
@ -252,7 +249,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local uimemrea = memory.read_u24_le( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_u24_le", "read unsigned 24 bit value, little endian")]
|
||||
public uint ReadU24Little(long addr, [LuaASCIIStringParam] string domain = null)
|
||||
public uint ReadU24Little(long addr, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian(false);
|
||||
return APIs.Memory.ReadU24(addr, domain);
|
||||
|
@ -260,7 +257,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("memory.write_u24_le( 0x100, 1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_u24_le", "write unsigned 24 bit value, little endian")]
|
||||
public void WriteU24Little(long addr, uint value, [LuaASCIIStringParam] string domain = null)
|
||||
public void WriteU24Little(long addr, uint value, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian(false);
|
||||
APIs.Memory.WriteU24(addr, value, domain);
|
||||
|
@ -268,7 +265,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local uimemrea = memory.read_u24_be( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_u24_be", "read unsigned 24 bit value, big endian")]
|
||||
public uint ReadU24Big(long addr, [LuaASCIIStringParam] string domain = null)
|
||||
public uint ReadU24Big(long addr, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian();
|
||||
return APIs.Memory.ReadU24(addr, domain);
|
||||
|
@ -276,7 +273,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("memory.write_u24_be( 0x100, 1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_u24_be", "write unsigned 24 bit value, big endian")]
|
||||
public void WriteU24Big(long addr, uint value, [LuaASCIIStringParam] string domain = null)
|
||||
public void WriteU24Big(long addr, uint value, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian();
|
||||
APIs.Memory.WriteU24(addr, value, domain);
|
||||
|
@ -284,7 +281,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local inmemrea = memory.read_s32_le( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_s32_le", "read signed 4 byte value, little endian")]
|
||||
public int ReadS32Little(long addr, [LuaASCIIStringParam] string domain = null)
|
||||
public int ReadS32Little(long addr, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian(false);
|
||||
return APIs.Memory.ReadS32(addr, domain);
|
||||
|
@ -292,7 +289,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("memory.write_s32_le( 0x100, -1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_s32_le", "write signed 4 byte value, little endian")]
|
||||
public void WriteS32Little(long addr, int value, [LuaASCIIStringParam] string domain = null)
|
||||
public void WriteS32Little(long addr, int value, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian(false);
|
||||
APIs.Memory.WriteS32(addr, value, domain);
|
||||
|
@ -300,7 +297,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local inmemrea = memory.read_s32_be( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_s32_be", "read signed 4 byte value, big endian")]
|
||||
public int ReadS32Big(long addr, [LuaASCIIStringParam] string domain = null)
|
||||
public int ReadS32Big(long addr, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian();
|
||||
return APIs.Memory.ReadS32(addr, domain);
|
||||
|
@ -308,7 +305,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("memory.write_s32_be( 0x100, -1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_s32_be", "write signed 4 byte value, big endian")]
|
||||
public void WriteS32Big(long addr, int value, [LuaASCIIStringParam] string domain = null)
|
||||
public void WriteS32Big(long addr, int value, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian();
|
||||
APIs.Memory.WriteS32(addr, value, domain);
|
||||
|
@ -316,7 +313,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local uimemrea = memory.read_u32_le( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_u32_le", "read unsigned 4 byte value, little endian")]
|
||||
public uint ReadU32Little(long addr, [LuaASCIIStringParam] string domain = null)
|
||||
public uint ReadU32Little(long addr, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian(false);
|
||||
return APIs.Memory.ReadU32(addr, domain);
|
||||
|
@ -324,7 +321,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("memory.write_u32_le( 0x100, 1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_u32_le", "write unsigned 4 byte value, little endian")]
|
||||
public void WriteU32Little(long addr, uint value, [LuaASCIIStringParam] string domain = null)
|
||||
public void WriteU32Little(long addr, uint value, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian(false);
|
||||
APIs.Memory.WriteU32(addr, value, domain);
|
||||
|
@ -332,7 +329,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local uimemrea = memory.read_u32_be( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_u32_be", "read unsigned 4 byte value, big endian")]
|
||||
public uint ReadU32Big(long addr, [LuaASCIIStringParam] string domain = null)
|
||||
public uint ReadU32Big(long addr, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian();
|
||||
return APIs.Memory.ReadU32(addr, domain);
|
||||
|
@ -340,7 +337,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("memory.write_u32_be( 0x100, 1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_u32_be", "write unsigned 4 byte value, big endian")]
|
||||
public void WriteU32Big(long addr, uint value, [LuaASCIIStringParam] string domain = null)
|
||||
public void WriteU32Big(long addr, uint value, string domain = null)
|
||||
{
|
||||
APIs.Memory.SetBigEndian();
|
||||
APIs.Memory.WriteU32(addr, value, domain);
|
||||
|
|
|
@ -13,18 +13,17 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("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")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string SaveCoreStateToMemory()
|
||||
=> APIs.MemorySaveState.SaveCoreStateToMemory();
|
||||
|
||||
[LuaMethodExample("memorysavestate.loadcorestate( \"3fcf120f-0778-43fd-b2c5-460fb7d34184\" );")]
|
||||
[LuaMethod("loadcorestate", "loads an in memory state with the given identifier")]
|
||||
public void LoadCoreStateFromMemory([LuaASCIIStringParam] string identifier)
|
||||
public void LoadCoreStateFromMemory(string identifier)
|
||||
=> APIs.MemorySaveState.LoadCoreStateFromMemory(identifier);
|
||||
|
||||
[LuaMethodExample("memorysavestate.removestate( \"3fcf120f-0778-43fd-b2c5-460fb7d34184\" );")]
|
||||
[LuaMethod("removestate", "removes the savestate with the given identifier from memory")]
|
||||
public void DeleteState([LuaASCIIStringParam] string identifier)
|
||||
public void DeleteState(string identifier)
|
||||
=> APIs.MemorySaveState.DeleteState(identifier);
|
||||
|
||||
[LuaMethodExample("memorysavestate.clearstatesfrommemory( );")]
|
||||
|
|
|
@ -25,19 +25,16 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local stmovfil = movie.filename( );")]
|
||||
[LuaMethod("filename", "Returns the file name including path of the currently loaded movie")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public string Filename()
|
||||
=> APIs.Movie.Filename();
|
||||
|
||||
[LuaMethodExample("local nlmovget = movie.getinput( 500 );")]
|
||||
[LuaMethod("getinput", "Returns a table of buttons pressed on a given frame of the loaded movie")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public LuaTable GetInput(int frame, int? controller = null)
|
||||
=> _th.DictToTable(APIs.Movie.GetInput(frame, controller));
|
||||
|
||||
[LuaMethodExample("local stmovget = movie.getinputasmnemonic( 500 );")]
|
||||
[LuaMethod("getinputasmnemonic", "Returns the input of a given frame of the loaded movie in a raw inputlog string")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string GetInputAsMnemonic(int frame)
|
||||
=> APIs.Movie.GetInputAsMnemonic(frame);
|
||||
|
||||
|
@ -68,13 +65,12 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local stmovmod = movie.mode( );")]
|
||||
[LuaMethod("mode", "Returns the mode of the current movie. Possible modes: \"PLAY\", \"RECORD\", \"FINISHED\", \"INACTIVE\"")]
|
||||
[return: LuaEnumStringParam]
|
||||
public string Mode()
|
||||
=> APIs.Movie.Mode();
|
||||
|
||||
[LuaMethodExample(@"movie.play_from_start(""C:\\moviename.ext"");")]
|
||||
[LuaMethod("play_from_start", "Resets the core to frame 0 with the currently loaded movie in playback mode. If a path to a movie is specified, attempts to load it, then continues with playback if it was successful. Returns true iff successful.")]
|
||||
public bool PlayFromStart([LuaArbitraryStringParam] string path = "")
|
||||
public bool PlayFromStart(string path = "")
|
||||
{
|
||||
_luaLibsImpl.IsRebootingCore = true;
|
||||
var success = APIs.Movie.PlayFromStart(path);
|
||||
|
@ -84,7 +80,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("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.")]
|
||||
public void Save([LuaArbitraryStringParam] string filename = "")
|
||||
public void Save(string filename = "")
|
||||
=> APIs.Movie.Save(filename);
|
||||
|
||||
[LuaMethodExample("movie.setreadonly( false );")]
|
||||
|
@ -114,19 +110,16 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local nlmovget = movie.getheader( );")]
|
||||
[LuaMethod("getheader", "If a movie is active, will return the movie header as a lua table")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public LuaTable GetHeader()
|
||||
=> _th.DictToTable(APIs.Movie.GetHeader());
|
||||
|
||||
[LuaMethodExample("local nlmovget = movie.getcomments( );")]
|
||||
[LuaMethod("getcomments", "If a movie is active, will return the movie comments as a lua table")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public LuaTable GetComments()
|
||||
=> _th.ListToTable(APIs.Movie.GetComments(), indexFrom: 0);
|
||||
|
||||
[LuaMethodExample("local nlmovget = movie.getsubtitles( );")]
|
||||
[LuaMethod("getsubtitles", "If a movie is active, will return the movie subtitles as a lua table")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public LuaTable GetSubtitles()
|
||||
=> _th.ListToTable(APIs.Movie.GetSubtitles(), indexFrom: 0);
|
||||
}
|
||||
|
|
|
@ -16,28 +16,24 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local stSQLcre = SQL.createdatabase( \"eg_db\" );")]
|
||||
[LuaMethod("createdatabase", "Creates a SQLite Database. Name should end with .db")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public string CreateDatabase([LuaArbitraryStringParam] string name)
|
||||
public string CreateDatabase(string name)
|
||||
=> APIs.SQLite.CreateDatabase(name);
|
||||
|
||||
[LuaMethodExample("local stSQLope = SQL.opendatabase( \"eg_db\" );")]
|
||||
[LuaMethod("opendatabase", "Opens a SQLite database. Name should end with .db")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public string OpenDatabase([LuaArbitraryStringParam] string name)
|
||||
public string OpenDatabase(string name)
|
||||
=> APIs.SQLite.OpenDatabase(name);
|
||||
|
||||
[LuaMethodExample("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. " +
|
||||
"Ex: create TABLE rewards (ID integer PRIMARY KEY, action VARCHAR(20)) ")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public string WriteCommand([LuaArbitraryStringParam] string query = "")
|
||||
public string WriteCommand(string query = "")
|
||||
=> APIs.SQLite.WriteCommand(query);
|
||||
|
||||
[LuaMethodExample("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." +
|
||||
"Ex: select * from rewards")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public object ReadCommand([LuaArbitraryStringParam] string query = "")
|
||||
public object ReadCommand(string query = "")
|
||||
{
|
||||
var result = APIs.SQLite.ReadCommand(query);
|
||||
return result switch
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("savestate.load( \"C:\\state.bin\" );")]
|
||||
[LuaMethod("load", "Loads a savestate with the given path. If EmuHawk is deferring quicksaves, to TAStudio for example, that form will do what it likes (and the path is ignored).")]
|
||||
public void Load([LuaArbitraryStringParam] string path, bool suppressOSD = false)
|
||||
public void Load(string path, bool suppressOSD = false)
|
||||
{
|
||||
_luaLibsImpl.IsUpdateSupressed = true;
|
||||
|
||||
|
@ -33,7 +33,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("savestate.save( \"C:\\state.bin\" );")]
|
||||
[LuaMethod("save", "Saves a state at the given path. If EmuHawk is deferring quicksaves, to TAStudio for example, that form will do what it likes (and the path is ignored).")]
|
||||
public void Save([LuaArbitraryStringParam] string path, bool suppressOSD = false)
|
||||
public void Save(string path, bool suppressOSD = false)
|
||||
=> APIs.SaveState.Save(path, suppressOSD);
|
||||
|
||||
[LuaMethodExample("savestate.saveslot( 7 );")]
|
||||
|
|
|
@ -17,13 +17,12 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("userdata.set(\"Unique key\", \"Current key data\");")]
|
||||
[LuaMethod("set", "adds or updates the data with the given key with the given value")]
|
||||
public void Set([LuaArbitraryStringParam] string name, [LuaArbitraryStringParam] object value)
|
||||
public void Set(string name, object value)
|
||||
=> APIs.UserData.Set(name, value);
|
||||
|
||||
[LuaMethodExample("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")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public object Get([LuaArbitraryStringParam] string key)
|
||||
public object Get(string key)
|
||||
=> APIs.UserData.Get(key);
|
||||
|
||||
[LuaMethodExample("userdata.clear( );")]
|
||||
|
@ -33,17 +32,16 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("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.")]
|
||||
public bool Remove([LuaArbitraryStringParam] string key)
|
||||
public bool Remove(string key)
|
||||
=> APIs.UserData.Remove(key);
|
||||
|
||||
[LuaMethodExample("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")]
|
||||
public bool ContainsKey([LuaArbitraryStringParam] string key)
|
||||
public bool ContainsKey(string key)
|
||||
=> APIs.UserData.ContainsKey(key);
|
||||
|
||||
[LuaMethodExample("console.writeline(#userdata.get_keys());")]
|
||||
[LuaMethod("get_keys", "returns a list-like table of valid keys")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public LuaTable GetKeys()
|
||||
=> _th.ListToTable((List<string>) APIs.UserData.Keys); //HACK cast will succeed as long as impl. returns Dictionary<K, V>.Keys.ToList() as IROC<K>
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace BizHawk.Client.Common
|
|||
string theEvent,
|
||||
Action<string> logCallback,
|
||||
LuaFile luaFile,
|
||||
[LuaArbitraryStringParam] string name = null);
|
||||
string name = null);
|
||||
|
||||
NLuaTableHelper GetTableHelper();
|
||||
|
||||
|
|
|
@ -2,24 +2,12 @@
|
|||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
/// <summary>Indicates a parameter/return is (or contains) a string which may include non-ASCII characters.</summary>
|
||||
[AttributeUsage(AttributeTargets.ReturnValue | AttributeTargets.Parameter)]
|
||||
public sealed class LuaArbitraryStringParamAttribute : LuaStringParamAttributeBase {}
|
||||
|
||||
/// <summary>Indicates a parameter/return is (or contains) a string which may only include ASCII characters.</summary>
|
||||
[AttributeUsage(AttributeTargets.ReturnValue | AttributeTargets.Parameter)]
|
||||
public sealed class LuaASCIIStringParamAttribute : LuaStringParamAttributeBase {}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Parameter)]
|
||||
public sealed class LuaColorParamAttribute : Attribute {}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
|
||||
public sealed class LuaDeprecatedMethodAttribute : Attribute {}
|
||||
|
||||
/// <summary>Indicates a parameter/return is (or contains) a string which is one of a known few constants (and these may only include ASCII characters).</summary>
|
||||
[AttributeUsage(AttributeTargets.ReturnValue | AttributeTargets.Parameter)]
|
||||
public sealed class LuaEnumStringParamAttribute : LuaStringParamAttributeBase {}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public sealed class LuaMethodAttribute : Attribute
|
||||
{
|
||||
|
@ -44,8 +32,6 @@ namespace BizHawk.Client.Common
|
|||
public string Example { get; }
|
||||
}
|
||||
|
||||
public abstract class LuaStringParamAttributeBase : Attribute {}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public sealed class LuaLibraryAttribute : Attribute
|
||||
{
|
||||
|
|
|
@ -46,27 +46,24 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethod("can_use_callback_params", "Returns whether EmuHawk will pass arguments to callbacks. This version passes arguments to \"memory\" callbacks (RAM/ROM/bus R/W), so this function will return true for that input. (It returns false for any other input.) This tells you whether hacks for older versions w/o parameter support are necessary.")]
|
||||
[LuaMethodExample("local mem_callback = event.can_use_callback_params(\"memory\") and mem_callback or mem_callback_pre_29;")]
|
||||
public bool CanUseCallbackParams([LuaEnumStringParam] string subset = null)
|
||||
public bool CanUseCallbackParams(string subset = null)
|
||||
=> subset is "memory";
|
||||
|
||||
[LuaMethodExample("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")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string OnFrameEnd(LuaFunction luaf, [LuaArbitraryStringParam] string name = null)
|
||||
public string OnFrameEnd(LuaFunction luaf, string name = null)
|
||||
=> _luaLibsImpl.CreateAndRegisterNamedFunction(luaf, NamedLuaFunction.EVENT_TYPE_POSTFRAME, LogOutputCallback, CurrentFile, name)
|
||||
.Guid.ToString();
|
||||
|
||||
[LuaMethodExample("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")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string OnFrameStart(LuaFunction luaf, [LuaArbitraryStringParam] string name = null)
|
||||
public string OnFrameStart(LuaFunction luaf, string name = null)
|
||||
=> _luaLibsImpl.CreateAndRegisterNamedFunction(luaf, NamedLuaFunction.EVENT_TYPE_PREFRAME, LogOutputCallback, CurrentFile, name)
|
||||
.Guid.ToString();
|
||||
|
||||
[LuaMethodExample("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")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string OnInputPoll(LuaFunction luaf, [LuaArbitraryStringParam] string name = null)
|
||||
public string OnInputPoll(LuaFunction luaf, string name = null)
|
||||
{
|
||||
var nlf = _luaLibsImpl.CreateAndRegisterNamedFunction(luaf, NamedLuaFunction.EVENT_TYPE_INPUTPOLL, LogOutputCallback, CurrentFile, name);
|
||||
//TODO should we bother registering the function if the service isn't supported? none of the other events work this way --yoshi
|
||||
|
@ -96,19 +93,17 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("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")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string OnLoadState(LuaFunction luaf, [LuaArbitraryStringParam] string name = null)
|
||||
public string OnLoadState(LuaFunction luaf, string name = null)
|
||||
=> _luaLibsImpl.CreateAndRegisterNamedFunction(luaf, NamedLuaFunction.EVENT_TYPE_LOADSTATE, LogOutputCallback, CurrentFile, name)
|
||||
.Guid.ToString();
|
||||
|
||||
[LuaDeprecatedMethod]
|
||||
[LuaMethod("onmemoryexecute", "Fires after the given address is executed by the core")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string OnMemoryExecute(
|
||||
LuaFunction luaf,
|
||||
uint address,
|
||||
[LuaArbitraryStringParam] string name = null,
|
||||
[LuaASCIIStringParam] string scope = null)
|
||||
string name = null,
|
||||
string scope = null)
|
||||
{
|
||||
// Log("Deprecated function event.onmemoryexecute() used, replace the call with event.on_bus_exec().");
|
||||
return OnBusExec(luaf, address, name: name, scope: scope);
|
||||
|
@ -116,12 +111,11 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local exec_cb_id = event.on_bus_exec(\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("on_bus_exec", "Fires after the given address is executed by the core")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string OnBusExec(
|
||||
LuaFunction luaf,
|
||||
uint address,
|
||||
[LuaArbitraryStringParam] string name = null,
|
||||
[LuaASCIIStringParam] string scope = null)
|
||||
string name = null,
|
||||
string scope = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -152,11 +146,10 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaDeprecatedMethod]
|
||||
[LuaMethod("onmemoryexecuteany", "Fires after any address is executed by the core (CPU-intensive)")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string OnMemoryExecuteAny(
|
||||
LuaFunction luaf,
|
||||
[LuaArbitraryStringParam] string name = null,
|
||||
[LuaASCIIStringParam] string scope = null)
|
||||
string name = null,
|
||||
string scope = null)
|
||||
{
|
||||
// Log("Deprecated function event.onmemoryexecuteany(...) used, replace the call with event.on_bus_exec_any(...).");
|
||||
return OnBusExecAny(luaf, name: name, scope: scope);
|
||||
|
@ -164,11 +157,10 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local exec_cb_id = event.on_bus_exec_any(\r\n\tfunction()\r\n\t\tconsole.log( \"Fires after any address is executed by the core (CPU-intensive)\" );\r\n\tend\r\n\t, \"Frame name\", \"System Bus\" );")]
|
||||
[LuaMethod("on_bus_exec_any", "Fires after any address is executed by the core (CPU-intensive)")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string OnBusExecAny(
|
||||
LuaFunction luaf,
|
||||
[LuaArbitraryStringParam] string name = null,
|
||||
[LuaASCIIStringParam] string scope = null)
|
||||
string name = null,
|
||||
string scope = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -204,12 +196,11 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaDeprecatedMethod]
|
||||
[LuaMethod("onmemoryread", "Fires after the given address is read by the core. If no address is given, it will attach to every memory read")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string OnMemoryRead(
|
||||
LuaFunction luaf,
|
||||
uint? address = null,
|
||||
[LuaArbitraryStringParam] string name = null,
|
||||
[LuaASCIIStringParam] string scope = null)
|
||||
string name = null,
|
||||
string scope = null)
|
||||
{
|
||||
// Log("Deprecated function event.onmemoryread(...) used, replace the call with event.on_bus_read(...).");
|
||||
return OnBusRead(luaf, address, name: name, scope: scope);
|
||||
|
@ -217,12 +208,11 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local exec_cb_id = event.on_bus_read(\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("on_bus_read", "Fires after the given address is read by the core. If no address is given, it will attach to every memory read")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string OnBusRead(
|
||||
LuaFunction luaf,
|
||||
uint? address = null,
|
||||
[LuaArbitraryStringParam] string name = null,
|
||||
[LuaASCIIStringParam] string scope = null)
|
||||
string name = null,
|
||||
string scope = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -252,12 +242,11 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaDeprecatedMethod]
|
||||
[LuaMethod("onmemorywrite", "Fires after the given address is written by the core. If no address is given, it will attach to every memory write")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string OnMemoryWrite(
|
||||
LuaFunction luaf,
|
||||
uint? address = null,
|
||||
[LuaArbitraryStringParam] string name = null,
|
||||
[LuaASCIIStringParam] string scope = null)
|
||||
string name = null,
|
||||
string scope = null)
|
||||
{
|
||||
// Log("Deprecated function event.onmemorywrite(...) used, replace the call with event.on_bus_write(...).");
|
||||
return OnBusWrite(luaf, address, name: name, scope: scope);
|
||||
|
@ -265,12 +254,11 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local exec_cb_id = event.on_bus_write(\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("on_bus_write", "Fires after the given address is written by the core. If no address is given, it will attach to every memory write")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string OnBusWrite(
|
||||
LuaFunction luaf,
|
||||
uint? address = null,
|
||||
[LuaArbitraryStringParam] string name = null,
|
||||
[LuaASCIIStringParam] string scope = null)
|
||||
string name = null,
|
||||
string scope = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -300,38 +288,34 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("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")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string OnSaveState(LuaFunction luaf, [LuaArbitraryStringParam] string name = null)
|
||||
public string OnSaveState(LuaFunction luaf, string name = null)
|
||||
=> _luaLibsImpl.CreateAndRegisterNamedFunction(luaf, NamedLuaFunction.EVENT_TYPE_SAVESTATE, LogOutputCallback, CurrentFile, name)
|
||||
.Guid.ToString();
|
||||
|
||||
[LuaMethodExample("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")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string OnExit(LuaFunction luaf, [LuaArbitraryStringParam] string name = null)
|
||||
public string OnExit(LuaFunction luaf, string name = null)
|
||||
=> _luaLibsImpl.CreateAndRegisterNamedFunction(luaf, NamedLuaFunction.EVENT_TYPE_ENGINESTOP, LogOutputCallback, CurrentFile, name)
|
||||
.Guid.ToString();
|
||||
|
||||
[LuaMethodExample("local closeGuid = event.onconsoleclose(\r\n\tfunction()\r\n\t\tconsole.log( \"Fires when the emulator console closes\" );\r\n\tend\r\n\t, \"Frame name\" );")]
|
||||
[LuaMethod("onconsoleclose", "Fires when the emulator console closes")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string OnConsoleClose(LuaFunction luaf, [LuaArbitraryStringParam] string name = null)
|
||||
public string OnConsoleClose(LuaFunction luaf, string name = null)
|
||||
=> _luaLibsImpl.CreateAndRegisterNamedFunction(luaf, NamedLuaFunction.EVENT_TYPE_CONSOLECLOSE, LogOutputCallback, CurrentFile, name)
|
||||
.Guid.ToString();
|
||||
|
||||
[LuaMethodExample("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.")]
|
||||
public bool UnregisterById([LuaASCIIStringParam] string guid)
|
||||
public bool UnregisterById(string guid)
|
||||
=> _luaLibsImpl.RemoveNamedFunctionMatching(nlf => nlf.Guid.ToString() == guid);
|
||||
|
||||
[LuaMethodExample("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.")]
|
||||
public bool UnregisterByName([LuaArbitraryStringParam] string name)
|
||||
public bool UnregisterByName(string name)
|
||||
=> _luaLibsImpl.RemoveNamedFunctionMatching(nlf => nlf.Name == name);
|
||||
|
||||
[LuaMethodExample("local scopes = event.availableScopes();")]
|
||||
[LuaMethod("availableScopes", "Lists the available scopes that can be specified for on_bus_* events")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public LuaTable AvailableScopes()
|
||||
{
|
||||
return DebuggableCore?.MemoryCallbacksAvailable() == true
|
||||
|
|
|
@ -27,7 +27,6 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local stmaiget = mainmemory.getname( );")]
|
||||
[LuaMethod("getname", "returns the name of the domain defined as main memory for the given core")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string GetName()
|
||||
=> MainMemName;
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("if ( nds.getscreenlayout( ) ) then\r\n\tconsole.log( \"Returns which screen layout is active\" );\r\nend;")]
|
||||
[LuaMethod("getscreenlayout", "Returns which screen layout is active")]
|
||||
[return: LuaEnumStringParam]
|
||||
public string GetScreenLayout()
|
||||
=> Settings.ScreenLayout.ToString();
|
||||
|
||||
|
@ -34,7 +33,6 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("if ( nds.getscreenrotation( ) ) then\r\n\tconsole.log( \"Returns how screens are rotated\" );\r\nend;")]
|
||||
[LuaMethod("getscreenrotation", "Returns how screens are rotated")]
|
||||
[return: LuaEnumStringParam]
|
||||
public string GetScreenRotation()
|
||||
=> Settings.ScreenRotation.ToString();
|
||||
|
||||
|
@ -45,13 +43,12 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("if ( nds.getaudiobitrate( ) ) then\r\n\tconsole.log( \"Returns the audio bitrate setting\" );\r\nend;")]
|
||||
[LuaMethod("getaudiobitrate", "Returns the audio bitrate setting")]
|
||||
[return: LuaEnumStringParam]
|
||||
public string GetAudioBitrate()
|
||||
=> Settings.AudioBitrate.ToString();
|
||||
|
||||
[LuaMethodExample("nds.setscreenlayout( \"Vertical\" );")]
|
||||
[LuaMethod("setscreenlayout", "Sets which screen layout is active")]
|
||||
public void SetScreenLayout([LuaEnumStringParam] string value)
|
||||
public void SetScreenLayout(string value)
|
||||
{
|
||||
var s = Settings;
|
||||
s.ScreenLayout = (NDS.ScreenLayoutKind)Enum.Parse(typeof(NDS.ScreenLayoutKind), value, true);
|
||||
|
@ -69,7 +66,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("nds.setscreenrotation( \"Rotate0\" );")]
|
||||
[LuaMethod("setscreenrotation", "Sets how screens are rotated")]
|
||||
public void SetScreenRotation([LuaEnumStringParam] string value)
|
||||
public void SetScreenRotation(string value)
|
||||
{
|
||||
var s = Settings;
|
||||
s.ScreenRotation = (NDS.ScreenRotationKind)Enum.Parse(typeof(NDS.ScreenRotationKind), value, true);
|
||||
|
@ -87,7 +84,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("nds.setaudiobitrate( \"Auto\" );")]
|
||||
[LuaMethod("setaudiobitrate", "Sets the audio bitrate setting")]
|
||||
public void SetAudioBitrate([LuaEnumStringParam] string value)
|
||||
public void SetAudioBitrate(string value)
|
||||
{
|
||||
var s = Settings;
|
||||
s.AudioBitrate = (NDS.NDSSettings.AudioBitrateType)Enum.Parse(typeof(NDS.NDSSettings.AudioBitrateType), value, true);
|
||||
|
|
|
@ -17,7 +17,6 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local stbizhex = bizstring.hex( -12345 );")]
|
||||
[LuaMethod("hex", "Converts the number to a string representation of the hexadecimal value of the given number")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public static string Hex(long num)
|
||||
{
|
||||
var hex = $"{num:X}";
|
||||
|
@ -31,7 +30,6 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local stbizbin = bizstring.binary( -12345 );")]
|
||||
[LuaMethod("binary", "Converts the number to a string representation of the binary value of the given number")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public static string Binary(long num)
|
||||
{
|
||||
var binary = Convert.ToString(num, 2);
|
||||
|
@ -41,7 +39,6 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local stbizoct = bizstring.octal( -12345 );")]
|
||||
[LuaMethod("octal", "Converts the number to a string representation of the octal value of the given number")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public static string Octal(long num)
|
||||
{
|
||||
var octal = Convert.ToString(num, 8);
|
||||
|
@ -55,35 +52,31 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local s = bizstring.pad_end(\"hm\", 5, 'm'); -- \"hmmmm\"")]
|
||||
[LuaMethod("pad_end", "Appends zero or more of pad_char to the end (right) of str until it's at least length chars long. If pad_char is not a string exactly one char long, its first char will be used, or ' ' if it's empty.")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public static string PadEnd(
|
||||
[LuaArbitraryStringParam] string str,
|
||||
string str,
|
||||
int length,
|
||||
[LuaArbitraryStringParam] string pad_char)
|
||||
string pad_char)
|
||||
=> str.PadRight(length, pad_char.Length is 0 ? ' ' : pad_char[0]);
|
||||
|
||||
[LuaMethodExample("local s = bizstring.pad_start(tostring(0x1A3792D4), 11, ' '); -- \" 439849684\"")]
|
||||
[LuaMethod("pad_start", "Prepends zero or more of pad_char to the start (left) of str until it's at least length chars long. If pad_char is not a string exactly one char long, its first char will be used, or ' ' if it's empty.")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public static string PadStart(
|
||||
[LuaArbitraryStringParam] string str,
|
||||
string str,
|
||||
int length,
|
||||
[LuaArbitraryStringParam] string pad_char)
|
||||
string pad_char)
|
||||
=> str.PadLeft(length, pad_char.Length is 0 ? ' ' : pad_char[0]);
|
||||
|
||||
[LuaMethodExample("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")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public static string Trim([LuaArbitraryStringParam] string str)
|
||||
public static string Trim(string str)
|
||||
=> string.IsNullOrEmpty(str) ? null : str.Trim();
|
||||
|
||||
[LuaMethodExample("local stbizrep = bizstring.replace( \"Some string\", \"Some\", \"Replaced\" );")]
|
||||
[LuaMethod("replace", "Returns a string that replaces all occurrences of str2 in str1 with the value of replace")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public static string Replace(
|
||||
[LuaArbitraryStringParam] string str,
|
||||
[LuaArbitraryStringParam] string str2,
|
||||
[LuaArbitraryStringParam] string replace)
|
||||
string str,
|
||||
string str2,
|
||||
string replace)
|
||||
{
|
||||
return string.IsNullOrEmpty(str)
|
||||
? null
|
||||
|
@ -92,8 +85,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local stbiztou = bizstring.toupper( \"Some string\" );")]
|
||||
[LuaMethod("toupper", "Returns an uppercase version of the given string")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public static string ToUpper([LuaArbitraryStringParam] string str)
|
||||
public static string ToUpper(string str)
|
||||
{
|
||||
return string.IsNullOrEmpty(str)
|
||||
? null
|
||||
|
@ -102,8 +94,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local stbiztol = bizstring.tolower( \"Some string\" );")]
|
||||
[LuaMethod("tolower", "Returns an lowercase version of the given string")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public static string ToLower([LuaArbitraryStringParam] string str)
|
||||
public static string ToLower(string str)
|
||||
{
|
||||
return string.IsNullOrEmpty(str)
|
||||
? null
|
||||
|
@ -112,8 +103,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("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")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public static string SubString([LuaArbitraryStringParam] string str, int position, int length)
|
||||
public static string SubString(string str, int position, int length)
|
||||
{
|
||||
return string.IsNullOrEmpty(str)
|
||||
? null
|
||||
|
@ -122,8 +112,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("local stbizrem = bizstring.remove( \"Some string\", 4, 5 );")]
|
||||
[LuaMethod("remove", "Returns a string that represents str with the given position and count removed")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public static string Remove([LuaArbitraryStringParam] string str, int position, int count)
|
||||
public static string Remove(string str, int position, int count)
|
||||
{
|
||||
return string.IsNullOrEmpty(str)
|
||||
? null
|
||||
|
@ -132,23 +121,22 @@ namespace BizHawk.Client.Common
|
|||
|
||||
[LuaMethodExample("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")]
|
||||
public static bool Contains([LuaArbitraryStringParam] string str, [LuaArbitraryStringParam] string str2)
|
||||
public static bool Contains(string str, string str2)
|
||||
=> !string.IsNullOrEmpty(str) && str.Contains(str2); // don't bother fixing encoding, will match (or not match) regardless
|
||||
|
||||
[LuaMethodExample("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")]
|
||||
public static bool StartsWith([LuaArbitraryStringParam] string str, [LuaArbitraryStringParam] string str2)
|
||||
public static bool StartsWith(string str, string str2)
|
||||
=> !string.IsNullOrEmpty(str) && str.StartsWith(str2); // don't bother fixing encoding, will match (or not match) regardless
|
||||
|
||||
[LuaMethodExample("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")]
|
||||
public static bool EndsWith([LuaArbitraryStringParam] string str, [LuaArbitraryStringParam] string str2)
|
||||
public static bool EndsWith(string str, string str2)
|
||||
=> !string.IsNullOrEmpty(str) && str.EndsWith(str2); // don't bother fixing encoding, will match (or not match) regardless
|
||||
|
||||
[LuaMethodExample("local nlbizspl = bizstring.split( \"Some, string\", \", \" );")]
|
||||
[LuaMethod("split", "Splits str into a Lua-style array using the given separator (consecutive separators in str will NOT create empty entries in the array). If the separator is not a string exactly one char long, ',' will be used.")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public LuaTable Split([LuaArbitraryStringParam] string str, [LuaArbitraryStringParam] string separator)
|
||||
public LuaTable Split(string str, string separator)
|
||||
{
|
||||
static char SingleOrElse(string s, char defaultValue)
|
||||
=> s?.Length == 1 ? s[0] : defaultValue;
|
||||
|
|
|
@ -30,7 +30,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
[LuaMethodExample("local stconget = console.getluafunctionslist( );")]
|
||||
[LuaMethod("getluafunctionslist", "returns a list of implemented functions")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public string GetLuaFunctionsList()
|
||||
{
|
||||
var list = new StringBuilder();
|
||||
|
@ -44,29 +43,29 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
[LuaMethodExample("console.log( \"New log.\" );")]
|
||||
[LuaMethod("log", "Outputs the given object to the output box on the Lua Console dialog. Note: Can accept a LuaTable")]
|
||||
public void Log([LuaArbitraryStringParam] params object[] outputs)
|
||||
public void Log(params object[] outputs)
|
||||
{
|
||||
LogWithSeparator("\t", "\n", outputs);
|
||||
}
|
||||
|
||||
[LuaMethodExample("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")]
|
||||
public void WriteLine([LuaArbitraryStringParam] params object[] outputs)
|
||||
public void WriteLine(params object[] outputs)
|
||||
{
|
||||
LogWithSeparator("\n", "\n", outputs);
|
||||
}
|
||||
|
||||
[LuaMethodExample("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")]
|
||||
public void Write([LuaArbitraryStringParam] params object[] outputs)
|
||||
public void Write(params object[] outputs)
|
||||
{
|
||||
LogWithSeparator("", "", outputs);
|
||||
}
|
||||
|
||||
// Outputs the given object to the output box on the Lua Console dialog. Note: Can accept a LuaTable
|
||||
private void LogWithSeparator(string separator, string terminator, [LuaArbitraryStringParam] params object[] outputs)
|
||||
private void LogWithSeparator(string separator, string terminator, params object[] outputs)
|
||||
{
|
||||
static string SerializeTable([LuaArbitraryStringParam] LuaTable lti)
|
||||
static string SerializeTable(LuaTable lti)
|
||||
{
|
||||
var keyObjs = lti.Keys;
|
||||
var valueObjs = lti.Values;
|
||||
|
@ -94,7 +93,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
var sb = new StringBuilder();
|
||||
|
||||
void SerializeAndWrite([LuaArbitraryStringParam] object output)
|
||||
void SerializeAndWrite(object output)
|
||||
=> sb.Append(output switch
|
||||
{
|
||||
null => "nil",
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private static void SetSize(Control control, int width, int height)
|
||||
=> control.Size = UIHelper.Scale(new Size(width, height));
|
||||
|
||||
private static void SetText(Control control, [LuaArbitraryStringParam] string caption)
|
||||
private static void SetText(Control control, string caption)
|
||||
=> control.Text = caption ?? string.Empty;
|
||||
|
||||
[LuaMethodExample("forms.addclick( 332, function()\r\n\tconsole.log( \"adds the given lua function as a click event to the given control\" );\r\nend );")]
|
||||
|
@ -70,7 +70,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
"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 long Button(
|
||||
long formHandle,
|
||||
[LuaArbitraryStringParam] string caption,
|
||||
string caption,
|
||||
LuaFunction clickEvent,
|
||||
int? x = null,
|
||||
int? y = null,
|
||||
|
@ -104,7 +104,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
[LuaMethodExample("local inforche = forms.checkbox( 333, \"Caption\", 2, 48 );")]
|
||||
[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")]
|
||||
public long Checkbox(long formHandle, [LuaArbitraryStringParam] string caption, int? x = null, int? y = null)
|
||||
public long Checkbox(long formHandle, string caption, int? x = null, int? y = null)
|
||||
{
|
||||
var form = GetForm(formHandle);
|
||||
if (form == null)
|
||||
|
@ -174,7 +174,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
"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 long Dropdown(
|
||||
long formHandle,
|
||||
[LuaArbitraryStringParam] LuaTable items,
|
||||
LuaTable items,
|
||||
int? x = null,
|
||||
int? y = null,
|
||||
int? width = null,
|
||||
|
@ -207,8 +207,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
[LuaMethodExample("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")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public string GetProperty(long handle, [LuaASCIIStringParam] string property)
|
||||
public string GetProperty(long handle, string property)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -239,7 +238,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
[LuaMethodExample("local stforget = forms.gettext(332);")]
|
||||
[LuaMethod("gettext", "Returns the text property of a given form or control")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public string GetText(long handle)
|
||||
{
|
||||
try
|
||||
|
@ -303,7 +301,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
"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 long Label(
|
||||
long formHandle,
|
||||
[LuaArbitraryStringParam] string caption,
|
||||
string caption,
|
||||
int? x = null,
|
||||
int? y = null,
|
||||
int? width = null,
|
||||
|
@ -344,7 +342,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public long NewForm(
|
||||
int? width = null,
|
||||
int? height = null,
|
||||
[LuaArbitraryStringParam] string title = null,
|
||||
string title = null,
|
||||
LuaFunction onClose = null)
|
||||
{
|
||||
var form = new LuaWinform(CurrentFile, WindowClosed);
|
||||
|
@ -382,11 +380,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
[LuaMethodExample(@"local filename = forms.openfile(""C:\filename.bin"", ""C:\"", ""Raster Images (*.bmp;*.gif;*.jpg;*.png)|*.bmp;*.gif;*.jpg;*.png|All Files (*.*)|*.*"")")]
|
||||
[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")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public string OpenFile(
|
||||
[LuaArbitraryStringParam] string fileName = null,
|
||||
[LuaArbitraryStringParam] string initialDirectory = null,
|
||||
[LuaASCIIStringParam] string filter = null)
|
||||
string fileName = null,
|
||||
string initialDirectory = null,
|
||||
string filter = null)
|
||||
{
|
||||
if (initialDirectory is null && fileName is not null) initialDirectory = Path.GetDirectoryName(fileName);
|
||||
var result = ((IDialogParent) MainForm).ShowFileOpenDialog(
|
||||
|
@ -703,7 +700,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
"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(
|
||||
long componentHandle,
|
||||
[LuaArbitraryStringParam] string path,
|
||||
string path,
|
||||
int x,
|
||||
int y,
|
||||
int? width = null,
|
||||
|
@ -745,7 +742,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
"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(
|
||||
long componentHandle,
|
||||
[LuaArbitraryStringParam] string path,
|
||||
string path,
|
||||
int x,
|
||||
int y,
|
||||
int? width = null,
|
||||
|
@ -819,7 +816,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
"Draws a region of the given image file at the given location on the canvas, and optionally resizes it before drawing. On the TASVideos Wiki, consult this diagram to see its usage: [https://user-images.githubusercontent.com/13409956/198868522-55dc1e5f-ae67-4ebb-a75f-558656cb4468.png|alt=Diagram showing how to use forms.drawImageRegion]")]
|
||||
public void DrawImageRegion(
|
||||
long componentHandle,
|
||||
[LuaArbitraryStringParam] string path,
|
||||
string path,
|
||||
int source_x,
|
||||
int source_y,
|
||||
int source_width,
|
||||
|
@ -1126,14 +1123,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
long componentHandle,
|
||||
int x,
|
||||
int y,
|
||||
[LuaArbitraryStringParam] string message,
|
||||
string message,
|
||||
[LuaColorParam] object forecolor = null,
|
||||
[LuaColorParam] object backcolor = null,
|
||||
int? fontsize = null,
|
||||
[LuaASCIIStringParam] string fontfamily = null,
|
||||
[LuaEnumStringParam] string fontstyle = null,
|
||||
[LuaEnumStringParam] string horizalign = null,
|
||||
[LuaEnumStringParam] string vertalign = null)
|
||||
string fontfamily = null,
|
||||
string fontstyle = null,
|
||||
string horizalign = null,
|
||||
string vertalign = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -1170,14 +1167,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
long componentHandle,
|
||||
int x,
|
||||
int y,
|
||||
[LuaArbitraryStringParam] string message,
|
||||
string message,
|
||||
[LuaColorParam] object forecolor = null,
|
||||
[LuaColorParam] object backcolor = null,
|
||||
int? fontsize = null,
|
||||
[LuaASCIIStringParam] string fontfamily = null,
|
||||
[LuaEnumStringParam] string fontstyle = null,
|
||||
[LuaEnumStringParam] string horizalign = null,
|
||||
[LuaEnumStringParam] string vertalign = null)
|
||||
string fontfamily = null,
|
||||
string fontstyle = null,
|
||||
string horizalign = null,
|
||||
string vertalign = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -1275,7 +1272,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
[LuaMethodExample("forms.setdropdownitems(dropdown_handle, { \"item1\", \"item2\" });")]
|
||||
[LuaMethod("setdropdownitems", "Updates the item list of a dropdown menu. The optional third parameter toggles alphabetical sorting of items, pass false to skip sorting.")]
|
||||
public void SetDropdownItems(long handle, [LuaArbitraryStringParam] LuaTable items, bool alphabetize = true)
|
||||
public void SetDropdownItems(long handle, LuaTable items, bool alphabetize = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -1338,7 +1335,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// </exception>
|
||||
[LuaMethodExample("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")]
|
||||
public void SetProperty(long handle, [LuaASCIIStringParam] string property, object value)
|
||||
public void SetProperty(long handle, string property, object value)
|
||||
{
|
||||
// relying on exceptions for error handling here
|
||||
void ParseAndSet(Control c)
|
||||
|
@ -1405,7 +1402,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
[LuaMethodExample("forms.settext( 332, \"Caption\" );")]
|
||||
[LuaMethod("settext", "Sets the text property of a control or form by passing in the handle of the created object")]
|
||||
public void Settext(long handle, [LuaArbitraryStringParam] string caption)
|
||||
public void Settext(long handle, string caption)
|
||||
{
|
||||
var ptr = new IntPtr(handle);
|
||||
foreach (var form in _luaForms)
|
||||
|
@ -1432,15 +1429,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
"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 long Textbox(
|
||||
long formHandle,
|
||||
[LuaArbitraryStringParam] string caption = null,
|
||||
string caption = null,
|
||||
int? width = null,
|
||||
int? height = null,
|
||||
[LuaEnumStringParam] string boxtype = null,
|
||||
string boxtype = null,
|
||||
int? x = null,
|
||||
int? y = null,
|
||||
bool multiline = false,
|
||||
bool fixedWidth = false,
|
||||
[LuaEnumStringParam] string scrollbars = null)
|
||||
string scrollbars = null)
|
||||
{
|
||||
var form = GetForm(formHandle);
|
||||
if (form == null)
|
||||
|
|
|
@ -172,7 +172,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
[LuaMethodExample("")]
|
||||
[LuaMethod("submitinputchange", "")]
|
||||
public void SubmitInputChange(int frame, [LuaASCIIStringParam] string button, bool value)
|
||||
public void SubmitInputChange(int frame, string button, bool value)
|
||||
{
|
||||
if (Engaged())
|
||||
{
|
||||
|
@ -209,7 +209,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
[LuaMethodExample("")]
|
||||
[LuaMethod("submitanalogchange", "")]
|
||||
public void SubmitAnalogChange(int frame, [LuaASCIIStringParam] string button, float value)
|
||||
public void SubmitAnalogChange(int frame, string button, float value)
|
||||
{
|
||||
if (Engaged())
|
||||
{
|
||||
|
@ -348,7 +348,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
[LuaMethod("addcolumn", "")]
|
||||
public void AddColumn([LuaArbitraryStringParam] string name, [LuaArbitraryStringParam] string text, int width)
|
||||
public void AddColumn(string name, string text, int width)
|
||||
{
|
||||
if (Engaged())
|
||||
{
|
||||
|
@ -358,7 +358,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
[LuaMethodExample("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")]
|
||||
public void SetBranchText([LuaArbitraryStringParam] string text, int? index = null)
|
||||
public void SetBranchText(string text, int? index = null)
|
||||
{
|
||||
var text1 = text;
|
||||
if (index != null)
|
||||
|
@ -377,7 +377,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
[LuaMethodExample("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")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public LuaTable GetBranches()
|
||||
{
|
||||
if (!Engaged()) return _th.CreateTable();
|
||||
|
@ -395,8 +394,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
[LuaMethodExample("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")]
|
||||
[return: LuaASCIIStringParam]
|
||||
public LuaTable GetBranchInput([LuaASCIIStringParam] string branchId, int frame)
|
||||
public LuaTable GetBranchInput(string branchId, int frame)
|
||||
{
|
||||
var table = _th.CreateTable();
|
||||
if (!Engaged()) return table;
|
||||
|
@ -433,7 +431,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
[LuaMethodExample("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")]
|
||||
[return: LuaArbitraryStringParam]
|
||||
public string GetMarker(int frame)
|
||||
{
|
||||
if (Engaged())
|
||||
|
@ -465,7 +462,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
[LuaMethodExample("tastudio.setmarker( 500, \"Some message\" );")]
|
||||
[LuaMethod("setmarker", "Adds or sets a marker at the given frame, with an optional message")]
|
||||
public void SetMarker(int frame, [LuaArbitraryStringParam] string message = null)
|
||||
public void SetMarker(int frame, string message = null)
|
||||
{
|
||||
if (Engaged())
|
||||
{
|
||||
|
|
|
@ -85,7 +85,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
[LuaMethod(
|
||||
"SetTitle",
|
||||
"Sets the canvas window title")]
|
||||
public void SetTitle([LuaArbitraryStringParam] string title)
|
||||
public void SetTitle(string title)
|
||||
=> Text = title;
|
||||
|
||||
[LuaMethodExample(
|
||||
|
@ -218,7 +218,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
[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([LuaArbitraryStringParam] string path, int x, int y, int? width = null, int? height = null)
|
||||
public void DrawIcon(string path, int x, int y, int? width = null, int? height = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -236,7 +236,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
"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(
|
||||
[LuaArbitraryStringParam] string path,
|
||||
string path,
|
||||
int x,
|
||||
int y,
|
||||
int? width = null,
|
||||
|
@ -268,7 +268,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
"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(
|
||||
[LuaArbitraryStringParam] string path,
|
||||
string path,
|
||||
int sourceX,
|
||||
int sourceY,
|
||||
int sourceWidth,
|
||||
|
@ -407,14 +407,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
public void DrawString(
|
||||
int x,
|
||||
int y,
|
||||
[LuaArbitraryStringParam] string message,
|
||||
string message,
|
||||
[LuaColorParam] object foreColor = null,
|
||||
[LuaColorParam] object backColor = null,
|
||||
int? fontSize = null,
|
||||
[LuaASCIIStringParam] string fontFamily = null,
|
||||
[LuaEnumStringParam] string fontStyle = null,
|
||||
[LuaEnumStringParam] string horizontalAlign = null,
|
||||
[LuaEnumStringParam] string verticalAlign = null)
|
||||
string fontFamily = null,
|
||||
string fontStyle = null,
|
||||
string horizontalAlign = null,
|
||||
string verticalAlign = null)
|
||||
{
|
||||
luaPictureBox.DrawText(x, y, message, _th.SafeParseColor(foreColor), _th.SafeParseColor(backColor), fontSize, fontFamily, fontStyle, horizontalAlign, verticalAlign);
|
||||
}
|
||||
|
@ -427,14 +427,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
public void DrawText(
|
||||
int x,
|
||||
int y,
|
||||
[LuaArbitraryStringParam] string message,
|
||||
string message,
|
||||
[LuaColorParam] object foreColor = null,
|
||||
[LuaColorParam] object backColor = null,
|
||||
int? fontSize = null,
|
||||
[LuaASCIIStringParam] string fontFamily = null,
|
||||
[LuaEnumStringParam] string fontStyle = null,
|
||||
[LuaEnumStringParam] string horizontalAlign = null,
|
||||
[LuaEnumStringParam] string verticalAlign = null)
|
||||
string fontFamily = null,
|
||||
string fontStyle = null,
|
||||
string horizontalAlign = null,
|
||||
string verticalAlign = null)
|
||||
{
|
||||
luaPictureBox.DrawText(x, y, message, _th.SafeParseColor(foreColor), _th.SafeParseColor(backColor), fontSize, fontFamily, fontStyle, horizontalAlign, verticalAlign);
|
||||
}
|
||||
|
@ -464,7 +464,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
[LuaMethod("save_image_to_disk", "Saves everything that's been drawn to a .png file at the given path. Relative paths are relative to the path set for \"Screenshots\" for the current system.")]
|
||||
public void SaveImageToDisk([LuaArbitraryStringParam] string path)
|
||||
public void SaveImageToDisk(string path)
|
||||
{
|
||||
luaPictureBox.Image.Save(path.MakeAbsolute(_emuLib.PathEntries.ScreenshotAbsolutePathFor(_emuLib.GetSystemId())));
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
string theEvent,
|
||||
Action<string> logCallback,
|
||||
LuaFile luaFile,
|
||||
[LuaArbitraryStringParam] string name = null)
|
||||
string name = null)
|
||||
=> null;
|
||||
|
||||
public NLuaTableHelper GetTableHelper() => null;
|
||||
|
|
|
@ -43,19 +43,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
method
|
||||
);
|
||||
Docs.Add(libFunc);
|
||||
#if DEBUG
|
||||
// these don't catch object or LuaTable!
|
||||
if (method.GetParameters().Any(static pi => pi.ParameterType == typeof(string)
|
||||
&& !pi.CustomAttributes.Any(static a => typeof(LuaStringParamAttributeBase).IsAssignableFrom(a.AttributeType))))
|
||||
{
|
||||
Console.WriteLine($"Lua function {name}.{libFunc.Name} has an unclassified string param");
|
||||
}
|
||||
if (method.ReturnParameter!.ParameterType == typeof(string)
|
||||
&& !method.ReturnParameter.CustomAttributes.Any(static a => typeof(LuaStringParamAttributeBase).IsAssignableFrom(a.AttributeType)))
|
||||
{
|
||||
Console.WriteLine($"Lua function {name}.{libFunc.Name} has an unclassified string return value");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,7 +277,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
string theEvent,
|
||||
Action<string> logCallback,
|
||||
LuaFile luaFile,
|
||||
[LuaArbitraryStringParam] string name = null)
|
||||
string name = null)
|
||||
{
|
||||
var nlf = new NamedLuaFunction(function, theEvent, logCallback, luaFile,
|
||||
() => { _lua.NewThread(out var thread); return thread; }, name);
|
||||
|
|
Loading…
Reference in New Issue