From 1ddbadb79bd4597bf99e363c8e35ecd949fdf077 Mon Sep 17 00:00:00 2001 From: Chronos Ouroboros Date: Sat, 29 Apr 2023 06:50:03 -0300 Subject: [PATCH] Add WIP 010 templates and update info on ident field values. --- _010Templates/Skout_ModelFile.bt | 90 ++++++++++++++++++++++++++++ _010Templates/Skout_SpriteFile.bt | 41 +++++++++++++ _010Templates/_Ident field values.md | 6 +- 3 files changed, 133 insertions(+), 4 deletions(-) create mode 100644 _010Templates/Skout_ModelFile.bt create mode 100644 _010Templates/Skout_SpriteFile.bt diff --git a/_010Templates/Skout_ModelFile.bt b/_010Templates/Skout_ModelFile.bt new file mode 100644 index 0000000..6ba1a82 --- /dev/null +++ b/_010Templates/Skout_ModelFile.bt @@ -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] ; + +typedef int Vertex10 > 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 ; + + FSeek (Header.MaterialsPointer); + int MaterialsPointers [Header.MaterialsCount] ; + + 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 ; + 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 ; + +return 0; \ No newline at end of file diff --git a/_010Templates/Skout_SpriteFile.bt b/_010Templates/Skout_SpriteFile.bt new file mode 100644 index 0000000..c6ed2c9 --- /dev/null +++ b/_010Templates/Skout_SpriteFile.bt @@ -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 ; + + FSeek (Header.SubFilePointer); + int SubFiles [Header.SubFileCount] ; + int SubFiles2 [Header.SubFileCount] ; + + 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 ; + +return 0; \ No newline at end of file diff --git a/_010Templates/_Ident field values.md b/_010Templates/_Ident field values.md index 5d26cac..98f0d29 100644 --- a/_010Templates/_Ident field values.md +++ b/_010Templates/_Ident field values.md @@ -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. \ No newline at end of file