add a Rom Status picker to allow the user to pick something other than a good dump

This commit is contained in:
adelikat 2014-04-15 22:51:42 +00:00
parent 1dd055ab6c
commit f81ccaacd8
5 changed files with 522 additions and 6 deletions

View File

@ -497,6 +497,12 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="RomStatusPicker.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="RomStatusPicker.Designer.cs">
<DependentUpon>RomStatusPicker.cs</DependentUpon>
</Compile>
<Compile Include="Throttle.cs" />
<Compile Include="tools\BatchRun.cs">
<SubType>Form</SubType>
@ -1052,6 +1058,9 @@
<SubType>Designer</SubType>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="RomStatusPicker.resx">
<DependentUpon>RomStatusPicker.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="tools\BatchRun.resx">
<DependentUpon>BatchRun.cs</DependentUpon>
</EmbeddedResource>

View File

@ -142,12 +142,17 @@ namespace BizHawk.Client.EmuHawk
private void AddToGameDbBtn_Click(object sender, EventArgs e)
{
var entryObj = (CompactGameInfo)ReflectionUtil.InvokeMethod(Global.Emulator, "GenerateGameDbEntry", null);
var userDb = Path.Combine(PathManager.GetExeDirectoryAbsolute(), "gamedb", "gamedb_user.txt");
Global.Game.Status = entryObj.Status = RomStatus.GoodDump; //TODO: let user decide
Database.SaveDatabaseEntry(userDb, entryObj);
GlobalWin.MainForm.UpdateDumpIcon();
HideShowGameDbButton();
var picker = new RomStatusPicker();
var result = picker.ShowDialog();
if (result == DialogResult.OK)
{
var entryObj = (CompactGameInfo)ReflectionUtil.InvokeMethod(Global.Emulator, "GenerateGameDbEntry", null);
var userDb = Path.Combine(PathManager.GetExeDirectoryAbsolute(), "gamedb", "gamedb_user.txt");
Global.Game.Status = entryObj.Status = picker.PickedStatus;
Database.SaveDatabaseEntry(userDb, entryObj);
GlobalWin.MainForm.UpdateDumpIcon();
HideShowGameDbButton();
}
}
}
}

View File

