Align ApiHawk and Lua library names

This commit is contained in:
YoshiRulz 2020-06-12 09:38:57 +10:00
parent 597e010faf
commit aca3768c78
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
19 changed files with 176 additions and 176 deletions

View File

@ -7,14 +7,14 @@ namespace BizHawk.Client.Common
{ {
public Dictionary<Type, IExternalApi> Libraries { get; set; } public Dictionary<Type, IExternalApi> Libraries { get; set; }
public IEmuApi Emu => (IEmuApi) Libraries[typeof(IEmuApi)]; public IEmulationApi Emulation => (IEmulationApi) Libraries[typeof(IEmulationApi)];
public IGameInfoApi GameInfo => (IGameInfoApi) Libraries[typeof(IGameInfoApi)]; public IGameInfoApi GameInfo => (IGameInfoApi) Libraries[typeof(IGameInfoApi)];
public IJoypadApi Joypad => (IJoypadApi) Libraries[typeof(IJoypadApi)]; public IJoypadApi Joypad => (IJoypadApi) Libraries[typeof(IJoypadApi)];
public IMemApi Mem => (IMemApi) Libraries[typeof(IMemApi)]; public IMemoryApi Memory => (IMemoryApi) Libraries[typeof(IMemoryApi)];
public IMemEventsApi MemEvents => (IMemEventsApi) Libraries[typeof(IMemEventsApi)]; public IMemoryEventsApi MemoryEvents => (IMemoryEventsApi) Libraries[typeof(IMemoryEventsApi)];
public IMemorySaveStateApi MemorySaveState => (IMemorySaveStateApi) Libraries[typeof(IMemorySaveStateApi)]; public IMemorySaveStateApi MemorySaveState => (IMemorySaveStateApi) Libraries[typeof(IMemorySaveStateApi)];
public IInputMovieApi Movie => (IInputMovieApi) Libraries[typeof(IInputMovieApi)]; public IMovieApi Movie => (IMovieApi) Libraries[typeof(IMovieApi)];
public ISqlApi Sql => (ISqlApi) Libraries[typeof(ISqlApi)]; public ISQLiteApi SQLite => (ISQLiteApi) Libraries[typeof(ISQLiteApi)];
public IUserDataApi UserData => (IUserDataApi) Libraries[typeof(IUserDataApi)]; public IUserDataApi UserData => (IUserDataApi) Libraries[typeof(IUserDataApi)];
public ApiSubsetContainer(Dictionary<Type, IExternalApi> libs) public ApiSubsetContainer(Dictionary<Type, IExternalApi> libs)

View File

@ -9,7 +9,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.Common namespace BizHawk.Client.Common
{ {
public sealed class MemApi : IMemApi public sealed class MemoryApi : IMemoryApi
{ {
[RequiredService] [RequiredService]
private IEmulator Emulator { get; set; } private IEmulator Emulator { get; set; }
@ -17,12 +17,12 @@ namespace BizHawk.Client.Common
[OptionalService] [OptionalService]
private IMemoryDomains MemoryDomainCore { get; set; } private IMemoryDomains MemoryDomainCore { get; set; }
public MemApi(Action<string> logCallback) public MemoryApi(Action<string> logCallback)
{ {
LogCallback = logCallback; LogCallback = logCallback;
} }
public MemApi() : this(Console.WriteLine) {} public MemoryApi() : this(Console.WriteLine) {}
private readonly Action<string> LogCallback; private readonly Action<string> LogCallback;

View File

@ -2,7 +2,7 @@
namespace BizHawk.Client.Common namespace BizHawk.Client.Common
{ {
public sealed class MemEventsApi : IMemEventsApi public sealed class MemoryEventsApi : IMemoryEventsApi
{ {
[RequiredService] [RequiredService]
private IDebuggable DebuggableCore { get; set; } private IDebuggable DebuggableCore { get; set; }

View File

@ -4,7 +4,7 @@ using System.Data.SQLite;
namespace BizHawk.Client.Common namespace BizHawk.Client.Common
{ {
public sealed class SqlApi : ISqlApi public sealed class SQLiteApi : ISQLiteApi
{ {
private SQLiteConnection _dbConnection; private SQLiteConnection _dbConnection;

View File

@ -4,7 +4,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.Common namespace BizHawk.Client.Common
{ {
public interface IEmuApi : IExternalApi public interface IEmulationApi : IExternalApi
{ {
Action FrameAdvanceCallback { get; set; } Action FrameAdvanceCallback { get; set; }
Action YieldCallback { get; set; } Action YieldCallback { get; set; }

View File

@ -2,7 +2,7 @@
namespace BizHawk.Client.Common namespace BizHawk.Client.Common
{ {
public interface IMemApi : IExternalApi public interface IMemoryApi : IExternalApi
{ {
void SetBigEndian(bool enabled = true); void SetBigEndian(bool enabled = true);

View File

@ -2,7 +2,7 @@
namespace BizHawk.Client.Common namespace BizHawk.Client.Common
{ {
public interface IMemEventsApi : IExternalApi public interface IMemoryEventsApi : IExternalApi
{ {
void AddReadCallback(MemoryCallbackDelegate cb, uint? address, string domain); void AddReadCallback(MemoryCallbackDelegate cb, uint? address, string domain);
void AddWriteCallback(MemoryCallbackDelegate cb, uint? address, string domain); void AddWriteCallback(MemoryCallbackDelegate cb, uint? address, string domain);

View File

@ -2,7 +2,7 @@
namespace BizHawk.Client.Common namespace BizHawk.Client.Common
{ {
public interface IInputMovieApi : IExternalApi public interface IMovieApi : IExternalApi
{ {
bool StartsFromSavestate(); bool StartsFromSavestate();
bool StartsFromSaveram(); bool StartsFromSaveram();

View File

@ -1,6 +1,6 @@
namespace BizHawk.Client.Common namespace BizHawk.Client.Common
{ {
public interface ISqlApi : IExternalApi public interface ISQLiteApi : IExternalApi
{ {
string CreateDatabase(string name); string CreateDatabase(string name);
string OpenDatabase(string name); string OpenDatabase(string name);

View File

@ -23,7 +23,7 @@ namespace BizHawk.Client.Common
[LuaMethodExample("emu.displayvsync( true );")] [LuaMethodExample("emu.displayvsync( true );")]
[LuaMethod("displayvsync", "Sets the display vsync property of the emulator")] [LuaMethod("displayvsync", "Sets the display vsync property of the emulator")]
public void DisplayVsync(bool enabled) => APIs.Emu.DisplayVsync(enabled); public void DisplayVsync(bool enabled) => APIs.Emulation.DisplayVsync(enabled);
[LuaMethodExample("emu.frameadvance( );")] [LuaMethodExample("emu.frameadvance( );")]
[LuaMethod("frameadvance", "Signals to the emulator to resume emulation. Necessary for any lua script while loop or else the emulator will freeze!")] [LuaMethod("frameadvance", "Signals to the emulator to resume emulation. Necessary for any lua script while loop or else the emulator will freeze!")]
@ -34,65 +34,65 @@ namespace BizHawk.Client.Common
[LuaMethodExample("local inemufra = emu.framecount( );")] [LuaMethodExample("local inemufra = emu.framecount( );")]
[LuaMethod("framecount", "Returns the current frame count")] [LuaMethod("framecount", "Returns the current frame count")]
public int FrameCount() => APIs.Emu.FrameCount(); public int FrameCount() => APIs.Emulation.FrameCount();
[LuaMethodExample("local obemudis = emu.disassemble( 0x8000 );")] [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")] [LuaMethod("disassemble", "Returns the disassembly object (disasm string and length int) for the given PC address. Uses System Bus domain if no domain name provided")]
public object Disassemble(uint pc, string name = "") => APIs.Emu.Disassemble(pc, name); public object Disassemble(uint pc, string name = "") => APIs.Emulation.Disassemble(pc, name);
// TODO: what about 64 bit registers? // TODO: what about 64 bit registers?
[LuaMethodExample("local inemuget = emu.getregister( emu.getregisters( )[ 0 ] );")] [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")] [LuaMethod("getregister", "returns the value of a cpu register or flag specified by name. For a complete list of possible registers or flags for a given core, use getregisters")]
public int GetRegister(string name) => (int?) APIs.Emu.GetRegister(name) ?? 0; public int GetRegister(string name) => (int?) APIs.Emulation.GetRegister(name) ?? 0;
[LuaMethodExample("local nlemuget = emu.getregisters( );")] [LuaMethodExample("local nlemuget = emu.getregisters( );")]
[LuaMethod("getregisters", "returns the complete set of available flags and registers for a given core")] [LuaMethod("getregisters", "returns the complete set of available flags and registers for a given core")]
public LuaTable GetRegisters() public LuaTable GetRegisters()
{ {
return APIs.Emu return APIs.Emulation
.GetRegisters() .GetRegisters()
.ToLuaTable(Lua); .ToLuaTable(Lua);
} }
[LuaMethodExample("emu.setregister( emu.getregisters( )[ 0 ], -1000 );")] [LuaMethodExample("emu.setregister( emu.getregisters( )[ 0 ], -1000 );")]
[LuaMethod("setregister", "sets the given register name to the given value")] [LuaMethod("setregister", "sets the given register name to the given value")]
public void SetRegister(string register, int value) => APIs.Emu.SetRegister(register, value); public void SetRegister(string register, int value) => APIs.Emulation.SetRegister(register, value);
[LuaMethodExample("local inemutot = emu.totalexecutedcycles( );")] [LuaMethodExample("local inemutot = emu.totalexecutedcycles( );")]
[LuaMethod("totalexecutedcycles", "gets the total number of executed cpu cycles")] [LuaMethod("totalexecutedcycles", "gets the total number of executed cpu cycles")]
public long TotalExecutedycles() => APIs.Emu.TotalExecutedCycles(); public long TotalExecutedycles() => APIs.Emulation.TotalExecutedCycles();
[LuaMethodExample("local stemuget = emu.getsystemid( );")] [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")] [LuaMethod("getsystemid", "Returns the ID string of the current core loaded. Note: No ROM loaded will return the string NULL")]
public string GetSystemId() => APIs.Emu.GetSystemId(); public string GetSystemId() => APIs.Emulation.GetSystemId();
[LuaMethodExample("if ( emu.islagged( ) ) then\r\n\tconsole.log( \"Returns whether or not the current frame is a lag frame\" );\r\nend;")] [LuaMethodExample("if ( emu.islagged( ) ) then\r\n\tconsole.log( \"Returns whether or not the current frame is a lag frame\" );\r\nend;")]
[LuaMethod("islagged", "Returns whether or not the current frame is a lag frame")] [LuaMethod("islagged", "Returns whether or not the current frame is a lag frame")]
public bool IsLagged() => APIs.Emu.IsLagged(); public bool IsLagged() => APIs.Emulation.IsLagged();
[LuaMethodExample("emu.setislagged( true );")] [LuaMethodExample("emu.setislagged( true );")]
[LuaMethod("setislagged", "Sets the lag flag for the current frame. If no value is provided, it will default to true")] [LuaMethod("setislagged", "Sets the lag flag for the current frame. If no value is provided, it will default to true")]
public void SetIsLagged(bool value = true) => APIs.Emu.SetIsLagged(value); public void SetIsLagged(bool value = true) => APIs.Emulation.SetIsLagged(value);
[LuaMethodExample("local inemulag = emu.lagcount( );")] [LuaMethodExample("local inemulag = emu.lagcount( );")]
[LuaMethod("lagcount", "Returns the current lag count")] [LuaMethod("lagcount", "Returns the current lag count")]
public int LagCount() => APIs.Emu.LagCount(); public int LagCount() => APIs.Emulation.LagCount();
[LuaMethodExample("emu.setlagcount( 50 );")] [LuaMethodExample("emu.setlagcount( 50 );")]
[LuaMethod("setlagcount", "Sets the current lag count")] [LuaMethod("setlagcount", "Sets the current lag count")]
public void SetLagCount(int count) => APIs.Emu.SetLagCount(count); public void SetLagCount(int count) => APIs.Emulation.SetLagCount(count);
[LuaMethodExample("emu.limitframerate( true );")] [LuaMethodExample("emu.limitframerate( true );")]
[LuaMethod("limitframerate", "sets the limit framerate property of the emulator")] [LuaMethod("limitframerate", "sets the limit framerate property of the emulator")]
public void LimitFramerate(bool enabled) => APIs.Emu.LimitFramerate(enabled); public void LimitFramerate(bool enabled) => APIs.Emulation.LimitFramerate(enabled);
[LuaMethodExample("emu.minimizeframeskip( true );")] [LuaMethodExample("emu.minimizeframeskip( true );")]
[LuaMethod("minimizeframeskip", "Sets the autominimizeframeskip value of the emulator")] [LuaMethod("minimizeframeskip", "Sets the autominimizeframeskip value of the emulator")]
public void MinimizeFrameskip(bool enabled) => APIs.Emu.MinimizeFrameskip(enabled); public void MinimizeFrameskip(bool enabled) => APIs.Emulation.MinimizeFrameskip(enabled);
[LuaMethodExample("emu.setrenderplanes( true, false );")] [LuaMethodExample("emu.setrenderplanes( true, false );")]
[LuaMethod("setrenderplanes", "Toggles the drawing of sprites and background planes. Set to false or nil to disable a pane, anything else will draw them")] [LuaMethod("setrenderplanes", "Toggles the drawing of sprites and background planes. Set to false or nil to disable a pane, anything else will draw them")]
public void SetRenderPlanes(params bool[] luaParam) => APIs.Emu.SetRenderPlanes(luaParam); public void SetRenderPlanes(params bool[] luaParam) => APIs.Emulation.SetRenderPlanes(luaParam);
[LuaMethodExample("emu.yield( );")] [LuaMethodExample("emu.yield( );")]
[LuaMethod("yield", "allows a script to run while emulation is paused and interact with the gui/main window in realtime ")] [LuaMethod("yield", "allows a script to run while emulation is paused and interact with the gui/main window in realtime ")]
@ -103,11 +103,11 @@ namespace BizHawk.Client.Common
[LuaMethodExample("local stemuget = emu.getdisplaytype();")] [LuaMethodExample("local stemuget = emu.getdisplaytype();")]
[LuaMethod("getdisplaytype", "returns the display type (PAL vs NTSC) that the emulator is currently running in")] [LuaMethod("getdisplaytype", "returns the display type (PAL vs NTSC) that the emulator is currently running in")]
public string GetDisplayType() => APIs.Emu.GetDisplayType(); public string GetDisplayType() => APIs.Emulation.GetDisplayType();
[LuaMethodExample("local stemuget = emu.getboardname();")] [LuaMethodExample("local stemuget = emu.getboardname();")]
[LuaMethod("getboardname", "returns (if available) the board name of the loaded ROM")] [LuaMethod("getboardname", "returns (if available) the board name of the loaded ROM")]
public string GetBoardName() => APIs.Emu.GetBoardName(); public string GetBoardName() => APIs.Emulation.GetBoardName();
[LuaMethod("getluacore", "returns the name of the Lua core currently in use")] [LuaMethod("getluacore", "returns the name of the Lua core currently in use")]
public string GetLuaBackend() public string GetLuaBackend()

View File

@ -25,44 +25,44 @@ namespace BizHawk.Client.Common
[LuaMethod("getmemorydomainlist", "Returns a string of the memory domains for the loaded platform core. List will be a single string delimited by line feeds")] [LuaMethod("getmemorydomainlist", "Returns a string of the memory domains for the loaded platform core. List will be a single string delimited by line feeds")]
public LuaTable GetMemoryDomainList() public LuaTable GetMemoryDomainList()
{ {
return APIs.Mem return APIs.Memory
.GetMemoryDomainList() .GetMemoryDomainList()
.ToLuaTable(Lua); .ToLuaTable(Lua);
} }
[LuaMethodExample("local uimemget = memory.getmemorydomainsize( mainmemory.getname( ) );")] [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")] [LuaMethod("getmemorydomainsize", "Returns the number of bytes of the specified memory domain. If no domain is specified, or the specified domain doesn't exist, returns the current domain size")]
public uint GetMemoryDomainSize(string name = "") => APIs.Mem.GetMemoryDomainSize(name); public uint GetMemoryDomainSize(string name = "") => APIs.Memory.GetMemoryDomainSize(name);
[LuaMethodExample("local stmemget = memory.getcurrentmemorydomain( );")] [LuaMethodExample("local stmemget = memory.getcurrentmemorydomain( );")]
[LuaMethod("getcurrentmemorydomain", "Returns a string name of the current memory domain selected by Lua. The default is Main memory")] [LuaMethod("getcurrentmemorydomain", "Returns a string name of the current memory domain selected by Lua. The default is Main memory")]
public string GetCurrentMemoryDomain() => APIs.Mem.GetCurrentMemoryDomain(); public string GetCurrentMemoryDomain() => APIs.Memory.GetCurrentMemoryDomain();
[LuaMethodExample("local uimemget = memory.getcurrentmemorydomainsize( );")] [LuaMethodExample("local uimemget = memory.getcurrentmemorydomainsize( );")]
[LuaMethod("getcurrentmemorydomainsize", "Returns the number of bytes of the current memory domain selected by Lua. The default is Main memory")] [LuaMethod("getcurrentmemorydomainsize", "Returns the number of bytes of the current memory domain selected by Lua. The default is Main memory")]
public uint GetCurrentMemoryDomainSize() => APIs.Mem.GetCurrentMemoryDomainSize(); public uint GetCurrentMemoryDomainSize() => APIs.Memory.GetCurrentMemoryDomainSize();
[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;")] [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")] [LuaMethod("usememorydomain", "Attempts to set the current memory domain to the given domain. If the name does not match a valid memory domain, the function returns false, else it returns true")]
public bool UseMemoryDomain(string domain) => APIs.Mem.UseMemoryDomain(domain); public bool UseMemoryDomain(string domain) => APIs.Memory.UseMemoryDomain(domain);
[LuaMethodExample("local stmemhas = memory.hash_region( 0x100, 50, mainmemory.getname( ) );")] [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.")] [LuaMethod("hash_region", "Returns a hash as a string of a region of memory, starting from addr, through count bytes. If the domain is unspecified, it uses the current region.")]
public string HashRegion(int addr, int count, string domain = null) => APIs.Mem.HashRegion(addr, count, domain); public string HashRegion(int addr, int count, string domain = null) => APIs.Memory.HashRegion(addr, count, domain);
[LuaMethodExample("local uimemrea = memory.readbyte( 0x100, mainmemory.getname( ) );")] [LuaMethodExample("local uimemrea = memory.readbyte( 0x100, mainmemory.getname( ) );")]
[LuaMethod("readbyte", "gets the value from the given address as an unsigned byte")] [LuaMethod("readbyte", "gets the value from the given address as an unsigned byte")]
public uint ReadByte(int addr, string domain = null) => APIs.Mem.ReadByte(addr, domain); public uint ReadByte(int addr, string domain = null) => APIs.Memory.ReadByte(addr, domain);
[LuaMethodExample("memory.writebyte( 0x100, 1000, mainmemory.getname( ) );")] [LuaMethodExample("memory.writebyte( 0x100, 1000, mainmemory.getname( ) );")]
[LuaMethod("writebyte", "Writes the given value to the given address as an unsigned byte")] [LuaMethod("writebyte", "Writes the given value to the given address as an unsigned byte")]
public void WriteByte(int addr, uint value, string domain = null) => APIs.Mem.WriteByte(addr, value, domain); public void WriteByte(int addr, uint value, string domain = null) => APIs.Memory.WriteByte(addr, value, domain);
[LuaMethodExample("local nlmemrea = memory.readbyterange( 0x100, 30, mainmemory.getname( ) );")] [LuaMethodExample("local nlmemrea = memory.readbyterange( 0x100, 30, mainmemory.getname( ) );")]
[LuaMethod("readbyterange", "Reads the address range that starts from address, and is length long. Returns the result into a table of key value pairs (where the address is the key).")] [LuaMethod("readbyterange", "Reads the address range that starts from address, and is length long. Returns the result into a table of key value pairs (where the address is the key).")]
public LuaTable ReadByteRange(int addr, int length, string domain = null) public LuaTable ReadByteRange(int addr, int length, string domain = null)
{ {
return APIs.Mem return APIs.Memory
.ReadByteRange(addr, length, domain) .ReadByteRange(addr, length, domain)
.ToLuaTable(Lua); .ToLuaTable(Lua);
} }
@ -73,7 +73,7 @@ namespace BizHawk.Client.Common
public void WriteByteRange(LuaTable memoryblock, string domain = null) public void WriteByteRange(LuaTable memoryblock, string domain = null)
{ {
#if true #if true
foreach (var addr in memoryblock.Keys) APIs.Mem.WriteByte(LuaInt(addr), (uint) memoryblock[addr], domain); foreach (var addr in memoryblock.Keys) APIs.Memory.WriteByte(LuaInt(addr), (uint) memoryblock[addr], domain);
#else #else
var d = string.IsNullOrEmpty(domain) ? Domain : DomainList[VerifyMemoryDomain(domain)]; var d = string.IsNullOrEmpty(domain) ? Domain : DomainList[VerifyMemoryDomain(domain)];
if (d.CanPoke()) if (d.CanPoke())
@ -102,224 +102,224 @@ namespace BizHawk.Client.Common
[LuaMethod("readfloat", "Reads the given address as a 32-bit float value from the main memory domain with th e given endian")] [LuaMethod("readfloat", "Reads the given address as a 32-bit float value from the main memory domain with th e given endian")]
public float ReadFloat(int addr, bool bigendian, string domain = null) public float ReadFloat(int addr, bool bigendian, string domain = null)
{ {
APIs.Mem.SetBigEndian(bigendian); APIs.Memory.SetBigEndian(bigendian);
return APIs.Mem.ReadFloat(addr, domain); return APIs.Memory.ReadFloat(addr, domain);
} }
[LuaMethodExample("memory.writefloat( 0x100, 10.0, false, mainmemory.getname( ) );")] [LuaMethodExample("memory.writefloat( 0x100, 10.0, false, mainmemory.getname( ) );")]
[LuaMethod("writefloat", "Writes the given 32-bit float value to the given address and endian")] [LuaMethod("writefloat", "Writes the given 32-bit float value to the given address and endian")]
public void WriteFloat(int addr, double value, bool bigendian, string domain = null) public void WriteFloat(int addr, double value, bool bigendian, string domain = null)
{ {
APIs.Mem.SetBigEndian(bigendian); APIs.Memory.SetBigEndian(bigendian);
APIs.Mem.WriteFloat(addr, value, domain); APIs.Memory.WriteFloat(addr, value, domain);
} }
[LuaMethodExample("local inmemrea = memory.read_s8( 0x100, mainmemory.getname( ) );")] [LuaMethodExample("local inmemrea = memory.read_s8( 0x100, mainmemory.getname( ) );")]
[LuaMethod("read_s8", "read signed byte")] [LuaMethod("read_s8", "read signed byte")]
public int ReadS8(int addr, string domain = null) => APIs.Mem.ReadS8(addr, domain); public int ReadS8(int addr, string domain = null) => APIs.Memory.ReadS8(addr, domain);
[LuaMethodExample("memory.write_s8( 0x100, 1000, mainmemory.getname( ) );")] [LuaMethodExample("memory.write_s8( 0x100, 1000, mainmemory.getname( ) );")]
[LuaMethod("write_s8", "write signed byte")] [LuaMethod("write_s8", "write signed byte")]
public void WriteS8(int addr, uint value, string domain = null) => APIs.Mem.WriteS8(addr, unchecked((int) value), domain); public void WriteS8(int addr, uint value, string domain = null) => APIs.Memory.WriteS8(addr, unchecked((int) value), domain);
[LuaMethodExample("local uimemrea = memory.read_u8( 0x100, mainmemory.getname( ) );")] [LuaMethodExample("local uimemrea = memory.read_u8( 0x100, mainmemory.getname( ) );")]
[LuaMethod("read_u8", "read unsigned byte")] [LuaMethod("read_u8", "read unsigned byte")]
public uint ReadU8(int addr, string domain = null) => APIs.Mem.ReadU8(addr, domain); public uint ReadU8(int addr, string domain = null) => APIs.Memory.ReadU8(addr, domain);
[LuaMethodExample("memory.write_u8( 0x100, 1000, mainmemory.getname( ) );")] [LuaMethodExample("memory.write_u8( 0x100, 1000, mainmemory.getname( ) );")]
[LuaMethod("write_u8", "write unsigned byte")] [LuaMethod("write_u8", "write unsigned byte")]
public void WriteU8(int addr, uint value, string domain = null) => APIs.Mem.WriteU8(addr, value, domain); public void WriteU8(int addr, uint value, string domain = null) => APIs.Memory.WriteU8(addr, value, domain);
[LuaMethodExample("local inmemrea = memory.read_s16_le( 0x100, mainmemory.getname( ) );")] [LuaMethodExample("local inmemrea = memory.read_s16_le( 0x100, mainmemory.getname( ) );")]
[LuaMethod("read_s16_le", "read signed 2 byte value, little endian")] [LuaMethod("read_s16_le", "read signed 2 byte value, little endian")]
public int ReadS16Little(int addr, string domain = null) public int ReadS16Little(int addr, string domain = null)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
return APIs.Mem.ReadS16(addr, domain); return APIs.Memory.ReadS16(addr, domain);
} }
[LuaMethodExample("memory.write_s16_le( 0x100, -1000, mainmemory.getname( ) );")] [LuaMethodExample("memory.write_s16_le( 0x100, -1000, mainmemory.getname( ) );")]
[LuaMethod("write_s16_le", "write signed 2 byte value, little endian")] [LuaMethod("write_s16_le", "write signed 2 byte value, little endian")]
public void WriteS16Little(int addr, int value, string domain = null) public void WriteS16Little(int addr, int value, string domain = null)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
APIs.Mem.WriteS16(addr, value, domain); APIs.Memory.WriteS16(addr, value, domain);
} }
[LuaMethodExample("local inmemrea = memory.read_s16_be( 0x100, mainmemory.getname( ) );")] [LuaMethodExample("local inmemrea = memory.read_s16_be( 0x100, mainmemory.getname( ) );")]
[LuaMethod("read_s16_be", "read signed 2 byte value, big endian")] [LuaMethod("read_s16_be", "read signed 2 byte value, big endian")]
public int ReadS16Big(int addr, string domain = null) public int ReadS16Big(int addr, string domain = null)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
return APIs.Mem.ReadS16(addr, domain); return APIs.Memory.ReadS16(addr, domain);
} }
[LuaMethodExample("memory.write_s16_be( 0x100, -1000, mainmemory.getname( ) );")] [LuaMethodExample("memory.write_s16_be( 0x100, -1000, mainmemory.getname( ) );")]
[LuaMethod("write_s16_be", "write signed 2 byte value, big endian")] [LuaMethod("write_s16_be", "write signed 2 byte value, big endian")]
public void WriteS16Big(int addr, int value, string domain = null) public void WriteS16Big(int addr, int value, string domain = null)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
APIs.Mem.WriteS16(addr, value, domain); APIs.Memory.WriteS16(addr, value, domain);
} }
[LuaMethodExample("local uimemrea = memory.read_u16_le( 0x100, mainmemory.getname( ) );")] [LuaMethodExample("local uimemrea = memory.read_u16_le( 0x100, mainmemory.getname( ) );")]
[LuaMethod("read_u16_le", "read unsigned 2 byte value, little endian")] [LuaMethod("read_u16_le", "read unsigned 2 byte value, little endian")]
public uint ReadU16Little(int addr, string domain = null) public uint ReadU16Little(int addr, string domain = null)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
return APIs.Mem.ReadU16(addr, domain); return APIs.Memory.ReadU16(addr, domain);
} }
[LuaMethodExample("memory.write_u16_le( 0x100, 1000, mainmemory.getname( ) );")] [LuaMethodExample("memory.write_u16_le( 0x100, 1000, mainmemory.getname( ) );")]
[LuaMethod("write_u16_le", "write unsigned 2 byte value, little endian")] [LuaMethod("write_u16_le", "write unsigned 2 byte value, little endian")]
public void WriteU16Little(int addr, uint value, string domain = null) public void WriteU16Little(int addr, uint value, string domain = null)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
APIs.Mem.WriteU16(addr, value, domain); APIs.Memory.WriteU16(addr, value, domain);
} }
[LuaMethodExample("local uimemrea = memory.read_u16_be( 0x100, mainmemory.getname( ) );")] [LuaMethodExample("local uimemrea = memory.read_u16_be( 0x100, mainmemory.getname( ) );")]
[LuaMethod("read_u16_be", "read unsigned 2 byte value, big endian")] [LuaMethod("read_u16_be", "read unsigned 2 byte value, big endian")]
public uint ReadU16Big(int addr, string domain = null) public uint ReadU16Big(int addr, string domain = null)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
return APIs.Mem.ReadU16(addr, domain); return APIs.Memory.ReadU16(addr, domain);
} }
[LuaMethodExample("memory.write_u16_be( 0x100, 1000, mainmemory.getname( ) );")] [LuaMethodExample("memory.write_u16_be( 0x100, 1000, mainmemory.getname( ) );")]
[LuaMethod("write_u16_be", "write unsigned 2 byte value, big endian")] [LuaMethod("write_u16_be", "write unsigned 2 byte value, big endian")]
public void WriteU16Big(int addr, uint value, string domain = null) public void WriteU16Big(int addr, uint value, string domain = null)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
APIs.Mem.WriteU16(addr, value, domain); APIs.Memory.WriteU16(addr, value, domain);
} }
[LuaMethodExample("local inmemrea = memory.read_s24_le( 0x100, mainmemory.getname( ) );")] [LuaMethodExample("local inmemrea = memory.read_s24_le( 0x100, mainmemory.getname( ) );")]
[LuaMethod("read_s24_le", "read signed 24 bit value, little endian")] [LuaMethod("read_s24_le", "read signed 24 bit value, little endian")]
public int ReadS24Little(int addr, string domain = null) public int ReadS24Little(int addr, string domain = null)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
return APIs.Mem.ReadS24(addr, domain); return APIs.Memory.ReadS24(addr, domain);
} }
[LuaMethodExample("memory.write_s24_le( 0x100, -1000, mainmemory.getname( ) );")] [LuaMethodExample("memory.write_s24_le( 0x100, -1000, mainmemory.getname( ) );")]
[LuaMethod("write_s24_le", "write signed 24 bit value, little endian")] [LuaMethod("write_s24_le", "write signed 24 bit value, little endian")]
public void WriteS24Little(int addr, int value, string domain = null) public void WriteS24Little(int addr, int value, string domain = null)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
APIs.Mem.WriteS24(addr, value, domain); APIs.Memory.WriteS24(addr, value, domain);
} }
[LuaMethodExample("local inmemrea = memory.read_s24_be( 0x100, mainmemory.getname( ) );")] [LuaMethodExample("local inmemrea = memory.read_s24_be( 0x100, mainmemory.getname( ) );")]
[LuaMethod("read_s24_be", "read signed 24 bit value, big endian")] [LuaMethod("read_s24_be", "read signed 24 bit value, big endian")]
public int ReadS24Big(int addr, string domain = null) public int ReadS24Big(int addr, string domain = null)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
return APIs.Mem.ReadS24(addr, domain); return APIs.Memory.ReadS24(addr, domain);
} }
[LuaMethodExample("memory.write_s24_be( 0x100, -1000, mainmemory.getname( ) );")] [LuaMethodExample("memory.write_s24_be( 0x100, -1000, mainmemory.getname( ) );")]
[LuaMethod("write_s24_be", "write signed 24 bit value, big endian")] [LuaMethod("write_s24_be", "write signed 24 bit value, big endian")]
public void WriteS24Big(int addr, int value, string domain = null) public void WriteS24Big(int addr, int value, string domain = null)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
APIs.Mem.WriteS24(addr, value, domain); APIs.Memory.WriteS24(addr, value, domain);
} }
[LuaMethodExample("local uimemrea = memory.read_u24_le( 0x100, mainmemory.getname( ) );")] [LuaMethodExample("local uimemrea = memory.read_u24_le( 0x100, mainmemory.getname( ) );")]
[LuaMethod("read_u24_le", "read unsigned 24 bit value, little endian")] [LuaMethod("read_u24_le", "read unsigned 24 bit value, little endian")]
public uint ReadU24Little(int addr, string domain = null) public uint ReadU24Little(int addr, string domain = null)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
return APIs.Mem.ReadU24(addr, domain); return APIs.Memory.ReadU24(addr, domain);
} }
[LuaMethodExample("memory.write_u24_le( 0x100, 1000, mainmemory.getname( ) );")] [LuaMethodExample("memory.write_u24_le( 0x100, 1000, mainmemory.getname( ) );")]
[LuaMethod("write_u24_le", "write unsigned 24 bit value, little endian")] [LuaMethod("write_u24_le", "write unsigned 24 bit value, little endian")]
public void WriteU24Little(int addr, uint value, string domain = null) public void WriteU24Little(int addr, uint value, string domain = null)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
APIs.Mem.WriteU24(addr, value, domain); APIs.Memory.WriteU24(addr, value, domain);
} }
[LuaMethodExample("local uimemrea = memory.read_u24_be( 0x100, mainmemory.getname( ) );")] [LuaMethodExample("local uimemrea = memory.read_u24_be( 0x100, mainmemory.getname( ) );")]
[LuaMethod("read_u24_be", "read unsigned 24 bit value, big endian")] [LuaMethod("read_u24_be", "read unsigned 24 bit value, big endian")]
public uint ReadU24Big(int addr, string domain = null) public uint ReadU24Big(int addr, string domain = null)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
return APIs.Mem.ReadU24(addr, domain); return APIs.Memory.ReadU24(addr, domain);
} }
[LuaMethodExample("memory.write_u24_be( 0x100, 1000, mainmemory.getname( ) );")] [LuaMethodExample("memory.write_u24_be( 0x100, 1000, mainmemory.getname( ) );")]
[LuaMethod("write_u24_be", "write unsigned 24 bit value, big endian")] [LuaMethod("write_u24_be", "write unsigned 24 bit value, big endian")]
public void WriteU24Big(int addr, uint value, string domain = null) public void WriteU24Big(int addr, uint value, string domain = null)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
APIs.Mem.WriteU24(addr, value, domain); APIs.Memory.WriteU24(addr, value, domain);
} }
[LuaMethodExample("local inmemrea = memory.read_s32_le( 0x100, mainmemory.getname( ) );")] [LuaMethodExample("local inmemrea = memory.read_s32_le( 0x100, mainmemory.getname( ) );")]
[LuaMethod("read_s32_le", "read signed 4 byte value, little endian")] [LuaMethod("read_s32_le", "read signed 4 byte value, little endian")]
public int ReadS32Little(int addr, string domain = null) public int ReadS32Little(int addr, string domain = null)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
return APIs.Mem.ReadS32(addr, domain); return APIs.Memory.ReadS32(addr, domain);
} }
[LuaMethodExample("memory.write_s32_le( 0x100, -1000, mainmemory.getname( ) );")] [LuaMethodExample("memory.write_s32_le( 0x100, -1000, mainmemory.getname( ) );")]
[LuaMethod("write_s32_le", "write signed 4 byte value, little endian")] [LuaMethod("write_s32_le", "write signed 4 byte value, little endian")]
public void WriteS32Little(int addr, int value, string domain = null) public void WriteS32Little(int addr, int value, string domain = null)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
APIs.Mem.WriteS32(addr, value, domain); APIs.Memory.WriteS32(addr, value, domain);
} }
[LuaMethodExample("local inmemrea = memory.read_s32_be( 0x100, mainmemory.getname( ) );")] [LuaMethodExample("local inmemrea = memory.read_s32_be( 0x100, mainmemory.getname( ) );")]
[LuaMethod("read_s32_be", "read signed 4 byte value, big endian")] [LuaMethod("read_s32_be", "read signed 4 byte value, big endian")]
public int ReadS32Big(int addr, string domain = null) public int ReadS32Big(int addr, string domain = null)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
return APIs.Mem.ReadS32(addr, domain); return APIs.Memory.ReadS32(addr, domain);
} }
[LuaMethodExample("memory.write_s32_be( 0x100, -1000, mainmemory.getname( ) );")] [LuaMethodExample("memory.write_s32_be( 0x100, -1000, mainmemory.getname( ) );")]
[LuaMethod("write_s32_be", "write signed 4 byte value, big endian")] [LuaMethod("write_s32_be", "write signed 4 byte value, big endian")]
public void WriteS32Big(int addr, int value, string domain = null) public void WriteS32Big(int addr, int value, string domain = null)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
APIs.Mem.WriteS32(addr, value, domain); APIs.Memory.WriteS32(addr, value, domain);
} }
[LuaMethodExample("local uimemrea = memory.read_u32_le( 0x100, mainmemory.getname( ) );")] [LuaMethodExample("local uimemrea = memory.read_u32_le( 0x100, mainmemory.getname( ) );")]
[LuaMethod("read_u32_le", "read unsigned 4 byte value, little endian")] [LuaMethod("read_u32_le", "read unsigned 4 byte value, little endian")]
public uint ReadU32Little(int addr, string domain = null) public uint ReadU32Little(int addr, string domain = null)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
return APIs.Mem.ReadU32(addr, domain); return APIs.Memory.ReadU32(addr, domain);
} }
[LuaMethodExample("memory.write_u32_le( 0x100, 1000, mainmemory.getname( ) );")] [LuaMethodExample("memory.write_u32_le( 0x100, 1000, mainmemory.getname( ) );")]
[LuaMethod("write_u32_le", "write unsigned 4 byte value, little endian")] [LuaMethod("write_u32_le", "write unsigned 4 byte value, little endian")]
public void WriteU32Little(int addr, uint value, string domain = null) public void WriteU32Little(int addr, uint value, string domain = null)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
APIs.Mem.WriteU32(addr, value, domain); APIs.Memory.WriteU32(addr, value, domain);
} }
[LuaMethodExample("local uimemrea = memory.read_u32_be( 0x100, mainmemory.getname( ) );")] [LuaMethodExample("local uimemrea = memory.read_u32_be( 0x100, mainmemory.getname( ) );")]
[LuaMethod("read_u32_be", "read unsigned 4 byte value, big endian")] [LuaMethod("read_u32_be", "read unsigned 4 byte value, big endian")]
public uint ReadU32Big(int addr, string domain = null) public uint ReadU32Big(int addr, string domain = null)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
return APIs.Mem.ReadU32(addr, domain); return APIs.Memory.ReadU32(addr, domain);
} }
[LuaMethodExample("memory.write_u32_be( 0x100, 1000, mainmemory.getname( ) );")] [LuaMethodExample("memory.write_u32_be( 0x100, 1000, mainmemory.getname( ) );")]
[LuaMethod("write_u32_be", "write unsigned 4 byte value, big endian")] [LuaMethod("write_u32_be", "write unsigned 4 byte value, big endian")]
public void WriteU32Big(int addr, uint value, string domain = null) public void WriteU32Big(int addr, uint value, string domain = null)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
APIs.Mem.WriteU32(addr, value, domain); APIs.Memory.WriteU32(addr, value, domain);
} }
} }
} }

