ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Thu Sep 20, 2018 8:54 pm

All times are UTC




Post new topic  Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Fri Apr 27, 2018 3:16 am 

Joined: Thu Apr 26, 2018 10:34 pm
Posts: 4
Hello all,

I'm trying to mod some graphic files that are a TID file and that has a DXT1 compression
I successfully extracted the png file from the tid file using nr2_tidtool v1.0, but the problem is getting the file back into a compressed DDS (DXT1) file with a TID header using hex.

I have attempted to add the modified png to a dds file with dxt1 compression using paint.net and dds export, but unsure how to create a tid file from it. I tried using hex editor by copy/paste the header, but since the file sizes are different sizes, the resulting png is a scrambled image.

I have attached the original tid file, and a proper dds file created.
Hope someone may be able to give some tips for a tid to dds conversion, and dds to tid conversion; I believe the header is at Offset 0x00 to 0x7F, and I believe that is all that would need to be changed.

Regards,


Attachments:
body_c.zip [184.08 KiB]
Downloaded 31 times
Top
   
PostPosted: Fri Apr 27, 2018 11:24 am 

Joined: Sun May 01, 2016 10:06 pm
Posts: 78
It's a very simple format.
Magic is 3 bytes at 0x0, "TID"
Flags are 1 byte at 0x3, 0x80 is mandatory; others are: 0x1 - big endian header; 0x2 - ARGB instead of RGBA; 0x4 - Morton order swizzling; 0x8 - vertical flip; 0x10 - I've found no use for this
Width is 4 bytes at 0x44
Height is 4 bytes at 0x48
Data size is 4 bytes at 0x58
Format is 4 bytes at 0x64, if it's 0 - it's either RGBA or ARGB (see Flags)
Image data is at 0x80 till EOF

If you want to make a TID, just copy first 128 bytes from existing one and copy your new image data (if you haven't changed width/height/format).
I remember that Vita really hates RGBA, so set that 0x2 flag and make your image data ARGB. No need to do so for DXT.

Image

Usage for DDS2TID: place your DDS file in the same folder as it's TID source; run QuickBMS; select "neptunia_ideafactory_dds2tid.bms"; navigate and select the DDS file; navigate and select the same folder (input folder is the output folder).


Attachments:
File comment: For QuickBMS: TID2DDS and a dirty DDS2TID with swizzling and RGBA->ARGB.
neptunia_ideafactory_tid2dds_dds2tid.zip [4.42 KiB]
Downloaded 81 times
File comment: For Noesis: exports in DXT with 0x8 flag aren't flipped vertically but RGBA are.
tex_IdeaFactory_tid.zip [1.44 KiB]
Downloaded 33 times
File comment: Amended
TID.png [30.51 KiB]
Not downloaded yet


Last edited by TheUkrainianBard on Sat Apr 28, 2018 6:41 pm, edited 5 times in total.
Top
   
PostPosted: Sat Apr 28, 2018 2:53 am 

Joined: Thu Apr 26, 2018 10:34 pm
Posts: 4
Thank you for your help understanding the TID headers and getting started!

I took your recommendation to change the first 128 bytes from the dds file to the tid file, but the image now looks like this (when extracted):

Image
I tried to edit the morton swizzle hex as you said, but unfortunately nothing happened, unless I am doing it incorrectly. I can provide the tools I am using if it would help?

Now, when I change the first 128 characters of the original .tid file do the dds header, I get the following:

DDS - Swizzle:
Image

Original Image:
Image

Would anyone have a tool to unswizzle and swizzle the above images? If more files are needed, I can provide them.


Attachments:
body_c.png [179.68 KiB]
Not downloaded yet
body_c.png [121.03 KiB]
Not downloaded yet
body_c.png [225.77 KiB]
Not downloaded yet
Top
   
PostPosted: Sat Apr 28, 2018 9:45 am 

Joined: Sun May 01, 2016 10:06 pm
Posts: 78
First image looks normal for a Morton order unswizzling done one too many times.
Second is what it looks like if you don't unswizzle a swizzled image.

Try setting 0x98 for Flags in the source of your post's first image.
Maybe Vita will eat it up.


Top
   
PostPosted: Sat Apr 28, 2018 6:08 pm 

Joined: Thu Apr 26, 2018 10:34 pm
Posts: 4
I've attemtped to change the flag to 0x98, but the image is still scrambled.
I have attached the .tid file also (in zip).

Image

I repacked the files, and it worked, but the image is like the morton swizzled image (1st image).
Image


Attachments:
body_c.zip [75.64 KiB]
Downloaded 21 times
Capture.PNG [26.14 KiB]
Not downloaded yet
2018-04-28-135845.png [859.24 KiB]
Not downloaded yet
Top
   
PostPosted: Sat Apr 28, 2018 6:20 pm 

Joined: Sun May 01, 2016 10:06 pm
Posts: 78
You've changed the wrong value though. Flags are at 0x03.
I've also updated my first reply.


Top
   
PostPosted: Sat Apr 28, 2018 8:46 pm 

Joined: Thu Apr 26, 2018 10:34 pm
Posts: 4
Ah my mistake!
The tis2dds / dds2tid bms works very well; I tried it in game and it came out perfectly.

Thank you very much!

I'll let you know if I run into any snags


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 7 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited