VitaSmith / gust_tools

A set of utilities for dealing with Gust (Koei Tecmo) PC games files
Other
213 stars 25 forks source link

Support G1T for Blue Reflection Second Light #50

Closed scese250 closed 2 years ago

scese250 commented 2 years ago

I receive this message when extracting a g1t file from the font

ERROR: Unsupported texture type (0x72)

And there's other g1t file that is extracted but corrupted, with this output log

TYPE OFFSET SIZE NAME DIMENSIONS MIPMAPS SUPPORTED? 0x5f 0x00000024 0x00100000 externalchars_hd1080_0\000.dds 1024x1024 1 Y

font.zip

VitaSmith commented 2 years ago

Thanks for the report.

I'm not seeing much of an issue with externalchars_hd1080_0.g1t. The DDS is properly extracted and Visual Studio 2022, which is very picky about malformed DDS, has no trouble opening it:

000

Can you please elaborate on why you think it's corrupted?

As to mainfont00_hd1080_0.g1t, this indeed appears to use a new type of texture for which I can't find any details. Simply trying to dump it as DXT# or BC# doesn't seem to produce much of anything, and I'm not sure that I want to invest much time trying to figure out what kind of DDS header we're supposed to write if it's just for a handful of file.

On the other hand, if somebody else is willing to investigate and provide a sample of what the extracted .dds should look like, then I can add support for type 0x72 in gust_g1t...

scese250 commented 2 years ago

Can you please elaborate on why you think it's corrupted?

My bad, I opened the DDS with the wrong program and I had a little mental slip. Forget that.

About the new type of texture, hopefully someone is willing to help.

asuka-aurora commented 2 years ago

Can you please elaborate on why you think it's corrupted?

My bad, I opened the DDS with the wrong program and I had a little mental slip. Forget that.

About the new type of texture, hopefully someone is willing to help.

In fact i‘ve already modded it as my own made DS4button icon. So i think the error is nothing to do with Gust Tool but the DDS Plugins, i use PS and NVIDIA Texture Export to deal that. C4`6LR{WF~DPKM7EUO27M4

asuka-aurora commented 2 years ago

But i found another error about G1T in Blue Reflection Second Light, without any modding, i just opened the original file(now it named as “000.bak.dds”) export by gust_tools 1.44 , then saved it as BC3/DXT5 with alpha and mipmaps named “000.dds”.Then i use gust_tools to repack it as "pc000_scl.g1t" then the game turned me a common error.And to make a help, the original file is the "pc000_scl.bak.g1t".

pc000_scl.zip

VitaSmith commented 2 years ago

Yeah, I had actually started looking at pc000_scl.g1t repacking before you created this issue, because I also found that it crashed the game after repacking.

The issue, and this is the same problem as the one I mentioned at the end of #6, is that the .dds has more data than its actual dimension.

And I have found that this is because Gust are actually packing 2 textures one on top of the other, so the actual dimension of 000.dds is 1024x2048 rather than 1024x1024: 000

So, if you repack the .dds with any DDS editing application, even without modding it, the second part of the data will be dropped and you'll see that the size of that file went from 2.6 MB to 1.3 MB. But of course, since the BR game application is still be looking for the extra stacked texture, it will crash.

For now, the solution is simple: Just edit the height dimension in the .dds header to double the size (so for 000.dds you would change 00 04 00 00 =1024 in Little-Endian to 00 08 00 00 = 2048) before editing the file, then revert that change before you repack with gust_g1t:

Image2

I'll be releasing a new version of gust_g1t that takes care of saving the .dds with the real dimension, and then modify back to the original dimension on reimport, so that you don't have to perform this change manually. But in the meantime, this should do the trick.

asuka-aurora commented 2 years ago

Yeah, I had actually started looking at pc000_scl.g1t repacking before you created this issue, because I also found that it crashed the game after repacking.

The issue, and this is the same problem as the one I mentioned at the end of #6, is that the .dds has more data than its actual dimension.

And I have found that this is because Gust are actually packing 2 textures one on top of the other, so the actual dimension of 000.dds is 1024x2048 rather than 1024x1024: 000

So, if you repack the .dds with any DDS editing application, even without modding it, the second part of the data will be dropped and you'll see that the size of that file went from 2.6 MB to 1.3 MB. But of course, since the BR game application is still be looking for the extra stacked texture, it will crash.

For now, the solution is simple: Just edit the height dimension in the .dds header to double the size (so for 000.dds you would change 00 04 00 00 =1024 in Little-Endian to 00 08 00 00 = 2048) before editing the file, then revert that change before you repack with gust_g1t:

Image2

I'll be releasing a new version of gust_g1t that takes care of saving the .dds with the real dimension, and then modify back to the original dimension on reimport, so that you don't have to perform this change manually. But in the meantime, this should do the trick.

Thank you very much for the things on KT games you achieve and always update at once, i'll try to edit it with you advice.

VitaSmith commented 2 years ago

Version 1.46, which I have just released, should now take care of Z-Stacked textures automatically. So, if you use that version, you should be able to unpack and repack Blue Reflection Second Light .g1t's without having to manually edit anything.