View File

@ -20,23 +20,23 @@ namespace BizHawk.Client.Common
[LuaMethodExample("local stSQLcre = SQL.createdatabase( \"eg_db\" );")] [LuaMethodExample("local stSQLcre = SQL.createdatabase( \"eg_db\" );")]
[LuaMethod("createdatabase", "Creates a SQLite Database. Name should end with .db")] [LuaMethod("createdatabase", "Creates a SQLite Database. Name should end with .db")]
public string CreateDatabase(string name) => APIs.Sql.CreateDatabase(name); public string CreateDatabase(string name) => APIs.SQLite.CreateDatabase(name);
[LuaMethodExample("local stSQLope = SQL.opendatabase( \"eg_db\" );")] [LuaMethodExample("local stSQLope = SQL.opendatabase( \"eg_db\" );")]
[LuaMethod("opendatabase", "Opens a SQLite database. Name should end with .db")] [LuaMethod("opendatabase", "Opens a SQLite database. Name should end with .db")]
public string OpenDatabase(string name) => APIs.Sql.OpenDatabase(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' );\" );")] [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. " + [LuaMethod("writecommand", "Runs a SQLite write command which includes CREATE,INSERT, UPDATE. " +
"Ex: create TABLE rewards (ID integer PRIMARY KEY, action VARCHAR(20)) ")] "Ex: create TABLE rewards (ID integer PRIMARY KEY, action VARCHAR(20)) ")]
public string WriteCommand(string query = "") => APIs.Sql.WriteCommand(query); public string WriteCommand(string query = "") => APIs.SQLite.WriteCommand(query);
[LuaMethodExample("local obSQLrea = SQL.readcommand( \"SELECT * FROM eg_tab WHERE eg_tab_id = 1;\" );")] [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." + [LuaMethod("readcommand", "Run a SQLite read command which includes Select. Returns all rows into a LuaTable." +
"Ex: select * from rewards")] "Ex: select * from rewards")]
public object ReadCommand(string query = "") public object ReadCommand(string query = "")
{ {
var result = APIs.Sql.ReadCommand(query); var result = APIs.SQLite.ReadCommand(query);
return result is Dictionary<string, object> dict ? dict.ToLuaTable(Lua) : result; return result is Dictionary<string, object> dict ? dict.ToLuaTable(Lua) : result;
} }
} }

