*: Add Markdown file documentation to //datadoc

:) Finally. Might as well.
This commit is contained in:
Lily Tsuru 2025-01-20 00:03:48 -05:00
parent 2a2d7073a3
commit 753b879e7b
3 changed files with 123 additions and 0 deletions

55
datadoc/msh.md Normal file
View file

@ -0,0 +1,55 @@
# Europa Model Mesh (.msh)
> [!WARNING]
> This document is mostly complete, however some pieces of it are not.
Europa mesh files are used to store submodel data. They are referenced by .mdl files.
# Magic/version
Magic/version is indicated as 2 Windows (CR-LF) formatted lines:
- `MESH\r\n`
- `[version]\r\n`
A file which does not start with the first line SHALL be rejected as a invalid .msh regardless of version.
The following versions are known to exist:
| Version | Description |
| ------- | ------------------------------------------------------------------------------------------------------------------------- |
| 1.2 | Very early text format. Used by a grand total of one accidentally shipped(?) mesh (RESOURCE.PAK `model\default.msh`) file |
| 2.0 | Binary format. Used by literally everything else |
# Version 1.2
> [!CAUTION]
> This format is currently not supported by libeuropa, since it can more than likely be imported by hand. Maybe for historic curiousity I'll document it later, but don't expect much.
# Version 2.0
### Block
Mesh 2.0 files use a block structure for lists of information.
A block consists of a 16-bit unsigned integer of count of items (not bytes!) in that block, then the serialized items themselves.
A empty block will always be serialized as just `00 00` regardless of type.
### Mesh piece
A mesh piece is used to change material or potentionally to split a mesh if it exceeds 64k verts.
In practice it's usually probably the first one.
First the material name is read (until a new line character is read). This corresponds to a <!-- FIXME: Write doc --> .mtl material file the game will also parse.
Next, the following blocks are read and parsed:
- Vertex block. This block corresponds of Vec3s (your usual float x, float y, float z deal) which repressent each vertex.
- Vertex color block. Consists of a struct of rgba colors for each vertex.
- Normal block. Consists of Vec3s which define normal. May possibly not be pressent (normals probably have to be generated then.)
- UV block. This consists of a set of UV coordinates over all verticies (and there can be multiple UVs, but I haven't fully worked this out..)
- Face block. This consists of 3 uint16 face indicies for XYZ for each vertex.
In version 2.0, the mesh file consists of a block of mesh pieces, except there will be at least one in a valid mesh file.

16
datadoc/pak.md Normal file
View file

@ -0,0 +1,16 @@
# Europa Package Files (.PAK)
> [!WARNING]
> This document is incomplete and needs more details.
Package files are used by the Europa engine's core filesystem APIs to boost file performance.
## Versions
| Version | Estimated dates |
| ------- | ------------------------------------------------------------------------- |
| 3 | ? - July 2000. Seen in very early PMDL exports only |
| 4 | August 2000 - Feburary 2001 (Used for packages built closer to ship date) |
| 5 | Sometime 2001 - March 2002 (Used for Jedi Starfighter) |
Versions 3 and 4 are relatively similar, with only minor differences.

52
datadoc/tex.md Normal file
View file

@ -0,0 +1,52 @@
# Europa PS2 Texture File (.tex)
On PS2, the Europa engine uses a homebrew texture format, known as "YATF" or, ~~probably~~ definitely **Y**et **A**nother **T**exture **F**ormat. Glad to know this team had some humour to them.
# Versions
| Version | Details |
| ------- | ---------------------------------------------------------------------------------------------------------------- |
| 1 | Introduced in Starfighter. |
| 2 | Introduced in Jedi Starfighter. Breaks the FourCC magic and adds a 4bpp mode while jumbling all the other modes. |
# Header
The .tex file header is one of the few filetypes in Europa which uses a proper FourCC magic. However this becomes rapidly annoying as you'll see later.
```cpp
struct yatfHeader {
uint32_t magic;
uint16_t version;
Format format; // Version-specific
uint8_t unknown; // ?
uint32_t unknownZeroed; // Zeroed on all files
uint32_t width;
uint32_t height;
};
```
### Version 1
Version 1 writes its magic (in LE) as `FTAY`.
Version 1 formats are:
| Int | Format type |
| --- | ---------------------- |
| 0 | 8bpp CLUT (256 colors) |
| 2 | 24bpp direct color |
| 3 | 32bpp RGBA8888 |
### Version 2
Version 2 writes its magic (in LE) as `YATF`. I have no clue why they did this because it pretty much means they broke the format anyways.
Version 2 formats are:
| Int | Format type |
| --- | ---------------------- |
| 1 | 8bpp CLUT (256 colors) |
| 3 | 24bpp direct color |
| 4 | 32bpp RGBA8888 |
| 5 | 4bpp CLUT (16 colors) |