patterns/includes: More misc cleanups (#353)

* patterns/zip: simplify find_sequence_in_range check

hex(340282366920938463463374607431768211455) =
0xffffffffffffffffffffffffffffffff

* patterns/7z: use Magic<> for signature, add pragma

* patterns/{nro, ogg}: use Magic<> for signature

* patterns/ttf: refactor, check magic

Use the "Field field @ position;" syntax instead of saving and restoring
the cursor position.

* readme: fix copy-paste error in pattern listing
This commit is contained in:
Mrmaxmeier
2025-03-22 13:46:06 +01:00
committed by GitHub
parent 3ad263783d
commit df97fc7257
6 changed files with 21 additions and 45 deletions

View File

@@ -4,6 +4,7 @@
import std.io;
import std.sys;
import type.magic;
struct MOD0 {
char magic[4];
@@ -27,7 +28,7 @@ struct SegmentHeader {
};
struct Header {
char magic[4];
type::Magic<"NRO0"> magic;
u32 version;
u32 file_size;
u32 flags;
@@ -67,7 +68,6 @@ fn is_homebrew() {
Start start @ 0x00;
Header header @ $;
std::assert(header.magic == "NRO0", "Invalid NRO File!");
AssetHeader assets @ header.file_size;