Gameshark refactor (#1867)

* first round of GameShark.cs cleanups, redundant code and stylecop cleanup

* simplify how gba readonly values are set

* a few more cleanups

* GameShark - use NESGameGenieDecoder for nes logic

* remove now unused NESGameGeneie tool

* Client.Common - move nes encode/decoder to a cheats folder

* GameShark - move genesis game genie coding logic to its own class

* remove NesGameGenieEncoder that i snow unused

* fix naming

* remove GenGameGenie in favor of using the unified Cheat Code decoder

* move Gameboy/GameGear decoding logic from GameShark to its own class, cleanup

* remove GBGameGenie, was only exposed via the toolbox, GameShark tool does all of this logic

* GameShark - move snes game genie decoding logic to its own class

* cleanup

* remove unused snes GameGenie tool

* move Gb GameShark decoding to its own class

* cleanup

* move Genesis action replay decoding logic to its own class

* cleanup

* cleanup

* cleanup

* cleanup

* move Sms ActionReplay decoding to its own class, cleanlup

* cleanup

* move snes action replay decoding to its own class

* cleanup with a helper method

* cleanup

* more cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* move Psx GameShark decoding to its own class

* Move saturn gameshark parsing to its own class

* cleanup

* cleanup

* move N64 decoder logic to its own class

* remove GBA cheat code that hasn't been ready for 5 years, easier to try to implement this in the re-architected code, so delete for now at least

* start to detangle GBA gameshark mess

* Gameshark - remove most gba cheat code functionality for now, easier to rebuild it later

* Gameshark - cleanup

* cleanup

* cleanup

* cleanup

* redesign nes decoder to simpler design

* simplify more

* convert psx and saturn decoders and simplify

* convert more decoders

* convert more decoders

* convert more decoders

* convert more decoders

* convert gba decoder

* convert more decoders

* convert and simplify N64 decoder

* GameShark - simplify more
This commit is contained in:
adelikat 2020-02-29 15:18:40 -06:00 committed by GitHub
parent 7c32305cb4
commit 4bfb4ab00d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 1098 additions and 7063 deletions

View File

@ -1,173 +0,0 @@
using System.Collections.Generic;
namespace BizHawk.Client.Common
{
public class NESGameGenieDecoder
{
private readonly string _code;
private readonly Dictionary<char, int> _gameGenieTable = new Dictionary<char, int>
{
['A'] = 0, // 0000
['P'] = 1, // 0001
['Z'] = 2, // 0010
['L'] = 3, // 0011
['G'] = 4, // 0100
['I'] = 5, // 0101
['T'] = 6, // 0110
['Y'] = 7, // 0111
['E'] = 8, // 1000
['O'] = 9, // 1001
['X'] = 10, // 1010
['U'] = 11, // 1011
['K'] = 12, // 1100
['S'] = 13, // 1101
['V'] = 14, // 1110
['N'] = 15 // 1111
};
public NESGameGenieDecoder(string code)
{
_code = code;
Decode();
}
public int Address { get; private set; }
public int Value { get; private set; }
public int? Compare { get; private set; }
public void Decode()
{
// char 3 bit 3 denotes the code length.
if (_code.Length == 6)
{
// Char # | 1 | 2 | 3 | 4 | 5 | 6 |
// Bit # |3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|
// maps to|1|6|7|8|H|2|3|4|-|I|J|K|L|A|B|C|D|M|N|O|5|E|F|G|
Value = 0;
Address = 0x8000;
_gameGenieTable.TryGetValue(_code[0], out var x);
Value |= x & 0x07;
Value |= (x & 0x08) << 4;
_gameGenieTable.TryGetValue(_code[1], out x);
Value |= (x & 0x07) << 4;
Address |= (x & 0x08) << 4;
_gameGenieTable.TryGetValue(_code[2], out x);
Address |= (x & 0x07) << 4;
_gameGenieTable.TryGetValue(_code[3], out x);
Address |= (x & 0x07) << 12;
Address |= x & 0x08;
_gameGenieTable.TryGetValue(_code[4], out x);
Address |= x & 0x07;
Address |= (x & 0x08) << 8;
_gameGenieTable.TryGetValue(_code[5], out x);
Address |= (x & 0x07) << 8;
Value |= x & 0x08;
}
else if (_code.Length == 8)
{
// Char # | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
// Bit # |3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|
// maps to|1|6|7|8|H|2|3|4|-|I|J|K|L|A|B|C|D|M|N|O|%|E|F|G|!|^|&|*|5|@|#|$|
Value = 0;
Address = 0x8000;
Compare = 0;
_gameGenieTable.TryGetValue(_code[0], out var x);
Value |= x & 0x07;
Value |= (x & 0x08) << 4;
_gameGenieTable.TryGetValue(_code[1], out x);
Value |= (x & 0x07) << 4;
Address |= (x & 0x08) << 4;
_gameGenieTable.TryGetValue(_code[2], out x);
Address |= (x & 0x07) << 4;
_gameGenieTable.TryGetValue(_code[3], out x);
Address |= (x & 0x07) << 12;
Address |= x & 0x08;
_gameGenieTable.TryGetValue(_code[4], out x);
Address |= x & 0x07;
Address |= (x & 0x08) << 8;
_gameGenieTable.TryGetValue(_code[5], out x);
Address |= (x & 0x07) << 8;
Compare |= x & 0x08;
_gameGenieTable.TryGetValue(_code[6], out x);
Compare |= x & 0x07;
Compare |= (x & 0x08) << 4;
_gameGenieTable.TryGetValue(_code[7], out x);
Compare |= (x & 0x07) << 4;
Value |= x & 0x08;
}
}
}
public class NESGameGenieEncoder
{
private readonly char[] _letters = { 'A', 'P', 'Z', 'L', 'G', 'I', 'T', 'Y', 'E', 'O', 'X', 'U', 'K', 'S', 'V', 'N' };
private readonly int _address;
private readonly int _value;
private int? _compare;
public NESGameGenieEncoder(int address, int value, int? compare)
{
_address = address;
if (_address >= 0x8000)
{
_address -= 0x8000;
}
_value = value;
_compare = compare;
GameGenieCode = "";
}
public string GameGenieCode { get; private set; }
public string Encode()
{
byte[] num = { 0, 0, 0, 0, 0, 0, 0, 0 };
num[0] = (byte)((_value & 7) + ((_value >> 4) & 8));
num[1] = (byte)(((_value >> 4) & 7) + ((_address >> 4) & 8));
num[2] = (byte)((_address >> 4) & 7);
num[3] = (byte)((_address >> 12) + (_address & 8));
num[4] = (byte)((_address & 7) + ((_address >> 8) & 8));
num[5] = (byte)((_address >> 8) & 7);
if (_compare.HasValue)
{
num[2] += 8;
num[5] += (byte)(_compare & 8);
num[6] = (byte)((_compare & 7) + ((_compare >> 4) & 8));
num[7] = (byte)(((_compare >> 4) & 7) + (_value & 8));
for (var i = 0; i < 8; i++)
{
GameGenieCode += _letters[num[i]];
}
}
else
{
num[5] += (byte)(_value & 8);
for (var i = 0; i < 6; i++)
{
GameGenieCode += _letters[num[i]];
}
}
return GameGenieCode;
}
}
}

View File

@ -0,0 +1,46 @@
using System;
using System.Globalization;
namespace BizHawk.Client.Common.cheats
{
public static class GbGameSharkDecoder
{
// Sample Input for GB/GBC:
// 010FF6C1
// Becomes:
// Address C1F6
// Value 0F
public static IDecodeResult Decode(string code)
{
if (code == null)
{
throw new ArgumentNullException(nameof(code));
}
if (code.Length != 8 || code.Contains("-"))
{
return new InvalidCheatCode("GameShark codes must be 8 characters with no dashes.");
}
var test = code.Substring(0, 2);
if (test != "00" && test != "01")
{
return new InvalidCheatCode("All GameShark Codes for GameBoy need to start with 00 or 01");
}
var result = new DecodeResult { Size = WatchSize.Byte };
code = code.Remove(0, 2);
var valueStr = code.Remove(2, 4);
code = code.Remove(0, 2);
var addrStr = code.Remove(0, 2);
addrStr = addrStr + code.Remove(2, 2);
result.Value = int.Parse(valueStr, NumberStyles.HexNumber);
result.Address = int.Parse(addrStr, NumberStyles.HexNumber);
return result;
}
}
}

View File

@ -0,0 +1,110 @@
using System;
using System.Collections.Generic;
namespace BizHawk.Client.Common.cheats
{
/// <summary>
/// Decodes Gameboy and Game Gear Game Genie codes
/// </summary>
public static class GbGgGameGenieDecoder
{
private static readonly Dictionary<char, int> _gbGgGameGenieTable = new Dictionary<char, int>
{
['0'] = 0,
['1'] = 1,
['2'] = 2,
['3'] = 3,
['4'] = 4,
['5'] = 5,
['6'] = 6,
['7'] = 7,
['8'] = 8,
['9'] = 9,
['A'] = 10,
['B'] = 11,
['C'] = 12,
['D'] = 13,
['E'] = 14,
['F'] = 15
};
public static IDecodeResult Decode(string _code)
{
if (_code == null)
{
throw new ArgumentNullException(nameof(_code));
}
if (_code.LastIndexOf("-") != 7 || _code.IndexOf("-") != 3)
{
return new InvalidCheatCode("All Master System Game Genie Codes need to have a dash after the third character and seventh character.");
}
// No cypher on value
// Char # | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
// Bit # |3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|
// maps to| Value |A|B|C|D|E|F|G|H|I|J|K|L|XOR 0xF|a|b|c|c|NotUsed|e|f|g|h|
// proper | Value |XOR 0xF|A|B|C|D|E|F|G|H|I|J|K|L|g|h|a|b|Nothing|c|d|e|f|
var result = new DecodeResult { Size = WatchSize.Byte };
int x;
// Getting Value
if (_code.Length > 0)
{
_gbGgGameGenieTable.TryGetValue(_code[0], out x);
result.Value = x << 4;
}
if (_code.Length > 1)
{
_gbGgGameGenieTable.TryGetValue(_code[1], out x);
result.Value |= x;
}
// Address
if (_code.Length > 2)
{
_gbGgGameGenieTable.TryGetValue(_code[2], out x);
result.Value = x << 8;
}
else
{
result.Value = -1;
}
if (_code.Length > 3)
{
_gbGgGameGenieTable.TryGetValue(_code[3], out x);
result.Address |= x << 4;
}
if (_code.Length > 4)
{
_gbGgGameGenieTable.TryGetValue(_code[4], out x);
result.Address |= x;
}
if (_code.Length > 5)
{
_gbGgGameGenieTable.TryGetValue(_code[5], out x);
result.Address |= (x ^ 0xF) << 12;
}
// compare need to be full
if (_code.Length > 8)
{
_gbGgGameGenieTable.TryGetValue(_code[6], out x);
var comp = x << 2;
// 8th character ignored
_gbGgGameGenieTable.TryGetValue(_code[8], out x);
comp |= (x & 0xC) >> 2;
comp |= (x & 0x3) << 6;
result.Compare = comp ^ 0xBA;
}
return result;
}
}
}

View File

@ -0,0 +1,89 @@
using System;
using System.Globalization;
using System.Linq;
namespace BizHawk.Client.Common.cheats
{
// TODO:
public static class GbaGameSharkDecoder
{
private static readonly uint[] GameSharkSeeds = { 0x09F4FBBDU, 0x9681884AU, 0x352027E9U, 0xF3DEE5A7U };
private static readonly uint[] ProActionReplaySeeds = { 0x7AA9648FU, 0x7FAE6994U, 0xC0EFAAD5U, 0x42712C57U };
private static string Decrypt(string code)
{
var op1 = uint.Parse(code.Remove(8, 9), NumberStyles.HexNumber);
var op2 = uint.Parse(code.Remove(0, 9), NumberStyles.HexNumber);
uint sum = 0xC6EF3720;
// Tiny Encryption Algorithm
for (int i = 0; i < 32; ++i)
{
op2 -= ((op1 << 4) + GameSharkSeeds[2]) ^ (op1 + sum) ^ ((op1 >> 5) + GameSharkSeeds[3]);
op1 -= ((op2 << 4) + GameSharkSeeds[0]) ^ (op2 + sum) ^ ((op2 >> 5) + GameSharkSeeds[1]);
sum -= 0x9E3779B9;
}
return $"{op1:X8} {op2:X8}";
}
// TODO: When to use this?
private static string DecryptPro(string code)
{
var sum = 0xC6EF3720;
var op1 = uint.Parse(code.Remove(8, 9), NumberStyles.HexNumber);
var op2 = uint.Parse(code.Remove(0, 9), NumberStyles.HexNumber);
for (int j = 0; j < 32; ++j)
{
op2 -= ((op1 << 4) + ProActionReplaySeeds[2]) ^ (op1 + sum) ^ ((op1 >> 5) + ProActionReplaySeeds[3]);
op1 -= ((op2 << 4) + ProActionReplaySeeds[0]) ^ (op2 + sum) ^ ((op2 >> 5) + ProActionReplaySeeds[1]);
sum -= 0x9E3779B9;
}
return $"{op1:X8} {op2:X8}";
}
public static IDecodeResult Decode(string code)
{
if (code == null)
{
throw new ArgumentNullException(nameof(code));
}
if (code.Length != 17)
{
code = Decrypt(code);
}
if (code.IndexOf(" ") != 9 || code.Length != 17)
{
return new InvalidCheatCode("All GBA GameShark Codes need to be 17 characters in length with a space after the first eight.");
}
var result = new DecodeResult
{
Size = code.First() switch
{
'0' => WatchSize.Byte,
'1' => WatchSize.Word,
'2' => WatchSize.DWord,
'3' => WatchSize.DWord,
'6' => WatchSize.Word,
_ => WatchSize.Byte
}
};
result.Address = int.Parse(GetLast(code, (int)result.Size), NumberStyles.HexNumber);
result.Value = int.Parse(code.Substring(1, 8));
return result;
}
private static string GetLast(string str, int length)
{
return length >= str.Length ? str : str.Substring(str.Length - length);
}
}
}

View File

@ -0,0 +1,53 @@
using System;
using System.Globalization;
namespace BizHawk.Client.Common.cheats
{
// TODO: validate string and throw
public static class GenesisActionReplayDecoder
{
public static IDecodeResult Decode(string code)
{
if (code == null)
{
throw new ArgumentNullException(nameof(code));
}
if (code.IndexOf(":") != 6)
{
return new InvalidCheatCode("Action Replay/Pro Action Replay Codes need to contain a colon after the sixth character.");
}
var parseString = code.Remove(0, 2);
switch (code.Length)
{
case 9:
// Sample Code of 1-Byte:
// FFF761:64
// Becomes:
// Address: F761
// Value: 64
return new DecodeResult
{
Address = int.Parse(parseString.Remove(4, 3), NumberStyles.HexNumber),
Value = int.Parse(parseString.Remove(0, 5), NumberStyles.HexNumber),
Size = WatchSize.Byte
};
case 11:
// Sample Code of 2-Byte:
// FFF761:6411
// Becomes:
// Address: F761
// Value: 6411
return new DecodeResult
{
Address = int.Parse(parseString.Remove(4, 5), NumberStyles.HexNumber),
Value = int.Parse(parseString.Remove(0, 5), NumberStyles.HexNumber),
Size = WatchSize.Word
};
default:
return new InvalidCheatCode("Action Replay/Pro Action Replay Codes need to be either 9 or 11 characters.");
}
}
}
}

View File

@ -0,0 +1,87 @@
using System;
using System.Collections.Generic;
namespace BizHawk.Client.Common.cheats
{
public static class GenesisGameGenieDecoder
{
private static readonly Dictionary<char, long> GameGenieTable = new Dictionary<char, long>
{
['A'] = 0,
['B'] = 1,
['C'] = 2,
['D'] = 3,
['E'] = 4,
['F'] = 5,
['G'] = 6,
['H'] = 7,
['J'] = 8,
['K'] = 9,
['L'] = 10,
['M'] = 11,
['N'] = 12,
['P'] = 13,
['R'] = 14,
['S'] = 15,
['T'] = 16,
['V'] = 17,
['W'] = 18,
['X'] = 19,
['Y'] = 20,
['Z'] = 21,
['0'] = 22,
['1'] = 23,
['2'] = 24,
['3'] = 25,
['4'] = 26,
['5'] = 27,
['6'] = 28,
['7'] = 29,
['8'] = 30,
['9'] = 31
};
public static IDecodeResult Decode(string code)
{
if (code == null)
{
throw new ArgumentNullException(nameof(code));
}
if (code.IndexOf("-") != 4)
{
return new InvalidCheatCode("Game Genie Codes need to contain a dash after the fourth character");
}
if (code.Contains("I") | code.Contains("O") | code.Contains("Q") | code.Contains("U"))
{
return new InvalidCheatCode("Game Genie Codes do not use I, O, Q or U.");
}
// Remove the -
code = code.Remove(4, 1);
long hexCode = 0;
// convert code to a long binary string
foreach (var t in code)
{
hexCode <<= 5;
GameGenieTable.TryGetValue(t, out var y);
hexCode |= y;
}
long decoded = (hexCode & 0xFF00000000) >> 32;
decoded |= hexCode & 0x00FF000000;
decoded |= (hexCode & 0x0000FF0000) << 16;
decoded |= (hexCode & 0x00000000700) << 5;
decoded |= (hexCode & 0x000000F800) >> 3;
decoded |= (hexCode & 0x00000000FF) << 16;
return new DecodeResult
{
Size = WatchSize.Word,
Value = (int)(decoded & 0x000000FFFF),
Address= (int)((decoded & 0xFFFFFF0000) >> 16)
};
}
}
}

View File

@ -0,0 +1,59 @@
using BizHawk.Emulation.Common;
namespace BizHawk.Client.Common.cheats
{
/// <summary>
/// Represents a decoded cheat value
/// </summary>
public interface IDecodeResult
{
int Address { get; }
int Value { get; }
int? Compare { get; }
WatchSize Size { get; }
bool IsValid { get; }
string Error { get; }
}
public class DecodeResult : IDecodeResult
{
public int Address { get; internal set; }
public int Value { get; internal set; }
public int? Compare { get; internal set; }
public WatchSize Size { get; internal set; }
public bool IsValid => true;
public string Error => "";
}
public class InvalidCheatCode : IDecodeResult
{
public InvalidCheatCode(string error)
{
Error = error;
}
public int Address => int.MaxValue;
public int Value => int.MaxValue;
public int? Compare => null;
public WatchSize Size => WatchSize.Separator;
public bool IsValid => false;
public string Error { get; }
}
public static class DecodeResultExtensions
{
public static Cheat ToCheat(this IDecodeResult result, MemoryDomain domain, string description)
{
var watch = Watch.GenerateWatch(
domain,
result.Address,
result.Size,
DisplayType.Hex,
domain.EndianType == MemoryDomain.Endian.Big,
description);
return result.Compare.HasValue
? new Cheat(watch, result.Value, result.Compare.Value, true, Cheat.CompareType.Equal)
: new Cheat(watch, result.Value);
}
}
}

View File

@ -0,0 +1,68 @@
using System;
using System.Globalization;
namespace BizHawk.Client.Common.cheats
{
// TODO: support comparison cheat codes
public static class N64GameSharkDecoder
{
public static IDecodeResult Decode(string code)
{
if (code == null)
{
throw new ArgumentNullException(nameof(code));
}
if (code.IndexOf(" ") != 8)
{
return new InvalidCheatCode("GameShark Codes need to contain a space after the eighth character.");
}
if (code.Length != 13)
{
return new InvalidCheatCode("GameShark Codes need to be 13 characters in length.");
}
switch (code.Substring(0, 2))
{
case "50":
case "D0":
case "D1":
case "D2":
case "D3":
return new InvalidCheatCode("This code is not yet supported by BizHawk.");
case "EE":
case "DD":
case "CC":
return new InvalidCheatCode("This code is for Disabling the Expansion Pak. This is not allowed.");
case "DE":
// Single Write ON-Boot code.
// Not Necessary? Think so?
case "F0":
case "F1":
case "2A":
case "3C":
case "FF":
return new InvalidCheatCode("This code is not needed by Bizhawk.");
}
var s = code.Remove(0, 2);
return new DecodeResult
{
Size = code.Substring(0, 2) switch
{
"80" => WatchSize.Byte,
"81" => WatchSize.Word,
"88" => WatchSize.Byte,
"89" => WatchSize.Word,
"A0" => WatchSize.Byte,
"A1" => WatchSize.Word,
_ => WatchSize.Byte,
},
Address = int.Parse(s.Remove(6, 5), NumberStyles.HexNumber),
Value = int.Parse(s.Remove(0, 7), NumberStyles.HexNumber)
};
}
}
}

View File

@ -0,0 +1,117 @@
using System;
using System.Collections.Generic;
namespace BizHawk.Client.Common.cheats
{
public static class NesGameGenieDecoder
{
private static readonly Dictionary<char, int> GameGenieTable = new Dictionary<char, int>
{
['A'] = 0, // 0000
['P'] = 1, // 0001
['Z'] = 2, // 0010
['L'] = 3, // 0011
['G'] = 4, // 0100
['I'] = 5, // 0101
['T'] = 6, // 0110
['Y'] = 7, // 0111
['E'] = 8, // 1000
['O'] = 9, // 1001
['X'] = 10, // 1010
['U'] = 11, // 1011
['K'] = 12, // 1100
['S'] = 13, // 1101
['V'] = 14, // 1110
['N'] = 15 // 1111
};
public static IDecodeResult Decode(string code)
{
if (code == null)
{
throw new ArgumentNullException(nameof(code));
}
if (code.Length != 6 && code.Length != 8)
{
return new InvalidCheatCode("Game Genie codes need to be six or eight characters in length.");
}
var result = new DecodeResult { Size = WatchSize.Byte };
// char 3 bit 3 denotes the code length.
if (code.Length == 6)
{
// Char # | 1 | 2 | 3 | 4 | 5 | 6 |
// Bit # |3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|
// maps to|1|6|7|8|H|2|3|4|-|I|J|K|L|A|B|C|D|M|N|O|5|E|F|G|
result.Value = 0;
result.Address = 0x8000;
GameGenieTable.TryGetValue(code[0], out var x);
result.Value |= x & 0x07;
result.Value |= (x & 0x08) << 4;
GameGenieTable.TryGetValue(code[1], out x);
result.Value |= (x & 0x07) << 4;
result.Address |= (x & 0x08) << 4;
GameGenieTable.TryGetValue(code[2], out x);
result.Address |= (x & 0x07) << 4;
GameGenieTable.TryGetValue(code[3], out x);
result.Address |= (x & 0x07) << 12;
result.Address |= x & 0x08;
GameGenieTable.TryGetValue(code[4], out x);
result.Address |= x & 0x07;
result.Address |= (x & 0x08) << 8;
GameGenieTable.TryGetValue(code[5], out x);
result.Address |= (x & 0x07) << 8;
result.Value |= x & 0x08;
}
else
{
// Char # | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
// Bit # |3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|
// maps to|1|6|7|8|H|2|3|4|-|I|J|K|L|A|B|C|D|M|N|O|%|E|F|G|!|^|&|*|5|@|#|$|
result.Value = 0;
result.Address = 0x8000;
result.Compare = 0;
GameGenieTable.TryGetValue(code[0], out var x);
result.Value |= x & 0x07;
result.Value |= (x & 0x08) << 4;
GameGenieTable.TryGetValue(code[1], out x);
result.Value |= (x & 0x07) << 4;
result.Address |= (x & 0x08) << 4;
GameGenieTable.TryGetValue(code[2], out x);
result.Address |= (x & 0x07) << 4;
GameGenieTable.TryGetValue(code[3], out x);
result.Address |= (x & 0x07) << 12;
result.Address |= x & 0x08;
GameGenieTable.TryGetValue(code[4], out x);
result.Address |= x & 0x07;
result.Address |= (x & 0x08) << 8;
GameGenieTable.TryGetValue(code[5], out x);
result.Address |= (x & 0x07) << 8;
result.Compare |= x & 0x08;
GameGenieTable.TryGetValue(code[6], out x);
result.Compare |= x & 0x07;
result.Compare |= (x & 0x08) << 4;
GameGenieTable.TryGetValue(code[7], out x);
result.Compare |= (x & 0x07) << 4;
result.Value |= x & 0x08;
}
return result;
}
}
}

View File

@ -0,0 +1,59 @@
using System;
using System.Globalization;
namespace BizHawk.Client.Common.cheats
{
// TODO: cheats support comparison type, so we could support a lot more codes, by having Compare and Type properties and parsing
public static class PsxGameSharkDecoder
{
// 30XXXXXX 00YY
public static IDecodeResult Decode(string code)
{
if (code == null)
{
throw new ArgumentNullException(nameof(code));
}
if (code.IndexOf(" ") != 8)
{
return new InvalidCheatCode("All PSX GameShark Codes need to contain a space after the eighth character.");
}
if (code.Length != 13)
{
return new InvalidCheatCode("All PSX GameShark Cheats need to be 13 characters in length.");
}
var result = new DecodeResult();
var type = code.Substring(0, 2);
result.Size = type switch
{
"10" => WatchSize.Word,
"11" => WatchSize.Word,
"20" => WatchSize.Byte,
"21" => WatchSize.Byte,
"30" => WatchSize.Byte,
"80" => WatchSize.Word,
"D0" => WatchSize.Word,
"D1" => WatchSize.Word,
"D2" => WatchSize.Word,
"D3" => WatchSize.Word,
"D4" => WatchSize.Word,
"D5" => WatchSize.Word,
"D6" => WatchSize.Word,
"E0" => WatchSize.Byte,
"E1" => WatchSize.Byte,
"E2" => WatchSize.Byte,
"E3" => WatchSize.Byte,
_ => WatchSize.Byte
};
var s = code.Remove(0, 2);
result.Address = int.Parse(s.Remove(6, 5), NumberStyles.HexNumber);
result.Value = int.Parse(s.Remove(0, 7), NumberStyles.HexNumber);
return result;
}
}
}

View File

@ -0,0 +1,46 @@
using System;
using System.Globalization;
namespace BizHawk.Client.Common.cheats
{
public static class SaturnGameSharkDecoder
{
// Sample Input for Saturn:
// 160949FC 0090
// Address: 0949FC
// Value: 90
// Note, 3XXXXXXX are Big Endian
// Remove first two octets
public static IDecodeResult Decode(string code)
{
if (code == null)
{
throw new ArgumentNullException(nameof(code));
}
if (code.IndexOf(" ") != 8)
{
return new InvalidCheatCode("All Saturn GameShark Codes need to contain a space after the eighth character.");
}
if (code.Length != 13)
{
return new InvalidCheatCode("All Saturn GameShark Cheats need to be 13 characters in length.");
}
var result = new DecodeResult { Size = WatchSize.Word };
// Only the first character really matters? 16 or 36?
var test = code.Remove(2, 11).Remove(1, 1);
if (test == "3")
{
result.Size = WatchSize.Byte;
}
var s = code.Remove(0, 2);
result.Address = int.Parse(s.Remove(6, 5), NumberStyles.HexNumber);
result.Value = int.Parse(s.Remove(0, 7));
return result;
}
}
}

View File

@ -0,0 +1,30 @@
using System;
using System.Globalization;
namespace BizHawk.Client.Common.cheats
{
public static class SmsActionReplayDecoder
{
public static IDecodeResult Decode(string code)
{
if (code == null)
{
throw new ArgumentNullException(nameof(code));
}
if (code.IndexOf("-") != 3 && code.Length != 9)
{
return new InvalidCheatCode("Action Replay Codes must be 9 characters with a dash after the third character");
}
var result = new DecodeResult { Size = WatchSize.Byte };
var s = code.Remove(0, 2);
var ramAddress = s.Remove(4, 2).Replace("-", "");
var ramValue = s.Remove(0, 5);
result.Address = int.Parse(ramAddress, NumberStyles.HexNumber);
result.Value = int.Parse(ramValue, NumberStyles.HexNumber);
return result;
}
}
}

View File

@ -0,0 +1,32 @@
using System;
using System.Globalization;
namespace BizHawk.Client.Common.cheats
{
public static class SnesActionReplayDecoder
{
// Sample Code:
// 7E18A428
// Address: 7E18A4
// Value: 28
public static IDecodeResult Decode(string code)
{
if (code == null)
{
throw new ArgumentNullException(nameof(code));
}
if (code.Length != 8)
{
return new InvalidCheatCode("Pro Action Replay Codes must to be eight characters.");
}
return new DecodeResult
{
Size = WatchSize.Word,
Address = int.Parse(code.Remove(6, 2), NumberStyles.HexNumber),
Value = int.Parse(code.Remove(0, 6), NumberStyles.HexNumber)
};
}
}
}

View File

@ -0,0 +1,112 @@
using System;
using System.Collections.Generic;
namespace BizHawk.Client.Common.cheats
{
public static class SnesGameGenieDecoder
{
// including transposition
// Code: D F 4 7 0 9 1 5 6 B C 8 A 2 3 E
// Hex: 0 1 2 3 4 5 6 7 8 9 A B C D E F
// This only applies to the SNES
private static readonly Dictionary<char, int> SNESGameGenieTable = new Dictionary<char, int>
{
['D'] = 0, // 0000
['F'] = 1, // 0001
['4'] = 2, // 0010
['7'] = 3, // 0011
['0'] = 4, // 0100
['9'] = 5, // 0101
['1'] = 6, // 0110
['5'] = 7, // 0111
['6'] = 8, // 1000
['B'] = 9, // 1001
['C'] = 10, // 1010
['8'] = 11, // 1011
['A'] = 12, // 1100
['2'] = 13, // 1101
['3'] = 14, // 1110
['E'] = 15 // 1111
};
public static IDecodeResult Decode(string code)
{
if (code == null)
{
throw new ArgumentNullException(nameof(code));
}
if (!code.Contains("-") && code.Length != 9)
{
return new InvalidCheatCode("Game genie codes must be 9 characters with a format of xxyy-yyyy");
}
// Code: D F 4 7 0 9 1 5 6 B C 8 A 2 3 E
// Hex: 0 1 2 3 4 5 6 7 8 9 A B C D E F
// XXYY-YYYY, where XX is the value, and YY-YYYY is the address.
// Char # | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
// Bit # |3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|
// maps to| Value |i|j|k|l|q|r|s|t|o|p|a|b|c|d|u|v|w|x|e|f|g|h|m|n|
// order | Value |a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|
var result = new DecodeResult { Size = WatchSize.Byte };
int x;
// Value
if (code.Length > 0)
{
SNESGameGenieTable.TryGetValue(code[0], out x);
result.Value = x << 4;
}
if (code.Length > 1)
{
SNESGameGenieTable.TryGetValue(code[1], out x);
result.Value |= x;
}
// Address
if (code.Length > 2)
{
SNESGameGenieTable.TryGetValue(code[2], out x);
result.Address = x << 12;
}
if (code.Length > 3)
{
SNESGameGenieTable.TryGetValue(code[3], out x);
result.Address |= x << 4;
}
if (code.Length > 4)
{
SNESGameGenieTable.TryGetValue(code[4], out x);
result.Address |= (x & 0xC) << 6;
result.Address |= (x & 0x3) << 22;
}
if (code.Length > 5)
{
SNESGameGenieTable.TryGetValue(code[5], out x);
result.Address |= (x & 0xC) << 18;
result.Address |= (x & 0x3) << 2;
}
if (code.Length > 6)
{
SNESGameGenieTable.TryGetValue(code[6], out x);
result.Address |= (x & 0xC) >> 2;
result.Address |= (x & 0x3) << 18;
}
if (code.Length > 7)
{
SNESGameGenieTable.TryGetValue(code[7], out x);
result.Address |= (x & 0xC) << 14;
result.Address |= (x & 0x3) << 10;
}
return result;
}
}
}

View File

@ -4,6 +4,7 @@ using System.Linq;
using NLua;
using BizHawk.Client.Common.cheats;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Nintendo.NES;
using BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES;
@ -44,19 +45,11 @@ namespace BizHawk.Client.Common
{
if (NESAvailable && MemoryDomains != null)
{
var decoder = new NESGameGenieDecoder(code);
var watch = Watch.GenerateWatch(
MemoryDomains["System Bus"],
decoder.Address,
WatchSize.Byte,
DisplayType.Hex,
false,
code);
Global.CheatList.Add(new Cheat(
watch,
decoder.Value,
decoder.Compare));
var result = NesGameGenieDecoder.Decode(code);
if (result.IsValid)
{
Global.CheatList.Add(result.ToCheat(MemoryDomains.SystemBus, ""));
}
}
}
@ -126,9 +119,12 @@ namespace BizHawk.Client.Common
{
if (NESAvailable)
{
var decoder = new NESGameGenieDecoder(code);
Global.CheatList.RemoveRange(
Global.CheatList.Where(c => c.Address == decoder.Address));
var decoder = NesGameGenieDecoder.Decode(code);
if (decoder.IsValid)
{
Global.CheatList.RemoveRange(
Global.CheatList.Where(c => c.Address == decoder.Address));
}
}
}

View File

@ -525,9 +525,6 @@
<Compile Update="tools/GBA/MobileDetailView.cs" SubType="Form" />
<Compile Update="tools/GBA/MobileDetailView.Designer.cs" DependentUpon="MobileDetailView.cs" />
<EmbeddedResource Update="tools/GBA/MobileDetailView.resx" DependentUpon="MobileDetailView.cs" />
<Compile Update="tools/GB/GBGameGenie.cs" SubType="Form" />
<Compile Update="tools/GB/GBGameGenie.Designer.cs" DependentUpon="GBGameGenie.cs" />
<EmbeddedResource Update="tools/GB/GBGameGenie.resx" DependentUpon="GBGameGenie.cs" />
<Compile Update="tools/GB/GBGPUView.cs" SubType="Form" />
<Compile Update="tools/GB/GBGPUView.Designer.cs" DependentUpon="GBGPUView.cs" />
<EmbeddedResource Update="tools/GB/GBGPUView.resx" DependentUpon="GBGPUView.cs" />
@ -537,9 +534,6 @@
<Compile Update="tools/Genesis/GenDbgWind.cs" SubType="Form" />
<Compile Update="tools/Genesis/GenDbgWind.Designer.cs" DependentUpon="GenDbgWind.cs" />
<EmbeddedResource Update="tools/Genesis/GenDbgWind.resx" DependentUpon="GenDbgWind.cs" />
<Compile Update="tools/Genesis/GenGameGenie.cs" SubType="Form" />
<Compile Update="tools/Genesis/GenGameGenie.Designer.cs" DependentUpon="GenGameGenie.cs" />
<EmbeddedResource Update="tools/Genesis/GenGameGenie.resx" DependentUpon="GenGameGenie.cs" />
<Compile Update="tools/Genesis/VDPViewer.cs" SubType="Form" />
<Compile Update="tools/Genesis/VDPViewer.Designer.cs" DependentUpon="VDPViewer.cs" />
<EmbeddedResource Update="tools/Genesis/VDPViewer.resx" DependentUpon="VDPViewer.cs" />
@ -589,9 +583,6 @@
<Compile Update="tools/NES/BarcodeEntry.Designer.cs" DependentUpon="BarcodeEntry.cs" />
<EmbeddedResource Update="tools/NES/BarcodeEntry.resx" DependentUpon="BarcodeEntry.cs" />
<Compile Update="tools/NES/NameTableViewer.cs" SubType="Component" />
<Compile Update="tools/NES/NESGameGenie.cs" SubType="Form" />
<Compile Update="tools/NES/NESGameGenie.Designer.cs" DependentUpon="NESGameGenie.cs" />
<EmbeddedResource Update="tools/NES/NESGameGenie.resx" DependentUpon="NESGameGenie.cs" />
<Compile Update="tools/NES/NESMusicRipper.cs" SubType="Form" />
<Compile Update="tools/NES/NESMusicRipper.Designer.cs" DependentUpon="NESMusicRipper.cs" />
<EmbeddedResource Update="tools/NES/NESMusicRipper.resx" DependentUpon="NESMusicRipper.cs" />
@ -618,9 +609,6 @@
<Compile Update="tools/SMS/VDPViewer.cs" SubType="Form" />
<Compile Update="tools/SMS/VDPViewer.Designer.cs" DependentUpon="VDPViewer.cs" />
<EmbeddedResource Update="tools/SMS/VDPViewer.resx" DependentUpon="VDPViewer.cs" />
<Compile Update="tools/SNES/SNESGameGenie.cs" SubType="Form" />
<Compile Update="tools/SNES/SNESGameGenie.Designer.cs" DependentUpon="SNESGameGenie.cs" />
<EmbeddedResource Update="tools/SNES/SNESGameGenie.resx" DependentUpon="SNESGameGenie.cs" />
<Compile Update="tools/SNES/SNESGraphicsDebugger.cs" SubType="Form" />
<Compile Update="tools/SNES/SNESGraphicsDebugger.Designer.cs" DependentUpon="SNESGraphicsDebugger.cs" />
<EmbeddedResource Update="tools/SNES/SNESGraphicsDebugger.resx" DependentUpon="SNESGraphicsDebugger.cs" />

View File

@ -335,7 +335,6 @@
this.GGLsettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.GenesisSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.vDPViewerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.GenesisGameGenieECDC = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator26 = new System.Windows.Forms.ToolStripSeparator();
this.GenesisSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.wonderSwanToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -2975,7 +2974,6 @@
//
this.GenesisSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.vDPViewerToolStripMenuItem,
this.GenesisGameGenieECDC,
this.toolStripSeparator26,
this.GenesisSettingsToolStripMenuItem});
this.GenesisSubMenu.Name = "GenesisSubMenu";
@ -2989,13 +2987,6 @@
this.vDPViewerToolStripMenuItem.Text = "&VDP Viewer";
this.vDPViewerToolStripMenuItem.Click += new System.EventHandler(this.GenVdpViewerMenuItem_Click);
//
// GenesisGameGenieECDC
//
this.GenesisGameGenieECDC.Name = "GenesisGameGenieECDC";
this.GenesisGameGenieECDC.Size = new System.Drawing.Size(217, 22);
this.GenesisGameGenieECDC.Text = "&Game Genie Encoder/Decoder";
this.GenesisGameGenieECDC.Click += new System.EventHandler(this.GenesisGameGenieEcDc_Click);
//
// toolStripSeparator26
//
this.toolStripSeparator26.Name = "toolStripSeparator26";
@ -4355,7 +4346,6 @@
private System.Windows.Forms.ToolStripMenuItem SaveRAMSubMenu;
private System.Windows.Forms.ToolStripMenuItem FlushSaveRAMMenuItem;
private System.Windows.Forms.ToolStripMenuItem PSXDiscControlsMenuItem;
private System.Windows.Forms.ToolStripMenuItem GenesisGameGenieECDC;
private System.Windows.Forms.ToolStripStatusLabel UpdateNotification;
private System.Windows.Forms.ToolStripMenuItem PSXControllerSettingsMenuItem;
private System.Windows.Forms.ToolStripMenuItem MacroToolMenuItem;

