Dragon Quest Builders 2 Modding: Reinject texture files from Model files

  • Thread starter Thread starter Sapphire645
  • Start date Start date
  • Views Views 6,761
  • Replies Replies 30
its okey , may you please ask him if could fix the issue by adding support ffx-ffx2 texture switch in his tools , since your already in touch with him
The guy is super nice, I'm sure he'll try his best to help. I'm actually trying to sort this out so I'm kinda busy, but I'll try to talk to him! 😉

Also, did you actually try the beta build just for this? Maybe it works? Here's the link:
https://www.mediafire.com/file/3pj7x4t7tx4mboz/Custom_Texture_Tool_PS_v53.0.b03.7z/file
 
CS1 and CS2 phyre textures were not compressed at all. What about that your phyre files seems to use some kind of LZ77 type of compression inside it? This was discussed at all?
 

Attachments

  • Screenshot_2024-07-03-00-04-35-833_com.GenesysEast.windhex-edit.jpg
    Screenshot_2024-07-03-00-04-35-833_com.GenesysEast.windhex-edit.jpg
    647.1 KB · Views: 58
  • Like
Reactions: eviltrainer
Well, I really can't help with this but at least the way dqb2 handles files like that [multiple of the same file in 1 file] is that right at the beggining of the file it has the number of files, the pointer to the file, and the size of the file, something like [Nº OF FILES] [POINTER TO FILE 1] [SIZE OF FILE 1] [POINTER TO FILE 2] [SIZE OF FILE 2]. Or if not then at least the g1t texture files seem to have their size listed as the second value right after the file header name. That miiight help?
 
  • Like
Reactions: eviltrainer
CS1 and CS2 phyre textures were not compressed at all. What about that your phyre files seems to use some kind of LZ77 type of compression inside it? This was discussed at all?
Oh, I don't think that was brought up indeed in the other thread. Guess I'm gonna let BigHead now about that!
Post automatically merged:

Well, I really can't help with this but at least the way dqb2 handles files like that [multiple of the same file in 1 file] is that right at the beggining of the file it has the number of files, the pointer to the file, and the size of the file, something like [Nº OF FILES] [POINTER TO FILE 1] [SIZE OF FILE 1] [POINTER TO FILE 2] [SIZE OF FILE 2]. Or if not then at least the g1t texture files seem to have their size listed as the second value right after the file header name. That miiight help?
Nice! That may help, but I'm afraid it can be slightly different since DQB1 uses Phyre Engine and DQB2 uses the linkdata system discussed here, even on Switch.

Also, I'm planning on translating DQB2 next, when I'm finished with DQB1. I remember there's like a txt with the file index with for every asset archive in the game, so we know what we're extracting. I only found the one for the PC version of the game, though. I'll have to find one for the Switch, since, the files IDs are completely different (although th file index 600 did work for the icon sheet just like the one you linked here).
 
Last edited by eviltrainer,
  • Like
Reactions: eviltrainer
CS1 and CS2 phyre textures were not compressed at all. What about that your phyre files seems to use some kind of LZ77 type of compression inside it? This was discussed at all?
A quick update about this 👆🏻, masagrator:
I don't think the info in that post was accurate, but maybe we're talking about different types of compression (pixel compression vs. file size compression). The phyre textures in CS1 and CS2 did use compressed DDS types: DXT1, DXT3, and DXT5. But the phyre file itself did not use any kind of file compression. The PKG format that contained the phyre files, did indeed use LZ77 compression, which was changed to LZ4 for CS3 and CS4. Some games also work with Zstandard compression, but it's not used by default in any of the games.

As for compression in these "multi-texture" phyre formats, I don't know why there is a table of alphanumeric values, but I'm almost positive they are not compressed in any way, pixel or file size compression. The DDS formats being used are uncompressed formats, ARGB4 and ARGB8, meaning the pixel bytes lines up exactly with what the data in each pixel contains. in ARGB4, exactly 2 bytes (16-bits) make up a pixel while in ARGB8, exactly 4 bytes (32 bits) make up a pixel. Knowing that, the format, and the dimensions, we can calculate exactly how many bytes the image will be. Which works up to a point, at least in the phyre image collection I was working on until I hit a brick wall. The "next" texture after I think texture 38, the bytes don't line up with either what ARGB4/ARGB8 "should" be.

Textures 38 and 39 (might) be correct, it's hard to tell. Textures 40 and beyond though are definitely corrupt. They look like some kind of bar, but there are pixels missing in them. It's possible there are more or less bytes, they could be grayscale, I don't know too much about uncompressed grayscale formats. They could use even less pixels. They could also be a weird format like L8/A8/LA8 meaning luminance/alpha textures. Maybe there are mipmap pixels in some textures, its possible, or maybe its a different format altogether. Or maybe its a mistake. It's hard to know without pointers.

Speaking of pointers. No this file does not contain any. If it did, this would have been solved within an hour. My current script prints out the first bytes of images that do work, so these values are correct. And these are nowhere in the file. For example, here is pointers for the first five textures in hex: 6210, 87D8, A1D8, A478, A9B8. These files tend to be little endian, so the first 2 and last 2 bytes are flipped: 1062, D887, D8A1, 78A4, B89A - these would be the pointer values of the first five textures. Unfortunately, the phyre file does not have these values anywhere.

I have also made it so the stride of each image is printed out, and unfortunately those values are nowhere either. If we knew how many bytes each image was, then we wouldn't need pointers. Those values as far as I can tell, are nowhere to be found either. Here is the first five stride values of the textures: 25C8, 1A00, 02A0, 0540, 06E4 and of course swapping the endianess: C825, 001A, A002, 4005, E406. These values are nowhere to be found either.

Here is the work I have put into it thus far:
https://www.mediafire.com/file/n5pg6x7xx...ff.7z/file

Just run the "TestScript" by right clicking the script and selecting "Run with Powershell". This will display some nonsense and extract some textures. They are in their native formats so they need to be converted to PNG to view them or use some kind of image viewer. Much of the values are hardcoded, so it's not useful for other files. I was hoping some kind of pattern would emerge, but quite the opposite: I imagine every file would need to be individually hardcoded with what we currently know about them.

This is the place where I manually swap formats depending on the index before hitting a brick wall. But even figuring out how to get beyond this point doesn't give us any clues on how to apply this to all of these files. It could be possible to build a script for each file, but that would be very tedious and a lot of trial and error.

1720205431672.png


Feel free to share this post with anyone who wants to take a crack at it. Maybe they can succeed where I have failed. The best solution would be one that can handle any of these files. Figuring out a single file is nice enough, but the process would need to be repeated for every single one. There is definitely something I'm missing. In that block of data just below the alphanumeric values, might hold the key to what that is. When I get some more time I'll look into it more, but at the moment I'm no further than I was a week ago.

Link to the original post: https://forums.dolphin-emu.org/Thread-custom-texture-tool-ps-v52-5?pid=534993#pid534993

Hopefully this wall of code means anything to you lol
 
I get it. Though there is definitely something compressed there, so maybe it's actually a table with all stuff missing? I will try to decompress that block when I will have time, but it won't be soon enough as I'm going on vacations tomorrow. :P
 
I get it. Though there is definitely something compressed there, so maybe it's actually a table with all stuff missing? I will try to decompress that block when I will have time, but it won't be soon enough as I'm going on vacations tomorrow. :P

Yay! Enjoy your vacations! I hope you have a great time because it helps a lot to make our head lighter on everything in life!
 

Site & Scene News

Popular threads in this forum