Add simple trainer editor (past gen)

Fixed save invalidation as well. GameVersions were detected based on
checksum validity.
Gonna change that so an invalid save can still be recognized (based off
of other markers)
This commit is contained in:
Kaphotics 2016-06-21 17:35:12 -07:00
parent ff1b084523
commit 3351c7f9bb
9 changed files with 1050 additions and 29 deletions

View file

@ -215,6 +215,12 @@
<Compile Include="SAV\SAV_Pokepuff.Designer.cs">
<DependentUpon>SAV_Pokepuff.cs</DependentUpon>
</Compile>
<Compile Include="SAV\SAV_SimpleTrainer.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SAV\SAV_SimpleTrainer.Designer.cs">
<DependentUpon>SAV_SimpleTrainer.cs</DependentUpon>
</Compile>
<Compile Include="SAV\SAV_SuperTrain.cs">
<SubType>Form</SubType>
</Compile>
@ -305,6 +311,9 @@
<EmbeddedResource Include="SAV\SAV_Pokepuff.resx">
<DependentUpon>SAV_Pokepuff.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SAV\SAV_SimpleTrainer.resx">
<DependentUpon>SAV_SimpleTrainer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SAV\SAV_SuperTrain.resx">
<DependentUpon>SAV_SuperTrain.cs</DependentUpon>
</EmbeddedResource>

View file

@ -3791,7 +3791,10 @@ namespace PKHeX
}
private void B_OpenTrainerInfo_Click(object sender, EventArgs e)
{
new SAV_Trainer().ShowDialog();
if (SAV.Generation < 6)
new SAV_SimpleTrainer().ShowDialog();
else if (SAV.Generation == 6)
new SAV_Trainer().ShowDialog();
// Refresh conversion info
PKMConverter.updateConfig(SAV.SubRegion, SAV.Country, SAV.ConsoleRegion, SAV.OT, SAV.Gender);
}

746
SAV/SAV_SimpleTrainer.Designer.cs generated Normal file
View file

