Lua - Refactor bit library to be its own class, proof of concept for the remaining libraries
This commit is contained in:
parent
5e8947a094
commit
3e1c28f26c
BizHawk.MultiClient
|
@ -445,6 +445,7 @@
|
|||
</Compile>
|
||||
<Compile Include="tools\Lua\Libraries\EmuLuaLibrary.Bit.cs" />
|
||||
<Compile Include="tools\Lua\Libraries\EmuLuaLibrary.Client.cs" />
|
||||
<Compile Include="tools\Lua\Libraries\EmuLuaLibrary.Common.cs" />
|
||||
<Compile Include="tools\Lua\Libraries\EmuLuaLibrary.Console.cs" />
|
||||
<Compile Include="tools\Lua\Libraries\EmuLuaLibrary.cs" />
|
||||
<Compile Include="tools\Lua\Libraries\EmuLuaLibrary.Emu.cs" />
|
||||
|
|
|
@ -1,45 +1,62 @@
|
|||
namespace BizHawk.MultiClient
|
||||
using System;
|
||||
|
||||
namespace BizHawk.MultiClient
|
||||
{
|
||||
public partial class EmuLuaLibrary
|
||||
public static class BitLuaLibrary
|
||||
{
|
||||
public uint bit_band(object val, object amt)
|
||||
public static string Name = "bit";
|
||||
public static string[] Functions = new[]
|
||||
{
|
||||
return (uint)(LuaInt(val) & LuaInt(amt));
|
||||
"band",
|
||||
"bnot",
|
||||
"bor",
|
||||
"bxor",
|
||||
"lshift",
|
||||
"rol",
|
||||
"ror",
|
||||
"rshift",
|
||||
};
|
||||
|
||||
public static uint bit_band(object val, object amt)
|
||||
{
|
||||
return (uint)(LuaCommon.LuaInt(val) & LuaCommon.LuaInt(amt));
|
||||
}
|
||||
|
||||
public uint bit_bnot(object val)
|
||||
public static uint bit_bnot(object val)
|
||||
{
|
||||
return (uint)(~LuaInt(val));
|
||||
return (uint)(~LuaCommon.LuaInt(val));
|
||||
}
|
||||
|
||||
public uint bit_bor(object val, object amt)
|
||||
public static uint bit_bor(object val, object amt)
|
||||
{
|
||||
return (uint)(LuaInt(val) | LuaInt(amt));
|
||||
return (uint)(LuaCommon.LuaInt(val) | LuaCommon.LuaInt(amt));
|
||||
}
|
||||
|
||||
public uint bit_bxor(object val, object amt)
|
||||
public static uint bit_bxor(object val, object amt)
|
||||
{
|
||||
return (uint)(LuaInt(val) ^ LuaInt(amt));
|
||||
return (uint)(LuaCommon.LuaInt(val) ^ LuaCommon.LuaInt(amt));
|
||||
}
|
||||
|
||||
public uint bit_lshift(object val, object amt)
|
||||
public static uint bit_lshift(object val, object amt)
|
||||
{
|
||||
return (uint)(LuaInt(val) << LuaInt(amt));
|
||||
return (uint)(LuaCommon.LuaInt(val) << LuaCommon.LuaInt(amt));
|
||||
}
|
||||
|
||||
public uint bit_rol(object val, object amt)
|
||||
public static uint bit_rol(object val, object amt)
|
||||
{
|
||||
return (uint)((LuaInt(val) << LuaInt(amt)) | (LuaInt(val) >> (32 - LuaInt(amt))));
|
||||
return (uint)((LuaCommon.LuaInt(val) << LuaCommon.LuaInt(amt))
|
||||
| (LuaCommon.LuaInt(val) >> (32 - LuaCommon.LuaInt(amt))));
|
||||
}
|
||||
|
||||
public uint bit_ror(object val, object amt)
|
||||
public static uint bit_ror(object val, object amt)
|
||||
{
|
||||
return (uint)((LuaInt(val) >> LuaInt(amt)) | (LuaInt(val) << (32 - LuaInt(amt))));
|
||||
return (uint)((LuaCommon.LuaInt(val) >> LuaCommon.LuaInt(amt))
|
||||
| (LuaCommon.LuaInt(val) << (32 - LuaCommon.LuaInt(amt))));
|
||||
}
|
||||
|
||||
public uint bit_rshift(object val, object amt)
|
||||
public static uint bit_rshift(object val, object amt)
|
||||
{
|
||||
return (uint)(LuaInt(val) >> LuaInt(amt));
|
||||
return (uint)(LuaCommon.LuaInt(val) >> LuaCommon.LuaInt(amt));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
|
||||
namespace BizHawk.MultiClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Generic helper functions for Lua Libraries
|
||||
/// </summary>
|
||||
public static class LuaCommon
|
||||
{
|
||||
public static int LuaInt(object lua_arg)
|
||||
{
|
||||
return Convert.ToInt32((double)lua_arg);
|
||||
}
|
||||
|
||||
public static uint LuaUInt(object lua_arg)
|
||||
{
|
||||
return Convert.ToUInt32((double)lua_arg);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -136,7 +136,7 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
else
|
||||
{
|
||||
_addr = LuaInt(address);
|
||||
_addr = LuaCommon.LuaInt(address);
|
||||
}
|
||||
|
||||
Global.Emulator.CoreComm.MemoryCallbackSystem.ReadAddr = _addr;
|
||||
|
@ -173,7 +173,7 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
else
|
||||
{
|
||||
_addr = LuaInt(address);
|
||||
_addr = LuaCommon.LuaInt(address);
|
||||
}
|
||||
|
||||
Global.Emulator.CoreComm.MemoryCallbackSystem.WriteAddr = _addr;
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private LuaWinform GetForm(object form_handle)
|
||||
{
|
||||
IntPtr ptr = new IntPtr(LuaInt(form_handle));
|
||||
IntPtr ptr = new IntPtr(LuaCommon.LuaInt(form_handle));
|
||||
return LuaForms.FirstOrDefault(form => form.Handle == ptr);
|
||||
}
|
||||
|
||||
|
@ -38,8 +38,8 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
if (X != null && Y != null)
|
||||
{
|
||||
int x = LuaInt(X);
|
||||
int y = LuaInt(Y);
|
||||
int x = LuaCommon.LuaInt(X);
|
||||
int y = LuaCommon.LuaInt(Y);
|
||||
control.Location = new Point(x, y);
|
||||
}
|
||||
}
|
||||
|
@ -55,8 +55,8 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
if (Width != null && Height != null)
|
||||
{
|
||||
int width = LuaInt(Width);
|
||||
int height = LuaInt(Height);
|
||||
int width = LuaCommon.LuaInt(Width);
|
||||
int height = LuaCommon.LuaInt(Height);
|
||||
control.Size = new Size(width, height);
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public void forms_addclick(object handle, LuaFunction lua_event)
|
||||
{
|
||||
IntPtr ptr = new IntPtr(LuaInt(handle));
|
||||
IntPtr ptr = new IntPtr(LuaCommon.LuaInt(handle));
|
||||
foreach (LuaWinform form in LuaForms)
|
||||
{
|
||||
foreach (Control control in form.Controls)
|
||||
|
@ -115,7 +115,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public void forms_clearclicks(object handle)
|
||||
{
|
||||
IntPtr ptr = new IntPtr(LuaInt(handle));
|
||||
IntPtr ptr = new IntPtr(LuaCommon.LuaInt(handle));
|
||||
foreach (LuaWinform form in LuaForms)
|
||||
{
|
||||
foreach (Control control in form.Controls)
|
||||
|
@ -134,7 +134,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public bool forms_destroy(object handle)
|
||||
{
|
||||
IntPtr ptr = new IntPtr(LuaInt(handle));
|
||||
IntPtr ptr = new IntPtr(LuaCommon.LuaInt(handle));
|
||||
foreach (LuaWinform form in LuaForms)
|
||||
{
|
||||
if (form.Handle == ptr)
|
||||
|
@ -160,7 +160,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
try
|
||||
{
|
||||
IntPtr ptr = new IntPtr(LuaInt(handle));
|
||||
IntPtr ptr = new IntPtr(LuaCommon.LuaInt(handle));
|
||||
foreach (LuaWinform form in LuaForms)
|
||||
{
|
||||
if (form.Handle == ptr)
|
||||
|
@ -191,7 +191,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
try
|
||||
{
|
||||
IntPtr ptr = new IntPtr(LuaInt(handle));
|
||||
IntPtr ptr = new IntPtr(LuaCommon.LuaInt(handle));
|
||||
foreach (LuaWinform form in LuaForms)
|
||||
{
|
||||
if (form.Handle == ptr)
|
||||
|
@ -245,7 +245,7 @@ namespace BizHawk.MultiClient
|
|||
LuaForms.Add(theForm);
|
||||
if (Width != null && Height != null)
|
||||
{
|
||||
theForm.Size = new Size(LuaInt(Width), LuaInt(Height));
|
||||
theForm.Size = new Size(LuaCommon.LuaInt(Width), LuaCommon.LuaInt(Height));
|
||||
}
|
||||
|
||||
if (title != null)
|
||||
|
@ -282,7 +282,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public void forms_setlocation(object handle, object X, object Y)
|
||||
{
|
||||
IntPtr ptr = new IntPtr(LuaInt(handle));
|
||||
IntPtr ptr = new IntPtr(LuaCommon.LuaInt(handle));
|
||||
foreach (LuaWinform form in LuaForms)
|
||||
{
|
||||
if (form.Handle == ptr)
|
||||
|
@ -304,7 +304,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public void forms_setproperty(object handle, object property, object value)
|
||||
{
|
||||
IntPtr ptr = new IntPtr(LuaInt(handle));
|
||||
IntPtr ptr = new IntPtr(LuaCommon.LuaInt(handle));
|
||||
foreach (LuaWinform form in LuaForms)
|
||||
{
|
||||
if (form.Handle == ptr)
|
||||
|
@ -326,7 +326,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public void forms_setsize(object handle, object Width, object Height)
|
||||
{
|
||||
IntPtr ptr = new IntPtr(LuaInt(handle));
|
||||
IntPtr ptr = new IntPtr(LuaCommon.LuaInt(handle));
|
||||
foreach (LuaWinform form in LuaForms)
|
||||
{
|
||||
if (form.Handle == ptr)
|
||||
|
@ -348,7 +348,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public void forms_settext(object handle, object caption)
|
||||
{
|
||||
IntPtr ptr = new IntPtr(LuaInt(handle));
|
||||
IntPtr ptr = new IntPtr(LuaCommon.LuaInt(handle));
|
||||
foreach (LuaWinform form in LuaForms)
|
||||
{
|
||||
if (form.Handle == ptr)
|
||||
|
|
|
@ -116,8 +116,8 @@ namespace BizHawk.MultiClient
|
|||
if (background == null)
|
||||
background = "black";
|
||||
}
|
||||
int dx = LuaInt(luaX);
|
||||
int dy = LuaInt(luaY);
|
||||
int dx = LuaCommon.LuaInt(luaX);
|
||||
int dy = LuaCommon.LuaInt(luaY);
|
||||
int a = 0;
|
||||
if (anchor != null)
|
||||
{
|
||||
|
@ -135,7 +135,7 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
else
|
||||
{
|
||||
a = LuaInt(anchor);
|
||||
a = LuaCommon.LuaInt(anchor);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -178,7 +178,7 @@ namespace BizHawk.MultiClient
|
|||
int i = 0;
|
||||
foreach (LuaTable point in points.Values)
|
||||
{
|
||||
Points[i] = new Point(LuaInt(point[1]), LuaInt(point[2]));
|
||||
Points[i] = new Point(LuaCommon.LuaInt(point[1]), LuaCommon.LuaInt(point[2]));
|
||||
i++;
|
||||
if (i >= 4)
|
||||
break;
|
||||
|
@ -199,10 +199,10 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
try
|
||||
{
|
||||
int int_x = LuaInt(X);
|
||||
int int_y = LuaInt(Y);
|
||||
int int_width = LuaInt(X2);
|
||||
int int_height = LuaInt(Y2);
|
||||
int int_x = LuaCommon.LuaInt(X);
|
||||
int int_y = LuaCommon.LuaInt(Y);
|
||||
int int_width = LuaCommon.LuaInt(X2);
|
||||
int int_height = LuaCommon.LuaInt(Y2);
|
||||
|
||||
if (int_x < int_width)
|
||||
{
|
||||
|
@ -245,11 +245,11 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
try
|
||||
{
|
||||
g.DrawEllipse(GetPen(line ?? "white"), LuaInt(X), LuaInt(Y), LuaInt(width), LuaInt(height));
|
||||
g.DrawEllipse(GetPen(line ?? "white"), LuaCommon.LuaInt(X), LuaCommon.LuaInt(Y), LuaCommon.LuaInt(width), LuaCommon.LuaInt(height));
|
||||
if (background != null)
|
||||
{
|
||||
var brush = GetBrush(background);
|
||||
g.FillEllipse(brush, LuaInt(X), LuaInt(Y), LuaInt(width), LuaInt(height));
|
||||
g.FillEllipse(brush, LuaCommon.LuaInt(X), LuaCommon.LuaInt(Y), LuaCommon.LuaInt(width), LuaCommon.LuaInt(height));
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
|
@ -270,14 +270,14 @@ namespace BizHawk.MultiClient
|
|||
Icon icon;
|
||||
if (width != null && height != null)
|
||||
{
|
||||
icon = new Icon(Path.ToString(), LuaInt(width), LuaInt(height));
|
||||
icon = new Icon(Path.ToString(), LuaCommon.LuaInt(width), LuaCommon.LuaInt(height));
|
||||
}
|
||||
else
|
||||
{
|
||||
icon = new Icon(Path.ToString());
|
||||
}
|
||||
|
||||
g.DrawIcon(icon, LuaInt(x), LuaInt(y));
|
||||
g.DrawIcon(icon, LuaCommon.LuaInt(x), LuaCommon.LuaInt(y));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
@ -300,7 +300,7 @@ namespace BizHawk.MultiClient
|
|||
if (height == null || height.GetType() != typeof(int))
|
||||
height = img.Height.ToString();
|
||||
|
||||
g.DrawImage(img, LuaInt(x), LuaInt(y), int.Parse(width.ToString()), int.Parse(height.ToString()));
|
||||
g.DrawImage(img, LuaCommon.LuaInt(x), LuaCommon.LuaInt(y), int.Parse(width.ToString()), int.Parse(height.ToString()));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
@ -316,7 +316,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
try
|
||||
{
|
||||
g.DrawLine(GetPen(color ?? "white"), LuaInt(x1), LuaInt(y1), LuaInt(x2), LuaInt(y2));
|
||||
g.DrawLine(GetPen(color ?? "white"), LuaCommon.LuaInt(x1), LuaCommon.LuaInt(y1), LuaCommon.LuaInt(x2), LuaCommon.LuaInt(y2));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
@ -333,11 +333,11 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
try
|
||||
{
|
||||
g.DrawPie(GetPen(line), LuaInt(X), LuaInt(Y), LuaInt(width), LuaInt(height), LuaInt(startangle), LuaInt(sweepangle));
|
||||
g.DrawPie(GetPen(line), LuaCommon.LuaInt(X), LuaCommon.LuaInt(Y), LuaCommon.LuaInt(width), LuaCommon.LuaInt(height), LuaCommon.LuaInt(startangle), LuaCommon.LuaInt(sweepangle));
|
||||
if (background != null)
|
||||
{
|
||||
var brush = GetBrush(background);
|
||||
g.FillPie(brush, LuaInt(X), LuaInt(Y), LuaInt(width), LuaInt(height), LuaInt(startangle), LuaInt(sweepangle));
|
||||
g.FillPie(brush, LuaCommon.LuaInt(X), LuaCommon.LuaInt(Y), LuaCommon.LuaInt(width), LuaCommon.LuaInt(height), LuaCommon.LuaInt(startangle), LuaCommon.LuaInt(sweepangle));
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
|
@ -354,10 +354,10 @@ namespace BizHawk.MultiClient
|
|||
GlobalWinF.DisplayManager.NeedsToPaint = true;
|
||||
using (var g = GetGraphics())
|
||||
{
|
||||
float x = LuaInt(X) + 0.1F;
|
||||
float x = LuaCommon.LuaInt(X) + 0.1F;
|
||||
try
|
||||
{
|
||||
g.DrawLine(GetPen(color ?? "white"), LuaInt(X), LuaInt(Y), x, LuaInt(Y));
|
||||
g.DrawLine(GetPen(color ?? "white"), LuaCommon.LuaInt(X), LuaCommon.LuaInt(Y), x, LuaCommon.LuaInt(Y));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
@ -378,7 +378,7 @@ namespace BizHawk.MultiClient
|
|||
int i = 0;
|
||||
foreach (LuaTable point in points.Values)
|
||||
{
|
||||
Points[i] = new Point(LuaInt(point[1]), LuaInt(point[2]));
|
||||
Points[i] = new Point(LuaCommon.LuaInt(point[1]), LuaCommon.LuaInt(point[2]));
|
||||
i++;
|
||||
}
|
||||
|
||||
|
@ -402,10 +402,10 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
try
|
||||
{
|
||||
int int_x = LuaInt(X);
|
||||
int int_y = LuaInt(Y);
|
||||
int int_width = LuaInt(width);
|
||||
int int_height = LuaInt(height);
|
||||
int int_x = LuaCommon.LuaInt(X);
|
||||
int int_y = LuaCommon.LuaInt(Y);
|
||||
int int_width = LuaCommon.LuaInt(width);
|
||||
int int_height = LuaCommon.LuaInt(height);
|
||||
g.DrawRectangle(GetPen(line ?? "white"), int_x, int_y, int_width, int_height);
|
||||
if (background != null)
|
||||
{
|
||||
|
@ -437,7 +437,7 @@ namespace BizHawk.MultiClient
|
|||
int fsize = 12;
|
||||
if (fontsize != null)
|
||||
{
|
||||
fsize = LuaInt(fontsize);
|
||||
fsize = LuaCommon.LuaInt(fontsize);
|
||||
}
|
||||
|
||||
FontFamily family = FontFamily.GenericMonospace;
|
||||
|
@ -471,7 +471,7 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
|
||||
Font font = new Font(family, fsize, fstyle, GraphicsUnit.Pixel);
|
||||
g.DrawString(message.ToString(), font, GetBrush(color ?? "white"), LuaInt(X), LuaInt(Y));
|
||||
g.DrawString(message.ToString(), font, GetBrush(color ?? "white"), LuaCommon.LuaInt(X), LuaCommon.LuaInt(Y));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
|
|
@ -16,9 +16,9 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
buttons[button] = Global.ControllerOutput[button];
|
||||
}
|
||||
else if (button.Length >= 3 && button.Substring(0, 2) == "P" + LuaInt(controller).ToString())
|
||||
else if (button.Length >= 3 && button.Substring(0, 2) == "P" + LuaCommon.LuaInt(controller).ToString())
|
||||
{
|
||||
buttons[button.Substring(3)] = Global.ControllerOutput["P" + LuaInt(controller) + " " + button.Substring(3)];
|
||||
buttons[button.Substring(3)] = Global.ControllerOutput["P" + LuaCommon.LuaInt(controller) + " " + button.Substring(3)];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,9 +28,9 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
buttons[button] = Global.ControllerOutput.GetFloat(button);
|
||||
}
|
||||
else if (button.Length >= 3 && button.Substring(0, 2) == "P" + LuaInt(controller).ToString())
|
||||
else if (button.Length >= 3 && button.Substring(0, 2) == "P" + LuaCommon.LuaInt(controller).ToString())
|
||||
{
|
||||
buttons[button.Substring(3)] = Global.ControllerOutput.GetFloat("P" + LuaInt(controller) + " " + button.Substring(3));
|
||||
buttons[button.Substring(3)] = Global.ControllerOutput.GetFloat("P" + LuaCommon.LuaInt(controller) + " " + button.Substring(3));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -83,14 +83,14 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public uint mainmemory_readbyte(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return MM_R_U8(addr);
|
||||
}
|
||||
|
||||
public LuaTable mainmemory_readbyterange(object address, object length)
|
||||
{
|
||||
int l = LuaInt(length);
|
||||
int addr = LuaInt(address);
|
||||
int l = LuaCommon.LuaInt(length);
|
||||
int addr = LuaCommon.LuaInt(address);
|
||||
int last_addr = l + addr;
|
||||
LuaTable table = _lua.NewTable();
|
||||
for (int i = addr; i <= last_addr; i++)
|
||||
|
@ -105,7 +105,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public float mainmemory_readfloat(object lua_addr, bool bigendian)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
uint val = Global.Emulator.MainMemory.PeekDWord(addr, bigendian ? Endian.Big : Endian.Little);
|
||||
|
||||
byte[] bytes = BitConverter.GetBytes(val);
|
||||
|
@ -115,8 +115,8 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public void mainmemory_writebyte(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
uint v = LuaUInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
uint v = LuaCommon.LuaUInt(lua_v);
|
||||
MM_W_U8(addr, v);
|
||||
}
|
||||
|
||||
|
@ -124,8 +124,8 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
foreach (var address in memoryblock.Keys)
|
||||
{
|
||||
int a = LuaInt(address);
|
||||
int v = LuaInt(memoryblock[address]);
|
||||
int a = LuaCommon.LuaInt(address);
|
||||
int v = LuaCommon.LuaInt(memoryblock[address]);
|
||||
|
||||
Global.Emulator.MainMemory.PokeByte(a, (byte)v);
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public void mainmemory_writefloat(object lua_addr, object lua_v, bool bigendian)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
float dv = (float)(double)lua_v;
|
||||
byte[] bytes = BitConverter.GetBytes(dv);
|
||||
uint v = BitConverter.ToUInt32(bytes, 0);
|
||||
|
@ -143,183 +143,183 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public int mainmemory_read_s8(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return (sbyte)MM_R_U8(addr);
|
||||
}
|
||||
|
||||
public uint mainmemory_read_u8(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return MM_R_U8(addr);
|
||||
}
|
||||
|
||||
public int mainmemory_read_s16_le(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return MM_R_S_LE(addr, 2);
|
||||
}
|
||||
|
||||
public int mainmemory_read_s24_le(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return MM_R_S_LE(addr, 3);
|
||||
}
|
||||
|
||||
public int mainmemory_read_s32_le(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return MM_R_S_LE(addr, 4);
|
||||
}
|
||||
|
||||
public uint mainmemory_read_u16_le(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return MM_R_U_LE(addr, 2);
|
||||
}
|
||||
|
||||
public uint mainmemory_read_u24_le(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return MM_R_U_LE(addr, 3);
|
||||
}
|
||||
|
||||
public uint mainmemory_read_u32_le(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return MM_R_U_LE(addr, 4);
|
||||
}
|
||||
|
||||
public int mainmemory_read_s16_be(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return MM_R_S_BE(addr, 2);
|
||||
}
|
||||
|
||||
public int mainmemory_read_s24_be(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return MM_R_S_BE(addr, 3);
|
||||
}
|
||||
|
||||
public int mainmemory_read_s32_be(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return MM_R_S_BE(addr, 4);
|
||||
}
|
||||
|
||||
public uint mainmemory_read_u16_be(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return MM_R_U_BE(addr, 2);
|
||||
}
|
||||
|
||||
public uint mainmemory_read_u24_be(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return MM_R_U_BE(addr, 3);
|
||||
}
|
||||
|
||||
public uint mainmemory_read_u32_be(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return MM_R_U_BE(addr, 4);
|
||||
}
|
||||
|
||||
public void mainmemory_write_s8(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int v = LuaInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
int v = LuaCommon.LuaInt(lua_v);
|
||||
MM_W_U8(addr, (uint)v);
|
||||
}
|
||||
|
||||
public void mainmemory_write_u8(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
uint v = LuaUInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
uint v = LuaCommon.LuaUInt(lua_v);
|
||||
MM_W_U8(addr, v);
|
||||
}
|
||||
|
||||
public void mainmemory_write_s16_le(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int v = LuaInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
int v = LuaCommon.LuaInt(lua_v);
|
||||
MM_W_S_LE(addr, v, 2);
|
||||
}
|
||||
|
||||
public void mainmemory_write_s24_le(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int v = LuaInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
int v = LuaCommon.LuaInt(lua_v);
|
||||
MM_W_S_LE(addr, v, 3);
|
||||
}
|
||||
|
||||
public void mainmemory_write_s32_le(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int v = LuaInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
int v = LuaCommon.LuaInt(lua_v);
|
||||
MM_W_S_LE(addr, v, 4);
|
||||
}
|
||||
|
||||
public void mainmemory_write_u16_le(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
uint v = LuaUInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
uint v = LuaCommon.LuaUInt(lua_v);
|
||||
MM_W_U_LE(addr, v, 2);
|
||||
}
|
||||
|
||||
public void mainmemory_write_u24_le(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
uint v = LuaUInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
uint v = LuaCommon.LuaUInt(lua_v);
|
||||
MM_W_U_LE(addr, v, 3);
|
||||
}
|
||||
|
||||
public void mainmemory_write_u32_le(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
uint v = LuaUInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
uint v = LuaCommon.LuaUInt(lua_v);
|
||||
MM_W_U_LE(addr, v, 4);
|
||||
}
|
||||
|
||||
public void mainmemory_write_s16_be(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int v = LuaInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
int v = LuaCommon.LuaInt(lua_v);
|
||||
MM_W_S_BE(addr, v, 2);
|
||||
}
|
||||
|
||||
public void mainmemory_write_s24_be(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int v = LuaInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
int v = LuaCommon.LuaInt(lua_v);
|
||||
MM_W_S_BE(addr, v, 3);
|
||||
}
|
||||
|
||||
public void mainmemory_write_s32_be(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int v = LuaInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
int v = LuaCommon.LuaInt(lua_v);
|
||||
MM_W_S_BE(addr, v, 4);
|
||||
}
|
||||
|
||||
public void mainmemory_write_u16_be(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
uint v = LuaUInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
uint v = LuaCommon.LuaUInt(lua_v);
|
||||
MM_W_U_BE(addr, v, 2);
|
||||
}
|
||||
|
||||
public void mainmemory_write_u24_be(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
uint v = LuaUInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
uint v = LuaCommon.LuaUInt(lua_v);
|
||||
MM_W_U_BE(addr, v, 3);
|
||||
}
|
||||
|
||||
public void mainmemory_write_u32_be(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
uint v = LuaUInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
uint v = LuaCommon.LuaUInt(lua_v);
|
||||
MM_W_U_BE(addr, v, 4);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,13 +85,13 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public uint memory_readbyte(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return M_R_U8(addr);
|
||||
}
|
||||
|
||||
public float memory_readfloat(object lua_addr, bool bigendian)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
uint val = Global.Emulator.MemoryDomains[_current_memory_domain].PeekDWord(addr, bigendian ? Endian.Big : Endian.Little);
|
||||
|
||||
byte[] bytes = BitConverter.GetBytes(val);
|
||||
|
@ -101,14 +101,14 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public void memory_writebyte(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
uint v = LuaUInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
uint v = LuaCommon.LuaUInt(lua_v);
|
||||
M_W_U8(addr, v);
|
||||
}
|
||||
|
||||
public void memory_writefloat(object lua_addr, object lua_v, bool bigendian)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
float dv = (float)(double)lua_v;
|
||||
byte[] bytes = BitConverter.GetBytes(dv);
|
||||
uint v = BitConverter.ToUInt32(bytes, 0);
|
||||
|
@ -135,183 +135,183 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public int memory_read_s8(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return (sbyte)M_R_U8(addr);
|
||||
}
|
||||
|
||||
public uint memory_read_u8(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return M_R_U8(addr);
|
||||
}
|
||||
|
||||
public int memory_read_s16_le(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return M_R_S_LE(addr, 2);
|
||||
}
|
||||
|
||||
public int memory_read_s24_le(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return M_R_S_LE(addr, 3);
|
||||
}
|
||||
|
||||
public int memory_read_s32_le(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return M_R_S_LE(addr, 4);
|
||||
}
|
||||
|
||||
public uint memory_read_u16_le(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return M_R_U_LE(addr, 2);
|
||||
}
|
||||
|
||||
public uint memory_read_u24_le(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return M_R_U_LE(addr, 3);
|
||||
}
|
||||
|
||||
public uint memory_read_u32_le(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return M_R_U_LE(addr, 4);
|
||||
}
|
||||
|
||||
public int memory_read_s16_be(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return M_R_S_BE(addr, 2);
|
||||
}
|
||||
|
||||
public int memory_read_s24_be(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return M_R_S_BE(addr, 3);
|
||||
}
|
||||
|
||||
public int memory_read_s32_be(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return M_R_S_BE(addr, 4);
|
||||
}
|
||||
|
||||
public uint memory_read_u16_be(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return M_R_U_BE(addr, 2);
|
||||
}
|
||||
|
||||
public uint memory_read_u24_be(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return M_R_U_BE(addr, 3);
|
||||
}
|
||||
|
||||
public uint memory_read_u32_be(object lua_addr)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
return M_R_U_BE(addr, 4);
|
||||
}
|
||||
|
||||
public void memory_write_s8(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int v = LuaInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
int v = LuaCommon.LuaInt(lua_v);
|
||||
M_W_U8(addr, (uint)v);
|
||||
}
|
||||
|
||||
public void memory_write_u8(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
uint v = LuaUInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
uint v = LuaCommon.LuaUInt(lua_v);
|
||||
M_W_U8(addr, v);
|
||||
}
|
||||
|
||||
public void memory_write_s16_le(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int v = LuaInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
int v = LuaCommon.LuaInt(lua_v);
|
||||
M_W_S_LE(addr, v, 2);
|
||||
}
|
||||
|
||||
public void memory_write_s24_le(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int v = LuaInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
int v = LuaCommon.LuaInt(lua_v);
|
||||
M_W_S_LE(addr, v, 3);
|
||||
}
|
||||
|
||||
public void memory_write_s32_le(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int v = LuaInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
int v = LuaCommon.LuaInt(lua_v);
|
||||
M_W_S_LE(addr, v, 4);
|
||||
}
|
||||
|
||||
public void memory_write_u16_le(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
uint v = LuaUInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
uint v = LuaCommon.LuaUInt(lua_v);
|
||||
M_W_U_LE(addr, v, 2);
|
||||
}
|
||||
|
||||
public void memory_write_u24_le(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
uint v = LuaUInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
uint v = LuaCommon.LuaUInt(lua_v);
|
||||
M_W_U_LE(addr, v, 3);
|
||||
}
|
||||
|
||||
public void memory_write_u32_le(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
uint v = LuaUInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
uint v = LuaCommon.LuaUInt(lua_v);
|
||||
M_W_U_LE(addr, v, 4);
|
||||
}
|
||||
|
||||
public void memory_write_s16_be(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int v = LuaInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
int v = LuaCommon.LuaInt(lua_v);
|
||||
M_W_S_BE(addr, v, 2);
|
||||
}
|
||||
|
||||
public void memory_write_s24_be(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int v = LuaInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
int v = LuaCommon.LuaInt(lua_v);
|
||||
M_W_S_BE(addr, v, 3);
|
||||
}
|
||||
|
||||
public void memory_write_s32_be(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
int v = LuaInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
int v = LuaCommon.LuaInt(lua_v);
|
||||
M_W_S_BE(addr, v, 4);
|
||||
}
|
||||
|
||||
public void memory_write_u16_be(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
uint v = LuaUInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
uint v = LuaCommon.LuaUInt(lua_v);
|
||||
M_W_U_BE(addr, v, 2);
|
||||
}
|
||||
|
||||
public void memory_write_u24_be(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
uint v = LuaUInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
uint v = LuaCommon.LuaUInt(lua_v);
|
||||
M_W_U_BE(addr, v, 3);
|
||||
}
|
||||
|
||||
public void memory_write_u32_be(object lua_addr, object lua_v)
|
||||
{
|
||||
int addr = LuaInt(lua_addr);
|
||||
uint v = LuaUInt(lua_v);
|
||||
int addr = LuaCommon.LuaInt(lua_addr);
|
||||
uint v = LuaCommon.LuaUInt(lua_v);
|
||||
M_W_U_BE(addr, v, 4);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
LuaTable input = _lua.NewTable();
|
||||
|
||||
string s = Global.MovieSession.Movie.GetInput(LuaInt(frame));
|
||||
string s = Global.MovieSession.Movie.GetInput(LuaCommon.LuaInt(frame));
|
||||
MovieControllerAdapter m = new MovieControllerAdapter { Type = Global.MovieSession.MovieControllerAdapter.Type };
|
||||
m.SetControllersAsMnemonic(s);
|
||||
foreach (string button in m.Type.BoolButtons)
|
||||
|
|
|
@ -127,8 +127,8 @@ namespace BizHawk.MultiClient
|
|||
public void nes_setscanlines(object top, object bottom, bool pal = false)
|
||||
{
|
||||
|
||||
int first = LuaInt(top);
|
||||
int last = LuaInt(bottom);
|
||||
int first = LuaCommon.LuaInt(top);
|
||||
int last = LuaCommon.LuaInt(bottom);
|
||||
if (first > 127)
|
||||
{
|
||||
first = 127;
|
||||
|
|
|
@ -33,18 +33,6 @@ namespace BizHawk.MultiClient
|
|||
|
||||
#region Register Library Functions
|
||||
|
||||
public static string[] BitwiseFunctions = new[]
|
||||
{
|
||||
"band",
|
||||
"bnot",
|
||||
"bor",
|
||||
"bxor",
|
||||
"lshift",
|
||||
"rol",
|
||||
"ror",
|
||||
"rshift",
|
||||
};
|
||||
|
||||
public static string[] MultiClientFunctions = new[]
|
||||
{
|
||||
"closerom",
|
||||
|
@ -313,6 +301,15 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
lua.RegisterFunction("print", this, GetType().GetMethod("print"));
|
||||
|
||||
lua.NewTable("bit");
|
||||
foreach (var funcName in BitLuaLibrary.Functions)
|
||||
{
|
||||
string libName = BitLuaLibrary.Name + "." + funcName;
|
||||
var method = (typeof(BitLuaLibrary)).GetMethod(BitLuaLibrary.Name + "_" + funcName);
|
||||
lua.RegisterFunction(libName, this, method);
|
||||
Docs.Add(BitLuaLibrary.Name, funcName, method);
|
||||
}
|
||||
|
||||
//Register libraries
|
||||
lua.NewTable("console");
|
||||
foreach (string t in ConsoleFunctions)
|
||||
|
@ -395,13 +392,6 @@ namespace BizHawk.MultiClient
|
|||
Docs.Add("forms", t, GetType().GetMethod("forms_" + t));
|
||||
}
|
||||
|
||||
lua.NewTable("bit");
|
||||
foreach (string t in BitwiseFunctions)
|
||||
{
|
||||
lua.RegisterFunction("bit." + t, this, GetType().GetMethod("bit_" + t));
|
||||
Docs.Add("bit", t, GetType().GetMethod("bit_" + t));
|
||||
}
|
||||
|
||||
lua.NewTable("nes");
|
||||
foreach (string t in NESFunctions)
|
||||
{
|
||||
|
@ -439,16 +429,6 @@ namespace BizHawk.MultiClient
|
|||
return t;
|
||||
}
|
||||
|
||||
public int LuaInt(object lua_arg)
|
||||
{
|
||||
return Convert.ToInt32((double)lua_arg);
|
||||
}
|
||||
|
||||
private uint LuaUInt(object lua_arg)
|
||||
{
|
||||
return Convert.ToUInt32((double)lua_arg);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// LuaInterface requires the exact match of parameter count, except optional parameters.
|
||||
/// So, if you want to support variable arguments, declare them as optional and pass
|
||||
|
|
Loading…
Reference in New Issue