Gildor's Forums

English Forum => Other games => Topic started by: Straight Edge on April 14, 2015, 10:03



Title: Mortal Kombat X
Post by: Straight Edge on April 14, 2015, 10:03
Having trouble extracting anything from the Asset folder (XXX files).

Commands I run: umodel -gui CHAR_SubZero_B.xxx

Error message:
appMalloc:size=808536909 <- FArray::Empty:808536909 x 1 <- FString<< <- SerializePackageFileSummary3 <- FPackageFileSummary<<:Ver=677/157 <- UnPackage::UnPackage:CHAR_SubZero_B.xxx, ver=677/157, game=8000 <- UnPackage::LoadPackage:CHAR_SubZero_B.xxx <- Main:umodel_version=343

or alternatively I run: umodel -noanim -nomesh -export CHAR_SubZero_B.xxx

ERROR: Trying to allocate 808536909 bytes
appMalloc:size=808536909 <- FArray::Empty:808536909 x 1 <- FString<< <- SerializePackageFileSummary3 <- FPackageFileSummary<<:Ver=677/157 <- UnPackage::UnPackage:CHAR_SubZero_B.xxx, ver=677/157, game=8000 <- UnPackage::LoadPackage:CHAR_SubZero_B.xxx <- Main:umodel_version=343

Does this mean NRS is using a new way of containing the game files that makes umodel incompatible, or am I simply going about this the wrong way?  ???


Title: Re: Problem with Mortal Kombat X
Post by: Gildor on April 14, 2015, 10:15
Sigh ... Run UModel without arguments. Select game directory. Disable animation. Select "Mortal Kombat" in game list, run.


Title: Re: Problem with Mortal Kombat X
Post by: Straight Edge on April 14, 2015, 10:36
Is this what you mean? Sorry, still a bit of a newb at this.

Loaded Umod. Selected game directory. Unchecked Animation. Hit OK.
(http://a.pomf.se/fkoppn.png)

Went into Game Directory. Located desired container file. Then hit Export.
(http://a.pomf.se/wyrozq.png)

This came up:
(http://a.pomf.se/hldsed.png)
appMalloc:size=808536909 <- FArray::Empty:808536909 x 1 <- FString<< <- SerializePackageFileSummary3 <- FPackageFileSummary<<:Ver=677/157 <- UnPackage::UnPackage:Asset/CHAR_SubZero_B.xxx, ver=677/157, game=8000 <- UnPackage::LoadPackage:Asset/CHAR_SubZero_B.xxx <- Main:umodel_version=343

Am I still doing this wrong? I never had this trouble with Mortal Kombat 9, Mass Effect or Injustice.


Title: Re: Mortal Kombat X
Post by: Gildor on April 14, 2015, 10:47
You fooled me with 1st message. I didn't notice that MK X is a new game which was just released. So, I'm moving thread to "Other games" board.
By the way, try selecting any of "Mortal Kombat" game series in "Override game detection". There's a little chance that old code will work with new game.


Title: Re: Mortal Kombat X
Post by: Straight Edge on April 14, 2015, 10:52
Gave it a shot. Didn't work.  :-\

I assume this one needs to be cracked a different way. Would it be helpful to you if I sent some of the game files?


Title: Re: Mortal Kombat X
Post by: Gildor on April 14, 2015, 10:54
Sure, send me a few packages and the game executable. I'll take a look in a few days.


Title: Re: Mortal Kombat X
Post by: Straight Edge on April 14, 2015, 11:28
Okay. I pm'd you the files. I hope you figure it out. Thanks for all your help btw. :)


Title: Re: Mortal Kombat X
Post by: Gildor on April 14, 2015, 11:46
Thanks. Is there 32-bit executable file?


Title: Re: Mortal Kombat X
Post by: Straight Edge on April 14, 2015, 11:55
Those are the only executable files in that directory, unfortuantely.  :-\


Title: Re: Mortal Kombat X
Post by: Gildor on April 14, 2015, 12:07
That's bad. 64-bit executables are much harder to analyze than 32-bit.


Title: Re: Mortal Kombat X
Post by: interloko on April 15, 2015, 18:38
Hi Gildor, I wanted to extract from some characters of this game, but with extract.exe, not umodel. I made it with MK9 and worked well, so the question is: do you use a similar process with extract.exe?
I'm getting a similar error message like the posted here (umodel).
Must I wait to you support the game with Umodel and then you will add support in the other apps?
Seems like this game requires a 64bit OS to run.


Title: Re: Mortal Kombat X
Post by: Gildor on April 15, 2015, 18:42
Hi,
Yes, you must wait. UModel and extract.exe uses the same code base, but just performs different actions on package files.
And yes - this game has only 64-bit executable file, that's why the game is not yet supported, I think - reversing of 64-bit executables is a few times harder for me than work with 32-bit ones.


Title: Re: Mortal Kombat X
Post by: interloko on April 15, 2015, 18:55
Thank you for your response


Title: Re: Mortal Kombat X
Post by: m0xf on April 15, 2015, 20:00
That's bad. 64-bit executables are much harder to analyze than 32-bit.
You use IDA pro? Version 6.6 and HexRays x64 alredy on torrents.  :)


Title: Re: Mortal Kombat X
Post by: Gildor on April 15, 2015, 21:13
Got it. Quickly checked the code - the engine was changed a lot. Previous MK versions used very old UE3 version, and it looks like the company's programmers extended that old version with newer features, but they didn't bother to make it even a bit compatible with original engine.

In my opinion, it's quite possible that the game will not be supported at all - or I'll need to write another one UModel, with support with just-this-one-game. Of course I'll try to support it - a bit later, when I'll have more free time (because this is definitely not a quick task). Even supporting the package format (without extraction of textures/meshes/etc) is very hard, and I'm expecting even more troubles with meshes.


Title: Re: Mortal Kombat X
Post by: UncleFestor on April 19, 2015, 00:17
Well, tbh, @ this point, just being able to decompress the files would be fantastic. Extracting textures & files sure that would be great. Extracting meshes isn't necessary at all. Even with MKKE there's nothing we can do with them cause we can't repack them back into the char Packages & have the Game engine load them.

On MKKE PC we can only manipulate textures, which we extract from decompressed packages. We can't do anything with the actual model/meshes. Any other modding we do is direct manipulation of the actual packages {Tables, Materials, Etc... }. Not the meshes.


Title: Re: Mortal Kombat X
Post by: Gildor on April 19, 2015, 00:33
For me, I don't understand why "repacking meshes back" could be important feature :)
Textures, sound - ok, that could be useful for people who translates games to other languages. But meshes?


Title: Re: Mortal Kombat X
Post by: UncleFestor on April 19, 2015, 02:46
Well, It would be good cause then we would be able to alter the meshes & create custom characters {In theory}. But I highly doubt either mk game would be able to read them.

We as modders are more concerned with modding MKX similar to how we did with MK9. Which involves editing the textures to create new costumes/skins, swapping materials, editing the data tables, etc... However the 1st step is decompressing the packages.



Title: Re: Mortal Kombat X
Post by: ID-Daemon on April 19, 2015, 17:34
ok, i've extracted the textures and they seem to be encrypted. Posted that on Xentax. Was that in any previous MK games? Or maybe it's just a compression that I don't know. At least it's not DXT1/3/5


Title: Re: Mortal Kombat X
Post by: Gildor on April 19, 2015, 18:12
Which software did you use to extract textures? May be the problem is with that program?


Title: Re: Mortal Kombat X
Post by: UncleFestor on April 19, 2015, 20:57
The Texture2D files were not encrypted in Injustice nor Mk9/MKKE.

The texture files for MKX are contained in the .tfc files for characters/costumes that have them {which is most of them} the ones that don't have .tfc files do have the texture2d files in the Char Package.

*EDIT*
The Texture2d files for MKX are not encrypted. I've verified this with a friend who was able to view it in a texture viewer.


Title: Re: Mortal Kombat X
Post by: ID-Daemon on April 20, 2015, 09:08
And what is the format?


Title: Re: Mortal Kombat X
Post by: Gildor on April 20, 2015, 11:05
Could anyone tell me the size of the largest xxx and largest tfc file in this game? Are there files larger than 4Gb in this game?
I'm asking that because game format uses 64-bit file offsets internally, while UModel uses 32-bit offsets everywhere.


Title: Re: Mortal Kombat X
Post by: Straight Edge on April 20, 2015, 11:08
Largest .tfc file I see is 480MB (BGND_KR_IL_Tunnel.tfc) and the largest .xxx file is 479MB (SND_MUS_SpecialModes.xxx) I don't see anything larger past the 1GB size.


Title: Re: Mortal Kombat X
Post by: Gildor on April 20, 2015, 11:09
Ok, thanks for the information :)


Title: Re: Mortal Kombat X
Post by: Gildor on April 20, 2015, 12:17
Well, I've got some progress with this game.
MK X package format is supported now. Please note: not data - just package format. So, "decompress" and "extract" are working now.


Title: Re: Mortal Kombat X
Post by: Straight Edge on April 20, 2015, 12:24
^^Good to hear. :D


Title: Re: Mortal Kombat X
Post by: UncleFestor on April 20, 2015, 17:13
Thanks for the updated tools. They work perfectly for the xxx packages :)




Title: Re: Mortal Kombat X
Post by: DarkSoul on April 20, 2015, 20:06
hey gildor thanks for the new decompressor and extract for mkx

im getting a notify with decompressing the files for this game

Code:
******** E:\...........\UmodelMKX\CHAR_SubZero_B.xxx ********

WARNING: wrong size of E:\............\UmodelMKX\CHAR_SubZero_B.xxx: differs in 912 bytes

also when i want to load the decompressed file into the game crashes and i need to restart my pc

the extract works fine tho


Title: Re: Mortal Kombat X
Post by: UncleFestor on April 20, 2015, 20:48
Yeah I'm also getting the same errors. I didn't notice the notify file @ 1st & thought that because the file that was in the unpacked folder was larger, it had decompressed correctly, but, it doesn't :(

I've attached the log to this post.

[вложение удалено Администратором]


Title: Re: Mortal Kombat X
Post by: joosebox on April 20, 2015, 21:26
Likewise.   I get this error when decompressing xxx file for UI button layouts.


******** C:\mk9 mod\ui_c_buttonLib.xxx ********

WARNING: wrong size of C:\mk9 mod\ui_c_buttonLib.xxx: differs in 32 bytes


Title: Re: Mortal Kombat X
Post by: Gildor on April 21, 2015, 00:29
Fixed the warning. Please try updated decompressor.


Title: Re: Mortal Kombat X
Post by: UncleFestor on April 21, 2015, 00:46
Tested & confirmed working. Decompressed package loads in game :) Thanks Gildor


Title: Re: Mortal Kombat X
Post by: Gildor on April 21, 2015, 00:48
Cool! At last I wrote something that works ;D


Title: Re: Mortal Kombat X
Post by: UncleFestor on April 21, 2015, 16:16
 ;D


Title: Re: Mortal Kombat X
Post by: raykingnihong on April 21, 2015, 22:14
Hi Gildor my friends, thank you very much for your great work, really looking forward to Umodel can be the perfect support for this game


Title: Re: Mortal Kombat X
Post by: LinkOFF on April 21, 2015, 23:28
Tested & confirmed working. Decompressed package loads in game :) Thanks Gildor
Game with decompressed package not started. Just black screen.


Title: Re: Mortal Kombat X
Post by: UncleFestor on April 22, 2015, 00:11
What package did you decompress & did you change anything inside the package ?


Title: Re: Mortal Kombat X
Post by: LinkOFF on April 22, 2015, 00:15
What package did you decompress & did you change anything inside the package ?

ui_c_buttonLib.xxx
Nothing changes.


Title: Re: Mortal Kombat X
Post by: UncleFestor on April 22, 2015, 01:08
I'll take a look @ that package tomorrow & let you know what's going on with it.


Title: Re: Mortal Kombat X
Post by: UncleFestor on April 22, 2015, 17:19
Nothing changes.

I tested it on my end it it works perfectly, also there's already been a PS3 Button mod released using this package. So you must've done something wrong. Try decompressing it again {using the original file of course}.


Title: Re: Mortal Kombat X
Post by: howfie on April 22, 2015, 17:53
Hi gildor, after you do this game, could you explain what the encoding is for the blendindices? I can get geometry, blendweights, and bones, http://snag.gy/Eeure.jpg (http://snag.gy/Eeure.jpg), but the blendindices use some kind of retarded encoding. Indices are a single byte, except for one index, which is two bytes and divided by either 4 or 16. For example on one vertex:

4c e0 d0 04 00 - 9f 48 18

There are 5 bytes for blend indices, but only 3 for weights. The weights are easy... just sums to FF or close to FF, so 3 or 4 weights max, simple weight/255.0f.

But the blendindices...

4c is correct 1st index.
2nd index is actually e0/04.
3rd index is actually 04d0/10 (but not always).

Then there's this one:

38 30 01 04 00 - cb 2f 05

38 is correct 1st index.
2nd index is actually 30/04.
3rd index is actually 0401/10 (but not perfectly divisible by 10... flag of some sort?)

Looked through your Github code but couldn't find anything on these "variable-length" encoded indices. Any enlightenment on this would be appreciated. Thanks!


Title: Re: Mortal Kombat X
Post by: Gildor on April 22, 2015, 17:59
Hi.
UE3 allows more than 256 bones. So, mesh split to chunks with at most 256 bones each. Each chunk has remap table so local 8-bit bone index converted to global bone. The conversion code in UModel is here:
https://github.com/gildor2/UModel/blob/master/Unreal/UnMesh3.cpp#L1745


Title: Re: Mortal Kombat X
Post by: howfie on April 22, 2015, 18:31
Cool, thanks for the link to the lines. Looked in your code for something like:

int BoneIndex1  = V->BoneIndex[0];
int BoneIndex2  = V->BoneIndex[1]/4;
int BoneIndex3  = V->BoneIndex[2]/16;
int BoneIndex4 = V->BoneIndex[3]/64;

You'll see for this game bone indices that go out of range of the remap table, like the value D0 here (0D is the correct index to the remap table):

Code:
vtx 0x3098: 10 50 d0 00 00 - 6e 49 48

BTW, how's life in England the past two years now? Pick up an accent yet :P ?


Title: Re: Mortal Kombat X
Post by: Gildor on April 22, 2015, 18:59
int BoneIndex1  = V->BoneIndex[0];
int BoneIndex2  = V->BoneIndex[1]/4;
int BoneIndex3  = V->BoneIndex[2]/16;
int BoneIndex4 = V->BoneIndex[3]/64;
This looks like they're using 32-bit integer to store more than 4 indices. For example, 5x 6-bit values etc.
Quote
BTW, how's life in England the past two years now? Pick up an accent yet :P ?
Hehe, I'm not in UK. I've left it after 5-6 months working at Ubisoft. So, my English is going worse now ... Long sad story :(


Title: Re: Mortal Kombat X
Post by: howfie on April 23, 2015, 15:18
Thanks gildor, figured it out he he he.

Works great now.
http://snag.gy/MscbB.jpg

It was really simple:

aaaaaaaa bbbbbbbb cccccccc dddddddd eeeeeeee

converts to

bbaaaaaaaa ccccbbbbbb00 ddddddcccc0000 eeeeeeeedd000000

Hope you and your family are well.


Title: Re: Mortal Kombat X
Post by: Gildor on April 23, 2015, 15:35
Insane. I think I will not support this game  :o


Title: Re: Mortal Kombat X
Post by: UncleFestor on April 23, 2015, 16:34
Well we don't need support for models, just the textures.

All we really need is to be able to extract the images from the Texture2d Files {export as dds}


Title: Re: Mortal Kombat X
Post by: USF on April 23, 2015, 16:35
Works great now.
http://snag.gy/MscbB.jpg
I do not understand how you did it, I unpacked the files but could not use them, how did you do it? is it possible to just shove in 3d max model? :o


Title: Re: Mortal Kombat X
Post by: howfie on April 23, 2015, 17:13
Works great now.
http://snag.gy/MscbB.jpg
I do not understand how you did it, I unpacked the files but could not use them, how did you do it? is it possible to just shove in 3d max model? :o

I used C++ to extract a single model from the game. Hard-coding offsets, etc. I have no interest in doing all the models, as Gildor's the Unreal man. It takes someone with more patience than I have to deal with all the million or so serialized objects that make up Unreal data. That man is Gildor lol.

My code looks like:

Code:
 //
 // FIXED PROPERTIES
 //

 uint32 n_verts = 0x5DE8;

 uint64 name_offset1 = 0x0EA9; // CHAR_Kitana_A
 uint64 name_offset2 = 0x0FD4; // CHAR_Kitana_A

 uint64 mesh_info_offset1 = 0x1136; // not important
 uint64 mesh_info_offset2 = 0x1699; // not important
 uint64 mesh_info_offset3 = 0x2CF8; // important!!!

 uint64 ib_offset = 0x02DA5; // index buffer
 uint64 jm_offset = 0x379DF; // joint map

 uint64 vb1_offset = 0x43B9C; // points
 uint64 vb2_offset = 0xE8120; // UV
 uint64 vb3_offset = 0xB91D4; // blending

 // move to surface information
 ifile.seekg(mesh_info_offset3);
 if(ifile.fail()) return error("Seek failure.", __LINE__);

 // read number of surface
 uint32 n_surfaces = LE_read_uint32(ifile);
 if(ifile.fail()) return error("Read failure.", __LINE__);

 // read surfaces
 boost::shared_array<MKXMESH> meshlist(new MKXMESH[n_surfaces]);
 for(uint32 i = 0; i < n_surfaces; i++) {
     meshlist[i].id    = LE_read_uint16(ifile); // id
     meshlist[i].jm    = LE_read_uint16(ifile); // joint map index
     meshlist[i].start = LE_read_uint32(ifile); // index buffer start
     meshlist[i].n_tri = LE_read_uint32(ifile); // number of triangles
     meshlist[i].bflag = LE_read_uint08(ifile); // some kind of flag
     if(ifile.fail()) return error("Read failure.", __LINE__);
    }

If I want another model I open it up in a hex editor and change the offsets lmao.


Title: Re: Mortal Kombat X
Post by: USF on April 23, 2015, 18:13
can you please extract the model some of the characters from MKX?I'm just not versed in C++


Title: Re: Mortal Kombat X
Post by: ccc93 on April 23, 2015, 18:23
Well we don't need support for models, just the textures.

All we really need is to be able to extract the images from the Texture2d Files {export as dds}

Well some of the others would like to even play with the models too.


Title: Re: Mortal Kombat X
Post by: UncleFestor on April 23, 2015, 18:33
Well, I guess for fun, but you won't be able to import those into MKX.

MKX uses an extremely modified version of UE3. The only program that can export a model into the correct format for the game to use is UDK. But you need the exact version that was used for MKX for the game to be able to read the models.

This is the exact reason why modding on MK9/MKKE wasn't as diverse as it was for SFxT or SFIV.

In MK9/MKKE even if you didn't change any vertices & all you did was export model, import to 3DSMax, export/import into UDK & save. Then inject into xxx package game would crash.

*EDIT*

However, most of the models are fairly basic. The game {MK9/MKKE/Injustice} utilizes the normal Maps extremely well & using Material swapping techniques & creating custom Norms, you can achieve really good results through just the textures. So as a starting point for a game like MKX which uses an even more modified version of UE3, focusing on extracting textures is the best starting point, imo, because it's usable for actual modding.


Title: Re: Mortal Kombat X
Post by: Gildor on April 23, 2015, 18:36
The only program that can export a model into the correct format for the game to use is UDK.
This game uses completely own skeletal and static mesh formats. Think of this like these developers obtained UE3 source code, dropped all mesh staff and wrote their own code. I think that's because basic UE3 has optimizations for complex scenes, but this game requires display of just 2 skeletal meshes (players) and probably 1 static mesh (scene). So they simplified everything, perhaps to save resources for something else (it works with PS3 and XBox360, not just with modern hardware).

That's why I can't find enough time to continue supporting this game.


Title: Re: Mortal Kombat X
Post by: UncleFestor on April 23, 2015, 18:41
The only program that can export a model into the correct format for the game to use is UDK.
This game uses completely own skeletal and static mesh formats. Think of this like these developers obtained UE3 source code, dropped all mesh staff and wrote their own code. I think that's because basic UE3 has optimizations for complex scenes, but this game requires display of just 2 skeletal meshes (players) and probably 1 static mesh (scene). So they simplified everything, perhaps to save resources for something else (it works with PS3 and XBox360, not just with modern hardware).

That's why I can't find enough time to continue supporting this game.

And that's why I was recommending to just add support for texture exporting.


*EDIT*

All we really need is the ability to extract textures from Texture2D files.


Title: Re: Mortal Kombat X
Post by: Gildor on April 23, 2015, 18:44
And that's why I was recommending to just add support for texture exporting.
I'd glad to save my time and to switch to something else, but definitely some UModel users will not agree with that :)
By the way, I'll try to support meshes, and probably at some point I'll decide that this is too hard and I'll stop.


Title: Re: Mortal Kombat X
Post by: UncleFestor on April 23, 2015, 18:52
Yeah, that's true. But I'm trying to view it from your perspective. It seems like an awful lot of work you would have to go through & an awful lot of time that you just don't have, to support models.

So, with that in mind, if our choices are textures only {maybe meshes down the line} or nothing. I would prefer textures. At least that way we can create costumes for characters.

The way I see it is, this is your hobby. You do it in your spare time & it's impossible to please everyone. Don't break your back for anyone. Whatever you're able to accomplish, people should understand that it isn't easy & appreciate what you provide regardless :)


Title: Re: Mortal Kombat X
Post by: Gildor on April 23, 2015, 18:54
:)


Title: Re: Mortal Kombat X
Post by: max_shift on April 23, 2015, 19:49
hey howfie! could you please explain what exactly you did with those bone id's xDD


Title: Re: Mortal Kombat X
Post by: Straight Edge on April 23, 2015, 19:53
Well we don't need support for models, just the textures.

All we really need is to be able to extract the images from the Texture2d Files {export as dds}
There is a very large community of people that would disagree with that. They rely on the models to create their own works of art or mods in other games.

But if you're truly unable to crack this game, gildor, then I thank you very much for your efforts in trying--that's what counts.


Title: Re: Mortal Kombat X
Post by: howfie on April 24, 2015, 02:19
hey howfie! could you please explain what exactly you did with those bone id's xDD

Sure. Now, I only extracted Kitana_A model, so I'll explain that one. In her SkeletalMesh file, the blending information (blend indices and blend weights) are stored at offset 0xB91D4. Reading them is simple:

Code:
 //
 // VERTEX BUFFER #3
 // BLENDING
 //

 struct MKXBLENDWEIGHT {
  uint08 bytes[8];
 };

 // move to vertex buffer
 ifile.seekg(vb3_offset);
 if(ifile.fail()) return error("Seek failure.", __LINE__);

 // read info
 uint16 vb3_h01 = LE_read_uint32(ifile); // bytes per vertex
 uint16 vb3_h02 = LE_read_uint32(ifile); // number of vertices
 uint16 vb3_h03 = LE_read_uint32(ifile); // number of vertices
 if(ifile.fail()) return error("Read failure.", __LINE__);
 if(vb3_h02 != n_verts) return error("Unexpected number of vertices.", __LINE__);
 if(vb3_h03 != n_verts) return error("Unexpected number of vertices.", __LINE__);

 // read data
 boost::shared_array<MKXBLENDWEIGHT> bwlist(new MKXBLENDWEIGHT[n_verts]);
 for(uint32 i = 0; i < n_verts; i++) {
     bwlist[i].bytes[0] = LE_read_uint08(ifile); // blendindex
     bwlist[i].bytes[1] = LE_read_uint08(ifile); // blendindex
     bwlist[i].bytes[2] = LE_read_uint08(ifile); // blendindex
     bwlist[i].bytes[3] = LE_read_uint08(ifile); // blendindex
     bwlist[i].bytes[4] = LE_read_uint08(ifile); // blendindex
     bwlist[i].bytes[5] = LE_read_uint08(ifile); // blendweight
     bwlist[i].bytes[6] = LE_read_uint08(ifile); // blendweight
     bwlist[i].bytes[7] = LE_read_uint08(ifile); // blendweight
     if(ifile.fail()) return error("Read failure.", __LINE__);
    }

