Example #1
0
 private static List <StorageSlotOffset> GetExtraSlots4(SAV4 sav)
 {
     return(new List <StorageSlotOffset>
     {
         new StorageSlotOffset {
             Type = StorageSlotType.GTS, Offset = sav.GTS
         },
     });
 }
Example #2
0
        public PoffinCase4(SAV4 sav)
        {
            SAV = sav;
            if (SAV.HGSS)
            {
                throw new ArgumentException(nameof(SAV));
            }

            Offset  = SAV.DP ? 0x5050 : 0x52E8;
            Poffins = ReadPoffins(SAV, Offset);
        }
Example #3
0
        public Mail4(SAV4 sav, int index)
        {
            switch (sav.Version)
            {
            case GameVersion.DP: DataOffset = (index * SIZE) + 0x4BEC + sav.GBO; break;

            case GameVersion.Pt: DataOffset = (index * SIZE) + 0x4E80 + sav.GBO; break;

            case GameVersion.HGSS: DataOffset = (index * SIZE) + 0x3FA8 + sav.GBO; break;
            }
            Data = sav.GetData(DataOffset, SIZE);
        }
Example #4
0
        public Mail4(SAV4 sav, int index)
        {
            switch (sav.Version)
            {
            case GameVersion.DP: DataOffset = (index * SIZE) + 0x4BEC; break;

            case GameVersion.Pt: DataOffset = (index * SIZE) + 0x4E80; break;

            case GameVersion.HGSS: DataOffset = (index * SIZE) + 0x3FA8; break;
            }
            Data = sav.General.Slice(DataOffset, SIZE);
        }
Example #5
0
 private static List <SlotInfoMisc> GetExtraSlotsUnsafe(SaveFile sav, bool all)
 {
     return(sav switch
     {
         SAV2 sav2 => GetExtraSlots2(sav2),
         SAV3 sav3 => GetExtraSlots3(sav3),
         SAV4 sav4 => GetExtraSlots4(sav4),
         SAV5 sav5 => GetExtraSlots5(sav5),
         SAV6XY xy => GetExtraSlots6XY(xy),
         SAV6AO xy => GetExtraSlots6AO(xy),
         SAV7 sav7 => GetExtraSlots7(sav7, all),
         _ => None
     });
Example #6
0
        /// <summary>Creates an instance of a SaveFile using the given save data.</summary>
        /// <param name="data">Save data from which to create a SaveFile.</param>
        /// <returns>An appropriate type of save file for the given data, or null if the save data is invalid.</returns>
        public static SaveFile getVariantSAV(byte[] data)
        {
            // Pre-check for header/footer signatures
            SaveFile sav;

            byte[] header = new byte[0], footer = new byte[0];
            CheckHeaderFooter(ref data, ref header, ref footer);

            switch (getSAVGeneration(data))
            {
            // Main Games
            case GameVersion.Gen1:      sav = new SAV1(data); break;

            case GameVersion.Gen2:      sav = new SAV2(data); break;

            case GameVersion.Gen3:      sav = new SAV3(data); break;

            case GameVersion.Gen4:      sav = new SAV4(data); break;

            case GameVersion.Gen5:      sav = new SAV5(data); break;

            case GameVersion.Gen6:      sav = new SAV6(data); break;

            case GameVersion.Gen7:      sav = new SAV7(data); break;

            // Side Games
            case GameVersion.COLO:      sav = new SAV3Colosseum(data); break;

            case GameVersion.XD:        sav = new SAV3XD(data); break;

            case GameVersion.RSBOX:     sav = new SAV3RSBox(data); break;

            case GameVersion.BATREV:    sav = new SAV4BR(data); break;

            // No pattern matched
            default: return(null);
            }
            sav.Header = header;
            sav.Footer = footer;
            return(sav);
        }
Example #7
0
 public Zukan4(SAV4 sav, int offset) : base(sav, offset)
 {
     Data   = sav.General;
     Offset = offset;
 }
Example #8
0
        /// <summary>Creates an instance of a SaveFile using the given save data.</summary>
        /// <param name="data">Save data from which to create a SaveFile.</param>
        /// <returns>An appropriate type of save file for the given data, or null if the save data is invalid.</returns>
        public static SaveFile getVariantSAV(byte[] data)
        {
            // Pre-check for header/footer signatures
            SaveFile sav;
            byte[] header = new byte[0], footer = new byte[0];
            CheckHeaderFooter(ref data, ref header, ref footer);

            switch (getSAVGeneration(data))
            {
                // Main Games
                case GameVersion.Gen1:      sav = new SAV1(data); break;
                case GameVersion.Gen2:      sav = new SAV2(data); break;
                case GameVersion.Gen3:      sav = new SAV3(data); break;
                case GameVersion.Gen4:      sav = new SAV4(data); break;
                case GameVersion.Gen5:      sav = new SAV5(data); break;
                case GameVersion.Gen6:      sav = new SAV6(data); break;
                case GameVersion.Gen7:      sav = new SAV7(data); break;

                // Side Games
                case GameVersion.COLO:      sav = new SAV3Colosseum(data); break;
                case GameVersion.XD:        sav = new SAV3XD(data); break;
                case GameVersion.RSBOX:     sav = new SAV3RSBox(data); break;
                case GameVersion.BATREV:    sav = new SAV4BR(data); break;
                
                // No pattern matched
                default: return null;
            }
            sav.Header = header;
            sav.Footer = footer;
            return sav;
        }