Ejemplo n.º 1
0
 public override void SerializeBlock(SerializerObject s)
 {
     s.DoEndian(R1Engine.Serialize.BinaryFile.Endian.Little, () => {
         ActionTable = s.SerializeObject <GBC_ActionTable>(ActionTable, name: nameof(ActionTable));
     });
     Puppet = s.DoAt(DependencyTable.GetPointer(0), () => s.SerializeObject <GBC_Puppet>(Puppet, name: $"{nameof(Puppet)}"));
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles the data serialization
        /// </summary>
        /// <param name="s">The serializer object</param>
        public override void SerializeImpl(SerializerObject s)
        {
            Byte00         = s.Serialize <byte>(Byte00, name: nameof(Byte00));
            AnimationSpeed = s.Serialize <byte>(AnimationSpeed, name: nameof(AnimationSpeed));
            if (Byte00 != 0)
            {
                AnimationPointer = s.SerializePointer(AnimationPointer, name: nameof(AnimationPointer));
            }
            else
            {
                LinkedStatePointer = s.SerializePointer(LinkedStatePointer, name: nameof(LinkedStatePointer));
            }
            CodePointer = s.SerializePointer(CodePointer, name: nameof(CodePointer));
            Byte0A      = s.Serialize <byte>(Byte0A, name: nameof(Byte0A));
            Byte0B      = s.Serialize <byte>(Byte0B, name: nameof(Byte0B));

            s.DoAt(AnimationPointer, () => {
                Animation = s.SerializeObject <R1Jaguar_AnimationDescriptor>(Animation, name: nameof(Animation));
                //Animation = s.SerializeObject<Jaguar_R1_AnimationDescriptor>(Animation, onPreSerialize: l => l.FlipFlagInX = this.FlipFlagInX, name: nameof(Animation));
                //Animation = s.SerializeObject<Jaguar_R1_AnimationDescriptor>(Animation, onPreSerialize: l => l.FlipFlagInX = (Byte00 != 200), name: nameof(Animation));
            });
            s.DoAt(LinkedStatePointer, () => {
                LinkedState = s.SerializeObject <R1Jaguar_EventState>(LinkedState, name: nameof(LinkedState));
            });
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Handles the data serialization
        /// </summary>
        /// <param name="s">The serializer object</param>
        public override void SerializeImpl(SerializerObject s)
        {
            // Serialize font data
            FontData = s.SerializeObject <R1_PS1_FontData>(FontData, name: nameof(FontData));

            // Serialize fixed Rayman event
            RaymanEvent = s.SerializeObject <R1_EventData>(RaymanEvent, name: nameof(RaymanEvent));

            // Serialize event information
            EventsPointer = s.SerializePointer(EventsPointer, name: nameof(EventsPointer));

            if (s.GameSettings.EngineVersion == EngineVersion.R1_PS1_JPDemoVol3)
            {
                UnknownEventTablePointer = s.SerializePointer(UnknownEventTablePointer, name: nameof(UnknownEventTablePointer));
            }
            EventCount            = s.Serialize <uint>(EventCount, name: nameof(EventCount));
            EventLinkTablePointer = s.SerializePointer(EventLinkTablePointer, name: nameof(EventLinkTablePointer));
            EvenLinkCount         = s.Serialize <uint>(EvenLinkCount, name: nameof(EvenLinkCount));

            // Serialize data from pointers
            s.DoAt(EventsPointer, () => Events = s.SerializeObjectArray <R1_EventData>(Events, EventCount, name: nameof(Events)));

            if (UnknownEventTablePointer != null)
            {
                s.DoAt(UnknownEventTablePointer, () => UnknownEventTable = s.SerializeObjectArray <R1_PS1JPDemoVol3_UnknownEventTableItem>(UnknownEventTable, EventCount, name: nameof(UnknownEventTable)));
            }

            s.DoAt(EventLinkTablePointer, () => EventLinkTable = s.SerializeArray <byte>(EventLinkTable, EvenLinkCount, name: nameof(EventLinkTable)));
        }
Ejemplo n.º 4
0
 public override void SerializeImpl(SerializerObject s)
 {
     ObjType           = s.Serialize <GBAVV_Isometric_ObjType>(ObjType, name: nameof(ObjType));
     ObjType_TimeTrial = s.Serialize <GBAVV_Isometric_ObjType>(ObjType_TimeTrial, name: nameof(ObjType_TimeTrial));
     XPos = s.SerializeObject <FixedPointInt>(XPos, name: nameof(XPos));
     YPos = s.SerializeObject <FixedPointInt>(YPos, name: nameof(YPos));
 }
 public override void SerializeImpl(SerializerObject s)
 {
     MapIndex          = s.SerializeObject <GBAIsometric_Spyro_DataBlockIndex>(MapIndex, x => x.HasPadding = true, name: nameof(MapIndex));
     TileAssembleIndex = s.SerializeObject <GBAIsometric_Spyro_DataBlockIndex>(TileAssembleIndex, x => x.HasPadding = true, name: nameof(TileAssembleIndex));
     TilesetIndex      = s.SerializeObject <GBAIsometric_Spyro_DataBlockIndex>(TilesetIndex, x => x.HasPadding = true, name: nameof(TilesetIndex));
     Flags             = s.Serialize <ushort>(Flags, name: nameof(Flags));
     s.Serialize <ushort>(default, name: "Padding"); // Always 0 and not referenced by the code
Ejemplo n.º 6
0
        public override void SerializeImpl(SerializerObject s)
        {
            MapsCount           = s.Serialize <uint>(MapsCount, name: nameof(MapsCount));
            MapsPointer         = s.SerializePointer(MapsPointer, name: nameof(MapsPointer));
            BonusMapPointer     = s.SerializePointer(BonusMapPointer, name: nameof(BonusMapPointer));
            ChallengeMapPointer = s.SerializePointer(ChallengeMapPointer, name: nameof(ChallengeMapPointer));

            MapsPointers = s.DoAt(MapsPointer, () => s.SerializePointerArray(MapsPointers, MapsCount, name: nameof(MapsPointers)));

            if (Maps == null)
            {
                Maps = new GBAVV_MapInfo[MapsCount];
            }

            for (int i = 0; i < Maps.Length; i++)
            {
                if (SerializeAll || (LevInfo?.MapIndex == i && LevInfo?.MapType == GBAVV_BaseManager.LevInfo.Type.Normal))
                {
                    Maps[i] = s.DoAt(MapsPointers[i], () => s.SerializeObject <GBAVV_MapInfo>(Maps[i], name: $"{nameof(Maps)}[{i}]"));
                }
            }

            if (SerializeAll || LevInfo?.MapType == GBAVV_BaseManager.LevInfo.Type.Bonus)
            {
                BonusMap = s.DoAt(BonusMapPointer, () => s.SerializeObject <GBAVV_MapInfo>(BonusMap, name: nameof(BonusMap)));
            }

            if (SerializeAll || LevInfo?.MapType == GBAVV_BaseManager.LevInfo.Type.Challenge)
            {
                ChallengeMap = s.DoAt(ChallengeMapPointer, () => s.SerializeObject <GBAVV_MapInfo>(ChallengeMap, name: nameof(ChallengeMap)));
            }
        }
Ejemplo n.º 7
0
 public override void SerializeImpl(SerializerObject s)
 {
     Database = s.SerializeObject <Palm_Database>(Database, onPreSerialize: pdb => pdb.Type = Palm_Database.DatabaseType.PDB, name: nameof(Database));
     s.DoAt(Database.AppInfoAreaPointer, () => {
         AppInfo = s.SerializeObject <LUDI_AppInfo>(AppInfo, name: nameof(AppInfo));
     });
 }
Ejemplo n.º 8
0
        public override void SerializeImpl(SerializerObject s)
        {
            MapLayersPointers    = s.SerializePointerArray(MapLayersPointers, 4, name: nameof(MapLayersPointers));
            CollisionDataPointer = s.SerializePointer(CollisionDataPointer, name: nameof(CollisionDataPointer));
            LayersBlockPointer   = s.SerializePointer(LayersBlockPointer, name: nameof(LayersBlockPointer));
            HasDataBlockHeader   = s.Serialize <bool>(HasDataBlockHeader, name: nameof(HasDataBlockHeader));
            s.SerializeArray <byte>(new byte[3], 3, name: "Padding");
            ObjDataPointer         = s.SerializePointer(ObjDataPointer, name: nameof(ObjDataPointer));
            ObjDataUnkTablePointer = s.SerializePointer(ObjDataUnkTablePointer, name: nameof(ObjDataUnkTablePointer));
            s.SerializeArray <byte>(new byte[12], 12, name: "Padding"); // Always 0, but still part of the same struct

            if (MapLayers == null)
            {
                MapLayers = new GBAVV_Map2D_MapLayer[MapLayersPointers.Length];
            }

            for (int i = 0; i < MapLayers.Length; i++)
            {
                MapLayers[i] = s.DoAt(MapLayersPointers[i], () => s.SerializeObject <GBAVV_Map2D_MapLayer>(MapLayers[i], name: $"{nameof(MapLayers)}[{i}]"));
            }

            CollisionLayer = s.DoAt(CollisionDataPointer, () => s.SerializeObject <GBAVV_Map2D_MapLayer>(CollisionLayer, name: nameof(CollisionLayer)));

            LayersBlock = s.DoAt(LayersBlockPointer, () => s.SerializeObject <GBAVV_Map2D_LayersBlock>(LayersBlock, x =>
            {
                x.HasHeader = HasDataBlockHeader;
                x.MapData   = this;
            }, name: nameof(LayersBlock)));

            ObjData         = s.DoAt(ObjDataPointer, () => s.SerializeObject <GBAVV_Map2D_ObjData>(ObjData, name: nameof(ObjData)));
            ObjDataUnkTable = s.DoAt(ObjDataUnkTablePointer, () => s.SerializeObject <GBAVV_Map2D_ObjDataUnkTable>(ObjDataUnkTable, name: nameof(ObjDataUnkTable)));
        }
Ejemplo n.º 9
0
        public override void SerializeImpl(SerializerObject s)
        {
            LevelID          = s.Serialize <ushort>(LevelID, name: nameof(LevelID));
            ObjectTableIndex = s.SerializeObject <GBAIsometric_Spyro_DataBlockIndex>(ObjectTableIndex, name: nameof(ObjectTableIndex));

            ObjectTable = ObjectTableIndex.DoAtBlock(size => s.SerializeObject <GBAIsometric_Spyro_ObjectTable>(ObjectTable, name: nameof(ObjectTable)));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Handles the data serialization
        /// </summary>
        /// <param name="s">The serializer object</param>
        public override void SerializeImpl(SerializerObject s)
        {
            // Serialize palettes
            s.DoAt(s.CurrentPointer + 0x2ADC4, () =>
            {
                TilePalette   = s.SerializeObjectArray <RGBA5551Color>(TilePalette, 8 * 16, name: nameof(TilePalette));
                SpritePalette = s.SerializeObjectArray <RGBA5551Color>(SpritePalette, 8 * 16, name: nameof(SpritePalette));
            });

            // Serialize tile sets
            TileSet_0000 = s.DoAt(s.CurrentPointer + 0x30000, () => s.SerializeArray <byte>(TileSet_0000, 1024 * 32, name: nameof(TileSet_0000)));
            TileSet_8000 = s.DoAt(s.CurrentPointer + 0x36F00, () => s.SerializeArray <byte>(TileSet_8000, 21 * 16, name: nameof(TileSet_8000)));
            // Animated tiles: 0x37050
            s.DoAt(s.CurrentPointer + 0x8077, () => {
                AnimatedTiles = s.SerializeArraySize <SNES_Proto_AnimatedTileEntry, byte>(AnimatedTiles, name: nameof(AnimatedTiles));
                AnimatedTiles = s.SerializeObjectArray <SNES_Proto_AnimatedTileEntry>(AnimatedTiles, AnimatedTiles.Length, name: nameof(AnimatedTiles));
            });
            // Serialize maps
            BG1_Map   = s.DoAt(s.CurrentPointer + 0x28000, () => s.SerializeObject <MapData>(BG1_Map, name: nameof(BG1_Map)));
            BG1_Tiles = s.DoAt(s.CurrentPointer + 0x1AAF8, () => s.SerializeObjectArray <MapTile>(BG1_Tiles, 1024 * 4, onPreSerialize: x => x.SNES_Is8PxTile = true, name: nameof(BG1_Tiles)));
            BG2_Tiles = s.DoAt(s.CurrentPointer + 0x29dc4, () => s.SerializeObjectArray <MapTile>(BG2_Tiles, 32 * 32, onPreSerialize: x => x.SNES_Is8PxTile = true, name: nameof(BG2_Tiles)));
            BG3_Tiles = s.DoAt(s.CurrentPointer + 0x2A5C4, () => s.SerializeObjectArray <MapTile>(BG3_Tiles, 32 * 32, onPreSerialize: x => x.SNES_Is8PxTile = true, name: nameof(BG3_Tiles)));

            // Serialize object data
            Rayman = s.DoAt(s.CurrentPointer + 0x10016, () => s.SerializeObject <SNES_Proto_Object>(Rayman, name: nameof(Rayman)));

            // Serialize sprite tile sets
            SpriteTileSet     = s.DoAt(s.CurrentPointer + 0x2afc4, () => s.SerializeArray <byte>(SpriteTileSet, 0x3000, name: nameof(SpriteTileSet)));
            SpriteTileSetAdd0 = s.DoAt(s.CurrentPointer + 0x24ea8, () => s.SerializeArray <byte>(SpriteTileSetAdd0, 0x600, name: nameof(SpriteTileSetAdd0)));
            SpriteTileSetAdd1 = s.DoAt(s.CurrentPointer + 0x24ea8 + 0x600, () => s.SerializeArray <byte>(SpriteTileSetAdd1, 0x600, name: nameof(SpriteTileSetAdd1)));
            SpriteTileSetAdd2 = s.DoAt(s.CurrentPointer + 0x24ea8 + 0xC00, () => s.SerializeArray <byte>(SpriteTileSetAdd2, 0x400, name: nameof(SpriteTileSetAdd2)));
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Handles the data serialization
        /// </summary>
        /// <param name="s">The serializer object</param>
        public override void SerializeImpl(SerializerObject s)
        {
            // Serialize ROM header
            base.SerializeImpl(s);

            var levelCount = ((GBA_Manager)s.Context.Settings.GetGameManager).LevelCount;

            // Get the pointer table
            var pointerTable = PointerTables.GBA_PointerTable(s.Context, Offset.file);

            // Serialize the offset table
            s.DoAt(pointerTable[GBA_Pointer.UiOffsetTable], () => Data = s.SerializeObject <GBA_Data>(Data, name: nameof(Data)));

            // Serialize level info
            if (pointerTable.ContainsKey(GBA_Pointer.LevelInfo))
            {
                LevelInfo = s.DoAt(pointerTable[GBA_Pointer.LevelInfo], () => s.SerializeObjectArray <GBA_R3_SceneInfo>(LevelInfo, levelCount, name: nameof(LevelInfo)));
            }

            // Serialize localization
            if (pointerTable.ContainsKey(GBA_Pointer.Localization))
            {
                s.DoAt(pointerTable[GBA_Pointer.Localization], () => Localization = s.SerializeObject <GBA_LocLanguageTable>(Localization, name: nameof(Localization)));
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Handles the data serialization
        /// </summary>
        /// <param name="s">The serializer object</param>
        public override void SerializeImpl(SerializerObject s)
        {
            // Get the pointer table
            var pointerTable = PointerTables.GBA_PointerTable(s.Context, Offset.file);

            // Serialize the offset table
            s.DoAt(pointerTable[GBA_Pointer.UiOffsetTable], () => UiOffsetTable = s.SerializeObject <GBA_OffsetTable>(UiOffsetTable, name: nameof(UiOffsetTable)));

            var manager = (GBA_Manager)s.Context.Settings.GetGameManager;

            switch (manager.GetLevelType(s.Context))
            {
            case GBA_Manager.LevelType.Game:
                // Serialize the level block for the current level
                Scene = s.DoAt(UiOffsetTable.GetPointer(s.Context.Settings.Level), () => s.SerializeObject <GBA_Scene>(Scene, name: nameof(Scene)));
                break;

            case GBA_Manager.LevelType.Menu:
                // Serialize the playfield for the current menu
                MenuLevelPlayfield = s.DoAt(UiOffsetTable.GetPointer(s.Context.Settings.Level), () => s.SerializeObject <GBA_PlayField>(MenuLevelPlayfield, name: nameof(MenuLevelPlayfield)));
                break;

            case GBA_Manager.LevelType.MadTrax:
                MadTraxPlayfield1 = s.DoAt(UiOffsetTable.GetPointer(0), () => s.SerializeObject <GBA_MadTraxPlayField>(MadTraxPlayfield1, name: nameof(MadTraxPlayfield1)));
                MadTraxPlayfield2 = s.DoAt(UiOffsetTable.GetPointer(1), () => s.SerializeObject <GBA_MadTraxPlayField>(MadTraxPlayfield2, name: nameof(MadTraxPlayfield2)));
                MadTraxPalette    = s.DoAt(UiOffsetTable.GetPointer(2), () => s.SerializeObject <GBA_Palette>(MadTraxPalette, name: nameof(MadTraxPalette)));

                break;

            case GBA_Manager.LevelType.DLC:
                // Nothing more to do here if it's a DLC map...
                break;
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Serializes the data
        /// </summary>
        /// <param name="s">The serializer object</param>
        public override void SerializeImpl(SerializerObject s)
        {
            // HEADER
            base.SerializeImpl(s);

            // BACKGROUND BLOCK
            s.DoAt(BackgroundBlockPointer, () => {
                BackgroundData = s.SerializeObject <R1_PS1_BackgroundBlock>(BackgroundData, name: nameof(BackgroundData));
            });

            // EVENT BLOCK
            s.DoAt(EventBlockPointer, () => {
                EventData = s.SerializeObject <R1_PS1_EventBlock>(EventData, name: nameof(EventData));
            });

            // MAP BLOCK
            s.DoAt(MapBlockPointer, () => {
                MapData = s.SerializeObject <MapData>(MapData, name: nameof(MapData));
            });

            // TEXTURE BLOCK
            s.DoAt(TextureBlockPointer, () => {
                TextureBlock = s.SerializeArray <byte>(TextureBlock, FileSize - TextureBlockPointer.FileOffset, name: nameof(TextureBlock));
            });
        }
Ejemplo n.º 14
0
        public override void SerializeBlock(SerializerObject s)
        {
            if (s.GameSettings.EngineVersion == EngineVersion.GBC_R1_PocketPC)
            {
                FileOffsets = s.SerializeArraySize <uint, uint>(FileOffsets, name: nameof(FileOffsets));
                FileOffsets = s.SerializeArray <uint>(FileOffsets, FileOffsets.Length, name: nameof(FileOffsets));
                if (Files == null)
                {
                    Files = new SoundFile_PPC[FileOffsets.Length];
                }
                for (int i = 0; i < FileOffsets.Length; i++)
                {
                    if (FileOffsets[i] == 0)
                    {
                        continue;
                    }
                    s.Goto(BlockStartPointer + FileOffsets[i]);
                    Files[i] = s.SerializeObject <SoundFile_PPC>(Files[i], name: $"{nameof(Files)}[{i}]");
                }
            }
            else
            {
                DataOffsetsOffset  = s.Serialize <ushort>(DataOffsetsOffset, name: nameof(DataOffsetsOffset));
                UShort_02          = s.Serialize <ushort>(UShort_02, name: nameof(UShort_02));
                SoundIDOffsetCount = s.Serialize <ushort>(SoundIDOffsetCount, name: nameof(SoundIDOffsetCount));
                SoundOffsetCount   = s.Serialize <ushort>(SoundOffsetCount, name: nameof(SoundOffsetCount));

                s.DoAt(BlockStartPointer + DataOffsetsOffset, () => {
                    SoundIDOffsets = s.SerializeArray <ushort>(SoundIDOffsets, SoundIDOffsetCount, name: nameof(SoundIDOffsets));
                    SoundOffsets   = s.SerializeArray <ushort>(SoundOffsets, SoundOffsetCount, name: nameof(SoundOffsets));
                });
                if (SoundIDs == null)
                {
                    SoundIDs = new SoundID[SoundIDOffsetCount];
                }
                if (Sounds == null)
                {
                    Sounds = new Sound[SoundOffsetCount];
                }
                for (int i = 0; i < SoundIDs.Length; i++)
                {
                    s.Goto(BlockStartPointer + SoundIDOffsets[i]);
                    SoundIDs[i] = s.SerializeObject <SoundID>(SoundIDs[i], name: $"{nameof(SoundIDs)}[{i}]");
                }
                for (int i = 0; i < Sounds.Length; i++)
                {
                    int nextOff = i < Sounds.Length - 1 ? SoundOffsets[i + 1] : (int)BlockSize;
                    int length  = nextOff - SoundOffsets[i];
                    s.Goto(BlockStartPointer + SoundOffsets[i]);
                    Sounds[i] = s.SerializeObject <Sound>(Sounds[i], onPreSerialize: d => d.Length = length, name: $"{nameof(Sounds)}[{i}]");
                    if (Sounds[i].SoundProgramID.HasValue)
                    {
                        Sounds[i].SoundProgram = s.DoAt(DependencyTable.GetPointer(Sounds[i].SoundProgramID.Value - 1), () => {
                            return(s.SerializeObject <GBC_SoundProgram>(Sounds[i].SoundProgram, name: nameof(Sound.SoundProgram)));
                        });
                    }
                }
            }
        }
Ejemplo n.º 15
0
 public override void SerializeImpl(SerializerObject s)
 {
     ObjType    = s.Serialize <GBAVV_Isometric_TargetObjType>(ObjType, name: nameof(ObjType));
     XPos       = s.SerializeObject <FixedPointInt>(XPos, name: nameof(XPos));
     YPos       = s.SerializeObject <FixedPointInt>(YPos, name: nameof(YPos));
     TargetXPos = s.SerializeObject <FixedPointInt>(TargetXPos, name: nameof(TargetXPos));
     TargetYPos = s.SerializeObject <FixedPointInt>(TargetYPos, name: nameof(TargetYPos));
 }
Ejemplo n.º 16
0
    public override void SerializeImpl(SerializerObject s)
    {
        SlotDesc = s.SerializeObject <RRR_SavSlotDesc>(SlotDesc, name: nameof(SlotDesc));
        long pos = s.CurrentFileOffset;

        Univers = s.SerializeObject <RRR_UniversSave>(Univers, name: nameof(Univers));
        s.Goto(new Pointer(pos + 0x11440, Offset.File));
    }
Ejemplo n.º 17
0
        public override void SerializeImpl(SerializerObject s)
        {
            TileSet8bppPointer = s.SerializePointer(TileSet8bppPointer, name: nameof(TileSet8bppPointer));
            TileSet4bppPointer = s.SerializePointer(TileSet4bppPointer, name: nameof(TileSet4bppPointer));

            TileSet8bpp = s.DoAt(TileSet8bppPointer, () => s.SerializeObject <GBAVV_WorldMap_TileSet>(TileSet8bpp, name: nameof(TileSet8bpp)));
            TileSet4bpp = s.DoAt(TileSet4bppPointer, () => s.SerializeObject <GBAVV_WorldMap_TileSet>(TileSet4bpp, name: nameof(TileSet4bpp)));
        }
Ejemplo n.º 18
0
 public override void SerializeOffsetData(SerializerObject s)
 {
     if (s.GameSettings.GBA_IsShanghai)
     {
         TileSet = s.DoAt(OffsetTable.GetPointer(0), () => s.SerializeObject <GBA_SpriteTileSet>(TileSet, name: nameof(TileSet)));
     }
     else
     {
         Palette = s.DoAt(OffsetTable.GetPointer(Index_Palette), () => s.SerializeObject <GBA_SpritePalette>(Palette, name: nameof(Palette)));
         TileSet = s.DoAt(OffsetTable.GetPointer(Index_TileSet), () => s.SerializeObject <GBA_SpriteTileSet>(TileSet, name: nameof(TileSet)));
     }
 }
Ejemplo n.º 19
0
 public override void SerializeImpl(SerializerObject s)
 {
     if (s.GameSettings.EngineVersion == EngineVersion.GBC_R1_Palm || s.GameSettings.EngineVersion == EngineVersion.GBC_R1_PocketPC)
     {
         FileID  = s.SerializeObject <LUDI_FileIdentifier>(FileID, name: nameof(FileID));
         BlockID = s.SerializeObject <LUDI_BlockIdentifier>(BlockID, name: nameof(BlockID));
     }
     else
     {
         GBC_Pointer = s.SerializeObject <GBC_Pointer>(GBC_Pointer, name: nameof(GBC_Pointer));
     }
 }
Ejemplo n.º 20
0
        public override void SerializeImpl(SerializerObject s)
        {
            FrameTablePointer = s.SerializePointer(FrameTablePointer, name: nameof(FrameTablePointer));
            HitBox            = s.SerializeObject <AnimRect>(HitBox, name: nameof(HitBox));
            RenderBox         = s.SerializeObject <AnimRect>(RenderBox, name: nameof(RenderBox));
            PaletteIndex      = s.Serialize <byte>(PaletteIndex, name: nameof(PaletteIndex));
            AnimSpeed         = s.Serialize <byte>(AnimSpeed, name: nameof(AnimSpeed));
            FramesCount       = s.Serialize <byte>(FramesCount, name: nameof(FramesCount));
            Byte_13           = s.Serialize <byte>(Byte_13, name: nameof(Byte_13));
            s.SerializeArray <byte>(new byte[4], 4, name: "Padding");

            FrameTable = s.DoAt(FrameTablePointer, () => s.SerializeArray <ushort>(FrameTable, FramesCount, name: nameof(FrameTable)));
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Handles the data serialization
        /// </summary>
        /// <param name="s">The serializer object</param>
        public override void SerializeImpl(SerializerObject s)
        {
            // Get the pointer table
            var pointerTable = PointerTables.GBA_PointerTable(s.Context, Offset.file);

            // Serialize the offset table
            s.DoAt(pointerTable[GBA_Pointer.UiOffsetTable], () => UiOffsetTable = s.SerializeObject <GBA_OffsetTable>(UiOffsetTable, name: nameof(UiOffsetTable)));

            var manager = (GBA_Manager)s.Context.Settings.GetGameManager;

            switch (manager.GetLevelType(s.Context))
            {
            case GBA_Manager.LevelType.Game:
                // Serialize the level block for the current level

                // Common
                if (s.GameSettings.GBA_IsCommon)
                {
                    Scene = s.DoAt(UiOffsetTable.GetPointer(s.Context.Settings.Level), () => s.SerializeObject <GBA_Scene>(Scene, name: nameof(Scene)));
                }
                // Mad Trax
                else if (s.GameSettings.EngineVersion == EngineVersion.GBA_R3_MadTrax)
                {
                    MadTraxPlayField_BG = s.DoAt(UiOffsetTable.GetPointer(0), () => s.SerializeObject <GBA_PlayField>(MadTraxPlayField_BG, name: nameof(MadTraxPlayField_BG)));
                    MadTraxPlayField_FG = s.DoAt(UiOffsetTable.GetPointer(1), () => s.SerializeObject <GBA_PlayField>(MadTraxPlayField_FG, name: nameof(MadTraxPlayField_FG)));
                    MadTraxPalette      = s.DoAt(UiOffsetTable.GetPointer(2), () => s.SerializeObject <GBA_Palette>(MadTraxPalette, name: nameof(MadTraxPalette)));
                }
                // Milan
                else if (s.GameSettings.GBA_IsMilan)
                {
                    Milan_SceneList = s.DoAt(UiOffsetTable.GetPointer(0), () => s.SerializeObject <GBA_Milan_SceneList>(Milan_SceneList, name: nameof(Milan_SceneList)));
                    // TODO: Parse block 1 and 2 (menus?)
                }
                // Shanghai
                else
                {
                    Shanghai_Scene = s.DoAt(UiOffsetTable.GetPointer(s.Context.Settings.Level), () => s.SerializeObject <GBA_Shanghai_Scene>(Shanghai_Scene, name: nameof(Shanghai_Scene)));
                }

                break;

            case GBA_Manager.LevelType.Menu:
                // Serialize the playfield for the current menu
                MenuLevelPlayfield = s.DoAt(UiOffsetTable.GetPointer(s.Context.Settings.Level), () => s.SerializeObject <GBA_PlayField>(MenuLevelPlayfield, name: nameof(MenuLevelPlayfield)));
                break;

            case GBA_Manager.LevelType.DLC:
                // Nothing more to do here if it's a DLC map...
                break;
            }
        }
        public override void SerializeImpl(SerializerObject s)
        {
            ID = s.Serialize <uint>(ID, name: nameof(ID));
            DialogDataPointer = s.SerializePointer(DialogDataPointer, name: nameof(DialogDataPointer));

            DialogData = s.DoAt(DialogDataPointer, () => s.SerializeObject <GBAIsometric_Spyro_DialogData>(DialogData, name: nameof(DialogData)));
        }
Ejemplo n.º 23
0
        public override void SerializeBlock(SerializerObject s)
        {
            // This block has no data

            // Parse data from pointers (first pointer leads to scene list, remaining pointers lead to the level scenes)
            LevelList = s.DoAt(DependencyTable.GetPointer(0), () => s.SerializeObject <GBC_LevelList>(LevelList, name: nameof(LevelList)));
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Serializes the data
        /// </summary>
        /// <param name="s">The serializer object</param>
        public override void SerializeImpl(SerializerObject s)
        {
            // HEADER
            base.SerializeImpl(s);

            // IMAGE BLOCK

            s.DoAt(ImageBlockPointer, () => ImageBlock = s.SerializeObject <R1_PS1_VignetteBlockGroup>(ImageBlock, name: nameof(ImageBlock), onPreSerialize: x => x.BlockGroupSize = (int)(PaletteBlockPointer - ImageBlockPointer) / 2));

            // PARALLAX PALETTES

            s.DoAt(PaletteBlockPointer, () =>
            {
                // TODO: Get correct length and parse
                UnknownPaletteHeader = s.SerializeArray <byte>(UnknownPaletteHeader, (FileSize - PaletteBlockPointer.FileOffset) % 512, name: nameof(UnknownPaletteHeader));

                uint numPalettes = (uint)(FileSize - s.CurrentPointer.FileOffset) / (256 * 2);
                if (ParallaxPalettes == null)
                {
                    ParallaxPalettes = new ARGB1555Color[numPalettes][];
                }

                for (int i = 0; i < ParallaxPalettes.Length; i++)
                {
                    ParallaxPalettes[i] = s.SerializeObjectArray <ARGB1555Color>(ParallaxPalettes[i], 256, name: nameof(ParallaxPalettes) + "[" + i + "]");
                }
            });
        }
Ejemplo n.º 25
0
        public override void SerializeImpl(SerializerObject s)
        {
            MapLayers = s.SerializeObjectArray <Layer>(MapLayers, 4, name: nameof(MapLayers));

            ObjectsCount    = s.Serialize <int>(ObjectsCount, name: nameof(ObjectsCount));
            WaypointsCount  = s.Serialize <int>(WaypointsCount, name: nameof(WaypointsCount));
            CollisionWidth  = s.Serialize <int>(CollisionWidth, name: nameof(CollisionWidth));
            CollisionHeight = s.Serialize <int>(CollisionHeight, name: nameof(CollisionHeight));

            ObjectsPointer   = s.SerializePointer(ObjectsPointer, name: nameof(ObjectsPointer));
            WaypointsPointer = s.SerializePointer(WaypointsPointer, name: nameof(WaypointsPointer));
            CollisionPointer = s.SerializePointer(CollisionPointer, name: nameof(CollisionPointer));

            Byte_6C = s.Serialize <byte>(Byte_6C, name: nameof(Byte_6C));
            Byte_6D = s.Serialize <byte>(Byte_6D, name: nameof(Byte_6D));
            Byte_6E = s.Serialize <byte>(Byte_6E, name: nameof(Byte_6E));
            Byte_6F = s.Serialize <byte>(Byte_6F, name: nameof(Byte_6F));

            LevelNameLocIndex = s.SerializeObject <GBAIsometric_LocIndex>(LevelNameLocIndex, name: nameof(LevelNameLocIndex));

            // Parse from pointers
            Objects   = s.DoAt(ObjectsPointer, () => s.SerializeObjectArray <GBAIsometric_Object>(Objects, ObjectsCount, name: nameof(Objects)));
            Waypoints = s.DoAt(WaypointsPointer, () => s.SerializeObjectArray <GBAIsometric_RHR_Waypoint>(Waypoints, WaypointsCount, name: nameof(Waypoints)));

            s.DoAt(CollisionPointer, () =>
            {
                s.DoEncoded(new RHREncoder(), () => CollisionData = s.SerializeObjectArray <GBAIsometric_TileCollision>(CollisionData, CollisionWidth * CollisionHeight, name: nameof(CollisionData)));
            });
        }
Ejemplo n.º 26
0
 /// <summary>
 /// Handles the data serialization
 /// </summary>
 /// <param name="s">The serializer object</param>
 public override void SerializeImpl(SerializerObject s)
 {
     MapData         = s.DoAt(s.CurrentPointer + 0x28000, () => s.SerializeObject <MapData>(MapData, name: nameof(MapData)));
     Palettes        = s.DoAt(s.CurrentPointer + 0x2ADC4, () => s.SerializeObjectArray <ARGB1555Color>(Palettes, 16 * 16, name: nameof(Palettes)));
     TileDescriptors = s.DoAt(s.CurrentPointer + 0x1AAF8, () => s.SerializeObjectArray <SNES_Proto_TileDescriptor>(TileDescriptors, 1024 * 4, name: nameof(TileDescriptors)));
     TileMap         = s.DoAt(s.CurrentPointer + 0x30000, () => s.SerializeArray <byte>(TileMap, 0x10000, name: nameof(TileMap)));
 }
Ejemplo n.º 27
0
        public override void SerializeImpl(SerializerObject s)
        {
            ObjFlags    = s.Serialize <uint>(ObjFlags, name: nameof(ObjFlags));
            DataPointer = s.SerializePointer(DataPointer, name: nameof(DataPointer));

            Data = s.DoAt(DataPointer, () => s.SerializeObject <GBAIsometric_ObjectTypeData>(Data, name: nameof(Data)));
        }
        public override void SerializeImpl(SerializerObject s)
        {
            if (s.GameSettings.GBA_IsMilan)
            {
                FrameCount      = s.Serialize <ushort>((ushort)FrameCount, name: nameof(FrameCount));
                Milan_Ushort_02 = s.Serialize <ushort>(Milan_Ushort_02, name: nameof(Milan_Ushort_02));
                Milan_Bytes_04  = s.SerializeArray <byte>(Milan_Bytes_04, 8, name: nameof(Milan_Bytes_04));
            }
            else
            {
                FrameCount = s.Serialize <uint>(FrameCount, name: nameof(FrameCount));
            }

            var baseOffset = s.CurrentPointer;

            FrameOffsets = s.SerializeArray <uint>(FrameOffsets, FrameCount, name: nameof(FrameOffsets));

            if (Frames == null)
            {
                Frames = new GBA_BatmanVengeance_AnimationFrame[FrameCount];
            }

            for (int i = 0; i < FrameOffsets.Length; i++)
            {
                Frames[i] = s.DoAt(baseOffset + FrameOffsets[i], () => s.SerializeObject <GBA_BatmanVengeance_AnimationFrame>(Frames[i], onPreSerialize: f => f.Puppet = Puppet, name: $"{nameof(Frames)}[{i}]"));
            }
        }
Ejemplo n.º 29
0
        public override void SerializeImpl(SerializerObject s)
        {
            TileSetPointer = s.SerializePointer(TileSetPointer, name: nameof(TileSetPointer));
            PaletteIndex   = s.Serialize <uint>(PaletteIndex, name: nameof(PaletteIndex));

            TileSet = s.DoAt(TileSetPointer, () => s.SerializeObject <GBAVV_Map2D_TileSet>(TileSet, name: nameof(TileSet)));
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Serializes the data
        /// </summary>
        /// <param name="s">The serializer object</param>
        public override void SerializeImpl(SerializerObject s)
        {
            // HEADER
            base.SerializeImpl(s);

            // DATA BLOCK
            s.DoAt(DataBlockPointer, () => AllfixData = s.SerializeObject <R1_PS1_AllfixBlock>(AllfixData, x => x.Length = TextureBlockPointer - s.CurrentPointer, name: nameof(AllfixData)));

            // TEXTURE BLOCK
            s.DoAt(TextureBlockPointer, () => TextureBlock = s.SerializeArray <byte>(TextureBlock, Palette1Pointer - s.CurrentPointer, name: nameof(TextureBlock)));

            // PALETTE 1
            s.DoAt(Palette1Pointer, () => Palette1 = s.SerializeObjectArray <ARGB1555Color>(Palette1, 256, name: nameof(Palette1)));

            // PALETTE 2
            s.DoAt(Palette2Pointer, () => Palette2 = s.SerializeObjectArray <ARGB1555Color>(Palette2, 256, name: nameof(Palette2)));

            // PALETTE 3
            s.DoAt(Palette3Pointer, () => Palette3 = s.SerializeObjectArray <ARGB1555Color>(Palette3, 256, name: nameof(Palette3)));

            // PALETTE 4
            s.DoAt(Palette4Pointer, () => Palette4 = s.SerializeObjectArray <ARGB1555Color>(Palette4, 256, name: nameof(Palette4)));

            // PALETTE 5
            s.DoAt(Palette5Pointer, () => Palette5 = s.SerializeObjectArray <ARGB1555Color>(Palette5, 256, name: nameof(Palette5)));

            // PALETTE 6
            s.DoAt(Palette6Pointer, () => Palette6 = s.SerializeObjectArray <ARGB1555Color>(Palette6, 256, name: nameof(Palette6)));
        }