@ -0,0 +1,746 @@
namespace PKHeX
{
partial class SAV_SimpleTrainer
{
/// <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.groupBox2 = new System.Windows.Forms.GroupBox();
this.L_Started = new System.Windows.Forms.Label();
this.CAL_AdventureStartDate = new System.Windows.Forms.DateTimePicker();
this.CAL_HoFDate = new System.Windows.Forms.DateTimePicker();
this.L_LastSaved = new System.Windows.Forms.Label();
this.MT_Seconds = new System.Windows.Forms.MaskedTextBox();
this.MT_Hours = new System.Windows.Forms.MaskedTextBox();
this.L_Seconds = new System.Windows.Forms.Label();
this.L_Hours = new System.Windows.Forms.Label();
this.MT_Minutes = new System.Windows.Forms.MaskedTextBox();
this.L_Minutes = new System.Windows.Forms.Label();
this.CAL_AdventureStartTime = new System.Windows.Forms.DateTimePicker();
this.CAL_HoFTime = new System.Windows.Forms.DateTimePicker();
this.TB_OTName = new System.Windows.Forms.TextBox();
this.CB_Gender = new System.Windows.Forms.ComboBox();
this.L_TrainerName = new System.Windows.Forms.Label();
this.L_TID = new System.Windows.Forms.Label();
this.MT_Money = new System.Windows.Forms.MaskedTextBox();
this.L_SID = new System.Windows.Forms.Label();
this.L_Money = new System.Windows.Forms.Label();
this.MT_TID = new System.Windows.Forms.MaskedTextBox();
this.MT_SID = new System.Windows.Forms.MaskedTextBox();
this.B_MaxCash = new System.Windows.Forms.Button();
this.GB_Map = new System.Windows.Forms.GroupBox();
this.NUD_Z = new System.Windows.Forms.NumericUpDown();
this.NUD_M = new System.Windows.Forms.NumericUpDown();
this.NUD_Y = new System.Windows.Forms.NumericUpDown();
this.NUD_X = new System.Windows.Forms.NumericUpDown();
this.L_Y = new System.Windows.Forms.Label();
this.L_CurrentMap = new System.Windows.Forms.Label();
this.L_Z = new System.Windows.Forms.Label();
this.L_X = new System.Windows.Forms.Label();
this.B_Save = new System.Windows.Forms.Button();
this.B_Cancel = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.CHK_H8 = new System.Windows.Forms.CheckBox();
this.CHK_H7 = new System.Windows.Forms.CheckBox();
this.CHK_H6 = new System.Windows.Forms.CheckBox();
this.CHK_H5 = new System.Windows.Forms.CheckBox();
this.CHK_H4 = new System.Windows.Forms.CheckBox();
this.CHK_H3 = new System.Windows.Forms.CheckBox();
this.CHK_H2 = new System.Windows.Forms.CheckBox();
this.CHK_H1 = new System.Windows.Forms.CheckBox();
this.CHK_8 = new System.Windows.Forms.CheckBox();
this.CHK_7 = new System.Windows.Forms.CheckBox();
this.CHK_6 = new System.Windows.Forms.CheckBox();
this.CHK_5 = new System.Windows.Forms.CheckBox();
this.CHK_4 = new System.Windows.Forms.CheckBox();
this.CHK_3 = new System.Windows.Forms.CheckBox();
this.CHK_2 = new System.Windows.Forms.CheckBox();
this.CHK_1 = new System.Windows.Forms.CheckBox();
this.groupBox2.SuspendLayout();
this.GB_Map.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_Z)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_M)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_Y)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_X)).BeginInit();
this.groupBox1.SuspendLayout();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// groupBox2
//
this.groupBox2.Controls.Add(this.L_Started);
this.groupBox2.Controls.Add(this.CAL_AdventureStartDate);
this.groupBox2.Controls.Add(this.CAL_HoFDate);
this.groupBox2.Controls.Add(this.L_LastSaved);
this.groupBox2.Controls.Add(this.MT_Seconds);
this.groupBox2.Controls.Add(this.MT_Hours);
this.groupBox2.Controls.Add(this.L_Seconds);
this.groupBox2.Controls.Add(this.L_Hours);
this.groupBox2.Controls.Add(this.MT_Minutes);
this.groupBox2.Controls.Add(this.L_Minutes);
this.groupBox2.Controls.Add(this.CAL_AdventureStartTime);
this.groupBox2.Controls.Add(this.CAL_HoFTime);
this.groupBox2.Location = new System.Drawing.Point(12, 98);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(200, 151);
this.groupBox2.TabIndex = 70;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Adventure Info";
//
// L_Started
//
this.L_Started.Location = new System.Drawing.Point(4, 51);
this.L_Started.Name = "L_Started";
this.L_Started.Size = new System.Drawing.Size(80, 20);
this.L_Started.TabIndex = 36;
this.L_Started.Text = "Game Started:";
this.L_Started.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// CAL_AdventureStartDate
//
this.CAL_AdventureStartDate.Format = System.Windows.Forms.DateTimePickerFormat.Short;
this.CAL_AdventureStartDate.Location = new System.Drawing.Point(90, 51);
this.CAL_AdventureStartDate.MaxDate = new System.DateTime(2050, 12, 31, 0, 0, 0, 0);
this.CAL_AdventureStartDate.MinDate = new System.DateTime(2000, 1, 1, 0, 0, 0, 0);
this.CAL_AdventureStartDate.Name = "CAL_AdventureStartDate";
this.CAL_AdventureStartDate.Size = new System.Drawing.Size(99, 20);
this.CAL_AdventureStartDate.TabIndex = 35;
this.CAL_AdventureStartDate.Value = new System.DateTime(2000, 1, 1, 0, 0, 0, 0);
//
// CAL_HoFDate
//
this.CAL_HoFDate.Format = System.Windows.Forms.DateTimePickerFormat.Short;
this.CAL_HoFDate.Location = new System.Drawing.Point(90, 107);
this.CAL_HoFDate.MaxDate = new System.DateTime(4095, 12, 31, 0, 0, 0, 0);
this.CAL_HoFDate.Name = "CAL_HoFDate";
this.CAL_HoFDate.Size = new System.Drawing.Size(99, 20);
this.CAL_HoFDate.TabIndex = 31;
this.CAL_HoFDate.Value = new System.DateTime(2000, 1, 1, 0, 0, 0, 0);
//
// L_LastSaved
//
this.L_LastSaved.Location = new System.Drawing.Point(4, 107);
this.L_LastSaved.Name = "L_LastSaved";
this.L_LastSaved.Size = new System.Drawing.Size(80, 20);
this.L_LastSaved.TabIndex = 32;
this.L_LastSaved.Text = "Hall of Fame:";
this.L_LastSaved.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// MT_Seconds
//
this.MT_Seconds.Location = new System.Drawing.Point(166, 17);
this.MT_Seconds.Mask = "00";
this.MT_Seconds.Name = "MT_Seconds";
this.MT_Seconds.Size = new System.Drawing.Size(22, 20);
this.MT_Seconds.TabIndex = 28;
this.MT_Seconds.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// MT_Hours
//
this.MT_Hours.Location = new System.Drawing.Point(44, 17);
this.MT_Hours.Mask = "00000";
this.MT_Hours.Name = "MT_Hours";
this.MT_Hours.Size = new System.Drawing.Size(38, 20);
this.MT_Hours.TabIndex = 25;
this.MT_Hours.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// L_Seconds
//
this.L_Seconds.AutoSize = true;
this.L_Seconds.Location = new System.Drawing.Point(136, 20);
this.L_Seconds.Name = "L_Seconds";
this.L_Seconds.Size = new System.Drawing.Size(29, 13);
this.L_Seconds.TabIndex = 30;
this.L_Seconds.Text = "Sec:";
//
// L_Hours
//
this.L_Hours.AutoSize = true;
this.L_Hours.Location = new System.Drawing.Point(12, 20);
this.L_Hours.Name = "L_Hours";
this.L_Hours.Size = new System.Drawing.Size(26, 13);
this.L_Hours.TabIndex = 26;
this.L_Hours.Text = "Hrs:";
//
// MT_Minutes
//
this.MT_Minutes.Location = new System.Drawing.Point(111, 17);
this.MT_Minutes.Mask = "00";
this.MT_Minutes.Name = "MT_Minutes";
this.MT_Minutes.Size = new System.Drawing.Size(22, 20);
this.MT_Minutes.TabIndex = 27;
this.MT_Minutes.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// L_Minutes
//
this.L_Minutes.AutoSize = true;
this.L_Minutes.Location = new System.Drawing.Point(84, 20);
this.L_Minutes.Name = "L_Minutes";
this.L_Minutes.Size = new System.Drawing.Size(27, 13);
this.L_Minutes.TabIndex = 29;
this.L_Minutes.Text = "Min:";
//
// CAL_AdventureStartTime
//
this.CAL_AdventureStartTime.CustomFormat = "hh:mm tt";
this.CAL_AdventureStartTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.CAL_AdventureStartTime.Location = new System.Drawing.Point(116, 70);
this.CAL_AdventureStartTime.MaxDate = new System.DateTime(2050, 12, 31, 0, 0, 0, 0);
this.CAL_AdventureStartTime.MinDate = new System.DateTime(2000, 1, 1, 0, 0, 0, 0);
this.CAL_AdventureStartTime.Name = "CAL_AdventureStartTime";
this.CAL_AdventureStartTime.ShowUpDown = true;
this.CAL_AdventureStartTime.Size = new System.Drawing.Size(73, 20);
this.CAL_AdventureStartTime.TabIndex = 34;
this.CAL_AdventureStartTime.Value = new System.DateTime(2001, 1, 1, 0, 0, 0, 0);
//
// CAL_HoFTime
//
this.CAL_HoFTime.CustomFormat = "hh:mm tt";
this.CAL_HoFTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.CAL_HoFTime.Location = new System.Drawing.Point(116, 126);
this.CAL_HoFTime.MaxDate = new System.DateTime(2050, 12, 31, 0, 0, 0, 0);
this.CAL_HoFTime.MinDate = new System.DateTime(2000, 1, 1, 0, 0, 0, 0);
this.CAL_HoFTime.Name = "CAL_HoFTime";
this.CAL_HoFTime.ShowUpDown = true;
this.CAL_HoFTime.Size = new System.Drawing.Size(73, 20);
this.CAL_HoFTime.TabIndex = 37;
this.CAL_HoFTime.Value = new System.DateTime(2001, 1, 1, 0, 0, 0, 0);
//
// TB_OTName
//
this.TB_OTName.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.TB_OTName.Location = new System.Drawing.Point(99, 11);
this.TB_OTName.MaxLength = 12;
this.TB_OTName.Name = "TB_OTName";
this.TB_OTName.Size = new System.Drawing.Size(93, 20);
this.TB_OTName.TabIndex = 57;
this.TB_OTName.Text = "WWWWWWWWWWWW";
this.TB_OTName.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// CB_Gender
//
this.CB_Gender.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CB_Gender.FormattingEnabled = true;
this.CB_Gender.Items.AddRange(new object[] {
"♂",
"♀"});
this.CB_Gender.Location = new System.Drawing.Point(99, 55);
this.CB_Gender.Name = "CB_Gender";
this.CB_Gender.Size = new System.Drawing.Size(40, 21);
this.CB_Gender.TabIndex = 68;
//
// L_TrainerName
//
this.L_TrainerName.Location = new System.Drawing.Point(7, 13);
this.L_TrainerName.Name = "L_TrainerName";
this.L_TrainerName.Size = new System.Drawing.Size(87, 16);
this.L_TrainerName.TabIndex = 58;
this.L_TrainerName.Text = "Name:";
this.L_TrainerName.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// L_TID
//
this.L_TID.Location = new System.Drawing.Point(9, 35);
this.L_TID.Name = "L_TID";
this.L_TID.Size = new System.Drawing.Size(38, 13);
this.L_TID.TabIndex = 61;
this.L_TID.Text = "TID:";
this.L_TID.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// MT_Money
//
this.MT_Money.Location = new System.Drawing.Point(119, 33);
this.MT_Money.Mask = "0000000";
this.MT_Money.Name = "MT_Money";
this.MT_Money.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.MT_Money.Size = new System.Drawing.Size(52, 20);
this.MT_Money.TabIndex = 59;
this.MT_Money.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// L_SID
//
this.L_SID.Location = new System.Drawing.Point(9, 58);
this.L_SID.Name = "L_SID";
this.L_SID.Size = new System.Drawing.Size(38, 13);
this.L_SID.TabIndex = 62;
this.L_SID.Text = "SID:";
this.L_SID.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// L_Money
//
this.L_Money.AutoSize = true;
this.L_Money.Location = new System.Drawing.Point(102, 36);
this.L_Money.Name = "L_Money";
this.L_Money.Size = new System.Drawing.Size(16, 13);
this.L_Money.TabIndex = 60;
this.L_Money.Text = "$:";
//
// MT_TID
//
this.MT_TID.Location = new System.Drawing.Point(53, 34);
this.MT_TID.Mask = "00000";
this.MT_TID.Name = "MT_TID";
this.MT_TID.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.MT_TID.Size = new System.Drawing.Size(39, 20);
this.MT_TID.TabIndex = 63;
this.MT_TID.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.MT_TID.TextChanged += new System.EventHandler(this.changeFFFF);
//
// MT_SID
//
this.MT_SID.Location = new System.Drawing.Point(53, 55);
this.MT_SID.Mask = "00000";
this.MT_SID.Name = "MT_SID";
this.MT_SID.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.MT_SID.Size = new System.Drawing.Size(39, 20);
this.MT_SID.TabIndex = 64;
this.MT_SID.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.MT_SID.TextChanged += new System.EventHandler(this.changeFFFF);
//
// B_MaxCash
//
this.B_MaxCash.Location = new System.Drawing.Point(172, 33);
this.B_MaxCash.Name = "B_MaxCash";
this.B_MaxCash.Size = new System.Drawing.Size(20, 20);
this.B_MaxCash.TabIndex = 66;
this.B_MaxCash.Text = "+";
this.B_MaxCash.UseVisualStyleBackColor = true;
//
// GB_Map
//
this.GB_Map.Controls.Add(this.NUD_Z);
this.GB_Map.Controls.Add(this.NUD_M);
this.GB_Map.Controls.Add(this.NUD_Y);
this.GB_Map.Controls.Add(this.NUD_X);
this.GB_Map.Controls.Add(this.L_Y);
this.GB_Map.Controls.Add(this.L_CurrentMap);
this.GB_Map.Controls.Add(this.L_Z);
this.GB_Map.Controls.Add(this.L_X);
this.GB_Map.Location = new System.Drawing.Point(218, 100);
this.GB_Map.Name = "GB_Map";
this.GB_Map.Size = new System.Drawing.Size(157, 125);
this.GB_Map.TabIndex = 71;
this.GB_Map.TabStop = false;
this.GB_Map.Text = "Map Position";
//
// NUD_Z
//
this.NUD_Z.Location = new System.Drawing.Point(93, 68);
this.NUD_Z.Maximum = new decimal(new int[] {
65535,
0,
0,
0});
this.NUD_Z.Minimum = new decimal(new int[] {
65535,
0,
0,
-2147483648});
this.NUD_Z.Name = "NUD_Z";
this.NUD_Z.Size = new System.Drawing.Size(50, 20);
this.NUD_Z.TabIndex = 53;
//
// NUD_M
//
this.NUD_M.Location = new System.Drawing.Point(93, 16);
this.NUD_M.Maximum = new decimal(new int[] {
1000,
0,
0,
0});
this.NUD_M.Name = "NUD_M";
this.NUD_M.Size = new System.Drawing.Size(50, 20);
this.NUD_M.TabIndex = 52;
//
// NUD_Y
//
this.NUD_Y.Location = new System.Drawing.Point(93, 94);
this.NUD_Y.Maximum = new decimal(new int[] {
65535,
0,
0,
0});
this.NUD_Y.Name = "NUD_Y";
this.NUD_Y.Size = new System.Drawing.Size(50, 20);
this.NUD_Y.TabIndex = 51;
//
// NUD_X
//
this.NUD_X.Location = new System.Drawing.Point(93, 42);
this.NUD_X.Maximum = new decimal(new int[] {
65535,
0,
0,
0});
this.NUD_X.Name = "NUD_X";
this.NUD_X.Size = new System.Drawing.Size(50, 20);
this.NUD_X.TabIndex = 50;
//
// L_Y
//
this.L_Y.Location = new System.Drawing.Point(6, 94);
this.L_Y.Name = "L_Y";
this.L_Y.Size = new System.Drawing.Size(80, 20);
this.L_Y.TabIndex = 49;
this.L_Y.Text = "Y Coordinate:";
this.L_Y.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// L_CurrentMap
//
this.L_CurrentMap.Location = new System.Drawing.Point(6, 16);
this.L_CurrentMap.Name = "L_CurrentMap";
this.L_CurrentMap.Size = new System.Drawing.Size(80, 20);
this.L_CurrentMap.TabIndex = 46;
this.L_CurrentMap.Text = "Current Map:";
this.L_CurrentMap.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// L_Z
//
this.L_Z.Location = new System.Drawing.Point(6, 68);
this.L_Z.Name = "L_Z";
this.L_Z.Size = new System.Drawing.Size(80, 20);
this.L_Z.TabIndex = 48;
this.L_Z.Text = "Z Coordinate:";
this.L_Z.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// L_X
//
this.L_X.Location = new System.Drawing.Point(6, 42);
this.L_X.Name = "L_X";
this.L_X.Size = new System.Drawing.Size(80, 20);
this.L_X.TabIndex = 47;
this.L_X.Text = "X Coordinate:";
this.L_X.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// B_Save
//
this.B_Save.Location = new System.Drawing.Point(300, 226);
this.B_Save.Name = "B_Save";
this.B_Save.Size = new System.Drawing.Size(75, 23);
this.B_Save.TabIndex = 73;
this.B_Save.Text = "Save";
this.B_Save.UseVisualStyleBackColor = true;
this.B_Save.Click += new System.EventHandler(this.B_Save_Click);
//
// B_Cancel
//
this.B_Cancel.Location = new System.Drawing.Point(219, 226);
this.B_Cancel.Name = "B_Cancel";
this.B_Cancel.Size = new System.Drawing.Size(75, 23);
this.B_Cancel.TabIndex = 72;
this.B_Cancel.Text = "Cancel";
this.B_Cancel.UseVisualStyleBackColor = true;
this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.TB_OTName);
this.groupBox1.Controls.Add(this.B_MaxCash);
this.groupBox1.Controls.Add(this.MT_SID);
this.groupBox1.Controls.Add(this.MT_TID);
this.groupBox1.Controls.Add(this.L_Money);
this.groupBox1.Controls.Add(this.L_SID);
this.groupBox1.Controls.Add(this.CB_Gender);
this.groupBox1.Controls.Add(this.MT_Money);
this.groupBox1.Controls.Add(this.L_TID);
this.groupBox1.Controls.Add(this.L_TrainerName);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(200, 82);
this.groupBox1.TabIndex = 74;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Trainer";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.CHK_H8);
this.groupBox3.Controls.Add(this.CHK_H7);
this.groupBox3.Controls.Add(this.CHK_H6);
this.groupBox3.Controls.Add(this.CHK_H5);
this.groupBox3.Controls.Add(this.CHK_H4);
this.groupBox3.Controls.Add(this.CHK_H3);
this.groupBox3.Controls.Add(this.CHK_H2);
this.groupBox3.Controls.Add(this.CHK_H1);
this.groupBox3.Controls.Add(this.CHK_8);
this.groupBox3.Controls.Add(this.CHK_7);
this.groupBox3.Controls.Add(this.CHK_6);
this.groupBox3.Controls.Add(this.CHK_5);
this.groupBox3.Controls.Add(this.CHK_4);
this.groupBox3.Controls.Add(this.CHK_3);
this.groupBox3.Controls.Add(this.CHK_2);
this.groupBox3.Controls.Add(this.CHK_1);
this.groupBox3.Location = new System.Drawing.Point(219, 12);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(157, 82);
this.groupBox3.TabIndex = 75;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Badges";
//
// CHK_H8
//
this.CHK_H8.AutoSize = true;
this.CHK_H8.Location = new System.Drawing.Point(130, 55);
this.CHK_H8.Name = "CHK_H8";
this.CHK_H8.Size = new System.Drawing.Size(15, 14);
this.CHK_H8.TabIndex = 15;
this.CHK_H8.UseVisualStyleBackColor = true;
this.CHK_H8.Visible = false;
//
// CHK_H7
//
this.CHK_H7.AutoSize = true;
this.CHK_H7.Location = new System.Drawing.Point(113, 55);
this.CHK_H7.Name = "CHK_H7";
this.CHK_H7.Size = new System.Drawing.Size(15, 14);
this.CHK_H7.TabIndex = 14;
this.CHK_H7.UseVisualStyleBackColor = true;
this.CHK_H7.Visible = false;
//
// CHK_H6
//
this.CHK_H6.AutoSize = true;
this.CHK_H6.Location = new System.Drawing.Point(96, 55);
this.CHK_H6.Name = "CHK_H6";
this.CHK_H6.Size = new System.Drawing.Size(15, 14);
this.CHK_H6.TabIndex = 13;
this.CHK_H6.UseVisualStyleBackColor = true;
this.CHK_H6.Visible = false;
//
// CHK_H5
//
this.CHK_H5.AutoSize = true;
this.CHK_H5.Location = new System.Drawing.Point(79, 55);
this.CHK_H5.Name = "CHK_H5";
this.CHK_H5.Size = new System.Drawing.Size(15, 14);
this.CHK_H5.TabIndex = 12;
this.CHK_H5.UseVisualStyleBackColor = true;
this.CHK_H5.Visible = false;
//
// CHK_H4
//
this.CHK_H4.AutoSize = true;
this.CHK_H4.Location = new System.Drawing.Point(62, 55);
this.CHK_H4.Name = "CHK_H4";
this.CHK_H4.Size = new System.Drawing.Size(15, 14);
this.CHK_H4.TabIndex = 11;
this.CHK_H4.UseVisualStyleBackColor = true;
this.CHK_H4.Visible = false;
//
// CHK_H3
//
this.CHK_H3.AutoSize = true;
this.CHK_H3.Location = new System.Drawing.Point(45, 55);
this.CHK_H3.Name = "CHK_H3";
this.CHK_H3.Size = new System.Drawing.Size(15, 14);
this.CHK_H3.TabIndex = 10;
this.CHK_H3.UseVisualStyleBackColor = true;
this.CHK_H3.Visible = false;
//
// CHK_H2
//
this.CHK_H2.AutoSize = true;
this.CHK_H2.Location = new System.Drawing.Point(28, 55);
this.CHK_H2.Name = "CHK_H2";
this.CHK_H2.Size = new System.Drawing.Size(15, 14);
this.CHK_H2.TabIndex = 9;
this.CHK_H2.UseVisualStyleBackColor = true;
this.CHK_H2.Visible = false;
//
// CHK_H1
//
this.CHK_H1.AutoSize = true;
this.CHK_H1.Location = new System.Drawing.Point(11, 55);
this.CHK_H1.Name = "CHK_H1";
this.CHK_H1.Size = new System.Drawing.Size(15, 14);
this.CHK_H1.TabIndex = 8;
this.CHK_H1.UseVisualStyleBackColor = true;
this.CHK_H1.Visible = false;
//
// CHK_8
//
this.CHK_8.AutoSize = true;
this.CHK_8.Location = new System.Drawing.Point(130, 27);
this.CHK_8.Name = "CHK_8";
this.CHK_8.Size = new System.Drawing.Size(15, 14);
this.CHK_8.TabIndex = 7;
this.CHK_8.UseVisualStyleBackColor = true;
this.CHK_8.Visible = false;
//
// CHK_7
//
this.CHK_7.AutoSize = true;
this.CHK_7.Location = new System.Drawing.Point(113, 27);
this.CHK_7.Name = "CHK_7";
this.CHK_7.Size = new System.Drawing.Size(15, 14);
this.CHK_7.TabIndex = 6;
this.CHK_7.UseVisualStyleBackColor = true;
this.CHK_7.Visible = false;
//
// CHK_6
//
this.CHK_6.AutoSize = true;
this.CHK_6.Location = new System.Drawing.Point(96, 27);
this.CHK_6.Name = "CHK_6";
this.CHK_6.Size = new System.Drawing.Size(15, 14);
this.CHK_6.TabIndex = 5;
this.CHK_6.UseVisualStyleBackColor = true;
this.CHK_6.Visible = false;
//
// CHK_5
//
this.CHK_5.AutoSize = true;
this.CHK_5.Location = new System.Drawing.Point(79, 27);
this.CHK_5.Name = "CHK_5";
this.CHK_5.Size = new System.Drawing.Size(15, 14);
this.CHK_5.TabIndex = 4;
this.CHK_5.UseVisualStyleBackColor = true;
this.CHK_5.Visible = false;
//
// CHK_4
//
this.CHK_4.AutoSize = true;
this.CHK_4.Location = new System.Drawing.Point(62, 27);
this.CHK_4.Name = "CHK_4";
this.CHK_4.Size = new System.Drawing.Size(15, 14);
this.CHK_4.TabIndex = 3;
this.CHK_4.UseVisualStyleBackColor = true;
this.CHK_4.Visible = false;
//
// CHK_3
//
this.CHK_3.AutoSize = true;
this.CHK_3.Location = new System.Drawing.Point(45, 27);
this.CHK_3.Name = "CHK_3";
this.CHK_3.Size = new System.Drawing.Size(15, 14);
this.CHK_3.TabIndex = 2;
this.CHK_3.UseVisualStyleBackColor = true;
this.CHK_3.Visible = false;
//
// CHK_2
//
this.CHK_2.AutoSize = true;
this.CHK_2.Location = new System.Drawing.Point(28, 27);
this.CHK_2.Name = "CHK_2";
this.CHK_2.Size = new System.Drawing.Size(15, 14);
this.CHK_2.TabIndex = 1;
this.CHK_2.UseVisualStyleBackColor = true;
this.CHK_2.Visible = false;
//
// CHK_1
//
this.CHK_1.AutoSize = true;
this.CHK_1.Location = new System.Drawing.Point(11, 27);
this.CHK_1.Name = "CHK_1";
this.CHK_1.Size = new System.Drawing.Size(15, 14);
this.CHK_1.TabIndex = 0;
this.CHK_1.UseVisualStyleBackColor = true;
this.CHK_1.Visible = false;
//
// SAV_SimpleTrainer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(386, 261);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.B_Save);
this.Controls.Add(this.B_Cancel);
this.Controls.Add(this.GB_Map);
this.Controls.Add(this.groupBox2);
this.Name = "SAV_SimpleTrainer";
this.Text = "Trainer Data Editor";
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.GB_Map.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.NUD_Z)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_M)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_Y)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_X)).EndInit();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label L_Started;
private System.Windows.Forms.DateTimePicker CAL_AdventureStartDate;
private System.Windows.Forms.DateTimePicker CAL_HoFDate;
private System.Windows.Forms.Label L_LastSaved;
private System.Windows.Forms.MaskedTextBox MT_Seconds;
private System.Windows.Forms.MaskedTextBox MT_Hours;
private System.Windows.Forms.Label L_Seconds;
private System.Windows.Forms.Label L_Hours;
private System.Windows.Forms.MaskedTextBox MT_Minutes;
private System.Windows.Forms.Label L_Minutes;
private System.Windows.Forms.DateTimePicker CAL_AdventureStartTime;
private System.Windows.Forms.DateTimePicker CAL_HoFTime;
private System.Windows.Forms.TextBox TB_OTName;
private System.Windows.Forms.ComboBox CB_Gender;
private System.Windows.Forms.Label L_TrainerName;
private System.Windows.Forms.Label L_TID;
private System.Windows.Forms.MaskedTextBox MT_Money;
private System.Windows.Forms.Label L_SID;
private System.Windows.Forms.Label L_Money;
private System.Windows.Forms.MaskedTextBox MT_TID;
private System.Windows.Forms.MaskedTextBox MT_SID;
private System.Windows.Forms.Button B_MaxCash;
private System.Windows.Forms.GroupBox GB_Map;
private System.Windows.Forms.NumericUpDown NUD_Z;
private System.Windows.Forms.NumericUpDown NUD_M;
private System.Windows.Forms.NumericUpDown NUD_Y;
private System.Windows.Forms.NumericUpDown NUD_X;
private System.Windows.Forms.Label L_Y;
private System.Windows.Forms.Label L_CurrentMap;
private System.Windows.Forms.Label L_Z;
private System.Windows.Forms.Label L_X;
private System.Windows.Forms.Button B_Save;
private System.Windows.Forms.Button B_Cancel;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.CheckBox CHK_8;
private System.Windows.Forms.CheckBox CHK_7;
private System.Windows.Forms.CheckBox CHK_6;
private System.Windows.Forms.CheckBox CHK_5;
private System.Windows.Forms.CheckBox CHK_4;
private System.Windows.Forms.CheckBox CHK_3;
private System.Windows.Forms.CheckBox CHK_2;
private System.Windows.Forms.CheckBox CHK_1;
private System.Windows.Forms.CheckBox CHK_H8;
private System.Windows.Forms.CheckBox CHK_H7;
private System.Windows.Forms.CheckBox CHK_H6;
private System.Windows.Forms.CheckBox CHK_H5;
private System.Windows.Forms.CheckBox CHK_H4;
private System.Windows.Forms.CheckBox CHK_H3;
private System.Windows.Forms.CheckBox CHK_H2;
private System.Windows.Forms.CheckBox CHK_H1;
}
}

