Mostly finish shpk article

This commit is contained in:
Joshua Goins 2023-09-23 09:31:46 -04:00
parent ade2fcee61
commit 900a18349a
2 changed files with 22 additions and 12 deletions

View file

@ -2,25 +2,25 @@ This is my collection of everything I know, and that I collected on FFXIV inner
Developers, please look at the end of each page for example implementations that I know of. I find it incredibly useful to look at them, especially if I'm stuck on implementing something. If you have a project that you want to add to the list or suggest any kind of edit, don't hesitate to [email me](https://redstrate.com/about) or [fix it yourself](https://git.sr.ht/~redstrate/docs.xiv.zone)! Developers, please look at the end of each page for example implementations that I know of. I find it incredibly useful to look at them, especially if I'm stuck on implementing something. If you have a project that you want to add to the list or suggest any kind of edit, don't hesitate to [email me](https://redstrate.com/about) or [fix it yourself](https://git.sr.ht/~redstrate/docs.xiv.zone)!
## Executables # Executables
**Note:** These are actually referring to their 64-bit counterparts, e.g. `ffxivboot.exe` is `ffxivboot64.exe`. **Note:** These are actually referring to their 64-bit counterparts, e.g. `ffxivboot.exe` is `ffxivboot64.exe`.
### Boot ## Boot
* [ffxivboot.exe](executable/ffxivboot) - Launcher for the launcher. * [ffxivboot.exe](executable/ffxivboot) - Launcher for the launcher.
* [ffxivupdater.exe](executable/ffxivupdater) - Game patcher. * [ffxivupdater.exe](executable/ffxivupdater) - Game patcher.
* [ffxivlauncher.exe](executable/ffxivlauncher) - Boot/game launcher. * [ffxivlauncher.exe](executable/ffxivlauncher) - Boot/game launcher.
### Game ## Game
* [ffxiv.exe](executable/ffxiv) - Game executable. * [ffxiv.exe](executable/ffxiv) - Game executable.
### Other ## Other
* [ffxivinstaller.exe](executable/ffxivinstaller) - Retail game client installer. * [ffxivinstaller.exe](executable/ffxivinstaller) - Retail game client installer.
## Concepts/Techniques # Concepts/Techniques
* [Logging into Official Servers](concept/logging-in-official) - Logging into the official game servers. * [Logging into Official Servers](concept/logging-in-official) - Logging into the official game servers.
* [Logging into Sapphire](concept/logging-in-sapphire) - Logging into unofficial Sapphire servers. * [Logging into Sapphire](concept/logging-in-sapphire) - Logging into unofficial Sapphire servers.
@ -28,29 +28,30 @@ Developers, please look at the end of each page for example implementations that
* [Equipment](concept/equipment) - All about reading equipment data ala TexTools. * [Equipment](concept/equipment) - All about reading equipment data ala TexTools.
* [Dalamud](concept/dalamud) - Launching Dalamud without the help of XIVQuickLauncher. * [Dalamud](concept/dalamud) - Launching Dalamud without the help of XIVQuickLauncher.
## File Formats # File Formats
### Excel ## Excel
* [.exd](format/exd) - Excel data. * [.exd](format/exd) - Excel data.
* [.exh](format/exh) - Excel header. * [.exh](format/exh) - Excel header.
* [.exl](format/exl) - Excel list. * [.exl](format/exl) - Excel list.
### Graphics ## Graphics
* [.mdl](format/mdl) - Game model. * [.mdl](format/mdl) - Game model.
* [.shpk](format/shpk) - Shader packages.
### SqPack ## SqPack
* [.index/index2](format/sqpack-index) - Game Data Index file. * [.index/index2](format/sqpack-index) - Game Data Index file.
* [.dat](format/sqpack-dat) - Compressed game data. * [.dat](format/sqpack-dat) - Compressed game data.
### Other ## Other
* [.patch](format/patch) - ZiPatch files. * [.patch](format/patch) - ZiPatch files.
* [.fiin](format/fiin) - File info. * [.fiin](format/fiin) - File info.
## Credits # Credits
This wouldn't be possible without all of the great people who open-source their work, and everyone else in the FFXIV community! This wouldn't be possible without all of the great people who open-source their work, and everyone else in the FFXIV community!

View file

@ -2,10 +2,14 @@
title: "SHPK" title: "SHPK"
--- ---
**Note**: Resource and scalar parameters are not documented yet.
These are "shader packages" or a collection of vertex and pixel shaders. A good example is _"character.shpk"_ which contains - you guessed it - character shaders. These are "shader packages" or a collection of vertex and pixel shaders. A good example is _"character.shpk"_ which contains - you guessed it - character shaders.
# Header Structure # Header Structure
All values are in **little-endian**.
| Offset | Type | Purpose | | Offset | Type | Purpose |
| ------ | ----- | ------ | | ------ | ----- | ------ |
| 0x00 | 4 character ASCII string | Magic, should read "ShPk". | | 0x00 | 4 character ASCII string | Magic, should read "ShPk". |
@ -25,4 +29,9 @@ Getting the shader bytecode from a shader package is easy, it begins at the shad
Then, collect a WORD (4 bytes) at a time and putting them into a buffer. Keep doing this until you hit the next `DXBC` ASCII and you found a complete shader bytecode. Rinse and repeat and you should have `N` shaders where `N = number of vertex shaders + number of pixel shaders`. Then, collect a WORD (4 bytes) at a time and putting them into a buffer. Keep doing this until you hit the next `DXBC` ASCII and you found a complete shader bytecode. Rinse and repeat and you should have `N` shaders where `N = number of vertex shaders + number of pixel shaders`.
The format of this shader bytecode is nothing special, it's simply DXBC (the bytecode format used by DirectX before DXIL). If you want to reverse this into something usable, like SPIR-V, HLSL or GLSL then you need to find a decompiler. The format of this shader bytecode is nothing special, it's DXBC (the bytecode format used by DirectX before DXIL.) If you want to reverse this into something usable, like SPIR-V, HLSL or GLSL then you need to find a decompiler.
# Alternative Implementations
* [SaintCoinach (C#)](https://github.com/xivapi/SaintCoinach/blob/master/SaintCoinach/Graphics/ShPk/ShPkFile.cs)
* [physis (Rust)](https://git.sr.ht/~redstrate/physis/tree/main/item/src/shpk.rs)