X-Git-Url: https://harrygodden.com/git/?p=csRadar.git;a=blobdiff_plain;f=vpk.h;fp=vpk.h;h=436994d0f9c493299d02382b71ec5c65874830ce;hp=b6bd69daf272e69cf8997e18c1330a8b9e54bde7;hb=8382aed7f0cdc38bc5c58832d4a15277cf56d4be;hpb=0bd8697a99ced50789a5d41b84a4b87f39cb1653 diff --git a/vpk.h b/vpk.h index b6bd69d..436994d 100644 --- a/vpk.h +++ b/vpk.h @@ -1,8 +1,26 @@ +// This software is not affiliated with Valve Corporation +// We are not affiliated, associated, authorized, endorsed by, or in any way officially +// connected with Valve Corporation, or any of its subsidiaries or its affiliates. +// +// All trademarks are property of their respective owners + +// Valve pak file directory reader + // VPK //======================================================================================================================= +typedef struct VPKHeader VPKHeader; +typedef struct VPKDirectoryEntry VPKDirectoryEntry; + +// API +// --- + +// There is no load function, reading the header file as binary is enough. +VPKDirectoryEntry *vpk_find( VPKHeader *self, const char *asset ); +void vpk_free( VPKHeader *self ); + #pragma pack(push, 1) -typedef struct +struct VPKHeader { u32 Signature; u32 Version; @@ -11,10 +29,9 @@ typedef struct u32 ArchiveMD5SectionSize; u32 OtherMD5SectionSize; u32 SignatureSectionSize; -} -VPKHeader; +}; -typedef struct +struct VPKDirectoryEntry { u32 CRC; u16 PreloadBytes; @@ -22,10 +39,11 @@ typedef struct u32 EntryOffset; u32 EntryLength; u16 Terminator; -} -VPKDirectoryEntry; +}; #pragma pack(pop) +#ifdef VALVE_IMPLEMENTATION + void vpk_free( VPKHeader *self ) { free( self ); @@ -86,3 +104,5 @@ VPKDirectoryEntry *vpk_find( VPKHeader *self, const char *asset ) return NULL; } + +#endif