patterns: Added valve vpk pattern (#384)

This commit is contained in:
Enaium
2025-05-10 18:29:50 +08:00
committed by GitHub
parent 3a64207e58
commit 3185503be1
3 changed files with 63 additions and 0 deletions

View File

@@ -166,6 +166,7 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi
| UEFI | | [`patterns/uefi.hexpat`](patterns/uefi.hexpat)` | UEFI structs for parsing efivars | | UEFI | | [`patterns/uefi.hexpat`](patterns/uefi.hexpat)` | UEFI structs for parsing efivars |
| UEFI Boot Entry | | [`patterns/uefi_boot_entry.hexpat`](patterns/uefi_boot_entry.hexpat) | UEFI Boot Entry (Load option) | | UEFI Boot Entry | | [`patterns/uefi_boot_entry.hexpat`](patterns/uefi_boot_entry.hexpat) | UEFI Boot Entry (Load option) |
| UF2 | | [`patterns/uf2.hexpat`](patterns/uf2.hexpat) | [USB Flashing Format](https://github.com/microsoft/uf2) | | UF2 | | [`patterns/uf2.hexpat`](patterns/uf2.hexpat) | [USB Flashing Format](https://github.com/microsoft/uf2) |
| Valve VPK | | [`patterns/valve_vpk.hexpat`](valve_vpk.hexpat) | Valve Package File |
| VBMeta | | [`patterns/vbmeta.hexpat`](patterns/vbmeta.hexpat) | Android VBMeta image | | VBMeta | | [`patterns/vbmeta.hexpat`](patterns/vbmeta.hexpat) | Android VBMeta image |
| VDF | | [`patterns/vdf.hexpat`](patterns/vdf.hexpat) | Binary Value Data Format (.vdf) files | | VDF | | [`patterns/vdf.hexpat`](patterns/vdf.hexpat) | Binary Value Data Format (.vdf) files |
| VEADO | | [`patterns/veado.hexpat`](patterns/veado.hexpat) | veadotube mini avatar file | | VEADO | | [`patterns/veado.hexpat`](patterns/veado.hexpat) | veadotube mini avatar file |

62
patterns/valve_vpk.hexpat Normal file
View File

@@ -0,0 +1,62 @@
#pragma author Enaium
#pragma description Valve VPK
import std.io;
import std.mem;
import std.string;
struct string {
char text[while(std::mem::read_unsigned($, 1) != 0x0)];
u8 end [[hidden]];
if (text == "") {
break;
}
};
struct entry {
string name;
u32 crc;
u16 preload_bytes;
u16 archive_index;
u32 entry_offset;
u32 entry_length;
u16 terminator;
if (preload_bytes > 0x0) {
u8 preload[preload_bytes];
}
if (archive_index == 0x7fff) {
u8 data[entry_length] @ entry_offset;
}
};
struct path {
string name;
entry entry[while(true)];
};
struct extension {
string name;
path path[while(true)];
};
struct header {
u32 signature;
u32 version;
u32 tree_size;
if (version == 0x2) {
u32 file_data_section_size;
u32 archive_md5_section_size;
u32 ohter_md5_section_size;
u32 signature_section_size;
}
};
struct vpk {
header header;
extension extension[while(true)];
};
vpk vpk @ 0x0;

Binary file not shown.