mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-27 00:14:09 -05:00
Box io update
This commit is contained in:
18
PKX/f1-Main.Designer.cs
generated
18
PKX/f1-Main.Designer.cs
generated
@@ -304,6 +304,7 @@ public void InitializeComponent()
|
||||
this.subepkx2 = new System.Windows.Forms.PictureBox();
|
||||
this.subepkx3 = new System.Windows.Forms.PictureBox();
|
||||
this.Tab_Tools = new System.Windows.Forms.TabPage();
|
||||
this.B_SaveBoxBin = new System.Windows.Forms.Button();
|
||||
this.B_3DSSETemp = new System.Windows.Forms.Button();
|
||||
this.B_JPEG = new System.Windows.Forms.Button();
|
||||
this.RTB_T = new System.Windows.Forms.RichTextBox();
|
||||
@@ -3718,6 +3719,7 @@ public void InitializeComponent()
|
||||
//
|
||||
// Tab_Tools
|
||||
//
|
||||
this.Tab_Tools.Controls.Add(this.B_SaveBoxBin);
|
||||
this.Tab_Tools.Controls.Add(this.B_3DSSETemp);
|
||||
this.Tab_Tools.Controls.Add(this.B_JPEG);
|
||||
this.Tab_Tools.Controls.Add(this.RTB_T);
|
||||
@@ -3729,9 +3731,19 @@ public void InitializeComponent()
|
||||
this.Tab_Tools.Text = "Tools";
|
||||
this.Tab_Tools.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// B_SaveBoxBin
|
||||
//
|
||||
this.B_SaveBoxBin.Location = new System.Drawing.Point(122, 20);
|
||||
this.B_SaveBoxBin.Name = "B_SaveBoxBin";
|
||||
this.B_SaveBoxBin.Size = new System.Drawing.Size(75, 45);
|
||||
this.B_SaveBoxBin.TabIndex = 8;
|
||||
this.B_SaveBoxBin.Text = "Save Box Data++";
|
||||
this.B_SaveBoxBin.UseVisualStyleBackColor = true;
|
||||
this.B_SaveBoxBin.Click += new System.EventHandler(this.B_SaveBoxBin_Click);
|
||||
//
|
||||
// B_3DSSETemp
|
||||
//
|
||||
this.B_3DSSETemp.Location = new System.Drawing.Point(49, 20);
|
||||
this.B_3DSSETemp.Location = new System.Drawing.Point(32, 20);
|
||||
this.B_3DSSETemp.Name = "B_3DSSETemp";
|
||||
this.B_3DSSETemp.Size = new System.Drawing.Size(75, 45);
|
||||
this.B_3DSSETemp.TabIndex = 7;
|
||||
@@ -3742,7 +3754,7 @@ public void InitializeComponent()
|
||||
// B_JPEG
|
||||
//
|
||||
this.B_JPEG.Enabled = false;
|
||||
this.B_JPEG.Location = new System.Drawing.Point(178, 20);
|
||||
this.B_JPEG.Location = new System.Drawing.Point(198, 20);
|
||||
this.B_JPEG.Name = "B_JPEG";
|
||||
this.B_JPEG.Size = new System.Drawing.Size(75, 45);
|
||||
this.B_JPEG.TabIndex = 5;
|
||||
@@ -3785,7 +3797,6 @@ public void InitializeComponent()
|
||||
this.L_SAVManipulation.Size = new System.Drawing.Size(117, 13);
|
||||
this.L_SAVManipulation.TabIndex = 7;
|
||||
this.L_SAVManipulation.Text = "Save File Manipulation:";
|
||||
this.L_SAVManipulation.Click += new System.EventHandler(this.L_SAVManipulation_Click);
|
||||
//
|
||||
// B_SwitchSAV
|
||||
//
|
||||
@@ -4448,6 +4459,7 @@ public void InitializeComponent()
|
||||
private System.Windows.Forms.PictureBox dragout;
|
||||
public System.Windows.Forms.ComboBox CB_Species;
|
||||
public System.Windows.Forms.CheckBox CHK_IsEgg;
|
||||
private System.Windows.Forms.Button B_SaveBoxBin;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -538,18 +538,19 @@ private void openFile(byte[] input, string path, string ext)
|
||||
}
|
||||
#endregion
|
||||
#region Box Data
|
||||
else if (input.Length == 0xE8 * 30 && BitConverter.ToUInt16(input, 4) == 0 && BitConverter.ToUInt32(input , 0) > 0)
|
||||
{ Array.Copy(input, 4, savefile, SaveGame.Box + 0xE8 * 30 * C_BoxSelect.SelectedIndex, input.Length); setPKXBoxes(); Util.Alert("Box Binary loaded."); }
|
||||
else if ((input.Length == 0xE8 * 30 || input.Length == 0xE8 * 30 * 31) && BitConverter.ToUInt16(input, 4) == 0 && BitConverter.ToUInt32(input , 8) > 0)
|
||||
{ Array.Copy(input, 0, savefile, SaveGame.Box + 0xE8 * 30 * ((input.Length == 0xE8*30) ? C_BoxSelect.SelectedIndex : 0), input.Length); setPKXBoxes(); Util.Alert("Box Binary loaded."); }
|
||||
#endregion
|
||||
#region injectiondebug
|
||||
else if (input.Length == 0x10000 && input[3] == 0)
|
||||
else if (input.Length == 0x10000)
|
||||
{
|
||||
int offset = -1;
|
||||
for (int i = 0; i < 0x300; i++)
|
||||
for (int i = 0; i < 0x800; i++)
|
||||
{
|
||||
byte[] data = PKX.decryptArray(input.Skip(i).Take(0xE8).ToArray());
|
||||
if (PKX.getCHK(data) == BitConverter.ToUInt16(data, 6)) { offset = i; break; }
|
||||
}
|
||||
if (offset < 0) { Util.Alert(path, "Unable to read the input file; not an expected injectiondebug.bin."); return; }
|
||||
C_BoxSelect.SelectedIndex = 0;
|
||||
Array.Copy(input, offset, savefile, SaveGame.Box + 0xE8 * 30 * C_BoxSelect.SelectedIndex, 9 * 30 * 0xE8);
|
||||
setPKXBoxes();
|
||||
@@ -2935,9 +2936,7 @@ private void clickVerifySHA(object sender, EventArgs e)
|
||||
}
|
||||
}
|
||||
private void clickExportSAV(object sender, EventArgs e)
|
||||
{
|
||||
if (ModifierKeys == Keys.Control) { exportBox(); return; }
|
||||
|
||||
{
|
||||
// Create another version of the save file.
|
||||
byte[] editedsav = new byte[0x100000];
|
||||
Array.Copy(savefile, editedsav, savefile.Length);
|
||||
@@ -4078,9 +4077,19 @@ private void loadBoxesFromDB(string path)
|
||||
Util.Alert(result);
|
||||
}
|
||||
}
|
||||
private void exportBox()
|
||||
private void B_SaveBoxBin_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Util.Prompt(MessageBoxButtons.YesNo, String.Format("Export {1}?" + Environment.NewLine + "(Box {0})", C_BoxSelect.SelectedIndex + 1, C_BoxSelect.Text)) == DialogResult.Yes)
|
||||
DialogResult dr = Util.Prompt(MessageBoxButtons.YesNoCancel, "Yes: Export All Boxes" + Environment.NewLine + String.Format("No: Export {1} (Box {0})", C_BoxSelect.SelectedIndex + 1, C_BoxSelect.Text) + Environment.NewLine + "Cancel: Abort");
|
||||
|
||||
if (dr == DialogResult.Yes)
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.Filter = "Box Data|*.bin";
|
||||
sfd.FileName = "pcdata.bin";
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
File.WriteAllBytes(sfd.FileName, savefile.Skip(SaveGame.Box).Take(0xE8 * 30 * 31).ToArray());
|
||||
}
|
||||
if (dr == DialogResult.No)
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.Filter = "Box Data|*.bin";
|
||||
@@ -4089,10 +4098,6 @@ private void exportBox()
|
||||
File.WriteAllBytes(sfd.FileName, savefile.Skip(SaveGame.Box + 0xE8 * 30 * C_BoxSelect.SelectedIndex).Take(0xE8 * 30).ToArray());
|
||||
}
|
||||
}
|
||||
private void L_SAVManipulation_Click(object sender, EventArgs e)
|
||||
{
|
||||
exportBox();
|
||||
}
|
||||
// Subfunction Save Buttons //
|
||||
private void B_OpenWondercards_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@@ -452,5 +452,6 @@ http://projectpokemon.org/forums/showthread.php?36986
|
||||
- Fixed: Boxes are now always initialized with encrypted empty slots (for those without loaded saves).
|
||||
- Changed: Export Box descriptive text to be more obvious on what it was exporting. Access by clicking on the Save Manipulation label above Export SAV.
|
||||
|
||||
1/26/15 - New Update:
|
||||
- Added: injectiondebug.bin loading, by popular request.
|
||||
1/26/15 - New Update: (6200+)
|
||||
- Added: injectiondebug.bin loading, by popular request.
|
||||
- Changed: Improved injectiondebug checking.
|
||||
Reference in New Issue
Block a user