View File

@ -2330,11 +2330,6 @@ namespace BizHawk.Client.EmuHawk
GenericCoreConfig.DoDialog(this, "Genesis Settings");
}
private void GenesisGameGenieEcDc_Click(object sender, EventArgs e)
{
Tools.Load<GenGameGenie>();
}
#endregion
#region Wondersawn

View File

@ -1,510 +0,0 @@
namespace BizHawk.Client.EmuHawk
{
partial class GBGameGenie
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.GameGenieCodeBox = new System.Windows.Forms.GroupBox();
this.GGCodeMaskBox = new System.Windows.Forms.MaskedTextBox();
this.label3 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.ValueBox = new BizHawk.Client.EmuHawk.HexTextBox();
this.AddressBox = new BizHawk.Client.EmuHawk.HexTextBox();
this.addcheatbt = new System.Windows.Forms.Button();
this.ButtonPanel = new System.Windows.Forms.Panel();
this.BF = new System.Windows.Forms.Button();
this.BD = new System.Windows.Forms.Button();
this.BB = new System.Windows.Forms.Button();
this.B9 = new System.Windows.Forms.Button();
this.B7 = new System.Windows.Forms.Button();
this.B5 = new System.Windows.Forms.Button();
this.B3 = new System.Windows.Forms.Button();
this.BE = new System.Windows.Forms.Button();
this.B6 = new System.Windows.Forms.Button();
this.B1 = new System.Windows.Forms.Button();
this.BC = new System.Windows.Forms.Button();
this.BA = new System.Windows.Forms.Button();
this.B8 = new System.Windows.Forms.Button();
this.B4 = new System.Windows.Forms.Button();
this.B2 = new System.Windows.Forms.Button();
this.B0 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.CompareBox = new BizHawk.Client.EmuHawk.HexTextBox();
this.label6 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.ClearButton = new System.Windows.Forms.Button();
this.menuStrip1 = new MenuStripEx();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.cheatname = new System.Windows.Forms.TextBox();
this.GameGenieCodeBox.SuspendLayout();
this.ButtonPanel.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// GameGenieCodeBox
//
this.GameGenieCodeBox.Controls.Add(this.GGCodeMaskBox);
this.GameGenieCodeBox.Location = new System.Drawing.Point(31, 103);
this.GameGenieCodeBox.Name = "GameGenieCodeBox";
this.GameGenieCodeBox.Size = new System.Drawing.Size(118, 54);
this.GameGenieCodeBox.TabIndex = 1;
this.GameGenieCodeBox.TabStop = false;
this.GameGenieCodeBox.Text = "Game Genie Code";
//
// GGCodeMaskBox
//
this.GGCodeMaskBox.Location = new System.Drawing.Point(25, 26);
this.GGCodeMaskBox.Margin = new System.Windows.Forms.Padding(2);
this.GGCodeMaskBox.Mask = ">AAA-AAA-AAA";
this.GGCodeMaskBox.Name = "GGCodeMaskBox";
this.GGCodeMaskBox.Size = new System.Drawing.Size(75, 20);
this.GGCodeMaskBox.TabIndex = 10;
this.GGCodeMaskBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.GGCodeMaskBox.TextMaskFormat = System.Windows.Forms.MaskFormat.ExcludePromptAndLiterals;
this.GGCodeMaskBox.TextChanged += new System.EventHandler(this.GGCodeMaskBox_TextChanged);
this.GGCodeMaskBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.GGCodeMaskBox_KeyPress);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(8, 65);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(34, 13);
this.label3.TabIndex = 5;
this.label3.Text = "Value";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(8, 20);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(45, 13);
this.label1.TabIndex = 3;
this.label1.Text = "Address";
//
// ValueBox
//
this.ValueBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.ValueBox.Location = new System.Drawing.Point(105, 61);
this.ValueBox.MaxLength = 2;
this.ValueBox.Name = "ValueBox";
this.ValueBox.Nullable = true;
this.ValueBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.ValueBox.Size = new System.Drawing.Size(27, 20);
this.ValueBox.TabIndex = 23;
this.ValueBox.TextChanged += new System.EventHandler(this.ValueBox_TextChanged);
//
// AddressBox
//
this.AddressBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.AddressBox.Location = new System.Drawing.Point(88, 16);
this.AddressBox.MaxLength = 4;
this.AddressBox.Name = "AddressBox";
this.AddressBox.Nullable = true;
this.AddressBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.AddressBox.Size = new System.Drawing.Size(44, 20);
this.AddressBox.TabIndex = 21;
this.AddressBox.TextChanged += new System.EventHandler(this.AddressBox_TextChanged);
//
// addcheatbt
//
this.addcheatbt.Enabled = false;
this.addcheatbt.Location = new System.Drawing.Point(86, 163);
this.addcheatbt.Margin = new System.Windows.Forms.Padding(0);
this.addcheatbt.Name = "addcheatbt";
this.addcheatbt.Size = new System.Drawing.Size(65, 26);
this.addcheatbt.TabIndex = 33;
this.addcheatbt.Text = "&Add Cheat";
this.addcheatbt.UseVisualStyleBackColor = true;
this.addcheatbt.Click += new System.EventHandler(this.AddCheatClick);
//
// ButtonPanel
//
this.ButtonPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.ButtonPanel.Controls.Add(this.BF);
this.ButtonPanel.Controls.Add(this.BD);
this.ButtonPanel.Controls.Add(this.BB);
this.ButtonPanel.Controls.Add(this.B9);
this.ButtonPanel.Controls.Add(this.B7);
this.ButtonPanel.Controls.Add(this.B5);
this.ButtonPanel.Controls.Add(this.B3);
this.ButtonPanel.Controls.Add(this.BE);
this.ButtonPanel.Controls.Add(this.B6);
this.ButtonPanel.Controls.Add(this.B1);
this.ButtonPanel.Controls.Add(this.BC);
this.ButtonPanel.Controls.Add(this.BA);
this.ButtonPanel.Controls.Add(this.B8);
this.ButtonPanel.Controls.Add(this.B4);
this.ButtonPanel.Controls.Add(this.B2);
this.ButtonPanel.Controls.Add(this.B0);
this.ButtonPanel.Location = new System.Drawing.Point(35, 30);
this.ButtonPanel.Name = "ButtonPanel";
this.ButtonPanel.Size = new System.Drawing.Size(240, 67);
this.ButtonPanel.TabIndex = 4;
//
// BF
//
this.BF.Location = new System.Drawing.Point(206, 35);
this.BF.Name = "BF";
this.BF.Size = new System.Drawing.Size(26, 23);
this.BF.TabIndex = 16;
this.BF.Text = "F";
this.BF.UseVisualStyleBackColor = true;
this.BF.Click += new System.EventHandler(this.Keypad_Click);
//
// BD
//
this.BD.Location = new System.Drawing.Point(149, 35);
this.BD.Name = "BD";
this.BD.Size = new System.Drawing.Size(26, 23);
this.BD.TabIndex = 14;
this.BD.Text = "D";
this.BD.UseVisualStyleBackColor = true;
this.BD.Click += new System.EventHandler(this.Keypad_Click);
//
// BB
//
this.BB.Location = new System.Drawing.Point(91, 35);
this.BB.Name = "BB";
this.BB.Size = new System.Drawing.Size(26, 23);
this.BB.TabIndex = 12;
this.BB.Text = "B";
this.BB.UseVisualStyleBackColor = true;
this.BB.Click += new System.EventHandler(this.Keypad_Click);
//
// B9
//
this.B9.Location = new System.Drawing.Point(34, 35);
this.B9.Name = "B9";
this.B9.Size = new System.Drawing.Size(26, 23);
this.B9.TabIndex = 10;
this.B9.Text = "9";
this.B9.UseVisualStyleBackColor = true;
this.B9.Click += new System.EventHandler(this.Keypad_Click);
//
// B7
//
this.B7.Location = new System.Drawing.Point(206, 5);
this.B7.Name = "B7";
this.B7.Size = new System.Drawing.Size(26, 23);
this.B7.TabIndex = 8;
this.B7.Text = "7";
this.B7.UseVisualStyleBackColor = true;
this.B7.Click += new System.EventHandler(this.Keypad_Click);
//
// B5
//
this.B5.Location = new System.Drawing.Point(149, 6);
this.B5.Name = "B5";
this.B5.Size = new System.Drawing.Size(26, 23);
this.B5.TabIndex = 6;
this.B5.Text = "5";
this.B5.UseVisualStyleBackColor = true;
this.B5.Click += new System.EventHandler(this.Keypad_Click);
//
// B3
//
this.B3.Location = new System.Drawing.Point(91, 6);
this.B3.Name = "B3";
this.B3.Size = new System.Drawing.Size(26, 23);
this.B3.TabIndex = 4;
this.B3.Text = "3";
this.B3.UseVisualStyleBackColor = true;
this.B3.Click += new System.EventHandler(this.Keypad_Click);
//
// BE
//
this.BE.Location = new System.Drawing.Point(178, 35);
this.BE.Name = "BE";
this.BE.Size = new System.Drawing.Size(26, 23);
this.BE.TabIndex = 15;
this.BE.Text = "E";
this.BE.UseVisualStyleBackColor = true;
this.BE.Click += new System.EventHandler(this.Keypad_Click);
//
// B6
//
this.B6.Location = new System.Drawing.Point(178, 5);
this.B6.Name = "B6";
this.B6.Size = new System.Drawing.Size(26, 23);
this.B6.TabIndex = 7;
this.B6.Text = "6";
this.B6.UseVisualStyleBackColor = true;
this.B6.Click += new System.EventHandler(this.Keypad_Click);
//
// B1
//
this.B1.Location = new System.Drawing.Point(34, 6);
this.B1.Name = "B1";
this.B1.Size = new System.Drawing.Size(26, 23);
this.B1.TabIndex = 2;
this.B1.Text = "1";
this.B1.UseVisualStyleBackColor = true;
this.B1.Click += new System.EventHandler(this.Keypad_Click);
//
// BC
//
this.BC.Location = new System.Drawing.Point(121, 35);
this.BC.Name = "BC";
this.BC.Size = new System.Drawing.Size(26, 23);
this.BC.TabIndex = 13;
this.BC.Text = "C";
this.BC.UseVisualStyleBackColor = true;
this.BC.Click += new System.EventHandler(this.Keypad_Click);
//
// BA
//
this.BA.Location = new System.Drawing.Point(63, 35);
this.BA.Name = "BA";
this.BA.Size = new System.Drawing.Size(26, 23);
this.BA.TabIndex = 11;
this.BA.Text = "A";
this.BA.UseVisualStyleBackColor = true;
this.BA.Click += new System.EventHandler(this.Keypad_Click);
//
// B8
//
this.B8.Location = new System.Drawing.Point(6, 35);
this.B8.Name = "B8";
this.B8.Size = new System.Drawing.Size(26, 23);
this.B8.TabIndex = 9;
this.B8.Text = "8";
this.B8.UseVisualStyleBackColor = true;
this.B8.Click += new System.EventHandler(this.Keypad_Click);
//
// B4
//
this.B4.Location = new System.Drawing.Point(121, 6);
this.B4.Name = "B4";
this.B4.Size = new System.Drawing.Size(26, 23);
this.B4.TabIndex = 5;
this.B4.Text = "4";
this.B4.UseVisualStyleBackColor = true;
this.B4.Click += new System.EventHandler(this.Keypad_Click);
//
// B2
//
this.B2.Location = new System.Drawing.Point(63, 6);
this.B2.Name = "B2";
this.B2.Size = new System.Drawing.Size(26, 23);
this.B2.TabIndex = 3;
this.B2.Text = "2";
this.B2.UseVisualStyleBackColor = true;
this.B2.Click += new System.EventHandler(this.Keypad_Click);
//
// B0
//
this.B0.Location = new System.Drawing.Point(6, 5);
this.B0.Name = "B0";
this.B0.Size = new System.Drawing.Size(26, 23);
this.B0.TabIndex = 1;
this.B0.Text = "0";
this.B0.UseVisualStyleBackColor = true;
this.B0.Click += new System.EventHandler(this.Keypad_Click);
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.CompareBox);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.AddressBox);
this.groupBox1.Controls.Add(this.ValueBox);
this.groupBox1.Location = new System.Drawing.Point(155, 103);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(137, 82);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Decoded Value";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(87, 42);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(18, 13);
this.label2.TabIndex = 25;
this.label2.Text = "0x";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(8, 42);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(49, 13);
this.label5.TabIndex = 24;
this.label5.Text = "Compare";
//
// CompareBox
//
this.CompareBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.CompareBox.Location = new System.Drawing.Point(105, 38);
this.CompareBox.MaxLength = 2;
this.CompareBox.Name = "CompareBox";
this.CompareBox.Nullable = true;
this.CompareBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.CompareBox.Size = new System.Drawing.Size(27, 20);
this.CompareBox.TabIndex = 26;
this.CompareBox.TextChanged += new System.EventHandler(this.CompareBox_TextChanged);
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(87, 65);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(18, 13);
this.label6.TabIndex = 9;
this.label6.Text = "0x";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(57, 20);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(18, 13);
this.label4.TabIndex = 7;
this.label4.Text = "0x";
//
// ClearButton
//
this.ClearButton.Location = new System.Drawing.Point(31, 163);
this.ClearButton.Margin = new System.Windows.Forms.Padding(2);
this.ClearButton.Name = "ClearButton";
this.ClearButton.Size = new System.Drawing.Size(52, 26);
this.ClearButton.TabIndex = 32;
this.ClearButton.Text = "&Clear";
this.ClearButton.UseVisualStyleBackColor = true;
this.ClearButton.Click += new System.EventHandler(this.ClearButton_Click);
//
// menuStrip1
//
this.menuStrip1.ClickThrough = true;
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(322, 24);
this.menuStrip1.TabIndex = 8;
this.menuStrip1.Text = "menuStrip1";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.cheatname);
this.groupBox2.Location = new System.Drawing.Point(31, 197);
this.groupBox2.Margin = new System.Windows.Forms.Padding(2);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new System.Windows.Forms.Padding(2);
this.groupBox2.Size = new System.Drawing.Size(262, 50);
this.groupBox2.TabIndex = 24;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Cheat Title (Uses GG code if left empty)";
//
// cheatname
//
this.cheatname.Location = new System.Drawing.Point(18, 23);
this.cheatname.Margin = new System.Windows.Forms.Padding(2);
this.cheatname.Name = "cheatname";
this.cheatname.Size = new System.Drawing.Size(227, 20);
this.cheatname.TabIndex = 0;
//
// GBGameGenie
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(322, 252);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.ClearButton);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.ButtonPanel);
this.Controls.Add(this.addcheatbt);
this.Controls.Add(this.GameGenieCodeBox);
this.Controls.Add(this.menuStrip1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.MainMenuStrip = this.menuStrip1;
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(342, 294);
this.MinimumSize = new System.Drawing.Size(312, 294);
this.Name = "GBGameGenie";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Game Boy/Game Gear Game Genie Encoder / Decoder";
this.Load += new System.EventHandler(this.GBGameGenie_Load);
this.GameGenieCodeBox.ResumeLayout(false);
this.GameGenieCodeBox.PerformLayout();
this.ButtonPanel.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.GroupBox GameGenieCodeBox;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label1;
private HexTextBox ValueBox;
private HexTextBox AddressBox;
private System.Windows.Forms.Button addcheatbt;
private System.Windows.Forms.Panel ButtonPanel;
private System.Windows.Forms.Button B6;
private System.Windows.Forms.Button B4;
private System.Windows.Forms.Button B2;
private System.Windows.Forms.Button B0;
private System.Windows.Forms.Button BE;
private System.Windows.Forms.Button BC;
private System.Windows.Forms.Button BA;
private System.Windows.Forms.Button B8;
private System.Windows.Forms.Button BF;
private System.Windows.Forms.Button BD;
private System.Windows.Forms.Button BB;
private System.Windows.Forms.Button B9;
private System.Windows.Forms.Button B7;
private System.Windows.Forms.Button B5;
private System.Windows.Forms.Button B3;
private System.Windows.Forms.Button B1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button ClearButton;
private MenuStripEx menuStrip1;
private System.Windows.Forms.MaskedTextBox GGCodeMaskBox;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox cheatname;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label5;
private HexTextBox CompareBox;
}
}

View File

@ -1,489 +0,0 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk
{
[Tool(false, null)]
public partial class GBGameGenie : Form, IToolFormAutoConfig
{
// TODO: fix the use of Global.Game.System and Emulator.SystemId
[RequiredService]
private IEmulator Emulator { get; set; }
[RequiredService]
private IMemoryDomains MemoryDomains { get; set; }
private readonly Dictionary<char, int> _gameGenieTable = new Dictionary<char, int>();
private bool _processing;
public bool AskSaveChanges() => true;
public bool UpdateBefore => false;
public void Restart()
{
if ((Emulator.SystemId != "GB") && (Global.Game.System != "GG"))
{
Close();
}
}
public void NewUpdate(ToolFormUpdateType type) { }
public void UpdateValues()
{
if ((Emulator.SystemId != "GB") && (Global.Game.System != "GG"))
{
Close();
}
}
public void FastUpdate()
{
// Do nothing
}
public GBGameGenie()
{
InitializeComponent();
_gameGenieTable.Add('0', 0); // 0000
_gameGenieTable.Add('1', 1); // 0001
_gameGenieTable.Add('2', 2); // 0010
_gameGenieTable.Add('3', 3); // 0011
_gameGenieTable.Add('4', 4); // 0100
_gameGenieTable.Add('5', 5); // 0101
_gameGenieTable.Add('6', 6); // 0110
_gameGenieTable.Add('7', 7); // 0111
_gameGenieTable.Add('8', 8); // 1000
_gameGenieTable.Add('9', 9); // 1001
_gameGenieTable.Add('A', 10); // 1010
_gameGenieTable.Add('B', 11); // 1011
_gameGenieTable.Add('C', 12); // 1100
_gameGenieTable.Add('D', 13); // 1101
_gameGenieTable.Add('E', 14); // 1110
_gameGenieTable.Add('F', 15); // 1111
}
public void GBGGDecode(string code, ref int val, ref int add, ref int cmp)
{
// No cypher on value
// Char # | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
// Bit # |3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|
// maps to| Value |A|B|C|D|E|F|G|H|I|J|K|L|XOR 0xF|a|b|c|c|NotUsed|e|f|g|h|
// proper | Value |XOR 0xF|A|B|C|D|E|F|G|H|I|J|K|L|g|h|a|b|Nothing|c|d|e|f|
int x;
// Getting Value
if (code.Length > 0)
{
_gameGenieTable.TryGetValue(code[0], out x);
val = x << 4;
}
if (code.Length > 1)
{
_gameGenieTable.TryGetValue(code[1], out x);
val |= x;
}
// Address
if (code.Length > 2)
{
_gameGenieTable.TryGetValue(code[2], out x);
add = x << 8;
}
else
{
add = -1;
}
if (code.Length > 3)
{
_gameGenieTable.TryGetValue(code[3], out x);
add |= x << 4;
}
if (code.Length > 4)
{
_gameGenieTable.TryGetValue(code[4], out x);
add |= x;
}
if (code.Length > 5)
{
_gameGenieTable.TryGetValue(code[5], out x);
add |= (x ^ 0xF) << 12;
}
// compare need to be full
if (code.Length > 8)
{
int comp = 0;
_gameGenieTable.TryGetValue(code[6], out x);
comp = x << 2;
// 8th character ignored
_gameGenieTable.TryGetValue(code[8], out x);
comp |= (x & 0xC) >> 2;
comp |= (x & 0x3) << 6;
cmp = comp ^ 0xBA;
}
else
{
cmp = -1;
}
}
private string GbGgEncode(int val, int add, int cmp)
{
char[] letters = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
string code = "";
int[] num = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
num[0] = (val & 0xF0) >> 4;
num[1] = val & 0x0F;
num[2] = (add & 0x0F00) >> 8;
num[3] = (add & 0x00F0) >> 4;
num[4] = add & 0x000F;
num[5] = ((add & 0xF000) >> 12) ^ 0xF;
if (cmp > -1)
{
int xoredcomp = (cmp & 0xFF) ^ 0xBA;
num[6] = (xoredcomp & 0x30) >> 2;
num[6] |= (xoredcomp & 0x0C) >> 2;
// 8th char has no real use (its value is not reflected in the address:value:compare
// probably a protection to stop people making code up, xor the 7th digit with 0x8
// to get back what the original code had (Might be more to it)
num[7] = num[6] ^ 8;
num[8] = (xoredcomp & 0xC0) >> 6;
num[8] |= (xoredcomp & 0x03) << 2;
for (int i = 0; i < 9; i++)
{
code += letters[num[i]];
}
}
else
{
for (int i = 0; i < 6; i++)
{
code += letters[num[i]];
}
}
return code;
}
private void GBGameGenie_Load(object sender, EventArgs e)
{
addcheatbt.Enabled = false;
//"Game Boy/Game Gear Game Genie Encoder / Decoder"
Text = Emulator.SystemId == "GB"
? "Game Boy Game Genie Encoder/Decoder"
: "Game Gear Game Genie Encoder/Decoder";
}
#region Dialog and Control Events
private void AddCheatClick(object sender, EventArgs e)
{
if ((Emulator.SystemId == "GB") || (Global.Game.System == "GG"))
{
string name;
var address = 0;
var value = 0;
int? compare = null;
if (!string.IsNullOrWhiteSpace(cheatname.Text))
{
name = cheatname.Text;
}
else
{
_processing = true;
GGCodeMaskBox.TextMaskFormat = MaskFormat.IncludeLiterals;
name = GGCodeMaskBox.Text;
GGCodeMaskBox.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;
_processing = false;
}
if (!string.IsNullOrWhiteSpace(AddressBox.Text))
{
address = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
}
if (!string.IsNullOrWhiteSpace(ValueBox.Text))
{
value = (byte)int.Parse(ValueBox.Text, NumberStyles.HexNumber);
}
if (!string.IsNullOrWhiteSpace(CompareBox.Text))
{
try
{
compare = byte.Parse(CompareBox.Text, NumberStyles.HexNumber);
}
catch
{
compare = null;
}
}
var watch = Watch.GenerateWatch(
MemoryDomains["System Bus"],
address,
WatchSize.Byte,
Client.Common.DisplayType.Hex,
false,
name);
Global.CheatList.Add(new Cheat(
watch,
value,
compare));
}
}
private void ClearButton_Click(object sender, EventArgs e)
{
AddressBox.Text = "";
ValueBox.Text = "";
CompareBox.Text = "";
GGCodeMaskBox.Text = "";
addcheatbt.Enabled = false;
}
private void CompareBox_TextChanged(object sender, EventArgs e)
{
if (_processing == false)
{
_processing = true;
// remove invalid character when pasted
if (Regex.IsMatch(CompareBox.Text, @"[^a-fA-F0-9]"))
{
CompareBox.Text = Regex.Replace(CompareBox.Text, @"[^a-fA-F0-9]", "");
}
if ((CompareBox.Text.Length == 2) || (CompareBox.Text.Length == 0))
{
if ((AddressBox.Text.Length > 0) || (ValueBox.Text.Length > 0))
{
int val = 0;
int add = 0;
int cmp = -1;
if (ValueBox.Text.Length > 0)
{
val = int.Parse(ValueBox.Text, NumberStyles.HexNumber);
}
if (AddressBox.Text.Length > 0)
{
add = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
}
if (CompareBox.Text.Length == 2)
{
cmp = int.Parse(CompareBox.Text, NumberStyles.HexNumber);
}
GGCodeMaskBox.Text = GbGgEncode(val, add, cmp);
addcheatbt.Enabled = true;
}
else
{
GGCodeMaskBox.Text = "";
addcheatbt.Enabled = false;
}
}
_processing = false;
}
}
private void ValueBox_TextChanged(object sender, EventArgs e)
{
if (_processing == false)
{
_processing = true;
// remove invalid character when pasted
if (Regex.IsMatch(ValueBox.Text, @"[^a-fA-F0-9]"))
{
ValueBox.Text = Regex.Replace(ValueBox.Text, @"[^a-fA-F0-9]", "");
}
if ((AddressBox.Text.Length > 0) || (ValueBox.Text.Length > 0))
{
var val = 0;
var add = 0;
var cmp = -1;
if (ValueBox.Text.Length > 0)
{
val = int.Parse(ValueBox.Text, NumberStyles.HexNumber);
}
if (AddressBox.Text.Length > 0)
{
add = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
}
if (CompareBox.Text.Length == 2)
{
cmp = int.Parse(CompareBox.Text, NumberStyles.HexNumber);
}
GGCodeMaskBox.Text = GbGgEncode(val, add, cmp);
addcheatbt.Enabled = true;
}
else
{
GGCodeMaskBox.Text = "";
addcheatbt.Enabled = false;
}
_processing = false;
}
}
private void AddressBox_TextChanged(object sender, EventArgs e)
{
// remove invalid character when pasted
if (_processing == false)
{
_processing = true;
if (Regex.IsMatch(AddressBox.Text, @"[^a-fA-F0-9]"))
{
AddressBox.Text = Regex.Replace(AddressBox.Text, @"[^a-fA-F0-9]", "");
}
if ((AddressBox.Text.Length > 0) || (ValueBox.Text.Length > 0))
{
var val = 0;
var add = 0;
var cmp = -1;
if (ValueBox.Text.Length > 0)
{
val = int.Parse(ValueBox.Text, NumberStyles.HexNumber);
}
if (AddressBox.Text.Length > 0)
{
add = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
}
if (CompareBox.Text.Length == 2)
{
cmp = int.Parse(CompareBox.Text, NumberStyles.HexNumber);
}
GGCodeMaskBox.Text = GbGgEncode(val, add, cmp);
addcheatbt.Enabled = true;
}
else
{
GGCodeMaskBox.Text = "";
addcheatbt.Enabled = false;
}
_processing = false;
}
}
private void Keypad_Click(object sender, EventArgs e)
{
if (GGCodeMaskBox.Text.Length < 9)
{
var code = "";
if (sender == B0) { code = "0"; }
else if (sender == B1) { code = "1"; }
else if (sender == B2) { code = "2"; }
else if (sender == B3) { code = "3"; }
else if (sender == B4) { code = "4"; }
else if (sender == B5) { code = "5"; }
else if (sender == B6) { code = "6"; }
else if (sender == B7) { code = "7"; }
else if (sender == B8) { code = "8"; }
else if (sender == B9) { code = "9"; }
else if (sender == BA) { code = "A"; }
else if (sender == BB) { code = "B"; }
else if (sender == BC) { code = "C"; }
else if (sender == BD) { code = "D"; }
else if (sender == BE) { code = "E"; }
else if (sender == BF) { code = "F"; }
GGCodeMaskBox.Text += code;
}
}
private void GGCodeMaskBox_KeyPress(object sender, KeyPressEventArgs e)
{
// Find a better way to remove all NON HEX char, while still allowing copy/paste
// Right now its all done through removing em GGCodeMaskBox_TextChanged
}
private void GGCodeMaskBox_TextChanged(object sender, EventArgs e)
{
if (_processing == false)
{
_processing = true;
// insert REGEX Remove non HEXA char
if (Regex.IsMatch(GGCodeMaskBox.Text, @"[^a-fA-F0-9]"))
{
GGCodeMaskBox.Text = Regex.Replace(GGCodeMaskBox.Text, @"[^a-fA-F0-9]", "");
}
if (GGCodeMaskBox.Text.Length > 0)
{
var val = -1;
var add = -1;
var cmp = -1;
GBGGDecode(GGCodeMaskBox.Text, ref val, ref add, ref cmp);
if (add > -1)
{
AddressBox.Text = $"{add:X4}";
}
if (val > -1)
{
ValueBox.Text = $"{val:X2}";
}
if (cmp > -1)
{
CompareBox.Text = $"{cmp:X2}";
}
else
{
CompareBox.Text = "";
}
addcheatbt.Enabled = true;
}
else
{
AddressBox.Text = "";
ValueBox.Text = "";
CompareBox.Text = "";
addcheatbt.Enabled = false;
}
_processing = false;
}
}
#endregion
}
}

View File

@ -1,123 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -53,7 +53,7 @@
this.btnClear.TabIndex = 4;
this.btnClear.Text = "Clear";
this.btnClear.UseVisualStyleBackColor = true;
this.btnClear.Click += new System.EventHandler(this.btnClear_Click);
this.btnClear.Click += new System.EventHandler(this.BtnClear_Click);
//
// lblCheat
//
@ -85,7 +85,7 @@
this.btnGo.TabIndex = 5;
this.btnGo.Text = "Convert";
this.btnGo.UseVisualStyleBackColor = true;
this.btnGo.Click += new System.EventHandler(this.btnGo_Click);
this.btnGo.Click += new System.EventHandler(this.Go_Click);
//
// lblDescription
//
@ -124,10 +124,8 @@
this.Name = "GameShark";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Cheat Code Converter";
this.Load += new System.EventHandler(this.GameShark_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion

File diff suppressed because it is too large Load Diff

View File

@ -1,260 +0,0 @@
namespace BizHawk.Client.EmuHawk
{
partial class GenGameGenie
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.menuStrip1 = new MenuStripEx();
this.GGCodeMaskBox = new System.Windows.Forms.MaskedTextBox();
this.AddCheatButton = new System.Windows.Forms.Button();
this.GameGenieCodeBox = new System.Windows.Forms.GroupBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.ValueBox = new BizHawk.Client.EmuHawk.HexTextBox();
this.AddressBox = new BizHawk.Client.EmuHawk.HexTextBox();
this.label6 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.ClearButton = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.cheatname = new System.Windows.Forms.TextBox();
this.GameGenieCodeBox.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.ClickThrough = true;
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(292, 24);
this.menuStrip1.TabIndex = 8;
this.menuStrip1.Text = "menuStrip1";
//
// GGCodeMaskBox
//
this.GGCodeMaskBox.Location = new System.Drawing.Point(18, 30);
this.GGCodeMaskBox.Margin = new System.Windows.Forms.Padding(2);
this.GGCodeMaskBox.Mask = ">AAAA-AAAA";
this.GGCodeMaskBox.Name = "GGCodeMaskBox";
this.GGCodeMaskBox.Size = new System.Drawing.Size(76, 20);
this.GGCodeMaskBox.TabIndex = 9;
this.GGCodeMaskBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.GGCodeMaskBox.TextMaskFormat = System.Windows.Forms.MaskFormat.ExcludePromptAndLiterals;
this.GGCodeMaskBox.TextChanged += new System.EventHandler(this.GGCodeMaskBox_TextChanged);
this.GGCodeMaskBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.GGCodeMaskBox_KeyPress);
//
// AddCheatButton
//
this.AddCheatButton.Enabled = false;
this.AddCheatButton.Location = new System.Drawing.Point(156, 117);
this.AddCheatButton.Margin = new System.Windows.Forms.Padding(2);
this.AddCheatButton.Name = "AddCheatButton";
this.AddCheatButton.Size = new System.Drawing.Size(72, 26);
this.AddCheatButton.TabIndex = 10;
this.AddCheatButton.Text = "&Add Cheat";
this.AddCheatButton.UseVisualStyleBackColor = true;
this.AddCheatButton.Click += new System.EventHandler(this.AddCheatButton_Click);
//
// GameGenieCodeBox
//
this.GameGenieCodeBox.Controls.Add(this.GGCodeMaskBox);
this.GameGenieCodeBox.Location = new System.Drawing.Point(20, 35);
this.GameGenieCodeBox.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
this.GameGenieCodeBox.Name = "GameGenieCodeBox";
this.GameGenieCodeBox.Padding = new System.Windows.Forms.Padding(4, 2, 4, 2);
this.GameGenieCodeBox.Size = new System.Drawing.Size(116, 69);
this.GameGenieCodeBox.TabIndex = 11;
this.GameGenieCodeBox.TabStop = false;
this.GameGenieCodeBox.Text = "Game Genie Code";
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.groupBox1.Controls.Add(this.ValueBox);
this.groupBox1.Controls.Add(this.AddressBox);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Location = new System.Drawing.Point(156, 35);
this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 2, 4, 2);
this.groupBox1.Size = new System.Drawing.Size(136, 69);
this.groupBox1.TabIndex = 12;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Decoded Value";
//
// ValueBox
//
this.ValueBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.ValueBox.Location = new System.Drawing.Point(92, 43);
this.ValueBox.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
this.ValueBox.MaxLength = 4;
this.ValueBox.Name = "ValueBox";
this.ValueBox.Nullable = true;
this.ValueBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.ValueBox.Size = new System.Drawing.Size(40, 20);
this.ValueBox.TabIndex = 23;
this.ValueBox.TextChanged += new System.EventHandler(this.ValueBox_TextChanged);
//
// AddressBox
//
this.AddressBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.AddressBox.Location = new System.Drawing.Point(72, 20);
this.AddressBox.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
this.AddressBox.MaxLength = 6;
this.AddressBox.Name = "AddressBox";
this.AddressBox.Nullable = true;
this.AddressBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.AddressBox.Size = new System.Drawing.Size(60, 20);
this.AddressBox.TabIndex = 22;
this.AddressBox.TextChanged += new System.EventHandler(this.AddressBox_TextChanged);
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(68, 46);
this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(18, 13);
this.label6.TabIndex = 9;
this.label6.Text = "0x";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(52, 24);
this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(18, 13);
this.label4.TabIndex = 7;
this.label4.Text = "0x";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(8, 46);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(34, 13);
this.label3.TabIndex = 5;
this.label3.Text = "Value";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(8, 24);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(45, 13);
this.label1.TabIndex = 3;
this.label1.Text = "Address";
//
// ClearButton
//
this.ClearButton.Location = new System.Drawing.Point(66, 117);
this.ClearButton.Margin = new System.Windows.Forms.Padding(2);
this.ClearButton.Name = "ClearButton";
this.ClearButton.Size = new System.Drawing.Size(68, 26);
this.ClearButton.TabIndex = 13;
this.ClearButton.Text = "&Clear";
this.ClearButton.UseVisualStyleBackColor = true;
this.ClearButton.Click += new System.EventHandler(this.ClearButton_Click);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.cheatname);
this.groupBox2.Location = new System.Drawing.Point(20, 154);
this.groupBox2.Margin = new System.Windows.Forms.Padding(2);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new System.Windows.Forms.Padding(2);
this.groupBox2.Size = new System.Drawing.Size(266, 50);
this.groupBox2.TabIndex = 14;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Cheat Title (Uses GG code if left empty)";
//
// cheatname
//
this.cheatname.Location = new System.Drawing.Point(18, 24);
this.cheatname.Margin = new System.Windows.Forms.Padding(2);
this.cheatname.Name = "cheatname";
this.cheatname.Size = new System.Drawing.Size(228, 20);
this.cheatname.TabIndex = 0;
//
// GenGameGenie
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 218);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.ClearButton);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.GameGenieCodeBox);
this.Controls.Add(this.AddCheatButton);
this.Controls.Add(this.menuStrip1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.MainMenuStrip = this.menuStrip1;
this.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(312, 293);
this.MinimumSize = new System.Drawing.Size(312, 250);
this.Name = "GenGameGenie";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Genesis Game Genie Encoder / Decoder";
this.GameGenieCodeBox.ResumeLayout(false);
this.GameGenieCodeBox.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private MenuStripEx menuStrip1;
private System.Windows.Forms.MaskedTextBox GGCodeMaskBox;
private System.Windows.Forms.Button AddCheatButton;
private System.Windows.Forms.GroupBox GameGenieCodeBox;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button ClearButton;
private HexTextBox ValueBox;
private HexTextBox AddressBox;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox cheatname;
}
}

