mirror of
https://github.com/WerWolv/ImHex-Patterns.git
synced 2026-03-27 23:37:04 -05:00
* repo-wide: trim trailing spaces Note: This doesn't touch the .tbl files in encodings/ since they include meaningful trailing spaces (`20= `) * patterns: clean up duplicate semicolons * ELF: add header magic check * glTF: use type::Magic for magic value * glTF: check that the file size in the header matches * xgstexture: fix generics syntax for magic value * JPEG: define hex enum with 0x00 instead of 0X00 * CI: update deprecated actions --------- Co-authored-by: Nik <werwolv98@gmail.com>
32 lines
708 B
Rust
32 lines
708 B
Rust
#pragma author WerWolv
|
|
#pragma description GNU Static library archive
|
|
|
|
#pragma MIME application/x-archive
|
|
|
|
import std.string;
|
|
import std.mem;
|
|
import std.sys;
|
|
|
|
struct ARFile {
|
|
char file_name[16];
|
|
char modification_timestamp[12];
|
|
char owner_id[6];
|
|
char group_id[6];
|
|
char file_mode[8];
|
|
char file_size[10];
|
|
u16 end_marker;
|
|
|
|
if (end_marker == 0x0A60) {
|
|
u8 data[std::string::parse_int(this.file_size, 10)];
|
|
padding[sizeof(data) & 1];
|
|
}
|
|
};
|
|
|
|
char signature[8] @ 0x00;
|
|
if (signature == "!<arch>\r") {
|
|
std::error("Archive file got corrupted due to CRLF line ending conversion!");
|
|
}
|
|
std::assert(signature == "!<arch>\n", "File is not a valid archive!");
|
|
|
|
ARFile files[while($ < std::mem::size())] @ $;
|