mirror of
https://github.com/WerWolv/ImHex-Patterns.git
synced 2026-03-28 07:47:02 -05:00
* 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
34 lines
602 B
Rust
34 lines
602 B
Rust
#pragma author WerWolv
|
|
#pragma description OGG Audio
|
|
|
|
#pragma MIME audio/ogg
|
|
|
|
import std.core;
|
|
import std.mem;
|
|
import type.magic;
|
|
|
|
bitfield HeaderType {
|
|
Continuation : 1;
|
|
BeginOfStream : 1;
|
|
EndOfStream : 1;
|
|
};
|
|
|
|
struct SegmentData {
|
|
u8 data[parent.segmentTable[std::core::array_index()]];
|
|
};
|
|
|
|
struct Ogg {
|
|
type::Magic<"OggS"> capturePattern;
|
|
u8 version;
|
|
HeaderType headerType;
|
|
u64 granulePosition;
|
|
u32 bitstreamSerialNumber;
|
|
u32 pageSequenceNumber;
|
|
u32 checksum;
|
|
u8 pageSegments;
|
|
u8 segmentTable[pageSegments];
|
|
SegmentData data[pageSegments];
|
|
};
|
|
|
|
Ogg ogg[while(!std::mem::eof())] @ 0x00;
|