View File

@ -1,328 +0,0 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Client.Common;
using BizHawk.Emulation.Cores.Consoles.Sega.gpgx;
namespace BizHawk.Client.EmuHawk
{
[Tool(false, null)]
public partial class GenGameGenie : Form, IToolFormAutoConfig
{
#pragma warning disable 675
/// <summary>
/// For now this is is an unnecessary restriction to make sure it doesn't show up as available for non-genesis cores
/// Note: this unnecessarily prevents it from being on the Genesis core, but that's okay it isn't released
/// Eventually we want a generic game genie tool and a hack like this won't be necessary
/// </summary>
[RequiredService]
private GPGX Emulator { get; set; }
[RequiredService]
private IMemoryDomains MemoryDomains { get; set; }
private readonly Dictionary<char, int> _gameGenieTable = new Dictionary<char, int>
{
['A'] = 0,
['B'] = 1,
['C'] = 2,
['D'] = 3,
['E'] = 4,
['F'] = 5,
['G'] = 6,
['H'] = 7,
['J'] = 8,
['K'] = 9,
['L'] = 10,
['M'] = 11,
['N'] = 12,
['P'] = 13,
['R'] = 14,
['S'] = 15,
['T'] = 16,
['V'] = 17,
['W'] = 18,
['X'] = 19,
['Y'] = 20,
['Z'] = 21,
['0'] = 22,
['1'] = 23,
['2'] = 24,
['3'] = 25,
['4'] = 26,
['5'] = 27,
['6'] = 28,
['7'] = 29,
['8'] = 30,
['9'] = 31
};
private bool _processing;
#region Public API
public bool AskSaveChanges() => true;
public bool UpdateBefore => false;
public void Restart()
{
if (Emulator.SystemId != "GEN")
{
Close();
}
}
public void NewUpdate(ToolFormUpdateType type) { }
public void UpdateValues()
{
if (Emulator.SystemId != "GEN")
{
Close();
}
}
public void FastUpdate()
{
// Do nothing
}
public GenGameGenie()
{
InitializeComponent();
}
#endregion
// code is code to be converted, val is pointer to value, add is pointer to address
private void GenGGDecode(string code, ref int val, ref int add)
{
long hexCode = 0;
// convert code to a long binary string
foreach (var t in code)
{
hexCode <<= 5;
_gameGenieTable.TryGetValue(t, out var y);
hexCode |= y;
}
long decoded = (hexCode & 0xFF00000000) >> 32;
decoded |= hexCode & 0x00FF000000;
decoded |= (hexCode & 0x0000FF0000) << 16;
decoded |= (hexCode & 0x00000000700) << 5;
decoded |= (hexCode & 0x000000F800) >> 3;
decoded |= (hexCode & 0x00000000FF) << 16;
val = (int)(decoded & 0x000000FFFF);
add = (int)((decoded & 0xFFFFFF0000) >> 16);
}
private static string GenGGEncode(int val, int add)
{
string code = null;
var encoded = (long)(val & 0x00FF) << 32;
encoded |= (val & 0xE000) >> 5;
encoded |= (val & 0x1F00) << 3;
encoded |= add & 0xFF0000;
encoded |= (add & 0x00FF00) << 16;
encoded |= add & 0x0000FF;
char[] letters = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'S', 'T', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
for (var i = 0; i < 8; i++)
{
var chr = (int)(encoded & 0x1F);
code += letters[chr];
encoded >>= 5;
}
// reverse string, as its build backward
var array = code.ToCharArray();
Array.Reverse(array);
return new string(array);
}
#region Dialog and Control Events
private void GGCodeMaskBox_KeyPress(object sender, KeyPressEventArgs e)
{
// ignore I O Q U
if ((e.KeyChar == 73) || (e.KeyChar == 79) || (e.KeyChar == 81) || (e.KeyChar == 85) ||
(e.KeyChar == 105) || (e.KeyChar == 111) || (e.KeyChar == 113) || (e.KeyChar == 117))
{
e.KeyChar = '\n';
}
}
private void GGCodeMaskBox_TextChanged(object sender, EventArgs e)
{
if (_processing == false)
{
_processing = true;
// remove Invalid I O Q P if pasted
GGCodeMaskBox.Text = GGCodeMaskBox.Text.Replace("I", "");
GGCodeMaskBox.Text = GGCodeMaskBox.Text.Replace("O", "");
GGCodeMaskBox.Text = GGCodeMaskBox.Text.Replace("Q", "");
GGCodeMaskBox.Text = GGCodeMaskBox.Text.Replace("U", "");
if (GGCodeMaskBox.Text.Length > 0)
{
int val = 0;
int add = 0;
GenGGDecode(GGCodeMaskBox.Text, ref val, ref add);
AddressBox.Text = $"{add:X6}";
ValueBox.Text = $"{val:X4}";
AddCheatButton.Enabled = true;
}
else
{
AddressBox.Text = "";
ValueBox.Text = "";
AddCheatButton.Enabled = false;
}
_processing = false;
}
}
private void AddressBox_TextChanged(object sender, EventArgs e)
{
// remove invalid character when pasted
if (_processing == false)
{
_processing = true;
if (Regex.IsMatch(AddressBox.Text, @"[^a-fA-F0-9]"))
{
AddressBox.Text = Regex.Replace(AddressBox.Text, @"[^a-fA-F0-9]", "");
}
if ((AddressBox.Text.Length > 0) || (ValueBox.Text.Length > 0))
{
int val = 0;
int add = 0;
if (ValueBox.Text.Length > 0)
{
val = int.Parse(ValueBox.Text, NumberStyles.HexNumber);
}
if (AddressBox.Text.Length > 0)
{
add = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
}
GGCodeMaskBox.Text = GenGGEncode(val, add);
AddCheatButton.Enabled = true;
}
else
{
GGCodeMaskBox.Text = "";
AddCheatButton.Enabled = false;
}
_processing = false;
}
}
private void ValueBox_TextChanged(object sender, EventArgs e)
{
if (_processing == false)
{
_processing = true;
// remove invalid character when pasted
if (Regex.IsMatch(ValueBox.Text, @"[^a-fA-F0-9]"))
{
ValueBox.Text = Regex.Replace(ValueBox.Text, @"[^a-fA-F0-9]", "");
}
if ((AddressBox.Text.Length > 0) || (ValueBox.Text.Length > 0))
{
int val = 0;
int add = 0;
if (ValueBox.Text.Length > 0)
{
val = int.Parse(ValueBox.Text, NumberStyles.HexNumber);
}
if (AddressBox.Text.Length > 0)
{
add = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
}
GGCodeMaskBox.Text = GenGGEncode(val, add);
AddCheatButton.Enabled = true;
}
else
{
GGCodeMaskBox.Text = "";
AddCheatButton.Enabled = false;
}
_processing = false;
}
}
private void ClearButton_Click(object sender, EventArgs e)
{
AddressBox.Text = "";
ValueBox.Text = "";
GGCodeMaskBox.Text = "";
AddCheatButton.Enabled = false;
}
private void AddCheatButton_Click(object sender, EventArgs e)
{
string name;
var address = 0;
var value = 0;
if (!string.IsNullOrWhiteSpace(cheatname.Text))
{
name = cheatname.Text;
}
else
{
_processing = true;
GGCodeMaskBox.TextMaskFormat = MaskFormat.IncludeLiterals;
name = GGCodeMaskBox.Text;
GGCodeMaskBox.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;
_processing = false;
}
if (!string.IsNullOrWhiteSpace(AddressBox.Text))
{
address = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
}
if (!string.IsNullOrWhiteSpace(ValueBox.Text))
{
value = ValueBox.ToRawInt() ?? 0;
}
var watch = Watch.GenerateWatch(
MemoryDomains["M68K BUS"],
address,
WatchSize.Word,
Common.DisplayType.Hex,
true,
name
);
Global.CheatList.Add(new Cheat(
watch,
value
));
}
#endregion
}
}