First thing to notice is that of the 8 bytes per vertex, 5 of them (not 4) are for blendindices and 3 of them (not 4) are for blendweights. Here is an example:

vtx 0x1bb6: [12 68 90 c1 03] - [7d 38 32] a point on her shirt, near her left boob.

The last 3 numbers: 7D, 38, 32, do not sum to FF so there are 4 blendweights. However, there are 5 indices.

If you view indices as single bytes, you look up 0x12 in the joint map and see it remaps to bone 0x04, which is fine (it's a spine bone). But now you look up 0x68 but can't the joint map only has 0x47 elements in it. chrrox and I noticed that the second number is "almost always divisible by 4." So if you divide 0x68 by 0x04 to get 0x1A and look up 0x1A in the joint map, the second index remaps to bone 0x05, which is also good (another spine bone).

Now try 0x90. The third number is "almost always divisible by 0x10." So we get 0x09 and look it up in the joint map to see it remaps to bone 0xAF, which is a bone in the FOOT! This is wrong, and moving the ankle bone will also move part of her left boob as well lol.

So we know 0x90 is wrong. What is the correct value? Well, in the joint map, her boob bone is bone 0xA3, which is index 0x19. Multiply that index by 0x10 and we get 0x0190. Where do we get that extra 01 from? From the next byte, 0xC1. You get the 1 from the 4 LSB in 0xC1.

Code:
jointmap[0x47] =
00    01    02    03    04    05    06    07    08    09    0A    0B    0C    0D    0E    0F
07 00 06 00 10 00 27 00 28 00 A8 00 A7 00 A9 00 AA 00 AF 00 AE 00 B0 00 B1 00 01 00 02 00 03 00
AB 00 A4 00 04 00 A5 00 AC 00 B5 00 B4 00 B3 00 A2 00 A3 00 05 00 63 00 64 00 82 00 83 00 7B 00
68 00 7C 00 7D 00 7E 00 7F 00 80 00 81 00 75 00 74 00 76 00 71 00 77 00 72 00 73 00 6C 00 6D 00
69 00 6E 00 6A 00 6B 00 78 00 79 00 7A 00 9A 00 87 00 9B 00 9C 00 9D 00 9E 00 9F 00 A0 00 94 00
93 00 95 00 90 00 96 00 91 00 92 00 8B 00 8C 00 88 00 8D 00 89 00 8A 00 97 00 98 00 99 00

So this is what you do for these indices:

[12 68 90 c1 03] hex = [00010010 01101000 10010000 11000001 00000011] binary

Take two LSB from 68 (00) and move them to front of 12 (00010010).
So first index is 0000010010 = 0x12.

Take four LSB from 90 (0000) and move them to front of 68 (01101000).
So second index is 000001101000 = 68 / 04 = 0x1A.

Take 6 LSB from c1 (000001) and move them to front of 90 (10010000).
So third index is 00000110010000 = 190 / 10 = 0x19.

Finally, take all 8 bits from 03 (00000011) and move them to front of c1 (11000001).
So final index is 0000001111000001 = 3C1 / 40 = 0x0F.
0x0F index remaps to bone 0x03, which is also a spine bone and now everything is correct.

I use the following code to process the 5 indices, where i1, i2, i3, i4, and i5 are the original indices:

Code:
     uint16 final_index1 = (i1 | ((i2 & 0x03) << 8));
     uint16 final_index2 = (i2 | ((i3 & 0x0F) << 8)) >> 2;
     uint16 final_index3 = (i3 | ((i4 & 0x3F) << 8)) >> 4;
     uint16 final_index4 = (i4 | (i5 << 8)) >> 6;





Title: Re: Mortal Kombat X
Post by: n0oB_$ayßoaT on April 24, 2015, 03:40
Hey there. A new guy here. What's up?

The main reason I registered here, perhaps obvious from my username, is to discuss Mortal Kombat X. I've searched the net and went through a few sites and ended up here, because I wanted to ask directly at the source - since Gildor seems to be the Unreal guru. I have a general understanding of things, but never really modified anything Unreal, so please bear with me. Especially since MKX seems to be a somewhat special case.

Now... my intentions... and what I need help with.

What I want to do is translate the game into another language. Ideally 100% of it - meaning subtitles for cutscenes/user interface/menus.

I presume what I'll need to do is locate the appropriate .xxx files (and possibly the .eng file) in the assets folder which contain this data, extract it, modify it (translate) and repack it.

I also presume that not everything is pure text and the interface/menus, etc. might be saved as graphics.

And that's where it kind of ends.

Would UModel suffice for what I want to do or do I need a different tool/method? There was I think some three step .bat alternative?

I imagine this should be much easier than pulling out models/textures, but I may be wrong.

I read the Unreal wiki, but even with that the localization seems a bit tricky.

Thanks!


Title: Re: Mortal Kombat X
Post by: Gildor on April 24, 2015, 10:05
Hey there. A new guy here. What's up?
...
Hi.

This forum has a special board relative to localization issues. Probably you'll find anything interesting there.
http://www.gildor.org/smf/index.php/board,22.0.html

By the way, nobody posted easy solutions there, even of somebody found one.


Title: Re: Mortal Kombat X
Post by: max_shift on April 24, 2015, 13:17
hey howfie! my man, thanks a lot. got it work perfectly, a bit bizarre but make sense lol

(http://s27.postimg.org/tnjvw7f77/pic.jpg) (http://s27.postimg.org/tnjvw7f77/pic.jpg)


Title: Re: Mortal Kombat X
Post by: Gildor on April 24, 2015, 13:50
Well. A few hours of hard work and a little progress: textures are supported now. UModel got a lot of changes in unusual parts of code (where all other games are identical to UE3).

Please read this! All textures are in BC7 format, so they are supported only partially - in viewer. You cannot export them because UModel doesn't have BC7 support. That's caused by NVidia Texture Tools (NVTT) library - it doesn't have BC7 support. Also, neither UE3 nor UE4 supports this texture format.


Title: Re: Mortal Kombat X
Post by: UncleFestor on April 24, 2015, 14:51
I don't know if this will help, but here's Nvidia texture tools BC7 Exporter: https://code.google.com/p/nvidia-texture-tools/downloads/detail?name=bc7_export.zip&can=2&q= (https://code.google.com/p/nvidia-texture-tools/downloads/detail?name=bc7_export.zip&can=2&q=)

It's supposed to allow decompression & extraction of BC7 Textures


Title: Re: Mortal Kombat X
Post by: howfie on April 24, 2015, 14:56
gildor, if you use that library you can use my code

http://forum.xentax.com/viewtopic.php?p=105556#p105556

to export bc7 to rgba.


Title: Re: Mortal Kombat X
Post by: Gildor on April 24, 2015, 15:27
gildor, if you use that library you can use my code

http://forum.xentax.com/viewtopic.php?p=105556#p105556

to export bc7 to rgba.
This code relies on unstable NVTT code - on exactly the same library as in previous UncleFestor's post. NVTT has BC7 support - in svn, but not in "release". The latest NVTT release was, I think, 5 years ago. I tried to integrate updated (unstable) NVTT into UModel, but with no success - this library, just for BC7 support, relies on STL library which can't be used in UModel (that's not taking into account that I hate STL).

There's also DirectXTex library by Microsoft, but it requires DirectX SDK for compilation.

Anyway, BC7 textures are used only in 2 games: Thief 2014 and Mortal Kombat X, so probably it's not worth doing complex integration to allow texture export just for 2 games. These textures could be viewed in UModel if videocard has corresponding OpenGL capability.


Title: Re: Mortal Kombat X
Post by: howfie on April 24, 2015, 15:52
hahahaha I understand gildor. you're right, for just two games when unreal doesn't by default support it, why bother? especially if this requires you to write your own decoder from scratch (i know it's not fun :) ).


Title: Re: Mortal Kombat X
Post by: Gildor on April 24, 2015, 16:46
Just found another one library - texgenpack (https://github.com/hglm/texgenpack). Will check whether it's worth integrating it into UModel because it supports not just BC7, but also ETC2 which is used by Android games.


Title: Re: Mortal Kombat X
Post by: TRDaz on April 24, 2015, 21:47
I tested the new update of Umodel with the files and cannot seem to get the textures to show, they just appear white, is that how they are supposed to be? (as you can't fully support them because of the BC7 format) Umodel gives "unknown texture format 11" error in the cmd.


Title: Re: Mortal Kombat X
Post by: Gildor on April 24, 2015, 23:10
It looks like your video card drivers doesn't have BC7 support. I don't remember whether this is DX10 or DX11 feature, but anyway only relatively modern video cards supports that.

UModel tries to upload texture to video card in BC7 format, but fails. It tries to decode texture into RGB format, but there's no BC7 decoder there. So, you have this error message and no texture on screen.


Title: Re: Mortal Kombat X
Post by: TRDaz on April 24, 2015, 23:16
Ah ok, nice work on getting them viewable though, even if it doesn't work for me xD


Title: Re: Mortal Kombat X
Post by: Gildor on April 26, 2015, 02:56
I've integrated detex (https://github.com/hglm/detex) library which should decode BC7 textures, as well as ECT2 (Android format is not supported by anything else).

Bad news. Unfortunately, ETC2 decoding is absolutely unacceptable. BC7 decoding has some glitches - random pixels are noticeably colorized with bad value.
Good news. This library is new, and it is under heavy development, so we could expect fixes to appear in near future.

I'm unsure whether I should enable "detex" code for BC7 in UModel, or wait for fixes or another solution.


Title: Re: Mortal Kombat X
Post by: UncleFestor on April 26, 2015, 07:33
I would say wait. It looks like an active project & they seem to be developing it @ a quick rate, seeing how it's gone through 3 revisions in just 12 days. It would probably be more beneficial to wait for the next update or 2 than implementing it now.


Title: Re: Mortal Kombat X
Post by: mkhacker on April 29, 2015, 11:33
Thanks for all your support on this game guys I have been reading your process and this seems like It's on a whole new level from Injustice and Mortal Kombat 9. I only have 1 question for Gildor, when using the viewer for loading screens it only sees the first texture in the file, (Image0) is it possible to make it view the other ones as the loading screens have about 8 'peices' in the 1 file. I could then use screenshot to get a nice crispy sump of the textures and peice them together. I did try selecting "next" (page up/dwn) while viewing the file but no luck.



Title: Re: Mortal Kombat X
Post by: prj20424 on May 01, 2015, 11:57
it might be usefull

Compress a texture using the GPU into the BC7 format using OpenCL or CUDA
https://github.com/volition-inc/bc7_gpu


Title: Re: Mortal Kombat X
Post by: Gildor on May 01, 2015, 12:07
This is a compression library. I need decompression :) And I need a library which would be free from other third-parties as much as possible. CUDA SDK is a huge library, more than 1Gb of size - it's unacceptable for me.


Title: Re: Mortal Kombat X
Post by: prj20424 on May 01, 2015, 12:42
This is a compression library. I need decompression :) And I need a library which would be free from other third-parties as much as possible. CUDA SDK is a huge library, more than 1Gb of size - it's unacceptable for me.

There is an OpenCL version and a CUDA version which can be switched with the #defines in "bc7_gpu.h".

there is a
bc7_decompress.h
bc7_decompress.cpp
// Copyright (c) 2012 THQ Inc.
// All rights reserved.

But who can stop you from rewrite code your way?


Title: Re: Mortal Kombat X
Post by: Gildor on May 01, 2015, 12:54
there is a
bc7_decompress.h
bc7_decompress.cpp
// Copyright (c) 2012 THQ Inc.
// All rights reserved.
Didn't notice that, thanks. Readme didn't mention that this library has decompression capabilities. Probably it's worth trying.
I've checked #includes, and it seems like decompressor doesn't require any additional library to be included.


Title: Re: Mortal Kombat X
Post by: mkhacker on May 02, 2015, 18:24
Any way to force umodel to read the "next" packed texture in archives that contain more than 1?


Title: Re: Mortal Kombat X
Post by: Gildor on May 02, 2015, 18:27
UModel reads ALL objects contained in package, unless you'll specify exactly which object to load.


Title: Re: Mortal Kombat X
Post by: mkhacker on May 04, 2015, 04:39
I just tried it agian and its working now, I swear the first time I tried it pressing page up/dw did nothing... but I got it now sorry to be a bother :)


Title: Re: Mortal Kombat X
Post by: Darko on May 04, 2015, 07:25
Stupid question, does umodel support models already??


Title: Re: Mortal Kombat X
Post by: Gildor on May 04, 2015, 11:25
Stupid question, does umodel support models already??
Not yet. I've researched SkeletalMesh format, need a lot of coding now - but still have no free time. Sorry.


Title: Re: Mortal Kombat X
Post by: Darko on May 04, 2015, 17:14
Stupid question, does umodel support models already??
Not yet. I've researched SkeletalMesh format, need a lot of coding now - but still have no free time. Sorry.

Nah, don't worry, I understand the situation and your job is first than this crap, It's just I was confused with the pack support and the images of some imported models. Anyways thanks for the asnwer.


Title: Re: Mortal Kombat X
Post by: mkhacker on May 11, 2015, 15:59
Gildor: stumbled accross this, It mentions BC7 Compressor / Decompressor Library 
http://sourceforge.net/projects/texgenpack/


Title: Re: Mortal Kombat X
Post by: Gildor on May 11, 2015, 16:45
Gildor: stumbled accross this, It mentions BC7 Compressor / Decompressor Library 
http://sourceforge.net/projects/texgenpack/
I'm aware of this library. It was migrated to GitHub, and its author created another one - "detex (https://github.com/hglm/detex)" - which has only texture decompression functionality. UModel already has this library integrated, but I disabled it because of poor quality of decompressed images.


Title: Re: Mortal Kombat X
Post by: mkhacker on May 11, 2015, 17:57
Ahh yes, I knew you had implemented detex in your 2nd last umodel build. I didn't know this was an older version (from the same authors) of detex.





Title: Re: Mortal Kombat X
Post by: Gildor on May 14, 2015, 11:22
I've posted an issue on "detex" page, and author of this library has fixed it. Now UModel has full BC7 texture support using "detex" library. Enjoy!


Title: Re: Mortal Kombat X
Post by: interloko on May 14, 2015, 17:29
Wow, great!
I'll download it now!
Thank you


Title: Re: Mortal Kombat X
Post by: Gildor on May 14, 2015, 22:02
Just found another one library - texgenpack (https://github.com/hglm/texgenpack). Will check whether it's worth integrating it into UModel because it supports not just BC7, but also ETC2 which is used by Android games.
I found that Android UE3 doesn't use ETC2, so I mistakenly assumed that textures in ETC packages which are marked as "DXT5" has ETC2 format. Now I fixed that, so you may use UModel with any Android game version, except "ATITC" ("Ardeno" platform).


Title: Re: Mortal Kombat X
Post by: DarkSoul on May 15, 2015, 08:03
great work Gildor thanks for the ongoing support


Title: Re: Mortal Kombat X
Post by: freemanpro on May 15, 2015, 15:43
y Gildor you best .thanks for this support


Title: Re: Mortal Kombat X
Post by: mkhacker on May 17, 2015, 06:14
You Rock Gildor thank you for your hard work and thanks to everyone else in this thread!


Title: Re: Mortal Kombat X
Post by: erik945 on May 29, 2015, 01:38
howfie, your code's fragment on page 4 for *.xxx files? or you unpack it?


Title: Re: Mortal Kombat X
Post by: logansan25 on June 03, 2015, 03:02
How i can extract file .obb?


Title: Re: Mortal Kombat X
Post by: Gildor on June 03, 2015, 10:59
How i can extract file .obb?
http://www.gildor.org/smf/index.php/topic,2531.0.html


Title: Re: Mortal Kombat X
Post by: logansan25 on June 03, 2015, 18:36
How i can extract file .obb?
http://www.gildor.org/smf/index.php/topic,2531.0.html

Done! Very thanks gildor!


Title: Re: Mortal Kombat X
Post by: Gildor on June 18, 2015, 22:41
Could anyone provide me core.xxx and engine.xxx files from this game?


Title: Re: Mortal Kombat X
Post by: TheMask on June 18, 2015, 23:01
unfortunately, those files don't exist in the game structure.
any other files you might need to work with?


Title: Re: Mortal Kombat X
Post by: Gildor on June 18, 2015, 23:10
Is it possible to get a list of all files in Cooked directory? (in pastebin.com etc)


Title: Re: Mortal Kombat X
Post by: urgarulga on June 18, 2015, 23:39
Is it possible to get a list of all files in Cooked directory? (in pastebin.com etc)

there's no cooked directory, but an asset folder.

http://pastebin.com/BSebfxQG (http://pastebin.com/BSebfxQG)


Title: Re: Mortal Kombat X
Post by: TheMask on June 18, 2015, 23:47
maybe no pastebin (since i'm too stupid to make a proper list) but here's the list of all *.xxx files of the game in a .7z file.
i hope this helps for a better overview.
https://www.dropbox.com/s/5253bnr986g2a15/MKX_XXX_Files.7z?dl=0

however most of the files are inside the Assets folder.

the file structure of the game itself looks like this:
https://www.dropbox.com/s/wal9xu2ihknygvt/MKX_File_Structure.jpg?dl=0


Title: Re: Mortal Kombat X
Post by: Gildor on June 18, 2015, 23:52
Nothing interesting :(
What's in MKScript folder?


Title: Re: Mortal Kombat X
Post by: TheMask on June 18, 2015, 23:56
https://www.dropbox.com/s/l96pq1xp46deoc9/MKX_MKScript_Folder.7z?dl=0


Title: Re: Mortal Kombat X
Post by: UncleFestor on June 19, 2015, 00:05
MKScript folder contains all the .mko's {Script Binary files which contain the tables for each asset.}


Title: Re: Mortal Kombat X
Post by: Gildor on June 19, 2015, 00:07
Nothing interesting, again ... So, I think we can't find core/engine scripts even if those are baked into one of xxx files.


Title: Re: Mortal Kombat X
Post by: Gildor on June 19, 2015, 14:01
The SkeletalMesh from MK X is now supported. You may view some screenshots on facebook page (https://www.facebook.com/media/set/?set=a.933795766664224.1073741830.176350295742112&type=3)

Please note: animation and static meshes are not supported, so don't forget to disable them.


Title: Re: Mortal Kombat X
Post by: interloko on June 19, 2015, 22:56
Great!
I assume we will get static mesh support some day
Thanks for the effort!


Title: Re: Mortal Kombat X
Post by: Darko on June 20, 2015, 19:05
Can someone upload cassie files pls??


Title: Re: Mortal Kombat X
Post by: Gildor on June 20, 2015, 23:35
StaticMesh is supported now.


Title: Re: Mortal Kombat X
Post by: devilblades on June 23, 2015, 06:26
StaticMesh is supported now.

I keep getting this error on most files

Trying to allocate -773094096 bytes
appMalloc:size=-773094096 <- FArray::Empty:1052266988 x 36 <- TArray::Serialize:0/0 <- UAnimSequence::Serialize <- LoadObject:AnimSequence'CHAR_SubZero_B.Cloth_Duckstance', pos=9D6ECF, ver=677/157, game=8103 <- UObject::EndLoad <- LoadWholePackage:CHAR_SubZero_B <- CUmodelApp::ShowPackageUI <- Main:umodel_version=364


Title: Re: Mortal Kombat X
Post by: devilblades on June 23, 2015, 06:29
Nevermind got it working lol


Title: Re: Mortal Kombat X
Post by: devilblades on June 23, 2015, 07:00
Anyone know where I can find the weapons from the game? I have only found Mileena's weapon and that is all so far


Title: Re: Mortal Kombat X
Post by: lello87 on December 16, 2015, 01:43
Hey guys,

Check out my UE4 guitar hero demo, that includes Erron Black on the guitar (you heard it right):

https://youtu.be/ret-7vMpTRg

The models and textures were of course extracted with Umodel ;)


Title: Re: Mortal Kombat X
Post by: Gildor on December 16, 2015, 08:26
Nice :)


Title: Re: Mortal Kombat X
Post by: rubening87 on January 14, 2017, 00:11
is there any chance of getting mkx animations somehow?


Title: Re: Mortal Kombat X
Post by: mknoob on October 24, 2020, 15:39
Support for MKX seems to have been broken somewhere along the way. No matter what settings, no matter which asset, I always get:


ERROR: TArray: index 0 is out of range (0)
ProcessVerts <- ConvertLod: lod=0 <- USkeletalMesh3::ConvertMesh <- USkeletalMesh3::PostLoad <- PostLoad: AC_Beast_3_Sk_LOD01 <- UObject::EndLoad <- LoadWholePackage: BGND_AztecCourtyard_MapAssets.xxx <- ExportPackages <- CUmodelApp::ShowPackageUI <- Main: umodel_build=1408


Title: Re: Mortal Kombat X
Post by: Gildor on October 24, 2020, 15:46
It would be really great if you'd find exact umodel version where error appeared (of course if you want to help).

Here's a video showing how to get older versions of umodel.exe:
https://twitter.com/UGildor/status/1277283756034985986


Title: Re: Mortal Kombat X
Post by: mknoob on October 24, 2020, 16:05
Found it. https://github.com/gildor2/UEViewer/commit/bda2f3ff2bbc05f217ba6b3db42301a3012cd2fe#diff-2493c839787b641f8462e4b351245f93b17d21655609967dc61823ecf9e5ea1a (https://github.com/gildor2/UEViewer/commit/bda2f3ff2bbc05f217ba6b3db42301a3012cd2fe#diff-2493c839787b641f8462e4b351245f93b17d21655609967dc61823ecf9e5ea1a) - this is where it stopped working

If you're looking into this, would please also look into an issue that's been there forever:

ERROR: Memory: bad allocation size -170186172 bytes
appMalloc:size=-170186172 (total=95 Mbytes) <- FArray::Empty:-1087924005 x 12 <- TArray::SerializeSimple <- SerializeBulkArray <- FStaticMeshVertexStream3<< <- FStaticMeshLODModel3<< <- TArray::Serialize:0/1 <- UStaticMesh3::Serialize <- LoadObject:StaticMesh3'BGND_KR_IL_Tunnel_ScriptAssets.KR_IL_TN_EggSac1Chest_St', pos=75BA16, ver=677/157, game=mk <- UObject::EndLoad <- LoadWholePackage:BGND_KR_IL_Tunnel_ScriptAssets.xxx <- ExportPackages <- CUmodelApp::ShowPackageUI <- Main:umodel_build=1292

I can upload sample files if need be(tell me on which file-sharing site)


Title: Re: Mortal Kombat X
Post by: Gildor on October 24, 2020, 17:05
Fixed the issue you mentioned before. Thanks a lot for testing and finding the problematic commit.

Can't fix StaticMesh ATM, I'm too busy with other things.


Title: Re: Mortal Kombat X
Post by: Odin on June 02, 2021, 08:07
All the same, the same error occurs, even on the old, even on the new versions of umodel.exe
*** ERROR: Memory: bad allocation size -1030792128 bytes
appMalloc: size = -1030792128 (total = 1 Mbytes) <- FArray :: Empty: 1052266988 x 48 <- TArray :: Serialize: 0/0 <- UAnimSequence :: Serialize <- LoadObject: AnimSequence'Char_QuanChi_A_ScriptAssets.XRay_Cine ', pos = 671035, ver = 677/157, game = mk <- UObject :: EndLoad <- CUmodelApp :: ShowPackageUI <- Main: umodel_build = 790


Title: Re: Mortal Kombat X
Post by: Gildor on June 02, 2021, 09:55
You should disable animations.


Title: Re: Mortal Kombat X
Post by: Kupretoz on August 24, 2021, 10:58
Does anyone ever try to extract mortal kombat 11?