public bool Write(DAIIO io, bool skiplength = false) { try { if (!skiplength) { io.WriteBits(Length, LengthBits); } io.WriteBits(BoneName.Length, 0x10); io.WriteString(BoneName); if (Value == null) { Value = new byte[0xC]; } for (int j = 0; j < 0xC; j++) { io.WriteBits(Value[j], 0x8); } return(true); } catch (Exception) { return(false); } }
public bool Write(DAIIO io, bool skiplength = false) { try { if (!skiplength) { io.WriteBits(Length, LengthBits); } io.WriteBits(Name.Length, 0x10); io.WriteString(Name); io.WriteBits(BundleHash, 0x20); io.WriteBits(ParentBundleHash, 0x20); io.WriteBits(HeapType, 0x8); io.WriteBits(InitSize, 0x20); io.WriteBoolean(AllowGrow); io.WriteBits(Status, 0x8); io.WriteBits(BundleType, 0x8); io.WriteBits(GroupID, 0x20); return(true); } catch (Exception) { return(false); } }
public bool Write(DAIIO io, bool skiplength = false) { try { io.WriteInt24(ID); io.WriteInt16((short)Name.Length); io.WriteString(Name); io.WriteInt16((short)Value.Length); io.WriteString(Value); return(true); } catch (Exception) { return(false); } }
public bool Write(DAIIO io, bool skiplength = false) { try { if (!skiplength) { io.WriteBits(Length, LengthBits); } io.WriteInt16(Version); if ((Version & 0xFFFF) >= 2) { io.WriteInt16(MarkerDataLength); io.WriteString(MarkerData); } if ((Version & 0xFFFF) >= 1) { BooleanFlagsThatAreTrue.Write(io); BooleanFlagsThatAreFalse.Write(io); io.WriteInt16(IntegerFlagsCount); if (IntegerFlags == null) { IntegerFlags = new ValueFlag[IntegerFlagsCount]; for (int xb = 0; xb < IntegerFlagsCount; xb++) { IntegerFlags[xb] = new ValueFlag(); } } for (int i = 0; i < IntegerFlagsCount; i++) { IntegerFlags[i].Write(io); } io.WriteInt16(FloatFlagsCount); if (FloatFlags == null) { FloatFlags = new ValueFlag[FloatFlagsCount]; for (int xb = 0; xb < FloatFlagsCount; xb++) { FloatFlags[xb] = new ValueFlag(); } } for (int i = 0; i < FloatFlagsCount; i++) { FloatFlags[i].Write(io); } } return(true); } catch (Exception) { return(false); } }
public bool Write(DAIIO io, bool skiplength = false) { try { if (_info.Version > 1) { io.WriteBoolean(HasDynamicStats); if (HasDynamicStats) { DynamicStats.Write(io); } else if (_info.Version > 3) { DynamicStats.Write(io); } } else if (_iscrafted) { CraftedStatIntances.Write(io); } if (_info.Version > 9) { ItemAbilities.Write(io); } if (_info.Version < 3) { ItemTimelines.Write(io); } ItemMaterials.Write(io); if (_info.Version < 5) { CompositionDisplay.Write(io); } else { io.WriteInt16((short)DisplayString.Length); io.WriteString(DisplayString); } io.WriteInt32(Level); io.WriteInt32(DamageType); io.WriteInt32(Quality); return(true); } catch (Exception) { return(false); } }
public bool Write(DAIIO io, bool skiplength = false) { try { if (!skiplength) { io.WriteBits(Length, LengthBits); } io.WriteInt32(Version); io.WriteInt32(ClassId); io.WriteInt32(BackgroundId); io.WriteInt32(GenderId); io.WriteInt32(RaceId); io.WriteInt16((short)CharacterName.Length); io.WriteString(CharacterName); io.WriteInt32(VoiceVariationID); io.WriteInt32(DifficultyModeID); if (Version > 9) { io.WriteInt32(LowestDifficultyModeID); } io.WriteInt32(CharacterSubclassID); if (Version >= 8) { if (CharacterID == null) { CharacterID = new byte[0x10]; } io.Write(CharacterID, 0, 0x10); } if (Version >= 0xD) { io.WriteSingle(AgeInRealTimeSeconds); } return(true); } catch (Exception) { return(false); } }
public bool Write(DAIIO io, bool skiplength = false) { try { if (!skiplength) { io.WriteBits(Length, LengthBits); } io.WriteBits(Name.Length, 0x10); if (Name.Length > 0) { io.WriteString(Name); if (Hash == null) { Hash = new byte[0]; } io.WriteBits(Hash.Length, 0x10); if (Hash.Length > 0) { io.Write(Hash, 0, Hash.Length); } else if (Unknown != null) { io.Write(Unknown, 0, Unknown.Length); } } else if (Unknown != null) { io.Write(Unknown, 0, Unknown.Length); } return(true); } catch (Exception) { return(false); } }
public bool Write(DAIIO io, bool skiplength = false) { try { if (!skiplength) { io.WriteBits(Length, LengthBits); } io.WriteBits(HeadOverrideIndex, 0x8); io.WriteBits(Gender, 0x8); io.WriteBits(Race, 0x8); io.WriteBits(Hair, 0x8); io.WriteBits(Beard, 0x8); if (_data.Version >= 9) { io.WriteBits(Horns, 0x8); } VectorShaderParams.Write(io); TextureShaderParams.Write(io); if (_data.Version >= 0xF) { BodyShaderHandles.Write(io); } if (_data.Version >= 0xC) { if (_data.Version < 0xE) { BoneOffsetsV1.Write(io); } else { BoneOffsetsV2.Write(io); } } if (_data.Version >= 0x9) { if (_data.Version >= 0xB) { HeadVariations.Write(io); } else { if (FaceVerticesBytes == null) { FaceVerticesBytes = new byte[FaceVerticesSize]; } FaceVerticesSize = FaceVerticesBytes.Length; io.WriteBits(FaceVerticesSize, 0x20); io.Write(FaceVerticesBytes, 0, FaceVerticesSize); } } else { io.WriteBits(FaceCodeVersion, 0x20); io.WriteInt16((short)FaceCode.Length); io.WriteString(FaceCode); } if (_data.Version >= 0x10) { if (DnaData == null) { DnaData = new byte[DnaSize]; } DnaSize = DnaData.Length; io.WriteInt32(DnaSize); for (int j = 0; j < DnaSize; j++) { if (j == (DnaSize - 3)) { Console.WriteLine(); } io.WriteBits(DnaData[j], 8); } } return(true); } catch (Exception) { return(false); } }
public bool Write(DAIIO io, bool skiplength = false) { try { io.xbaseStream.Write(DataMagic, 0, 8); io.Position = 0x41; io.WriteInt64(SavedTime.ToUnixSecondsWithAdd()); io.WriteInt16((short)SID.Length); io.WriteString(SID); io.WriteUInt16(GameVersion); io.WriteUInt16(SaveVersion); io.WriteUInt16(ProjectVersion); io.WriteUInt16(BitstreamFeatures); io.WriteUInt32(ChangeList); io.WriteUInt16((ushort)Level.Length); io.WriteString(Level); io.WriteUInt32(Difficulty); if (BundleList == null) { BundleList = new string[BundleCount]; for (int xb = 0; xb < BundleCount; xb++) { BundleList[xb] = ""; } } BundleCount = (ushort)BundleList.Length; io.WriteUInt16(BundleCount); for (int i = 0; i < BundleCount; i++) { io.WriteInt16((short)BundleList[i].Length); io.WriteString(BundleList[i]); } if (Inclusions == null) { Inclusions = new Inclusion[InclusionCount]; for (int xb = 0; xb < InclusionCount; xb++) { Inclusions[xb] = new Inclusion(); } } InclusionCount = (ushort)Inclusions.Length; io.WriteInt16((short)InclusionCount); for (int i = 0; i < InclusionCount; i++) { Inclusions[i].Write(io); } if (SubLevelInfoCount <= 0x40 && SubLevelInfoCount > 0) { if (SubLevelEntries == null) { SubLevelEntries = new SubLevelInfo[SubLevelInfoCount]; for (int xb = 0; xb < SubLevelInfoCount; xb++) { SubLevelEntries[xb] = new SubLevelInfo(); } } SubLevelInfoCount = SubLevelEntries.Length; io.WriteBits(SubLevelInfoCount, 0xc); for (int i = 0; i < SubLevelInfoCount; i++) { SubLevelEntries[i].Write(io); } } if (LevelChecksum == null) { LevelChecksum = new byte[0x10]; } for (int i = 0; i < 0x10; i++) { io.WriteBits(LevelChecksum[i], 0x8); } io.WriteBits(DLC, 0x14); io.WriteBits(EntityVersion, 0x10); io.WriteBits(ProjectVersionContext, 0x10); io.WriteBoolean(HasDebugInfo); /////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////CALCULATE SECTION BOOKMARKS///////////////////////////////////////// var pos = io.Position; /////////////////////////////////////////////////////////////////////////// pos += 0x54; //////////////////////////////////////////////////////////////////////////////////// pos += (EntityContentLength + ////////////////////////////////////////////////////////////////// (((SaveEntityComplexLength + 0x38) + SaveEntity.Length) + EntityMetaData.Length)); //// AgentTocBookmark = (int)pos; //////////////////////////////////////////////////////////////// pos += (AgentToc.Length + 0x18); //////////////////////////////////////////////////////////// ClientDataBookmark = (int)pos; //////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// io.WriteBits(AgentTocBookmark, 0x1A); io.WriteBits(ClientDataBookmark, 0x1A); io.WriteBits(EntityContentLength, 0x20); /////////////////////////////////////////////////////////////////////////////// ////////////////////////WRITE UNFINISHED SECTION////////////////////////////// EntityContent.Write(io); ///////////////////////////////////////////////////// //MUST WRITE UNFINISHED RAW DATA, REMOVE IF CONTENT HAS BEEN MAPPED OUT///// if (tmpdata.Length > 0) //////////////////////////////////////////////////// { io.WriteData(tmpdata, (EntityContentLength - EntityContent.Length)); //// } ///////////////////////////////////////////////////////////////////////// //Start writing SaveEntity SaveEntityBookmark = (int)io.Position; io.WriteBits(SaveEntityComplexLength, 6); io.WriteData(SaveEntityComplex, SaveEntityComplexLength); io.WriteBits(SaveEntityBookmark, 0x1A); SaveEntity.Write(io); EntityMetaData.Write(io); AgentToc.Write(io); ClientData.Write(io); // io.FinishWriter(); if (LastPartSeedLength > 0) { io.WriteBits((uint)LastPartSeed, (uint)LastPartSeedLength, true); } io.Flush(); return(true); } catch (Exception) { return(false); } }