View File

@ -1,123 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -1,500 +0,0 @@
namespace BizHawk.Client.EmuHawk
{
partial class NESGameGenie
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.GameGenieCode = new System.Windows.Forms.TextBox();
this.GameGenieCodeBox = new System.Windows.Forms.GroupBox();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.CompareBox = new BizHawk.Client.EmuHawk.HexTextBox();
this.ValueBox = new BizHawk.Client.EmuHawk.HexTextBox();
this.AddressBox = new BizHawk.Client.EmuHawk.HexTextBox();
this.AddCheat = new System.Windows.Forms.Button();
this.ButtonPanel = new System.Windows.Forms.Panel();
this.N = new System.Windows.Forms.Button();
this.V = new System.Windows.Forms.Button();
this.S = new System.Windows.Forms.Button();
this.K = new System.Windows.Forms.Button();
this.U = new System.Windows.Forms.Button();
this.X = new System.Windows.Forms.Button();
this.O = new System.Windows.Forms.Button();
this.Y = new System.Windows.Forms.Button();
this.L = new System.Windows.Forms.Button();
this.E = new System.Windows.Forms.Button();
this.T = new System.Windows.Forms.Button();
this.I = new System.Windows.Forms.Button();
this.G = new System.Windows.Forms.Button();
this.Z = new System.Windows.Forms.Button();
this.P = new System.Windows.Forms.Button();
this.A = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.Encoding = new System.Windows.Forms.CheckBox();
this.ClearButton = new System.Windows.Forms.Button();
this.MenuStrip = new MenuStripEx();
this.GameGenieCodeBox.SuspendLayout();
this.ButtonPanel.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// GameGenieCode
//
this.GameGenieCode.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.GameGenieCode.Location = new System.Drawing.Point(6, 19);
this.GameGenieCode.MaxLength = 8;
this.GameGenieCode.Name = "GameGenieCode";
this.GameGenieCode.Size = new System.Drawing.Size(102, 20);
this.GameGenieCode.TabIndex = 20;
this.GameGenieCode.TextChanged += new System.EventHandler(this.GameGenieCode_TextChanged);
this.GameGenieCode.KeyDown += new System.Windows.Forms.KeyEventHandler(this.GameGenieCode_KeyDown);
this.GameGenieCode.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.GameGenieCode_KeyPress);
//
// GameGenieCodeBox
//
this.GameGenieCodeBox.Controls.Add(this.GameGenieCode);
this.GameGenieCodeBox.Location = new System.Drawing.Point(31, 103);
this.GameGenieCodeBox.Name = "GameGenieCodeBox";
this.GameGenieCodeBox.Size = new System.Drawing.Size(119, 54);
this.GameGenieCodeBox.TabIndex = 1;
this.GameGenieCodeBox.TabStop = false;
this.GameGenieCodeBox.Text = "Game Genie Code";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(8, 68);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(34, 13);
this.label3.TabIndex = 5;
this.label3.Text = "Value";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(8, 42);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(49, 13);
this.label2.TabIndex = 4;
this.label2.Text = "Compare";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(8, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(45, 13);
this.label1.TabIndex = 3;
this.label1.Text = "Address";
//
// CompareBox
//
this.CompareBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.CompareBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.CompareBox.Location = new System.Drawing.Point(88, 39);
this.CompareBox.MaxLength = 2;
this.CompareBox.Name = "CompareBox";
this.CompareBox.Nullable = true;
this.CompareBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.CompareBox.Size = new System.Drawing.Size(20, 20);
this.CompareBox.TabIndex = 22;
this.CompareBox.TextChanged += new System.EventHandler(this.CompareBox_TextChanged);
//
// ValueBox
//
this.ValueBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.ValueBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.ValueBox.Location = new System.Drawing.Point(88, 65);
this.ValueBox.MaxLength = 2;
this.ValueBox.Name = "ValueBox";
this.ValueBox.Nullable = true;
this.ValueBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.ValueBox.Size = new System.Drawing.Size(20, 20);
this.ValueBox.TabIndex = 23;
this.ValueBox.TextChanged += new System.EventHandler(this.ValueBox_TextChanged);
//
// AddressBox
//
this.AddressBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.AddressBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.AddressBox.Location = new System.Drawing.Point(76, 13);
this.AddressBox.MaxLength = 4;
this.AddressBox.Name = "AddressBox";
this.AddressBox.Nullable = true;
this.AddressBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.AddressBox.Size = new System.Drawing.Size(32, 20);
this.AddressBox.TabIndex = 21;
this.AddressBox.TextChanged += new System.EventHandler(this.AddressBox_TextChanged);
//
// AddCheat
//
this.AddCheat.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.AddCheat.Location = new System.Drawing.Point(212, 230);
this.AddCheat.Name = "AddCheat";
this.AddCheat.Size = new System.Drawing.Size(69, 21);
this.AddCheat.TabIndex = 33;
this.AddCheat.Text = "&Add Cheat";
this.AddCheat.UseVisualStyleBackColor = true;
this.AddCheat.Click += new System.EventHandler(this.AddCheat_Click);
//
// ButtonPanel
//
this.ButtonPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.ButtonPanel.Controls.Add(this.N);
this.ButtonPanel.Controls.Add(this.V);
this.ButtonPanel.Controls.Add(this.S);
this.ButtonPanel.Controls.Add(this.K);
this.ButtonPanel.Controls.Add(this.U);
this.ButtonPanel.Controls.Add(this.X);
this.ButtonPanel.Controls.Add(this.O);
this.ButtonPanel.Controls.Add(this.Y);
this.ButtonPanel.Controls.Add(this.L);
this.ButtonPanel.Controls.Add(this.E);
this.ButtonPanel.Controls.Add(this.T);
this.ButtonPanel.Controls.Add(this.I);
this.ButtonPanel.Controls.Add(this.G);
this.ButtonPanel.Controls.Add(this.Z);
this.ButtonPanel.Controls.Add(this.P);
this.ButtonPanel.Controls.Add(this.A);
this.ButtonPanel.Location = new System.Drawing.Point(31, 30);
this.ButtonPanel.Name = "ButtonPanel";
this.ButtonPanel.Size = new System.Drawing.Size(240, 67);
this.ButtonPanel.TabIndex = 4;
//
// N
//
this.N.Location = new System.Drawing.Point(206, 35);
this.N.Name = "N";
this.N.Size = new System.Drawing.Size(26, 23);
this.N.TabIndex = 16;
this.N.Text = "N";
this.N.UseVisualStyleBackColor = true;
this.N.Click += new System.EventHandler(this.Keypad_Click);
//
// V
//
this.V.Location = new System.Drawing.Point(149, 35);
this.V.Name = "V";
this.V.Size = new System.Drawing.Size(26, 23);
this.V.TabIndex = 14;
this.V.Text = "V";
this.V.UseVisualStyleBackColor = true;
this.V.Click += new System.EventHandler(this.Keypad_Click);
//
// S
//
this.S.Location = new System.Drawing.Point(91, 35);
this.S.Name = "S";
this.S.Size = new System.Drawing.Size(26, 23);
this.S.TabIndex = 12;
this.S.Text = "S";
this.S.UseVisualStyleBackColor = true;
this.S.Click += new System.EventHandler(this.Keypad_Click);
//
// K
//
this.K.Location = new System.Drawing.Point(34, 35);
this.K.Name = "K";
this.K.Size = new System.Drawing.Size(26, 23);
this.K.TabIndex = 10;
this.K.Text = "K";
this.K.UseVisualStyleBackColor = true;
this.K.Click += new System.EventHandler(this.Keypad_Click);
//
// U
//
this.U.Location = new System.Drawing.Point(206, 5);
this.U.Name = "U";
this.U.Size = new System.Drawing.Size(26, 23);
this.U.TabIndex = 8;
this.U.Text = "U";
this.U.UseVisualStyleBackColor = true;
this.U.Click += new System.EventHandler(this.Keypad_Click);
//
// X
//
this.X.Location = new System.Drawing.Point(149, 6);
this.X.Name = "X";
this.X.Size = new System.Drawing.Size(26, 23);
this.X.TabIndex = 6;
this.X.Text = "X";
this.X.UseVisualStyleBackColor = true;
this.X.Click += new System.EventHandler(this.Keypad_Click);
//
// O
//
this.O.Location = new System.Drawing.Point(91, 6);
this.O.Name = "O";
this.O.Size = new System.Drawing.Size(26, 23);
this.O.TabIndex = 4;
this.O.Text = "O";
this.O.UseVisualStyleBackColor = true;
this.O.Click += new System.EventHandler(this.Keypad_Click);
//
// Y
//
this.Y.Location = new System.Drawing.Point(178, 35);
this.Y.Name = "Y";
this.Y.Size = new System.Drawing.Size(26, 23);
this.Y.TabIndex = 15;
this.Y.Text = "Y";
this.Y.UseVisualStyleBackColor = true;
this.Y.Click += new System.EventHandler(this.Keypad_Click);
//
// L
//
this.L.Location = new System.Drawing.Point(178, 5);
this.L.Name = "L";
this.L.Size = new System.Drawing.Size(26, 23);
this.L.TabIndex = 7;
this.L.Text = "L";
this.L.UseVisualStyleBackColor = true;
this.L.Click += new System.EventHandler(this.Keypad_Click);
//
// E
//
this.E.Location = new System.Drawing.Point(34, 6);
this.E.Name = "E";
this.E.Size = new System.Drawing.Size(26, 23);
this.E.TabIndex = 2;
this.E.Text = "E";
this.E.UseVisualStyleBackColor = true;
this.E.Click += new System.EventHandler(this.Keypad_Click);
//
// T
//
this.T.Location = new System.Drawing.Point(121, 35);
this.T.Name = "T";
this.T.Size = new System.Drawing.Size(26, 23);
this.T.TabIndex = 13;
this.T.Text = "T";
this.T.UseVisualStyleBackColor = true;
this.T.Click += new System.EventHandler(this.Keypad_Click);
//
// I
//
this.I.Location = new System.Drawing.Point(63, 35);
this.I.Name = "I";
this.I.Size = new System.Drawing.Size(26, 23);
this.I.TabIndex = 11;
this.I.Text = "I";
this.I.UseVisualStyleBackColor = true;
this.I.Click += new System.EventHandler(this.Keypad_Click);
//
// G
//
this.G.Location = new System.Drawing.Point(6, 35);
this.G.Name = "G";
this.G.Size = new System.Drawing.Size(26, 23);
this.G.TabIndex = 9;
this.G.Text = "G";
this.G.UseVisualStyleBackColor = true;
this.G.Click += new System.EventHandler(this.Keypad_Click);
//
// Z
//
this.Z.Location = new System.Drawing.Point(121, 6);
this.Z.Name = "Z";
this.Z.Size = new System.Drawing.Size(26, 23);
this.Z.TabIndex = 5;
this.Z.Text = "Z";
this.Z.UseVisualStyleBackColor = true;
this.Z.Click += new System.EventHandler(this.Keypad_Click);
//
// P
//
this.P.Location = new System.Drawing.Point(63, 6);
this.P.Name = "P";
this.P.Size = new System.Drawing.Size(26, 23);
this.P.TabIndex = 3;
this.P.Text = "P";
this.P.UseVisualStyleBackColor = true;
this.P.Click += new System.EventHandler(this.Keypad_Click);
//
// A
//
this.A.Location = new System.Drawing.Point(6, 5);
this.A.Name = "A";
this.A.Size = new System.Drawing.Size(26, 23);
this.A.TabIndex = 1;
this.A.Text = "A";
this.A.UseVisualStyleBackColor = true;
this.A.Click += new System.EventHandler(this.Keypad_Click);
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.AddressBox);
this.groupBox1.Controls.Add(this.ValueBox);
this.groupBox1.Controls.Add(this.CompareBox);
this.groupBox1.Location = new System.Drawing.Point(31, 158);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(119, 93);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
//
// label6
//
this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(70, 69);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(18, 13);
this.label6.TabIndex = 9;
this.label6.Text = "0x";
//
// label5
//
this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(70, 42);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(18, 13);
this.label5.TabIndex = 8;
this.label5.Text = "0x";
//
// label4
//
this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(58, 16);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(18, 13);
this.label4.TabIndex = 7;
this.label4.Text = "0x";
//
// Encoding
//
this.Encoding.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.Encoding.Appearance = System.Windows.Forms.Appearance.Button;
this.Encoding.AutoSize = true;
this.Encoding.Location = new System.Drawing.Point(227, 119);
this.Encoding.Name = "Encoding";
this.Encoding.Size = new System.Drawing.Size(54, 23);
this.Encoding.TabIndex = 31;
this.Encoding.Text = "Encode";
this.Encoding.UseVisualStyleBackColor = true;
//
// ClearButton
//
this.ClearButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.ClearButton.Location = new System.Drawing.Point(227, 148);
this.ClearButton.Name = "ClearButton";
this.ClearButton.Size = new System.Drawing.Size(54, 23);
this.ClearButton.TabIndex = 32;
this.ClearButton.Text = "&Clear";
this.ClearButton.UseVisualStyleBackColor = true;
this.ClearButton.Click += new System.EventHandler(this.ClearButton_Click);
//
// MenuStrip
//
this.MenuStrip.ClickThrough = true;
this.MenuStrip.Location = new System.Drawing.Point(0, 0);
this.MenuStrip.Name = "MenuStrip";
this.MenuStrip.Size = new System.Drawing.Size(302, 24);
this.MenuStrip.TabIndex = 8;
this.MenuStrip.Text = "menuStrip1";
//
// NESGameGenie
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(302, 260);
this.Controls.Add(this.ClearButton);
this.Controls.Add(this.Encoding);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.ButtonPanel);
this.Controls.Add(this.AddCheat);
this.Controls.Add(this.GameGenieCodeBox);
this.Controls.Add(this.MenuStrip);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.Icon = global::BizHawk.Client.EmuHawk.Properties.Resources.NESControllerIcon_MultiSize;
this.MainMenuStrip = this.MenuStrip;
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(322, 302);
this.MinimumSize = new System.Drawing.Size(312, 295);
this.Name = "NESGameGenie";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Game Genie Encoder / Decoder";
this.Load += new System.EventHandler(this.NESGameGenie_Load);
this.GameGenieCodeBox.ResumeLayout(false);
this.GameGenieCodeBox.PerformLayout();
this.ButtonPanel.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox GameGenieCode;
private System.Windows.Forms.GroupBox GameGenieCodeBox;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private HexTextBox CompareBox;
private HexTextBox ValueBox;
private HexTextBox AddressBox;
private System.Windows.Forms.Button AddCheat;
private System.Windows.Forms.Panel ButtonPanel;
private System.Windows.Forms.Button L;
private System.Windows.Forms.Button Z;
private System.Windows.Forms.Button P;
private System.Windows.Forms.Button A;
private System.Windows.Forms.Button Y;
private System.Windows.Forms.Button T;
private System.Windows.Forms.Button I;
private System.Windows.Forms.Button G;
private System.Windows.Forms.Button N;
private System.Windows.Forms.Button V;
private System.Windows.Forms.Button S;
private System.Windows.Forms.Button K;
private System.Windows.Forms.Button U;
private System.Windows.Forms.Button X;
private System.Windows.Forms.Button O;
private System.Windows.Forms.Button E;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.CheckBox Encoding;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button ClearButton;
private MenuStripEx MenuStrip;
}
}

View File

