Skip to content

Instantly share code, notes, and snippets.

@notcake
Last active August 29, 2015 14:20
Show Gist options
  • Save notcake/2646858ce2f6d7c76252 to your computer and use it in GitHub Desktop.
Save notcake/2646858ce2f6d7c76252 to your computer and use it in GitHub Desktop.
Metro 2033 Redux content.vfx
struct Header
{
uint32 Unknown0;
uint32 Unknown1;
uint32 Unknown2;
uint32 Unknown3;
uint32 Unknown4;
uint32 Unknown5;
uint32 PackFileCount;
uint32 INodeCount;
uint32 UnknownCount;
PackFileEntry PackFiles [PackFileCount];
INodeEntry INodes [INodeCount];
UnknownEntry Unknowns [UnknownCount];
uint32 Unknown6 = 0x00000000;
uint32 Unknown7 = 0x00000000;
};
struct PackFileEntry
{
stringz FileName;
uint32 PathCount;
stringz Paths [PathCount];
uint32 PackFileSize;
};
[SubtypeDiscriminator ("NodeType")]
struct INodeEntry
{
uint16 NodeType;
};
[Condition ("NodeType == 0x0008")]
struct INodeDirectory : INodeEntry
{
uint16 ChildINodeCount;
uint32 Unknown0;
StringXN8 Name;
};
[Condition ("NodeType == 0x0000")]
struct INodeFile : INodeEntry
{
uint16 PackFileIndex;
uint32 Unknown2;
uint32 Unknown3;
uint32 Unknown4;
StringXN8 Name;
};
struct UnknownEntry
{
uint16 Unknown0;
uint16 PackFileIndex;
uint32 Unknown1;
uint32 Unknown2;
uint32 Unknown3;
uint32 Unknown4;
};
struct StringXN8
{
uint8 Length;
uint8 XorKey;
char EncodedString [Length - 1];
uint8 NullTerminator = 0x00;
string GetString ()
{
char[] decodedString = new char [this.Length - 1];
for (int i = 0; i < this.Length; i++)
{
decodedString [i] = xor (this.XorKey, this.EncodedString [i]);
}
return decodedString;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment