Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patterns: add Family ID enum to uf2.hexpat + add missing description pragmas and other minor fixes #282

Merged
merged 5 commits into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi
|------|------|------|-------------|
| 3DS | | [`patterns/3ds.hexpat`](patterns/3ds.hexpat) | Autodesk 3DS Max Model file |
| 7Z | | [`patterns/7z.hexpat`](patterns/7z.hexpat) | 7z File Format |
| ADTS | | [`patterns/adts.hexpat`(patterns/adts.hexpat) | ADTS/AAC audio files |
| AFE2 | | [`patterns/afe2.hexpat`](patterns/afe2.hexpat) | Nintendo Switch Atmosphère CFW Fatal Error log |
| ANI | `application/x-navi-animation` | [`patterns/ani.hexpat`](patterns/ani.hexpat) | Windows Animated Cursor file |
| AR | `application/x-archive` | [`patterns/ar.hexpat`](patterns/ar.hexpat) | Static library archive files |
| ARIA2 | | [`patterns/aria2.hexpat`](patterns/aria2.hexpat) | ARIA2 Download Manager Control files |
| ARM VTOR | | [`patterns/arm_cm_vtor.hexpat`](patterns/arm_cm_vtor.hexpat) | ARM Cortex M Vector Table Layout |
| Bastion | | [`patterns/bastion/*`](https://gitlab.com/EvelynTSMG/imhex-bastion-pats) | Various [Bastion](https://en.wikipedia.org/wiki/Bastion_(video_game)) files |
| Bencode | `application/x-bittorrent` | [`patterns/bencode.hexpat`](patterns/bencode.hexpat) | Bencode encoding, used by Torrent files |
| Prusa BGCODE | | [`patterns/bgcode.hexpat`](patterns/bgcode.hexpat) | PrusaSlicer Binary G-Code files |
| BMP | `image/bmp` | [`patterns/bmp.hexpat`](patterns/bmp.hexpat) | OS2/Windows Bitmap files |
| BIN | | [`patterns/selinux.hexpat`](patterns/selinux.pat) | SE Linux modules |
| BSON | `application/bson` | [`patterns/bson.hexpat`](patterns/bson.hexpat) | BSON (Binary JSON) format |
Expand All @@ -47,6 +49,7 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi
| CrashLvl | | [`patterns/Crashlvl.hexpat`](patterns/Crashlvl.hexpat) | Crash Bandicoot - Back in Time (fan game) User created level format |
| DDS | `image/vnd-ms.dds` | [`patterns/dds.hexpat`](patterns/dds.hexpat) | DirectDraw Surface |
| DEX | | [`patterns/dex.hexpat`](patterns/dex.hexpat) | Dalvik EXecutable Format |
| DICOM | `application/dicom` | [`patterns/dicom.hexpat`](patterns/dicom.hexpat) | DICOM image format |
| DMG | | [`patterns/dmg.hexpat`](patterns/dmg.hexpat) | Apple Disk Image Trailer (DMG) |
| DS_Store | | [`patterns/dsstore.hexpat`](patterns/dsstore.hexpat) | .DS_Store file format |
| DTA | | [`patterns/max_v104.hexpat`](patterns/max_v104.hexpat) | Mechanized Assault and Exploration v1.04 (strategy game) save file format |
Expand All @@ -62,6 +65,7 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi
| GB | `application/x-gameboy-rom` | [`patterns/gb.hexpat`](patterns/gb.hexpat) | Gameboy ROM |
| GGUF | | [`patterns/gguf.hexpat`](patterns/gguf.hexpat) | GGML Inference Models |
| GIF | `image/gif` | [`patterns/gif.hexpat`](patterns/gif.hexpat) | GIF image files |
| GLTF | `model/gltf-binary` | [`patterns/gltf.hexpat`](patterns/gltf.hexpat) | GL Transmission Format binary 3D model file |
| GZIP | `application/gzip` | [`patterns/gzip.hexpat`](patterns/gzip.hexpat) | GZip compressed data format |
| Halo Tag || [`patterns/hinf_tag.hexpat`](patterns/hinf_tag.hexpat) | Halo Infinite Tag Files |
| Halo Module || [`patterns/hinf_module.hexpat`](patterns/hinf_module.hexpat) | Halo Infinite Module Archive Files |
Expand Down Expand Up @@ -116,11 +120,13 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi
| 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 |
| TES | | [`patterns/wintec_tes.hexpat`](patterns/wintec_tes.hexpat) | Wintec TES GPS log |
| 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 |
| TTF | `font/ttf`, `font/otf` | [`patterns/ttf.hexpat`](patterns/ttf.hexpat) | TrueType and OpenType font format |
| Ubiquiti | | [`patterns/ubiquiti.hexpat`](patterns/ubiquiti.hexpat) | Ubiquiti Firmware (update) image |
| 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) |
| UF2 | | [`patterns/uf2.hexpat`](patterns/uf2.hexpat) | [USB Flashing Format](https://github.com/microsoft/uf2) |
| VBMeta | | [`patterns/vbmeta.hexpat`](patterns/vbmeta.hexpat) | Android VBMeta image |
| VDF | | [`patterns/vdf.hexpat`](patterns/vdf.hexpat) | Binary Value Data Format (.vdf) files |
Expand Down
2 changes: 1 addition & 1 deletion patterns/bplist.hexpat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma description TODO
#pragma description Apple binary property list

import std.math;
import std.core;
Expand Down
4 changes: 2 additions & 2 deletions patterns/gguf.hexpat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// https://github.com/ggerganov/ggml/blob/master/docs/gguf.md
// https://github.com/openxla/iree/blob/main/runtime/src/iree/io/formats/gguf/gguf_parser.c

#pragma description GGUF v3 File Format Patter
#pragma description GGUF v3 File Format Pattern
#pragma authors @leonjza, jessie @ imhex discord

#pragma pattern_limit 300000
Expand Down Expand Up @@ -212,4 +212,4 @@ struct gguf_file_t {
u8 tensor_data[];
};

gguf_file_t GGUF @ 0x00;
gguf_file_t GGUF @ 0x00;
6 changes: 4 additions & 2 deletions patterns/gltf.hexpat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @file <gltf.pat> ImHex Pattern for glTF binary files.
* @file <gltf.hexpat> ImHex Pattern for glTF binary files.
*
* Copyright (c) 2023 H. Utku Maden <utkumaden@hotmail.com>
*
Expand All @@ -22,7 +22,9 @@
* SOFTWARE.
*/

#pragma description TODO
#pragma author H. Utku Maden
#pragma description GL Transmission Format binary 3D model file (.glb)
#pragma MIME model/gltf-binary

import std.mem;
import std.io;
Expand Down
3 changes: 3 additions & 0 deletions patterns/pbz.hexpat
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
//
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma author Nicolás Alvarez
#pragma description Apple pbz compressed file

import std.mem;
import type.magic;

Expand Down
2 changes: 1 addition & 1 deletion patterns/pkm.hexpat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma description PKM (PacKMan) files containing ETC (Ericsson Texture Compression)
#pragma author applecuckoo
#pragma description PKM (PacKMan) files containing ETC (Ericsson Texture Compression)
#pragma endian big

enum PKMFormat : u16 {
Expand Down
4 changes: 2 additions & 2 deletions patterns/ras.hexpat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma author Fl3ch4
#pragma description TODO
#pragma MIME image/webp
#pragma description RAS image files
#pragma MIME image/x-sun-raster
#pragma endian big


Expand Down
58 changes: 57 additions & 1 deletion patterns/uf2.hexpat
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,62 @@ enum UF2_TagTypeEnum : u32 {
DeviceTypeIdentifier = 0xC8A729
};

// reference: https://microsoft.github.io/uf2/utils/uf2families.json

enum UF2_FamilyID : u32 {
ATMEGA32 = 0x16573617,
SAML21 = 0x1851780a,
NRF52 = 0x1b57745f,
ESP32 = 0x1c5f21b0,
STM32L1 = 0x1e1f432d,
STM32L0 = 0x202e3a91,
STM32WL = 0x21460ff0,
LPC55 = 0x2abc77ec,
STM32G0 = 0x300f5633,
GD32F350 = 0x31d228c6,
STM32L5 = 0x04240bdf,
STM32G4 = 0x4c71240a,
MIMXRT10XX = 0x4fb2d5bd,
STM32F7 = 0x53b80f00,
SAMD51 = 0x55114460,
STM32F4 = 0x57755a57,
FX2 = 0x5a18069b,
STM32F2 = 0x5d1a0a2e,
STM32F1 = 0x5ee21072,
NRF52833 = 0x621e937a,
STM32F0 = 0x647824b6,
SAMD21 = 0x68ed2b88,
STM32F3 = 0x6b846188,
STM32F407 = 0x6d0922fa,
STM32H7 = 0x6db66082,
STM32WB = 0x70d16653,
KL32L2 = 0x7f83e793,
STM32F407VG = 0x8fb060fe,
NRF52840 = 0xada52840,
ESP32S2 = 0xbfdd4eee,
ESP32S3 = 0xc47e5767,
ESP32C3 = 0xd42ba06c,
ESP32C2 = 0x2b88d29c,
ESP32H2 = 0x332726f6,
ESP32C6 = 0x540ddf62,
ESP32P4 = 0x3d308e94,
ESP32C5 = 0xf71c0343,
ESP32C61 = 0x77d850c4,
RP2040 = 0xe48bff56,
STM32L4 = 0x00ff6919,
GD32VF103 = 0x9af03e33,
CSK4 = 0x4f6ace52,
CSK6 = 0x6e7348a8,
M0SENSE = 0x11de784a,
MaixPlayU4 = 0x4b684d71,
RZA1LU = 0x9517422f,
STM32F411xE = 0x2dc309c5,
NRF52832xxAA = 0x72721d4e,
NRF52832xxAB = 0x6f752678,
AT32F415 = 0xa0c97b8e,
CH32V = 0x699b62ec,
};

fn formatTagType(UF2_TagType type) {
u32 value = (type.bytes[0] << 16) | (type.bytes[1] << 8) | (type.bytes[2]);

Expand Down Expand Up @@ -75,7 +131,7 @@ struct UF2_Block {
u32 numBlocks;

if (flags.FamilyIDPresent)
u32 familyId;
UF2_FamilyID familyId;
else
u32 fileSize;

Expand Down
2 changes: 1 addition & 1 deletion patterns/usb.hexpat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma description TODO
#pragma description USB Descriptor

import std.core;
import std.io;
Expand Down
2 changes: 2 additions & 0 deletions patterns/wintec_tes.hexpat
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
// Made with help from a (since deleted) GPSBabel definition
// https://github.com/GPSBabel/gpsbabel/blob/gpsbabel_1_8_0/wintec_tes.cc

#pragma description Wintec TES GPS log

#include "std/mem.pat"
#include "std/string.pat"

Expand Down
3 changes: 3 additions & 0 deletions patterns/xgspak.hexpat
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#pragma author LolHacksRule
#pragma description Exient XGS Engine Pak files

import std.mem;
import std.core;
import type.time;
Expand Down
3 changes: 3 additions & 0 deletions patterns/xgstexture.hexpat
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#pragma author LolHacksRule
#pragma description Exient XGS Engine Texture

import type.magic;
//By LolHacksRule

Expand Down
Loading