Send "chunk uninitialized detection" to class

yeah, get educated.
This commit is contained in:
Kurt
2015-10-24 16:52:25 -07:00
parent e85c57b35c
commit b1c0beff74
2 changed files with 26 additions and 18 deletions

View File

@@ -471,5 +471,28 @@ p.IsNicknamed ascending
for (int i = 0; i < len; i++)
setData(sorted[i], Box + i * PK6.SIZE_STORED);
}
// Writeback Validity
public string checkChunkFF()
{
string r = "";
byte[] FFFF = Enumerable.Repeat((byte)0xFF, 0x200).ToArray();
for (int i = 0; i < Data.Length / 0x200; i++)
{
if (!FFFF.SequenceEqual(Data.Skip(i * 0x200).Take(0x200))) continue;
r = String.Format("0x200 chunk @ 0x{0} is FF'd.", (i * 0x200).ToString("X5"))
+ Environment.NewLine + "Cyber will screw up (as of August 31st 2014)." + Environment.NewLine + Environment.NewLine;
// Check to see if it is in the Pokedex
if (i * 0x200 > PokeDex && i * 0x200 < PokeDex + 0x900)
{
r += "Problem lies in the Pokedex. ";
if (i * 0x200 == PokeDex + 0x400)
r += "Remove a language flag for a species < 585, ie Petilil";
}
break;
}
return r;
}
}
}

View File

@@ -2397,24 +2397,9 @@ private void clickExportSAV(object sender, EventArgs e)
byte[] sav = SAV.Write();
// Chunk Error Checking
byte[] FFFF = Enumerable.Repeat((byte)0xFF, 0x200).ToArray();
for (int i = 0; i < sav.Length / 0x200; i++)
{
if (!FFFF.SequenceEqual(sav.Skip(i*0x200).Take(0x200))) continue;
string problem = String.Format("0x200 chunk @ 0x{0} is FF'd.", (i * 0x200).ToString("X5"))
+ Environment.NewLine + "Cyber will screw up (as of August 31st)." + Environment.NewLine + Environment.NewLine;
// Check to see if it is in the Pokedex
if (i * 0x200 > SAV.PokeDex && i * 0x200 < SAV.PokeDex + 0x900)
{
problem += "Problem lies in the Pokedex. ";
if (i * 0x200 == SAV.PokeDex + 0x400)
problem += "Remove a language flag for a species ~ ex " + specieslist[548];
}
if (Util.Prompt(MessageBoxButtons.YesNo, problem, "Continue saving?") != DialogResult.Yes)
return;
}
string err = SAV.checkChunkFF();
if (err.Length > 0 && Util.Prompt(MessageBoxButtons.YesNo, err, "Continue saving?") != DialogResult.Yes)
return;
SaveFileDialog cySAV = new SaveFileDialog();
// Try for file path