Kingdom Hearts Unchained seems to use two files to store almost all gameplay elements: misc.mp4 and misc.png. The files originally used in the install archive are enlarged whenever there is an update, the post-installation file download increases their size a hundred times.
The question is how they work, the smaller file is probably referencing stuff in the bigger one, but beyond that I'm clueless where to start.
Since the game is free2play it shouldn't be a problem linking these two files (ca. 20 MB) here:
http://www10.zippyshare.com/v/YhnYeNaS/file.html
The original apk file containing these files can be downloaded here:
https://apkpure.com/store/apps/details? ... lay.khuxww
If there is interest in the larger post-installation files (over 1 GB), I could upload them too.
Important information: this site is currently scheduled to go offline indefinitely by end of the year.
[Mobile] Kingdom Hearts Unchained file archives
Re: [Mobile] Kingdom Hearts Unchained file archives
What more can I say than, PLEASE FOR THE LOVE OF GOD, POST THE FILES. I've spent the entire time since the NA version came out trying to figure out how to get it on my phone, and long story short, I need the post-install files. All of it. The entire "data/data/com" square enix whatever folder. Also, PLEASE don't make an account/avatar before exporting the files, because the account and save data carries over inside of the misc.mp4 file, and I could not find a way to delete said account by itself. I found an upload of all the files by someone on some jank, ad-filed website I don't care to remember the name of, only to get screwed over by that revelation. It needs to be clean, so people savvy enough to go through the process can go right in on their own accounts.
- MayBeePah
- advanced
- Posts: 44
- Joined: Mon Oct 06, 2014 7:22 am
- Has thanked: 1 time
- Been thanked: 30 times
Re: [Mobile] Kingdom Hearts Unchained file archives
The misc.mp4 file contains multiple archives
To get the next archive in the misc.mp4 file, just keep adding an offset of headerSize + extensionSize + dataSize
Example C code: https://db.tt/dMIdazju
Hope this helps a bit
Code: Select all
struct BGADArchive {
int magic;
short unk0;
short unk1;
short headerSize;
short extensionSize;
short unk2;
short unk3;
int dataSize;
int unknownSize;
};
Example C code: https://db.tt/dMIdazju
Hope this helps a bit
Re: [Mobile] Kingdom Hearts Unchained file archives
If that was directed towards me, sorry, but I don't know anything about scripting. More to the point, all I want is to copy-paste the full "data/com.squareenix" yada yada whatever folder in directly, because that jank file I mentioned proved to me that the game can recognize the files properly when you do that. Problem is, that file already had an account made, at level 15, no less.MayBeePah wrote:The misc.mp4 file contains multiple archives
To get the next archive in the misc.mp4 file, just keep adding an offset of headerSize + extensionSize + dataSizeCode: Select all
struct BGADArchive { int magic; short unk0; short unk1; short headerSize; short extensionSize; short unk2; short unk3; int dataSize; int unknownSize; };
Example C code: https://db.tt/dMIdazju
Hope this helps a bit
I need a clean folder of files, because misc.mp4 is larger than my phone's entire cache folder, meaning it's impossible for me to download it myself. My phone can't store app data on the external SD Card for some stupid manufacturing cost-saving reason, and I've bricked my phone multiple times trying to do all this ever since the NA version came out. I've asked on KH13, KHInsider, Reddit, and more, but everyone just ignores me, so I'm very annoyed at this point. I just, need, the files, please.
-
- 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
Thank you MayBeePah, I'll try to make sense of it. Were you able to extract one of the archives in the misc.mp4?
@ggbhtg: I uploaded all files here:
http://www.share-online.biz/dl/GE20MF5OETM
http://www.share-online.biz/dl/2KGQOF5OS8O6
http://www.share-online.biz/dl/67HSUF5OQ8X
http://www.share-online.biz/dl/Q2ILXF5O8M
It's four parts because my internet connection is not that good and gets cut sometimes. It's packed with 7-zip, I didn't click on anything after the download started so hopefully this will help you. You could always get these files with an android emulator yourself though.
@ggbhtg: I uploaded all files here:
http://www.share-online.biz/dl/GE20MF5OETM
http://www.share-online.biz/dl/2KGQOF5OS8O6
http://www.share-online.biz/dl/67HSUF5OQ8X
http://www.share-online.biz/dl/Q2ILXF5O8M
It's four parts because my internet connection is not that good and gets cut sometimes. It's packed with 7-zip, I didn't click on anything after the download started so hopefully this will help you. You could always get these files with an android emulator yourself though.
Re: [Mobile] Kingdom Hearts Unchained file archives
THANK. YOU. I can't use an emulator because I don't have my own computer. It's gonna take a while to retrieve on my own crap internet connection, but I'll definitely post my results tomorrow.Azurfan wrote:Thank you MayBeePah, I'll try to make sense of it. Were you able to extract one of the archives in the misc.mp4?
@ggbhtg: I uploaded all files here:
http://www.share-online.biz/dl/GE20MF5OETM
http://www.share-online.biz/dl/2KGQOF5OS8O6
http://www.share-online.biz/dl/67HSUF5OQ8X
http://www.share-online.biz/dl/Q2ILXF5O8M
It's four parts because my internet connection is not that good and gets cut sometimes. It's packed with 7-zip, I didn't click on anything after the download started so hopefully this will help you. You could always get these files with an android emulator yourself though.
Re: [Mobile] Kingdom Hearts Unchained file archives
Ok....unfortunately, I still can't get the game to actually run. Why? Because I get a "logged out due to inactivity" error. If I copy paste in certain files, this error message triggers and locks me into the title screen. Misc.mp4 isn't one of these files, but there's still a big issue here.
Initially, I seemed to circumvent this by installing the game without pasting in your files first, extracted cookieFile.txt, then pasted it over your cookies that seem to just become invalid to the game after a period of time. I've not done research yet to know if this is a known issue. HOWEVER, even though I got the game to run using this fix, and made it all the way to avatar creation and clan selection, the game spontaneously gave me the "inactivity" error anyway.
So right now, I'm trying to figure out which combination of files will actually let the game run, hoping that this isn't caused by that Permission I had to remove in order to get the apk to even install.
The worst part? This error also cause the game's data files to completely self-destruct on my end. That means I have to keep going back and forth on my phone to try different variations of using your files and fresh files from the game to trick itself into running properly...and every time I'm wrong, I have to uninstall and reinstall the app from scratch and twiddle my thumbs while that 1GB misc file transfers.
It also doesn't help that there's a specific file(s) that detects whether you have the misc files and whatever else is in the download. This file decides you don't actually have the download, gives a "storage space error" when you try and start the game, because it wants to download everything from scratch, then blows up all your app's files like the inactivity error.
Initially, I seemed to circumvent this by installing the game without pasting in your files first, extracted cookieFile.txt, then pasted it over your cookies that seem to just become invalid to the game after a period of time. I've not done research yet to know if this is a known issue. HOWEVER, even though I got the game to run using this fix, and made it all the way to avatar creation and clan selection, the game spontaneously gave me the "inactivity" error anyway.
So right now, I'm trying to figure out which combination of files will actually let the game run, hoping that this isn't caused by that Permission I had to remove in order to get the apk to even install.
The worst part? This error also cause the game's data files to completely self-destruct on my end. That means I have to keep going back and forth on my phone to try different variations of using your files and fresh files from the game to trick itself into running properly...and every time I'm wrong, I have to uninstall and reinstall the app from scratch and twiddle my thumbs while that 1GB misc file transfers.
It also doesn't help that there's a specific file(s) that detects whether you have the misc files and whatever else is in the download. This file decides you don't actually have the download, gives a "storage space error" when you try and start the game, because it wants to download everything from scratch, then blows up all your app's files like the inactivity error.
- MayBeePah
- advanced
- Posts: 44
- Joined: Mon Oct 06, 2014 7:22 am
- Has thanked: 1 time
- Been thanked: 30 times
Re: [Mobile] Kingdom Hearts Unchained file archives
I can decrypt and uncompress the archive with names now
But the images and some other files are custom formats (PNGs are compressed). I'll figure them out soon...
But the images and some other files are custom formats (PNGs are compressed). I'll figure them out soon...
You do not have the required permissions to view the files attached to this post.
Re: [Mobile] Kingdom Hearts Unchained file archives
Dumb question, but would it be possible to get the player character body parts(hair, faces, limbs, outfits, etc) extracted? I realized they could probably be used in animations and neat stuff like that.
-
- n00b
- Posts: 14
- Joined: Thu Jul 01, 2010 8:46 pm
- Has thanked: 1 time
Re: [Mobile] Kingdom Hearts Unchained file archives
Could you share more on how you were able to get the file names? The game appears to be using the cocos2d-x sdk. It may use "VP8L" as an image format. I'm not sure if they would use Google's WebP though since it's unconventional.MayBeePah wrote:I can decrypt and uncompress the archive with names now
But the images and some other files are custom formats (PNGs are compressed). I'll figure them out soon...
- MayBeePah
- advanced
- Posts: 44
- Joined: Mon Oct 06, 2014 7:22 am
- Has thanked: 1 time
- Been thanked: 30 times
Re: [Mobile] Kingdom Hearts Unchained file archives
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:
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
int khux_random(int seed) {
return 0x19660D * seed + 0x3C6EF35F;
}
void khux_decrypt(int* data, int length, int key) {
int i = 0;
int count = (length + 3) >> 2;
while (i < count) {
key = khux_random(key);
data[i] ^= key;
i++;
}
}
struct BGAD {
int magic;
short key_type;
short unk;
short header_size;
short name_length;
short data_type;
short is_compressed;
int data_size;
int decompressed_size;
//char name[nameLength];
//char data[dataSize];
/* how to:
decrypt name: khux_decrypt(&name, name_length, data_size)
decrypt data: khux_decrypt(&data, data_size, name_length)
calculate offset to next BGAD file: header_size + name_length + data_size
validate: magic == BGADMagic
after decryption use zlib to decompress:
if (is_compressed) {
void* decompressed_buffer = malloc(decompressed_size);
uncompress(decompressed_buffer, &decompressed_size, &data, data_size)
}
*/
};
- MayBeePah
- advanced
- Posts: 44
- Joined: Mon Oct 06, 2014 7:22 am
- Has thanked: 1 time
- Been thanked: 30 times
Re: [Mobile] Kingdom Hearts Unchained file archives
This should extract every file in the misc.mp4 file
I just made this quickly so tell me if anything went wrong
requires zlib
usage: khux_decrypt .../misc.mp4 .../'directory name'
I just made this quickly so tell me if anything went wrong
requires zlib
usage: khux_decrypt .../misc.mp4 .../'directory name'
Code: Select all
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <zlib.h>
#include <sys/stat.h>
#define BGADMagic 0x44414742
#define BGADSize sizeof(struct BGAD)
#define BGADMaxNameLength 0x100
#define BGADMaxDataSize 0x1000000
#define false 0
#define true 1
#define CatchError(condition) if (condition) { return false; }
#define Read(ptr, size) CatchError(fread(ptr, size, 1, file) != 1)
int khux_random(int seed) {
return 0x19660D * seed + 0x3C6EF35F;
}
void khux_decrypt(int* data, int length, int key) {
int count = (length + 3) >> 2;
for (int i=0; i<count; i++) {
key = khux_random(key);
data[i] ^= key;
}
}
struct BGAD {
int magic;
short key_type;
short unk;
short header_size;
short name_length;
short data_type;
short is_compressed;
int data_size;
int decompressed_size;
};
struct BGADInfo {
struct BGAD header;
void* name;
void* data;
void* decompressed;
};
typedef struct BGADInfo BGADInfo;
void BGADInfoInit(BGADInfo* info) {
info->name = malloc(BGADMaxNameLength);
info->data = malloc(BGADMaxDataSize);
info->decompressed = malloc(BGADMaxDataSize);
}
void BGADDecryptName(BGADInfo* info) {
khux_decrypt(info->name, info->header.name_length, info->header.data_size);
((char*)info->name)[info->header.name_length] = 0;
}
void BGADDecryptData(BGADInfo* info) {
khux_decrypt(info->data, info->header.data_size, info->header.name_length);
if (info->header.is_compressed) {
unsigned long int size = info->header.decompressed_size;
uncompress(info->decompressed, &size, info->data, info->header.data_size);
}
}
int ReadBGAD(FILE* file, BGADInfo* info) {
Read(&info->header, BGADSize)
CatchError(info->header.magic != BGADMagic)
CatchError(info->header.name_length > BGADMaxNameLength)
Read(info->name, info->header.name_length)
BGADDecryptName(info);
CatchError(info->header.data_size > BGADMaxDataSize)
CatchError(info->header.decompressed_size > BGADMaxDataSize)
Read(info->data, info->header.data_size)
BGADDecryptData(info);
return true;
}
void WriteBGAD(FILE* file, BGADInfo* info) {
void* ptr = info->header.is_compressed
? info->decompressed
: info->data;
int size = info->header.is_compressed
? info->header.decompressed_size
: info->header.data_size;
fwrite(ptr, size, 1, file);
}
void CreateDirectories(char** base, char* directories) {
char* directory = strtok(directories, "/");
char* next_directory;
mkdir(*base, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
while (directory != NULL) {
next_directory = strtok(NULL, "/");
strncat(*base, "/", 1);
strncat(*base, directory, strlen(directory));
if (next_directory != NULL) {
mkdir(*base, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
}
directory = next_directory;
}
}
int main(int argc, const char * argv[]) {
setbuf(stdout, NULL);
char* in_path = (char*)argv[1];
char* out_path = (char*)argv[2];
unsigned long out_path_len = strlen(out_path);
FILE* file = fopen(in_path, "r");
BGADInfo* info = malloc(sizeof(BGADInfo));
BGADInfoInit(info);
char* write_path = malloc(0x100);
while (ReadBGAD(file, info)) {
memset(write_path, 0, 0x100);
strncat(write_path, out_path, out_path_len);
CreateDirectories(&write_path, info->name);
FILE* out_file = fopen(write_path, "w");
CatchError(out_file == NULL)
WriteBGAD(out_file, info);
fclose(out_file);
}
fclose(file);
return 0;
}
Re: [Mobile] Kingdom Hearts Unchained file archives
Would a compiled version be too much to ask for? I made some quick attempts that didn't work out, so I would be really thankful for one.