remove GenGameGenie in favor of using the unified Cheat Code decoder
This commit is contained in:
parent
bdba72802e
commit
0f134d3dc3
BizHawk.Client.EmuHawk
|
@ -537,9 +537,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" />
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -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>
|
Loading…
Reference in New Issue