136
SAV/SAV_SimpleTrainer.cs Normal file
View file

@ -0,0 +1,136 @@
using System;
using System.Linq;
using System.Windows.Forms;
namespace PKHeX
{
public partial class SAV_SimpleTrainer : Form
{
public SAV_SimpleTrainer()
{
InitializeComponent();
Util.TranslateInterface(this, Main.curlanguage);
cba = new[] {CHK_1, CHK_2, CHK_3, CHK_4, CHK_5, CHK_6, CHK_7, CHK_8};
TB_OTName.MaxLength = SAV.OTLength;
B_MaxCash.Click += (sender, e) => MT_Money.Text = "9,999,999";
TB_OTName.Text = SAV.OT;
CB_Gender.SelectedIndex = SAV.Gender;
MT_TID.Text = SAV.TID.ToString("00000");
MT_SID.Text = SAV.SID.ToString("00000");
MT_Money.Text = SAV.Money.ToString();
int badgeval = 0;
if (SAV is SAV4)
{
SAV4 s = (SAV4)SAV;
NUD_M.Value = s.M;
NUD_X.Value = s.X;
NUD_Z.Value = s.Z;
NUD_Y.Value = s.Y;
badgeval = s.Badges;
if (s.Version == GameVersion.HGSS)
{
badgeval |= s.Badges16 << 8;
cba = cba.Concat(new[] {CHK_H1, CHK_H2, CHK_H3, CHK_H4, CHK_H5, CHK_H6, CHK_H7, CHK_H8}).ToArray();
}
}
else if (SAV is SAV5)
{
SAV5 s = (SAV5)SAV;
NUD_M.Value = s.M;
NUD_X.Value = s.X;
NUD_Z.Value = s.Z;
NUD_Y.Value = s.Y;
badgeval = s.Badges;
}
for (int i = 0; i < cba.Length; i++)
{
cba[i].Visible = true;
cba[i].Checked = (badgeval & 1 << i) != 0;
}
MT_Hours.Text = SAV.PlayedHours.ToString();
MT_Minutes.Text = SAV.PlayedMinutes.ToString();
MT_Seconds.Text = SAV.PlayedSeconds.ToString();
CAL_HoFDate.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToFame);
CAL_HoFTime.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToFame % 86400);
CAL_AdventureStartDate.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToStart);
CAL_AdventureStartTime.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToStart % 86400);
}
private readonly CheckBox[] cba;
private readonly SaveFile SAV = Main.SAV.Clone();
private void changeFFFF(object sender, EventArgs e)
{
MaskedTextBox box = sender as MaskedTextBox;
if (box.Text == "") box.Text = "0";
if (Util.ToInt32(box.Text) > 65535) box.Text = "65535";
}
private void B_Save_Click(object sender, EventArgs e)
{
SAV.OT = TB_OTName.Text;
SAV.Gender = (byte)CB_Gender.SelectedIndex;
SAV.TID = (ushort)Util.ToUInt32(MT_TID.Text);
SAV.SID = (ushort)Util.ToUInt32(MT_SID.Text);
SAV.Money = Util.ToUInt32(MT_Money.Text);
// Copy Badges
int badgeval = 0;
for (int i = 0; i < cba.Length; i++)
badgeval |= (cba[i].Checked ? 1 : 0) << i;
if (SAV is SAV4)
{
SAV4 s = (SAV4)SAV;
s.M = (int)NUD_M.Value;
s.X = (int)NUD_X.Value;
s.Z = (int)NUD_Z.Value;
s.Y = (int)NUD_Y.Value;
s.Badges = badgeval & 0xFF;
if (s.Version == GameVersion.HGSS)
{
s.Badges16 = badgeval >> 8;
}
}
else if (SAV is SAV5)
{
SAV5 s = (SAV5)SAV;
s.M = (int)NUD_M.Value;
s.X = (int)NUD_X.Value;
s.Z = (int)NUD_Z.Value;
s.Y = (int)NUD_Y.Value;
s.Badges = badgeval & 0xFF;
}
// Save PlayTime
SAV.PlayedHours = ushort.Parse(MT_Hours.Text);
SAV.PlayedMinutes = ushort.Parse(MT_Minutes.Text) % 60;
SAV.PlayedSeconds = ushort.Parse(MT_Seconds.Text) % 60;
SAV.SecondsToStart = getSeconds(CAL_AdventureStartDate, CAL_AdventureStartTime);
SAV.SecondsToFame = getSeconds(CAL_HoFDate, CAL_HoFTime);
SAV.Data.CopyTo(Main.SAV.Data, 0);
Main.SAV.Edited = true;
Close();
}
private void B_Cancel_Click(object sender, EventArgs e)
{
Close();
}
private int getSeconds(DateTimePicker date, DateTimePicker time)
{
int val = (int)(date.Value - new DateTime(2000, 1, 1)).TotalSeconds;
val -= val % 86400;
val += (int)(time.Value - new DateTime(2000, 1, 1)).TotalSeconds;
return val;
}
}
}

120
SAV/SAV_SimpleTrainer.resx Normal file
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>

View file

@ -8,14 +8,14 @@ namespace PKHeX
public override string BAKName => $"{FileName} [{OT} ({Version})" +/* - {LastSavedTime}*/ "].bak";
public override string Filter => (Footer.Length > 0 ? "DeSmuME DSV|*.dsv|" : "") + "SAV File|*.sav";
public override string Extension => ".sav";
public SAV4(byte[] data = null)
public SAV4(byte[] data = null, int versionOverride = -1)
{
Data = data == null ? new byte[SaveUtil.SIZE_G4RAW] : (byte[])data.Clone();
BAK = (byte[])Data.Clone();
Exportable = !Data.SequenceEqual(new byte[Data.Length]);
// Get Version
SaveVersion = Math.Max(SaveUtil.getIsG4SAV(Data), 0); // Empty file default to DP
SaveVersion = versionOverride > -1 ? versionOverride : Math.Max(SaveUtil.getIsG4SAV(Data), 0); // Empty file default to DP
getActiveBlock();
getSAVOffsets();
@ -27,7 +27,7 @@ namespace PKHeX
public readonly int SaveVersion;
public override byte[] BAK { get; }
public override bool Exportable { get; }
public override SaveFile Clone() { return new SAV4(Data); }
public override SaveFile Clone() { return new SAV4(Data, SaveVersion); }
public override int SIZE_STORED => PKX.SIZE_4STORED;
public override int SIZE_PARTY => PKX.SIZE_4PARTY;
@ -313,7 +313,7 @@ namespace PKHeX
}
// Trainer Info
protected override GameVersion Version
public override GameVersion Version
{
get
{
@ -356,7 +356,7 @@ namespace PKHeX
get { return BitConverter.ToUInt16(Data, Trainer1 + 0x12); }
set { BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x12); }
}
public uint Money
public override uint Money
{
get { return BitConverter.ToUInt32(Data, Trainer1 + 0x14); }
set { BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x14); }
@ -398,17 +398,17 @@ namespace PKHeX
Data[Trainer1 + 0x1F] = (byte)value;
}
}
public int PlayedHours
public override int PlayedHours
{
get { return BitConverter.ToUInt16(Data, Trainer1 + 0x22); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, Trainer1 + 0x22); }
}
public int PlayedMinutes
public override int PlayedMinutes
{
get { return Data[Trainer1 + 0x24]; }
set { Data[Trainer1 + 0x24] = (byte)value; }
}
public int PlayedSeconds
public override int PlayedSeconds
{
get { return Data[Trainer1 + 0x25]; }
set { Data[Trainer1 + 0x25] = (byte)value; }
@ -527,8 +527,8 @@ namespace PKHeX
}
}
}
public int SecondsToStart { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x34); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x34); } }
public int SecondsToFame { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x3C); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x3C); } }
public override int SecondsToStart { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x34); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x34); } }
public override int SecondsToFame { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x3C); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x3C); } }
// Storage
public int UnlockedBoxes

