home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Spezial
/
SPEZIAL2_97.zip
/
SPEZIAL2_97.iso
/
ANWEND
/
EDITOR
/
BE
/
BE.INI
< prev
next >
Wrap
Text File
|
1997-04-19
|
28KB
|
1,061 lines
//
// Binary Editor configuration file
//
// This default initialisation file has definitions to aid in the decoding
// and display of bitmap headers, palettes and data of various formats.
// This file may be extended to allow decoding of other file formats too.
// It is admitted that the field names used to describe the various fields
// may or may not match up that given in the official documentation.
//
// Some handy things to have around
map bool { "TRUE" 1 "FALSE" 0 }
def BYTE { n8 hex "byte" } def BYTES { 2048 n8 hex "bytes" }
def WORD { n16 hex "word" } def WORDS { 2048 n16 hex "words" }
def DWORD { n32 hex "dword" } def DWORDS { 2048 n32 hex "dwords" }
def DBLINE union { 8 n8 hex "bytes" buf 8 asc "chars" }
def DWLINE union { 4 n16 hex "words" buf 8 asc "chars" }
def DDLINE union { 4 n32 hex "dwords" buf 16 asc "chars " }
def DB { 4096 DBLINE open open open "lines" }
def DW { 4096 DWLINE open open open "lines" }
def DD { 4096 DDLINE open open open "lines" }
unsigned dec
//
// OS/2 and Windows Bitmap File Format
// Decode the headers and palettes, but not the bitmap bits
//
le
map BFT_ // bitmap file type
{
"BFT_ICON" 0x4349 // 'IC'
"BFT_BMAP" 0x4d42 // 'BM'
"BFT_POINTER" 0x5450 // 'PT'
"BFT_COLORICON" 0x4943 // 'CI'
"BFT_COLORPOINTER" 0x5043 // 'CP'
"BFT_BITMAPARRAY" 0x4142 // 'BA'
}
map BCA_ // ulCompression
{
"BCA_UNCOMP" 0
"BCA_RLE8" 1
"BCA_RLE4" 2
"BCA_HUFFMAN1D" 3
"BCA_RLE24" 4
}
map BRU_ // units
{
"BRU_METRIC" 0
}
map BRA_ // algorithm
{
"BRA_BOTTOMUP" 0
}
map BRH_ // halftoning alg
{
"BRH_NOTHALFTONED" 0
"BRH_ERRORDIFFUSION" 1
"BRH_PANDA" 2
"BRH_SUPERCIRCLE" 3
}
def RGB
{
n8 hex "bBlue "
n8 hex "bGreen"
n8 hex "bRed "
}
def RGB2
{
n8 hex "bBlue "
n8 hex "bGreen "
n8 hex "bRed "
n8 hex "fcOptions"
}
def BMP_PALETTE_11
{
0x100 RGB "argbColor"
}
def BMP_INFO_HEADER_11
{
n32 ptr BMP_PALETTE_11 "cbFix "
n16 "cx "
n16 "cy "
n16 "cPlanes "
n16 "cBitCount"
}
def BMP_PALETTE_20
{
0x100 RGB2 "argbColor"
}
def BMP_INFO_HEADER_20
{
n32 ptr BMP_PALETTE_20 rel "cbFix "
n32 "cx "
n32 "cy "
n16 "cPlanes "
n16 "cBitCount "
n32 map BCA_ "ulCompression "
n32 "cbImage "
n32 "cxResolution "
n32 "cyResolution "
n32 "cclrUsed "
n32 "cclrImportant "
n16 map BRU_ "usUnits "
n16 "usReserved "
n16 map BRA_ "usRecording "
n16 map BRH_ "usRendering "
n32 "cSize1 "
n32 "cSize2 "
n32 "ulColorEncoding"
n32 hex "ulIdentifier "
}
def BMP_INFO_HEADER
{
n32 "cbFix "
at 0 BMP_INFO_HEADER_11 "if cbFix==12"
at 0 BMP_INFO_HEADER_20 "if cbFix>12 "
}
def BMP_FILE_HEADER
{
n16 map BFT_ "usType "
n32 "cbSize "
n16 signed "xHotspot"
n16 signed "yHotspot"
n32 hex "offBits "
BMP_INFO_HEADER "bmp "
}
def BMP_ARRAY_FILE_HEADER
{
n16 map BFT_ "usType "
n32 "cbSize "
n32 hex ptr BMP_ARRAY_FILE_HEADER "offNext "
n16 "cxDisplay"
n16 "cyDisplay"
BMP_FILE_HEADER "bfh "
}
def BMP_FILE
{
n16 map BFT_ "usType "
at 0 BMP_FILE_HEADER "if usType==BFT_BMAP "
at 0 BMP_ARRAY_FILE_HEADER "if usType==BFT_BITMAPARRAY"
}
//
// Targa files
// Just decode the header
//
le
map TGA_
{
"TGA_NO_IMAGE" 0
"TGA_UNCOMP_CM" 1
"TGA_UNCOMP_RGB" 2
"TGA_UNCOMP_BW" 3
"TGA_RL_CM" 9
"TGA_RL_RGB" 10
"TGA_RL_BW" 11
"TGA_COMP_CM" 32
"TGA_COMP_CM_4" 33
}
map IDB_
{
"IDB_ORIGIN" 0x20 : 0x20
"IDB_NON_INT" 0x00 : 0xc0
"IDB_2_WAY" 0x40 : 0xc0
"IDB_4_WAY" 0x80 : 0xc0
}
def TGA_HEADER
{
n8 "n_chars_in_id "
n8 "color_map_present "
n8 map TGA_ "image_type "
n16 "color_map_start "
n16 "color_map_length "
n8 "color_map_entry_bits"
n16 "x_origin "
n16 "y_origin "
n16 "width "
n16 "height "
n8 "bpp "
n8 map IDB_ "image_descriptor "
}
def TGA_FILE
{
n8 ptr TGA_HEADER null "n_chars_in_id"
buf 255 asc "id "
}
//
// KIPS files
// Just decode the header
//
def KPS_FILE
{
buf 8 asc "signiture (=DFIMAG00)"
n16 "height "
n16 "width "
buf 20 hex "unknown "
}
//
// PCX file
// Decode header with small inline 4bpp palette
// Don't decode compressed bitmap bits or trailer with 8bpp palette
//
map PCXENC_
{
"PCXENC_RLE" 1
}
def PCX_RGB
{
n8 hex "red "
n8 hex "green"
n8 hex "blue "
}
def PCX_FILE
{
n8 hex "magic# (=0x0a) "
n8 "version (=0,1,2,3,5)"
n8 map PCXENC_ "compression "
n8 "bpppp "
n16 "x1 "
n16 "y1 "
n16 "x2 "
n16 "y2 "
at 16
16 PCX_RGB "4bpp palette "
at 65
n8 "planes "
n16 "bytes_per_line "
n8 "colour/bw "
at 0
8 buf 16 hex "header as hex "
}
//
// M-Motion VID file
//
le
def VID_FILE
{
buf 6 asc "signiture (=YUV12C)"
buf 2 hex "padding "
n16 "xpos "
n16 "ypos "
n16 "xsize "
n16 "ysize "
}
//
// TIFF file
// Decode the file as little or big endian TIFF, depending upon the
// BE_TIFF pre-processor symbol
//
$ifdef BE_TIFF
be
$else
le
$endif
map TIFF_T
{
"T_NEWSUBFILETYPE" 254
"T_SUBFILETYPE" 255
"T_IMAGEWIDTH" 256
"T_IMAGELENGTH" 257
"T_BITSPERSAMPLE" 258
"T_COMPRESSION" 259
"T_PHOTOMETRIC" 262
"T_THRESHOLDING" 263
"T_CELLWIDTH" 264
"T_CELLLENGTH" 265
"T_FILLORDER" 266
"T_DOCNAME" 269
"T_DESCRIPTION" 270
"T_MAKE" 271
"T_MODEL" 272
"T_STRIPOFFSETS" 273
"T_ORIENTATION" 274
"T_SAMPLESPERPIXEL" 277
"T_ROWSPERSTRIP" 278
"T_STRIPBYTECOUNTS" 279
"T_MINSAMPLEVALUE" 280
"T_MAXSAMPLEVALUE" 281
"T_XRESOLUTION" 282
"T_YRESOLUTION" 283
"T_PLANARCONFIG" 284
"T_PAGENAME" 285
"T_XPOSITION" 286
"T_YPOSITION" 287
"T_FREEOFFSETS" 288
"T_FREEBYTECOUNTS" 289
"T_GRAYRESPONSEUNIT" 290
"T_GRAYRESPONSECURVE" 291
"T_GROUP3OPTIONS" 292
"T_GROUP4OPTIONS" 293
"T_RESOLUTIONUNIT" 296
"T_PAGENUMBER" 297
"T_COLORRESPONSECURVES" 301
"T_SOFTWARE" 305
"T_DATETIME" 306
"T_ARTIST" 315
"T_HOSTCOMPUTER" 316
"T_PREDICTOR" 317
"T_WHITEPOINT" 318
"T_PRIMARYCHROMA" 319
"T_COLORMAP" 320
"T_HALFTONEHINTS" 321
"T_TILEWIDTH" 322
"T_TILELENGTH" 323
"T_TILEOFFSETS" 324
"T_TILEBYTECOUNTS" 325
"T_INKSET" 332
"T_INKNAMES" 333
"T_NUMBEROFINKS" 334
"T_DOTRANGE" 336
"T_TARGETPRINTER" 337
"T_EXTRASAMPLES" 338
"T_SAMPLEFORMAT" 339
"T_SMINSAMPLEVALUE" 340
"T_SMAXSAMPLEVALUE" 341
"T_TRANSFERRANGE" 342
"T_JPEGPROC" 512
"T_JPEGINTERCHANGEFMT" 513
"T_JPEGINTERCHANGEFMTLEN" 514
"T_JPEGRESTARTINTERVAL" 515
"T_JPEGLOSSLESSPRED" 517
"T_JPEGPOINTTRANSFORMS" 518
"T_JPEGOTABLES" 519
"T_JPEGDCTABLES" 520
"T_JPEGACTABLES" 521
"T_COEFFICIENTS" 529
"T_SUBSAMPLING" 530
"T_REFERENCEBLACKWHITE" 532
}
map TIFF_D
{
"D_BYTE" 1
"D_ASCII" 2
"D_SHORT" 3
"D_LONG" 4
"D_RATIONAL" 5
"D_SBYTE" 6
"D_UNDEFINED" 7
"D_SSHORT" 8
"D_SLONG" 9
"D_SRATIONAL" 10
"D_FLOAT" 11
"D_DOUBLE" 12
}
def TIFF_RATIONAL
{
n32 unsigned "numerator "
n32 unsigned "denominator"
}
def TIFF_SRATIONAL
{
n32 signed "numerator "
n32 signed "denominator"
}
def TIFF_TAG_NI union
{
buf 100 asc "data (if D_ASCII) "
100 n8 unsigned open "data (if D_BYTE) "
100 n8 signed open "data (if D_SBYTE) "
100 n16 unsigned open "data (if D_SHORT) "
100 n16 signed open "data (if D_SSHORT) "
100 n32 unsigned open "data (if D_LONG) "
100 n32 signed open "data (if D_SLONG) "
100 TIFF_RATIONAL open open "data (if D_RATIONAL) "
100 TIFF_SRATIONAL open open "data (if D_SRATIONAL)"
100 buf 4 hex open "data (if D_FLOAT) "
100 buf 8 hex open "data (if D_DOUBLE) "
16 buf 16 hex "data "
}
def TIFF_TAG
{
n16 map TIFF_T "type "
n16 map TIFF_D "data_type "
n32 dec "length "
union
{
buf 4 asc suppress "data (if D_ASCII) "
4 n8 unsigned open suppress "data (if D_BYTE "
4 n8 signed open suppress "data (if D_SBYTE) "
2 n16 unsigned open suppress "data (if D_SHORT) "
2 n16 signed open suppress "data (if D_SSHORT) "
n32 unsigned suppress "data (if D_LONG) "
n32 signed suppress "data (if D_SLONG) "
buf 4 hex suppress "data (if D_FLOAT) "
n32 hex ptr TIFF_TAG_NI suppress "data (if non-inline)"
}
}
def TIFF_NEXT_IFD
{
n32 ptr TIFF_IFD "offset_ifd"
at 12
}
def TIFF_IFD
{
n16 ptr TIFF_NEXT_IFD mul add 2 rel "n_tags"
100 TIFF_TAG "tags "
}
def TIFF_FILE
{
buf 2 asc "byte_order (=II,MM) "
n16 dec "version_number (=42)"
n32 ptr TIFF_IFD "offset_ifd "
}
//
// ILBM files
// Decode chunk structure
//
be
map ILBM_COMP_TYPE
{
"none" 0
"rle" 1
}
map ILBM_MASKING
{
"none" 0
"mask" 1
"transparent" 2
}
def ILBM_BMHD_DATA
{
n16 "width "
n16 "height "
n16 "xpos "
n16 "ypos "
n8 "bitsperpixel"
n8 map ILBM_MASKING "masking "
n8 map ILBM_COMP_TYPE "compression "
n8 hex "unused "
n16 "transcol "
n8 "xaspect "
n8 "yaspect "
n16 "xscreen "
n16 "yscreen "
}
map ILBM_CAMG_VALUE
{
"lace" 0x00000004 : 0x00000004
"ehb" 0x00000080 : 0x00000080
"ham" 0x00000800 : 0x00000800
"hires" 0x00008000 : 0x00008000
}
def ILBM_RGB
{
n8 hex "red "
n8 hex "green"
n8 hex "blue "
}
def ILBM_SHAM_PAL
{
16 ILBM_RGB "0rgb's"
}
def ILBM_SHAM_DATA
{
n16 "sham version (=0)"
200 ILBM_SHAM_PAL "sham palettes "
}
// note that chunk next pointer may require size rounding up by one
// note size decoded first for ease of navigation
def ILBM_CHUNK
{
buf 4 asc "name "
n32 ptr ILBM_CHUNK add 4 rel align 2 "size "
union
{
ILBM_BMHD_DATA suppress "data (if BMHD) "
n32 map ILBM_CAMG_VALUE suppress "data (if CAMG) "
0x100 ILBM_RGB suppress "data (if CMAP) "
ILBM_SHAM_DATA suppress "data (if SHAM) "
buf 100 hex suppress "data (otherwise)"
}
}
def ILBM_FILE
{
buf 4 asc "form "
n32 "length "
buf 4 asc "ilbm "
ILBM_CHUNK "first chunk"
}
//
// GIF file
// Decode headers and block structures
//
le
map GIF_GCT_BPP
{
"gct" 0x80 : 0x80
"no_gct" 0x00 : 0x80
}
def GIF_RGB
{
n8 hex "red "
n8 hex "green"
n8 hex "blue "
}
def GIF_CHUNK
{
n8 ptr GIF_CHUNK add 1 rel "size "
16 buf 16 hex "data "
at 0 n8 ptr GIF_BLOCK add 1 rel null "follow if size is 0"
}
def GIF_EXTENSION
{
n8 hex "introducer (=0x21) "
n8 hex "graphic control label"
GIF_CHUNK "first chunk "
}
map GIF_LCT_BPP
{
"lct" 0x80 : 0x80
"no_lct" 0x00 : 0x80
"ilace" 0x40 : 0x40
"no_ilace" 0x00 : 0x40
// "sortedpalette" 0x?? : 0x??
}
def GIF_IMAGE_DESC
{
n8 hex "introducer (=0x2c) "
n16 "xpos "
n16 "ypos "
n16 "width "
n16 "height "
n8 map GIF_LCT_BPP "lct bpp-1 "
n8 "min_LZW_code_size-1 "
at 11 GIF_CHUNK "1st chunk if (no lct)"
at 11+ 2*sizeof GIF_RGB GIF_CHUNK "1st chunk if (1bpp lct)"
at 11+ 4*sizeof GIF_RGB GIF_CHUNK "1st chunk if (2bpp lct)"
at 11+ 8*sizeof GIF_RGB GIF_CHUNK "1st chunk if (3bpp lct)"
at 11+ 16*sizeof GIF_RGB GIF_CHUNK "1st chunk if (4bpp lct)"
at 11+ 32*sizeof GIF_RGB GIF_CHUNK "1st chunk if (5bpp lct)"
at 11+ 64*sizeof GIF_RGB GIF_CHUNK "1st chunk if (6bpp lct)"
at 11+128*sizeof GIF_RGB GIF_CHUNK "1st chunk if (7bpp lct)"
at 11+256*sizeof GIF_RGB GIF_CHUNK "1st chunk if (8bpp lct)"
}
def GIF_TERM
{
n8 hex "introducer (=0x3b)"
}
def GIF_BLOCK
{
n8 hex "introducer"
at 0 GIF_EXTENSION "if 0x21 "
at 0 GIF_IMAGE_DESC "if 0x2c "
at 0 GIF_TERM "if 0x3b "
}
// signature and screen descriptor
def GIF_FILE
{
buf 6 asc "signiture (GIFxxx) "
n16 "xscreen "
n16 "yscreen "
n8 map GIF_GCT_BPP "gct bpp-1 "
n8 "bg index "
n8 hex "? "
0x100 GIF_RGB "gct (if got one) "
at 13 GIF_BLOCK "1st block if (no gct)"
at 13+ 2*sizeof GIF_RGB GIF_BLOCK "1st block if (1bpp gct)"
at 13+ 4*sizeof GIF_RGB GIF_BLOCK "1st block if (2bpp gct)"
at 13+ 8*sizeof GIF_RGB GIF_BLOCK "1st block if (3bpp gct)"
at 13+ 16*sizeof GIF_RGB GIF_BLOCK "1st block if (4bpp gct)"
at 13+ 32*sizeof GIF_RGB GIF_BLOCK "1st block if (5bpp gct)"
at 13+ 64*sizeof GIF_RGB GIF_BLOCK "1st block if (6bpp gct)"
at 13+128*sizeof GIF_RGB GIF_BLOCK "1st block if (7bpp gct)"
at 13+256*sizeof GIF_RGB GIF_BLOCK "1st block if (8bpp gct)"
}
//
// RiscOS Sprites
// Display headers and data (rather crudely)
//
le
map SPRITE_MODE
{
"640x256x1bpp" 0
"320x256x2bpp" 1
"160x256x4bpp" 2
"Text only" 3
"320x256x1bpp" 4
"160x256x2bpp" 5
"160x256x2bpp" 6
"Teletext" 7
"640x256x2bpp" 8
"320x256x4bpp" 9
"160x256x8bpp" 10
"640x250x2bpp" 11
"640x256x4bpp" 12
"320x256x8bpp" 13
"640x250x4bpp" 14
"640x256x8bpp" 15
"1056x250x4bpp" 16
"1056x256x4bpp" 17
"640x512x1bpp multisync-monitor" 18
"640x512x2bpp multisync-monitor" 19
"640x512x4bpp multisync-monitor" 20
"640x512x8bpp multisync-monitor" 21
"1152x896x1bpp 61.2Hz-hires-monitor" 23
"1056x256x8bpp" 24
"640x480x1bpp multisync-or-60Hz-VGA-monitor" 25
"640x480x2bpp multisync-or-60Hz-VGA-monitor" 26
"640x480x4bpp multisync-or-60Hz-VGA-monitor" 27
"640x480x8bpp multisync-or-60Hz-VGA-monitor" 28
}
// 2 RGB values match if not flashing
def SPRITE_PAL
{
n8 hex "? "
n8 hex "red "
n8 hex "green"
n8 hex "blue "
n8 hex "? "
n8 hex "red "
n8 hex "green"
n8 hex "blue "
}
// List the first few bytes of data
// Give it laid out at several widths
// Remember, nibbles can be swapped
def SPRITE_DATA
{
at 0 50 buf 4 hex "data (1 dword per line)"
at 0 50 buf 8 hex "data (2 dwords per line)"
at 0 50 buf 12 hex "data (3 dwords per line)"
at 0 50 buf 16 hex "data (4 dwords per line)"
at 0 50 buf 20 hex "data (5 dwords per line)"
at 0 50 buf 24 hex "data (6 dwords per line)"
at 0 50 buf 28 hex "data (7 dwords per line)"
at 0 50 buf 32 hex "data (8 dwords per line)"
}
def SPRITE_HDR
{
n32 hex ptr SPRITE_HDR rel "next_sprite "
buf 12 asc "name "
n32 "width_in_dwords-1"
n32 "scan_lines-1 "
n32 "first_bit "
n32 "last_bit "
n32 hex ptr SPRITE_DATA add -. rel "offset_image "
n32 hex ptr SPRITE_DATA add -. rel "offset_mask "
n32 map SPRITE_MODE "mode "
0x40 SPRITE_PAL "palette "
}
def SPRITE_FILE
{
n32 "num_sprites "
n32 hex ptr SPRITE_HDR add -. "first_sprite"
}
//
// PSEG files
// I don't know very much about the internal structure of these.
// Here is enough to allow loading and saving of 1bpp PSEG files.
//
be
def PSEG_COMMENT
{
buf 100 ebc "text"
}
def PSEG_BEGIN_PAGE
{
buf 100 ebc "segment (often is filename)"
}
def PSEG_BEGIN_IMG_BLOCK
{
buf 100 ebc "image (often is filename)"
}
map PSEG_ORIENTATION
{
"90degrees" 0x2d
}
def PSEG_IMG_OUTPUT_CTL
{
buf 6 hex "? "
buf 2 hex "? "
n8 map PSEG_ORIENTATION "orientation"
buf 1 hex "? "
buf 8 hex "? "
n16 "x_scale "
n16 "y_scale "
buf 2 hex "reserved "
}
def PSEG_INPUT_IMG_DESC
{
buf 2 "? "
n16 hex "0 or 0x0960 "
n16 hex "0 or 0x0960 "
buf 8 hex "? "
n16 hex "0 or 0x0960 "
n16 hex "0 or 0x0960 "
n16 "bytes_per_line"
n16 "lines "
buf 4 hex "? "
n8 map PSEG_ORIENTATION "orientation "
buf 1 hex "? "
n16 "x_cell "
n16 "y_cell "
buf 4 hex "? (=00001ffff)"
}
def PSEG_RASTER_DATA
{
buf 100 hex "data"
}
def PSEG_IMG_CELL_POSN
{
n16 "x_cell_pos "
n16 "y_cell_pos "
n16 "x_cell_size"
n16 "y_cell_size"
n16 "x_fill_size"
n16 "y_fill_size"
}
def PSEG_END_IMG_BLOCK
{
buf 100 ebc "image (often is filename)"
}
def PSEG_END_PAGE
{
buf 100 ebc "segment (often is filename)"
}
def PSEG_RECORD
{
n8 hex "start (=0x5a) "
n16 ptr PSEG_RECORD rel "data_size "
buf 3 hex "type "
buf 3 hex "? "
union
{
PSEG_COMMENT "if type==@deeeee"
PSEG_BEGIN_PAGE "if type==@d3a85f"
PSEG_BEGIN_IMG_BLOCK "if type==@d3a87b"
PSEG_IMG_OUTPUT_CTL "if type==@d3a77b"
PSEG_INPUT_IMG_DESC "if type==@d3a67b"
PSEG_RASTER_DATA "if type==@d3ee7b"
PSEG_IMG_CELL_POSN "if type==@d3ac7b"
PSEG_END_IMG_BLOCK "if type==@d3a97b"
PSEG_END_PAGE "if type==@d3a95f"
buf 100 hex "as raw data "
}
}
def PSEG_FILE
{
PSEG_RECORD "first_record"
}
//
// 3D Texture block file, as understood by Andys CSG Raytracer,
// and the Modular Renderer C++ class library, written by the BE author.
//
le
def TEX_FILE
{
n32 hex "magic "
n32 dec "w "
n32 dec "h "
n32 dec "d "
n32 dec "bpv "
buf 100 hex "data..."
}
//
// OS/2 Resource File
// Assume types and names are not ASCII strings.
//
le
map RES_TYPE
{
"RT_POINTER" 1
"RT_BITMAP" 2
"RT_MENU" 3
"RT_DIALOG" 4
"RT_STRING" 5
"RT_FONTDIR" 6
"RT_FONT" 7
"RT_ACCELTABLE" 8
"RT_RCDATA" 9
"RT_DLGINCLUDE" 11
"RT_FKALONG" 17
"RT_HELPTABLE" 18
"RT_HELPSUBTABLE" 19
}
map RES_MEM_FLAGS
{
"NSCODE" 0x0000 : 0x0007
"NSDATA" 0x0001 : 0x0007
"NSITER" 0x0008 : 0x0008
"NSMOVE" 0x0010 : 0x0010
"NSPURE" 0x0020 : 0x0020
"NSPRELOAD" 0x0040 : 0x0040
"NSEXRD" 0x0080 : 0x0080
"NSRELOC" 0x0100 : 0x0100
"NSCONFORM" 0x0200 : 0x0200
"NSDPL0" 0x0400 : 0x0400
"NSDPL1" 0x0800 : 0x0800
"NSDISCARD" 0x1000 : 0x1000
"NS32BIT" 0x2000 : 0x2000
"NSHUGE" 0x4000 : 0x4000
}
def RES_FILE
{
n8 hex "(=0xff) "
n16 map RES_TYPE "resource_type "
n8 hex "(=0xff) "
n16 "name "
n16 map RES_MEM_FLAGS "memory_flags "
n32 ptr RES_FILE add 4 rel "data_size "
union
{
buf 100 hex "data... "
BMP_FILE "data if RT_BITMAP"
}
}
//
// ZIP file format
// zero or more zipped-files
// where each zipped-file is a ZIP_LOCAL_FILE_HEADER followed by its data
// followed by zero or more ZIP_FILE_HEADERs
// followed by ZIP_CENTRAL
// This is a little tricky to handle, because each of the zip files
// in the header
//
le
// Operating system
map ZIP_OS
{
"MS-DOS and OS/2 (FAT FS)" 0
"Amiga" 1
"VMS" 2
"*nix" 3
"VM/CMS" 4
"Atari ST" 5
"OS/2 (HPFS FS)" 6
"Macintosh" 7
"Z-System" 8
"CP/M" 9
}
// Compression method
map ZIP_COMP
{
"Stored" 0
"Shrunk (dynamic LZW)" 1
"Reduced with compression factor 1" 2
"Reduced with compression factor 2" 3
"Reduced with compression factor 3" 4
"Reduced with compression factor 4" 5
"Imploded (sliding dict.+shannon fano)" 6
"Tokenized" 7
"Imploded (sliding dict.+dyn huff+shannon fano)" 8
}
// header to each zipped-file in the zip-archive
def ZIP_LOCAL_FILE_HEADER
{
n32 hex "signature (=0x04034b50) "
n8 dec "version needed to extract (level)"
n8 map ZIP_OS "version needed to extract (OS) "
n16 hex "general purpose bit flag "
n16 map ZIP_COMP "compression method "
n16 dec "last mod file time "
n16 dec "last mod file date "
n32 hex "crc-32 "
n32 dec "compressed size "
n32 dec "uncompressed size "
n16 dec "filename length "
n16 dec "extra field length "
buf 100 asc "filename and extra field ... "
}
// The awkward thing here is that the next zipped-file in the archive
// follows sizeof ZIP_LOCAL_FILE_HEADER + compressed size + filename length
// + extra field length bytes later on, and BE doesn't give an easy way
// to step onto the next one...
// If you are looking at a ZIP_LOCAL_FILE_HEADER, and you want to see the
// next one, add 0x1e+compressed size+filename length+extra field length.
// header to each entry in the central directory
def ZIP_FILE_HEADER
{
n32 hex "signature (=0x02014b50) "
n8 dec "version made by (level) "
n8 map ZIP_OS "version made by (OS) "
n8 dec "version needed to extract (level) "
n8 map ZIP_OS "version needed to extract (OS) "
n16 hex "general purpose bit flag "
n16 dec "compression method "
n16 dec "last mod file time "
n16 dec "last mod file date "
n32 hex "crc-32 "
n32 dec "compressed size "
n32 dec "uncompressed size "
n16 dec "filename length "
n16 dec "extra field length "
n16 dec "file comment length "
n16 dec "disk number start "
n16 hex "internal file attributes "
n32 hex "external file attributes "
n32 dec "relative offset of local header "
buf 100 asc "filename, extra field and comment ..."
}
// The awkward thing here is that the entry in the central directory
// follows sizeof ZIP_FILE_HEADER + filename length + extra field length
// bytes later on, and BE doesn't give an easy way to step onto the next one...
// If you are looking at a ZIP_FILE_HEADER, and you want to see the
// next one, add 0x2e+filename length+extra field length+comment length.
def ZIP_CENTRAL
{
n32 hex "signature (=0x06054b50) "
n16 dec "number of this disk "
n16 dec "number of disk with start of central directory "
n16 dec "total number of entries in the central dir on this disk "
n16 dec "total number of entries in the central dir "
n32 dec "size of the central directory "
n32 dec "offset of start of central directory wrt. start disk num"
n16 dec "zipfile comment length "
buf 100 asc "zipfile comment ... "
}
def ZIP_BLOCK union
{
n32 hex "signature "
ZIP_LOCAL_FILE_HEADER "local file header (if signature=0x04034b50)"
ZIP_FILE_HEADER "file header (if signature=0x02014b50)"
ZIP_CENTRAL "central directory (if signature=0x06054b50)"
}
// So this ZIP_FILE definition is very sad really
def ZIP_FILE
{
ZIP_BLOCK "first zip-block"
}
//
// Choose what to decode. Simply overlay all the different filetypes given in
// this configuration file on top of each other.
//
def main union
{
BMP_FILE "Bitmap file"
TGA_FILE "Targa file"
KPS_FILE "KIPS file"
PCX_FILE "PCX file"
VID_FILE "VID file"
TIFF_FILE "TIFF file"
ILBM_FILE "ILBM file"
GIF_FILE "GIF file"
SPRITE_FILE "Sprite file"
PSEG_FILE "PSEG file"
TEX_FILE "TEX file"
RES_FILE "RES file"
ZIP_FILE "ZIP file"
}