Skip to content

Commit 1f6c701

Browse files
patterns: Added sup pattern file (WerWolv#337)
* Add sup pattern file * Add files via upload * Update README.md
1 parent 4092dad commit 1f6c701

File tree

3 files changed

+121
-1
lines changed

3 files changed

+121
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ Everything will immediately show up in ImHex's Content Store and gets bundled wi
137137
| Shell Link | `application/x-ms-shortcut` | [`patterns/lnk.hexpat`](patterns/lnk.hexpat) | Windows Shell Link file format |
138138
| shp | | [`patterns/shp.hexpat`](patterns/shp.hexpat) | ESRI shape file |
139139
| shx | | [`patterns/shx.hexpat`](patterns/shx.hexpat) | ESRI index file |
140+
| sup | | [`patterns/sup.hexpat`](patterns/sup.hexpat) | PGS Subtitle |
140141
| SPIRV | | [`patterns/spirv.hexpat`](patterns/spirv.hexpat) | SPIR-V header and instructions |
141142
| STL | `model/stl` | [`patterns/stl.hexpat`](patterns/stl.hexpat) | STL 3D Model format |
142143
| 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
267268

268269
| Name | Path | Description |
269270
|------|------|-------------|
270-
| 8051 | [`disassemblers/8051.json`](disassemblers/8051.json) | Intel 8051 Architecture |
271+
| 8051 | [`disassemblers/8051.json`](disassemblers/8051.json) | Intel 8051 Architecture |

patterns/sup.hexpat

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
#pragma description SUP Bluray Subtitle
2+
3+
#pragma magic [50 47] @ 0x00
4+
#pragma endian big
5+
6+
import std.mem;
7+
8+
enum SegmentType : u8{
9+
PaletteDefinitionSegment=0x14,
10+
ObjectDefinitionSegment=0x15,
11+
PresentationCompositionSegment=0x16,
12+
WindowDefinitionSegment=0x17,
13+
END=0x80
14+
};
15+
16+
17+
18+
enum CompositionState : u8 {
19+
Normal=0x00,
20+
AcquisitionPoint=0x40,
21+
EpochStart=0x80
22+
};
23+
enum PaletteUpdateFlag : u8 {
24+
False=0x00,
25+
True=0x80
26+
};
27+
enum ObjectCroppedFlag : u8{
28+
True=0x40,
29+
False=0x00
30+
};
31+
struct CompositionObject{
32+
u16 objectID;
33+
u8 windowID;
34+
ObjectCroppedFlag objectCroppedFlag;
35+
u16 objectHorizontalPosition;
36+
u16 objectVerticalPosition;
37+
if (objectCroppedFlag == ObjectCroppedFlag::True){
38+
u16 objectCroppingHorizontalPosition;
39+
u16 objectCroppingVerticalPosition;
40+
u16 objectCroppingWidth;
41+
u16 objectCroppingHeight;
42+
}
43+
};
44+
struct PresentationCompositionSegment{
45+
u16 width;
46+
u16 height;
47+
u8 framerate;
48+
u16 compositionNumber;
49+
CompositionState compositionState;
50+
PaletteUpdateFlag paletteUpdateFlag;
51+
u8 paletteID;
52+
u8 numberOfCompositionObjects;
53+
CompositionObject compositionObject[numberOfCompositionObjects];
54+
};
55+
56+
57+
struct WindowDefinitionSegment{
58+
u8 numberOfWindows;
59+
u8 windowID;
60+
u16 windowHorizontalPosition;
61+
u16 windowVerticalPosition;
62+
u16 windowWidth;
63+
u16 windowHeight;
64+
};
65+
66+
fn paletteCount(){
67+
u64 len = (parent.parent.header.segmentSize-7)/5+1;
68+
return len;
69+
};
70+
struct PaletteEntry{
71+
u8 paletteEntryID;
72+
u8 luminance;
73+
u8 colorDifferenceRed [[color("FF0000")]];
74+
u8 colorDifferenceBlue [[color("0000FF")]];
75+
u8 Transparency;
76+
};
77+
struct PaletteDefinitionSegment{
78+
u8 paletteID;
79+
u8 paletteVersionNumber;
80+
PaletteEntry paletteEntry[paletteCount()];
81+
};
82+
83+
84+
enum LastInSequenceFlag : u8{
85+
LastInSequence=0x40,
86+
FirstInSequence=0x80,
87+
FirstAndLastsInSequence=0xC0
88+
};
89+
struct ObjectDefinitionSegment{
90+
u16 objectID;
91+
u8 objectVersionNumber;
92+
LastInSequenceFlag lastInSequenceFlag;
93+
u24 objectDataLength;
94+
//u16 width;
95+
//u16 height;
96+
u8 objectData[objectDataLength];
97+
};
98+
99+
100+
struct PGSHeader{
101+
char magicNumber[2];
102+
u32 presentationTimeStamp;
103+
u32 decodingTimeStamp;
104+
SegmentType segmentType;
105+
u16 segmentSize;
106+
};
107+
108+
struct PGSSegment{
109+
PGSHeader header;
110+
match(header.segmentType){
111+
(0x14): PaletteDefinitionSegment paletteDefinitionSegment;
112+
(0x15): ObjectDefinitionSegment objectDefinitionSegment;
113+
(0x16): PresentationCompositionSegment presentationCompositionSegment;
114+
(0x17): WindowDefinitionSegment windowDefinitionSegment;
115+
}
116+
};
117+
118+
119+
PGSSegment pgsSegment[while(!std::mem::eof())] @ 0;
147 KB
Binary file not shown.

0 commit comments

Comments
 (0)