예제 #1
0
        public SAV4(byte[] data = null, GameVersion versionOverride = GameVersion.Any)
        {
            Data       = data == null ? new byte[SaveUtil.SIZE_G4RAW] : (byte[])data.Clone();
            BAK        = (byte[])Data.Clone();
            Exportable = !Data.SequenceEqual(new byte[Data.Length]);

            // Get Version
            if (data == null)
            {
                Version = GameVersion.HGSS;
            }
            else if (versionOverride != GameVersion.Any)
            {
                Version = versionOverride;
            }
            else
            {
                Version = SaveUtil.GetIsG4SAV(Data);
            }
            if (Version == GameVersion.Invalid)
            {
                return;
            }

            GetActiveGeneralBlock();
            GetActiveStorageBlock();
            GetSAVOffsets();

            switch (Version)
            {
            case GameVersion.DP: Personal = PersonalTable.DP; break;

            case GameVersion.Pt: Personal = PersonalTable.Pt; break;

            case GameVersion.HGSS: Personal = PersonalTable.HGSS; break;
            }

            if (!Exportable)
            {
                ClearBoxes();
            }
        }