XeNTaX Forum Index
Forum MultiEx Commander Tools Tools Home
It is currently Mon Oct 15, 2018 2:55 pm

All times are UTC + 1 hour


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: [PS3] Ninja Gaiden 1 & 2 Sigma Texture Format
PostPosted: Wed Nov 22, 2017 3:17 am 
Offline
ultra-veteran
ultra-veteran

Joined: Wed Dec 14, 2011 5:46 pm
Posts: 338
Has thanked: 139 times
Have thanks: 115 times














You can make the ads go away by registering

I figured out a method to extract GXT textures from the Vita version of Ninja Gaiden Sigma 2. Since they are low resolution I'm looking to employ similar tricks to the PS3 format. I know where the image data is, I just don't know the format. In previous cases I needed the image header, either gxt or dds. For these files, I don't see any header information, so I'm guessing I need to find the headers or need to know what header data to put in front of the data. Could someone please help me identify the format of the images or identify what I'm looking for in terms of header data?

Thanks!

Sample Files: http://www.mediafire.com/file/2b4gfetq7 ... lNinja.zip

ImageImage

The gmd contains the local offset inside the ttgl. The gmd also includes the length of the image data. The ttgl contains the image data.


Last edited by Protocol X27 on Sat Dec 09, 2017 3:56 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: [PS3] Ninja Gaiden 2 Sigma Texture Format
PostPosted: Wed Nov 22, 2017 10:06 am 
Offline
VIP member
VIP member
User avatar

Joined: Wed Nov 05, 2008 12:16 pm
Posts: 1106
Has thanked: 2221 times
Have thanks: 625 times
the ttg in gmd has 3 sections of info, the first contains the offsets, the second contains the datasize and the last contains format
and width and height and strings. The first byte of that 32 byte stride last section is the format, 0x88 == dxt5 and 0x86 == dxt1. :D

edit
the image data actually starts at 0x100 in the ttgl, so the offsets are not absolute it seems, add 0x80 to each

edit2
here is Noesis python script that will open the textures from your sample :D
*script updated December 19, 2017*

supports DXT1, DXT3, DXT5 and ARGB32 swizzled formats
you must have the gmd and ttgl pair in same folder, then open the gmd file.


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.


_________________
Noesis
Hex2obj
QuickBMS
Asset Studio
TextureFinder


Last edited by AceWell on Wed Dec 20, 2017 3:31 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: [PS3] Ninja Gaiden 2 Sigma Texture Format
PostPosted: Wed Nov 22, 2017 2:38 pm 
Offline
ultra-veteran
ultra-veteran

Joined: Wed Dec 14, 2011 5:46 pm
Posts: 338
Has thanked: 139 times
Have thanks: 115 times
Holy Cow! Wow, Thanks, AceWell! You went the extra mile, in creating the plugin too! Glad I was more specific in my questions than usual, lol.

So since the third TTD block just had basic info & dxt1/dxt5 flags, I still would have had craft the DDS header myself? I looked at your plugin. I'm not that skilled with Noesis stuff, but it looks like it's leveraging Noesis' code to generate the textures? Just trying to expand my knowledge to better understand this stuff.

Thanks again, exceeded expectations and saved me a bit of time on restructuring on of my own scripts. :bravo:

Edit:
Shoot, it would figure the one sample wasn't a good baseline... :( All the other files I'm trying are crashing. Here's what I've found by tinkering with the plugin.

Most other files have this happen:

Image

Since it's a print line, if I comment it out, I get this.

Image

I noticed that some files do have 0x85 for a file type. Might that be DXT3 or alternate DXT with/without alpha channel?

I'm going to attempt to identify the issue, but I'm rather slow at this since I haven't worked with Noesis plugins before? Can I get the print lines to show in a console somehow? Only recourse I have at the moment is to Save > Reload Plugins> 'Hope for the best'

Here are some other file samples: https://www.mediafire.com/file/s7dacdlf ... amples.zip

Edit 2:
In the case of r_rei_a.gmd it looks like the image data is split between the gmd/ttgl. The Vita files did this, so unfortunately not surprising, but in that case all images were in one file or the other, not divided... need to figure out if there's a flag to determine which file holds each image because offsets appear to be mixed. :-/


Top
 Profile  
 
 Post subject: Re: [PS3] Ninja Gaiden 2 Sigma Texture Format
