Add SMS Action Replay handling.
This commit is contained in:
parent
a3b7770333
commit
c4016affee
|
@ -21,7 +21,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[ToolAttributes(released: true, supportedSystems: new[] { "GB", "GBA", "GEN", "N64", "PSX", "SAT", "SNES" })]
|
[ToolAttributes(released: true, supportedSystems: new[] { "GB", "GBA", "GEN", "N64", "PSX", "SAT", "SMS", "SNES" })]
|
||||||
public partial class GameShark : Form, IToolForm, IToolFormAutoConfig
|
public partial class GameShark : Form, IToolForm, IToolFormAutoConfig
|
||||||
{
|
{
|
||||||
//We are using Memory Domains, so we NEED this.
|
//We are using Memory Domains, so we NEED this.
|
||||||
|
@ -103,6 +103,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
//This determies what kind of Code we have
|
//This determies what kind of Code we have
|
||||||
testo = txtCheat.Text.Remove(2, 11);
|
testo = txtCheat.Text.Remove(2, 11);
|
||||||
SAT();
|
SAT();
|
||||||
|
break;
|
||||||
|
case "SMS":
|
||||||
|
SMS();
|
||||||
break;
|
break;
|
||||||
case "SNES":
|
case "SNES":
|
||||||
//Currently only does Action Replay
|
//Currently only does Action Replay
|
||||||
|
@ -172,6 +175,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
//Nothing, yet
|
//Nothing, yet
|
||||||
//Sample of Decryption Code from mGBA
|
//Sample of Decryption Code from mGBA
|
||||||
|
//const uint32_t GBACheatGameSharkSeeds[4] = { 0x09F4FBBD, 0x9681884A, 0x352027E9, 0xF3DEE5A7 };
|
||||||
/* void GBACheatDecryptGameShark(uint32_t* op1, uint32_t* op2, const uint32_t* seeds) {
|
/* void GBACheatDecryptGameShark(uint32_t* op1, uint32_t* op2, const uint32_t* seeds) {
|
||||||
uint32_t sum = 0xC6EF3720;
|
uint32_t sum = 0xC6EF3720;
|
||||||
int i;
|
int i;
|
||||||
|
@ -674,6 +678,45 @@ namespace BizHawk.Client.EmuHawk
|
||||||
MessageBox.Show("An Error occured: " + ex.GetType().ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show("An Error occured: " + ex.GetType().ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void SMS()
|
||||||
|
{
|
||||||
|
//This is FUN!
|
||||||
|
if (txtCheat.Text.IndexOf("-") != 4)
|
||||||
|
{
|
||||||
|
MessageBox.Show("All Master System Action Replay Codes need to contain a dash after the fourth character.", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (txtCheat.Text.Length != 9)
|
||||||
|
{
|
||||||
|
MessageBox.Show("All Master System Action Replay Codes need to nine charaters in length.", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
parseString = txtCheat.Text;
|
||||||
|
parseString = parseString.Remove(0, 2);
|
||||||
|
//MessageBox.Show(parseString);
|
||||||
|
RAMAddress = parseString.Remove(4, 2);
|
||||||
|
//MessageBox.Show(RAMAddress);
|
||||||
|
RAMAddress = RAMAddress.Replace("-", "");
|
||||||
|
MessageBox.Show(RAMAddress);
|
||||||
|
RAMValue = parseString.Remove(0, 5);
|
||||||
|
MessageBox.Show(RAMValue);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//A Watch needs to be generated so we can make a cheat out of that. This is due to how the Cheat engine works.
|
||||||
|
//System Bus Domain, The Address to Watch, Byte size (Byte), Hex Display, Description. Not Big Endian.
|
||||||
|
var watch = Watch.GenerateWatch(MemoryDomains["Main RAM"], long.Parse(RAMAddress, NumberStyles.HexNumber), Watch.WatchSize.Byte, Watch.DisplayType.Hex, txtDescription.Text, false);
|
||||||
|
//Take Watch, Add our Value we want, and it should be active when addded?
|
||||||
|
Global.CheatList.Add(new Cheat(watch, int.Parse(RAMValue, NumberStyles.HexNumber)));
|
||||||
|
//Clear old Inputs
|
||||||
|
txtCheat.Clear();
|
||||||
|
txtDescription.Clear();
|
||||||
|
}
|
||||||
|
//Someone broke the world?
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("An Error occured: " + ex.GetType().ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
private void SNES()
|
private void SNES()
|
||||||
{
|
{
|
||||||
//TODO: Sample Code and Get Smarter?
|
//TODO: Sample Code and Get Smarter?
|
||||||
|
|
Loading…
Reference in New Issue