Example #1
0
        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint strategySetCount = stream.ReadUInt32().SwapEndian();
            uint strategyOptionCount = stream.ReadUInt32().SwapEndian();
            uint refStringStart = stream.ReadUInt32().SwapEndian();

            StrategySetList = new List<StrategySet>( (int)strategySetCount );
            for ( uint i = 0; i < strategySetCount; ++i ) {
                StrategySet ss = new StrategySet( stream, refStringStart );
                StrategySetList.Add( ss );
            }
            StrategyOptionList = new List<StrategyOption>( (int)strategyOptionCount );
            for ( uint i = 0; i < strategyOptionCount; ++i ) {
                StrategyOption so = new StrategyOption( stream, refStringStart );
                StrategyOptionList.Add( so );
            }

            StrategyOptionDict = new Dictionary<uint, StrategyOption>( StrategyOptionList.Count );
            foreach ( var option in StrategyOptionList ) {
                StrategyOptionDict.Add( option.InGameID, option );
            }

            return true;
        }
Example #2
0
        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 4 );
            switch ( magic ) {
                case "G1TG": Endian = Util.Endianness.BigEndian; break;
                case "GT1G": Endian = Util.Endianness.LittleEndian; break;
                default: throw new Exception( "Not a g1t file!" );
            }

            uint version = stream.ReadUInt32().FromEndian( Endian );

            switch ( version ) {
                case 0x30303530: break;
                case 0x30303630: break;
                default: throw new Exception( "Unsupported g1t version!" );
            }

            uint fileSize = stream.ReadUInt32().FromEndian( Endian );
            uint headerSize = stream.ReadUInt32().FromEndian( Endian );
            uint numberTextures = stream.ReadUInt32().FromEndian( Endian );
            uint unknown = stream.ReadUInt32().FromEndian( Endian );

            stream.Position = headerSize;
            uint bytesUnknownData = stream.ReadUInt32().FromEndian( Endian );
            stream.Position = headerSize + bytesUnknownData;
            Textures = new List<g1tTexture>( (int)numberTextures );
            for ( uint i = 0; i < numberTextures; ++i ) {
                var g = new g1tTexture( stream, Endian );
                Textures.Add( g );
            }

            return true;
        }
Example #3
0
        private bool LoadFile( Stream stream, uint textPointerLocationDiff )
        {
            string magic = stream.ReadAscii( 8 );
            uint alwaysSame = stream.ReadUInt32().SwapEndian();
            uint filesize = stream.ReadUInt32().SwapEndian();

            uint lengthSection1 = stream.ReadUInt32().SwapEndian();

            stream.Position = 0x50;
            int textPointerDiffDiff = (int)stream.ReadUInt32().SwapEndian();
            stream.Position = 0x20;
            uint textStart = stream.ReadUInt32().SwapEndian();
            int textPointerDiff = (int)stream.ReadUInt32().SwapEndian() - textPointerDiffDiff;

            EntryList = new List<ScenarioFileEntry>();

            // i wonder what the actual logic behind this is...
            uint textPointersLocation = ( lengthSection1 + 0x80 ).Align( 0x10 ) + textPointerLocationDiff;
            // + 0x1888; // + 0x1B4C // diff of 2C4 // Actually this isn't constant, dammit.

            if ( textStart != textPointersLocation ) {
                stream.Position = textPointersLocation;

                while ( true ) {
                    long loc = stream.Position;
                    stream.DiscardBytes( 8 );
                    uint[] ptrs = new uint[4];
                    ptrs[0] = stream.ReadUInt32().SwapEndian();
                    ptrs[1] = stream.ReadUInt32().SwapEndian();
                    ptrs[2] = stream.ReadUInt32().SwapEndian();
                    ptrs[3] = stream.ReadUInt32().SwapEndian();

                    if ( stream.Position > textStart ) { break; }
                    if ( ptrs.Any( x => x == 0 ) ) { break; }
                    if ( ptrs.Any( x => x + textPointerDiff < textStart ) ) { break; }
                    if ( ptrs.Any( x => x + textPointerDiff >= filesize ) ) { break; }

                    var s = new ScenarioFileEntry();
                    s.Pointer = (uint)loc;
                    stream.Position = ptrs[0] + textPointerDiff;
                    s.JpName = stream.ReadShiftJisNullterm();
                    stream.Position = ptrs[1] + textPointerDiff;
                    s.JpText = stream.ReadShiftJisNullterm();
                    stream.Position = ptrs[2] + textPointerDiff;
                    s.EnName = stream.ReadShiftJisNullterm();
                    stream.Position = ptrs[3] + textPointerDiff;
                    s.EnText = stream.ReadShiftJisNullterm();
                    EntryList.Add( s );

                    stream.Position = loc + 0x18;
                }
            }

            return true;
        }