@ -0,0 +1,321 @@
namespace BizHawk.Client.EmuHawk
{
partial class RomStatusPicker
{
/// <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.CancelBtn = new System.Windows.Forms.Button();
this.OkBtn = new System.Windows.Forms.Button();
this.GoodRadio = new System.Windows.Forms.RadioButton();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.HomebrewRadio = new System.Windows.Forms.RadioButton();
this.label3 = new System.Windows.Forms.Label();
this.pictureBox3 = new System.Windows.Forms.PictureBox();
this.HackRadio = new System.Windows.Forms.RadioButton();
this.label4 = new System.Windows.Forms.Label();
this.pictureBox4 = new System.Windows.Forms.PictureBox();
this.TranslationRadio = new System.Windows.Forms.RadioButton();
this.label5 = new System.Windows.Forms.Label();
this.pictureBox5 = new System.Windows.Forms.PictureBox();
this.BadRadio = new System.Windows.Forms.RadioButton();
this.label6 = new System.Windows.Forms.Label();
this.pictureBox6 = new System.Windows.Forms.PictureBox();
this.OverdumpRadio = new System.Windows.Forms.RadioButton();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).BeginInit();
this.SuspendLayout();
//
// CancelBtn
//
this.CancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.CancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.CancelBtn.Location = new System.Drawing.Point(91, 168);
this.CancelBtn.Name = "CancelBtn";
this.CancelBtn.Size = new System.Drawing.Size(60, 23);
this.CancelBtn.TabIndex = 0;
this.CancelBtn.Text = "&Cancel";
this.CancelBtn.UseVisualStyleBackColor = true;
this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click);
//
// OkBtn
//
this.OkBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.OkBtn.Location = new System.Drawing.Point(25, 168);
this.OkBtn.Name = "OkBtn";
this.OkBtn.Size = new System.Drawing.Size(60, 23);
this.OkBtn.TabIndex = 1;
this.OkBtn.Text = "&Ok";
this.OkBtn.UseVisualStyleBackColor = true;
this.OkBtn.Click += new System.EventHandler(this.OkBtn_Click);
//
// GoodRadio
//
this.GoodRadio.AutoSize = true;
this.GoodRadio.Checked = true;
this.GoodRadio.Location = new System.Drawing.Point(12, 12);
this.GoodRadio.Name = "GoodRadio";
this.GoodRadio.Size = new System.Drawing.Size(14, 13);
this.GoodRadio.TabIndex = 2;
this.GoodRadio.TabStop = true;
this.GoodRadio.UseVisualStyleBackColor = true;
//
// pictureBox1
//
this.pictureBox1.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.GreenCheck;
this.pictureBox1.InitialImage = global::BizHawk.Client.EmuHawk.Properties.Resources.GreenCheck;
this.pictureBox1.Location = new System.Drawing.Point(29, 10);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(16, 16);
this.pictureBox1.TabIndex = 3;
this.pictureBox1.TabStop = false;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(48, 12);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(64, 13);
this.label1.TabIndex = 4;
this.label1.Text = "Good Dump";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(48, 37);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(58, 13);
this.label2.TabIndex = 7;
this.label2.Text = "Homebrew";
//
// pictureBox2
//
this.pictureBox2.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.HomeBrew;
this.pictureBox2.InitialImage = global::BizHawk.Client.EmuHawk.Properties.Resources.HomeBrew;
this.pictureBox2.Location = new System.Drawing.Point(29, 35);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(16, 16);
this.pictureBox2.TabIndex = 6;
this.pictureBox2.TabStop = false;
//
// HomebrewRadio
//
this.HomebrewRadio.AutoSize = true;
this.HomebrewRadio.Location = new System.Drawing.Point(12, 37);
this.HomebrewRadio.Name = "HomebrewRadio";
this.HomebrewRadio.Size = new System.Drawing.Size(14, 13);
this.HomebrewRadio.TabIndex = 5;
this.HomebrewRadio.UseVisualStyleBackColor = true;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(48, 62);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(33, 13);
this.label3.TabIndex = 10;
this.label3.Text = "Hack";
//
// pictureBox3
//
this.pictureBox3.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Hack;
this.pictureBox3.InitialImage = global::BizHawk.Client.EmuHawk.Properties.Resources.Hack;
this.pictureBox3.Location = new System.Drawing.Point(29, 60);
this.pictureBox3.Name = "pictureBox3";
this.pictureBox3.Size = new System.Drawing.Size(16, 16);
this.pictureBox3.TabIndex = 9;
this.pictureBox3.TabStop = false;
//
// HackRadio
//
this.HackRadio.AutoSize = true;
this.HackRadio.Location = new System.Drawing.Point(12, 62);
this.HackRadio.Name = "HackRadio";
this.HackRadio.Size = new System.Drawing.Size(14, 13);
this.HackRadio.TabIndex = 8;
this.HackRadio.UseVisualStyleBackColor = true;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(48, 87);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(85, 13);
this.label4.TabIndex = 13;
this.label4.Text = "Translated ROM";
//
// pictureBox4
//
this.pictureBox4.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Translation;
this.pictureBox4.InitialImage = global::BizHawk.Client.EmuHawk.Properties.Resources.Translation;
this.pictureBox4.Location = new System.Drawing.Point(29, 85);
this.pictureBox4.Name = "pictureBox4";
this.pictureBox4.Size = new System.Drawing.Size(16, 16);
this.pictureBox4.TabIndex = 12;
this.pictureBox4.TabStop = false;
//
// TranslationRadio
//
this.TranslationRadio.AutoSize = true;
this.TranslationRadio.Location = new System.Drawing.Point(12, 87);
this.TranslationRadio.Name = "TranslationRadio";
this.TranslationRadio.Size = new System.Drawing.Size(14, 13);
this.TranslationRadio.TabIndex = 11;
this.TranslationRadio.UseVisualStyleBackColor = true;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(48, 112);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(57, 13);
this.label5.TabIndex = 16;
this.label5.Text = "Bad Dump";
//
// pictureBox5
//
this.pictureBox5.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.ExclamationRed;
this.pictureBox5.InitialImage = global::BizHawk.Client.EmuHawk.Properties.Resources.ExclamationRed;
this.pictureBox5.Location = new System.Drawing.Point(29, 110);
this.pictureBox5.Name = "pictureBox5";
this.pictureBox5.Size = new System.Drawing.Size(16, 16);
this.pictureBox5.TabIndex = 15;
this.pictureBox5.TabStop = false;
//
// BadRadio
//
this.BadRadio.AutoSize = true;
this.BadRadio.Location = new System.Drawing.Point(12, 112);
this.BadRadio.Name = "BadRadio";
this.BadRadio.Size = new System.Drawing.Size(14, 13);
this.BadRadio.TabIndex = 14;
this.BadRadio.UseVisualStyleBackColor = true;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(48, 137);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(61, 13);
this.label6.TabIndex = 19;
this.label6.Text = "Over Dump";
//
// pictureBox6
//
this.pictureBox6.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.ExclamationRed;
this.pictureBox6.InitialImage = global::BizHawk.Client.EmuHawk.Properties.Resources.ExclamationRed;
this.pictureBox6.Location = new System.Drawing.Point(29, 135);
this.pictureBox6.Name = "pictureBox6";
this.pictureBox6.Size = new System.Drawing.Size(16, 16);
this.pictureBox6.TabIndex = 18;
this.pictureBox6.TabStop = false;
//
// OverdumpRadio
//
this.OverdumpRadio.AutoSize = true;
this.OverdumpRadio.Location = new System.Drawing.Point(12, 137);
this.OverdumpRadio.Name = "OverdumpRadio";
this.OverdumpRadio.Size = new System.Drawing.Size(14, 13);
this.OverdumpRadio.TabIndex = 17;
this.OverdumpRadio.UseVisualStyleBackColor = true;
//
// RomStatusPicker
//
this.AcceptButton = this.OkBtn;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.CancelBtn;
this.ClientSize = new System.Drawing.Size(163, 203);
this.Controls.Add(this.label6);
this.Controls.Add(this.pictureBox6);
this.Controls.Add(this.OverdumpRadio);
this.Controls.Add(this.label5);
this.Controls.Add(this.pictureBox5);
this.Controls.Add(this.BadRadio);
this.Controls.Add(this.label4);
this.Controls.Add(this.pictureBox4);
this.Controls.Add(this.TranslationRadio);
this.Controls.Add(this.label3);
this.Controls.Add(this.pictureBox3);
this.Controls.Add(this.HackRadio);
this.Controls.Add(this.label2);
this.Controls.Add(this.pictureBox2);
this.Controls.Add(this.HomebrewRadio);
this.Controls.Add(this.label1);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.GoodRadio);
this.Controls.Add(this.OkBtn);
this.Controls.Add(this.CancelBtn);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "RomStatusPicker";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Pick a status";
this.Load += new System.EventHandler(this.RomStatusPicker_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button CancelBtn;
private System.Windows.Forms.Button OkBtn;
private System.Windows.Forms.RadioButton GoodRadio;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.RadioButton HomebrewRadio;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.PictureBox pictureBox3;
private System.Windows.Forms.RadioButton HackRadio;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.PictureBox pictureBox4;
private System.Windows.Forms.RadioButton TranslationRadio;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.PictureBox pictureBox5;
private System.Windows.Forms.RadioButton BadRadio;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.PictureBox pictureBox6;
private System.Windows.Forms.RadioButton OverdumpRadio;
}
}

View File

@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
public partial class RomStatusPicker : Form
{
public RomStatusPicker()
{
InitializeComponent();
PickedStatus = RomStatus.Unknown;
}
public RomStatus PickedStatus { get; private set; }
private void RomStatusPicker_Load(object sender, EventArgs e)
{
GoodRadio.Select();
}
private void OkBtn_Click(object sender, EventArgs e)
{
if (GoodRadio.Checked)
{
PickedStatus = RomStatus.GoodDump;
}
else if (HomebrewRadio.Checked)
{
PickedStatus = RomStatus.Homebrew;
}
else if (HackRadio.Checked)
{
PickedStatus = RomStatus.Hack;
}
else if (HackRadio.Checked)
{
PickedStatus = RomStatus.TranslatedRom;
}
else if (BadRadio.Checked)
{
PickedStatus = RomStatus.BadDump;
}
DialogResult = DialogResult.OK;
Close();
}
private void CancelBtn_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
}
}

View File

@ -0,0 +1,120 @@
<?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>
</root>