Switching daycare and finish ORAS PS

Powersaves will now load properly if the save is readable.
This commit is contained in:
Kurt
2014-12-28 13:56:59 -08:00
parent d03307985d
commit 4337bf0379

View File

@@ -161,6 +161,7 @@ public Form1()
GB_OT.Click += clickGT;
GB_nOT.Click += clickGT;
GB_Daycare.Click += switchDaycare;
TB_Nickname.Font = PKX.getPKXFont(11F);
// Close splash screen.
@@ -580,7 +581,7 @@ private void open1MB(byte[] input, string path, string GameType, bool oras)
Array.Copy(savefile, 0x43C - 1 * 0x130, realHash2, 0, 0x20);
B_SwitchSAV.Enabled = (hashValue1.SequenceEqual(realHash1) && hashValue2.SequenceEqual(realHash2));
getSAVOffsets(); // to detect if we are ORAS or not
getSAVOffsets(ref oras); // to detect if we are ORAS or not
Array.Copy(savefile, 0x5400 + 0x7F000 * savindex, cyberSAV, 0, cyberSAV.Length);
openSave(oras);
@@ -3179,7 +3180,7 @@ private void clickExportSAV(object sender, EventArgs e)
}
}
}
// Box/SAV Functions //
// Box/SAV Functions //
private void clickBoxRight(object sender, EventArgs e)
{
if (C_BoxSelect.SelectedIndex < 30)
@@ -3597,12 +3598,12 @@ private void setSAVLabel()
L_SAVINDEX.Text = (savindex + 1).ToString();
RTB_S.AppendText("Loaded Save File " + (savindex + 1).ToString() + Environment.NewLine);
}
private void getSAVOffsets()
private void getSAVOffsets(ref bool oras)
{
// Get the save file offsets for the input game
bool enableInterface = false;
if (BitConverter.ToUInt32(savefile, 0x6A810 + 0x7F000 * savindex) == 0x42454546)
{
{
enableInterface = true;
SaveGame = new PKX.Structures.SaveGame("XY");
}
@@ -3610,7 +3611,7 @@ private void getSAVOffsets()
{
enableInterface = true;
SaveGame = new PKX.Structures.SaveGame("ORAS");
savegame_oras = true;
oras = true;
}
else
{
@@ -3814,6 +3815,15 @@ private void getTSV(object sender, EventArgs e)
uint psv = PKX.getPSV(Util.getHEXval(TB_PID));
Tip3.SetToolTip(this.TB_PID, "PSV: " + psv.ToString("0000"));
}
private void switchDaycare(object sender, EventArgs e)
{
if (!savegame_oras) return;
// If ORAS, alter the daycare offset via toggle.
SaveGame.Daycare = (SaveGame.Daycare == 0x21000) ? 0x211F0 : 0x21000;
// Refresh Boxes
setPKXBoxes();
}
private void mainMenuBoxDumpLoad(object sender, EventArgs e)
{
DialogResult dr = Util.Prompt(MessageBoxButtons.YesNoCancel, "Press Yes to Import All from Folder." + Environment.NewLine + "Press No to Dump All to Folder.", "Press Cancel to Abort.");