PostPosted: Thu Nov 23, 2017 1:16 am 
Offline
VIP member
VIP member
User avatar

Joined: Wed Nov 05, 2008 12:16 pm
Posts: 1106
Has thanked: 2221 times
Have thanks: 625 times
yeah one sample rarely is ever enough to reverse correctly :D
uncomment line 7 in the script and reload to bring up the console to see print.
i will investigate this format 0x85 :D

_________________
Noesis
Hex2obj
QuickBMS
Asset Studio
TextureFinder


Top
 Profile  
 
 Post subject: Re: [PS3] Ninja Gaiden 2 Sigma Texture Format
PostPosted: Thu Nov 23, 2017 2:06 am 
Offline
veteran

Joined: Fri Oct 16, 2015 8:05 pm
Posts: 125
Has thanked: 2 times
Have thanks: 65 times
AceWell wrote:
i will investigate this format 0x85 :D


i don't endian so well, but looks like ATI2 format


Top
 Profile  
 
 Post subject: Re: [PS3] Ninja Gaiden 2 Sigma Texture Format
PostPosted: Thu Nov 23, 2017 4:06 am 
Offline
ultra-veteran
ultra-veteran

Joined: Wed Dec 14, 2011 5:46 pm
Posts: 338
Has thanked: 139 times
Have thanks: 115 times
Thanks, guys!

I did more tinkering and I've managed to gut the data of one sample manually and combine with proper DXT1/DXT5 headers, so it'll be quicker for me to write a dump routine since I don't know the noesis library as well. I'm getting close, and if I'm on the right track the only thing that'd be missing is whatever that 0x85 format is. If is is indeed ATI2 would it have a different file header format?

I did find that byte 0xE in each of the header strides identifies the file that contains the data. if its 0x00 then the data is in the ttgl. If its 0x01 then it's in the gmd.


Top
 Profile  
 
 Post subject: Re: [PS3] Ninja Gaiden 2 Sigma Texture Format
PostPosted: Thu Nov 23, 2017 4:10 am 
Offline
VIP member
VIP member
User avatar

Joined: Wed Nov 05, 2008 12:16 pm
Posts: 1106
Has thanked: 2221 times
Have thanks: 625 times
i couldn't get anything decent with ATI2, but morton swizzled raw looks good :D
Code:
        elif imgFmt == 0x85:
            untwid = bytearray()
            for x in range(0, imgWidth):
                for y in range(0, imgHeight):
                    idx = noesis.morton2D(x, y)
                    untwid += data[idx*4:idx*4+4]
            data = rapi.imageDecodeRaw(untwid, imgWidth, imgHeight, "a8 r8 g8 b8")
            texFmt = noesis.NOESISTEX_RGBA32


_________________
Noesis
Hex2obj
QuickBMS
Asset Studio
TextureFinder


Last edited by AceWell on Wed Dec 20, 2017 12:57 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: [PS3] Ninja Gaiden 2 Sigma Texture Format
PostPosted: Thu Nov 23, 2017 5:45 am 
Offline
ultra-veteran
ultra-veteran

Joined: Wed Dec 14, 2011 5:46 pm
Posts: 338
Has thanked: 139 times
Have thanks: 115 times
Oiy, I'm so close. Glad you found the proper format. Ok, so down to the last thing... what does the header look like for that format? At least with a working container I could see the DXT1/5 headers as a reference, but since the plugin doesn't yet like having images divided, I can't get Noesis to export me one of that type. I'll have to dig for a pair of files that has them all in the ttgl and include at least one 0x85.

Here's what I have so far. It's working on both standard & mixed types. After opening both files it'll dump all textures, but of course the 0x85's aren't correct. My code isn't very sophisticated, so I have some things hard coded since I'm still learning how to dissect all this stuff.

https://www.mediafire.com/file/wrnj7rba ... r_V0.9.zip


Top
 Profile  
 
 Post subject: Re: [PS3] Ninja Gaiden 2 Sigma Texture Format
PostPosted: Mon Nov 27, 2017 7:38 pm 
Offline
ultra-veteran
ultra-veteran

