Created
November 18, 2022 17:46
-
-
Save belaw/01f22c91a7c073004096f34291943f6f to your computer and use it in GitHub Desktop.
DATPARTOUT 010 Editor Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//-------------------------------------- | |
//--- 010 Editor v6.0.1 Binary Template | |
// | |
// File: DATPARTOUTTemplate.bt | |
// Author: Jonas Witting <jonaswitting@gmail.com> | |
// Purpose: Pinball | |
// Date: 06/2015 | |
//-------------------------------------- | |
enum <UBYTE> TYPE { | |
RESOURCE_IDENTIFIER = 0, | |
IMAGE = 1, | |
TEXT = 3, | |
PALETTE = 5, | |
TEXT2 = 9, | |
INT_TABLE = 10, | |
FLOAT_TABLE = 11, | |
Z_BUFFER_DATA = 12 | |
}; | |
typedef struct { | |
CHAR signature[21]; | |
CHAR appName[50]; | |
CHAR description[100]; | |
UINT dataLength; | |
UINT16 nGroups; | |
UINT16 unk1; | |
UINT unk2; | |
} DATPARTOUTHEADER; | |
typedef struct { | |
SetBackColor(cLtGreen); | |
UINT16 identifier; | |
} ENTRY_RESOURCE_IDENTIFIER <read=readENTRY_RESOURCE_IDENTIFIER>; | |
string readENTRY_RESOURCE_IDENTIFIER(local ENTRY_RESOURCE_IDENTIFIER &t) { | |
string s; | |
SPrintf(s, "%d", t.identifier); | |
return s; | |
} | |
typedef struct { | |
SetBackColor(cLtBlue); | |
UINT16 distance; | |
SetBackColor(cLtGray); | |
UBYTE color; | |
} ALPHA_IMAGE_PIXEL <read=readALPHA_IMAGE_PIXEL>; | |
string readALPHA_IMAGE_PIXEL(local ALPHA_IMAGE_PIXEL &b) { | |
string s; | |
SPrintf(s, "%d %d", b.distance, b.color); | |
return s; | |
} | |
typedef struct { | |
UINT16 offset; | |
UINT16 rowLength; | |
ALPHA_IMAGE_PIXEL pixels[rowLength]; | |
} ALPHA_IMAGE_ROW <read=readALPHA_IMAGE_ROW,optimize=false>; | |
string readALPHA_IMAGE_ROW(local ALPHA_IMAGE_ROW &l) { | |
string s; | |
SPrintf(s, "%d", l.offset); | |
return s; | |
} | |
typedef struct { | |
SetBackColor(cLtBlue); | |
UINT dataLength; | |
SetBackColor(cNone); | |
UBYTE tableSize; | |
SetBackColor(cLtRed); | |
UINT16 width; | |
UINT16 height; | |
SetBackColor(cNone); | |
UINT16 xPos; | |
UINT16 yPos; | |
UINT imageSize; | |
UBYTE imageType; | |
local int padding =-( ( ( (int)height * (int)width ) - (int)imageSize ) / (int)(height) ); | |
SetBackColor(cGray); | |
if((int)imageType == 5){ | |
struct { | |
while (ReadUShort() != 0xFFFF) { | |
ALPHA_IMAGE_ROW row; | |
} | |
} IMAGE; | |
UINT16 terminator; | |
} else { | |
struct { | |
struct { | |
UBYTE pixels[width]; | |
if(padding>0){ | |
SetBackColor(cLtGray); | |
UBYTE padBytes[padding]; | |
} | |
} IMGROW[height] <optimize=false>; | |
} IMAGE; | |
} | |
} ENTRY_IMAGE <read=readENTRY_IMAGE>; | |
string readENTRY_IMAGE(local ENTRY_IMAGE &e) { | |
string s; | |
SPrintf(s, "%d x %d", e.width, e.height); | |
return s; | |
} | |
typedef struct { | |
SetBackColor(cLtBlue); | |
UINT dataLength; | |
SetBackColor(cLtRed); | |
CHAR text[dataLength]; | |
} ENTRY_TEXT <read=readENTRY_TEXT>; | |
string readENTRY_TEXT(local ENTRY_TEXT &e) { | |
return e.text; | |
} | |
typedef struct { | |
SetBackColor(cLtBlue); | |
UINT dataLength; | |
SetBackColor(cNone); | |
struct { | |
struct { | |
SetBackColor(cLtRed); | |
UBYTE red; | |
SetBackColor(cLtGreen); | |
UBYTE green; | |
SetBackColor(cLtBlue); | |
UBYTE blue; | |
SetBackColor(cNone); | |
UBYTE unk6; | |
} COLOR[(int)dataLength/4]; | |
} COLORS; | |
} ENTRY_PALETTE; | |
typedef struct { | |
SetBackColor(cLtBlue); | |
UINT dataLength; | |
SetBackColor(cLtGreen); | |
SHORT table[dataLength/2]; | |
} ENTRY_INT_TABLE; | |
string readENTRY_INT_TABLE(local ENTRY_INT_TABLE &e) { | |
string s = ""; | |
int i = 0; | |
for(i = 0; i < e.dataLength / 2; i++) { | |
SPrintf(s, "%s%d", s, e.table[i]); | |
if(i != (e.dataLength / 2) - 1) | |
s = s + ", "; | |
} | |
return s; | |
} | |
typedef struct { | |
SetBackColor(cLtBlue); | |
UINT dataLength; | |
SetBackColor(cLtGreen); | |
FLOAT data[dataLength/sizeof(FLOAT)]; | |
} ENTRY_FLOAT_TABLE; | |
string readENTRY_FLOAT_TABLE(local ENTRY_FLOAT_TABLE &e) { | |
string s = ""; | |
int i = 0; | |
for(i = 0; i < e.dataLength/sizeof(FLOAT); i++) { | |
SPrintf(s, "%s%g", s, e.data[i]); | |
if(i != (e.dataLength/sizeof(FLOAT)) - 1) | |
s = s + ", "; | |
} | |
return s; | |
} | |
typedef struct { | |
SetBackColor(cLtBlue); | |
UINT dataLength; | |
SetBackColor(cNone); | |
UBYTE tableSize; | |
SetBackColor(cLtRed); | |
UINT16 width; | |
UINT16 height; | |
SetBackColor(cNone); | |
UINT16 fullWidth; | |
UINT unk3; | |
UINT16 unk4; | |
UINT16 unk5; | |
SetBackColor(cLtGreen); | |
struct { | |
UINT16 distances[fullWidth]; | |
} rows[height]; | |
} ENTRY_Z_BUFFER_DATA; | |
typedef struct { | |
SetBackColor(cLtBlue); | |
UINT dataLength; | |
SetBackColor(cLtGreen); | |
UBYTE data[dataLength] <optimize=false>; | |
} ENTRY_GENERIC; | |
typedef struct { | |
SetBackColor(cPurple); | |
TYPE type; | |
switch(type){ | |
case RESOURCE_IDENTIFIER: | |
ENTRY_RESOURCE_IDENTIFIER resource_identifier; | |
break; | |
case IMAGE: | |
ENTRY_IMAGE image; | |
break; | |
case PALETTE: | |
ENTRY_PALETTE palette; | |
break; | |
case TEXT: | |
case TEXT2: | |
ENTRY_TEXT text; | |
break; | |
case INT_TABLE: | |
ENTRY_INT_TABLE int_table; | |
break; | |
case FLOAT_TABLE: | |
ENTRY_FLOAT_TABLE float_table; | |
break; | |
case Z_BUFFER_DATA: | |
ENTRY_Z_BUFFER_DATA z_buffer_data; | |
break; | |
default: | |
ENTRY_GENERIC generic; | |
break; | |
} | |
} ENTRY <read=readENTRY>; | |
string readENTRY(local ENTRY &e) { | |
string s; | |
SPrintf(s, "%s", EnumToString(e.type)); | |
switch(e.type){ | |
case RESOURCE_IDENTIFIER: | |
s = s + " " + readENTRY_RESOURCE_IDENTIFIER(e.resource_identifier); | |
break; | |
case IMAGE: | |
s = s + " " + readENTRY_IMAGE(e.image); | |
break; | |
case PALETTE: | |
break; | |
case TEXT: | |
case TEXT2: | |
s = s + " " + readENTRY_TEXT(e.text); | |
break; | |
case INT_TABLE: | |
s = s + " " + readENTRY_INT_TABLE(e.int_table); | |
break; | |
case FLOAT_TABLE: | |
s = s + " " + readENTRY_FLOAT_TABLE(e.float_table); | |
break; | |
case Z_BUFFER_DATA: | |
break; | |
default: | |
break; | |
} | |
return s; | |
} | |
typedef struct { | |
UBYTE nEntries; | |
ENTRY entries[nEntries] <optimize=false>; | |
} GROUP <read=readGROUP>; | |
string readGROUP(local GROUP &g) { | |
string s; | |
SPrintf(s, "Entries: %d ", g.nEntries); | |
int i; | |
for (i = 0; i < g.nEntries; i++) { | |
SPrintf(s, "%s%s", s, readENTRY(g.entries[i])); | |
if(i != g.nEntries - 1) | |
s = s + ", "; | |
} | |
return s; | |
} | |
DATPARTOUTHEADER header; | |
GROUP groups[header.nGroups] <optimize=false>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment