Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Mon Nov 19, 2018 8:58 am

All times are UTC

Post new topic  Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Sun Sep 09, 2018 1:19 pm 

Joined: Wed Feb 24, 2016 11:08 am
Posts: 26
Hey Guys,

I want to translate a chinese/korean Game for Nintendo Switch.
I'm already able to translate all texts ingame, but I don't have access to the textures yet.

I've uploaded all files inside /romfs/textures folder.
This files are nltx files, most likely containing all the textures of the Game.

Here's the Downloadlink:
https://mega.nz/#!FvxTHC6Y!RikHiRHE3mEs ... XdULKcBMa4

Can someone help me extracting/converting the Textures + reimport them?

PostPosted: Sun Sep 09, 2018 5:55 pm 

Joined: Fri Sep 07, 2018 1:37 pm
Posts: 10
Here's something that might work.

First off, nltx.bms will convert .nltx to .dds, which you can then edit. Unfortunately, the conversion takes a while. You'll want to keep the result as .dds, because we need uncompressed pixel data, but also because I wrote the reimporter for .dds :P

Now, the next part is a bit tricky. The game uses "YKCMP" compression, which thankfully somebody already reverse-engineered online, but it doesn't have a decent compressor, and writing one seems to be a bit of an investement. We can, however, naively convert .dds back to this YKCMP format, except that the result will not be compressed at all, and in total your textures will take twice as much space.

yk_compress.bms takes .dds files, performs that naive compression and gives you .yk files. Then you have to open the original .nltx file in your favorite hex editor and replace everything after offset 0x80 with the contents of that .yk file. It's also not clear if the game will even accept these naively recompressed files, so I suggest you try it on one texture first, load it into the game and see if it functions.

Good luck!

yk_compress.bms [985 Bytes]
Downloaded 17 times
nltx.bms [1.82 KiB]
Downloaded 19 times

Last edited by iltrof on Sun Sep 09, 2018 11:00 pm, edited 1 time in total.
PostPosted: Sun Sep 09, 2018 9:39 pm 

Joined: Wed Feb 24, 2016 11:08 am
Posts: 26
iltrof wrote:

It works like a charm!
I can extract the dds files, edit them and recompress them with the method you've explained and they work perfectly ingame! <3

Well, I can translate this files now, but I'm still missing textures of the Game.
I thought they would be in the nltx files but it isn't like this.

There's another file format which I've found in the romfs of the game.
I believe they could contain textures.

Do you mind looking into this files?
https://mega.nz/#!cuhW0KwR!OlUvRXAt-bzj ... Yt716OrjrM

PostPosted: Sun Sep 09, 2018 10:56 pm 

Joined: Fri Sep 07, 2018 1:37 pm
Posts: 10
Glad the reimporting worked! Maybe as a personal challenge I'll even try to implement the actual compression, so that your files' size doesn't explode like that.

As for the .fad files, it seems like they have a lot of specific info in them, and I can't really make sense of it. They do contain a bunch of YKCMP archives though. I extracted some, but if I try to represent them graphically, I just get a bunch of random dots or vertical lines. It appears to me that none of these YKCMP archives contain any textures, and the .fad's don't seem to have any room left to store the textures in any other fashion.

Here's the kind of randomness I'm looking at:

Well, I could be missing something, but you may be out of luck with these .fad's.

Upd: looked at the game files for PS Vita, which only seem to be differently compressed. That doesn't have anything to do with anything though. :P

However, I see that there's a lot of these .fad files, and it doesn't look like the textures could be anywhere else, either. I guess I'll try making a script for extracting all of the YKCMP archives from your files & saving them as .dds. You'll have to look through them manually though. I also don't know where I'd look for the image dimensions, but I'll give it a go, at least.

Upd2: ok, here we go. Excuse the file being an .exe: I felt more comfortable making it in C++ than in bms, and now it's also instant, so you won't have to wait for an extra hour. Just drop it into the folder with .fad's and run it - it will extract every YKCMP it can find into separate folders. For each one you'll get a .dmp with raw contents and a .dds with the squarest image size.

You can also do "fadEx 10000.fad" to just extract one .fad, and "fadEx 10000.fad 7" to only extract the 7th archive from that .fad.

Finally, say, you're scrolling through the .dds'es and you see something that resembles a texture, but its size is incorrect. If, for example, you are looking at /10000/7.dds, you can run "fadEx 10000.fad 7 -a", and it will generate .dds'es of all viable sizes for that texture, placing them in /10000/7/*.dds

I looked through all three of the files you provided, and managed to find one texture, whatever it's supposed to be (#11 in 199995.fad):

So, maybe, you'll be able to find something after all. That just leaves reimporting, and it won't be easy...

fadEx.zip [28.01 KiB]
Downloaded 10 times
PostPosted: Mon Sep 10, 2018 3:24 pm 

Joined: Wed Feb 24, 2016 11:08 am
Posts: 26
iltrof wrote:


I've tried some of the other fad-files, the dds files are the same as the one you've shown me.
But I really think that this are really textures, I can see something "image like" on these, but obfuscated


Probably something needs to be done with the offset or something?
I'm not that good with graphic types, so :S

I can't find any other files were the ingame textures could be.
There's also romfs/stage, but this are the levels. For textures, the filesizes are way too small.

Probably you know how to "fix" these images?

PostPosted: Mon Sep 10, 2018 4:38 pm 

Joined: Fri Sep 07, 2018 1:37 pm
Posts: 10
Sorry, I really don't know what to try from this point on :(

