Page 3 of 4

Re: [Mobile] Kingdom Hearts Unchained file archives

Posted: Mon Aug 08, 2016 11:50 pm
by thethiny
Azurfan wrote:Thanks for the tool thethiny, being able to back up your savedata manually is always nice.

In other news reddit user ebaroni83 found out how the so-called PNG files are structured: https://www.reddit.com/r/KingdomHearts/ ... ta_in_png/

The custom header contains the image's width at 0x12 and height at 0x16 while the body of the image (starting at 0x26) is compressed with zlib and consists of a "non-compliant bitmap", as he puts it, which has to be flipped horizontally & vertically and the red & blue color channel have to be switched as well to get the correct result.
You're welcome ^_^

Edit: I've released a tool that converts the PNGs to BMPs, R/B Issue fixed along with upside down images.
https://github.com/thethiny/Modding-Dat ... Ux/PNG2BMP

Re: [Mobile] Kingdom Hearts Unchained file archives

Posted: Tue Aug 09, 2016 7:43 am
by Azurfan
Tremendous work thethiny, the converter works really well. :D

Re: [Mobile] Kingdom Hearts Unchained file archives

Posted: Tue Aug 09, 2016 8:30 am
by thethiny
I'm really glad it does :D
Some images won't convert well, all you have to do is open them with a Hex editor and you're gonna find 0x20 somewhere after FF FF replace it with 0x04.

Re: [Mobile] Kingdom Hearts Unchained file archives

Posted: Thu Aug 11, 2016 11:36 am
by Azurfan
I hadn't any problems with that yet but I've noticed that there are many 4Byte files all around the extracted archives which seem to have the correct file name but not even the beginning of a header and then there are files which seem to be prematurely cut off, but these are far less common. This happens for audio, graphic and text files so maybe there is still some kind of file structure in there that gets in the way of the extraction process.

Re: [Mobile] Kingdom Hearts Unchained file archives

Posted: Thu Aug 11, 2016 10:27 pm
by thethiny
What do you mean exactly? I know that there are very short files which my tool automatically excludes. I think they're headers only and their files are somewhere else. Or they're some sort of counter.

Re: [Mobile] Kingdom Hearts Unchained file archives

Posted: Sat Aug 13, 2016 9:19 pm
by Azurfan
It's not your tool that is causing the problem, it already exists after using MayBeePah's khuxdecrypt. Maybe that's a problem on my end but from the roughly 186,000 files that can be extracted from the newest Japanese version around 83,400 are only 4 byte large and headerless despite having a seemingly correct file name. The last two bytes for these files are either 00 00 or FF FF.

Re: [Mobile] Kingdom Hearts Unchained file archives

Posted: Fri Sep 09, 2016 5:30 am
by Rhaes
I hope this isn't too much of a necro...

I'm looking for a way to extract the data of the game, such as the avatar parts, keyblades, medal icons etc. Is this at all possible?

Anyways, thanks for reading! :D

EDIT

Solution found! Thanks to thethiny for all the help! :keke:

Re: [Mobile] Kingdom Hearts Unchained file archives

Posted: Fri Sep 16, 2016 9:48 pm
by thethiny
MayBeePah wrote:Sorry, I've been busy and I forgot to work on Unchained.
I haven't got time at the moment to continue but here's the decryption algorithm if anyone wants to try:

Code: Select all

#define BGADMagic 0x44414742
Hi again all :D
Based on MayBeePah's code for Decrypting the files, I reverse engineered it and now I made a tool to RePack!
https://github.com/thethiny/Modding-Dat ... HUxEncrypt
It handles single BGADs, so if you have a BGAD with loads of file, then you will need to manually inject the BGAD back. I still don't know how the png table works, so for now use this tool and make sure that the file sizes remain the same! If it's larger, shrink it. If it's smaller, fill it with Stub Zeros. For the PNG files you will need the MD5 hash of the file which is easy, just extract the BGAD then use HxD to get the MD5 hash and store it in a file and add it back to the PNG. This tool is most useful for the banner files (/data/data/com.square_enix.android_googleplay.khuxww/cache/).

Enjoy :D


Edit: I've also updated my tool to allow for even more PNG files to be converted.

Re: [Mobile] Kingdom Hearts Unchained file archives

Posted: Thu Oct 13, 2016 2:25 pm
by Azurfan
It's seems the file format was changed, at least for the JP version.

http://sabercathost.com/H57/2016101305.mp4

Re: [Mobile] Kingdom Hearts Unchained file archives

Posted: Fri Oct 14, 2016 11:21 am
by thethiny
Azurfan wrote:It's seems the file format was changed, at least for the JP version.

http://sabercathost.com/H57/2016101305.mp4
The game can load both the previous files and the new files, which means that there's something somewhere that tells the game which method to use to read the names. It has to be in the files themselves.

Re: [Mobile] Kingdom Hearts Unchained file archives

Posted: Tue Nov 15, 2016 6:45 am
by nmylogan
sorry to revive an old topic but is there a way for a layman to use or learn this? maybe a video I could follow to get this working?

Re: [Mobile] Kingdom Hearts Unchained file archives

Posted: Thu Jan 19, 2017 5:19 am
by thethiny
The new toolsets are now available to download at my github.
https://github.com/thethiny/Modding-Dat ... /DecryptV2 - January 19 2017

Re: [Mobile] Kingdom Hearts Unchained file archives

Posted: Sat Jan 28, 2017 10:51 am
by Aredo
Hi, just checked khuxDecryptV2. It can't decrypt *.jpg files in "files/m" folder. I tried on versions of archives from current verison ( 1.2.3 ) of the game.
Can you please check the decryption of those files? Was the decryption algorithm different before? Or is it different for "mp4" and "jpg"?
By the way, "/files/r/misc.mp4" is decrypted ok.

Re: [Mobile] Kingdom Hearts Unchained file archives

Posted: Sat Jan 28, 2017 12:39 pm
by thethiny
Give me time and I'll try. I upgraded to Android 7.1.1 so I can't play anymore.

Re: [Mobile] Kingdom Hearts Unchained file archives

Posted: Sat Jan 28, 2017 12:59 pm
by Aredo
Ok, thank you for fast answer. I'll wait for update from your side.