Example #4
0
        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint fileSize = stream.ReadUInt32().SwapEndian();
            uint skitInfoCount = stream.ReadUInt32().SwapEndian();
            uint skitInfoOffset = stream.ReadUInt32().SwapEndian();
            uint conditionForwarderCount = stream.ReadUInt32().SwapEndian();
            uint conditionForwarderOffset = stream.ReadUInt32().SwapEndian();
            uint conditionCount = stream.ReadUInt32().SwapEndian();
            uint conditionOffset = stream.ReadUInt32().SwapEndian();
            uint uCount4 = stream.ReadUInt32().SwapEndian();
            uint uOffset4 = stream.ReadUInt32().SwapEndian();
            uint uCount5 = stream.ReadUInt32().SwapEndian();
            uint uOffset5 = stream.ReadUInt32().SwapEndian();
            uint refStringStart = stream.ReadUInt32().SwapEndian();

            SkitInfoList = new List<SkitInfo>( (int)skitInfoCount );
            stream.Position = skitInfoOffset;
            for ( uint i = 0; i < skitInfoCount; ++i ) {
                SkitInfo s = new SkitInfo( stream, refStringStart );
                SkitInfoList.Add( s );
            }

            SkitConditionForwarderList = new List<SkitConditionForwarder>( (int)conditionForwarderCount );
            stream.Position = conditionForwarderOffset;
            for ( uint i = 0; i < conditionForwarderCount; ++i ) {
                var s = new SkitConditionForwarder( stream );
                SkitConditionForwarderList.Add( s );
            }

            SkitConditionList = new List<SkitCondition>( (int)conditionCount );
            stream.Position = conditionOffset;
            for ( uint i = 0; i < conditionCount; ++i ) {
                var s = new SkitCondition( stream );
                SkitConditionList.Add( s );
            }

            UnknownSkitData4List = new List<UnknownSkitData4>( (int)uCount4 );
            stream.Position = uOffset4;
            for ( uint i = 0; i < uCount4; ++i ) {
                var s = new UnknownSkitData4( stream );
                UnknownSkitData4List.Add( s );
            }

            UnknownSkitData5List = new List<UnknownSkitData5>( (int)uCount5 );
            stream.Position = uOffset5;
            for ( uint i = 0; i < uCount5; ++i ) {
                var s = new UnknownSkitData5( stream );
                UnknownSkitData5List.Add( s );
            }

            return true;
        }
Example #5
0
        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint blockCount = stream.ReadUInt32().SwapEndian();
            uint refStringStart = stream.ReadUInt32().SwapEndian();

            Blocks = new List<T8BTVABlock>( (int)blockCount );
            for ( uint i = 0; i < blockCount; ++i ) {
                Blocks.Add( new T8BTVABlock( stream, refStringStart ) );
            }

            return true;
        }
Example #6
0
        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint entryCount = stream.ReadUInt32().SwapEndian();
            uint refStringStart = stream.ReadUInt32().SwapEndian();

            GradeShopEntryList = new List<GradeShopEntry>( (int)entryCount );
            for ( uint i = 0; i < entryCount; ++i ) {
                GradeShopEntry e = new GradeShopEntry( stream, refStringStart );
                GradeShopEntryList.Add( e );
            }

            return true;
        }