View File

@ -21,8 +21,8 @@ namespace BizHawk.Client.Common
private GPGX.GPGXSettings Settings private GPGX.GPGXSettings Settings
{ {
get => APIs.Emu.GetSettings() as GPGX.GPGXSettings ?? new GPGX.GPGXSettings(); get => APIs.Emulation.GetSettings() as GPGX.GPGXSettings ?? new GPGX.GPGXSettings();
set => APIs.Emu.PutSettings(value); set => APIs.Emulation.PutSettings(value);
} }
[LuaMethodExample("if ( genesis.getlayer_bga( ) ) then\r\n\tconsole.log( \"Returns whether the bg layer A is displayed\" );\r\nend;")] [LuaMethodExample("if ( genesis.getlayer_bga( ) ) then\r\n\tconsole.log( \"Returns whether the bg layer A is displayed\" );\r\nend;")]

View File

@ -56,17 +56,17 @@ namespace BizHawk.Client.Common
[LuaMethodExample("local uimairea = mainmemory.readbyte( 0x100 );")] [LuaMethodExample("local uimairea = mainmemory.readbyte( 0x100 );")]
[LuaMethod("readbyte", "gets the value from the given address as an unsigned byte")] [LuaMethod("readbyte", "gets the value from the given address as an unsigned byte")]
public uint ReadByte(int addr) => APIs.Mem.ReadByte(addr, Domain.Name); public uint ReadByte(int addr) => APIs.Memory.ReadByte(addr, Domain.Name);
[LuaMethodExample("mainmemory.writebyte( 0x100, 1000 );")] [LuaMethodExample("mainmemory.writebyte( 0x100, 1000 );")]
[LuaMethod("writebyte", "Writes the given value to the given address as an unsigned byte")] [LuaMethod("writebyte", "Writes the given value to the given address as an unsigned byte")]
public void WriteByte(int addr, uint value) => APIs.Mem.WriteByte(addr, value, Domain.Name); public void WriteByte(int addr, uint value) => APIs.Memory.WriteByte(addr, value, Domain.Name);
[LuaMethodExample("local nlmairea = mainmemory.readbyterange( 0x100, 64 );")] [LuaMethodExample("local nlmairea = mainmemory.readbyterange( 0x100, 64 );")]
[LuaMethod("readbyterange", "Reads the address range that starts from address, and is length long. Returns the result into a table of key value pairs (where the address is the key).")] [LuaMethod("readbyterange", "Reads the address range that starts from address, and is length long. Returns the result into a table of key value pairs (where the address is the key).")]
public LuaTable ReadByteRange(int addr, int length) public LuaTable ReadByteRange(int addr, int length)
{ {
return APIs.Mem return APIs.Memory
.ReadByteRange(addr, length, Domain.Name) .ReadByteRange(addr, length, Domain.Name)
.ToLuaTable(Lua); .ToLuaTable(Lua);
} }
@ -77,7 +77,7 @@ namespace BizHawk.Client.Common
public void WriteByteRange(LuaTable memoryblock) public void WriteByteRange(LuaTable memoryblock)
{ {
#if true #if true
foreach (var addr in memoryblock.Keys) APIs.Mem.WriteByte(LuaInt(addr), (uint) memoryblock[addr], Domain.Name); foreach (var addr in memoryblock.Keys) APIs.Memory.WriteByte(LuaInt(addr), (uint) memoryblock[addr], Domain.Name);
#else #else
var d = Domain; var d = Domain;
if (d.CanPoke()) if (d.CanPoke())
@ -106,224 +106,224 @@ namespace BizHawk.Client.Common
[LuaMethod("readfloat", "Reads the given address as a 32-bit float value from the main memory domain with th e given endian")] [LuaMethod("readfloat", "Reads the given address as a 32-bit float value from the main memory domain with th e given endian")]
public float ReadFloat(int addr, bool bigendian) public float ReadFloat(int addr, bool bigendian)
{ {
APIs.Mem.SetBigEndian(bigendian); APIs.Memory.SetBigEndian(bigendian);
return APIs.Mem.ReadFloat(addr, Domain.Name); return APIs.Memory.ReadFloat(addr, Domain.Name);
} }
[LuaMethodExample("mainmemory.writefloat( 0x100, 10.0, false );")] [LuaMethodExample("mainmemory.writefloat( 0x100, 10.0, false );")]
[LuaMethod("writefloat", "Writes the given 32-bit float value to the given address and endian")] [LuaMethod("writefloat", "Writes the given 32-bit float value to the given address and endian")]
public void WriteFloat(int addr, double value, bool bigendian) public void WriteFloat(int addr, double value, bool bigendian)
{ {
APIs.Mem.SetBigEndian(bigendian); APIs.Memory.SetBigEndian(bigendian);
APIs.Mem.WriteFloat(addr, value, Domain.Name); APIs.Memory.WriteFloat(addr, value, Domain.Name);
} }
[LuaMethodExample("local inmairea = mainmemory.read_s8( 0x100 );")] [LuaMethodExample("local inmairea = mainmemory.read_s8( 0x100 );")]
[LuaMethod("read_s8", "read signed byte")] [LuaMethod("read_s8", "read signed byte")]
public int ReadS8(int addr) => APIs.Mem.ReadS8(addr, Domain.Name); public int ReadS8(int addr) => APIs.Memory.ReadS8(addr, Domain.Name);
[LuaMethodExample("mainmemory.write_s8( 0x100, 1000 );")] [LuaMethodExample("mainmemory.write_s8( 0x100, 1000 );")]
[LuaMethod("write_s8", "write signed byte")] [LuaMethod("write_s8", "write signed byte")]
public void WriteS8(int addr, uint value) => APIs.Mem.WriteS8(addr, unchecked((int) value), Domain.Name); public void WriteS8(int addr, uint value) => APIs.Memory.WriteS8(addr, unchecked((int) value), Domain.Name);
[LuaMethodExample("local uimairea = mainmemory.read_u8( 0x100 );")] [LuaMethodExample("local uimairea = mainmemory.read_u8( 0x100 );")]
[LuaMethod("read_u8", "read unsigned byte")] [LuaMethod("read_u8", "read unsigned byte")]
public uint ReadU8(int addr) => APIs.Mem.ReadU8(addr, Domain.Name); public uint ReadU8(int addr) => APIs.Memory.ReadU8(addr, Domain.Name);
[LuaMethodExample("mainmemory.write_u8( 0x100, 1000 );")] [LuaMethodExample("mainmemory.write_u8( 0x100, 1000 );")]
[LuaMethod("write_u8", "write unsigned byte")] [LuaMethod("write_u8", "write unsigned byte")]
public void WriteU8(int addr, uint value) => APIs.Mem.WriteU8(addr, value, Domain.Name); public void WriteU8(int addr, uint value) => APIs.Memory.WriteU8(addr, value, Domain.Name);
[LuaMethodExample("local inmairea = mainmemory.read_s16_le( 0x100 );")] [LuaMethodExample("local inmairea = mainmemory.read_s16_le( 0x100 );")]
[LuaMethod("read_s16_le", "read signed 2 byte value, little endian")] [LuaMethod("read_s16_le", "read signed 2 byte value, little endian")]
public int ReadS16Little(int addr) public int ReadS16Little(int addr)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
return APIs.Mem.ReadS16(addr, Domain.Name); return APIs.Memory.ReadS16(addr, Domain.Name);
} }
[LuaMethodExample("mainmemory.write_s16_le( 0x100, -1000 );")] [LuaMethodExample("mainmemory.write_s16_le( 0x100, -1000 );")]
[LuaMethod("write_s16_le", "write signed 2 byte value, little endian")] [LuaMethod("write_s16_le", "write signed 2 byte value, little endian")]
public void WriteS16Little(int addr, int value) public void WriteS16Little(int addr, int value)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
APIs.Mem.WriteS16(addr, value, Domain.Name); APIs.Memory.WriteS16(addr, value, Domain.Name);
} }
[LuaMethodExample("local inmairea = mainmemory.read_s16_be( 0x100 );")] [LuaMethodExample("local inmairea = mainmemory.read_s16_be( 0x100 );")]
[LuaMethod("read_s16_be", "read signed 2 byte value, big endian")] [LuaMethod("read_s16_be", "read signed 2 byte value, big endian")]
public int ReadS16Big(int addr) public int ReadS16Big(int addr)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
return APIs.Mem.ReadS16(addr, Domain.Name); return APIs.Memory.ReadS16(addr, Domain.Name);
} }
[LuaMethodExample("mainmemory.write_s16_be( 0x100, -1000 );")] [LuaMethodExample("mainmemory.write_s16_be( 0x100, -1000 );")]
[LuaMethod("write_s16_be", "write signed 2 byte value, big endian")] [LuaMethod("write_s16_be", "write signed 2 byte value, big endian")]
public void WriteS16Big(int addr, int value) public void WriteS16Big(int addr, int value)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
APIs.Mem.WriteS16(addr, value, Domain.Name); APIs.Memory.WriteS16(addr, value, Domain.Name);
} }
[LuaMethodExample("local uimairea = mainmemory.read_u16_le( 0x100 );")] [LuaMethodExample("local uimairea = mainmemory.read_u16_le( 0x100 );")]
[LuaMethod("read_u16_le", "read unsigned 2 byte value, little endian")] [LuaMethod("read_u16_le", "read unsigned 2 byte value, little endian")]
public uint ReadU16Little(int addr) public uint ReadU16Little(int addr)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
return APIs.Mem.ReadU16(addr, Domain.Name); return APIs.Memory.ReadU16(addr, Domain.Name);
} }
[LuaMethodExample("mainmemory.write_u16_le( 0x100, 1000 );")] [LuaMethodExample("mainmemory.write_u16_le( 0x100, 1000 );")]
[LuaMethod("write_u16_le", "write unsigned 2 byte value, little endian")] [LuaMethod("write_u16_le", "write unsigned 2 byte value, little endian")]
public void WriteU16Little(int addr, uint value) public void WriteU16Little(int addr, uint value)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
APIs.Mem.WriteU16(addr, value, Domain.Name); APIs.Memory.WriteU16(addr, value, Domain.Name);
} }
[LuaMethodExample("local uimairea = mainmemory.read_u16_be( 0x100 );")] [LuaMethodExample("local uimairea = mainmemory.read_u16_be( 0x100 );")]
[LuaMethod("read_u16_be", "read unsigned 2 byte value, big endian")] [LuaMethod("read_u16_be", "read unsigned 2 byte value, big endian")]
public uint ReadU16Big(int addr) public uint ReadU16Big(int addr)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
return APIs.Mem.ReadU16(addr, Domain.Name); return APIs.Memory.ReadU16(addr, Domain.Name);
} }
[LuaMethodExample("mainmemory.write_u16_be( 0x100, 1000 );")] [LuaMethodExample("mainmemory.write_u16_be( 0x100, 1000 );")]
[LuaMethod("write_u16_be", "write unsigned 2 byte value, big endian")] [LuaMethod("write_u16_be", "write unsigned 2 byte value, big endian")]
public void WriteU16Big(int addr, uint value) public void WriteU16Big(int addr, uint value)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
APIs.Mem.WriteU16(addr, value, Domain.Name); APIs.Memory.WriteU16(addr, value, Domain.Name);
} }
[LuaMethodExample("local inmairea = mainmemory.read_s24_le( 0x100 );")] [LuaMethodExample("local inmairea = mainmemory.read_s24_le( 0x100 );")]
[LuaMethod("read_s24_le", "read signed 24 bit value, little endian")] [LuaMethod("read_s24_le", "read signed 24 bit value, little endian")]
public int ReadS24Little(int addr) public int ReadS24Little(int addr)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
return APIs.Mem.ReadS24(addr, Domain.Name); return APIs.Memory.ReadS24(addr, Domain.Name);
} }
[LuaMethodExample("mainmemory.write_s24_le( 0x100, -1000 );")] [LuaMethodExample("mainmemory.write_s24_le( 0x100, -1000 );")]
[LuaMethod("write_s24_le", "write signed 24 bit value, little endian")] [LuaMethod("write_s24_le", "write signed 24 bit value, little endian")]
public void WriteS24Little(int addr, int value) public void WriteS24Little(int addr, int value)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
APIs.Mem.WriteS24(addr, value, Domain.Name); APIs.Memory.WriteS24(addr, value, Domain.Name);
} }
[LuaMethodExample("local inmairea = mainmemory.read_s24_be( 0x100 );")] [LuaMethodExample("local inmairea = mainmemory.read_s24_be( 0x100 );")]
[LuaMethod("read_s24_be", "read signed 24 bit value, big endian")] [LuaMethod("read_s24_be", "read signed 24 bit value, big endian")]
public int ReadS24Big(int addr) public int ReadS24Big(int addr)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
return APIs.Mem.ReadS24(addr, Domain.Name); return APIs.Memory.ReadS24(addr, Domain.Name);
} }
[LuaMethodExample("mainmemory.write_s24_be( 0x100, -1000 );")] [LuaMethodExample("mainmemory.write_s24_be( 0x100, -1000 );")]
[LuaMethod("write_s24_be", "write signed 24 bit value, big endian")] [LuaMethod("write_s24_be", "write signed 24 bit value, big endian")]
public void WriteS24Big(int addr, int value) public void WriteS24Big(int addr, int value)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
APIs.Mem.WriteS24(addr, value, Domain.Name); APIs.Memory.WriteS24(addr, value, Domain.Name);
} }
[LuaMethodExample("local uimairea = mainmemory.read_u24_le( 0x100 );")] [LuaMethodExample("local uimairea = mainmemory.read_u24_le( 0x100 );")]
[LuaMethod("read_u24_le", "read unsigned 24 bit value, little endian")] [LuaMethod("read_u24_le", "read unsigned 24 bit value, little endian")]
public uint ReadU24Little(int addr) public uint ReadU24Little(int addr)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
return APIs.Mem.ReadU24(addr, Domain.Name); return APIs.Memory.ReadU24(addr, Domain.Name);
} }
[LuaMethodExample("mainmemory.write_u24_le( 0x100, 1000 );")] [LuaMethodExample("mainmemory.write_u24_le( 0x100, 1000 );")]
[LuaMethod("write_u24_le", "write unsigned 24 bit value, little endian")] [LuaMethod("write_u24_le", "write unsigned 24 bit value, little endian")]
public void WriteU24Little(int addr, uint value) public void WriteU24Little(int addr, uint value)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
APIs.Mem.WriteU24(addr, value, Domain.Name); APIs.Memory.WriteU24(addr, value, Domain.Name);
} }
[LuaMethodExample("local uimairea = mainmemory.read_u24_be( 0x100 );")] [LuaMethodExample("local uimairea = mainmemory.read_u24_be( 0x100 );")]
[LuaMethod("read_u24_be", "read unsigned 24 bit value, big endian")] [LuaMethod("read_u24_be", "read unsigned 24 bit value, big endian")]
public uint ReadU24Big(int addr) public uint ReadU24Big(int addr)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
return APIs.Mem.ReadU24(addr, Domain.Name); return APIs.Memory.ReadU24(addr, Domain.Name);
} }
[LuaMethodExample("mainmemory.write_u24_be( 0x100, 1000 );")] [LuaMethodExample("mainmemory.write_u24_be( 0x100, 1000 );")]
[LuaMethod("write_u24_be", "write unsigned 24 bit value, big endian")] [LuaMethod("write_u24_be", "write unsigned 24 bit value, big endian")]
public void WriteU24Big(int addr, uint value) public void WriteU24Big(int addr, uint value)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
APIs.Mem.WriteU24(addr, value, Domain.Name); APIs.Memory.WriteU24(addr, value, Domain.Name);
} }
[LuaMethodExample("local inmairea = mainmemory.read_s32_le( 0x100 );")] [LuaMethodExample("local inmairea = mainmemory.read_s32_le( 0x100 );")]
[LuaMethod("read_s32_le", "read signed 4 byte value, little endian")] [LuaMethod("read_s32_le", "read signed 4 byte value, little endian")]
public int ReadS32Little(int addr) public int ReadS32Little(int addr)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
return APIs.Mem.ReadS32(addr, Domain.Name); return APIs.Memory.ReadS32(addr, Domain.Name);
} }
[LuaMethodExample("mainmemory.write_s32_le( 0x100, -1000 );")] [LuaMethodExample("mainmemory.write_s32_le( 0x100, -1000 );")]
[LuaMethod("write_s32_le", "write signed 4 byte value, little endian")] [LuaMethod("write_s32_le", "write signed 4 byte value, little endian")]
public void WriteS32Little(int addr, int value) public void WriteS32Little(int addr, int value)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
APIs.Mem.WriteS32(addr, value, Domain.Name); APIs.Memory.WriteS32(addr, value, Domain.Name);
} }
[LuaMethodExample("local inmairea = mainmemory.read_s32_be( 0x100 );")] [LuaMethodExample("local inmairea = mainmemory.read_s32_be( 0x100 );")]
[LuaMethod("read_s32_be", "read signed 4 byte value, big endian")] [LuaMethod("read_s32_be", "read signed 4 byte value, big endian")]
public int ReadS32Big(int addr) public int ReadS32Big(int addr)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
return APIs.Mem.ReadS32(addr, Domain.Name); return APIs.Memory.ReadS32(addr, Domain.Name);
} }
[LuaMethodExample("mainmemory.write_s32_be( 0x100, -1000 );")] [LuaMethodExample("mainmemory.write_s32_be( 0x100, -1000 );")]
[LuaMethod("write_s32_be", "write signed 4 byte value, big endian")] [LuaMethod("write_s32_be", "write signed 4 byte value, big endian")]
public void WriteS32Big(int addr, int value) public void WriteS32Big(int addr, int value)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
APIs.Mem.WriteS32(addr, value, Domain.Name); APIs.Memory.WriteS32(addr, value, Domain.Name);
} }
[LuaMethodExample("local uimairea = mainmemory.read_u32_le( 0x100 );")] [LuaMethodExample("local uimairea = mainmemory.read_u32_le( 0x100 );")]
[LuaMethod("read_u32_le", "read unsigned 4 byte value, little endian")] [LuaMethod("read_u32_le", "read unsigned 4 byte value, little endian")]
public uint ReadU32Little(int addr) public uint ReadU32Little(int addr)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
return APIs.Mem.ReadU32(addr, Domain.Name); return APIs.Memory.ReadU32(addr, Domain.Name);
} }
[LuaMethodExample("mainmemory.write_u32_le( 0x100, 1000 );")] [LuaMethodExample("mainmemory.write_u32_le( 0x100, 1000 );")]
[LuaMethod("write_u32_le", "write unsigned 4 byte value, little endian")] [LuaMethod("write_u32_le", "write unsigned 4 byte value, little endian")]
public void WriteU32Little(int addr, uint value) public void WriteU32Little(int addr, uint value)
{ {
APIs.Mem.SetBigEndian(false); APIs.Memory.SetBigEndian(false);
APIs.Mem.WriteU32(addr, value, Domain.Name); APIs.Memory.WriteU32(addr, value, Domain.Name);
} }
[LuaMethodExample("local uimairea = mainmemory.read_u32_be( 0x100 );")] [LuaMethodExample("local uimairea = mainmemory.read_u32_be( 0x100 );")]
[LuaMethod("read_u32_be", "read unsigned 4 byte value, big endian")] [LuaMethod("read_u32_be", "read unsigned 4 byte value, big endian")]
public uint ReadU32Big(int addr) public uint ReadU32Big(int addr)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
return APIs.Mem.ReadU32(addr, Domain.Name); return APIs.Memory.ReadU32(addr, Domain.Name);
} }
[LuaMethodExample("mainmemory.write_u32_be( 0x100, 1000 );")] [LuaMethodExample("mainmemory.write_u32_be( 0x100, 1000 );")]
[LuaMethod("write_u32_be", "write unsigned 4 byte value, big endian")] [LuaMethod("write_u32_be", "write unsigned 4 byte value, big endian")]
public void WriteU32Big(int addr, uint value) public void WriteU32Big(int addr, uint value)
{ {
APIs.Mem.SetBigEndian(); APIs.Memory.SetBigEndian();
APIs.Mem.WriteU32(addr, value, Domain.Name); APIs.Memory.WriteU32(addr, value, Domain.Name);
} }
} }
} }

