remove unused snes GameGenie tool

This commit is contained in:
adelikat 2020-02-28 19:46:20 -06:00
parent 195ebc7d5b
commit 5b781f568f
4 changed files with 0 additions and 964 deletions

View File

@ -609,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

@ -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>