Joined: Wed Dec 14, 2011 5:46 pm
Posts: 338
Has thanked: 139 times
Have thanks: 115 times
Ok, I guess this constitutes an official release. I've been able extract everything to suit my needs, so I'm not pouring a ton of time into a Noesis plugin, but what I came up with is a bit of a clunky multi step process. All textures that aren't ripped as DDS will output as '.ngs'. I managed to cobble together a watered down version of the Noesis plugin that will read just the '.ngs' format and use the provided samples to make them viewable in Noesis, and by that, extractable. I've only found a couple characters so far that even have the RGBA32 textures, and of those it's a small percentage of the overall textures. In most cases they are normal maps.

Ninja Gaiden Sigma 2 PS3 DDS Ripper & Custom Noesis plugin: https://www.mediafire.com/file/m7myca7e ... r_V1.0.zip

Thank you so much for the assist, AceWell! I never would have made sense of the header or stumble across the swizzle algorithm without the samples to follow. :D


Top
 Profile  
 
 Post subject: Re: [PS3] Ninja Gaiden 2 Sigma Texture Format
PostPosted: Sat Dec 09, 2017 3:56 pm 
Offline
ultra-veteran
ultra-veteran

Joined: Wed Dec 14, 2011 5:46 pm
Posts: 338
Has thanked: 139 times
Have thanks: 115 times
I got some motivation to work on Ninja Gaiden Sigma 1. Thankfully much of the data is the same, so I only had to adjust some things for my script. One snag though is another image format. This one contains mostly 86/88 DXT1/5 stuff, but now there is a 0x87 image type.

AceWell, or anyone knowledgeable, any chance you could help parse that one like with the 0x85? Please :)

I have included two sample file sets that have 0x87's in them. Like before, the TMC has the header data, the TTX has the image data. The file is not actually a TTX extension, I just had to call it something since there was no extension in the header of the original file when unpacked. I have also included my script in its current state which will dump all dds. 0x87's will dump to .ngs like with my previous script with just the header data & image data in case this any way a time saver to get right to the guts needed to parse the format.

https://www.mediafire.com/file/gef47cp9 ... amples.zip


Top
 Profile  
 
 Post subject: Re: [PS3] Ninja Gaiden 1 & 2 Sigma Texture Format
PostPosted: Sat Dec 09, 2017 10:45 pm 
Offline
VIP member
VIP member
User avatar

Joined: Wed Nov 05, 2008 12:16 pm
Posts: 1106
Has thanked: 2221 times
Have thanks: 625 times
the 0x87 types look like dxt3 to me :D

_________________
Noesis
Hex2obj
QuickBMS
Asset Studio
TextureFinder


Top
 Profile  
 
 Post subject: Re: [PS3] Ninja Gaiden 1 & 2 Sigma Texture Format
PostPosted: Sat Dec 09, 2017 11:05 pm 
Offline
ultra-veteran
ultra-veteran

Joined: Wed Dec 14, 2011 5:46 pm
Posts: 338
Has thanked: 139 times
Have thanks: 115 times
Terrific!! Looks like that worked. Thank you so much. :D

btw, Ace, I saw that I couldn't send you a PM. Any way I can throw something your way for your time. I really appreciate the help.


Top
 Profile  
 
 Post subject: Re: [PS3] Ninja Gaiden 1 & 2 Sigma Texture Format
PostPosted: Wed Dec 20, 2017 3:36 am 
Offline
VIP member
VIP member
User avatar

Joined: Wed Nov 05, 2008 12:16 pm
Posts: 1106
Has thanked: 2221 times
Have thanks: 625 times
just knowing that it works is good enough for me :D

and since i don't like leaving incomplete scripts posted i have updated my previous Noesis python script here with your findings :D
viewtopic.php?p=135533#p135533

_________________
Noesis
Hex2obj
QuickBMS
Asset Studio
TextureFinder


Top
 Profile  
 
 Post subject: Re: [PS3] Ninja Gaiden 1 & 2 Sigma Texture Format
PostPosted: Thu Dec 21, 2017 4:01 pm 
Offline
ultra-veteran
ultra-veteran

Joined: Wed Dec 14, 2011 5:46 pm
Posts: 338
Has thanked: 139 times
Have thanks: 115 times
Thank you! You are a true community team player. I'm glad to having some working utils for a game I wasn't sure that extraction would happen for.

Awesome stuff, I'm sure the Noesis route will be helpful for any more keen on that over my roundabout methods. :D

Alternate topic, do you work with mesh extraction as well or just stick to graphic formats? I have one last game on my to do list which has been challenging due to the age & irregular format (ie Original Xbox/MGF format). My success at enlisting help in the past has been a challenge.


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


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:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group