mirror of
https://github.com/WerWolv/ImHex-Patterns.git
synced 2026-03-28 07:47:02 -05:00
patterns: Added sup pattern file (#337)
* Add sup pattern file * Add files via upload * Update README.md
This commit is contained in:
@@ -137,6 +137,7 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi
|
||||
| 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 |
|
||||
| sup | | [`patterns/sup.hexpat`](patterns/sup.hexpat) | PGS Subtitle |
|
||||
| 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 |
|
||||
@@ -267,4 +268,4 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi
|
||||
|
||||
| Name | Path | Description |
|
||||
|------|------|-------------|
|
||||
| 8051 | [`disassemblers/8051.json`](disassemblers/8051.json) | Intel 8051 Architecture |
|
||||
| 8051 | [`disassemblers/8051.json`](disassemblers/8051.json) | Intel 8051 Architecture |
|
||||
|
||||
119
patterns/sup.hexpat
Normal file
119
patterns/sup.hexpat
Normal file
@@ -0,0 +1,119 @@
|
||||
#pragma description SUP Bluray Subtitle
|
||||
|
||||
#pragma magic [50 47] @ 0x00
|
||||
#pragma endian big
|
||||
|
||||
import std.mem;
|
||||
|
||||
enum SegmentType : u8{
|
||||
PaletteDefinitionSegment=0x14,
|
||||
ObjectDefinitionSegment=0x15,
|
||||
PresentationCompositionSegment=0x16,
|
||||
WindowDefinitionSegment=0x17,
|
||||
END=0x80
|
||||
};
|
||||
|
||||
|
||||
|
||||
enum CompositionState : u8 {
|
||||
Normal=0x00,
|
||||
AcquisitionPoint=0x40,
|
||||
EpochStart=0x80
|
||||
};
|
||||
enum PaletteUpdateFlag : u8 {
|
||||
False=0x00,
|
||||
True=0x80
|
||||
};
|
||||
enum ObjectCroppedFlag : u8{
|
||||
True=0x40,
|
||||
False=0x00
|
||||
};
|
||||
struct CompositionObject{
|
||||
u16 objectID;
|
||||
u8 windowID;
|
||||
ObjectCroppedFlag objectCroppedFlag;
|
||||
u16 objectHorizontalPosition;
|
||||
u16 objectVerticalPosition;
|
||||
if (objectCroppedFlag == ObjectCroppedFlag::True){
|
||||
u16 objectCroppingHorizontalPosition;
|
||||
u16 objectCroppingVerticalPosition;
|
||||
u16 objectCroppingWidth;
|
||||
u16 objectCroppingHeight;
|
||||
}
|
||||
};
|
||||
struct PresentationCompositionSegment{
|
||||
u16 width;
|
||||
u16 height;
|
||||
u8 framerate;
|
||||
u16 compositionNumber;
|
||||
CompositionState compositionState;
|
||||
PaletteUpdateFlag paletteUpdateFlag;
|
||||
u8 paletteID;
|
||||
u8 numberOfCompositionObjects;
|
||||
CompositionObject compositionObject[numberOfCompositionObjects];
|
||||
};
|
||||
|
||||
|
||||
struct WindowDefinitionSegment{
|
||||
u8 numberOfWindows;
|
||||
u8 windowID;
|
||||
u16 windowHorizontalPosition;
|
||||
u16 windowVerticalPosition;
|
||||
u16 windowWidth;
|
||||
u16 windowHeight;
|
||||
};
|
||||
|
||||
fn paletteCount(){
|
||||
u64 len = (parent.parent.header.segmentSize-7)/5+1;
|
||||
return len;
|
||||
};
|
||||
struct PaletteEntry{
|
||||
u8 paletteEntryID;
|
||||
u8 luminance;
|
||||
u8 colorDifferenceRed [[color("FF0000")]];
|
||||
u8 colorDifferenceBlue [[color("0000FF")]];
|
||||
u8 Transparency;
|
||||
};
|
||||
struct PaletteDefinitionSegment{
|
||||
u8 paletteID;
|
||||
u8 paletteVersionNumber;
|
||||
PaletteEntry paletteEntry[paletteCount()];
|
||||
};
|
||||
|
||||
|
||||
enum LastInSequenceFlag : u8{
|
||||
LastInSequence=0x40,
|
||||
FirstInSequence=0x80,
|
||||
FirstAndLastsInSequence=0xC0
|
||||
};
|
||||
struct ObjectDefinitionSegment{
|
||||
u16 objectID;
|
||||
u8 objectVersionNumber;
|
||||
LastInSequenceFlag lastInSequenceFlag;
|
||||
u24 objectDataLength;
|
||||
//u16 width;
|
||||
//u16 height;
|
||||
u8 objectData[objectDataLength];
|
||||
};
|
||||
|
||||
|
||||
struct PGSHeader{
|
||||
char magicNumber[2];
|
||||
u32 presentationTimeStamp;
|
||||
u32 decodingTimeStamp;
|
||||
SegmentType segmentType;
|
||||
u16 segmentSize;
|
||||
};
|
||||
|
||||
struct PGSSegment{
|
||||
PGSHeader header;
|
||||
match(header.segmentType){
|
||||
(0x14): PaletteDefinitionSegment paletteDefinitionSegment;
|
||||
(0x15): ObjectDefinitionSegment objectDefinitionSegment;
|
||||
(0x16): PresentationCompositionSegment presentationCompositionSegment;
|
||||
(0x17): WindowDefinitionSegment windowDefinitionSegment;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
PGSSegment pgsSegment[while(!std::mem::eof())] @ 0;
|
||||
BIN
tests/patterns/test_data/sup.hexpat.sup
Normal file
BIN
tests/patterns/test_data/sup.hexpat.sup
Normal file
Binary file not shown.
Reference in New Issue
Block a user