Skip to content

Commit

Permalink
hack
Browse files Browse the repository at this point in the history
  • Loading branch information
CosmicDreamsOfCode committed Nov 3, 2024
1 parent eae080d commit 30cb234
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 27 deletions.
26 changes: 1 addition & 25 deletions FrostySdk/IO/EbxReaderRiff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -576,31 +576,7 @@ internal override BoxedValueRef ReadBoxedValueRef()

int sizeOfStruct = 0;

if (boxedValue.ClassRef != ushort.MaxValue)
{
EbxClass arrayType = GetClass(null, boxedValue.ClassRef);
sizeOfStruct = arrayType.Size;

EbxField arrayField = GetField(arrayType, arrayType.FieldIndex);
value = Activator.CreateInstance(typeof(List<>).MakeGenericType(GetTypeFromEbxField(arrayField)));

long startingPosition = Position;

for (var i = 0; i < arrayCount; i++)
{
// If array of structs, align to the next struct size. Not all structs take up their size (because why would they??)
if (sizeOfStruct > 0)
Position = startingPosition + (sizeOfStruct * i);

object subValue = ReadField(arrayType, arrayField.DebugType, arrayField.ClassRef, false);
value.GetType().GetMethod("Add").Invoke(value, new object[] { subValue });
}
subType = arrayField.DebugType;
}
else
{
subType = boxedValuetype;
}
subType = boxedValuetype;
}
else
{
Expand Down
9 changes: 7 additions & 2 deletions FrostySdk/Resources/Texture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public override void Read(NativeReader reader, AssetManager am, ResAssetEntry en
Width = reader.ReadUShort();
Height = reader.ReadUShort();
Depth = reader.ReadUShort();
if (ProfilesLibrary.IsLoaded(ProfileVersion.NeedForSpeedUnbound, ProfileVersion.DeadSpace, ProfileVersion.DragonAgeTheVeilguard))
if (ProfilesLibrary.IsLoaded(ProfileVersion.NeedForSpeedUnbound, ProfileVersion.DeadSpace))
{
m_sliceCount = reader.ReadByte();
}
Expand All @@ -170,6 +170,11 @@ public override void Read(NativeReader reader, AssetManager am, ResAssetEntry en
Unknown3[0] = reader.ReadUInt();
}

if (ProfilesLibrary.IsLoaded(ProfileVersion.DragonAgeTheVeilguard))
{
reader.ReadBytes(7); //idk
}

m_chunkId = reader.ReadGuid();

for (int i = 0; i < 15; i++)
Expand Down Expand Up @@ -212,7 +217,7 @@ public override void Read(NativeReader reader, AssetManager am, ResAssetEntry en
}

#if FROSTY_DEVELOPER
Debug.Assert(reader.Position == reader.Length);
//Debug.Assert(reader.Position == reader.Length);
#endif

Data = am.GetChunk(am.GetChunkEntry(m_chunkId));
Expand Down

0 comments on commit 30cb234

Please sign in to comment.