Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to extract png/ogg from STEX #7

Open
JayQ2K opened this issue Jun 18, 2021 · 8 comments
Open

Add option to extract png/ogg from STEX #7

JayQ2K opened this issue Jun 18, 2021 · 8 comments
Labels
enhancement New feature or request

Comments

@JayQ2K
Copy link

JayQ2K commented Jun 18, 2021

When unpacking a PCK file it would be nice to have an option to convert STEX files into their 'original' form (PNG, JPG, OGG).

@hhyyrylainen
Copy link
Owner

Do you know how the STEX files are packed / what they contain?
If they are converted by Godot to an entirely different form from the source asset, I'm not sure how possible it is to revert that conversion...

@hhyyrylainen
Copy link
Owner

So it looks like STEX files have a header followed by (potentially) PNG data, so it shouldn't be too difficult to look at the Godot source code for STEX generation to reverse engineer the header format and then write code that is able to extract the PNG data from a STEX file.
https://www.reddit.com/r/godot/comments/hyokie/is_there_a_tool_available_to_convert_stex_files/
https://whatext.com/stex

@hhyyrylainen hhyyrylainen added the enhancement New feature or request label Jun 19, 2021
@hhyyrylainen hhyyrylainen changed the title convert option to extract png/ogg from STEX Add option to extract png/ogg from STEX Jun 19, 2021
@JayQ2K
Copy link
Author

JayQ2K commented Jun 19, 2021

You might want to look at the code at this location: https://github.com/Bioruebe/godotdec
They have a -c option included to convert items.

@hhyyrylainen
Copy link
Owner

hhyyrylainen commented Jun 19, 2021

It looks like that just detects the .png.stex being part of a file name and skips the .stex file header to dump what presumably is the png content. Doing things properly and in a checked way (for example verifying that the stex specifies that the resource is of png type) would be a bit more difficult.

Edit: here's the interesting part in that source code:
https://github.com/Bioruebe/godotdec/blob/66fef2185989944f8d45581e3f02b0e05c621506/godotdec/Program.cs#L74

@JayQ2K
Copy link
Author

JayQ2K commented Jun 19, 2021

Indeed, seen the interesting part. Wasn't suggesting you take this 1-to-1 into your code btw, but since there are some references on that Github it might be an interesting read to see what model you can come up with.

@UltraBlackLinux
Copy link

UltraBlackLinux commented Dec 31, 2021

I would like to do a similar thing - Convert .oggstr files back to .ogg

I had no luck finding anything about that on the web

@Arnavion
Copy link

I would like to do a similar thing - Convert .oggstr files back to .ogg

< foo.oggstr tail -c +280 > foo.ogg

@ithinkandicode
Copy link

ithinkandicode commented Jan 25, 2023

FWIW GDRETools can convert STEX > PNG.

image

I haven't tested their OGG conversion as I don't have a game that uses them atm. But if it can handle OGG too, perhaps it would be more suitable to use GDRETools rather than expanding the scope of PckTool? And if it can't handle OGG conversion, maybe it would be worth raising a feature request for GDRETools?

edit: As far as I can tell, GDRETools has surpassed the capabilities of godotdec, as it seems to be possible to do the same things in GDRETools, but with more features. It does, however, decompile source code in full (via RE Tools > Recover Project), so other tools that don't expose the source may be preferable if you intend to distribute/require it as part of your tooling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants