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))); }); }
/// <summary> /// Handles the data serialization /// </summary> /// <param name="s">The serializer object</param> public override void SerializeImpl(SerializerObject s) { Unk1 = s.Serialize <uint>(Unk1, name: nameof(Unk1)); var unk2Length = 27; // The PS1 version hard-codes a different length for this version if (s.GameSettings.EngineVersion == EngineVersion.R1_PS1_Edu && s.GameSettings.EduVolume.StartsWith("CS")) { unk2Length = 29; } Unk2 = s.SerializeArray <byte>(Unk2, unk2Length, name: nameof(Unk2)); Unk3 = s.SerializeArray <byte>(Unk3, 3130, name: nameof(Unk3)); SampleNames = s.SerializeStringArray(SampleNames, 7, 9, name: nameof(SampleNames)); VignetteItemsCount = s.Serialize <byte>(VignetteItemsCount, name: nameof(VignetteItemsCount)); Unk5 = s.Serialize <uint>(Unk5, name: nameof(Unk5)); Unk6 = s.Serialize <uint>(Unk6, name: nameof(Unk6)); VignetteItems = s.SerializeObjectArray <R1_PCEdu_GeneralFileVignetteItem>(VignetteItems, VignetteItemsCount, name: nameof(VignetteItems)); CreditsStringItemsCount = s.Serialize <uint>(CreditsStringItemsCount, name: nameof(CreditsStringItemsCount)); CreditsStringItems = s.SerializeObjectArray <R1_PC_GeneralFileStringItem>(CreditsStringItems, CreditsStringItemsCount, name: nameof(CreditsStringItems)); }
public override void SerializeImpl(SerializerObject s) { // Serialize alpha data (only on EDU) if (s.GameSettings.EngineVersion == EngineVersion.R1_PC_Edu || s.GameSettings.EngineVersion == EngineVersion.R1_PS1_Edu) { if (EDU_Alpha == null) { EDU_Alpha = new byte[160][]; } for (int i = 0; i < EDU_Alpha.Length; i++) { EDU_Alpha[i] = s.SerializeArray <byte>(EDU_Alpha[i], 256, name: $"{nameof(EDU_Alpha)}[{i}]"); } } LevelsCount = s.Serialize <ushort>(LevelsCount, name: nameof(LevelsCount)); Unk2 = s.Serialize <byte>(Unk2, name: nameof(Unk2)); Unk3 = s.Serialize <byte>(Unk3, name: nameof(Unk3)); WorldMapVig = s.SerializeString(WorldMapVig, 9, name: nameof(WorldMapVig)); LevelSelectVig = s.SerializeString(LevelSelectVig, 9, name: nameof(LevelSelectVig)); Unk4 = s.SerializeArray <byte>(Unk4, 7, name: nameof(Unk4)); Unk5 = s.Serialize <byte>(Unk5, name: nameof(Unk5)); Unk6 = s.Serialize <ushort>(Unk6, name: nameof(Unk6)); Levels = s.SerializeObjectArray <R1_WorldMapInfo>(Levels, 32, name: nameof(Levels)); Unk8 = s.Serialize <uint>(Unk8, name: nameof(Unk8)); Unk9 = s.SerializeArray <byte>(Unk9, 17, name: nameof(Unk9)); UnkStrings = s.SerializeStringArray(UnkStrings, 319, 9, name: nameof(UnkStrings)); UnkLevelStructs = s.SerializeObjectArray <R1_PC_WorldMapLevelUnkStruct>(UnkLevelStructs, LevelsCount, name: nameof(UnkLevelStructs)); }
/// <summary> /// Handles the data serialization /// </summary> /// <param name="s">The serializer object</param> public override void SerializeImpl(SerializerObject s) { TextureBlockChecksum = s.DoChecksum(new Checksum8Calculator(false), () => { s.DoXOR((byte)(s.GameSettings.EngineVersion == EngineVersion.R1_PC || s.GameSettings.EngineVersion == EngineVersion.R1_PocketPC ? 0 : 0xFF), () => { // Read the offset table for the textures, based from the start of the tile texture arrays TexturesOffsetTable = s.SerializePointerArray(TexturesOffsetTable, 1200, s.CurrentPointer + 1200 * 4 + 3 * 4, name: nameof(TexturesOffsetTable)); // Read the textures count TexturesCount = s.Serialize <uint>(TexturesCount, name: nameof(TexturesCount)); NonTransparentTexturesCount = s.Serialize <uint>(NonTransparentTexturesCount, name: nameof(NonTransparentTexturesCount)); TexturesDataTableCount = s.Serialize <uint>(TexturesDataTableCount, name: nameof(TexturesDataTableCount)); }); TexturesChecksum = s.DoChecksum(new Checksum8Calculator(), () => { // Serialize the textures NonTransparentTextures = s.SerializeObjectArray <R1_PC_TileTexture>(NonTransparentTextures, NonTransparentTexturesCount, name: nameof(NonTransparentTextures)); TransparentTextures = s.SerializeObjectArray <R1_PC_TransparentTileTexture>(TransparentTextures, TexturesCount - NonTransparentTexturesCount, name: nameof(TransparentTextures)); // Serialize the fourth unknown value Unknown4 = s.SerializeArray <byte>(Unknown4, 32, name: nameof(Unknown4)); }, ChecksumPlacement.After, calculateChecksum: s.GameSettings.EngineVersion == EngineVersion.R1_PC || s.GameSettings.EngineVersion == EngineVersion.R1_PocketPC, name: nameof(TexturesChecksum)); }, ChecksumPlacement.Before, calculateChecksum: s.GameSettings.EngineVersion == EngineVersion.R1_PC_Kit || s.GameSettings.EngineVersion == EngineVersion.R1_PC_Edu, name: nameof(TextureBlockChecksum)); }
public override void SerializeBlock(SerializerObject s) { if (s.GameSettings.EngineVersion <= EngineVersion.GBA_BatmanVengeance && !s.GameSettings.GBA_IsMilan) { if (s.GameSettings.GBA_IsShanghai) { s.Goto(ShanghaiOffsetTable.GetPointer(0)); } Length = s.Serialize <ushort>(Length, name: nameof(Length)); PalOffset = s.Serialize <ushort>(PalOffset, name: nameof(PalOffset)); if (s.GameSettings.GBA_IsShanghai) { s.Goto(ShanghaiOffsetTable.GetPointer(1)); } Palette = s.SerializeObjectArray <RGBA5551Color>((RGBA5551Color[])Palette, Length, name: nameof(Palette)); } else if (s.GameSettings.EngineVersion == EngineVersion.GBA_SplinterCell_NGage) { Palette = s.SerializeObjectArray <BGRA4441Color>((BGRA4441Color[])Palette, BlockSize / 2, name: nameof(Palette)); } else { Palette = s.SerializeObjectArray <RGBA5551Color>((RGBA5551Color[])Palette, BlockSize / 2, name: nameof(Palette)); } }
} // TODO: What is this? public override void SerializeImpl(SerializerObject s) { Unknown1Offset = s.Serialize <ushort>(Unknown1Offset, name: nameof(Unknown1Offset)); Unknown2Offset = s.Serialize <ushort>(Unknown2Offset, name: nameof(Unknown2Offset)); ActionsCount = s.Serialize <byte>(ActionsCount, name: nameof(ActionsCount)); Actions = s.SerializeObjectArray <GBC_Action>(Actions, ActionsCount, name: nameof(Actions)); s.DoAt(Offset + Unknown1Offset, () => { Data1Offsets = s.SerializeArray <ushort>(Data1Offsets, ActionsCount, name: nameof(Data1Offsets)); if (ActionData1 == null) { ActionData1 = new GBC_ActionData1[ActionsCount]; } for (int i = 0; i < Data1Offsets.Length; i++) { if (Data1Offsets[i] != 0) { ActionData1[i] = s.DoAt(Offset + Data1Offsets[i], () => s.SerializeObject <GBC_ActionData1>(ActionData1[i], name: $"{nameof(ActionData1)}[{i}]")); } } }); s.Goto(Offset + Unknown2Offset); ActionData2 = s.SerializeObjectArray <GBC_ActionData2>(ActionData2, ActionsCount, name: nameof(ActionData2)); }
public override void SerializeBlock(SerializerObject s) { if (s.GameSettings.GBA_IsMilan) { Milan_ActorID = s.SerializeString(Milan_ActorID, length: 4, name: nameof(Milan_ActorID)); s.SerializeArray <byte>(new byte[8], 8, name: "Padding"); } else { if (s.GameSettings.EngineVersion > EngineVersion.GBA_BatmanVengeance) { UnkData = s.SerializeArray <byte>(UnkData, 8, name: nameof(UnkData)); } Index_Puppet = s.Serialize <byte>(Index_Puppet, name: nameof(Index_Puppet)); Byte_09 = s.Serialize <byte>(Byte_09, name: nameof(Byte_09)); Byte_0A = s.Serialize <byte>(Byte_0A, name: nameof(Byte_0A)); Byte_0B = s.Serialize <byte>(Byte_0B, name: nameof(Byte_0B)); if (s.GameSettings.EngineVersion == EngineVersion.GBA_BatmanVengeance) { Actions = s.SerializeObjectArray <GBA_Action>(Actions, (BlockSize - 4) / 12, name: nameof(Actions)); } else { Actions = s.SerializeObjectArray <GBA_Action>(Actions, (BlockSize - 12) / 8, name: nameof(Actions)); } } }
/// <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))); }
/// <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))); }
public override void SerializeImpl(SerializerObject s) { Palette = s.SerializeObjectArray <RGBA5551Color>(Palette, 256, name: nameof(Palette)); Width = s.Serialize <ushort>(Width, name: nameof(Width)); Height = s.Serialize <ushort>(Height, name: nameof(Height)); Frames = s.SerializeObjectArray <Frame>(Frames, FramesCount, x => x.TileMapLength = Width * Height, name: nameof(Frames)); }
/// <summary> /// Handles the data serialization /// </summary> /// <param name="s">The serializer object</param> public override void SerializeImpl(SerializerObject s) { var p = s.CurrentPointer; FontData = s.SerializeObjectArray <R1_PS1_FontData>(FontData, 2, name: nameof(FontData)); WldObj = s.SerializeObjectArray <R1_EventData>(WldObj, 29, name: nameof(WldObj)); DataBlock = s.SerializeArray <byte>(DataBlock, Length - (s.CurrentPointer - p), name: nameof(DataBlock)); }
public override void SerializeImpl(SerializerObject s) { TilePositionsPointer = s.SerializePointer(TilePositionsPointer, name: nameof(TilePositionsPointer)); TileShapesPointer = s.SerializePointer(TileShapesPointer, name: nameof(TileShapesPointer)); TileOffset = s.Serialize <UInt24>(TileOffset, name: nameof(TileOffset)); TilesCount = s.Serialize <byte>(TilesCount, name: nameof(TilesCount)); TilePositions = s.DoAt(TilePositionsPointer, () => s.SerializeObjectArray <TilePosition>(TilePositions, TilesCount, name: nameof(TilePositions))); TileShapes = s.DoAt(TileShapesPointer, () => s.SerializeObjectArray <TileShape>(TileShapes, TilesCount, name: nameof(TileShapes))); }
public override void SerializeImpl(SerializerObject s) { LocID = s.Serialize <uint>(LocID, name: nameof(LocID)); SpritePointer = s.SerializePointer(SpritePointer, name: nameof(SpritePointer)); PalettePointer0 = s.SerializePointer(PalettePointer0, name: nameof(PalettePointer0)); PalettePointer1 = s.SerializePointer(PalettePointer1, name: nameof(PalettePointer1)); Sprite = s.DoAt(SpritePointer, () => s.SerializeObject <GBAIsometric_RHR_Sprite>(Sprite, name: nameof(Sprite))); Palette0 = s.DoAt(PalettePointer0, () => s.SerializeObjectArray <RGBA5551Color>(Palette0, 16, name: nameof(Palette0))); Palette1 = s.DoAt(PalettePointer1, () => s.SerializeObjectArray <RGBA5551Color>(Palette1, 16, name: nameof(Palette1))); }
//public GBAIsometric_Spyro_SpriteMap Index3Map { get; set; } // TODO: What is this? public override void SerializeImpl(SerializerObject s) { MapLayerPointers = s.SerializePointerArray(MapLayerPointers, 4, name: nameof(MapLayerPointers)); if (Is2D) { if (s.GameSettings.EngineVersion == EngineVersion.GBAIsometric_Spyro2) { Collision2DIndex = s.SerializeObject <GBAIsometric_Spyro_DataBlockIndex>(Collision2DIndex, x => x.HasPadding = true, name: nameof(Collision2DIndex)); } TilePaletteIndex = s.SerializeObject <GBAIsometric_Spyro_DataBlockIndex>(TilePaletteIndex, x => x.HasPadding = true, name: nameof(TilePaletteIndex)); if (s.GameSettings.EngineVersion == EngineVersion.GBAIsometric_Spyro3) { Collision2DIndex = s.SerializeObject <GBAIsometric_Spyro_DataBlockIndex>(Collision2DIndex, x => x.HasPadding = true, name: nameof(Collision2DIndex)); } ObjPaletteIndex = s.SerializeObject <GBAIsometric_Spyro_DataBlockIndex>(ObjPaletteIndex, x => x.HasPadding = true, name: nameof(ObjPaletteIndex)); if (s.GameSettings.EngineVersion == EngineVersion.GBAIsometric_Spyro3) { ID = s.Serialize <uint>(ID, name: nameof(ID)); } } else { TilePaletteIndex = s.SerializeObject <GBAIsometric_Spyro_DataBlockIndex>(TilePaletteIndex, x => x.HasPadding = true, name: nameof(TilePaletteIndex)); Collision3DIndex = s.SerializeObject <GBAIsometric_Spyro_DataBlockIndex>(Collision3DIndex, x => x.HasPadding = true, name: nameof(Collision3DIndex)); ObjPaletteIndex = s.SerializeObject <GBAIsometric_Spyro_DataBlockIndex>(ObjPaletteIndex, x => x.HasPadding = true, name: nameof(ObjPaletteIndex)); Index3 = s.SerializeObject <GBAIsometric_Spyro_DataBlockIndex>(Index3, x => x.HasPadding = true, name: nameof(Index3)); ID = s.Serialize <uint>(ID, name: nameof(ID)); } if (SerializeDataForID == ID || ForceSerializeAll) { if (MapLayers == null) { MapLayers = new GBAIsometric_Spyro_MapLayer[MapLayerPointers.Length]; } for (int i = 0; i < MapLayers.Length; i++) { MapLayers[i] = s.DoAt(MapLayerPointers[i], () => s.SerializeObject <GBAIsometric_Spyro_MapLayer>(MapLayers[i], name: $"{nameof(MapLayers)}[{i}]")); } TilePalette = TilePaletteIndex.DoAtBlock(size => s.SerializeObjectArray <RGBA5551Color>(TilePalette, 256, name: nameof(TilePalette))); ObjPalette = ObjPaletteIndex.DoAtBlock(size => s.SerializeObjectArray <RGBA5551Color>(ObjPalette, 256, name: nameof(ObjPalette))); Collision3D = Collision3DIndex?.DoAtBlock(size => s.SerializeObject <GBAIsometric_Spyro_Collision3DMapData>(Collision3D, name: nameof(Collision3D))); Collision2D = Collision2DIndex?.DoAtBlock(size => s.SerializeObject <GBAIsometric_Spyro_Collision2DMapData>(Collision2D, name: nameof(Collision2D))); //Index3Map = Index3?.DoAtBlock(size => s.SerializeObject<GBAIsometric_Spyro_SpriteMap>(Index3Map, name: nameof(Index3Map))); } }
public override void SerializeImpl(SerializerObject s) { Palette = s.SerializeObjectArray <RGBA5551Color>(Palette, 256, name: nameof(Palette)); Width = s.Serialize <ushort>(Width, name: nameof(Width)); Height = s.Serialize <ushort>(Height, name: nameof(Height)); TileSetCount = s.Serialize <uint>(TileSetCount, name: nameof(TileSetCount)); TileMap = s.SerializeObjectArray <MapTile>(TileMap, Width * Height, name: nameof(TileMap)); TileSet = s.SerializeArray <byte>(TileSet, TileSetCount * 0x20, name: nameof(TileSet)); PaletteIndices = s.SerializeArray <byte>(PaletteIndices, (Width * Height) / 2, name: nameof(PaletteIndices)); }
/// <summary> /// Serializes the data /// </summary> /// <param name="s">The serializer object</param> public override void SerializeImpl(SerializerObject s) { LayersPerFrame = s.Serialize <byte>(LayersPerFrame, name: nameof(LayersPerFrame)); Unknown1 = s.Serialize <byte>(Unknown1, name: nameof(Unknown1)); FrameCount = s.Serialize <byte>(FrameCount, name: nameof(FrameCount)); Unknown2 = s.Serialize <byte>(Unknown2, name: nameof(Unknown2)); Unknown3 = s.Serialize <uint>(Unknown3, name: nameof(Unknown3)); AnimationDataLength = s.Serialize <ushort>(AnimationDataLength, name: nameof(AnimationDataLength)); Layers = s.SerializeObjectArray <R1_AnimationLayer>(Layers, LayersPerFrame * FrameCount, name: nameof(Layers)); DefaultFrame = s.SerializeObject <R1_AnimationFrame>(DefaultFrame, name: nameof(DefaultFrame)); Frames = s.SerializeObjectArray <R1_AnimationFrame>(Frames, FrameCount, name: nameof(Frames)); }
/// <summary> /// Handles the data serialization /// </summary> /// <param name="s">The serializer object</param> public override void SerializeImpl(SerializerObject s) { // Serialize the background layer information BackgroundDefineNormal = s.SerializeObjectArray <R1_BackgroundLayerPosition>(BackgroundDefineNormal, 6, name: nameof(BackgroundDefineNormal)); BackgroundDefineDiff = s.SerializeObjectArray <R1_BackgroundLayerPosition>(BackgroundDefineDiff, 6, name: nameof(BackgroundDefineDiff)); Unknown3 = s.SerializeArray <byte>(Unknown3, 16, name: nameof(Unknown3)); BackgroundLayerInfos = s.SerializeObjectArray <R1_ImageDescriptor>(BackgroundLayerInfos, 12, name: nameof(BackgroundLayerInfos)); Unknown4 = s.SerializeArray <byte>(Unknown4, s.GameSettings.EngineVersion == EngineVersion.R1_PS1_JP ? 208 : 80, name: nameof(Unknown4)); }
public override void SerializeImpl(SerializerObject s) { Bytes_00 = s.SerializeArray <byte>(Bytes_00, 4, name: nameof(Bytes_00)); DoorObjectsCount = s.Serialize <uint>(DoorObjectsCount, name: nameof(DoorObjectsCount)); DoorObjects = s.SerializeObjectArray <GBAIsometric_Spyro2_Object2D>(DoorObjects, DoorObjectsCount, onPreSerialize: x => x.Category = GBAIsometric_Spyro2_Object2D.ObjCategory.Door, name: nameof(DoorObjects)); CharacterObjectsCount = s.Serialize <uint>(CharacterObjectsCount, name: nameof(CharacterObjectsCount)); CharacterObjects = s.SerializeObjectArray <GBAIsometric_Spyro2_Object2D>(CharacterObjects, CharacterObjectsCount, onPreSerialize: x => x.Category = GBAIsometric_Spyro2_Object2D.ObjCategory.Character, name: nameof(CharacterObjects)); CollectibleObjectsCount = s.Serialize <uint>(CollectibleObjectsCount, name: nameof(CollectibleObjectsCount)); CollectibleObjects = s.SerializeObjectArray <GBAIsometric_Spyro2_Object2D>(CollectibleObjects, CollectibleObjectsCount, onPreSerialize: x => x.Category = GBAIsometric_Spyro2_Object2D.ObjCategory.Collectible, name: nameof(CollectibleObjects)); }
/// <summary> /// Handles the data serialization /// </summary> /// <param name="s">The serializer object</param> public override void SerializeImpl(SerializerObject s) { // Serialize pointers AnimLayersPointer = s.SerializePointer(AnimLayersPointer, name: nameof(AnimLayersPointer)); AnimFramesPointer = s.SerializePointer(AnimFramesPointer, name: nameof(AnimFramesPointer)); // Serialize data LayersPerFrameSerialized = s.Serialize <ushort>(LayersPerFrameSerialized, name: nameof(LayersPerFrameSerialized)); FrameCountSerialized = s.Serialize <ushort>(FrameCountSerialized, name: nameof(FrameCountSerialized)); // Serialize data from pointers s.DoAt(AnimLayersPointer, () => Layers = s.SerializeObjectArray(Layers, LayersPerFrame * FrameCount, name: nameof(Layers))); s.DoAt(AnimFramesPointer, () => Frames = s.SerializeObjectArray(Frames, FrameCount, name: nameof(Frames))); }
/// <summary> /// Serializes the data /// </summary> /// <param name="s">The serializer object</param> public override void SerializeImpl(SerializerObject s) { // Serialize PC Header base.SerializeImpl(s); // Hard-code to 1 item DesItemCount = 1; // Serialize the DES DesItems = s.SerializeObjectArray <R1_PC_DES>(DesItems, DesItemCount, onPreSerialize: data => data.FileType = R1_PC_DES.Type.BigRay, name: nameof(DesItems)); // Serialize the ETA Eta = s.SerializeArraySize <R1_PC_ETA, byte>(Eta, name: nameof(Eta)); Eta = s.SerializeObjectArray <R1_PC_ETA>(Eta, Eta.Length, name: nameof(Eta)); }
public override void SerializeImpl(SerializerObject s) { s.DoEndian(R1Engine.Serialize.BinaryFile.Endian.Big, () => { LanguageTables = s.SerializeArraySize <LanguageTable, ushort>(LanguageTables, name: nameof(LanguageTables)); LanguageTables = s.SerializeObjectArray <LanguageTable>(LanguageTables, LanguageTables.Length, name: nameof(LanguageTables)); }); }
public override void SerializeImpl(SerializerObject s) { DialogCount = s.Serialize <uint>(DialogCount, name: nameof(DialogCount)); DialogPointer = s.SerializePointer(DialogPointer, name: nameof(DialogPointer)); Dialog = s.DoAt(DialogPointer, () => s.SerializeObjectArray <GBAIsometric_RHR_CutsceneDialog>(Dialog, DialogCount, name: nameof(Dialog))); }
/// <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 + "]"); } }); }
public override void SerializeImpl(SerializerObject s) { Unk1 = s.Serialize <ushort>(Unk1, name: nameof(Unk1)); Unk2 = s.Serialize <ushort>(Unk2, name: nameof(Unk2)); Unk3 = s.Serialize <ushort>(Unk3, name: nameof(Unk3)); ObjectsCount = s.Serialize <uint>(ObjectsCount, name: nameof(ObjectsCount)); OffsetsCount = s.Serialize <uint>(OffsetsCount, name: nameof(OffsetsCount)); UShort_0E = s.Serialize <ushort>(UShort_0E, name: nameof(UShort_0E)); Offsets = s.SerializeArray <uint>(Offsets, OffsetsCount, name: nameof(Offset)); UnusedOffsets = s.SerializeArray <uint>(UnusedOffsets, 4 - OffsetsCount, name: nameof(UnusedOffsets)); ObjectsOffset = s.Serialize <uint>(ObjectsOffset, name: nameof(ObjectsOffset)); UnkData0 = s.SerializeArray <byte>(UnkData0, 24, name: nameof(UnkData0)); ObjectsEndOffset = s.Serialize <uint>(ObjectsEndOffset, name: nameof(ObjectsEndOffset)); UnkData1 = s.SerializeArray <byte>(UnkData1, 76 - 24 - 4, name: nameof(UnkData1)); if (UnkDataBlocks == null) { UnkDataBlocks = new byte[OffsetsCount][]; } for (int i = 0; i < OffsetsCount; i++) { UnkDataBlocks[i] = s.SerializeArray <byte>(UnkDataBlocks[i], 64, name: $"{nameof(UnkDataBlocks)}[{i}]"); } Objects = s.SerializeObjectArray <GBARRR_Object>(Objects, ObjectsCount, name: nameof(Objects)); s.Serialize <uint>(0, "Padding"); }
public void SerializeVignette(SerializerObject s, bool isImgDataCompressed) { // Serialize data from pointers s.DoAt(ImageDataPointer, () => { if (s.Context.Settings.GameModeSelection == GameModeSelection.RaymanDSi) { if (isImgDataCompressed) { s.DoEncoded(new GBA_LZSSEncoder(), () => ImageData = s.SerializeArray <byte>(ImageData, 0x40 * Width * Height, name: nameof(ImageData))); } else { ImageData = s.SerializeArray <byte>(ImageData, 0x40 * Width * Height, name: nameof(ImageData)); } } else { ImageData = s.SerializeArray <byte>(ImageData, 0x20 * Width * Height, name: nameof(ImageData)); } }); s.DoAt(BlockIndicesPointer, () => BlockIndices = s.SerializeArray <ushort>(BlockIndices, Width * Height, name: nameof(BlockIndices))); s.DoAt(PaletteIndicesPointer, () => PaletteIndices = s.SerializeArray <byte>(PaletteIndices, Width * Height, name: nameof(PaletteIndices))); s.DoAt(PalettesPointer, () => { Palettes = s.SerializeObjectArray <ARGB1555Color>(Palettes, (s.Context.Settings.GameModeSelection == GameModeSelection.RaymanDSi) ? 256 : (PaletteCount * 16), name: nameof(Palettes)); }); }
/// <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))); } }
public override void SerializeImpl(SerializerObject s) { Width = s.Serialize <ushort>(Width, name: nameof(Width)); Height = s.Serialize <ushort>(Height, name: nameof(Height)); Collision = s.SerializeObjectArray <GBAIsometric_TileCollision>(Collision, Width * Height, name: nameof(Collision)); }
public override void SerializeBlock(SerializerObject s) { Width = s.Serialize <uint>(Width, name: nameof(Width)); Height = s.Serialize <uint>(Height, name: nameof(Height)); Speed = s.Serialize <uint>(Speed, name: nameof(Speed)); FrameCount = s.Serialize <uint>(FrameCount, name: nameof(FrameCount)); FrameOffsets = s.SerializeArray <uint>(FrameOffsets, FrameCount, name: nameof(FrameOffsets)); if (s.GameSettings.EngineVersion == EngineVersion.GBC_R1_PocketPC) { if (FrameDataPPC == null) { FrameDataPPC = new BGR565Color[FrameCount][]; } for (int i = 0; i < FrameDataPPC.Length; i++) { uint decompressedSize = Width * Height * 2; uint nextOff = i < FrameDataPPC.Length - 1 ? FrameOffsets[i + 1] : BlockSize; uint compressedSize = nextOff - FrameOffsets[i]; s.DoAt(BlockStartPointer + FrameOffsets[i], () => { s.DoEncoded(new Lzo1xEncoder(compressedSize, decompressedSize), () => { FrameDataPPC[i] = s.SerializeObjectArray <BGR565Color>(FrameDataPPC[i], Width * Height, name: $"{nameof(FrameDataPPC)}[{i}]"); }); }); } } }
/// <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 pointerTable = PointerTables.GBAIsometric_PointerTable(s.GameSettings.GameModeSelection, Offset.file); // Serialize level infos LevelInfos = s.DoAt(pointerTable[GBAIsometric_Pointer.Levels], () => s.SerializeObjectArray <GBAIsometric_LevelInfo>(LevelInfos, 20, name: nameof(LevelInfos))); // Serialize localization Localization = s.DoAt(pointerTable[GBAIsometric_Pointer.Localization], () => s.SerializeObject <GBAIsometric_LocalizationTable>(Localization, name: nameof(Localization))); // Serialize object types ObjectTypes = s.DoAt(pointerTable[GBAIsometric_Pointer.ObjTypes], () => s.SerializeObjectArray <GBAIsometric_ObjectType>(ObjectTypes, 105, name: nameof(ObjectTypes))); }
/// <summary> /// Serializes the data /// </summary> /// <param name="s">The serializer object</param> public override void SerializeImpl(SerializerObject s) { // Serialize PC Header base.SerializeImpl(s); // Serialize world data BG1 = s.Serialize <ushort>(BG1, name: nameof(BG1)); BG2 = s.Serialize <ushort>(BG2, name: nameof(BG2)); Plan0NumPcxCount = s.Serialize <byte>(Plan0NumPcxCount, name: nameof(Plan0NumPcxCount)); VideoBiosCheckSum = s.Serialize <byte>(VideoBiosCheckSum, name: nameof(VideoBiosCheckSum)); BiosCheckSum = s.Serialize <byte>(BiosCheckSum, name: nameof(BiosCheckSum)); if (s.GameSettings.EngineVersion == EngineVersion.R1_PC || s.GameSettings.EngineVersion == EngineVersion.R1_PocketPC) { s.DoXOR(0x15, () => Plan0NumPcx = s.SerializeArray <byte>(Plan0NumPcx, Plan0NumPcxCount, name: nameof(Plan0NumPcx))); } else { s.DoXOR(0x19, () => Plan0NumPcxFiles = s.SerializeStringArray(Plan0NumPcxFiles, Plan0NumPcxCount, 8, name: nameof(Plan0NumPcxFiles))); } // Serialize the DES DesItemCount = s.Serialize <ushort>(DesItemCount, name: nameof(DesItemCount)); DesItems = s.SerializeObjectArray <R1_PC_DES>(DesItems, DesItemCount, onPreSerialize: data => data.FileType = R1_PC_DES.Type.World, name: nameof(DesItems)); // Serialize the ETA Eta = s.SerializeArraySize <R1_PC_ETA, byte>(Eta, name: nameof(Eta)); Eta = s.SerializeObjectArray <R1_PC_ETA>(Eta, Eta.Length, name: nameof(Eta)); // Kit and EDU have more data... if (s.GameSettings.EngineVersion == EngineVersion.R1_PC_Kit || s.GameSettings.EngineVersion == EngineVersion.R1_PC_Edu) { // Serialize world defines WorldDefineChecksum = s.DoChecksum(new Checksum8Calculator(false), () => { s.DoXOR(0x71, () => WorldDefine = s.SerializeObject <R1_PC_WorldDefine>(WorldDefine, name: nameof(WorldDefine))); }, ChecksumPlacement.Before, name: nameof(WorldDefineChecksum)); // Serialize file tables if (s.GameSettings.EngineVersion == EngineVersion.R1_PC_Kit) { DESFileNames = s.SerializeStringArray(DESFileNames, 100, 13, name: nameof(DESFileNames)); ETAFileNames = s.SerializeStringArray(ETAFileNames, 60, 13, name: nameof(ETAFileNames)); } } }