Important information: this site is currently scheduled to go offline indefinitely by end of the year.

[Mobile] Kingdom Hearts Unchained file archives

The Original Forum. Game archives, full of resources. How to open them? Get help here.
thethiny
beginner
Posts: 29
Joined: Sun Aug 07, 2016 1:57 am
Has thanked: 3 times
Been thanked: 5 times

Re: [Mobile] Kingdom Hearts Unchained file archives

Post 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
Azurfan
advanced
Posts: 61
Joined: Wed Jun 23, 2010 10:12 pm
Has thanked: 23 times
Been thanked: 3 times

Re: [Mobile] Kingdom Hearts Unchained file archives

Post by Azurfan »

Tremendous work thethiny, the converter works really well. :D
thethiny
beginner
Posts: 29
Joined: Sun Aug 07, 2016 1:57 am
Has thanked: 3 times
Been thanked: 5 times

Re: [Mobile] Kingdom Hearts Unchained file archives

Post 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.
Azurfan
advanced
Posts: 61
Joined: Wed Jun 23, 2010 10:12 pm
Has thanked: 23 times
Been thanked: 3 times

Re: [Mobile] Kingdom Hearts Unchained file archives

Post 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.
thethiny
beginner
Posts: 29
Joined: Sun Aug 07, 2016 1:57 am
Has thanked: 3 times
Been thanked: 5 times

Re: [Mobile] Kingdom Hearts Unchained file archives

Post 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.
Azurfan
advanced
Posts: 61
Joined: Wed Jun 23, 2010 10:12 pm
Has thanked: 23 times
Been thanked: 3 times

Re: [Mobile] Kingdom Hearts Unchained file archives

Post 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.
User avatar
Rhaes
n00b
Posts: 15
Joined: Fri Sep 09, 2016 5:19 am
Has thanked: 2 times

Re: [Mobile] Kingdom Hearts Unchained file archives

Post 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:
thethiny
beginner
Posts: 29
Joined: Sun Aug 07, 2016 1:57 am
Has thanked: 3 times
Been thanked: 5 times

Re: [Mobile] Kingdom Hearts Unchained file archives

Post 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.
Azurfan
advanced
Posts: 61
Joined: Wed Jun 23, 2010 10:12 pm
Has thanked: 23 times
Been thanked: 3 times

Re: [Mobile] Kingdom Hearts Unchained file archives

Post by Azurfan »

It's seems the file format was changed, at least for the JP version.

http://sabercathost.com/H57/2016101305.mp4
thethiny
beginner
Posts: 29
Joined: Sun Aug 07, 2016 1:57 am
Has thanked: 3 times
Been thanked: 5 times

Re: [Mobile] Kingdom Hearts Unchained file archives

Post 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.
nmylogan
ultra-n00b
Posts: 1
Joined: Tue Nov 15, 2016 6:41 am

Re: [Mobile] Kingdom Hearts Unchained file archives

Post 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?
thethiny
beginner
Posts: 29
Joined: Sun Aug 07, 2016 1:57 am
Has thanked: 3 times
Been thanked: 5 times

Re: [Mobile] Kingdom Hearts Unchained file archives

Post by thethiny »

The new toolsets are now available to download at my github.
https://github.com/thethiny/Modding-Dat ... /DecryptV2 - January 19 2017
Aredo
ultra-n00b
Posts: 2
Joined: Wed Jul 21, 2010 4:42 pm

Re: [Mobile] Kingdom Hearts Unchained file archives

Post 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.
thethiny
beginner
Posts: 29
Joined: Sun Aug 07, 2016 1:57 am
Has thanked: 3 times
Been thanked: 5 times

Re: [Mobile] Kingdom Hearts Unchained file archives

Post by thethiny »

Give me time and I'll try. I upgraded to Android 7.1.1 so I can't play anymore.
Aredo
ultra-n00b
Posts: 2
Joined: Wed Jul 21, 2010 4:42 pm

Re: [Mobile] Kingdom Hearts Unchained file archives

Post by Aredo »

Ok, thank you for fast answer. I'll wait for update from your side.
Post Reply