Пример #1
0
 public void Serialize(IBinarySerializer s)
 {
     if (s.GetSettings <UbiArtSettings>().Game == UbiArtGame.RaymanOrigins)
     {
         Id = s.SerializeLengthPrefixedString(Id, name: nameof(Id));
     }
     else
     {
         Levels   = s.SerializeUbiArtObjectArray <Level>(Levels, name: nameof(Levels));
         Id       = s.SerializeLengthPrefixedString(Id, name: nameof(Id));
         Absolute = s.SerializeBool <uint>(Absolute, name: nameof(Absolute));
     }
 }
        /// <summary>
        /// Handles the serialization using the specified serializer
        /// </summary>
        /// <param name="s">The serializer</param>
        public void Serialize(IBinarySerializer s)
        {
            // 3DS files can not be serialized separately
            if (IPKVersion == 4)
            {
                throw new BinarySerializableException("File data for IPK 4 can not be serialized separately");
            }

            // Read common values
            OffsetCount    = s.Serialize <uint>(OffsetCount, name: nameof(OffsetCount));
            Size           = s.Serialize <uint>(Size, name: nameof(Size));
            CompressedSize = s.Serialize <uint>(CompressedSize, name: nameof(CompressedSize));
            TStamp         = s.Serialize <ulong>(TStamp, name: nameof(TStamp));

            Offsets = s.SerializeArray <ulong>(Offsets, (int)OffsetCount, name: nameof(Offsets));

            // For any game after Origins the path is in the standard format
            if (IPKVersion >= 5)
            {
                Path = s.SerializeObject <UbiArtPath>(Path, name: nameof(Path));
            }
            else
            {
                Path = new UbiArtPath(s.SerializeLengthPrefixedString(Path?.FullPath, name: nameof(Path)));
            }
        }
Пример #3
0
        /// <summary>
        /// Handles the serialization using the specified serializer
        /// </summary>
        /// <param name="s">The serializer</param>
        public void Serialize(IBinarySerializer s)
        {
            // Just Dance reads the values in reverse
            if (s.GetSettings <UbiArtSettings>().Game == UbiArtGame.JustDance2017)
            {
                // Read the path
                FileName      = s.SerializeLengthPrefixedString(FileName, name: nameof(FileName));
                DirectoryPath = s.SerializeLengthPrefixedString(DirectoryPath, name: nameof(DirectoryPath));
            }
            else
            {
                // Read the path
                DirectoryPath = s.SerializeLengthPrefixedString(DirectoryPath, name: nameof(DirectoryPath));
                FileName      = s.SerializeLengthPrefixedString(FileName, name: nameof(FileName));
            }

            StringID = s.SerializeObject <UbiArtStringID>(StringID, name: nameof(StringID));

            if (s.GetSettings <UbiArtSettings>().Game != UbiArtGame.RaymanOrigins)
            {
                Flags = s.Serialize <uint>(Flags, name: nameof(Flags));
            }
        }
Пример #4
0
 /// <summary>
 /// Handles the serialization using the specified serializer
 /// </summary>
 /// <param name="s">The serializer</param>
 public void Serialize(IBinarySerializer s)
 {
     Pid                  = s.Serialize <int>(Pid, name: nameof(Pid));
     Name                 = s.SerializeLengthPrefixedString(Name, name: nameof(Name));
     StatusIcon           = s.Serialize <uint>(StatusIcon, name: nameof(StatusIcon));
     Country              = s.Serialize <int>(Country, name: nameof(Country));
     GlobalMedalsRank     = s.Serialize <uint>(GlobalMedalsRank, name: nameof(GlobalMedalsRank));
     GlobalMedalsMaxRank  = s.Serialize <uint>(GlobalMedalsMaxRank, name: nameof(GlobalMedalsMaxRank));
     DiamondMedals        = s.Serialize <uint>(DiamondMedals, name: nameof(DiamondMedals));
     GoldMedals           = s.Serialize <uint>(GoldMedals, name: nameof(GoldMedals));
     SilverMedals         = s.Serialize <uint>(SilverMedals, name: nameof(SilverMedals));
     BronzeMedals         = s.Serialize <uint>(BronzeMedals, name: nameof(BronzeMedals));
     PlayerStats          = s.SerializeObject <PlayerStatsData>(PlayerStats, name: nameof(PlayerStats));
     Costume              = s.Serialize <uint>(Costume, name: nameof(Costume));
     TotalChallengePlayed = s.Serialize <uint>(TotalChallengePlayed, name: nameof(TotalChallengePlayed));
 }
        /// <summary>
        /// Serializes an unknown generic value for UbiArt games
        /// </summary>
        /// <typeparam name="T">The type of value to serialize</typeparam>
        /// <param name="s">The serializer</param>
        /// <param name="value">The value</param>
        /// <param name="name">The object value name, for logging</param>
        /// <returns>The value</returns>
        public static T SerializeUbiArtGenericValue <T>(this IBinarySerializer s, T value, string name = null)
        {
            // Get the type
            var t = typeof(T);

            // Check if the value is a boolean or string, which we handle differently
            if (t == typeof(string))
            {
                return((T)(object)s.SerializeLengthPrefixedString((string)(object)value, name: name));
            }
            else if (t == typeof(bool))
            {
                return((T)(object)s.SerializeBool <uint>((bool)(object)value, name: name));
            }
            else
            {
                return(s.Serialize <T>(value, name: name));
            }
        }