I mean, the files do have patterns, so there's likely more to them than I'm seeing, but I just don't know what to do with these patterns.
It doesn't look like the images are chunked - you'd at least see normally connected pixels instead of this colorful mess. They don't really look compressed or encrypted by some conventional algorithm either.
I even tried taking every 4th byte/pixel thinking it would look better, but the result doesn't look any less obfuscated.

So, for now, I have no idea how to "fix" these, if these even are images; maybe somebody else should take a look.

PostPosted: Mon Sep 10, 2018 5:42 pm 

Joined: Wed Feb 24, 2016 11:08 am
Posts: 26
iltrof wrote:

You're right.
I don't have a clue either :S
Hopefully someone else is able to figure this out ;-;
Thank you for your work anyways! The textures (nltx) work pretty fine ingame after modifiying them :D
That's a big step forward

PostPosted: Sat Sep 15, 2018 7:52 pm 

Joined: Fri Sep 07, 2018 1:37 pm
Posts: 10
Finally figured out the extraction, I think. Here's the new exe.
Couple of layers of complexity here:

1) fads contain YKCMP archives with textures.
2) The textures are either compressed with bc1_unorm, bc3_unorm, or contain uncompressed RGBA. At least that's true for the three fads you gave me. All three are supported by dds, so we don't need to uncompress the data; we just have to change the dds header accordingly.
3) Furthermore, the textures are swizzled (rearranged). People have already reverse-engineered the algorithm for Switch, so I basically just adapted this code for the final step. In the fads you gave me I saw three different kinds of this swizzling.

Now, before I start working on reimporting, I want you to test that every texture is extracted properly. We don't want to have any surprises later. After all, there might be other compressions/swizzles in the rest of fad files; I can only say it works for the three fads I have.
If the extractor gives an error or just crashes, please give me the fad that broke it - you'll know which one that is.
Even if it doesn't crash, please look at all textures yourself to make sure they aren't weird or anything.

Once again, you can put fadEx.exe in the folder with all fads and just run it - it will extract everything. You can also do "fadEx 10000.fad" to just extract that one fad.
Be aware that fadEx will overwrite results of previous extractions, so copy the textures to some other location before modifying them, just in case.
For reimporting I'm planning to use the same folder structure fadEx uses, and it will also expect the same filenames. So please don't change the filenames :)

Also, I don't know which program you use to modify the dds files, but you might want to check if it preserves the compression. I expect it would, but better be safe ;)
If you open one of the extracted dds files in a hex editor, you will likely see DXT5 at offset 0x54 (meaning it's compressed with bc3_unorm). You can then modify the dds and see if that DXT5 is still there after modification. If it is, everything's good.
(I say "might", but please do check and tell me if the compression stays the same)

fadEx.zip [29.77 KiB]
Downloaded 13 times
PostPosted: Sat Sep 15, 2018 8:08 pm 

Joined: Wed Feb 24, 2016 11:08 am
Posts: 26
Oh shit!
you're a genious!!

It works on all .fad files of the game <3
Preserving the compressions isn't a problem.
The NintendoSDK has a Executable which converts the dds in a dds with a compression I want.
I've sent you a Screenshot of the compression types via PM.

Now I just need a way to rebuild this fad files and we're gold!
We're able to completely mod the game, even the textures we weren't able to translate until now <3

iltrof wrote:

I've uploaded two dds files.
One of them is the original one, the other one is the translated one.
Both should be DX5 now, same file size. :D
SO editing the files isn't a problem

10000.zip [1.25 MiB]
Downloaded 9 times
PostPosted: Sun Sep 16, 2018 8:45 pm 

Joined: Fri Sep 07, 2018 1:37 pm
Posts: 10
After finishing reimporting, I realised I gave you the wrong fadEx :/
Well, it's not really wrong, but I decided to change the way filenames are generated at the last second and forgot to put it in the archive again.
The new fadEx is in the attachment. Sorry, you'll have to reextract everything. Also, for the textures you've already modified: don't forget to change their filenames as well (just use the names fadEx gives them).

The attachment also contains fadIm, which lets you import .dds back into .fad.
You have two options:
1) Run it like "fadIm 10000.fad -a". Then it will look at every .dds inside the folder called "10000" and import them into 10000.fad. (Doesn't have to be all of the textures. It will keep the original ones inside the .fad if they are not in the folder.)
2) Run it like "fadIm 10000.fad texture.dds". Then it will import that single .dds into the .fad.

Again, as mentioned before, fadIm needs the textures' names to be the same as what fadEx (the new fadEx) generates. fadIm will silently ignore all filenames that look wrong, so don't change them.

Of course, like always, test it and tell me if it works :P
I only know that fadEx will properly extract .fad's generated by fadIm. I can't be sure I'm changing all offsets/sizes properly, so it's up to you to check if the game accepts the new .fad's.

To get you started: take the title screen you translated yesterday and change its name to "0_8_3_4.dds" (this is what the new version of fadEx generates).
Then run "fadIm 10000.fad 0_8_3_4.dds". It will make a new .fad with that modified texture inside.
Try putting it into the game. If it accepts it, then we're golden ;)

fads.zip [61.59 KiB]
Downloaded 6 times
PostPosted: Sun Sep 16, 2018 9:44 pm 

Joined: Wed Feb 24, 2016 11:08 am
Posts: 26
iltrof wrote:

Hell ya, you're the best!!!
I reextracted the 10000.fad and reimported the modified title screen.
The Game doesn't crash, there are no visible bugs aaaaand:



Gonna post better screenshots tomorrow (it's 11:44pm here, gonna go to sleep now^^)

Thank you soooooo much for this!

Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 11 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