Add some code for Slide Code Handling for Action Replay MAX.

TODO: Detect Action Replay MAX codes Vs. GameShark/Action Replay codes.
This commit is contained in:
hegyak 2015-11-29 14:22:23 -08:00
parent 3c07f7e649
commit 020c71557b
1 changed files with 87 additions and 41 deletions

View File

@ -379,13 +379,29 @@ namespace BizHawk.Client.EmuHawk
//Provided by mGBA and endrift
UInt32[] GBAGameSharkSeeds = { UInt32.Parse("09F4FBBD", NumberStyles.HexNumber), UInt32.Parse("9681884A", NumberStyles.HexNumber), UInt32.Parse("352027E9", NumberStyles.HexNumber), UInt32.Parse("F3DEE5A7", NumberStyles.HexNumber) };
UInt32[] GBAProActionReplaySeeds = { UInt32.Parse("7AA9648F", NumberStyles.HexNumber), UInt32.Parse("7FAE6994", NumberStyles.HexNumber), UInt32.Parse("C0EFAAD5", NumberStyles.HexNumber), UInt32.Parse("42712C57", NumberStyles.HexNumber) };
private string firstSlide;
private string secondSlide;
Boolean Slider = false;
private void GBA()
{
Boolean blnNoCode = true;
//TODO:
//Clean the detection methods and improve/optimize code conversion.
testo = null;
//We have a Game Shark or Action Replay.
//Slider is special code that allows us to break out and do Slide Codes. It needs work
//TODO:
//Make Slide Code Handling suck less.
//TODO:
//Determine how to make Action Replay Max Code detection a thing?
if (Slider == true)
{
secondSlide = txtCheat.Text;
GBASlide();
}
else if (Slider == false)
{
//We have a Game Shark or Action Replay?
if (txtCheat.Text.Length == 17 && txtCheat.Text.IndexOf(" ") == 8)
{
parseString = txtCheat.Text;
@ -413,6 +429,8 @@ namespace BizHawk.Client.EmuHawk
MessageBox.Show("The code you entered is not supported by BizHawk.", "Emulator Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
parseString = RAMValue;
MessageBox.Show(parseString);
parseString = RAMValue.Remove(4, 4);
//Is it a Word or Double Word?
if (parseString == "0000")
@ -428,6 +446,7 @@ namespace BizHawk.Client.EmuHawk
}
blnNoCode = false;
}
}
if (txtCheat.Text.Length == 12)
{
MessageBox.Show("Encrypted Codebreaker/GameShark SP/Xploder codes are not supported by this tool.", "Tool error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
@ -490,6 +509,33 @@ namespace BizHawk.Client.EmuHawk
txtDescription.Clear();
}
}
public void GBASlide()
{
//This works on the Action Replay MAX, not the Codebreaker, GameShark SP/Xploder
string s = firstSlide.Remove(0, 11).Insert(1, "0");
string str2 = secondSlide.Remove(8, 9);
if (str2.StartsWith("0000"))
{
str2 = str2.Remove(0, 4);
}
long num = 0L;
num = long.Parse(secondSlide.Remove(0, 9).Remove(4, 4), NumberStyles.HexNumber);
long num2 = long.Parse(secondSlide.Remove(0, 13), NumberStyles.HexNumber);
long num3 = long.Parse(s, NumberStyles.HexNumber);
for (double i = 0.0; i != num; i++)
{
s = string.Format("{0:X8}", num3);
Watch watch = Watch.GenerateWatch(MemoryDomains["System Bus"], long.Parse(s, NumberStyles.HexNumber), WatchSize.Word, Client.Common.DisplayType.Hex, false, txtDescription.Text);
int? compare = null;
Global.CheatList.Add(new Cheat(watch, int.Parse(str2, NumberStyles.HexNumber), compare, true));
num3 = long.Parse(s, NumberStyles.HexNumber) + num2;
}
Slider = false;
txtCheat.Clear();
txtDescription.Clear();
}
private void GEN()
{
//Game Genie only, for now.