Skip to content

Commit

Permalink
Add WIP 010 templates and update info on ident field values.
Browse files Browse the repository at this point in the history
  • Loading branch information
Doom2fan committed Apr 29, 2023
1 parent 959c4df commit 1ddbadb
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 4 deletions.
90 changes: 90 additions & 0 deletions _010Templates/Skout_ModelFile.bt
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
//------------------------------------------------
// File: Skout_ModelFile.bt
// Author: Chronos Ouroboros
// Version: 1.0
// Purpose: Parse Skout model files.
// Category: Game
//------------------------------------------------

LittleEndian ();

typedef float Vec3F [3] <read=Str ("(%g %g %g)", this [0], this [1], this [2]),
write=SScanf (value,"(%g %g %g)", this [0], this [1], this [2])>;

typedef int Vertex10 <read=Str ("(%g %g %g)", this & 0x3FF, (this >> 10) & 0x3FF, (this >> 20) & 0x3FF)>;

local int curPos;
local int i;
local int j;
local int offs;
struct Skout_Model {
struct TXobj3 {
FSeek (0x04);
int VertexSetsCount;
int VertexSetPointers [8];
int MaterialsCount;
int MaterialsPointer;
FSeek (0x34);
int Huh;
} Header <open=true>;

FSeek (Header.MaterialsPointer);
int MaterialsPointers [Header.MaterialsCount] <format=hex>;

FSeek (Header.MaterialsPointer);
struct MaterialsData {
for (i = 0; i < Header.MaterialsCount; i++) {
FSeek (MaterialsPointers [i]);
struct MaterialData {
int Unknown1;
Vec3F AmbientColor;
Vec3F LightColor;
Vec3F SomeColor;
Vec3F SpecularColor;
float Unknown5;
float Unknown6;
int FileId <format=hex>;
uint Unknown7;
uint Unknown8;
uint Unknown9;
} materialData;
}
FSeek (Header.MaterialsPointer + Header.MaterialsCount * 4);
} Materials;

for (i = 0; i < Header.VertexSetsCount; i++) {
FSeek (Header.VertexSetPointers [i]);
struct VertexSet {
int UnknownPre1;
int UnknownPre2;
int LightCacheOffs;
int TexCoordsOffs;
int VertexPosOffs;
int VertexNormOffs;
int PlaneNormOffs;
} vertexSet;
}

for (i = 0; i < Header.VertexSetsCount; i++) {
offs = vertexSet [i].VertexPosOffs;

if (offs < 0)
continue;

FSeek (offs);
struct VertexPosData {
int VertexCount;
int VertexFormat;
Vec3F VertexScale;
Vec3F VertexOffset;
Vec3F BoundsMin;
Vec3F BoundsMax;
if (VertexFormat == 10)
Vertex10 Vertices [VertexCount];
else if (VertexFormat == 32)
Vec3F Vertices [VertexCount];
} vertexPosData;
}
} file <open=true>;

return 0;
41 changes: 41 additions & 0 deletions _010Templates/Skout_SpriteFile.bt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//------------------------------------------------
// File: Skout_SpriteFile.bt
// Author: Chronos Ouroboros
// Version: 1.0
// Purpose: Parse Skout sprite files.
// Category: Game
//------------------------------------------------

LittleEndian();

local int i;
struct Skout_Sprite {
struct spr3_Header {
int Something1;
float Duration;
float BoundsMin [3];
float BoundsMax [3];
FSeek (0x24);
int SubFileCount;
int SubFilePointer;
FSeek (0x234);
int Pics;
} Header <open=true>;

FSeek (Header.SubFilePointer);
int SubFiles [Header.SubFileCount] <format=hex>;
int SubFiles2 [Header.SubFileCount] <format=hex>;

FSkip (0xc);
int Something1;
int Something2Pointers [Something1];

local int curPos = FTell ();
for (i = 0; i < Something1; i++) {
FSeek (Something2Pointers [i]);
float Something2;
}
FSeek (curPos);
} file <open=true>;

return 0;
6 changes: 2 additions & 4 deletions _010Templates/_Ident field values.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ Some of these values are guesses, while some we know based on observations.
* `02-09-FF`: Audio files.
* `04-0C-??`: Graphics. If the 3rd ident byte is FF, it's a 16 or 32 bit image; Otherwise, it's a palette index. The kind of image is further subtyped by "Data1" and "Data2" in the header, which determines what kind of image data it contains (e.g., Indexed, RGBA1555, RGBA8888)
* `05-0D-FF`: ??? Something with a built-in palette. Unsure. Didn't notice any changes when not present.
* `07-0F-FF`: Unknown, very strange. All of them seem to start with 464 bytes set to "CD" with a hole of 4 zeroes at 0x4C? Always starts with `010C`? Delayed crash on start if not present. Cutscenes black out, main menu shows nothing then crashes.
* Loaded by GLspr3DoesCheckExist, GLspr3CountShots, GLspr3DrawSprBound and more
* `07-0F-FF`: Sprite definitions.
* `08-10-??`: Font graphics. Mostly the same as normal graphics, has some kind of extra data, and `Data1` is 257. Game crashes if not present, but if they're present but 0 bytes, it just doesn't render text.
* `09-11-FF`: Crash on launch if not present.
* Loaded by GLspr3CDlineObjectMaterial, CDspr3CDlineObject, GLspr3DrawObj, GLspr3DrawObjScaleUV and more
* `09-11-FF`: Model files.
* `0A-12-FF`: "Single player" option doesn't work if these files are removed from `skout.bit`. Seems to be levels? Removing them from `network.bit` makes the game say `Cutscene 0x?? not found [cutscene ok, but level 0x?? not found!]`
* `0B-13-FF`: Removing these causes error messages saying `Cutscene 0x?? not found`
* `0C-0F-FF`: Model animations? All seem to have 660 zero bytes at the start? Crash on new game start if not present.

0 comments on commit 1ddbadb

Please sign in to comment.