View File

@ -31,8 +31,8 @@ namespace BizHawk.Client.Common
private object Settings private object Settings
{ {
get => APIs.Emu.GetSettings(); get => APIs.Emulation.GetSettings();
set => APIs.Emu.PutSettings(value); set => APIs.Emulation.PutSettings(value);
} }
[LuaDeprecatedMethod] [LuaDeprecatedMethod]

View File

@ -20,8 +20,8 @@ namespace BizHawk.Client.Common
private LibsnesCore.SnesSettings Settings private LibsnesCore.SnesSettings Settings
{ {
get => APIs.Emu.GetSettings() as LibsnesCore.SnesSettings ?? new LibsnesCore.SnesSettings(); get => APIs.Emulation.GetSettings() as LibsnesCore.SnesSettings ?? new LibsnesCore.SnesSettings();
set => APIs.Emu.PutSettings(value); set => APIs.Emulation.PutSettings(value);
} }
[LuaMethodExample("if ( snes.getlayer_bg_1( ) ) then\r\n\tconsole.log( \"Returns whether the bg 1 layer is displayed\" );\r\nend;")] [LuaMethodExample("if ( snes.getlayer_bg_1( ) ) then\r\n\tconsole.log( \"Returns whether the bg 1 layer is displayed\" );\r\nend;")]

View File

@ -14,7 +14,7 @@ using BizHawk.Emulation.Cores.WonderSwan;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[Description("A library for interacting with the currently loaded emulator core")] [Description("A library for interacting with the currently loaded emulator core")]
public sealed class EmuApi : IEmuApi public sealed class EmulationApi : IEmulationApi
{ {
[RequiredService] [RequiredService]
private IEmulator Emulator { get; set; } private IEmulator Emulator { get; set; }
@ -37,16 +37,16 @@ namespace BizHawk.Client.EmuHawk
[OptionalService] [OptionalService]
private IRegionable RegionableCore { get; set; } private IRegionable RegionableCore { get; set; }
public EmuApi(Action<string> logCallback) public EmulationApi(Action<string> logCallback)
{ {
LogCallback = logCallback; LogCallback = logCallback;
} }
public EmuApi() : this(Console.WriteLine) {} public EmulationApi() : this(Console.WriteLine) {}
private readonly Action<string> LogCallback; private readonly Action<string> LogCallback;
/// <summary>Using this property to get a reference to <see cref="GlobalWin.Config">GlobalWin.Config</see> is a terrible, horrible, no good, very bad idea. That's why it's not in the <see cref="IEmuApi">interface</see>.</summary> /// <summary>Using this property to get a reference to <see cref="GlobalWin.Config">GlobalWin.Config</see> is a terrible, horrible, no good, very bad idea. That's why it's not in the <see cref="IEmulationApi">interface</see>.</summary>
public Config ForbiddenConfigReference public Config ForbiddenConfigReference
{ {
get get

View File

@ -7,7 +7,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public sealed class MovieApi : IInputMovieApi public sealed class MovieApi : IMovieApi
{ {
public MovieApi(Action<string> logCallback) public MovieApi(Action<string> logCallback)
{ {

View File

@ -6,12 +6,12 @@ using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public sealed class SavestateLuaLibrary : DelegatingLuaLibraryEmu public sealed class SaveStateLuaLibrary : DelegatingLuaLibraryEmu
{ {
public SavestateLuaLibrary(Lua lua) public SaveStateLuaLibrary(Lua lua)
: base(lua) { } : base(lua) { }
public SavestateLuaLibrary(Lua lua, Action<string> logOutputCallback) public SaveStateLuaLibrary(Lua lua, Action<string> logOutputCallback)
: base(lua, logOutputCallback) { } : base(lua, logOutputCallback) { }
public override string Name => "savestate"; public override string Name => "savestate";