Example #7
0
        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint unknown = stream.ReadUInt32().SwapEndian();
            uint recipeCount = stream.ReadUInt32().SwapEndian();

            RecipeList = new List<Recipe>( (int)recipeCount );
            for ( uint i = 0; i < recipeCount; ++i ) {
                Recipe r = new Recipe( stream );
                RecipeList.Add( r );
            }

            return true;
        }
Example #8
0
        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint unknown = stream.ReadUInt32().SwapEndian();
            uint titleCount = stream.ReadUInt32().SwapEndian();

            TitleList = new List<Title>( (int)titleCount );
            for ( uint i = 0; i < titleCount; ++i ) {
                Title t = new Title( stream );
                TitleList.Add( t );
            }

            return true;
        }
Example #9
0
        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint floorInfoCount = stream.ReadUInt32().SwapEndian();
            uint refStringStart = stream.ReadUInt32().SwapEndian();

            FloorList = new List<FloorInfo>( (int)floorInfoCount );
            for ( uint i = 0; i < floorInfoCount; ++i ) {
                FloorInfo fi = new FloorInfo( stream, refStringStart );
                FloorList.Add( fi );
            }

            return true;
        }
Example #10
0
        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint infoCount = stream.ReadUInt32().SwapEndian();
            uint refStringStart = stream.ReadUInt32().SwapEndian();

            TreasureInfoList = new List<TreasureInfo>( (int)infoCount );
            for ( uint i = 0; i < infoCount; ++i ) {
                TreasureInfo ti = new TreasureInfo( stream, refStringStart );
                TreasureInfoList.Add( ti );
            }

            return true;
        }
Example #11
0
        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint entrySize = stream.ReadUInt32().SwapEndian();
            uint synopsisCount = stream.ReadUInt32().SwapEndian();
            uint unknown = stream.ReadUInt32().SwapEndian();
            stream.DiscardBytes( 0xC );

            SynopsisList = new List<SynopsisEntry>( (int)synopsisCount );
            for ( uint i = 0; i < synopsisCount; ++i ) {
                SynopsisEntry l = new SynopsisEntry( stream );
                SynopsisList.Add( l );
            }

            return true;
        }
Example #12
0
        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint fileSize = stream.ReadUInt32().SwapEndian();
            uint dataStart = stream.ReadUInt32().SwapEndian();
            uint dataCount = stream.ReadUInt32().SwapEndian();
            uint refStringStart = stream.ReadUInt32().SwapEndian();

            stream.Position = dataStart;
            NpcFileList = new List<NpcFileReference>( (int)dataCount );
            for ( uint i = 0; i < dataCount; ++i ) {
                NpcFileReference n = new NpcFileReference( stream, refStringStart );
                NpcFileList.Add( n );
            }

            return true;
        }
Example #13
0
        public ScenarioDat( Stream data )
        {
            Magic = data.ReadAscii( 8 );
            Filesize = data.ReadUInt32().SwapEndian();
            Unknown = data.ReadUInt32().SwapEndian();

            Filecount = data.ReadUInt32().SwapEndian();
            FilesOffset = data.ReadUInt32().SwapEndian();
            uint FilesizeAgain = data.ReadUInt32();
            uint Padding = data.ReadUInt32();

            Entries = new List<ScenarioDatEntry>( (int)Filecount );
            for ( uint i = 0; i < Filecount; ++i ) {
                data.Position = 0x20u + i * 0x20u;
                var e = new ScenarioDatEntry( data, FilesOffset );
                Entries.Add( e );
            }
        }
Example #14
0
        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint unknown = stream.ReadUInt32().SwapEndian();
            uint locationCount = stream.ReadUInt32().SwapEndian();

            LocationList = new List<Location>( (int)locationCount );
            for ( uint i = 0; i < locationCount; ++i ) {
                Location l = new Location( stream );
                LocationList.Add( l );
            }

            LocationIdDict = new Dictionary<uint, Location>( LocationList.Count );
            foreach ( Location l in LocationList ) {
                LocationIdDict.Add( l.LocationID, l );
            }

            return true;
        }
Example #15
0
        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint skillCount = stream.ReadUInt32().SwapEndian();
            uint refStringStart = stream.ReadUInt32().SwapEndian();

            SkillList = new List<Skill>( (int)skillCount );
            for ( uint i = 0; i < skillCount; ++i ) {
                Skill s = new Skill( stream, refStringStart );
                SkillList.Add( s );
            }

            SkillIdDict = new Dictionary<uint, Skill>( SkillList.Count );
            foreach ( Skill s in SkillList ) {
                SkillIdDict.Add( s.InGameID, s );
            }

            return true;
        }
Example #16
0
        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint fileSize = stream.ReadUInt32().SwapEndian();
            uint unknownDataStart = stream.ReadUInt32().SwapEndian();
            uint unknownDataCount = stream.ReadUInt32().SwapEndian();
            uint npcDefStart = stream.ReadUInt32().SwapEndian();
            uint npcDefCount = stream.ReadUInt32().SwapEndian();
            uint refStringStart = stream.ReadUInt32().SwapEndian();

            stream.Position = npcDefStart;
            NpcDefList = new List<NpcDialogueDefinition>( (int)npcDefCount );
            for ( uint i = 0; i < npcDefCount; ++i ) {
                NpcDialogueDefinition n = new NpcDialogueDefinition( stream, refStringStart );
                NpcDefList.Add( n );
            }

            return true;
        }
Example #17
0
        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint enemyGroupCount = stream.ReadUInt32().SwapEndian();
            uint refStringStart = stream.ReadUInt32().SwapEndian();

            EnemyGroupList = new List<EnemyGroup>( (int)enemyGroupCount );
            for ( uint i = 0; i < enemyGroupCount; ++i ) {
                EnemyGroup s = new EnemyGroup( stream, refStringStart );
                EnemyGroupList.Add( s );
            }

            EnemyGroupIdDict = new Dictionary<uint, EnemyGroup>( EnemyGroupList.Count );
            foreach ( EnemyGroup e in EnemyGroupList ) {
                EnemyGroupIdDict.Add( e.InGameID, e );
            }

            return true;
        }
Example #18
0
        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint unknown1 = stream.ReadUInt32().SwapEndian();
            uint bytesToEnd = stream.ReadUInt32().SwapEndian();
            uint unknown2 = stream.ReadUInt32().SwapEndian();
            uint unknown3 = stream.ReadUInt32().SwapEndian();
            HorizontalTiles = stream.ReadUInt32().SwapEndian();
            VerticalTiles = stream.ReadUInt32().SwapEndian();
            uint tileCount = stream.ReadUInt32().SwapEndian();

            TileList = new List<MapTile>( (int)tileCount );
            for ( uint i = 0; i < tileCount; ++i ) {
                MapTile mt = new MapTile( stream );
                TileList.Add( mt );
            }

            return true;
        }
Example #19
0
        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint fileSize = stream.ReadUInt32().SwapEndian();
            uint definitionsStart = stream.ReadUInt32().SwapEndian();
            uint definitionsCount = stream.ReadUInt32().SwapEndian(); // 64 bytes per entry
            uint contentsStart = stream.ReadUInt32().SwapEndian();
            uint contentsCount = stream.ReadUInt32().SwapEndian(); // 16 bytes per entry
            uint itemsStart = stream.ReadUInt32().SwapEndian();
            uint itemsCount = stream.ReadUInt32().SwapEndian(); // 8 bytes per entry
            uint refStringStart = stream.ReadUInt32().SwapEndian();

            stream.Position = definitionsStart;
            SearchPointDefinitions = new List<SearchPointDefinition>( (int)definitionsCount );
            for ( uint i = 0; i < definitionsCount; ++i ) {
                SearchPointDefinitions.Add( new SearchPointDefinition( stream ) );
            }

            stream.Position = contentsStart;
            SearchPointContents = new List<SearchPointContent>( (int)contentsCount );
            for ( uint i = 0; i < contentsCount; ++i ) {
                SearchPointContents.Add( new SearchPointContent( stream ) );
            }

            stream.Position = itemsStart;
            SearchPointItems = new List<SearchPointItem>( (int)itemsCount );
            for ( uint i = 0; i < itemsCount; ++i ) {
                SearchPointItems.Add( new SearchPointItem( stream ) );
            }

            return true;
        }
Example #20
0
        private bool LoadFile( Stream stream )
        {
            string magic = stream.ReadAscii( 8 );
            uint filesize = stream.ReadUInt32().SwapEndian();
            uint modelDefStart = stream.ReadUInt32().SwapEndian();
            uint modelDefCount = stream.ReadUInt32().SwapEndian();
            uint refStringStart = stream.ReadUInt32().SwapEndian();
            uint customStart = stream.ReadUInt32().SwapEndian();
            uint customCount = stream.ReadUInt32().SwapEndian();
            uint otherStart = stream.ReadUInt32().SwapEndian();
            uint otherCount = stream.ReadUInt32().SwapEndian();
            uint u20BsectionStart = stream.ReadUInt32().SwapEndian();
            uint u20BsectionCount = stream.ReadUInt32().SwapEndian();
            uint u80sectionStart = stream.ReadUInt32().SwapEndian();
            uint u80sectionCount = stream.ReadUInt32().SwapEndian();
            stream.DiscardBytes( 8 );

            ModelDefList = new List<CharacterModelDefinition>( (int)modelDefCount );
            stream.Position = modelDefStart;
            for ( uint i = 0; i < modelDefCount; ++i ) {
                ModelDefList.Add( new CharacterModelDefinition( stream, refStringStart ) );
            }

            ModelCustomList = new List<CustomModelAddition>( (int)customCount );
            stream.Position = customStart;
            for ( uint i = 0; i < customCount; ++i ) {
                ModelCustomList.Add( new CustomModelAddition( stream, refStringStart ) );
            }

            ModelOtherList = new List<OtherModelAddition>( (int)otherCount );
            stream.Position = otherStart;
            for ( uint i = 0; i < otherCount; ++i ) {
                ModelOtherList.Add( new OtherModelAddition( stream, refStringStart ) );
            }

            U20BList = new List<Unknown0x20byteAreaB>( (int)u20BsectionCount );
            stream.Position = u20BsectionStart;
            for ( uint i = 0; i < u20BsectionCount; ++i ) {
                U20BList.Add( new Unknown0x20byteAreaB( stream, refStringStart ) );
            }

            U80List = new List<Unknown0x80byteArea>( (int)u80sectionCount );
            stream.Position = u80sectionStart;
            for ( uint i = 0; i < u80sectionCount; ++i ) {
                U80List.Add( new Unknown0x80byteArea( stream, refStringStart ) );
            }

            foreach ( var model in ModelDefList ) {
                model.Custom = new CustomModelAddition[model.CustomCount];
                for ( int i = 0; i < model.Custom.Length; ++i ) {
                    model.Custom[i] = ModelCustomList[(int)model.CustomIndex + i];
                }
                model.Other = new OtherModelAddition[model.OtherCount];
                for ( int i = 0; i < model.Other.Length; ++i ) {
                    model.Other[i] = ModelOtherList[(int)model.OtherIndex + i];
                }
                model.Unknown0x20Area = new Unknown0x20byteAreaB[model.Unknown0x20AreaCount];
                for ( int i = 0; i < model.Unknown0x20Area.Length; ++i ) {
                    model.Unknown0x20Area[i] = U20BList[(int)model.Unknown0x20AreaIndex + i];
                }
                model.Unknown0x80Area = new Unknown0x80byteArea[model.Unknown0x80AreaCount];
                for ( int i = 0; i < model.Unknown0x80Area.Length; ++i ) {
                    model.Unknown0x80Area[i] = U80List[(int)model.Unknown0x80AreaIndex + i];
                }
            }

            return true;
        }