View file

@ -10,14 +10,14 @@ namespace PKHeX
public override string BAKName => $"{FileName} [{OT} ({Version})" +/* - {LastSavedTime}*/ "].bak";
public override string Filter => (Footer.Length > 0 ? "DeSmuME DSV|*.dsv|" : "") + "SAV File|*.sav";
public override string Extension => ".sav";
public SAV5(byte[] data = null)
public SAV5(byte[] data = null, int versionOverride = -1)
{
Data = data == null ? new byte[SaveUtil.SIZE_G5RAW] : (byte[])data.Clone();
BAK = (byte[])Data.Clone();
Exportable = !Data.SequenceEqual(new byte[Data.Length]);
// Get Version
SaveVersion = SaveUtil.getIsG5SAV(Data);
SaveVersion = versionOverride > -1 ? versionOverride : SaveUtil.getIsG5SAV(Data);
if (SaveVersion < 0) // Invalidate Data
Data = null;
@ -81,7 +81,7 @@ namespace PKHeX
private int SaveVersion { get; set; }
public override byte[] BAK { get; }
public override bool Exportable { get; }
public override SaveFile Clone() { return new SAV5(Data); }
public override SaveFile Clone() { return new SAV5(Data, SaveVersion); }
public override int SIZE_STORED => PKX.SIZE_5STORED;
public override int SIZE_PARTY => PKX.SIZE_5PARTY;
@ -508,7 +508,7 @@ namespace PKHeX
protected override MysteryGift[] MysteryGiftCards { get { return new MysteryGift[0]; } set { } }
// Trainer Info
protected override GameVersion Version
public override GameVersion Version
{
get
{
@ -541,7 +541,7 @@ namespace PKHeX
get { return BitConverter.ToUInt16(Data, Trainer1 + 0x14 + 2); }
set { BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x14 + 2); }
}
public uint Money
public override uint Money
{
get { return BitConverter.ToUInt32(Data, Trainer2); }
set { BitConverter.GetBytes(value).CopyTo(Data, Trainer2); }
@ -587,22 +587,22 @@ namespace PKHeX
set { BitConverter.GetBytes(value * 18).CopyTo(Data, Trainer1 + 0x18E); }
}
public int PlayedHours
public override int PlayedHours
{
get { return BitConverter.ToUInt16(Data, Trainer1 + 0x24); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, Trainer1 + 0x24); }
}
public int PlayedMinutes
public override int PlayedMinutes
{
get { return Data[Trainer1 + 0x24 + 2]; }
set { Data[Trainer1 + 0x24 + 2] = (byte)value; }
}
public int PlayedSeconds
public override int PlayedSeconds
{
get { return Data[Trainer1 + 0x24 + 3]; }
set { Data[Trainer1 + 0x24 + 3] = (byte)value; }
}
public int SecondsToStart { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x34); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x34); } }
public int SecondsToFame { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x3C); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x3C); } }
public override int SecondsToStart { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x34); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x34); } }
public override int SecondsToFame { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x3C); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x3C); } }
}
}

