Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //------------------------------------------------
- //--- 010 Editor v8.0 Binary Template
- //
- // File: *.spr
- // Authors: Waelwindows
- // Version: 0
- // Purpose: Structure the spr format into a understandable class
- //------------------------------------------------
- typedef struct {
- uint unknown <name="UNK1", hidden=1>; // Seems to be always 0x0
- int scale <name="Scaling">;
- } SPR_SCALER;
- typedef struct {
- uint texIndex <name="Texture Index">;
- float unk1 <hidden=1>;
- float unk2 <hidden=1>; // Various
- float unk3 <hidden=1>; // Various
- float unk4 <hidden=1>; // Various
- float unk5 <hidden=1>; // Various
- float rectX <name="Rectangle X">;
- float rectY <name="Rectangle Y">;
- float rectWidth <name="Rectangle Width">;
- float rectHeight <name="Rectangle Height">;
- } SPR_PROPERTY;
- typedef struct {
- byte type;
- char signature[3];
- if ( signature != "PXT" ) {
- Warning("Texture doesn't have PXT identifier");
- return -1;
- }
- if (type == 2) {
- uint width <name="Width">;
- uint height <name="Height">;
- uint unknown <hidden=1>;
- uint index <name="Index">;
- uint byteSize <name="Byte Size">;
- byte data[byteSize];
- }
- // Texture container
- // 3: Main texture container
- // 4: Child texture container (child of 3)
- else if (type == 3 || type == 4) {
- uint childrenCount;
- byte childrenCount; // Same as above, yes
- byte flags[3]; // Changing them in game does nothing
- uint childrenPositions[childrenCount]; // All of them are relative to where TXP starts
- }
- else {
- Warning("Error, unknown texture type");
- return -1;
- }
- } TEX;
- // ----------------------------------------------------------
- typedef struct {
- char magic[4] <name="File ID", comment="Always SPRC">;
- uint eofc <name="EOFC Offset", format=hex>;
- uint headerOffset <name="Header Offset", comment="Seems to be always set to 0x20", format=hex>;
- uint ver <name="File Version">;
- DWORD ebr1 <hidden=1>;
- uint texCompOffset <name="Texture Compression Offset", format=hex>;
- } OFFSET_TBL;
- typedef struct {
- uint id <name="ID", comment="Should be always set to 0">;
- uint texOffset <name="Texture Offset", comment="Always 8 bytes before last PXT?", format=hex>;
- uint texCount <name="Texture Count">;
- uint sprCount <name="Sprite Count">;
- uint sprPropertOffset <name="Sprite Properties Offset", format=hex>;
- uint texNameOffset <name="Texture Name Offset Table", format=hex>;
- uint sprNameOffset <name="Sprite Name Offset Table", format=hex>;
- uint sprScaleOffset <name="Sprite Scale Offset", format=hex>;
- } HEADER;
- // Define the headers
- LittleEndian();
- OFFSET_TBL offset_tbl <name="Offset Table", open=true, bgcolor=cGreen>;
- BigEndian();
- FSeek(offset_tbl.headerOffset);
- HEADER header <name="Header", open=true, bgcolor=cRed>;
- FSeek(header.sprScaleOffset);
- SPR_SCALER scale[header.sprCount] <name="Sprite Scaling", bgcolor=cBlue>;
- FSeek(header.sprPropertOffset);
- SPR_PROPERTY properties[header.sprCount] <name="Sprite Properties", bgcolor=cYellow>;
- FSeek(header.sprNameOffset);
- uint sprNames[header.sprCount] <name="Sprite Names Offsets", format=hex, bgcolor=cGreen>;
- FSeek(header.texNameOffset);
- uint texNames[header.texCount] <name="Texture Names Offsets", format=hex, bgcolor=cRed>;
- FSeek(header.texOffset +8);
- TEX textures[header.texCount] <name="Textures", bgcolor=cWhite>;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement