private void Initialize(byte[] File)
        {
            PointerOffset = EndianUtils.SwapEndian(BitConverter.ToInt32(File, 0x0C));

            LocationTileTableJPN = PointerOffset + EndianUtils.SwapEndian(BitConverter.ToInt32(File, 0x156DC));
            LocationTileTableENG = PointerOffset + EndianUtils.SwapEndian(BitConverter.ToInt32(File, 0x15710));

            LocationOffsetTableJPN = PointerOffset + EndianUtils.SwapEndian(BitConverter.ToInt32(File, 0x156E4));
            LocationOffsetTableENG = 0x04 + PointerOffset + EndianUtils.SwapEndian(BitConverter.ToInt32(File, 0x15718));                 // increment by 4 so we don't have to check if we're on JPN or ENG later, those two originally point to the exact same location

            LocationInfoTable = PointerOffset + EndianUtils.SwapEndian(BitConverter.ToInt32(File, 0x156BC));

            // 0x188 / 8 -> 0x31, not sure where in file it's set but whatever
            InfoAmount = 0x31;

            TownMapInfos = new TownMapInfo[InfoAmount];

            for (int i = 0; i < InfoAmount; i++)
            {
                int OffsetLocation   = LocationOffsetTableJPN + (i * 0x08);
                int TilesToSkip      = EndianUtils.SwapEndian(BitConverter.ToInt32(File, OffsetLocation));
                int TilesLocationJPN = LocationTileTableJPN + (TilesToSkip * 0x20);
                OffsetLocation = LocationOffsetTableENG + (i * 0x08);
                TilesToSkip    = EndianUtils.SwapEndian(BitConverter.ToInt32(File, OffsetLocation));
                int TilesLocationENG = LocationTileTableENG + (TilesToSkip * 0x20);

                int InfoLocation = LocationInfoTable + (i * 0xAC);

                TownMapInfos[i] = new TownMapInfo(File, TilesLocationJPN, TilesLocationENG, InfoLocation);
            }
        }
 public UInt64 Timestamp2;         // in microseconds
 public TropUsrSingleTrophy(byte[] File, uint Offset)
 {
     TrophyID          = EndianUtils.SwapEndian(BitConverter.ToUInt32(File, (int)(Offset + 0x08)));
     TrophyIDDuplicate = EndianUtils.SwapEndian(BitConverter.ToUInt32(File, (int)(Offset + 0x10)));
     Unlocked          = EndianUtils.SwapEndian(BitConverter.ToUInt32(File, (int)(Offset + 0x14)));
     Timestamp1        = EndianUtils.SwapEndian(BitConverter.ToUInt64(File, (int)(Offset + 0x20)));
     Timestamp2        = EndianUtils.SwapEndian(BitConverter.ToUInt64(File, (int)(Offset + 0x28)));
 }
Esempio n. 3
0
        public byte[] SerializeScript()
        {
            List <byte> bytes = new List <byte>(Entry.Length);

            foreach (uint e in Entry)
            {
                bytes.AddRange(System.BitConverter.GetBytes(EndianUtils.SwapEndian(e)));
            }
            return(bytes.ToArray());
        }
        public TSSFile TSS = null;         // access for GetEntry()/ToString()

        public CreditsInfoSingle(CreditsInfo Credits, int offset, byte[] file)
        {
            this.Credits = Credits;
            this.Offset  = offset;
            this.Data    = new UInt32[Size / 4];
            for (int i = 0; i < Size / 4; ++i)
            {
                Data[i] = EndianUtils.SwapEndian(BitConverter.ToUInt32(file, offset + i * 0x04));
            }

            return;
        }
Esempio n. 5
0
        public TownMapTile(byte[] File, int Pointer)
        {
            Time           = EndianUtils.SwapEndian(BitConverter.ToInt32(File, Pointer));
            XTextureOffset = EndianUtils.SwapEndian(BitConverter.ToInt32(File, Pointer + 0x04));
            YTextureOffset = EndianUtils.SwapEndian(BitConverter.ToInt32(File, Pointer + 0x08));
            XSize          = EndianUtils.SwapEndian(BitConverter.ToInt32(File, Pointer + 0x0C));
            YSize          = EndianUtils.SwapEndian(BitConverter.ToInt32(File, Pointer + 0x10));
            XDisplayOffset = EndianUtils.SwapEndian(BitConverter.ToInt32(File, Pointer + 0x14));
            YDisplayOffset = EndianUtils.SwapEndian(BitConverter.ToInt32(File, Pointer + 0x18));
            Unknown        = EndianUtils.SwapEndian(BitConverter.ToInt32(File, Pointer + 0x1C));

            this.Pointer = Pointer;
        }
Esempio n. 6
0
        public TropUsr(byte[] File)
        {
            this.File = File;

            TrophyAmount  = EndianUtils.SwapEndian(BitConverter.ToUInt32(File, 0xDC));
            UserInfoStart = EndianUtils.SwapEndian(BitConverter.ToUInt32(File, 0x144));
            UserInfoSize  = 0x70;

            TrophyInfos = new Dictionary <uint, TropUsrSingleTrophy>((int)TrophyAmount);

            for (uint i = 0; i < TrophyAmount; i++)
            {
                TropUsrSingleTrophy TrophyInfo = new TropUsrSingleTrophy(File, UserInfoStart + (i * UserInfoSize));
                TrophyInfos.Add(TrophyInfo.TrophyID, TrophyInfo);
            }
        }
Esempio n. 7
0
        public static int Execute(List <string> args)
        {
            if (args.Count != 1)
            {
                Console.WriteLine("Usage: SPKDunpack file");
                return(-1);
            }

            byte[] spkd = File.ReadAllBytes(args[0]);

            uint FileAmount = EndianUtils.SwapEndian(BitConverter.ToUInt32(spkd, 4));
            uint BlockSize  = EndianUtils.SwapEndian(BitConverter.ToUInt32(spkd, 12));

            FileData[] FileInfos = new FileData[FileAmount + 1];

            for (int i = 0; i < FileAmount; i++)
            {
                FileInfos[i]            = new FileData();
                FileInfos[i].Name       = ASCIIEncoding.GetEncoding(0).GetString(spkd, (i + 1) * (int)BlockSize, 16);
                FileInfos[i].Name       = FileInfos[i].Name.Substring(0, FileInfos[i].Name.IndexOf('\0'));
                FileInfos[i].Unknown    = EndianUtils.SwapEndian(BitConverter.ToUInt32(spkd, (i + 1) * (int)BlockSize + 16));
                FileInfos[i].FileStart1 = EndianUtils.SwapEndian(BitConverter.ToUInt32(spkd, (i + 1) * (int)BlockSize + 20));
                FileInfos[i].FileStart2 = EndianUtils.SwapEndian(BitConverter.ToUInt32(spkd, (i + 1) * (int)BlockSize + 24));
                FileInfos[i].Something  = EndianUtils.SwapEndian(BitConverter.ToUInt32(spkd, (i + 1) * (int)BlockSize + 28));
            }
            FileInfos[FileAmount]            = new FileData();
            FileInfos[FileAmount].FileStart1 = (UInt32)spkd.Length;

            DirectoryInfo d = System.IO.Directory.CreateDirectory(args[0] + ".ext");

            for (int i = 0; i < FileAmount; i++)
            {
                int    Filesize = (int)FileInfos[i + 1].FileStart1 - (int)FileInfos[i].FileStart1;
                byte[] b        = new byte[Filesize];
                Buffer.BlockCopy(spkd, (int)FileInfos[i].FileStart1, b, 0, Filesize);
                File.WriteAllBytes(d.FullName + "\\" + FileInfos[i].Name, b);
            }

            return(0);
        }
Esempio n. 8
0
        private static int[] GetLocation(byte[] File, int Max, int Pointer)
        {
            byte[] PointerBytes = System.BitConverter.GetBytes(EndianUtils.SwapEndian((uint)Pointer));
            byte[] SearchBytes  = new byte[] { 0x04, 0x0C, 0x00, 0x18, PointerBytes[0], PointerBytes[1], PointerBytes[2], PointerBytes[3] };

            List <int> PointerArrayList = new List <int>();

            for (int i = 0; i < Max; i++)
            {
                if (File[i] == SearchBytes[0] &&
                    File[i + 1] == SearchBytes[1] &&
                    File[i + 2] == SearchBytes[2] &&
                    File[i + 3] == SearchBytes[3] &&
                    File[i + 4] == SearchBytes[4] &&
                    File[i + 5] == SearchBytes[5] &&
                    File[i + 6] == SearchBytes[6] &&
                    File[i + 7] == SearchBytes[7])
                {
                    PointerArrayList.Add(i + 4);
                }
            }

            return(PointerArrayList.ToArray());
        }