WIP: Implement texture files #191

Draft
lucas wants to merge 14 commits from feat/textures into master

14 commits

Author SHA1 Message Date
7384d3359c
Only use texture files for texture-meta command
All checks were successful
lint/clippy Checking for common mistakes and opportunities for code improvement
build/msvc Build for the target platform: msvc
build/linux Build for the target platform: linux
2025-03-06 13:32:47 +01:00
5f8016c655
Use macro to generate file type enum and impls
Due to the large amount of variants, and the different kind of values
connected to each variant (hash, extension name) being scattered
across the various `impl` blocks, the file became rather convoluted.

While I don't generally like the indirection of macros or meta
programming, it's not that bad with Rust, thanks to Rust Analyzer being
able to attach diagnostics to the source inside the macro definition,
and the ability to generate the macro's output for validation.

Therefore, the new macro allows putting all data used for this enum
definition into a single block.
2025-02-21 15:44:10 +01:00
ea2368c532
Switch to cursor_split feature
All checks were successful
lint/clippy Checking for common mistakes and opportunities for code improvement
build/msvc Build for the target platform: msvc
build/linux Build for the target platform: linux
The `cursor_remaining` feature was replaced by that:
https://github.com/rust-lang/rust/pull/109174
2025-02-19 11:14:13 +01:00
ff6fd948c8
sdk: Remove unused function 2025-02-19 11:14:11 +01:00
572778f210
dtmt: Fix file injection
I ended up wrapping the raw data in a `BundleFile` twice.
I also made '--compile' the default, as it should be much less often
that raw data needs to be inserted. Even files that are essentially raw
binary blobs, like `.wwise_event`, still have some custom fields that
need to be accounted for.
2025-02-19 11:14:09 +01:00
4bf97e9f19
Add cmdline to tracing output
Can come in handy when other people report problems and show the error
message or full log, but not the command line.

Setting that span to `level = "error"` ensures that it won't be disabled
by level filters.
2025-02-19 11:14:07 +01:00
6f6df14bfc
Refactor code for file injection 2025-02-19 11:14:05 +01:00
bcbc005df7
Implement more texture formats
The second compression method found in the game's code seems to be Zlib,
but it doesn't seem to be used in the game files. What does get used is
a compression type of `0`, which appears to be uncompressed data.

For DDS formats, all the ones that are currently used by in the game
files can be emitted as is. Though for some of them, other tools might
not be able to display them.
2025-02-19 11:14:04 +01:00
233389ebb1
sdk: Implement decompiling streamed mipmaps
For now, we only extract the largest mipmap.
2025-02-19 11:13:59 +01:00
30b9a93fa3
Reverse DDSImage::load
Decompiling the game binary shows a rather elaborate algorithm to load
DDS images from binary. Though comparing it to Microsoft's documentation
on DDS, most of it seems to be pretty standard handling.

However, we don't actually need all of it. The part about calculating
pitch and reading blocks only accesses a subset of the `ImageFormat`
struct, so we can strip our implementation to just that.
2025-02-19 11:12:11 +01:00
84cb6ff985
sdk: Add decompiled SJSON texture file
In addition to the actual image file, also write a `.texture` engine
file.
2025-02-19 11:12:09 +01:00
0e2f0d4409
sdk: Add dictionary group for texture categories 2025-02-19 11:12:08 +01:00
126d3c743d
dtmt: Add option to compile file when injecting 2025-02-19 11:12:06 +01:00
ea7886b08f
feat(sdk): Implement partial texture decompilation 2025-02-19 11:12:05 +01:00