Add new lengths

new format still crashes as block absolute index is now different
should do a different way of loading blocks (key instead of index)
This commit is contained in:
Kurt 2020-01-09 08:17:41 -08:00
parent 0dd4d1fe7a
commit bbd1aff5fe
4 changed files with 7 additions and 8 deletions

View file

@ -74,7 +74,7 @@ namespace PKHeX.Core
/// <returns>True if hash matches</returns>
public static bool GetIsHashValid(byte[] data)
{
if (data.Length != SaveUtil.SIZE_G8SWSH)
if (data.Length != SaveUtil.SIZE_G8SWSH && data.Length != SaveUtil.SIZE_G8SWSH_1)
return false;
var hash = ComputeHash(data);

View file

@ -17,6 +17,7 @@ namespace PKHeX.Core
public const int BEEF = 0x42454546;
public const int SIZE_G8SWSH = 0x1716B3;
public const int SIZE_G8SWSH_1 = 0x17195E;
public const int SIZE_G7GG = 0x100000;
public const int SIZE_G7USUM = 0x6CC00;
public const int SIZE_G7SM = 0x6BE00;
@ -60,7 +61,7 @@ namespace PKHeX.Core
private static readonly HashSet<int> SIZES = new HashSet<int>(SIZES_2)
{
SIZE_G8SWSH,
SIZE_G8SWSH, SIZE_G8SWSH_1,
SIZE_G7SM, SIZE_G7USUM, SIZE_G7GG,
SIZE_G6XY, SIZE_G6ORAS, SIZE_G6ORASDEMO,
SIZE_G5RAW, SIZE_G5BW, SIZE_G5B2W2,
@ -443,7 +444,7 @@ namespace PKHeX.Core
/// <returns>Version Identifier or Invalid if type cannot be determined.</returns>
private static GameVersion GetIsG8SAV(byte[] data)
{
if (data.Length != SIZE_G8SWSH)
if (data.Length != SIZE_G8SWSH && data.Length != SIZE_G8SWSH_1)
return Invalid;
return SwishCrypto.GetIsHashValid(data) ? SWSH : Invalid;

View file

@ -80,7 +80,7 @@ namespace PKHeX.Core
{
if (length <= 0x100000)
return false;
if (length == SaveUtil.SIZE_G4BR || length == SaveUtil.SIZE_G8SWSH)
if (length == SaveUtil.SIZE_G4BR || length == SaveUtil.SIZE_G8SWSH ||length == SaveUtil.SIZE_G8SWSH_1)
return false;
if (SAV3GCMemoryCard.IsMemoryCardSize(length))
return false; // pbr/GC have size > 1MB

View file

@ -73,8 +73,8 @@ namespace PKHeX.WinForms.Controls
private void SavePartyStats(PKM pk)
{
Stats.SavePartyStats(pk);
pk.Stat_Level = CurrentLevel;
}
pk.Stat_Level = Util.ToInt32((HaX ? MT_Level : TB_Level).Text);
}
public PKM CurrentPKM { get => PreparePKM(); set => Entity = value; }
public bool ModifyPKM { private get; set; } = true;
@ -102,7 +102,6 @@ namespace PKHeX.WinForms.Controls
public PKM Entity { get; private set; }
public bool FieldsLoaded { get; private set; }
public bool ChangingFields { get; set; }
public int CurrentLevel => Util.ToInt32((HaX ? MT_Level : TB_Level).Text);
private GameVersion origintrack;
private Action GetFieldsfromPKM;
@ -121,7 +120,6 @@ namespace PKHeX.WinForms.Controls
private readonly PictureBox[] movePB, relearnPB;
public SaveFile RequestSaveFile => SaveFileRequested?.Invoke(this, EventArgs.Empty);
public bool PKMIsUnsaved => FieldsLoaded && LastData?.Any(b => b != 0) == true && !LastData.SequenceEqual(CurrentPKM.Data);
public bool IsEmptyOrEgg => CHK_IsEgg.Checked || CB_Species.SelectedIndex == 0;
private readonly ComboBox[] Moves, Relearn, ValidationRequired, PPUps;
private readonly MaskedTextBox[] MovePP;