DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
vpk.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2020-2021 David Knapp (Cloudwalk)
3
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License
6
as published by the Free Software Foundation; either version 2
7
of the License, or (at your option) any later version.
8
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13
See the GNU General Public License for more details.
14
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19
*/
20
21
#ifndef VPK_H
22
#define VPK_H
23
24
#include <stdint.h>
25
26
/*
27
* The VPK format is Valve's package format for Source engine games,
28
* used to store game content.
29
*
30
* Game content is spread across multiple VPK files. A single, special
31
* VPK file, ending in _dir.vpk, contains a centralized directory
32
* tree for all of the other files, and has its own header.
33
* Although content can be stored in the directory file.
34
*
35
* This is useful for navigating game content without having
36
* to guess which VPK some file belongs to, while also
37
* making game updates more efficient by spreading content
38
* across multiple files, where opening and closing thousands
39
* of loose files to update them is less efficient.
40
*/
41
42
const
uint32_t
VPK_SIGNATURE
= 0x55aa1234;
43
44
typedef
struct
dvpk_header_v1_s
45
{
46
const
uint32_t
signature
;
// Should always be VPK_SIGNATURE
47
const
uint32_t
version
;
// Should always be 1
48
49
// Size of directory tree
50
uint32_t
tree_size
;
51
}
dvpk_header_v1_t
;
52
53
typedef
struct
dvpk_header_v2_s
54
{
55
const
uint32_t
signature
;
// Should always be VPK_SIGNATURE
56
const
uint32_t
version
;
// Should always be 2
57
58
// Size of directory tree
59
uint32_t
tree_size
;
60
61
// Section sizes
62
uint32_t
filedata_size
;
63
uint32_t
archivemd5_size
;
64
uint32_t
othermd5_size
;
65
uint32_t
signature_size
;
66
}
dvpk_header_v2_t
;
67
68
typedef
struct
dvpk_dir_entry_s
69
{
70
uint32_t
crc32
;
71
uint16_t
preloadbytes
;
72
73
uint16_t
archiveindex
;
74
uint32_t
entryoffset
;
75
uint32_t
entrylength
;
76
const
uint16_t
terminator
;
// Should always be 0xFFFF
77
}
dvpk_dir_entry_t
;
78
79
typedef
struct
dvpk_archive_md5_entry_s
80
{
81
uint32_t
archiveindex
;
82
uint32_t
startingoffset
;
83
uint32_t
count
;
84
int8_t md5sum[16];
85
}
dvpk_archive_md5_entry_t
;
86
87
typedef
struct
dvpk_other_md5_entry_s
88
{
89
int8_t treesum[16];
90
int8_t archivemd5sum[16];
91
int8_t unknown[16];
// ??
92
}
dvpk_other_md5_entry_t
;
93
94
typedef
struct
dvpk_signature_entry_s
95
{
96
uint32_t
pubkeysize
;
// Always 160
97
int8_t pubkey[160];
98
uint32_t
signaturesize
;
// Always 128
99
int8_t signature[128];
100
}
dvpk_signature_entry_t
;
101
102
#endif
dvpk_archive_md5_entry_t
Definition
vpk.h:80
dvpk_archive_md5_entry_t::count
uint32_t count
Definition
vpk.h:83
dvpk_archive_md5_entry_t::startingoffset
uint32_t startingoffset
Definition
vpk.h:82
dvpk_archive_md5_entry_t::archiveindex
uint32_t archiveindex
Definition
vpk.h:81
dvpk_dir_entry_t
Definition
vpk.h:69
dvpk_dir_entry_t::terminator
const uint16_t terminator
Definition
vpk.h:76
dvpk_dir_entry_t::preloadbytes
uint16_t preloadbytes
Definition
vpk.h:71
dvpk_dir_entry_t::entryoffset
uint32_t entryoffset
Definition
vpk.h:74
dvpk_dir_entry_t::entrylength
uint32_t entrylength
Definition
vpk.h:75
dvpk_dir_entry_t::crc32
uint32_t crc32
Definition
vpk.h:70
dvpk_dir_entry_t::archiveindex
uint16_t archiveindex
Definition
vpk.h:73
dvpk_header_v1_t
Definition
vpk.h:45
dvpk_header_v1_t::version
const uint32_t version
Definition
vpk.h:47
dvpk_header_v1_t::tree_size
uint32_t tree_size
Definition
vpk.h:50
dvpk_header_v1_t::signature
const uint32_t signature
Definition
vpk.h:46
dvpk_header_v2_t
Definition
vpk.h:54
dvpk_header_v2_t::signature
const uint32_t signature
Definition
vpk.h:55
dvpk_header_v2_t::othermd5_size
uint32_t othermd5_size
Definition
vpk.h:64
dvpk_header_v2_t::archivemd5_size
uint32_t archivemd5_size
Definition
vpk.h:63
dvpk_header_v2_t::version
const uint32_t version
Definition
vpk.h:56
dvpk_header_v2_t::tree_size
uint32_t tree_size
Definition
vpk.h:59
dvpk_header_v2_t::filedata_size
uint32_t filedata_size
Definition
vpk.h:62
dvpk_header_v2_t::signature_size
uint32_t signature_size
Definition
vpk.h:65
dvpk_other_md5_entry_t
Definition
vpk.h:88
dvpk_signature_entry_t
Definition
vpk.h:95
dvpk_signature_entry_t::signaturesize
uint32_t signaturesize
Definition
vpk.h:98
dvpk_signature_entry_t::pubkeysize
uint32_t pubkeysize
Definition
vpk.h:96
VPK_SIGNATURE
const uint32_t VPK_SIGNATURE
Definition
vpk.h:42
vpk.h
Generated on Mon Mar 10 2025 16:50:17 for DarkPlaces by
1.12.0