@ -1,309 +0,0 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Client.Common;
using BizHawk.Common;
namespace BizHawk.Client.EmuHawk
{
[Tool(false, null)]
public partial class NESGameGenie : Form, IToolFormAutoConfig
{
[RequiredService]
private IEmulator Emulator { get; set; }
[RequiredService]
private IMemoryDomains MemoryDomains { get; set; }
private readonly Dictionary<char, int> _gameGenieTable = new Dictionary<char, int>
{
['A'] = 0, // 0000
['P'] = 1, // 0001
['Z'] = 2, // 0010
['L'] = 3, // 0011
['G'] = 4, // 0100
['I'] = 5, // 0101
['T'] = 6, // 0110
['Y'] = 7, // 0111
['E'] = 8, // 1000
['O'] = 9, // 1001
['X'] = 10, // 1010
['U'] = 11, // 1011
['K'] = 12, // 1100
['S'] = 13, // 1101
['V'] = 14, // 1110
['N'] = 15 // 1111
};
private int? _address;
private int? _value;
private int? _compare;
public bool AskSaveChanges() => true;
public bool UpdateBefore => false;
public void Restart()
{
if (Emulator.SystemId != "NES")
{
Close();
}
}
public void NewUpdate(ToolFormUpdateType type) { }
public void UpdateValues()
{
if (Emulator.SystemId != "NES")
{
Close();
}
}
public void FastUpdate()
{
// Do nothing
}
public NESGameGenie()
{
InitializeComponent();
AddressBox.SetHexProperties(0x10000);
ValueBox.SetHexProperties(0x100);
CompareBox.SetHexProperties(0x100);
}
private void NESGameGenie_Load(object sender, EventArgs e)
{
AddCheat.Enabled = false;
}
public void DecodeGameGenieCode(string code)
{
var decoder = new NESGameGenieDecoder(code);
_address = decoder.Address;
_value = decoder.Value;
_compare = decoder.Compare;
SetProperties();
}
private void SetProperties()
{
if (_address.HasValue)
{
AddressBox.SetFromRawInt(_address.Value);
}
else
{
AddressBox.ResetText();
}
if (_compare.HasValue)
{
CompareBox.SetFromRawInt(_compare.Value);
}
else
{
CompareBox.ResetText();
}
if (_value.HasValue)
{
ValueBox.SetFromRawInt(_value.Value);
}
else
{
ValueBox.ResetText();
}
}
private void ClearProperties()
{
_address = _value = _compare = null;
AddressBox.Text =
CompareBox.Text =
ValueBox.Text =
"";
AddCheat.Enabled = false;
}
private void TryEnableAddCheat()
{
AddCheat.Enabled = !string.IsNullOrWhiteSpace(AddressBox.Text)
&& !string.IsNullOrWhiteSpace(ValueBox.Text)
&& !string.IsNullOrWhiteSpace(GameGenieCode.Text);
}
private void EncodeGameGenie()
{
_address = AddressBox.ToRawInt();
_value = ValueBox.ToRawInt();
_compare = CompareBox.ToRawInt();
GameGenieCode.Text = new NESGameGenieEncoder(_address.Value, _value.Value, _compare).Encode();
}
#region Events
private void GameGenieCode_KeyPress(object sender, KeyPressEventArgs e)
{
if (!_gameGenieTable.ContainsKey(char.ToUpper(e.KeyChar)))
{
if (ModifierKeys != Keys.None)
{
return;
}
if (e.KeyChar != (char)Keys.Back || e.KeyChar != '\b' || e.KeyChar == 22 || e.KeyChar == 1 || e.KeyChar == 3)
{
e.Handled = true;
}
}
else
{
Encoding.Checked = false;
}
}
private void ClearButton_Click(object sender, EventArgs e)
{
ClearProperties();
GameGenieCode.Text = "";
Encoding.Checked = false;
}
private void AddCheat_Click(object sender, EventArgs e)
{
if (!string.IsNullOrWhiteSpace(AddressBox.Text) && !string.IsNullOrWhiteSpace(ValueBox.Text))
{
var watch = Watch.GenerateWatch(
MemoryDomains["System Bus"],
AddressBox.ToRawInt().Value,
WatchSize.Byte,
Client.Common.DisplayType.Hex,
false,
GameGenieCode.Text);
Global.CheatList.Add(new Cheat(
watch,
ValueBox.ToRawInt().Value,
CompareBox.ToRawInt()
));
}
}
private void GameGenieCode_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyData == Keys.Enter)
{
if (AddCheat.Enabled)
{
AddCheat_Click(null, null);
}
}
}
private void ValueBox_TextChanged(object sender, EventArgs e)
{
if (Encoding.Checked && !string.IsNullOrWhiteSpace(ValueBox.Text))
{
var val = int.Parse(ValueBox.Text, NumberStyles.HexNumber);
if (val.StrictlyBoundedBy(0.RangeTo(0x100)) && !string.IsNullOrWhiteSpace(AddressBox.Text))
{
_value = val;
EncodeGameGenie();
}
}
TryEnableAddCheat();
}
private void Keypad_Click(object sender, EventArgs e)
{
if (GameGenieCode.Text.Length < 8)
{
var code = "";
if (sender == A) code = "A";
if (sender == P) code += "P";
if (sender == Z) code += "Z";
if (sender == L) code += "L";
if (sender == G) code += "G";
if (sender == I) code += "I";
if (sender == T) code += "T";
if (sender == Y) code += "Y";
if (sender == E) code += "E";
if (sender == O) code += "O";
if (sender == X) code += "X";
if (sender == U) code += "U";
if (sender == K) code += "K";
if (sender == S) code += "S";
if (sender == V) code += "V";
if (sender == N) code += "N";
int x = GameGenieCode.SelectionStart;
GameGenieCode.Text = GameGenieCode.Text.Insert(x, code);
GameGenieCode.SelectionStart = x + 1;
Encoding.Checked = false;
}
}
private void AddressBox_TextChanged(object sender, EventArgs e)
{
if (Encoding.Checked && AddressBox.Text.Length > 0)
{
if (!string.IsNullOrEmpty(ValueBox.Text))
{
EncodeGameGenie();
}
}
TryEnableAddCheat();
}
private void CompareBox_TextChanged(object sender, EventArgs e)
{
if (Encoding.Checked)
{
if (CompareBox.Text.Length > 0)
{
var c = int.Parse(CompareBox.Text, NumberStyles.HexNumber);
if (c.StrictlyBoundedBy(0.RangeTo(0x100)) && ValueBox.Text.Length > 0 && AddressBox.Text.Length > 0)
{
_compare = c;
EncodeGameGenie();
}
}
else
{
_compare = -1;
EncodeGameGenie();
}
}
TryEnableAddCheat();
}
private void GameGenieCode_TextChanged(object sender, EventArgs e)
{
if (Encoding.Checked == false)
{
if (GameGenieCode.Text.Length == 6 || GameGenieCode.Text.Length == 8)
{
DecodeGameGenieCode(GameGenieCode.Text);
}
else
{
ClearProperties();
}
}
TryEnableAddCheat();
}
#endregion
}
}

View File

@ -1,123 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="MenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -1,473 +0,0 @@
namespace BizHawk.Client.EmuHawk
{
partial class SNESGameGenie
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.GameGenieCodeBox = new System.Windows.Forms.GroupBox();
this.GGCodeMaskBox = new System.Windows.Forms.MaskedTextBox();
this.label3 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.ValueBox = new BizHawk.Client.EmuHawk.HexTextBox();
this.AddressBox = new BizHawk.Client.EmuHawk.HexTextBox();
this.addcheatbt = new System.Windows.Forms.Button();
this.ButtonPanel = new System.Windows.Forms.Panel();
this.BF = new System.Windows.Forms.Button();
this.BD = new System.Windows.Forms.Button();
this.BB = new System.Windows.Forms.Button();
this.B9 = new System.Windows.Forms.Button();
this.B7 = new System.Windows.Forms.Button();
this.B5 = new System.Windows.Forms.Button();
this.B3 = new System.Windows.Forms.Button();
this.BE = new System.Windows.Forms.Button();
this.B6 = new System.Windows.Forms.Button();
this.B1 = new System.Windows.Forms.Button();
this.BC = new System.Windows.Forms.Button();
this.BA = new System.Windows.Forms.Button();
this.B8 = new System.Windows.Forms.Button();
this.B4 = new System.Windows.Forms.Button();
this.B2 = new System.Windows.Forms.Button();
this.B0 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label6 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.ClearButton = new System.Windows.Forms.Button();
this.menuStrip1 = new MenuStripEx();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.CheatNameBox = new System.Windows.Forms.TextBox();
this.GameGenieCodeBox.SuspendLayout();
this.ButtonPanel.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// GameGenieCodeBox
//
this.GameGenieCodeBox.Controls.Add(this.GGCodeMaskBox);
this.GameGenieCodeBox.Location = new System.Drawing.Point(31, 103);
this.GameGenieCodeBox.Name = "GameGenieCodeBox";
this.GameGenieCodeBox.Size = new System.Drawing.Size(118, 54);
this.GameGenieCodeBox.TabIndex = 1;
this.GameGenieCodeBox.TabStop = false;
this.GameGenieCodeBox.Text = "Game Genie Code";
//
// GGCodeMaskBox
//
this.GGCodeMaskBox.Location = new System.Drawing.Point(25, 26);
this.GGCodeMaskBox.Margin = new System.Windows.Forms.Padding(2);
this.GGCodeMaskBox.Mask = ">AAAA-AAAA";
this.GGCodeMaskBox.Name = "GGCodeMaskBox";
this.GGCodeMaskBox.Size = new System.Drawing.Size(75, 20);
this.GGCodeMaskBox.TabIndex = 10;
this.GGCodeMaskBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.GGCodeMaskBox.TextMaskFormat = System.Windows.Forms.MaskFormat.ExcludePromptAndLiterals;
this.GGCodeMaskBox.TextChanged += new System.EventHandler(this.GGCodeMaskBox_TextChanged);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(8, 54);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(34, 13);
this.label3.TabIndex = 5;
this.label3.Text = "Value";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(8, 22);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(45, 13);
this.label1.TabIndex = 3;
this.label1.Text = "Address";
//
// ValueBox
//
this.ValueBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.ValueBox.Location = new System.Drawing.Point(105, 50);
this.ValueBox.MaxLength = 2;
this.ValueBox.Name = "ValueBox";
this.ValueBox.Nullable = true;
this.ValueBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.ValueBox.Size = new System.Drawing.Size(27, 20);
this.ValueBox.TabIndex = 23;
this.ValueBox.TextChanged += new System.EventHandler(this.ValueBox_TextChanged);
//
// AddressBox
//
this.AddressBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.AddressBox.Location = new System.Drawing.Point(75, 19);
this.AddressBox.MaxLength = 6;
this.AddressBox.Name = "AddressBox";
this.AddressBox.Nullable = true;
this.AddressBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.AddressBox.Size = new System.Drawing.Size(57, 20);
this.AddressBox.TabIndex = 21;
this.AddressBox.TextChanged += new System.EventHandler(this.AddressBox_TextChanged);
//
// addcheatbt
//
this.addcheatbt.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.addcheatbt.Enabled = false;
this.addcheatbt.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.addcheatbt.Location = new System.Drawing.Point(85, 163);
this.addcheatbt.Margin = new System.Windows.Forms.Padding(0);
this.addcheatbt.Name = "addcheatbt";
this.addcheatbt.Size = new System.Drawing.Size(65, 26);
this.addcheatbt.TabIndex = 33;
this.addcheatbt.Text = "&Add Cheat";
this.addcheatbt.UseVisualStyleBackColor = true;
this.addcheatbt.Click += new System.EventHandler(this.AddCheat_Click);
//
// ButtonPanel
//
this.ButtonPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.ButtonPanel.Controls.Add(this.BF);
this.ButtonPanel.Controls.Add(this.BD);
this.ButtonPanel.Controls.Add(this.BB);
this.ButtonPanel.Controls.Add(this.B9);
this.ButtonPanel.Controls.Add(this.B7);
this.ButtonPanel.Controls.Add(this.B5);
this.ButtonPanel.Controls.Add(this.B3);
this.ButtonPanel.Controls.Add(this.BE);
this.ButtonPanel.Controls.Add(this.B6);
this.ButtonPanel.Controls.Add(this.B1);
this.ButtonPanel.Controls.Add(this.BC);
this.ButtonPanel.Controls.Add(this.BA);
this.ButtonPanel.Controls.Add(this.B8);
this.ButtonPanel.Controls.Add(this.B4);
this.ButtonPanel.Controls.Add(this.B2);
this.ButtonPanel.Controls.Add(this.B0);
this.ButtonPanel.Location = new System.Drawing.Point(35, 30);
this.ButtonPanel.Name = "ButtonPanel";
this.ButtonPanel.Size = new System.Drawing.Size(240, 67);
this.ButtonPanel.TabIndex = 4;
//
// BF
//
this.BF.Location = new System.Drawing.Point(206, 35);
this.BF.Name = "BF";
this.BF.Size = new System.Drawing.Size(26, 23);
this.BF.TabIndex = 16;
this.BF.Text = "F";
this.BF.UseVisualStyleBackColor = true;
this.BF.Click += new System.EventHandler(this.Keypad_Click);
//
// BD
//
this.BD.Location = new System.Drawing.Point(149, 35);
this.BD.Name = "BD";
this.BD.Size = new System.Drawing.Size(26, 23);
this.BD.TabIndex = 14;
this.BD.Text = "D";
this.BD.UseVisualStyleBackColor = true;
this.BD.Click += new System.EventHandler(this.Keypad_Click);
//
// BB
//
this.BB.Location = new System.Drawing.Point(91, 35);
this.BB.Name = "BB";
this.BB.Size = new System.Drawing.Size(26, 23);
this.BB.TabIndex = 12;
this.BB.Text = "B";
this.BB.UseVisualStyleBackColor = true;
this.BB.Click += new System.EventHandler(this.Keypad_Click);
//
// B9
//
this.B9.Location = new System.Drawing.Point(34, 35);
this.B9.Name = "B9";
this.B9.Size = new System.Drawing.Size(26, 23);
this.B9.TabIndex = 10;
this.B9.Text = "9";
this.B9.UseVisualStyleBackColor = true;
this.B9.Click += new System.EventHandler(this.Keypad_Click);
//
// B7
//
this.B7.Location = new System.Drawing.Point(206, 5);
this.B7.Name = "B7";
this.B7.Size = new System.Drawing.Size(26, 23);
this.B7.TabIndex = 8;
this.B7.Text = "7";
this.B7.UseVisualStyleBackColor = true;
this.B7.Click += new System.EventHandler(this.Keypad_Click);
//
// B5
//
this.B5.Location = new System.Drawing.Point(149, 6);
this.B5.Name = "B5";
this.B5.Size = new System.Drawing.Size(26, 23);
this.B5.TabIndex = 6;
this.B5.Text = "5";
this.B5.UseVisualStyleBackColor = true;
this.B5.Click += new System.EventHandler(this.Keypad_Click);
//
// B3
//
this.B3.Location = new System.Drawing.Point(91, 6);
this.B3.Name = "B3";
this.B3.Size = new System.Drawing.Size(26, 23);
this.B3.TabIndex = 4;
this.B3.Text = "3";
this.B3.UseVisualStyleBackColor = true;
this.B3.Click += new System.EventHandler(this.Keypad_Click);
//
// BE
//
this.BE.Location = new System.Drawing.Point(178, 35);
this.BE.Name = "BE";
this.BE.Size = new System.Drawing.Size(26, 23);
this.BE.TabIndex = 15;
this.BE.Text = "E";
this.BE.UseVisualStyleBackColor = true;
this.BE.Click += new System.EventHandler(this.Keypad_Click);
//
// B6
//
this.B6.Location = new System.Drawing.Point(178, 5);
this.B6.Name = "B6";
this.B6.Size = new System.Drawing.Size(26, 23);
this.B6.TabIndex = 7;
this.B6.Text = "6";
this.B6.UseVisualStyleBackColor = true;
this.B6.Click += new System.EventHandler(this.Keypad_Click);
//
// B1
//
this.B1.Location = new System.Drawing.Point(34, 6);
this.B1.Name = "B1";
this.B1.Size = new System.Drawing.Size(26, 23);
this.B1.TabIndex = 2;
this.B1.Text = "1";
this.B1.UseVisualStyleBackColor = true;
this.B1.Click += new System.EventHandler(this.Keypad_Click);
//
// BC
//
this.BC.Location = new System.Drawing.Point(121, 35);
this.BC.Name = "BC";
this.BC.Size = new System.Drawing.Size(26, 23);
this.BC.TabIndex = 13;
this.BC.Text = "C";
this.BC.UseVisualStyleBackColor = true;
this.BC.Click += new System.EventHandler(this.Keypad_Click);
//
// BA
//
this.BA.Location = new System.Drawing.Point(63, 35);
this.BA.Name = "BA";
this.BA.Size = new System.Drawing.Size(26, 23);
this.BA.TabIndex = 11;
this.BA.Text = "A";
this.BA.UseVisualStyleBackColor = true;
this.BA.Click += new System.EventHandler(this.Keypad_Click);
//
// B8
//
this.B8.Location = new System.Drawing.Point(6, 35);
this.B8.Name = "B8";
this.B8.Size = new System.Drawing.Size(26, 23);
this.B8.TabIndex = 9;
this.B8.Text = "8";
this.B8.UseVisualStyleBackColor = true;
this.B8.Click += new System.EventHandler(this.Keypad_Click);
//
// B4
//
this.B4.Location = new System.Drawing.Point(121, 6);
this.B4.Name = "B4";
this.B4.Size = new System.Drawing.Size(26, 23);
this.B4.TabIndex = 5;
this.B4.Text = "4";
this.B4.UseVisualStyleBackColor = true;
this.B4.Click += new System.EventHandler(this.Keypad_Click);
//
// B2
//
this.B2.Location = new System.Drawing.Point(63, 6);
this.B2.Name = "B2";
this.B2.Size = new System.Drawing.Size(26, 23);
this.B2.TabIndex = 3;
this.B2.Text = "2";
this.B2.UseVisualStyleBackColor = true;
this.B2.Click += new System.EventHandler(this.Keypad_Click);
//
// B0
//
this.B0.Location = new System.Drawing.Point(6, 5);
this.B0.Name = "B0";
this.B0.Size = new System.Drawing.Size(26, 23);
this.B0.TabIndex = 1;
this.B0.Text = "0";
this.B0.UseVisualStyleBackColor = true;
this.B0.Click += new System.EventHandler(this.Keypad_Click);
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.AddressBox);
this.groupBox1.Controls.Add(this.ValueBox);
this.groupBox1.Location = new System.Drawing.Point(155, 103);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(137, 82);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Decoded Value";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(87, 54);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(18, 13);
this.label6.TabIndex = 9;
this.label6.Text = "0x";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(57, 22);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(18, 13);
this.label4.TabIndex = 7;
this.label4.Text = "0x";
//
// ClearButton
//
this.ClearButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.ClearButton.Location = new System.Drawing.Point(31, 163);
this.ClearButton.Margin = new System.Windows.Forms.Padding(2);
this.ClearButton.Name = "ClearButton";
this.ClearButton.Size = new System.Drawing.Size(52, 26);
this.ClearButton.TabIndex = 32;
this.ClearButton.Text = "&Clear";
this.ClearButton.UseVisualStyleBackColor = true;
this.ClearButton.Click += new System.EventHandler(this.ClearButton_Click);
//
// menuStrip1
//
this.menuStrip1.ClickThrough = true;
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(292, 24);
this.menuStrip1.TabIndex = 8;
this.menuStrip1.Text = "menuStrip1";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.CheatNameBox);
this.groupBox2.Location = new System.Drawing.Point(31, 197);
this.groupBox2.Margin = new System.Windows.Forms.Padding(2);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new System.Windows.Forms.Padding(2);
this.groupBox2.Size = new System.Drawing.Size(262, 50);
this.groupBox2.TabIndex = 24;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Cheat Title (Uses GG code if left empty)";
//
// CheatNameBox
//
this.CheatNameBox.Location = new System.Drawing.Point(18, 23);
this.CheatNameBox.Margin = new System.Windows.Forms.Padding(2);
this.CheatNameBox.Name = "CheatNameBox";
this.CheatNameBox.Size = new System.Drawing.Size(227, 20);
this.CheatNameBox.TabIndex = 0;
//
// SNESGameGenie
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 252);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.ClearButton);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.ButtonPanel);
this.Controls.Add(this.addcheatbt);
this.Controls.Add(this.GameGenieCodeBox);
this.Controls.Add(this.menuStrip1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.MainMenuStrip = this.menuStrip1;
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(312, 294);
this.MinimumSize = new System.Drawing.Size(312, 294);
this.Name = "SNESGameGenie";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "SNES Game Genie Encoder / Decoder";
this.Load += new System.EventHandler(this.SNESGameGenie_Load);
this.GameGenieCodeBox.ResumeLayout(false);
this.GameGenieCodeBox.PerformLayout();
this.ButtonPanel.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.GroupBox GameGenieCodeBox;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label1;
private HexTextBox ValueBox;
private HexTextBox AddressBox;
private System.Windows.Forms.Button addcheatbt;
private System.Windows.Forms.Panel ButtonPanel;
private System.Windows.Forms.Button B6;
private System.Windows.Forms.Button B4;
private System.Windows.Forms.Button B2;
private System.Windows.Forms.Button B0;
private System.Windows.Forms.Button BE;
private System.Windows.Forms.Button BC;
private System.Windows.Forms.Button BA;
private System.Windows.Forms.Button B8;
private System.Windows.Forms.Button BF;
private System.Windows.Forms.Button BD;
private System.Windows.Forms.Button BB;
private System.Windows.Forms.Button B9;
private System.Windows.Forms.Button B7;
private System.Windows.Forms.Button B5;
private System.Windows.Forms.Button B3;
private System.Windows.Forms.Button B1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button ClearButton;
private MenuStripEx menuStrip1;
private System.Windows.Forms.MaskedTextBox GGCodeMaskBox;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox CheatNameBox;
}
}

View File

@ -1,365 +0,0 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Nintendo.SNES;
using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk
{
[Tool(false, null)]
public partial class SNESGameGenie : Form, IToolFormAutoConfig
{
[RequiredService]
public LibsnesCore Emulator { get; set; }
[RequiredService]
private IMemoryDomains MemoryDomains { get; set; }
// including transposition
// Code: D F 4 7 0 9 1 5 6 B C 8 A 2 3 E
// Hex: 0 1 2 3 4 5 6 7 8 9 A B C D E F
private readonly Dictionary<char, int> _gameGenieTable = new Dictionary<char, int>
{
['D'] = 0, // 0000
['F'] = 1, // 0001
['4'] = 2, // 0010
['7'] = 3, // 0011
['0'] = 4, // 0100
['9'] = 5, // 0101
['1'] = 6, // 0110
['5'] = 7, // 0111
['6'] = 8, // 1000
['B'] = 9, // 1001
['C'] = 10, // 1010
['8'] = 11, // 1011
['A'] = 12, // 1100
['2'] = 13, // 1101
['3'] = 14, // 1110
['E'] = 15 // 1111
};
private bool _processing;
public SNESGameGenie()
{
InitializeComponent();
}
private void SNESGameGenie_Load(object sender, EventArgs e)
{
addcheatbt.Enabled = false;
}
#region Public API
public bool AskSaveChanges() => true;
public bool UpdateBefore => false;
public void Restart()
{
// Do nothing
}
public void NewUpdate(ToolFormUpdateType type) { }
public void UpdateValues()
{
// Do nothing
}
public void FastUpdate()
{
// Do nothing
}
#endregion
private void SnesGGDecode(string code, ref int val, ref int add)
{
// Code: D F 4 7 0 9 1 5 6 B C 8 A 2 3 E
// Hex: 0 1 2 3 4 5 6 7 8 9 A B C D E F
// XXYY-YYYY, where XX is the value, and YY-YYYY is the address.
// Char # | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
// Bit # |3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|
// maps to| Value |i|j|k|l|q|r|s|t|o|p|a|b|c|d|u|v|w|x|e|f|g|h|m|n|
// order | Value |a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|
int x;
// Getting Value
if (code.Length > 0)
{
_gameGenieTable.TryGetValue(code[0], out x);
val = x << 4;
}
if (code.Length > 1)
{
_gameGenieTable.TryGetValue(code[1], out x);
val |= x;
}
// Address
if (code.Length > 2)
{
_gameGenieTable.TryGetValue(code[2], out x);
add = x << 12;
}
if (code.Length > 3)
{
_gameGenieTable.TryGetValue(code[3], out x);
add |= x << 4;
}
if (code.Length > 4)
{
_gameGenieTable.TryGetValue(code[4], out x);
add |= (x & 0xC) << 6;
add |= (x & 0x3) << 22;
}
if (code.Length > 5)
{
_gameGenieTable.TryGetValue(code[5], out x);
add |= (x & 0xC) << 18;
add |= (x & 0x3) << 2;
}
if (code.Length > 6)
{
_gameGenieTable.TryGetValue(code[6], out x);
add |= (x & 0xC) >> 2;
add |= (x & 0x3) << 18;
}
if (code.Length > 7)
{
_gameGenieTable.TryGetValue(code[7], out x);
add |= (x & 0xC) << 14;
add |= (x & 0x3) << 10;
}
}
private static string SnesGGEncode(int val, int add)
{
// Code: D F 4 7 0 9 1 5 6 B C 8 A 2 3 E
// Hex: 0 1 2 3 4 5 6 7 8 9 A B C D E F
// Char # | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
// Bit # |3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|3|2|1|0|
// maps to| Value |i|j|k|l|q|r|s|t|o|p|a|b|c|d|u|v|w|x|e|f|g|h|m|n|
// order | Value |a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|
char[] letters = { 'D', 'F', '4', '7', '0', '9', '1', '5', '6', 'B', 'C', '8', 'A', '2', '3', 'E' };
var code = "";
int[] num = { 0, 0, 0, 0, 0, 0, 0, 0 };
num[0] = (val & 0xF0) >> 4;
num[1] = val & 0x0F;
num[2] = (add & 0x00F000) >> 12; // ijkl
num[3] = (add & 0x0000F0) >> 4; // qrst
num[4] = ((add & 0x000300) >> 6) | ((add & 0xC00000) >> 22); // opab
num[5] = ((add & 0x300000) >> 18) | ((add & 0x00000C) >> 2); // cduv
num[6] = ((add & 0x000003) << 2) | ((add & 0x0C0000) >> 18); // wxef
num[7] = ((add & 0x030000) >> 14) | ((add & 0x000C00) >> 10); // ghmn
for (int i = 0; i < 8; i++)
{
code += letters[num[i]];
}
return code;
}
#region Dialog and Control Events
private void ClearButton_Click(object sender, EventArgs e)
{
AddressBox.Text = "";
ValueBox.Text = "";
GGCodeMaskBox.Text = "";
addcheatbt.Enabled = false;
}
private void AddCheat_Click(object sender, EventArgs e)
{
string name;
var address = 0;
var value = 0;
if (!string.IsNullOrWhiteSpace(CheatNameBox.Text))
{
name = CheatNameBox.Text;
}
else
{
_processing = true;
GGCodeMaskBox.TextMaskFormat = MaskFormat.IncludeLiterals;
name = GGCodeMaskBox.Text;
GGCodeMaskBox.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;
_processing = false;
}
if (!string.IsNullOrWhiteSpace(AddressBox.Text))
{
address = int.Parse(AddressBox.Text, NumberStyles.HexNumber)
+ 0x8000;
}
if (!string.IsNullOrWhiteSpace(ValueBox.Text))
{
value = byte.Parse(ValueBox.Text, NumberStyles.HexNumber);
}
var watch = Watch.GenerateWatch(
MemoryDomains["System Bus"],
address,
WatchSize.Byte,
Common.DisplayType.Hex,
false,
name
);
Global.CheatList.Add(new Cheat(
watch,
value
));
}
private void AddressBox_TextChanged(object sender, EventArgs e)
{
// Remove invalid character when pasted
if (_processing == false)
{
_processing = true;
if (Regex.IsMatch(AddressBox.Text, @"[^a-fA-F0-9]"))
{
AddressBox.Text = Regex.Replace(AddressBox.Text, @"[^a-fA-F0-9]", "");
}
if (!string.IsNullOrEmpty(AddressBox.Text) || !string.IsNullOrEmpty(ValueBox.Text))
{
int val = 0, add = 0;
if (!string.IsNullOrEmpty(AddressBox.Text))
{
add = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
}
if (!string.IsNullOrEmpty(ValueBox.Text))
{
val = int.Parse(ValueBox.Text, NumberStyles.HexNumber);
}
GGCodeMaskBox.Text = SnesGGEncode(val, add);
addcheatbt.Enabled = true;
}
else
{
GGCodeMaskBox.Text = "";
addcheatbt.Enabled = false;
}
_processing = false;
}
}
private void ValueBox_TextChanged(object sender, EventArgs e)
{
if (_processing == false)
{
_processing = true;
// remove invalid character when pasted
if (Regex.IsMatch(ValueBox.Text, @"[^a-fA-F0-9]"))
{
ValueBox.Text = Regex.Replace(ValueBox.Text, @"[^a-fA-F0-9]", "");
}
if ((AddressBox.Text.Length > 0) || (ValueBox.Text.Length > 0))
{
int val = 0, add = 0;
if (ValueBox.Text.Length > 0)
{
val = int.Parse(ValueBox.Text, NumberStyles.HexNumber);
}
if (AddressBox.Text.Length > 0)
{
add = int.Parse(AddressBox.Text, NumberStyles.HexNumber);
}
GGCodeMaskBox.Text = SnesGGEncode(val, add);
addcheatbt.Enabled = true;
}
else
{
GGCodeMaskBox.Text = "";
addcheatbt.Enabled = false;
}
_processing = false;
}
}
private void GGCodeMaskBox_TextChanged(object sender, EventArgs e)
{
if (_processing == false)
{
_processing = true;
// insert REGEX Remove non HEXA char
if (Regex.IsMatch(GGCodeMaskBox.Text, @"[^a-fA-F0-9]"))
{
GGCodeMaskBox.Text = Regex.Replace(GGCodeMaskBox.Text, @"[^a-fA-F0-9]", "");
}
if (GGCodeMaskBox.Text.Length > 0)
{
int val = 0, add = 0;
SnesGGDecode(GGCodeMaskBox.Text, ref val, ref add);
AddressBox.Text = $"{add:X6}";
ValueBox.Text = $"{val:X2}";
addcheatbt.Enabled = true;
}
else
{
AddressBox.Text = "";
ValueBox.Text = "";
addcheatbt.Enabled = false;
}
_processing = false;
}
}
private void Keypad_Click(object sender, EventArgs e)
{
if (GGCodeMaskBox.Text.Length < 8)
{
var code = "";
if (sender == B0) code = "0";
if (sender == B1) code = "1";
if (sender == B2) code = "2";
if (sender == B3) code = "3";
if (sender == B4) code = "4";
if (sender == B5) code = "5";
if (sender == B6) code = "6";
if (sender == B7) code = "7";
if (sender == B8) code = "8";
if (sender == B9) code = "9";
if (sender == BA) code = "A";
if (sender == BB) code = "B";
if (sender == BC) code = "C";
if (sender == BD) code = "D";
if (sender == BE) code = "E";
if (sender == BF) code = "F";
GGCodeMaskBox.Text += code;
}
}
#endregion
}
}

View File

@ -1,123 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -62,8 +62,6 @@ namespace BizHawk.Client.EmuHawk
continue;
if (VersionInfo.DeveloperBuild && t.GetCustomAttributes(false).OfType<ToolAttribute>().Any(a => !a.Released))
continue;
if (t == typeof(GBGameGenie)) // Hack, this tool is specific to a system id and a sub-system (gb and gg) we have no reasonable way to declare a dependency like that
continue;
if (!ServiceInjector.IsAvailable(Emulator.ServiceProvider, t))
continue;
// if (!ApiInjector.IsAvailable(, t))

View File

@ -185,6 +185,8 @@
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=aaaaaaa/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=aaaaaaaa/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=AARRGGBB/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=accum/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=addr/@EntryIndexedValue">True</s:Boolean>
@ -208,6 +210,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=autorestore/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Autosave/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=avisynth/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Axxxxxxx/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=backbuffer/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=backcolor/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=bandai/@EntryIndexedValue">True</s:Boolean>
@ -256,10 +259,12 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=CURRINDEX/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=CURRTRACK/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Cyotek/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Daaaaaaa/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=databus/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Datacorder/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Datarows/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Datasheet/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=DEADFACE/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Deadzone/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=dearchive/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=defctrl/@EntryIndexedValue">True</s:Boolean>
@ -282,10 +287,13 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Ejin/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Endian/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=endianess/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=endrift/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Faaaaaaa/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Fairchild/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Famicom/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Famtasia/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=FCEU/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=FFFFFE/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=FFFFFFFF/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ffmpeg/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ffmpeg_0027s/@EntryIndexedValue">True</s:Boolean>
@ -327,6 +335,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Hotkeys/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=hsbios/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=hwnd/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=iiii/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Intelli/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Intellivision/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=inrate/@EntryIndexedValue">True</s:Boolean>
@ -351,6 +360,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Loadstates/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Longplay/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Longplays/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=looper/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Lossless/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=lparam/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=lsmv/@EntryIndexedValue">True</s:Boolean>
@ -531,8 +541,17 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=XBOX/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=xinput/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Xjin/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Xploder/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=xxxx/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=XXXXXX/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=xxxxxxx/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=XXXXXXXX/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=xxyy/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Yabause/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=YYYYYY/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=YYYYYYYY/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=YYYYYYZZ/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=YYYYZZZZ/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Zeromus/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Zipheader/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ZSNES/@EntryIndexedValue">True</s:Boolean>