Lua - implement nes.addgamegenie() and nes.removegamegenie()
This commit is contained in:
parent
2f8561a81d
commit
608dbf6316
|
@ -548,6 +548,8 @@ namespace BizHawk.MultiClient
|
|||
"setdispbackground",
|
||||
"getdispsprites",
|
||||
"setdispsprites",
|
||||
"addgamegenie",
|
||||
"removegamegenie",
|
||||
};
|
||||
/****************************************************/
|
||||
/*************function definitions********************/
|
||||
|
@ -2538,5 +2540,50 @@ namespace BizHawk.MultiClient
|
|||
Global.Config.NESDispSprites = show;
|
||||
Global.MainForm.SyncCoreInputComm();
|
||||
}
|
||||
|
||||
public void nes_addgamegenie(string code)
|
||||
{
|
||||
if (Global.Emulator is NES)
|
||||
{
|
||||
NESGameGenie gg = new NESGameGenie();
|
||||
gg.DecodeGameGenieCode(code);
|
||||
if (gg.address > 0 && gg.value > 0)
|
||||
{
|
||||
Cheat c = new Cheat();
|
||||
c.name = code;
|
||||
c.domain = Global.Emulator.MemoryDomains[1];
|
||||
c.address = gg.address;
|
||||
c.value = (byte)gg.value;
|
||||
if (gg.compare != -1)
|
||||
{
|
||||
c.compare = (byte)gg.compare;
|
||||
}
|
||||
c.Enable();
|
||||
Global.MainForm.Cheats1.AddCheat(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void nes_removegamegenie(string code)
|
||||
{
|
||||
if (Global.Emulator is NES)
|
||||
{
|
||||
NESGameGenie gg = new NESGameGenie();
|
||||
gg.DecodeGameGenieCode(code);
|
||||
if (gg.address > 0 && gg.value > 0)
|
||||
{
|
||||
Cheat c = new Cheat();
|
||||
c.name = code;
|
||||
c.domain = Global.Emulator.MemoryDomains[1];
|
||||
c.address = gg.address;
|
||||
c.value = (byte)gg.value;
|
||||
if (gg.compare != -1)
|
||||
{
|
||||
c.compare = (byte)gg.compare;
|
||||
}
|
||||
Global.CheatList.RemoveCheat(Global.Emulator.MemoryDomains[1], c.address);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,19 +13,16 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
public partial class NESGameGenie : Form
|
||||
{
|
||||
int address = -1;
|
||||
int value = -1;
|
||||
int compare = -1;
|
||||
public int address = -1;
|
||||
public int value = -1;
|
||||
public int compare = -1;
|
||||
Dictionary<char, int> GameGenieTable = new Dictionary<char, int>();
|
||||
|
||||
public NESGameGenie()
|
||||
{
|
||||
InitializeComponent();
|
||||
Closing += (o, e) => SaveConfigSettings();
|
||||
}
|
||||
|
||||
private void NESGameGenie_Load(object sender, EventArgs e)
|
||||
{
|
||||
GameGenieTable.Add('A', 0); //0000
|
||||
GameGenieTable.Add('P', 1); //0001
|
||||
GameGenieTable.Add('Z', 2); //0010
|
||||
|
@ -42,7 +39,10 @@ namespace BizHawk.MultiClient
|
|||
GameGenieTable.Add('S', 13); //1101
|
||||
GameGenieTable.Add('V', 14); //1110
|
||||
GameGenieTable.Add('N', 15); //1111
|
||||
}
|
||||
|
||||
private void NESGameGenie_Load(object sender, EventArgs e)
|
||||
{
|
||||
AddCheat.Enabled = false;
|
||||
|
||||
if (Global.Config.NESGGSaveWindowPosition && Global.Config.NESGGWndx >= 0 && Global.Config.NESGGWndy >= 0)
|
||||
|
@ -82,7 +82,7 @@ namespace BizHawk.MultiClient
|
|||
return (value >> bit) & 1;
|
||||
}
|
||||
|
||||
private void DecodeGameGenieCode(string code)
|
||||
public void DecodeGameGenieCode(string code)
|
||||
{
|
||||
//char 3 bit 3 denotes the code length.
|
||||
if (code.Length == 6)
|
||||
|
|
|
@ -176,6 +176,8 @@ namespace BizHawk.MultiClient
|
|||
cheatList.Remove(cheatList[x]);
|
||||
}
|
||||
}
|
||||
|
||||
Global.OSD.AddMessage("Cheat removed");
|
||||
}
|
||||
|
||||
public string CheatsPath
|
||||
|
|
Loading…
Reference in New Issue