Пример #6
0
 /// <summary>
 /// Handles the serialization using the specified serializer
 /// </summary>
 /// <param name="s">The serializer</param>
 public void Serialize(IBinarySerializer s)
 {
     DefaultText = s.SerializeLengthPrefixedString(DefaultText, name: nameof(DefaultText));
     LocId       = s.SerializeObject <LocalisationId>(LocId, name: nameof(LocId));
     UseText     = s.SerializeBool <uint>(UseText, name: nameof(UseText));
 }
 /// <summary>
 /// Handles the serialization using the specified serializer
 /// </summary>
 /// <param name="s">The serializer</param>
 public void Serialize(IBinarySerializer s)
 {
     Unknown0  = s.Serialize <uint>(Unknown0, name: nameof(Unknown0));
     AudioFile = s.SerializeLengthPrefixedString(AudioFile, name: nameof(AudioFile));
     Unknown1  = s.Serialize <uint>(Unknown1, name: nameof(Unknown1));
 }
Пример #8
0
 public void Serialize(IBinarySerializer s)
 {
     Name   = s.SerializeLengthPrefixedString(Name, name: nameof(Name));
     Parent = s.SerializeBool <uint>(Parent);
 }
Пример #9
0
 public void Serialize(IBinarySerializer s)
 {
     Levels                             = s.SerializeUbiArtObjectArray <UbiArtObjKeyObjValuePair <UbiArtStringID, UbiArtGeneric <PersistentGameData_Level> > >(Levels, name: nameof(Levels));
     Rewards                            = s.SerializeObject <SaveSession>(Rewards, name: nameof(Rewards));
     Score                              = s.SerializeObject <PersistentGameData_Score>(Score, name: nameof(Score));
     Profile                            = s.SerializeObject <ProfileData>(Profile, name: nameof(Profile));
     BubbleDreamer                      = s.SerializeObject <PersistentGameData_BubbleDreamerData>(BubbleDreamer, name: nameof(BubbleDreamer));
     UnlockedPets                       = s.SerializeUbiArtArray <int>(UnlockedPets, name: nameof(UnlockedPets));
     PetsDailyReward                    = s.SerializeUbiArtObjectArray <PetRewardData>(PetsDailyReward, name: nameof(PetsDailyReward));
     UnlockedCupsForPets                = s.SerializeUbiArtObjectArray <St_petCups>(UnlockedCupsForPets, name: nameof(UnlockedCupsForPets));
     GivenPetCount                      = s.Serialize <uint>(GivenPetCount, name: nameof(GivenPetCount));
     NewPetsUnlocked                    = s.SerializeBool <uint>(NewPetsUnlocked, name: nameof(NewPetsUnlocked));
     FirstPetShown                      = s.SerializeBool <uint>(FirstPetShown, name: nameof(FirstPetShown));
     HasShownMessageAllPet              = s.SerializeBool <uint>(HasShownMessageAllPet, name: nameof(HasShownMessageAllPet));
     Messages                           = s.SerializeUbiArtObjectArray <Message>(Messages, name: nameof(Messages));
     MessagesTotalCount                 = s.Serialize <uint>(MessagesTotalCount, name: nameof(MessagesTotalCount));
     Messages_onlineDate                = s.SerializeObject <UbiArtDateTime>(Messages_onlineDate, name: nameof(Messages_onlineDate));
     Messages_localDate                 = s.SerializeObject <UbiArtDateTime>(Messages_localDate, name: nameof(Messages_localDate));
     Messages_readDrcCount              = s.Serialize <uint>(Messages_readDrcCount, name: nameof(Messages_readDrcCount));
     Messages_interactDrcCount          = s.Serialize <uint>(Messages_interactDrcCount, name: nameof(Messages_interactDrcCount));
     Messages_lastSeenMessageHandle     = s.Serialize <uint>(Messages_lastSeenMessageHandle, name: nameof(Messages_lastSeenMessageHandle));
     Messages_tutoCount                 = s.Serialize <uint>(Messages_tutoCount, name: nameof(Messages_tutoCount));
     Messages_drcCountSinceLastInteract = s.Serialize <uint>(Messages_drcCountSinceLastInteract, name: nameof(Messages_drcCountSinceLastInteract));
     PlayerCard_displayedCount          = s.Serialize <uint>(PlayerCard_displayedCount, name: nameof(PlayerCard_displayedCount));
     PlayerCard_tutoSeen                = s.SerializeBool <uint>(PlayerCard_tutoSeen, name: nameof(PlayerCard_tutoSeen));
     GameCompleted                      = s.SerializeBool <uint>(GameCompleted, name: nameof(GameCompleted));
     TimeToCompleteGameInSec            = s.Serialize <uint>(TimeToCompleteGameInSec, name: nameof(TimeToCompleteGameInSec));
     TimeSpendInGameInSec               = s.Serialize <uint>(TimeSpendInGameInSec, name: nameof(TimeSpendInGameInSec));
     TeensiesBonusCounter               = s.Serialize <uint>(TeensiesBonusCounter, name: nameof(TeensiesBonusCounter));
     LuckyTicketsCounter                = s.Serialize <uint>(LuckyTicketsCounter, name: nameof(LuckyTicketsCounter));
     LuckyTicketLevelCount              = s.Serialize <uint>(LuckyTicketLevelCount, name: nameof(LuckyTicketLevelCount));
     RetroMapUnlockedCounter            = s.Serialize <uint>(RetroMapUnlockedCounter, name: nameof(RetroMapUnlockedCounter));
     MrDarkUnlockCount                  = s.SerializeUbiArtObjectArray <UbiArtStringID>(MrDarkUnlockCount, name: nameof(MrDarkUnlockCount));
     CatchEmAllIndex                    = s.Serialize <uint>(CatchEmAllIndex, name: nameof(CatchEmAllIndex));
     NewCostumes                        = s.SerializeUbiArtObjectArray <UbiArtStringID>(NewCostumes, name: nameof(NewCostumes));
     CostumeUnlockSeen                  = s.SerializeUbiArtObjectArray <UbiArtStringID>(CostumeUnlockSeen, name: nameof(CostumeUnlockSeen));
     RetroUnlocks                       = s.SerializeUbiArtObjectArray <UbiArtStringID>(RetroUnlocks, name: nameof(RetroUnlocks));
     NewUnlockedDoor                    = s.SerializeUbiArtObjectArray <UnlockedDoor>(NewUnlockedDoor, name: nameof(NewUnlockedDoor));
     LuckyTicketRewardList              = s.SerializeUbiArtObjectArray <RO2_LuckyTicketReward>(LuckyTicketRewardList, name: nameof(LuckyTicketRewardList));
     NodeData                           = s.SerializeUbiArtObjectArray <NodeDataStruct>(NodeData, name: nameof(NodeData));
     LuckyTicketsRewardGivenCounter     = s.Serialize <uint>(LuckyTicketsRewardGivenCounter, name: nameof(LuckyTicketsRewardGivenCounter));
     ConsecutiveLuckyTicketCount        = s.Serialize <uint>(ConsecutiveLuckyTicketCount, name: nameof(ConsecutiveLuckyTicketCount));
     TicketReminderMessageCount         = s.Serialize <uint>(TicketReminderMessageCount, name: nameof(TicketReminderMessageCount));
     DisplayGhosts                      = s.Serialize <uint>(DisplayGhosts, name: nameof(DisplayGhosts));
     UplayDoneAction0                   = s.SerializeBool <uint>(UplayDoneAction0, name: nameof(UplayDoneAction0));
     UplayDoneAction1                   = s.SerializeBool <uint>(UplayDoneAction1, name: nameof(UplayDoneAction1));
     UplayDoneAction2                   = s.SerializeBool <uint>(UplayDoneAction2, name: nameof(UplayDoneAction2));
     UplayDoneAction3                   = s.SerializeBool <uint>(UplayDoneAction3, name: nameof(UplayDoneAction3));
     UplayDoneReward0                   = s.SerializeBool <uint>(UplayDoneReward0, name: nameof(UplayDoneReward0));
     UplayDoneReward1                   = s.SerializeBool <uint>(UplayDoneReward1, name: nameof(UplayDoneReward1));
     UplayDoneReward2                   = s.SerializeBool <uint>(UplayDoneReward2, name: nameof(UplayDoneReward2));
     UplayDoneReward3                   = s.SerializeBool <uint>(UplayDoneReward3, name: nameof(UplayDoneReward3));
     PlayedDiamondCupSequence           = s.SerializeUbiArtObjectArray <UbiArtStringID>(PlayedDiamondCupSequence, name: nameof(PlayedDiamondCupSequence));
     Costumes                           = s.SerializeUbiArtObjectArray <UbiArtStringID>(Costumes, name: nameof(Costumes));
     PlayedChallenge                    = s.SerializeUbiArtArray <uint>(PlayedChallenge, name: nameof(PlayedChallenge));
     PlayedInvasion                     = s.SerializeUbiArtObjectArray <UbiArtStringID>(PlayedInvasion, name: nameof(PlayedInvasion));
     TvOffOptionEnabledNb               = s.Serialize <uint>(TvOffOptionEnabledNb, name: nameof(TvOffOptionEnabledNb));
     TvOffOptionActivatedTime           = s.Serialize <uint>(TvOffOptionActivatedTime, name: nameof(TvOffOptionActivatedTime));
     BarbaraCostumeUnlockSeen           = s.SerializeBool <uint>(BarbaraCostumeUnlockSeen, name: nameof(BarbaraCostumeUnlockSeen));
     WorldUnlockMessagesSeen            = s.SerializeUbiArtObjectArray <UbiArtStringID>(WorldUnlockMessagesSeen, name: nameof(WorldUnlockMessagesSeen));
     RetroWorldUnlockMessageSeen        = s.SerializeBool <uint>(RetroWorldUnlockMessageSeen, name: nameof(RetroWorldUnlockMessageSeen));
     FreedAllTeensiesMessageSeen        = s.SerializeBool <uint>(FreedAllTeensiesMessageSeen, name: nameof(FreedAllTeensiesMessageSeen));
     MisterDarkCompletionMessageSeen    = s.SerializeBool <uint>(MisterDarkCompletionMessageSeen, name: nameof(MisterDarkCompletionMessageSeen));
     FirstInvasionMessageSeen           = s.SerializeBool <uint>(FirstInvasionMessageSeen, name: nameof(FirstInvasionMessageSeen));
     InvitationTutoSeen                 = s.SerializeBool <uint>(InvitationTutoSeen, name: nameof(InvitationTutoSeen));
     MessageSeen8Bit                    = s.SerializeBool <uint>(MessageSeen8Bit, name: nameof(MessageSeen8Bit));
     ChallengeWorldUnlockMessageSeen    = s.SerializeBool <uint>(ChallengeWorldUnlockMessageSeen, name: nameof(ChallengeWorldUnlockMessageSeen));
     DoorUnlockMessageSeen              = s.SerializeUbiArtObjectArray <UbiArtStringID>(DoorUnlockMessageSeen, name: nameof(DoorUnlockMessageSeen));
     DoorUnlockDRCMessageRequired       = s.SerializeUbiArtObjectArray <UbiArtStringID>(DoorUnlockDRCMessageRequired, name: nameof(DoorUnlockDRCMessageRequired));
     LuckyTicketRewardWorldName         = s.SerializeObject <UbiArtStringID>(LuckyTicketRewardWorldName, name: nameof(LuckyTicketRewardWorldName));
     IsUGCMiiverseWarningSet            = s.SerializeBool <uint>(IsUGCMiiverseWarningSet, name: nameof(IsUGCMiiverseWarningSet));
     Reward39Failed                     = s.Serialize <int>(Reward39Failed, name: nameof(Reward39Failed));
     UnlockPrivilegesData               = s.SerializeLengthPrefixedString(UnlockPrivilegesData, name: nameof(UnlockPrivilegesData));
     IsDemoRewardChecked                = s.Serialize <int>(IsDemoRewardChecked, name: nameof(IsDemoRewardChecked));
     PrisonerDataDummy                  = s.SerializeObject <PrisonerData>(PrisonerDataDummy, name: nameof(PrisonerDataDummy));
     PersistentGameDataLevelDummy       = s.SerializeObject <PersistentGameData_Level>(PersistentGameDataLevelDummy, name: nameof(PersistentGameDataLevelDummy));
     MessageDummy                       = s.SerializeObject <Message>(MessageDummy, name: nameof(MessageDummy));
     UnlockedDoorDummy                  = s.SerializeObject <UnlockedDoor>(UnlockedDoorDummy, name: nameof(UnlockedDoorDummy));
     BubbleDreamerDataDummy             = s.SerializeObject <PersistentGameData_BubbleDreamerData>(BubbleDreamerDataDummy, name: nameof(BubbleDreamerDataDummy));
     DummmyNodeData                     = s.SerializeObject <NodeDataStruct>(DummmyNodeData, name: nameof(DummmyNodeData));
 }