Lua - add snes library getlayer_set_bg_1(), setlayer_set_bg_1(), etc to toggle/get all layer options
This commit is contained in:
parent
04c46893d3
commit
496f645b48
|
@ -212,6 +212,13 @@ namespace BizHawk.MultiClient
|
|||
docs.Add("nes", NESFunctions[i], this.GetType().GetMethod("nes_" + NESFunctions[i]));
|
||||
}
|
||||
|
||||
lua.NewTable("snes");
|
||||
for (int i = 0; i < SNESFunctions.Length; i++)
|
||||
{
|
||||
lua.RegisterFunction("snes." + SNESFunctions[i], this, this.GetType().GetMethod("snes_" + SNESFunctions[i]));
|
||||
docs.Add("snes", SNESFunctions[i], this.GetType().GetMethod("snes_" + SNESFunctions[i]));
|
||||
}
|
||||
|
||||
lua.NewTable("event");
|
||||
for (int i = 0; i < EventFunctions.Length; i++)
|
||||
{
|
||||
|
@ -568,6 +575,27 @@ namespace BizHawk.MultiClient
|
|||
"removegamegenie",
|
||||
};
|
||||
|
||||
public static string[] SNESFunctions = new string[]
|
||||
{
|
||||
"setlayer_bg_1",
|
||||
"setlayer_bg_2",
|
||||
"setlayer_bg_3",
|
||||
"setlayer_bg_4",
|
||||
"getlayer_bg_1",
|
||||
"getlayer_bg_2",
|
||||
"getlayer_bg_3",
|
||||
"getlayer_bg_4",
|
||||
|
||||
"setlayer_obj_1",
|
||||
"setlayer_obj_2",
|
||||
"setlayer_obj_3",
|
||||
"setlayer_obj_4",
|
||||
"getlayer_obj_1",
|
||||
"getlayer_obj_2",
|
||||
"getlayer_obj_3",
|
||||
"getlayer_obj_4",
|
||||
};
|
||||
|
||||
public static string[] EventFunctions = new string[]
|
||||
{
|
||||
"onloadstate",
|
||||
|
@ -2847,6 +2875,93 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
//SNES library
|
||||
//----------------------------------------------------
|
||||
public bool snes_getlayer_bg_1()
|
||||
{
|
||||
return Global.Config.SNES_ShowBG1_1;
|
||||
}
|
||||
|
||||
public bool snes_getlayer_bg_2()
|
||||
{
|
||||
return Global.Config.SNES_ShowBG2_1;
|
||||
}
|
||||
|
||||
public bool snes_getlayer_bg_3()
|
||||
{
|
||||
return Global.Config.SNES_ShowBG3_1;
|
||||
}
|
||||
|
||||
public bool snes_getlayer_bg_4()
|
||||
{
|
||||
return Global.Config.SNES_ShowBG4_1;
|
||||
}
|
||||
|
||||
public bool snes_getlayer_obj_1()
|
||||
{
|
||||
return Global.Config.SNES_ShowOBJ1;
|
||||
}
|
||||
|
||||
public bool snes_getlayer_obj_2()
|
||||
{
|
||||
return Global.Config.SNES_ShowOBJ2;
|
||||
}
|
||||
|
||||
public bool snes_getlayer_obj_3()
|
||||
{
|
||||
return Global.Config.SNES_ShowOBJ3;
|
||||
}
|
||||
|
||||
public bool snes_getlayer_obj_4()
|
||||
{
|
||||
return Global.Config.SNES_ShowOBJ4;
|
||||
}
|
||||
|
||||
|
||||
public void snes_setlayer_bg_1(bool value)
|
||||
{
|
||||
Global.MainForm.SNES_ToggleBG1(value);
|
||||
}
|
||||
|
||||
public void snes_setlayer_bg_2(bool value)
|
||||
{
|
||||
Global.MainForm.SNES_ToggleBG2(value);
|
||||
}
|
||||
|
||||
public void snes_setlayer_bg_3(bool value)
|
||||
{
|
||||
Global.MainForm.SNES_ToggleBG3(value);
|
||||
}
|
||||
|
||||
public void snes_setlayer_bg_4(bool value)
|
||||
{
|
||||
Global.MainForm.SNES_ToggleBG4(value);
|
||||
}
|
||||
|
||||
public void snes_setlayer_obj_1(bool value)
|
||||
{
|
||||
Global.MainForm.SNES_ToggleOBJ1(value);
|
||||
}
|
||||
|
||||
public void snes_setlayer_obj_2(bool value)
|
||||
{
|
||||
Global.MainForm.SNES_ToggleOBJ2(value);
|
||||
}
|
||||
|
||||
public void snes_setlayer_obj_3(bool value)
|
||||
{
|
||||
Global.MainForm.SNES_ToggleOBJ3(value);
|
||||
}
|
||||
|
||||
public void snes_setlayer_obj_4(bool value)
|
||||
{
|
||||
Global.MainForm.SNES_ToggleOBJ4(value);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
//Events library
|
||||
//----------------------------------------------------
|
||||
|
||||
public void event_onsavestate(LuaFunction luaf)
|
||||
{
|
||||
savestate_registersave(luaf);
|
||||
|
|
|
@ -1867,11 +1867,19 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
private void SNES_ToggleBG1()
|
||||
public void SNES_ToggleBG1(bool? setto = null)
|
||||
{
|
||||
if (Global.Emulator is LibsnesCore)
|
||||
{
|
||||
Global.Config.SNES_ShowBG1_1 = Global.Config.SNES_ShowBG1_0 ^= true;
|
||||
if (setto.HasValue)
|
||||
{
|
||||
Global.Config.SNES_ShowBG1_1 = Global.Config.SNES_ShowBG1_0 = setto.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.Config.SNES_ShowBG1_1 = Global.Config.SNES_ShowBG1_0 ^= true;
|
||||
}
|
||||
|
||||
SyncCoreCommInputSignals();
|
||||
if (Global.Config.SNES_ShowBG1_1)
|
||||
{
|
||||
|
@ -1884,11 +1892,18 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
private void SNES_ToggleBG2()
|
||||
public void SNES_ToggleBG2(bool? setto = null)
|
||||
{
|
||||
if (Global.Emulator is LibsnesCore)
|
||||
{
|
||||
Global.Config.SNES_ShowBG2_1 = Global.Config.SNES_ShowBG2_0 ^= true;
|
||||
if (setto.HasValue)
|
||||
{
|
||||
Global.Config.SNES_ShowBG2_1 = Global.Config.SNES_ShowBG2_0 = setto.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.Config.SNES_ShowBG2_1 = Global.Config.SNES_ShowBG2_0 ^= true;
|
||||
}
|
||||
SyncCoreCommInputSignals();
|
||||
if (Global.Config.SNES_ShowBG2_1)
|
||||
{
|
||||
|
@ -1901,11 +1916,18 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
private void SNES_ToggleBG3()
|
||||
public void SNES_ToggleBG3(bool? setto = null)
|
||||
{
|
||||
if (Global.Emulator is LibsnesCore)
|
||||
{
|
||||
Global.Config.SNES_ShowBG3_1 = Global.Config.SNES_ShowBG3_0 ^= true;
|
||||
if (setto.HasValue)
|
||||
{
|
||||
Global.Config.SNES_ShowBG3_1 = Global.Config.SNES_ShowBG3_0 = setto.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.Config.SNES_ShowBG3_1 = Global.Config.SNES_ShowBG3_0 ^= true;
|
||||
}
|
||||
SyncCoreCommInputSignals();
|
||||
if (Global.Config.SNES_ShowBG3_1)
|
||||
{
|
||||
|
@ -1918,11 +1940,18 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
private void SNES_ToggleBG4()
|
||||
public void SNES_ToggleBG4(bool? setto = null)
|
||||
{
|
||||
if (Global.Emulator is LibsnesCore)
|
||||
{
|
||||
Global.Config.SNES_ShowBG4_1 = Global.Config.SNES_ShowBG4_0 ^= true;
|
||||
if (setto.HasValue)
|
||||
{
|
||||
Global.Config.SNES_ShowBG4_1 = Global.Config.SNES_ShowBG4_0 = setto.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.Config.SNES_ShowBG4_1 = Global.Config.SNES_ShowBG4_0 ^= true;
|
||||
}
|
||||
SyncCoreCommInputSignals();
|
||||
if (Global.Config.SNES_ShowBG4_1)
|
||||
{
|
||||
|
@ -1935,11 +1964,18 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
private void SNES_ToggleOBJ1()
|
||||
public void SNES_ToggleOBJ1(bool? setto = null)
|
||||
{
|
||||
if (Global.Emulator is LibsnesCore)
|
||||
{
|
||||
Global.Config.SNES_ShowOBJ1 ^= true;
|
||||
if (setto.HasValue)
|
||||
{
|
||||
Global.Config.SNES_ShowOBJ1 = setto.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.Config.SNES_ShowOBJ1 ^= true;
|
||||
}
|
||||
SyncCoreCommInputSignals();
|
||||
if (Global.Config.SNES_ShowOBJ1)
|
||||
{
|
||||
|
@ -1952,11 +1988,18 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
private void SNES_ToggleOBJ2()
|
||||
public void SNES_ToggleOBJ2(bool? setto = null)
|
||||
{
|
||||
if (Global.Emulator is LibsnesCore)
|
||||
{
|
||||
Global.Config.SNES_ShowOBJ2 ^= true;
|
||||
if (setto.HasValue)
|
||||
{
|
||||
Global.Config.SNES_ShowOBJ2 = setto.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.Config.SNES_ShowOBJ2 ^= true;
|
||||
}
|
||||
SyncCoreCommInputSignals();
|
||||
if (Global.Config.SNES_ShowOBJ2)
|
||||
{
|
||||
|
@ -1969,11 +2012,18 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
private void SNES_ToggleOBJ3()
|
||||
public void SNES_ToggleOBJ3(bool? setto = null)
|
||||
{
|
||||
if (Global.Emulator is LibsnesCore)
|
||||
{
|
||||
Global.Config.SNES_ShowOBJ3 ^= true;
|
||||
if (setto.HasValue)
|
||||
{
|
||||
Global.Config.SNES_ShowOBJ3 = setto.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.Config.SNES_ShowOBJ3 ^= true;
|
||||
}
|
||||
SyncCoreCommInputSignals();
|
||||
if (Global.Config.SNES_ShowOBJ3)
|
||||
{
|
||||
|
@ -1986,11 +2036,18 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
private void SNES_ToggleOBJ4()
|
||||
public void SNES_ToggleOBJ4(bool? setto = null)
|
||||
{
|
||||
if (Global.Emulator is LibsnesCore)
|
||||
{
|
||||
Global.Config.SNES_ShowOBJ4 ^= true;
|
||||
if (setto.HasValue)
|
||||
{
|
||||
Global.Config.SNES_ShowOBJ4 = setto.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.Config.SNES_ShowOBJ4 ^= true;
|
||||
}
|
||||
SyncCoreCommInputSignals();
|
||||
if (Global.Config.SNES_ShowOBJ4)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue