lua - add nes.getclipleftandright(), nes.setclipleftandright(), also fix the previous nes library functions to work even if not in NESHawk
This commit is contained in:
parent
8f3316e501
commit
2e19d31d33
|
@ -209,7 +209,7 @@ namespace BizHawk.MultiClient
|
||||||
for (int i = 0; i < NESFunctions.Length; i++)
|
for (int i = 0; i < NESFunctions.Length; i++)
|
||||||
{
|
{
|
||||||
lua.RegisterFunction("nes." + NESFunctions[i], this, this.GetType().GetMethod("nes_" + NESFunctions[i]));
|
lua.RegisterFunction("nes." + NESFunctions[i], this, this.GetType().GetMethod("nes_" + NESFunctions[i]));
|
||||||
docs.Add("bit", NESFunctions[i], this.GetType().GetMethod("nes_" + NESFunctions[i]));
|
docs.Add("nes", NESFunctions[i], this.GetType().GetMethod("nes_" + NESFunctions[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
docs.Sort();
|
docs.Sort();
|
||||||
|
@ -539,8 +539,10 @@ namespace BizHawk.MultiClient
|
||||||
public static string[] NESFunctions = new string[]
|
public static string[] NESFunctions = new string[]
|
||||||
{
|
{
|
||||||
"setscanlines",
|
"setscanlines",
|
||||||
"nes_gettopscanline",
|
"gettopscanline",
|
||||||
"nes_getbottomscanline",
|
"getbottomscanline",
|
||||||
|
"getclipleftandright",
|
||||||
|
"setclipleftandright",
|
||||||
};
|
};
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
/*************function definitions********************/
|
/*************function definitions********************/
|
||||||
|
@ -2450,57 +2452,58 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
public void nes_setscanlines(object top, object bottom)
|
public void nes_setscanlines(object top, object bottom)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
int first = LuaInt(top);
|
||||||
|
int last = LuaInt(bottom);
|
||||||
|
if (first > 127)
|
||||||
|
{
|
||||||
|
first = 127;
|
||||||
|
}
|
||||||
|
else if (first < 0)
|
||||||
|
{
|
||||||
|
first = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (last > 239)
|
||||||
|
{
|
||||||
|
last = 239;
|
||||||
|
}
|
||||||
|
else if (last < 128)
|
||||||
|
{
|
||||||
|
last = 128;
|
||||||
|
}
|
||||||
|
|
||||||
|
Global.Config.NESTopLine = first;
|
||||||
|
Global.Config.NESBottomLine = last;
|
||||||
|
|
||||||
if (Global.Emulator is NES)
|
if (Global.Emulator is NES)
|
||||||
{
|
{
|
||||||
int first = LuaInt(top);
|
|
||||||
int last = LuaInt(bottom);
|
|
||||||
if (first > 127)
|
|
||||||
{
|
|
||||||
first = 127;
|
|
||||||
}
|
|
||||||
else if (first < 0)
|
|
||||||
{
|
|
||||||
first = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (last > 239)
|
|
||||||
{
|
|
||||||
last = 239;
|
|
||||||
}
|
|
||||||
else if (last < 128)
|
|
||||||
{
|
|
||||||
last = 128;
|
|
||||||
}
|
|
||||||
|
|
||||||
Global.Config.NESTopLine = first;
|
|
||||||
(Global.Emulator as NES).FirstDrawLine = first;
|
(Global.Emulator as NES).FirstDrawLine = first;
|
||||||
|
|
||||||
Global.Config.NESBottomLine = last;
|
|
||||||
(Global.Emulator as NES).LastDrawLine = last;
|
(Global.Emulator as NES).LastDrawLine = last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int nes_gettopscanline()
|
public int nes_gettopscanline()
|
||||||
{
|
{
|
||||||
if (Global.Emulator is NES)
|
return Global.Config.NESTopLine;
|
||||||
{
|
|
||||||
return Global.Config.NESTopLine;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int nes_getbottomscanline()
|
public int nes_getbottomscanline()
|
||||||
{
|
{
|
||||||
|
return Global.Config.NESBottomLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool nes_getclipleftandright()
|
||||||
|
{
|
||||||
|
return Global.Config.NESClipLeftAndRight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void nes_setclipleftandright(bool leftandright)
|
||||||
|
{
|
||||||
|
Global.Config.NESClipLeftAndRight = leftandright;
|
||||||
if (Global.Emulator is NES)
|
if (Global.Emulator is NES)
|
||||||
{
|
{
|
||||||
return Global.Config.NESBottomLine;
|
(Global.Emulator as NES).SetClipLeftAndRight(leftandright);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue