public static FlverDummy Read(DSBinaryReader bin, DataFiles.FLVER ContainingFlver) { var dmy = new FlverDummy(ContainingFlver); dmy.Position = bin.ReadVector3(); dmy.UnknownByte1 = bin.ReadByte(); dmy.UnknownByte2 = bin.ReadByte(); dmy.UnknownShort1 = bin.ReadInt16(); dmy.Row2 = bin.ReadVector3(); dmy.TypeID = bin.ReadInt16(); dmy.ParentBoneIndex = bin.ReadInt16(); dmy.Row3 = bin.ReadVector3(); dmy.SomeSortOfParentIndex = bin.ReadInt16(); dmy.UnknownFlag1 = bin.ReadBoolean(); dmy.UnknownFlag2 = bin.ReadBoolean(); //hit.Row4 = bin.ReadVector3(); //hit.Row4_ID1 = bin.ReadInt16(); //hit.Row4_ID2 = bin.ReadInt16(); bin.ReadBytes(16); return(dmy); }
protected override void SubtypeRead(DSBinaryReader bin) { //SUx00 = bin.ReadInt32(); SUB_CONST_1 = bin.ReadInt32(); if (bin.LongOffsets) { bin.Jump(4); } i_AttachObj = bin.ReadInt32(); if (bin.LongOffsets) { bin.Jump(4); } ItemLot1 = bin.ReadInt32(); SUB_CONST_2 = bin.ReadInt32(); ItemLot2 = bin.ReadInt32(); SUB_CONST_3 = bin.ReadInt32(); ItemLot3 = bin.ReadInt32(); SUB_CONST_4 = bin.ReadInt32(); ItemLot4 = bin.ReadInt32(); SUB_CONST_5 = bin.ReadInt32(); ItemLot5 = bin.ReadInt32(); SUB_CONST_6 = bin.ReadInt32(); if (!bin.IsDeS) { InChest = bin.ReadBoolean(); StartDisabled = bin.ReadBoolean(); SUB_CONST_7 = bin.ReadByte(); SUB_CONST_8 = bin.ReadByte(); } }
protected override void SubtypeRead(DSBinaryReader bin) { MsgID = bin.ReadInt16(); SUB_CONST_1 = bin.ReadInt16(); SeekGuidanceOnly = bin.ReadBoolean(); SUB_CONST_2 = bin.ReadByte(); SUB_CONST_3 = bin.ReadInt16(); }
protected override void SubtypeRead(DSBinaryReader bin) { //SUx00 = bin.ReadInt32(); SUB_CONST_1 = bin.ReadInt32(); i_AttachObj = bin.ReadInt32(); ItemLot1 = bin.ReadInt32(); SUB_CONST_2 = bin.ReadInt32(); ItemLot2 = bin.ReadInt32(); SUB_CONST_3 = bin.ReadInt32(); ItemLot3 = bin.ReadInt32(); SUB_CONST_4 = bin.ReadInt32(); ItemLot4 = bin.ReadInt32(); SUB_CONST_5 = bin.ReadInt32(); ItemLot5 = bin.ReadInt32(); SUB_CONST_6 = bin.ReadInt32(); InChest = bin.ReadBoolean(); StartDisabled = bin.ReadBoolean(); SUB_CONST_7 = bin.ReadByte(); SUB_CONST_8 = bin.ReadByte(); }
private AnimationRef LoadAnimationFromOffset(DSBinaryReader bin, int offset, int id, Dictionary <int, List <int> > debugUnkTypesReport) { int oldOffset = (int)bin.BaseStream.Position; bin.BaseStream.Seek(offset, SeekOrigin.Begin); var anim = new AnimationRef(); anim.ID = id; try { Dictionary <int, TimeActEventBase> eventOffsetLookupForEventGroup = new Dictionary <int, TimeActEventBase>(); int eventCount = bin.ReadInt32(); int eventHeadersOffset = bin.ReadInt32(); int eventGroupCount = bin.ReadInt32(); int eventGroupOffset = bin.ReadInt32(); var timeConstantsCount = bin.ReadInt32(); var timeConstantsOffset = bin.ReadInt32(); int animFileOffset = bin.ReadInt32(); if (Header.IsBigEndian) { bin.AssertInt32(0); bin.AssertInt32(0); bin.AssertInt32(0); bin.AssertInt32(0); bin.AssertInt32(0); } if (eventCount > 0) { for (int i = 0; i < eventCount; i++) { var thisEventOffset = eventHeadersOffset + (EventHeaderSize * i); //lazily seek to the start of each event manually. bin.BaseStream.Seek(thisEventOffset, SeekOrigin.Begin); int startTimeOffset = bin.ReadInt32(); int endTimeOffset = bin.ReadInt32(); int eventBodyOffset = bin.ReadInt32(); //if (EventHeaderSize >= 0x10) //{ // int unk = bin.ReadInt32(); // throw new Exception(); //} float startTime = -1; float endTime = -1; bin.StepIn(startTimeOffset); { startTime = bin.ReadSingle(); } bin.StepOut(); bin.StepIn(endTimeOffset); { endTime = bin.ReadSingle(); } bin.StepOut(); bin.StepIn(eventBodyOffset); { int eventTypeInt = bin.ReadInt32(); TimeActEventType eventType = (TimeActEventType)eventTypeInt; int eventParamOffset = bin.ReadInt32(); if (eventParamOffset <= 0) { var newEvent = TimeActEventBase.GetNewEvent(eventType, startTime, endTime); newEvent.Index = anim.EventList.Count; anim.EventList.Add(newEvent); eventOffsetLookupForEventGroup.Add(thisEventOffset, newEvent); } else { bin.StepIn(eventParamOffset); { var newEvent = TimeActEventBase.GetNewEvent(eventType, startTime, endTime); if (newEvent == null) { if (!debugUnkTypesReport.ContainsKey(eventTypeInt)) { debugUnkTypesReport.Add(eventTypeInt, new List <int>()); } if (i < eventCount - 1) { bin.StepIn(eventHeadersOffset + (EventHeaderSize * (i + 1))); { bin.ReadInt32(); //startTimeOffset bin.ReadInt32(); //endTimeOffset var nextEventBodyOffset = bin.ReadInt32(); int thisUnkParamByteCount = nextEventBodyOffset - eventParamOffset; if (!debugUnkTypesReport[eventTypeInt].Contains(thisUnkParamByteCount)) { debugUnkTypesReport[eventTypeInt].Add(thisUnkParamByteCount); } //bin.StepIn(nextEventBodyOffset); //{ // bin.ReadInt32();//eventType // var nextEventParamOffset = bin.ReadInt32(); // int thisUnkParamByteCount = nextEventParamOffset - eventParamOffset; // debugUnkTypesReport[eventTypeInt].Add(thisUnkParamByteCount); //} //bin.StepOut(); } bin.StepOut(); } else { //debugUnkTypesReport[eventTypeInt].Add(-1); } } else { newEvent.ReadParameters(bin); newEvent.Index = anim.EventList.Count; anim.EventList.Add(newEvent); eventOffsetLookupForEventGroup.Add(thisEventOffset, newEvent); } } bin.StepOut(); } } bin.StepOut(); } } if (eventGroupCount > 0 && eventGroupOffset > 0) { bin.StepIn(eventGroupOffset); { for (int i = 0; i < eventGroupCount; i++) { var group = new TimeActEventGroup(); int groupEntryCount = bin.ReadInt32(); int groupPointerOffset = bin.ReadInt32(); int groupTypeOffset = bin.ReadInt32(); bin.StepIn(groupPointerOffset); { for (int j = 0; j < groupEntryCount; j++) { var groupEventOffset = bin.ReadInt32(); if (eventOffsetLookupForEventGroup.ContainsKey(groupEventOffset)) { var thisGroupEvent = eventOffsetLookupForEventGroup[groupEventOffset]; group.Events.Add(thisGroupEvent); } } } bin.StepOut(); bin.StepIn(groupTypeOffset); { group.GeneralType = (TimeActEventType)bin.ReadInt32(); } bin.StepOut(); anim.EventGroupList.Add(group); } } bin.StepOut(); } bin.BaseStream.Seek(animFileOffset, SeekOrigin.Begin); int fileType = bin.ReadInt32(); if (fileType == 0) { anim.IsReference = false; int dataOffset = bin.ReadInt32(); //bin.BaseStream.Seek(dataOffset, SeekOrigin.Begin); int nameOffset = -1; if (Header.IsBigEndian) { anim.OriginalAnimID = bin.ReadInt32(); bin.AssertByte(0); anim.TAEDataOnly = bin.ReadBoolean(); anim.UseHKXOnly = bin.ReadBoolean(); anim.IsLoopingObjAnim = bin.ReadBoolean(); nameOffset = bin.ReadInt32(); var secondaryNameOffset = bin.ReadInt32(); } else { nameOffset = bin.ReadInt32(); anim.IsLoopingObjAnim = bin.ReadBoolean(); anim.UseHKXOnly = bin.ReadBoolean(); anim.TAEDataOnly = bin.ReadBoolean(); bin.AssertByte(0); anim.OriginalAnimID = bin.ReadInt32(); bin.AssertInt32(0); } if (nameOffset <= 0) { //throw new Exception("Anim file type was that of a named one but the name pointer was NULL."); } else { bin.BaseStream.Seek(nameOffset, SeekOrigin.Begin); anim.FileName = ReadUnicodeString(bin); } } else if (fileType == 1) { anim.IsReference = true; anim.FileName = null; if (Header.IsBigEndian) { var nullA = bin.ReadInt32(); var nullB = bin.ReadInt32(); var offsetPointingToNextDword = bin.ReadInt32(); var offsetPointingToStartOfNextAnimFileStruct = bin.ReadInt32(); anim.RefAnimID = bin.ReadInt32(); var nullC = bin.ReadInt32(); } else { var offsetPointingToNextDword = bin.ReadInt32(); var offsetPointingToStartOfNextAnimFileStruct = bin.ReadInt32(); anim.RefAnimID = bin.ReadInt32(); var nullA = bin.ReadInt32(); var nullB = bin.ReadInt32(); var nullC = bin.ReadInt32(); } } else { throw new Exception($"Unknown anim file type code: {fileType}"); } return(anim); } catch (EndOfStreamException) { MiscUtil.PrintlnDX($"Warning: reached end of file while parsing animation {id}; data may not be complete.", ConsoleColor.Yellow); //if (!MiscUtil.ConsolePrompYesNo("Would you like to continue loading the file and run the risk of " + // "accidentally outputting a file that might be missing some of its original data?")) //{ // throw new LoadAbortedException(); //} //else //{ // return a; //} return(anim); } finally { bin.BaseStream.Seek(oldOffset, SeekOrigin.Begin); } }
protected override void InternalRead(DSBinaryReader bin) { Name = bin.ReadMsbString(); bin.AssertInt32((int)Type); Index = bin.ReadInt32(); i_ModelName = bin.ReadInt32(); PlaceholderModel = bin.ReadMsbString(); PosX = bin.ReadSingle(); PosY = bin.ReadSingle(); PosZ = bin.ReadSingle(); RotX = bin.ReadSingle(); RotY = bin.ReadSingle(); RotZ = bin.ReadSingle(); ScaleX = bin.ReadSingle(); ScaleY = bin.ReadSingle(); ScaleZ = bin.ReadSingle(); DrawGroup1 = bin.ReadInt32(); DrawGroup2 = bin.ReadInt32(); DrawGroup3 = bin.ReadInt32(); DrawGroup4 = bin.ReadInt32(); DispGroup1 = bin.ReadInt32(); DispGroup2 = bin.ReadInt32(); DispGroup3 = bin.ReadInt32(); DispGroup4 = bin.ReadInt32(); int baseDataOffset = bin.ReadInt32(); int subtypeDataOffset = bin.ReadInt32(); BASE_CONST_1 = bin.ReadInt32(); bin.StepInMSB(baseDataOffset); { EntityID = bin.ReadInt32(); LightID = bin.ReadSByte(); FogID = bin.ReadSByte(); ScatterID = bin.ReadSByte(); LensFlareID = bin.ReadSByte(); ShadowID = bin.ReadSByte(); DofID = bin.ReadSByte(); ToneMapID = bin.ReadSByte(); ToneCorrectID = bin.ReadSByte(); LanternID = bin.ReadSByte(); LodParamID = bin.ReadSByte(); BASE_CONST_2 = bin.ReadByte(); IsShadowSrc = bin.ReadBoolean(); IsShadowDest = bin.ReadBoolean(); IsShadowOnly = bin.ReadBoolean(); DrawByReflectCam = bin.ReadBoolean(); DrawOnlyReflectCam = bin.ReadBoolean(); IsUseDepthBiasFloat = bin.ReadSByte(); DisablePointLightEffect = bin.ReadSByte(); BASE_CONST_3 = bin.ReadByte(); BASE_CONST_4 = bin.ReadByte(); } bin.StepOut(); bin.StepInMSB(subtypeDataOffset); { SubtypeRead(bin); } bin.StepOut(); }