protected override void SubtypeRead(DSBinaryReader bin) { X = bin.ReadSingle(); Y = bin.ReadSingle(); Z = bin.ReadSingle(); SUB_CONST_1 = bin.ReadSingle(); }
protected override void SubtypeRead(DSBinaryReader bin) { SUB_CONST_1 = bin.ReadInt32(); SUB_CONST_2 = bin.ReadInt32(); Radius = bin.ReadSingle(); Height = bin.ReadSingle(); EntityID = bin.ReadInt32(); }
protected override void SubtypeRead(DSBinaryReader bin) { UNK1 = bin.ReadInt32(); UNK2 = bin.ReadInt32(); Radius = bin.ReadSingle(); Height = bin.ReadSingle(); EventEntityID = bin.ReadInt32(); }
protected override void SubtypeRead(DSBinaryReader bin) { SUB_CONST_1 = bin.ReadInt32(); SUB_CONST_2 = bin.ReadInt32(); WidthX = bin.ReadSingle(); DepthZ = bin.ReadSingle(); HeightY = bin.ReadSingle(); EntityID = bin.ReadInt32(); }
protected override void SubtypeRead(DSBinaryReader bin) { HitFilterID = bin.ReadByte(); SoundSpaceType = (PartsCollisionSoundSpaceType)bin.ReadByte(); i_EnvLightMapSpot = bin.ReadInt16(); ReflectPlaneHeight = bin.ReadSingle(); NvmGroup1 = bin.ReadInt32(); NvmGroup2 = bin.ReadInt32(); NvmGroup3 = bin.ReadInt32(); NvmGroup4 = bin.ReadInt32(); VagrantID1 = bin.ReadInt32(); VagrantID2 = bin.ReadInt32(); VagrantID3 = bin.ReadInt32(); MapNameID = bin.ReadInt16(); DisableStart = bin.ReadInt16(); DisableBonfireID = bin.ReadInt32(); SUB_CONST_1 = bin.ReadInt32(); SUB_CONST_2 = bin.ReadInt32(); SUB_CONST_3 = bin.ReadInt32(); PlayRegionID = bin.ReadInt32(); LockCamID1 = bin.ReadInt16(); LockCamID2 = bin.ReadInt16(); SUB_CONST_4 = bin.ReadInt32(); SUB_CONST_5 = bin.ReadInt32(); SUB_CONST_6 = bin.ReadInt32(); SUB_CONST_7 = bin.ReadInt32(); }
protected override void SubtypeRead(DSBinaryReader bin) { SUB_CONST_1 = bin.ReadInt32(); if (bin.LongOffsets) { bin.Jump(4); } SUB_CONST_2 = bin.ReadInt32(); if (bin.LongOffsets) { bin.Jump(4); } Radius = bin.ReadSingle(); Height = bin.ReadSingle(); EntityID = bin.ReadInt32(); }
protected override void InternalRead(DSBinaryReader bin) { Name = bin.ReadMsbString(); Ux04 = bin.ReadInt32(); Index = bin.ReadInt32(); bin.AssertInt32((int)Type); PosX = bin.ReadSingle(); PosY = bin.ReadSingle(); PosZ = bin.ReadSingle(); RotX = bin.ReadSingle(); RotY = bin.ReadSingle(); RotZ = bin.ReadSingle(); int baseSubtypeDataOffset = bin.ReadInt32(); bin.AssertInt32(OffsetDeltas.Item1 >= 0 ? baseSubtypeDataOffset + OffsetDeltas.Item1 : 0); bin.AssertInt32(OffsetDeltas.Item2 >= 0 ? baseSubtypeDataOffset + OffsetDeltas.Item2 : 0); bin.AssertInt32(OffsetDeltas.Item3 >= 0 ? baseSubtypeDataOffset + OffsetDeltas.Item3 : 0); bin.StepInMSB(baseSubtypeDataOffset); { SubtypeRead(bin); } bin.StepOut(); }
protected override void SubtypeRead(DSBinaryReader bin) { SUx00 = bin.ReadInt32(); SUx04 = bin.ReadSingle(); SUx08 = bin.ReadSingle(); SUx0C = bin.ReadSingle(); SUx10 = bin.ReadSingle(); SUx14 = bin.ReadSingle(); SUx18 = bin.ReadSingle(); SUx1C = bin.ReadSingle(); }
protected override void SubtypeRead(DSBinaryReader bin) { SubUnk1 = bin.ReadInt32(); SubUnk2 = bin.ReadSingle(); SubUnk3 = bin.ReadSingle(); SubUnk4 = bin.ReadSingle(); SubUnk5 = bin.ReadSingle(); SubUnk6 = bin.ReadSingle(); SUB_CONST_1 = bin.ReadSingle(); SUB_CONST_2 = bin.ReadSingle(); }
protected override void InternalRead(DSBinaryReader bin) { Name = bin.ReadMsbString(); BASE_CONST_1 = bin.ReadInt32(); SolvedIndex = bin.ReadInt32(); bin.AssertInt32((int)Type); PosX = bin.ReadSingle(); PosY = bin.ReadSingle(); PosZ = bin.ReadSingle(); RotX = bin.ReadSingle(); RotY = bin.ReadSingle(); RotZ = bin.ReadSingle(); if (bin.LongOffsets) { bin.Jump(4); } int baseSubtypeDataOffset = bin.ReadInt32(); if (bin.LongOffsets) { bin.Jump(4); bin.AssertInt32(OffsetDeltas64.Item1 >= 0 ? baseSubtypeDataOffset + OffsetDeltas64.Item1 : 0); bin.Jump(4); bin.AssertInt32(OffsetDeltas64.Item2 >= 0 ? baseSubtypeDataOffset + OffsetDeltas64.Item2 : 0); bin.Jump(4); bin.AssertInt32(OffsetDeltas64.Item3 >= 0 ? baseSubtypeDataOffset + OffsetDeltas64.Item3 : 0); bin.Jump(4); } else { bin.AssertInt32(OffsetDeltas.Item1 >= 0 ? baseSubtypeDataOffset + OffsetDeltas.Item1 : 0); bin.AssertInt32(OffsetDeltas.Item2 >= 0 ? baseSubtypeDataOffset + OffsetDeltas.Item2 : 0); bin.AssertInt32(OffsetDeltas.Item3 >= 0 ? baseSubtypeDataOffset + OffsetDeltas.Item3 : 0); } bin.StepInMSB(baseSubtypeDataOffset); { SubtypeRead(bin); } bin.StepOut(); }
protected override void SubtypeRead(DSBinaryReader bin) { SUB_CONST_1 = bin.ReadInt32(); SUB_CONST_2 = bin.ReadInt32(); if (bin.IsDeS) { NpcSubUnk0 = bin.ReadSingle(); } else { ThinkParamID = bin.ReadInt32(); } NPCParamID = bin.ReadInt32(); TalkID = bin.ReadInt32(); PointMoveType = bin.ReadByte(); SUB_CONST_3 = bin.ReadByte(); PlatoonID = bin.ReadUInt16(); CharaInitID = bin.ReadInt32(); i_HitName = bin.ReadInt32(); SUB_CONST_4 = bin.ReadInt32(); SUB_CONST_5 = bin.ReadInt32(); SolvedMovePointIndex1 = bin.ReadInt16(); SolvedMovePointIndex2 = bin.ReadInt16(); SolvedMovePointIndex3 = bin.ReadInt16(); SolvedMovePointIndex4 = bin.ReadInt16(); SolvedMovePointIndex5 = bin.ReadInt16(); SolvedMovePointIndex6 = bin.ReadInt16(); SolvedMovePointIndex7 = bin.ReadInt16(); SolvedMovePointIndex8 = bin.ReadInt16(); SpStayAnimID = bin.ReadInt32(); SpStayDamageAnimID = bin.ReadInt32(); }
protected override void SubtypeRead(DSBinaryReader bin) { UNK1 = bin.ReadByte(); UNK2 = bin.ReadByte(); UNK3 = bin.ReadByte(); UNK4 = bin.ReadByte(); UNK5 = bin.ReadSingle(); UNK6 = bin.ReadInt32(); UNK7 = bin.ReadInt32(); VagrantEntityID1 = bin.ReadInt32(); VagrantEntityID2 = bin.ReadInt32(); VagrantEntityID3 = bin.ReadInt32(); UNK8 = bin.ReadInt16(); UNK9 = bin.ReadInt16(); BonfireObjectEntityID = bin.ReadInt32(); UNK10 = bin.ReadInt32(); UNK11 = bin.ReadInt32(); UNK12 = bin.ReadInt32(); MultiplayerID = bin.ReadInt32(); UNK13 = bin.ReadInt16(); UNK14 = bin.ReadInt16(); UNK15 = bin.ReadInt32(); UNK16 = bin.ReadInt32(); UNK17 = bin.ReadInt32(); UNK18 = bin.ReadInt32(); UNK19 = bin.ReadInt32(); UNK20 = bin.ReadInt32(); }
private void SubtypeReadDeS(DSBinaryReader bin) { HitFilterID = bin.ReadByte(); SoundSpaceType = (PartsCollisionSoundSpaceType)bin.ReadByte(); i_EnvLightMapSpot = bin.ReadInt16(); ReflectPlaneHeight = bin.ReadSingle(); NavimeshGroup1 = bin.ReadInt32(); NavimeshGroup2 = bin.ReadInt32(); NavimeshGroup3 = bin.ReadInt32(); NavimeshGroup4 = bin.ReadInt32(); RefTexID1 = bin.ReadInt16(); RefTexID2 = bin.ReadInt16(); RefTexID3 = bin.ReadInt16(); RefTexID4 = bin.ReadInt16(); RefTexID5 = bin.ReadInt16(); RefTexID6 = bin.ReadInt16(); RefTexID7 = bin.ReadInt16(); RefTexID8 = bin.ReadInt16(); RefTexID9 = bin.ReadInt16(); RefTexID10 = bin.ReadInt16(); RefTexID11 = bin.ReadInt16(); RefTexID12 = bin.ReadInt16(); RefTexID13 = bin.ReadInt16(); RefTexID14 = bin.ReadInt16(); RefTexID15 = bin.ReadInt16(); RefTexID16 = bin.ReadInt16(); SUB_CONST_1 = bin.ReadInt16(); MapNameID = bin.ReadInt16(); SUB_CONST_4 = bin.ReadInt32(); SUB_CONST_5 = bin.ReadInt32(); SUB_CONST_6 = bin.ReadInt32(); SUB_CONST_7 = bin.ReadInt32(); }
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(); }
private Animation LoadAnimationFromOffset(DSBinaryReader bin, int offset, int animID_ForDebug) { int oldOffset = (int)bin.BaseStream.Position; bin.BaseStream.Seek(offset, SeekOrigin.Begin); var anim = new Animation(); try { int eventCount = bin.ReadInt32(); int eventHeadersOffset = bin.ReadInt32(); bin.BaseStream.Seek(0x10, SeekOrigin.Current); //skip shit we don't need int animFileOffset = bin.ReadInt32(); for (int i = 0; i < eventCount; i++) { //lazily seek to the start of each event manually. bin.BaseStream.Seek(eventHeadersOffset + (EventHeaderSize * i), SeekOrigin.Begin); int startTimeOffset = bin.ReadInt32(); int endTimeOffset = bin.ReadInt32(); int eventBodyOffset = bin.ReadInt32(); 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); { TimeActEventType eventType = (TimeActEventType)bin.ReadInt32(); int eventParamOffset = bin.ReadInt32(); bin.StepIn(eventParamOffset); { switch (eventType) { case TimeActEventType.Type000: var newType000 = new Tae000(startTime, endTime); newType000.ReadParameters(bin); anim.EventList.Add(newType000); break; case TimeActEventType.Type001: var newType001 = new Tae001(startTime, endTime); newType001.ReadParameters(bin); anim.EventList.Add(newType001); break; case TimeActEventType.Type002: var newType002 = new Tae002(startTime, endTime); newType002.ReadParameters(bin); anim.EventList.Add(newType002); break; case TimeActEventType.Type005: var newType005 = new Tae005(startTime, endTime); newType005.ReadParameters(bin); anim.EventList.Add(newType005); break; case TimeActEventType.Type008: var newType008 = new Tae008(startTime, endTime); newType008.ReadParameters(bin); anim.EventList.Add(newType008); break; case TimeActEventType.Type016: var newType016 = new Tae016(startTime, endTime); newType016.ReadParameters(bin); anim.EventList.Add(newType016); break; case TimeActEventType.Type024: var newType024 = new Tae024(startTime, endTime); newType024.ReadParameters(bin); anim.EventList.Add(newType024); break; case TimeActEventType.Type032: var newType032 = new Tae032(startTime, endTime); newType032.ReadParameters(bin); anim.EventList.Add(newType032); break; case TimeActEventType.Type033: var newType033 = new Tae033(startTime, endTime); newType033.ReadParameters(bin); anim.EventList.Add(newType033); break; case TimeActEventType.Type064: var newType064 = new Tae064(startTime, endTime); newType064.ReadParameters(bin); anim.EventList.Add(newType064); break; case TimeActEventType.Type065: var newType065 = new Tae065(startTime, endTime); newType065.ReadParameters(bin); anim.EventList.Add(newType065); break; case TimeActEventType.Type066: var newType066 = new Tae066(startTime, endTime); newType066.ReadParameters(bin); anim.EventList.Add(newType066); break; case TimeActEventType.Type067: var newType067 = new Tae067(startTime, endTime); newType067.ReadParameters(bin); anim.EventList.Add(newType067); break; case TimeActEventType.Type096: var newType096 = new Tae096(startTime, endTime); newType096.ReadParameters(bin); anim.EventList.Add(newType096); break; case TimeActEventType.Type099: var newType099 = new Tae099(startTime, endTime); newType099.ReadParameters(bin); anim.EventList.Add(newType099); break; case TimeActEventType.Type100: var newType100 = new Tae100(startTime, endTime); newType100.ReadParameters(bin); anim.EventList.Add(newType100); break; case TimeActEventType.Type101: var newType101 = new Tae101(startTime, endTime); newType101.ReadParameters(bin); anim.EventList.Add(newType101); break; case TimeActEventType.Type104: var newType104 = new Tae104(startTime, endTime); newType104.ReadParameters(bin); anim.EventList.Add(newType104); break; case TimeActEventType.Type108: var newType108 = new Tae108(startTime, endTime); newType108.ReadParameters(bin); anim.EventList.Add(newType108); break; case TimeActEventType.Type109: var newType109 = new Tae109(startTime, endTime); newType109.ReadParameters(bin); anim.EventList.Add(newType109); break; case TimeActEventType.Type110: var newType110 = new Tae110(startTime, endTime); newType110.ReadParameters(bin); anim.EventList.Add(newType110); break; case TimeActEventType.Type112: var newType112 = new Tae112(startTime, endTime); newType112.ReadParameters(bin); anim.EventList.Add(newType112); break; case TimeActEventType.Type114: var newType114 = new Tae114(startTime, endTime); newType114.ReadParameters(bin); anim.EventList.Add(newType114); break; case TimeActEventType.Type115: var newType115 = new Tae115(startTime, endTime); newType115.ReadParameters(bin); anim.EventList.Add(newType115); break; case TimeActEventType.Type116: var newType116 = new Tae116(startTime, endTime); newType116.ReadParameters(bin); anim.EventList.Add(newType116); break; case TimeActEventType.Type118: var newType118 = new Tae118(startTime, endTime); newType118.ReadParameters(bin); anim.EventList.Add(newType118); break; case TimeActEventType.Type119: var newType119 = new Tae119(startTime, endTime); newType119.ReadParameters(bin); anim.EventList.Add(newType119); break; case TimeActEventType.Type120: var newType120 = new Tae120(startTime, endTime); newType120.ReadParameters(bin); anim.EventList.Add(newType120); break; case TimeActEventType.Type121: var newType121 = new Tae121(startTime, endTime); newType121.ReadParameters(bin); anim.EventList.Add(newType121); break; case TimeActEventType.Type128: var newType128 = new Tae128(startTime, endTime); newType128.ReadParameters(bin); anim.EventList.Add(newType128); break; case TimeActEventType.Type129: var newType129 = new Tae129(startTime, endTime); newType129.ReadParameters(bin); anim.EventList.Add(newType129); break; case TimeActEventType.Type130: var newType130 = new Tae130(startTime, endTime); newType130.ReadParameters(bin); anim.EventList.Add(newType130); break; case TimeActEventType.Type144: var newType144 = new Tae144(startTime, endTime); newType144.ReadParameters(bin); anim.EventList.Add(newType144); break; case TimeActEventType.Type145: var newType145 = new Tae145(startTime, endTime); newType145.ReadParameters(bin); anim.EventList.Add(newType145); break; case TimeActEventType.Type193: var newType193 = new Tae193(startTime, endTime); newType193.ReadParameters(bin); anim.EventList.Add(newType193); break; case TimeActEventType.Type224: var newType224 = new Tae224(startTime, endTime); newType224.ReadParameters(bin); anim.EventList.Add(newType224); break; case TimeActEventType.Type225: var newType225 = new Tae225(startTime, endTime); newType225.ReadParameters(bin); anim.EventList.Add(newType225); break; case TimeActEventType.Type226: var newType226 = new Tae226(startTime, endTime); newType226.ReadParameters(bin); anim.EventList.Add(newType226); break; case TimeActEventType.Type228: var newType228 = new Tae228(startTime, endTime); newType228.ReadParameters(bin); anim.EventList.Add(newType228); break; case TimeActEventType.Type229: var newType229 = new Tae229(startTime, endTime); newType229.ReadParameters(bin); anim.EventList.Add(newType229); break; case TimeActEventType.Type231: var newType231 = new Tae231(startTime, endTime); newType231.ReadParameters(bin); anim.EventList.Add(newType231); break; case TimeActEventType.Type232: var newType232 = new Tae232(startTime, endTime); newType232.ReadParameters(bin); anim.EventList.Add(newType232); break; case TimeActEventType.Type233: var newType233 = new Tae233(startTime, endTime); newType233.ReadParameters(bin); anim.EventList.Add(newType233); break; case TimeActEventType.Type236: var newType236 = new Tae236(startTime, endTime); newType236.ReadParameters(bin); anim.EventList.Add(newType236); break; case TimeActEventType.Type300: var newType300 = new Tae300(startTime, endTime); newType300.ReadParameters(bin); anim.EventList.Add(newType300); break; case TimeActEventType.Type301: var newType301 = new Tae301(startTime, endTime); newType301.ReadParameters(bin); anim.EventList.Add(newType301); break; case TimeActEventType.Type302: var newType302 = new Tae302(startTime, endTime); newType302.ReadParameters(bin); anim.EventList.Add(newType302); break; case TimeActEventType.Type303: var newType303 = new Tae303(startTime, endTime); newType303.ReadParameters(bin); anim.EventList.Add(newType303); break; case TimeActEventType.Type304: var newType304 = new Tae304(startTime, endTime); newType304.ReadParameters(bin); anim.EventList.Add(newType304); break; case TimeActEventType.Type306: var newType306 = new Tae306(startTime, endTime); newType306.ReadParameters(bin); anim.EventList.Add(newType306); break; case TimeActEventType.Type307: var newType307 = new Tae307(startTime, endTime); newType307.ReadParameters(bin); anim.EventList.Add(newType307); break; case TimeActEventType.Type308: var newType308 = new Tae308(startTime, endTime); newType308.ReadParameters(bin); anim.EventList.Add(newType308); break; case TimeActEventType.Type401: var newType401 = new Tae401(startTime, endTime); newType401.ReadParameters(bin); anim.EventList.Add(newType401); break; case TimeActEventType.Type500: var newType500 = new Tae500(startTime, endTime); newType500.ReadParameters(bin); anim.EventList.Add(newType500); break; } } bin.StepOut(); } 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 = bin.ReadInt32(); anim.Unk1 = bin.ReadInt32(); anim.Unk2 = bin.ReadInt32(); if (nameOffset <= 0) { throw new Exception("Anim file type was that of a named one but the name pointer was NULL."); } bin.BaseStream.Seek(nameOffset, SeekOrigin.Begin); anim.FileName = ReadUnicodeString(bin); } else if (fileType == 1) { anim.IsReference = true; anim.FileName = null; bin.ReadInt32(); //offset pointing to next dword for some reason. bin.ReadInt32(); //offset pointing to start of next anim file struct anim.RefAnimID = bin.ReadInt32(); //Null 1 //Null 2 //Null 3 } else { throw new Exception($"Unknown anim file type code: {fileType}"); } return(anim); } catch (EndOfStreamException) { MiscUtil.PrintlnDX($"Warning: reached end of file while parsing animation {animID_ForDebug}; 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(); ModelIndex = 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(); Ux60 = bin.ReadInt32(); bin.StepInMSB(baseDataOffset); { EventEntityID = bin.ReadInt32(); LightID = bin.ReadByte(); FogID = bin.ReadByte(); ScatterID = bin.ReadByte(); BUx07 = bin.ReadByte(); BUx08 = bin.ReadByte(); BUx09 = bin.ReadByte(); BUx0A = bin.ReadByte(); BUx0B = bin.ReadByte(); BUx0C = bin.ReadInt16(); BUx0E = bin.ReadInt16(); BUx10 = bin.ReadInt16(); BUx12 = bin.ReadInt16(); BUx14 = bin.ReadInt32(); //BUx18 = bin.ReadInt32(); } bin.StepOut(); bin.StepInMSB(subtypeDataOffset); { SubtypeRead(bin); } bin.StepOut(); }
private Animation LoadAnimationFromOffset(DSBinaryReader bin, int offset, int animID_ForDebug) { int oldOffset = (int)bin.BaseStream.Position; bin.BaseStream.Seek(offset, SeekOrigin.Begin); var anim = new Animation(); try { int eventCount = bin.ReadInt32(); int eventHeadersOffset = bin.ReadInt32(); bin.BaseStream.Seek(0x10, SeekOrigin.Current); //skip shit we don't need int animFileOffset = bin.ReadInt32(); for (int i = 0; i < eventCount; i++) { //lazily seek to the start of each event manually. bin.BaseStream.Seek(eventHeadersOffset + (EventHeaderSize * i), SeekOrigin.Begin); int startTimeOffset = bin.ReadInt32(); int endTimeOffset = bin.ReadInt32(); int eventBodyOffset = bin.ReadInt32(); bin.BaseStream.Seek(startTimeOffset, SeekOrigin.Begin); float startTime = bin.ReadSingle(); bin.BaseStream.Seek(endTimeOffset, SeekOrigin.Begin); float endTime = bin.ReadSingle(); bin.BaseStream.Seek(eventBodyOffset, SeekOrigin.Begin); int eventTypeValue = bin.ReadInt32(); int eventParamOffset = bin.ReadInt32(); bin.BaseStream.Seek(eventParamOffset, SeekOrigin.Begin); AnimationEventType eventType = (AnimationEventType)eventTypeValue; var nextEvent = new AnimationEvent(i + 1, eventType, animID_ForDebug); nextEvent.StartTime = startTime; nextEvent.EndTime = endTime; for (int j = 0; j < nextEvent.Parameters.Count; j++) { var nextParamVal = new MultiDword() { Int = bin.ReadInt32() }; if (AnimationEvent.CheckIfParamIsUnlikelyToBeFloat(nextParamVal)) { nextEvent.Parameters[j].Value = nextParamVal.Int.ToString(); } else { string convStr = nextParamVal.Float.ToString(); nextEvent.Parameters[j].Value = convStr + (convStr.Contains(".") ? "" : ".0"); } } anim.Events.Add(nextEvent); } bin.BaseStream.Seek(animFileOffset, SeekOrigin.Begin); int fileType = bin.ReadInt32(); if (fileType == 0) { int dataOffset = bin.ReadInt32(); bin.BaseStream.Seek(dataOffset, SeekOrigin.Begin); int nameOffset = bin.ReadInt32(); if (nameOffset == 0) { throw new Exception("Anim file type was that of a named one but the name pointer was NULL."); } bin.BaseStream.Seek(nameOffset, SeekOrigin.Begin); anim.FileName = ReadUnicodeString(bin); } else if (fileType == 1) { anim.FileName = null; } else { throw new Exception($"Unknown anim file type code: {fileType}"); } return(anim); } catch (EndOfStreamException) { MiscUtil.PrintlnDX($"Warning: reached end of file while parsing animation {animID_ForDebug}; 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 SubtypeRead(DSBinaryReader bin) { SUx00 = bin.ReadSingle(); SUx04 = bin.ReadSingle(); SUx08 = bin.ReadSingle(); SUx0C = bin.ReadSingle(); SUx10 = bin.ReadSingle(); SUx14 = bin.ReadSingle(); SUx18 = bin.ReadSingle(); SUx1C = bin.ReadSingle(); SUx20 = bin.ReadSingle(); SUx24 = bin.ReadSingle(); SUx28 = bin.ReadSingle(); SUx2C = bin.ReadSingle(); SUx30 = bin.ReadSingle(); SUx34 = bin.ReadSingle(); SUx38 = bin.ReadSingle(); SUx3C = bin.ReadSingle(); }
protected override void SubtypeRead(DSBinaryReader bin) { MaxNum = bin.ReadByte(); GenType = bin.ReadByte(); LimitNum = bin.ReadInt16(); MinGenNum = bin.ReadInt16(); MaxGenNum = bin.ReadInt16(); MinInterval = bin.ReadSingle(); MaxInterval = bin.ReadSingle(); InitialSpawnNum = bin.ReadInt32(); SUB_CONST_1 = bin.ReadInt32(); SUB_CONST_2 = bin.ReadInt32(); SUB_CONST_3 = bin.ReadInt32(); SUB_CONST_4 = bin.ReadInt32(); SUB_CONST_5 = bin.ReadInt32(); SUB_CONST_6 = bin.ReadInt32(); SUB_CONST_7 = bin.ReadInt32(); InternalSpawnPoint1 = bin.ReadInt32(); InternalSpawnPoint2 = bin.ReadInt32(); InternalSpawnPoint3 = bin.ReadInt32(); InternalSpawnPoint4 = bin.ReadInt32(); InternalSpawnPart1 = bin.ReadInt32(); InternalSpawnPart2 = bin.ReadInt32(); InternalSpawnPart3 = bin.ReadInt32(); InternalSpawnPart4 = bin.ReadInt32(); InternalSpawnPart5 = bin.ReadInt32(); InternalSpawnPart6 = bin.ReadInt32(); InternalSpawnPart7 = bin.ReadInt32(); InternalSpawnPart8 = bin.ReadInt32(); InternalSpawnPart9 = bin.ReadInt32(); InternalSpawnPart10 = bin.ReadInt32(); InternalSpawnPart11 = bin.ReadInt32(); InternalSpawnPart12 = bin.ReadInt32(); InternalSpawnPart13 = bin.ReadInt32(); InternalSpawnPart14 = bin.ReadInt32(); InternalSpawnPart15 = bin.ReadInt32(); InternalSpawnPart16 = bin.ReadInt32(); InternalSpawnPart17 = bin.ReadInt32(); InternalSpawnPart18 = bin.ReadInt32(); InternalSpawnPart19 = bin.ReadInt32(); InternalSpawnPart20 = bin.ReadInt32(); InternalSpawnPart21 = bin.ReadInt32(); InternalSpawnPart22 = bin.ReadInt32(); InternalSpawnPart23 = bin.ReadInt32(); InternalSpawnPart24 = bin.ReadInt32(); InternalSpawnPart25 = bin.ReadInt32(); InternalSpawnPart26 = bin.ReadInt32(); InternalSpawnPart27 = bin.ReadInt32(); InternalSpawnPart28 = bin.ReadInt32(); InternalSpawnPart29 = bin.ReadInt32(); InternalSpawnPart30 = bin.ReadInt32(); InternalSpawnPart31 = bin.ReadInt32(); InternalSpawnPart32 = bin.ReadInt32(); SUB_CONST_8 = bin.ReadInt32(); SUB_CONST_9 = bin.ReadInt32(); SUB_CONST_10 = bin.ReadInt32(); SUB_CONST_11 = bin.ReadInt32(); SUB_CONST_12 = bin.ReadInt32(); SUB_CONST_13 = bin.ReadInt32(); SUB_CONST_14 = bin.ReadInt32(); SUB_CONST_15 = bin.ReadInt32(); SUB_CONST_16 = bin.ReadInt32(); SUB_CONST_17 = bin.ReadInt32(); SUB_CONST_18 = bin.ReadInt32(); SUB_CONST_19 = bin.ReadInt32(); SUB_CONST_20 = bin.ReadInt32(); SUB_CONST_21 = bin.ReadInt32(); SUB_CONST_22 = bin.ReadInt32(); SUB_CONST_23 = bin.ReadInt32(); }
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 SubtypeRead(DSBinaryReader bin) { WindVecMinX = bin.ReadSingle(); WindVecMinY = bin.ReadSingle(); WindVecMinZ = bin.ReadSingle(); SubUnk4 = bin.ReadSingle(); WindVecMaxX = bin.ReadSingle(); WindVecMaxY = bin.ReadSingle(); WindVecMaxZ = bin.ReadSingle(); SubUnk8 = bin.ReadSingle(); WindSwingCycle0 = bin.ReadSingle(); WindSwingCycle1 = bin.ReadSingle(); WindSwingCycle2 = bin.ReadSingle(); WindSwingCycle3 = bin.ReadSingle(); WindSwingPow0 = bin.ReadSingle(); WindSwingPow1 = bin.ReadSingle(); WindSwingPow2 = bin.ReadSingle(); WindSwingPow3 = bin.ReadSingle(); }
protected override void SubtypeRead(DSBinaryReader bin) { SUx00 = bin.ReadInt16(); SUx02 = bin.ReadInt16(); SUx04 = bin.ReadInt16(); SUx06 = bin.ReadInt16(); SUx08 = bin.ReadSingle(); SUx0C = bin.ReadSingle(); SUx10 = bin.ReadInt32(); SUx14 = bin.ReadInt32(); SUx18 = bin.ReadInt32(); SUx1C = bin.ReadInt32(); SUx20 = bin.ReadInt32(); SUx24 = bin.ReadInt32(); SUx28 = bin.ReadInt32(); SUx2C = bin.ReadInt32(); RegionIndex2 = bin.ReadInt32(); SUx34 = bin.ReadInt32(); SUx38 = bin.ReadInt32(); SUx3C = bin.ReadInt32(); PartIndex2 = bin.ReadInt32(); PartIndex3 = bin.ReadInt32(); SUx48 = bin.ReadInt32(); SUx4C = bin.ReadInt32(); SUx50 = bin.ReadInt32(); SUx54 = bin.ReadInt32(); SUx58 = bin.ReadInt32(); SUx5C = bin.ReadInt32(); SUx60 = bin.ReadInt32(); SUx64 = bin.ReadInt32(); SUx68 = bin.ReadInt32(); SUx6C = bin.ReadInt32(); SUx70 = bin.ReadInt32(); SUx74 = bin.ReadInt32(); SUx78 = bin.ReadInt32(); SUx7C = bin.ReadInt32(); SUx80 = bin.ReadInt32(); SUx84 = bin.ReadInt32(); SUx88 = bin.ReadInt32(); SUx8C = bin.ReadInt32(); SUx90 = bin.ReadInt32(); SUx94 = bin.ReadInt32(); SUx98 = bin.ReadInt32(); SUx9C = bin.ReadInt32(); SUxA0 = bin.ReadInt32(); SUxA4 = bin.ReadInt32(); SUxA8 = bin.ReadInt32(); SUxAC = bin.ReadInt32(); SUxB0 = bin.ReadInt32(); SUxB4 = bin.ReadInt32(); SUxB8 = bin.ReadInt32(); SUxBC = bin.ReadInt32(); SUxC0 = bin.ReadInt32(); SUxC4 = bin.ReadInt32(); SUxC8 = bin.ReadInt32(); SUxCC = bin.ReadInt32(); SUxD0 = bin.ReadInt32(); SUxD4 = bin.ReadInt32(); SUxD8 = bin.ReadInt32(); SUxDC = bin.ReadInt32(); SUxE0 = bin.ReadInt32(); SUxE4 = bin.ReadInt32(); SUxE8 = bin.ReadInt32(); SUxEC = bin.ReadInt32(); SUxF0 = bin.ReadInt32(); SUxF4 = bin.ReadInt32(); SUxF8 = bin.ReadInt32(); SUxFC = bin.ReadInt32(); }
protected override void SubtypeRead(DSBinaryReader bin) { SubUnk1 = bin.ReadSingle(); SubUnk2 = bin.ReadSingle(); SubUnk3 = bin.ReadSingle(); SubUnk4 = bin.ReadSingle(); SubUnk5 = bin.ReadSingle(); SubUnk6 = bin.ReadSingle(); SubUnk7 = bin.ReadSingle(); SubUnk8 = bin.ReadSingle(); SubUnk9 = bin.ReadSingle(); SubUnk10 = bin.ReadSingle(); SubUnk11 = bin.ReadSingle(); SubUnk12 = bin.ReadSingle(); SubUnk13 = bin.ReadSingle(); SubUnk14 = bin.ReadSingle(); SubUnk15 = bin.ReadSingle(); SubUnk16 = bin.ReadSingle(); }