View file

@ -270,7 +270,7 @@ namespace PKHeX
public int Spinda { get; private set; } = int.MinValue;
public int EncounterCount { get; private set; } = int.MinValue;
protected override GameVersion Version
public override GameVersion Version
{
get
{
@ -392,7 +392,7 @@ namespace PKHeX
get { return Data[Trainer1 + 0x14D]; }
set { Data[Trainer1 + 0x14D] = (byte)value; }
}
public uint Money
public override uint Money
{
get { return BitConverter.ToUInt32(Data, Trainer2 + 0x8); }
set { BitConverter.GetBytes(value).CopyTo(Data, Trainer2 + 0x8); }
@ -433,16 +433,17 @@ namespace PKHeX
}
}
public int PlayedHours{
public override int PlayedHours
{
get { return BitConverter.ToUInt16(Data, PlayTime); }
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, PlayTime); }
}
public int PlayedMinutes
public override int PlayedMinutes
{
get { return Data[PlayTime + 2]; }
set { Data[PlayTime + 2] = (byte)value; }
}
public int PlayedSeconds
public override int PlayedSeconds
{
get { return Data[PlayTime + 3]; }
set { Data[PlayTime + 3] = (byte)value; }
@ -461,8 +462,8 @@ namespace PKHeX
public int ResumeHour { get { return Data[AdventureInfo + 0xB]; } set { Data[AdventureInfo + 0xB] = (byte)value; } }
public int ResumeMinute { get { return Data[AdventureInfo + 0xC]; } set { Data[AdventureInfo + 0xC] = (byte)value; } }
public int ResumeSeconds { get { return Data[AdventureInfo + 0xD]; } set { Data[AdventureInfo + 0xD] = (byte)value; } }
public int SecondsToStart { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x18); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x18); } }
public int SecondsToFame { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x20); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x20); } }
public override int SecondsToStart { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x18); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x18); } }
public override int SecondsToFame { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x20); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x20); } }
public uint getPSSStat(int index) { return BitConverter.ToUInt32(Data, PSSStats + 4*index); }
public void setPSSStat(int index, uint value) { BitConverter.GetBytes(value).CopyTo(Data, PSSStats + 4*index); }

View file

@ -40,7 +40,7 @@ namespace PKHeX
}
public virtual string MiscSaveChecks() { return ""; }
public virtual string MiscSaveInfo() { return ""; }
protected abstract GameVersion Version { get; }
public abstract GameVersion Version { get; }
public abstract bool ChecksumsValid { get; }
public abstract string ChecksumInfo { get; }
public abstract int Generation { get; }
@ -282,6 +282,12 @@ namespace PKHeX
public abstract ushort TID { get; set; }
public abstract ushort SID { get; set; }
public abstract string OT { get; set; }
public abstract int PlayedHours { get; set; }
public abstract int PlayedMinutes { get; set; }
public abstract int PlayedSeconds { get; set; }
public abstract int SecondsToStart { get; set; }
public abstract int SecondsToFame { get; set; }
public abstract uint Money { get; set; }
public abstract int BoxCount { get; }
public abstract int PartyCount { get; protected set; }
public virtual int CurrentBox { get { return 0; } set { } }