Compare commits

..

14 Commits

Author SHA1 Message Date
WerWolv
dac2e0f786 patterns: Fixed a few errors 2024-02-25 22:59:32 +01:00
Nik
f70b7066b9 includes: Switch over to import statements (#224)
* Update includes and patterns to new import system

* Update namespaces to new syntax
2024-02-25 22:04:41 +01:00
WerWolv
3f44a743e8 yara: Added advanced analysis rules 2024-02-25 11:29:59 +01:00
WerWolv
834e5261b3 tests: Fixed tests not building 2024-02-18 13:07:04 +01:00
Nik
0e2966f10d includes/std: Added missing std::core::set_pattern_comment function 2024-02-09 13:23:51 +01:00
Nik
b2bc248447 includes/hex: SectionId -> Section 2024-01-31 08:24:03 +01:00
Nik
e6589ecba1 includes/std: Make std::mem::read_string take in a larger size 2024-01-31 08:22:25 +01:00
apewo
f75ba4b6ee patterns/pe: Add extra MIME Type (#220)
add pe mime

Co-authored-by: John Doe <bla@bla.bla>
2024-01-29 18:36:21 +01:00
Nik
cf18580960 includes/hex: Added decompress functions 2024-01-27 17:05:08 +01:00
lucia c
e7d1973957 patterns: Added SWF header pattern (#219)
* patterns: Added pattern for SWF files.

* Added test file for SWF header.

* Update README with SWF file type.
2024-01-27 15:53:16 +01:00
t1hq
35cc68544b encodings: Add custom encoding file for Big5 (#218)
* add big5 encoding table

* add notes for big5 encoding, and how to import custom encoding file
2024-01-27 11:18:47 +01:00
Nik
41d8967deb patterns/pyc: Remove unused function 2024-01-20 22:14:47 +01:00
pew
658ec20b37 patterns: Add .ras pattern (#216)
* Add simple .ras file pattern

* Update ras.hexpat

* Update README.md

* Add .ras test file

* Update ras.hexpat

* Update ras.hexpat

* Update ras.hexpat

* Update ras.hexpat
2024-01-10 00:38:18 +01:00
paxcut
fb5fcbafc1 includes/type: Changes to magic type to include address of failed asserts. (#217) 2024-01-10 00:36:17 +01:00
137 changed files with 19174 additions and 329 deletions

View File

@@ -94,12 +94,14 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi
| PYC | | [`patterns/pyc.hexpat`](patterns/pyc.hexpat) | Python bytecode files |
| QBCL | | [`patterns/qbcl.hexpat`](patterns/qbcl.hexpat) | Qubicle voxel scene project file |
| QOI | `image/qoi` | [`patterns/qoi.hexpat`](patterns/qoi.hexpat) | QOI image files |
| RAS | `image/x-sun-raster` | [`patterns/ras.hexpat`](patterns/ras.hexpat) | RAS image files |
| Shell Link | `application/x-ms-shortcut` | [`patterns/lnk.hexpat`](patterns/lnk.hexpat) | Windows Shell Link file format |
| shp | | [`patterns/shp.hexpat`](patterns/shp.hexpat) | ESRI shape file |
| shx | | [`patterns/shx.hexpat`](patterns/shx.hexpat) | ESRI index file |
| SPIRV | | [`patterns/spirv.hexpat`](patterns/spirv.hexpat) | SPIR-V header and instructions |
| STL | `model/stl` | [`patterns/stl.hexpat`](patterns/stl.hexpat) | STL 3D Model format |
| StuffItV5 | `application/x-stuffit` | [`patterns/sit5.hexpat`](patterns/sit5.hexpat) | StuffIt V5 archive |
| SWF | |[`patterns/swf.hexpat`](patterns/swf.hexpat) | Shockwave Flash file format |
| TAR | `application/x-tar` | [`patterns/tar.hexpat`](patterns/tar.hexpat) | Tar file format |
| TIFF | `image/tiff` | [`patterns/tiff.hexpat`](patterns/tiff.hexpat) | Tag Image File Format |
| TGA | `image/tga` | [`patterns/tga.hexpat`](patterns/tga.hexpat) | Truevision TGA/TARGA image |
@@ -168,6 +170,7 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi
| ASCII+OEM | [`encodings/ascii_oem.tbl`](encodings/ascii_oem.tbl) | ASCII encoding with Windows OEM characters |
| Baltic ISO | [`encodings/baltic_iso.tbl`](encodings/baltic_iso.tbl) | Baltic ISO encoding |
| Baltic Windows | [`encodings/baltic_windows.tbl`](encodings/baltic_windows.tbl) | Baltic Windows encoding |
| Big5 (Traditional Chinese) | [`encodings/big5.tbl`](encodings/big5.tbl) | Big5 encoding for Traditional Chinese |
| Cyrillic ISO | [`encodings/cyrillic_iso.tbl`](encodings/cyrillic_iso.tbl) | Cyrillic ISO encoding |
| Cyrillic Windows | [`encodings/cyrillic_windows.tbl`](encodings/cyrillic_windows.tbl) | Cyrillic Windows encoding |
| Cyrillic KOI8-R | [`encodings/cyrillic_koi8_r.tbl`](encodings/cyrillic_koi8_r.tbl) | Cyrillic KOI8-R encoding (Russian Characters) |
@@ -195,6 +198,7 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi
| Turkish Windows | [`encodings/turkish_windows.tbl`](encodings/turkish_windows.tbl) | Turkish Windows encoding |
| UTF-8 | [`encodings/utf8.tbl`](encodings/utf8.tbl) | UTF-8 encoding |
| Vietnamese | [`encodings/vietnamese.tbl`](encodings/vietnamese.tbl) | Vietnamese character encoding |
> import custom encoding from File -> Import... -> Custome Encoding File
### Data Processor Nodes
| Name | Path | Description |

18594
encodings/big5.tbl Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +1,12 @@
#pragma once
#include <hex/impl/imhex_check.pat>
import hex.impl.imhex_check;
/*!
Core intrinsic functions to interact with the ImHex Hex Editor
*/
namespace hex::core {
namespace auto hex::core {
/**
A type representing a selection in the hex editor

View File

@@ -1,12 +1,14 @@
#pragma once
#include <hex/impl/imhex_check.pat>
import hex.impl.imhex_check;
import std.mem;
/*!
Library to allow decoding of more complex values
*/
namespace hex::dec {
namespace auto hex::dec {
/**
Demangles a mangled name into a human readable name
@@ -17,4 +19,46 @@ namespace hex::dec {
return builtin::hex::dec::demangle(mangled_name);
};
/**
Decompresses the bytes of a pattern into a section using the zlib algorithm
@param pattern The pattern whose bytes should be decompressed
@param section The section to decompress the data into
@param window_size The window size passed to zlib
@return true if successful, false otherwise
*/
fn zlib_decompress(ref auto pattern, std::mem::Section section, u64 window_size = 0) {
return builtin::hex::dec::zlib_decompress(pattern, section, window_size);
};
/**
Decompresses the bytes of a pattern into a section using the bzip algorithm
@param pattern The pattern whose bytes should be decompressed
@param section The section to decompress the data into
@return true if successful, false otherwise
*/
fn bzip_decompress(ref auto pattern, std::mem::Section section) {
return builtin::hex::dec::bzip_decompress(pattern, section);
};
/**
Decompresses the bytes of a pattern into a section using the LZMA algorithm
@param pattern The pattern whose bytes should be decompressed
@param section The section to decompress the data into
@return true if successful, false otherwise
*/
fn lzma_decompress(ref auto pattern, std::mem::Section section) {
return builtin::hex::dec::lzma_decompress(pattern, section);
};
/**
Decompresses the bytes of a pattern into a section using the zstd algorithm
@param pattern The pattern whose bytes should be decompressed
@param section The section to decompress the data into
@return true if successful, false otherwise
*/
fn zstd_decompress(ref auto pattern, std::mem::Section section) {
return builtin::hex::dec::zstd_decompress(pattern, section);
};
}

View File

@@ -1,12 +1,12 @@
#pragma once
#include <hex/impl/imhex_check.pat>
import hex.impl.imhex_check;
/*!
Library to do HTTP requests
*/
namespace hex::http {
namespace auto hex::http {
/**
Performs a HTTP GET request to the given URL and returns the response body

View File

@@ -1,12 +1,12 @@
#pragma once
#include <hex/impl/imhex_check.pat>
import hex.impl.imhex_check;
/*!
Library to interact with the currently loaded provider.
*/
namespace hex::prv {
namespace auto hex::prv {
/**

View File

@@ -1,16 +1,16 @@
#pragma once
#include <std/io.pat>
#include <std/mem.pat>
import std.io;
import std.mem;
#include <hex/impl/imhex_check.pat>
#include <hex/dec.pat>
import hex.impl.imhex_check;
import hex.dec;
/*!
Types to automatically decode mangled names
*/
namespace hex::type {
namespace auto hex::type {
/**
A mangled name string that gets demangled when displayed

View File

@@ -1,13 +1,13 @@
#pragma once
#include <std/sys.pat>
import std.sys;
/*!
The array library contains a helper type to make it easier to create multi-dimensional arrays
and pass arrays to functions as parameters.
*/
namespace std {
namespace auto std {
/**
Simple one dimensional array wrapper

View File

@@ -1,12 +1,12 @@
#pragma once
#include <std/limits.pat>
import std.limits;
/*!
This library contains various helper functions for common bit operations.
*/
namespace std::bit {
namespace auto std::bit {
/**
Calculates the number of 1 bits in a given number

View File

@@ -1,13 +1,13 @@
#pragma once
#include <std/mem.pat>
import std.mem;
/*!
The core library contains intrinsics and "compiler magic" functions that
get extra help from the runtime to fulfill their purpose.
*/
namespace std::core {
namespace auto std::core {
/**
The layout order of each field after byte-endianness has been handled.
@@ -146,4 +146,14 @@ namespace std::core {
fn set_display_name(ref auto pattern, str name) {
builtin::std::core::set_display_name(pattern, name);
};
/**
Changes the comment attached to a pattern
@param pattern The pattern to modify
@param name The new comment of the pattern
*/
fn set_pattern_comment(ref auto pattern, str comment) {
builtin::std::core::set_pattern_comment(pattern, name);
};
}

View File

@@ -5,7 +5,7 @@
of ASCII characters.
*/
namespace std::ctype {
namespace auto std::ctype {
/**
Checks if the given character `c` is a digit between '0' and '9'

View File

@@ -7,7 +7,7 @@
**These functions are considered dangerous and require the user to manually permit them**
*/
namespace std::file {
namespace auto std::file {
/**
A handle representing a file that has been opened

View File

@@ -4,7 +4,7 @@
Library for doing arithmetic with fixed point numbers and converting them from/to floating point numbers.
*/
namespace std::fxpt {
namespace auto std::fxpt {
/**
A fixed point value

View File

@@ -4,7 +4,7 @@
The hash library contains various data hash functions
*/
namespace std::hash {
namespace auto std::hash {
/**
Calculates the CRC32 hash of the bytes inside of a given pattern

View File

@@ -4,7 +4,7 @@
The IO library allows formatting strings and outputting text to the console
*/
namespace std {
namespace auto std {
/**
Formats the given arguments using the format string and prints the result to the console

View File

@@ -4,7 +4,7 @@
Library to calculate the minimum and maximum values that fit into a given data type
*/
namespace std::limits {
namespace auto std::limits {
/**
Returns the minimum value that can be stored in a `u8`.

View File

@@ -1,12 +1,12 @@
#pragma once
#include <std/mem.pat>
import std.mem;
/*!
Library containing more advanced mathematical operations.
*/
namespace std::math {
namespace auto std::math {
/**
Compares the values `a` and `b` with each other and returns the smaller of the two

View File

@@ -1,10 +1,8 @@
#pragma once
/*!
Library for doing raw memory accesses and other low-level operations.
*/
namespace std::mem {
namespace auto std::mem {
namespace impl {
@@ -128,7 +126,7 @@ namespace std::mem {
@param size The size of the value to read
@return The value read
*/
fn read_string(u128 address, u8 size) {
fn read_string(u128 address, u128 size) {
return builtin::std::mem::read_string(address, size);
};

View File

@@ -1,13 +1,13 @@
#pragma once
#include <std/mem.pat>
import std.mem;
/*!
The Pointer library contains helper functions to deal with pointer types.
The `relative_to` functions are meant to be used with the `[[pointer_base]]` attribute
*/
namespace std::ptr {
namespace auto std::ptr {
/**
Use the offset of the current pointer as start address

View File

@@ -1,12 +1,12 @@
#pragma once
#include <std/limits.pat>
import std.limits;
/*!
Library to generate random numbers. Supports various different distribution types.
*/
namespace std::random {
namespace auto std::random {
/**
Represents the type of distribution to use to generate a random number

View File

@@ -1,12 +1,12 @@
#pragma once
#include <std/io.pat>
import std.io;
/*!
Libray to interact with strings.
*/
namespace std::string {
namespace auto std::string {
/**
Base type for sized strings. Represents a string with its size preceeding it.

View File

@@ -1,12 +1,12 @@
#pragma once
#include <std/io.pat>
import std.io;
/*!
Basic helper functions
*/
namespace std {
namespace auto std {
/**
Asserts that a given value is true. If it's not, abort evaluation and print the given message to the console

View File

@@ -1,12 +1,12 @@
#pragma once
#include <std/io.pat>
import std.io;
/*!
Library to handle time and date related operations.
*/
namespace std::time {
namespace auto std::time {
/**
A structured representation of a time and date.

View File

@@ -1,14 +1,14 @@
#pragma once
#include <std/io.pat>
#include <std/math.pat>
import std.io;
import std.math;
/*!
Types used to change the base of the displayed integer value.
Used like `type::Hex<u32> hexNumber;`, `type::Oct<u16> octalNumber;`
*/
namespace type {
namespace auto type {
/**
Integer type representing a Hexadecimal value. Displays its value in hexadecimal format.

View File

@@ -1,12 +1,12 @@
#include <std/io.pat>
#include <std/string.pat>
#include <std/mem.pat>
import std.io;
import std.string;
import std.mem;
/*!
Type representing a Base64 encoded string
*/
namespace type {
namespace auto type {
/**
Type representing a Base64 encoded string

View File

@@ -1,12 +1,12 @@
#pragma once
#include <std/io.pat>
import std.io;
/*!
Type to decode a BCD (Binary Coded Decimal) number
*/
namespace type {
namespace auto type {
/**
Decodes a BCD value where one byte represents a single digit

View File

@@ -1,12 +1,12 @@
#pragma once
#include <std/io.pat>
import std.io;
/*!
Types to display single bytes using various different representations
*/
namespace type {
namespace auto type {
/**
Type visualizing the value of each individual bit

View File

@@ -1,13 +1,13 @@
#pragma once
#include <std/io.pat>
#include <std/core.pat>
import std.io;
import std.core;
/*!
Types representing RGB or RGBA colors. The decoded color will be displayed in their color field
*/
namespace type {
namespace auto type {
/**
Type representing a generic RGBA color with a variable number of bits for each color

View File

@@ -1,14 +1,14 @@
#pragma once
#include <std/io.pat>
#include <std/math.pat>
#include <std/mem.pat>
import std.io;
import std.math;
import std.mem;
/*!
Type representing a 16 bit half precision floating point number
*/
namespace type {
namespace auto type {
/**
Type representing a 16 bit half precision floating point number

View File

@@ -1,12 +1,12 @@
#pragma once
#include <std/io.pat>
import std.io;
/*!
Types to deal with UUIDs (Universally Unique Identifiers) / GUIDs (Globally Unique Identifiers) as described in RFC 4122
*/
namespace type {
namespace auto type {
/**
Type representing a GUID value

View File

@@ -1,13 +1,13 @@
#pragma once
#include <std/io.pat>
#include <std/string.pat>
import std.io;
import std.string;
/*!
Types used to decode IP addresses
*/
namespace type {
namespace auto type {
/**
A 4 byte IPv4 Address as described in RFC 791

View File

@@ -1,13 +1,13 @@
#pragma once
#include <std/io.pat>
#include <std/mem.pat>
import std.io;
import std.mem;
/*!
Types used to decode Little Endian Base 128 numbers used to store large numbers as space efficiently as possible
*/
namespace type {
namespace auto type {
/**
Base LEB128 type. Use `uLEB128` and `sLEB128` instead.

View File

@@ -1,12 +1,12 @@
#pragma once
#include <std/io.pat>
import std.io;
/*!
Types used to decode MAC Addresses
*/
namespace type {
namespace auto type {
/**
A MAC Address as used in the Internet Protocol

View File

@@ -1,38 +1,43 @@
#include <std/string.pat>
#include <std/sys.pat>
#include <std/io.pat>
#include <std/ctype.pat>
import std.string;
import std.sys;
import std.io;
import std.ctype;
/*!
Types used to parse and enforce specific magic numbers
*/
namespace type {
namespace auto type
{
fn fm(ref auto value)
{
str result;
for (u32 i = 0, i < sizeof(value), i += 1)
{
char c = value[i];
if (std::ctype::isprint(c))
result += c;
else
result += std::format("\\x{:02X}", u8(c));
}
return std::format("\"{}\"", result);
};
/**
A Magic number. Throws an error if the magic number does not match the expected value
@tparam ExpectedValue A string representing the expected value
*/
struct Magic<auto ExpectedValue> {
struct Magic<auto ExpectedValue>
{
char value[std::string::length(ExpectedValue)];
std::assert(value == ExpectedValue, std::format("Invalid magic value! Expected \"{}\", got \"{}\".", ExpectedValue, value));
std::assert_warn(value == ExpectedValue, std::format("Invalid magic value! Expected {}, got {} at position 0x{:X}", type::fm(ExpectedValue), type::fm(value), $ - std::string::length(ExpectedValue)));
} [[sealed, format("type::impl::format_magic")]];
namespace impl {
fn format_magic(ref auto magic) {
str result;
for (u32 i = 0, i < sizeof(magic.value), i += 1) {
char c = magic.value[i];
if (std::ctype::isprint(c))
result += c;
else
result += std::format("\\x{:02X}", u8(c));
}
return std::format("\"{}\"", result);
namespace impl
{
fn format_magic(ref auto magic)
{
return fm(magic.value);
};
}
}

View File

@@ -1,10 +1,10 @@
#include <std/mem.pat>
import std.mem;
/*!
Types dealing with various kinds of resource paths
*/
namespace type {
namespace auto type {
/**
Type representing a single path segment. Use the `Path` type instead of using this on its own

View File

@@ -1,10 +1,10 @@
#include <std/io.pat>
import std.io;
/*!
Types used to pretty print size values
*/
namespace type {
namespace auto type {
/**
A generic size type which displays its value in Bytes (or kiB, MiB, GiB, TiB, PiB, EiB if larger)

View File

@@ -1,13 +1,13 @@
#pragma once
#include <std/io.pat>
#include <std/time.pat>
import std.io;
import std.time;
/*!
Types used to decode various different time formats
*/
namespace type {
namespace auto type {
/**
A 32 bit Unix time value

View File

@@ -5,7 +5,7 @@
*/
// Explicitly don't add these types to the `type` namespace for usability
// namespace type {
// namespace auto type {
// using char = s8;
using byte = s8;

View File

@@ -5,7 +5,7 @@
*/
// Explicitly don't add these types to the `type` namespace for usability
// namespace type {
// namespace auto type {
using uint8_t = u8;
using uint16_t = u16;

View File

@@ -5,7 +5,7 @@
*/
// Explicitly don't add these types to the `type` namespace for usability
// namespace type {
// namespace auto type {
using le16 = le u16;
using be16 = be u16;

View File

@@ -5,7 +5,7 @@
*/
// Explicitly don't add these types to the `type` namespace for usability
// namespace type {
// namespace auto type {
// using u8 = u8;
// using u16 = u16;

View File

@@ -5,7 +5,7 @@
*/
// Explicitly don't add these types to the `type` namespace for usability
// namespace type {
// namespace auto type {
using BYTE = u8;
using WORD = u16;

View File

@@ -1,8 +1,8 @@
#pragma author WerWolv
#pragma description Autodesk 3DS Max Model file
#include <std/io.pat>
#include <type/base.pat>
import std.io;
import type.base;
#pragma MIME image/x-3ds

View File

@@ -1,8 +1,8 @@
#pragma description 7z File Format
#include <std/io.pat>
#include <std/mem.pat>
#include <std/math.pat>
import std.io;
import std.mem;
import std.math;
enum Type:u8{

View File

@@ -2,9 +2,9 @@
#pragma description Crash Bandicoot - Back in Time (fan game) User created level format
// Supports all versions till 0.94c, newer versions might be compatible!
#include <type/magic.pat>
#include <std/string.pat>
#include <std/array.pat>
import type.magic;
import std.string;
import std.array;
struct Header {

View File

@@ -3,8 +3,8 @@
#pragma endian little
#include <std/io.pat>
#include <std/sys.pat>
import std.io;
import std.sys;
#define ATMOSPHERE_REBOOT_TO_FATAL_MAGIC "AFE2"
#define ATMOSPHERE_REBOOT_TO_FATAL_MAGIC_1 "AFE1"

View File

@@ -3,9 +3,9 @@
#pragma MIME application/x-archive
#include <std/string.pat>
#include <std/mem.pat>
#include <std/sys.pat>
import std.string;
import std.mem;
import std.sys;
struct ARFile {
char file_name[16];

View File

@@ -3,8 +3,8 @@
#pragma endian little
#include <std/io.pat>
#include <std/mem.pat>
import std.io;
import std.mem;
#define VTOR 0x00000000
#define EXTERNAL_INTERRUPT_COUNT 64

View File

@@ -3,9 +3,9 @@
#pragma MIME application/x-bittorrent
#include <std/ctype.pat>
#include <std/mem.pat>
#include <std/string.pat>
import std.ctype;
import std.mem;
import std.string;
namespace bencode {

View File

@@ -2,7 +2,7 @@
#pragma MIME image/bmp
#pragma endian little
#include <std/mem.pat>
import std.mem;
struct BitmapFileHeader {
u8 bfType[2];

View File

@@ -1,7 +1,7 @@
#include <std/math.pat>
#include <std/core.pat>
#include <type/magic.pat>
#include <type/time.pat>
import std.math;
import std.core;
import type.magic;
import type.time;
using CFBinaryPlistObject;

View File

@@ -3,8 +3,8 @@
#pragma MIME application/bson
#include <std/mem.pat>
#include <type/time.pat>
import std.mem;
import type.time;
enum Type : u8 {
Double = 0x01,

View File

@@ -1,8 +1,8 @@
#pragma description GoldSrc engine maps format (used in Half-Life 1)
#include <std/ptr.pat>
#include <std/mem.pat>
#include <std/sys.pat>
import std.ptr;
import std.mem;
import std.sys;
#pragma endian little

View File

@@ -1,11 +1,11 @@
#pragma author WerWolv
#pragma description Windows HtmlHelp Data (ITSF / CHM)
#include <type/magic.pat>
#include <type/size.pat>
#include <type/guid.pat>
#include <type/leb128.pat>
#include <std/sys.pat>
import type.magic;
import type.size;
import type.guid;
import type.leb128;
import std.sys;
enum WindowsLanguageId : u32 {
Arabic_SaudiArabia = 0x401,

View File

@@ -3,8 +3,8 @@
#pragma MIME application/x-coff
#include <type/time.pat>
#include <type/size.pat>
import type.time;
import type.size;
enum Machine : u16 {
Unknown = 0x0000,

View File

@@ -1,12 +1,12 @@
#pragma author WerWolv
#pragma description Old Binary CPIO Format
#include <type/base.pat>
import type.base;
#include <std/time.pat>
#include <std/core.pat>
#include <std/sys.pat>
#include <std/mem.pat>
import std.time;
import std.core;
import std.sys;
import std.mem;
#pragma MIME application/x-cpio

View File

@@ -1,6 +1,6 @@
#pragma description Dalvik EXecutable Format
#include <type/leb128.pat>
import type.leb128;
struct header_item {
u8 magic[8];

View File

@@ -3,12 +3,12 @@
#pragma MIME application/dicom
#pragma endian little
#include <std/core.pat>
#include <std/io.pat>
#include <std/mem.pat>
#include <std/string.pat>
#include <std/sys.pat>
#include <type/magic.pat>
import std.core;
import std.io;
import std.mem;
import std.string;
import std.sys;
import type.magic;
u32 UNDEFINED_LENGTH = 0xffffffff;

View File

@@ -2,10 +2,10 @@
#pragma endian big
#include <type/magic.pat>
#include <type/size.pat>
#include <type/guid.pat>
#include <std/mem.pat>
import type.magic;
import type.size;
import type.guid;
import std.mem;
// Parse DMG Structure per http://newosxbook.com/DMG.html
//

View File

@@ -2,7 +2,7 @@
// Apple macOS .DS_Store format
#pragma endian big
#include <std/io.pat>
import std.io;
struct RecordEntry {
u32 length;

View File

@@ -7,9 +7,9 @@
#pragma MIME application/x-object
#pragma MIME application/x-sharedlib
#include <std/core.pat>
#include <std/io.pat>
#include <std/mem.pat>
import std.core;
import std.io;
import std.mem;
using BitfieldOrder = std::core::BitfieldOrder;

View File

@@ -3,12 +3,12 @@
#pragma endian big
#include <std/sys.pat>
#include <std/io.pat>
#include <std/core.pat>
import std.sys;
import std.io;
import std.core;
#include <type/magic.pat>
#include <type/size.pat>
import type.magic;
import type.size;
// These are used in order for the children to be able to find strings
u64 fdt_addr;

View File

@@ -1,9 +1,9 @@
#pragma author WerWolv
#pragma description Free Lossless Audio Codec, FLAC Audio Format
#include <std/sys.pat>
#include <std/core.pat>
#include <std/io.pat>
import std.sys;
import std.core;
import std.io;
#pragma endian big

View File

@@ -1,7 +1,7 @@
#pragma author WerWolv
#pragma description Drive File System
#include <std/io.pat>
import std.io;
struct DiskTimeStamp {
u8 seconds, minutes, hours;

View File

@@ -3,9 +3,9 @@
#pragma MIME application/x-gameboy-rom
#include <type/size.pat>
#include <std/string.pat>
#include <std/mem.pat>
import type.size;
import std.string;
import std.mem;
bool uppercaseROMFeatures in;
bool brandedROMFeatures in;

View File

@@ -13,13 +13,13 @@
#define EXTENSION_INTRODUCER_MAGIC 0x21
#define GIF_TRAILER_MAGIC 0x3B
#include <std/io.pat>
#include <std/core.pat>
#include <std/mem.pat>
#include <std/string.pat>
#include <std/math.pat>
import std.io;
import std.core;
import std.mem;
import std.string;
import std.math;
#include <type/magic.pat>
import type.magic;
bitfield GCT_Flags {
size : 3 [[comment("physical size = 2^(flags.size + 1)")]];

View File

@@ -22,8 +22,8 @@
* SOFTWARE.
*/
#include <std/mem.pat>
#include <std/io.pat>
import std.mem;
import std.io;
/**
* @brief The glTF magic section.

View File

@@ -3,10 +3,10 @@
#pragma MIME application/gzip
#include <type/time.pat>
#include <type/size.pat>
#include <std/core.pat>
#include <std/mem.pat>
import type.time;
import type.size;
import std.core;
import std.mem;
using BitfieldOrder = std::core::BitfieldOrder;

View File

@@ -1,6 +1,6 @@
#include <std/mem.pat>
#include <std/io.pat>
#include <std/string.pat>
import std.mem;
import std.io;
import std.string;
struct Header {
u32 magic;

View File

@@ -1,10 +1,10 @@
#pragma author Surasia
#pragma description Halo Infinite HavokScript 5.1 "luas" file
#include <std/io.pat>
#include <std/mem.pat>
#include <std/core.pat>
#include <std/string.pat>
import std.io;
import std.mem;
import std.core;
import std.string;
struct String32 {
s32 length;

View File

@@ -3,7 +3,7 @@
#pragma endian little
#include <std/sys.pat>
import std.sys;
#pragma MIME image/vnd.microsoft.icon
#pragma MIME image/x-icon

View File

@@ -2,7 +2,7 @@
#pragma MIME audio/mpeg
#include <std/mem.pat>
import std.mem;
namespace v1 {

View File

@@ -8,7 +8,7 @@
*/
#pragma endian big
#include <std/mem.pat>
import std.mem;
enum FileType: u16 {
Data = 0x3030,

View File

@@ -3,8 +3,8 @@
#pragma endian big
#include <std/sys.pat>
#include <std/io.pat>
import std.sys;
import std.io;
struct MAC {
u8 octets[6];

View File

@@ -3,8 +3,8 @@
#pragma endian big
#include <std/mem.pat>
#include <std/string.pat>
import std.mem;
import std.string;
struct Hunk {
u24 offset;

View File

@@ -2,7 +2,7 @@
#pragma endian little
#include <std/io.pat>
import std.io;
enum VolumeDescriptorTypes : u8 {
BootRecord,

View File

@@ -5,11 +5,11 @@
#pragma pattern_limit 100000000
#pragma MIME application/x-java-applet
#include <std/string.pat>
#include <std/math.pat>
#include <std/core.pat>
#include <std/io.pat>
#include <std/sys.pat>
import std.string;
import std.math;
import std.core;
import std.io;
import std.sys;
using BitfieldOrder = std::core::BitfieldOrder;

View File

@@ -1,9 +1,9 @@
#pragma author WerWolv
#pragma description JPEG Image Format
#include <std/io.pat>
#include <std/mem.pat>
#include <type/magic.pat>
import std.io;
import std.mem;
import type.magic;
#pragma endian big
#pragma MIME image/jpeg

View File

@@ -3,9 +3,9 @@
#pragma MIME application/x-ms-shortcut
#include <std/core.pat>
#include <type/guid.pat>
#include <type/size.pat>
import std.core;
import type.guid;
import type.size;
using BitfieldOrder = std::core::BitfieldOrder;

View File

@@ -1,7 +1,7 @@
#pragma description Lua 5.4 bytecode
#include <std/io.pat>
#include <std/mem.pat>
import std.io;
import std.mem;
namespace impl {

View File

@@ -3,7 +3,7 @@
#pragma MIME application/x-mach-binary
#include <type/size.pat>
import type.size;
enum Magic : u32 {
_32BitMagic = 0xFEEDFACE,

View File

@@ -1,7 +1,7 @@
#pragma description Mechanized Assault and Exploration v1.04 (strategy game) save file format
#include <std/sys.pat>
#include <std/mem.pat>
import std.sys;
import std.mem;
#pragma array_limit 12544
#pragma pattern_limit 2000000

View File

@@ -1,6 +1,6 @@
#pragma description MIDI header, event fields provided
#include <std/core.pat>
import std.core;
#pragma MIME audio/midi
#pragma endian big

View File

@@ -3,9 +3,9 @@
#pragma MIME application/x-dmp
#include <type/time.pat>
#include <type/types/win32.pat>
#include <type/size.pat>
import type.time;
import type.types.win32;
import type.size;
using RVA = ULONG32;
using RVA64 = ULONG64;

View File

@@ -6,9 +6,9 @@
#pragma MIME video/mp4
#pragma MIME application/mp4
#include <std/io.pat>
#include <std/mem.pat>
#include <std/string.pat>
import std.io;
import std.mem;
import std.string;
fn to_string(auto var) {
return str(var);

View File

@@ -3,8 +3,8 @@
#pragma endian little
#include <std/sys.pat>
#include <std/io.pat>
import std.sys;
import std.io;
struct ApplicationTitle {
char name[0x200];

View File

@@ -1,7 +1,7 @@
#pragma author WerWolv
#pragma description Minecraft NBT format
#include <std/sys.pat>
import std.sys;
#pragma endian big

View File

@@ -1,6 +1,6 @@
#pragma description NE header and Standard NE fields
#include <std/mem.pat>
import std.mem;
struct DOSHeader {
char signature[2];

View File

@@ -1,8 +1,8 @@
#pragma author gmestanley
#pragma description .nes file format
#include <std/mem.pat>
#include <std/string.pat>
import std.mem;
import std.string;
bitfield iNES07Flags {
mirroringIsVertical : 1;

View File

@@ -1,8 +1,8 @@
#pragma author WerWolv
#pragma description Nintendo Switch NRO files
#include <std/io.pat>
#include <std/sys.pat>
import std.io;
import std.sys;
struct MOD0 {
char magic[4];

View File

@@ -1,7 +1,7 @@
#pragma author WerWolv
#pragma description NTAG213/NTAG215/NTAG216, NFC Forum Type 2 Tag compliant IC
#include <std/core.pat>
import std.core;
using BitfieldOrder = std::core::BitfieldOrder;

View File

@@ -3,8 +3,8 @@
#pragma MIME audio/ogg
#include <std/core.pat>
#include <std/mem.pat>
import std.core;
import std.mem;
bitfield HeaderType {
Continuation : 1;

View File

@@ -6,8 +6,8 @@
//
// SPDX-License-Identifier: GPL-2.0-or-later
#include <std/mem.pat>
#include <type/magic.pat>
import std.mem;
import type.magic;
#pragma endian big

View File

@@ -1,6 +1,6 @@
#pragma description pcap header and packets
#include <std/mem.pat>
import std.mem;
#pragma MIME application/vnd.tcpdump.pcap
enum network_type : u32 {

View File

@@ -3,7 +3,7 @@
#pragma MIME application/x-pcx
#include <std/io.pat>
import std.io;
enum Encoding : u8 {
NoEncoding = 0x00,

View File

@@ -3,11 +3,12 @@
#pragma MIME application/x-dosexec
#pragma MIME application/x-msdownload
#pragma MIME application/vnd.microsoft.portable-executable
#include <std/core.pat>
#include <std/string.pat>
#include <type/guid.pat>
#include <type/time.pat>
import std.core;
import std.string;
import type.guid;
import type.time;
struct DOSHeader {
char signature[2] [[hex::spec_name("e_magic")]];

View File

@@ -1,10 +1,10 @@
#pragma author WerWolv
#pragma description Nintendo Switch PFS0 archive (NSP files)
#include <type/magic.pat>
#include <type/size.pat>
import type.magic;
import type.size;
#include <std/core.pat>
import std.core;
struct FileEntry {
u64 dataOffset;

View File

@@ -3,7 +3,7 @@
#pragma MIME image/png
#pragma endian big
#include <std/mem.pat>
import std.mem;
struct header_t {
u8 highBitByte;

View File

@@ -1,10 +1,10 @@
#pragma author WerWolv
#pragma description Google Protobuf encoding
#include <std/core.pat>
#include <std/mem.pat>
import std.core;
import std.mem;
#include <type/leb128.pat>
import type.leb128;
struct ZigZag32 {
u32 value;

View File

@@ -1,7 +1,7 @@
#pragma description Python bytecode files
#include <type/time.pat>
#include <std/mem.pat>
import type.time;
import std.mem;
#define FLAG_REF 0x80
#define TYPE_NULL '0'
@@ -48,10 +48,6 @@ fn below(u8 major, u8 minor) {
return _major <=major && _minor < minor;
};
fn is(u8 major, u8 minor) {
return _major == major && _minor == minor;
};
fn between(u8 major, u8 minor, u8 otherMajor, u8 otherMinor) {
return above(major, minor) && below(otherMajor, otherMinor);
};

Some files were not shown because too many files have changed in this diff Show More