XeNTaX Forum Index
Forum MultiEx Commander Tools Tools Home
It is currently Tue Oct 24, 2017 1:36 am

All times are UTC + 1 hour


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 123 posts ]  Go to page 1, 2, 3, 4, 5 ... 9  Next
Author Message
 Post subject: Far Cry Primal models
PostPosted: Sat Jan 14, 2017 3:28 pm 
Offline
double-veteran
double-veteran

Joined: Tue Mar 24, 2015 8:12 pm
Posts: 1209
Has thanked: 20 times
Have thanks: 574 times














You can make the ads go away by registering

Far Cry Primal tools.

fcp_unpack.exe - unpack .fat/.dat pairs.

Drop .fat onto the tool. It will unpack all files. It will search all .XML files located in the same dir for names.
Names for all files in big primal_main package is here - https://mega.nz/#!IZYlBSKJ!gjrLniO4goeC ... nH2QqOVcfs

You can go to current dir, and run the tool from somewhere else and specify FAT file somewhere else. So you can place everything in 3 different dirs if you like:

1. dir with the tool
2. dir with fat/dat pair
3. current dir where unpacked files will go (also must have xml files for names)

fcp_pack.exe - repack .fat/.dat pairs.

Just run it in the dir where you have files to pack.

oasis_fcp - modified "dunia tools" strings converter for Far Cry Primal

1. Convert BIN to XML as usual
2. Find line with 0xAEE923DE code and delete it. (This new format somehow has 1 section without lines in it. This is causing the old tool to fail. Maybe it's needed or something, then I'll have to find a way to handle it.)
3. Make changes you need
4. Convert file back to BIN
5. Add "table_fcp" table to the end of the file (This can be done in any hex editor or commander tool, or with command line such as "copy /b oasis.bin + table_fcp oasiswithtable.bin")
6. Pack oasis file into FAT/DAT with my packer tool.

Important note. Patch.fat/dat is loaded before patch_sound.fat/dat so you have to find some other package to replace text, or remove old file from patch. I did this by finding the file hash in patch.fat and changing it. The hash is (F3 F8 E3 5D 29 FD BD F2) for english file. Changing any byte here will "mask" the file so game won't find it. Also if oasis file will be changed, you need to get the new table from the end of original file.

oasis_fc4 - strings converter for Far Cry 4

Same for FC4

Latest model tools: viewtopic.php?p=126915#p126915

Image

I made a new tutorial on how to research model formats: https://www.youtube.com/watch?v=-1b3bM7ih6Y

And the thread for all my tutorials here: viewtopic.php?f=29&t=15687


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.



Last edited by daemon1 on Wed Feb 08, 2017 5:01 pm, edited 5 times in total.

Top
 Profile  
 
 Post subject: Re: Far Cry Primal models
PostPosted: Sat Jan 14, 2017 3:48 pm 
Offline
double-veteran
double-veteran

Joined: Tue Mar 24, 2015 8:12 pm
Posts: 1209
Has thanked: 20 times
Have thanks: 574 times
bouvrie wrote:
Far Cry *.dat/fat pairs unpack to smaller files.

So what if I just unpack *.dat/fat pairs into smaller files? Will you be able to use your dunia tools then? I can send you some unpacked examples.

bouvrie wrote:
One thing I noticed with Sir Kane's Watch Dogs 2 extractor, is that it manages to translate the filepath/name hashes from the dat/fat into the actual filenames. It would be very cool if that trick can be reproduced with Far Cry 4

There's NO TRICK. There's NO WAY to translate hashes to names, please remember that ;). Sir Kane's Watch Dogs 2 extractor is also using dictionary, and it works completely the same as all other "hashed" extractors. But there's a way to gather names automatically from running game, or from game files, which Ekey did for WD2, and which I did for Dead Space before.


Top
 Profile  
 
 Post subject: Re: Far Cry Primal models
PostPosted: Sat Jan 14, 2017 5:20 pm 
Offline
advanced

Joined: Sat Mar 18, 2006 5:29 pm
Posts: 49
Has thanked: 13 times
Have thanks: 1 time
// note: this conversation is a continuation of the post at http://forum.xentax.com/viewtopic.php?p=126135#p126135
daemon1 wrote:
bouvrie wrote:
Far Cry *.dat/fat pairs unpack to smaller files.

So what if I just unpack *.dat/fat pairs into smaller files? Will you be able to use your dunia tools then? I can send you some unpacked examples.
That's the general idea, provided Ubi didn't change much with the filesystem. And for modding, it'd be great if you could do a reverse procedure too, packing a folder's contents into a dat/fat pair. I think this will work, UNLESS the binaryfile formats also uses different compression. But we'll see, sure, send me some examples! :)

In Far Cry 4, we use different tools to 'convert' binary objects to XML, RML to XML, and .xbt to dds texture. Would it be thinkable that all those formats just share the same compression technique, and a generic unpacker/packer can be written for them?

daemon1 wrote:
There's NO TRICK. There's NO WAY to translate hashes to names, please remember that ;). Sir Kane's Watch Dogs 2 extractor is also using dictionary, and it works completely the same as all other "hashed" extractors. But there's a way to gather names automatically from running game, or from game files, which Ekey did for WD2, and which I did for Dead Space before.

Yeah, I know hashes are one-way, I assumed Sir Kane uncovered a dictionary function within the game itself, returning the source string from a specified hash, but I misread his post. Would've been cool though. :)

For Far Cry 4, I compiled my own filelist based on the data I extracted from the various XML files, along with data from other sources. However, that only scratches the surface of all the files in there. Right now I'm batch processing about 188000 translated XML files to see if I can write their XML definitions. Dunia seems to load all definition files on startup, so performance is very bad at this point. But at least it's a step forward.

Regarding the model: THIS IS AWESOME! For Far Cry 4, I always wondered if/whether sense can be made of both model files and audio files (the latter extract to *.SPK/*.SBAO files which seem to use different codec than Far Cry 3. There's a topic on XeNTaX about that). Perhaps some day, one can actually add new objects to the game, possibly even with customized *.HKX (Havok physics data?), materials and shaders.

In your Mammoth tutorial video I see you have a Far Cry Primal file-list already. How did you compile that, playing the game, analyzing subdats or something?

Looks like I'll be diving in your tutorials, thank you for those! This subject matter fascinates me.:D


Top
 Profile  
 
 Post subject: Re: Far Cry Primal models
PostPosted: Sat Jan 14, 2017 9:23 pm 
Offline
double-veteran
double-veteran

Joined: Tue Mar 24, 2015 8:12 pm
Posts: 1209
Has thanked: 20 times
Have thanks: 574 times
...


Last edited by daemon1 on Sun Jan 15, 2017 4:36 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Far Cry Primal models
PostPosted: Sun Jan 15, 2017 12:03 pm 
Offline
double-veteran
double-veteran

Joined: Tue Mar 24, 2015 8:12 pm
Posts: 1209
Has thanked: 20 times
Have thanks: 574 times
bouvrie wrote:
it'd be great if you could do a reverse procedure too, packing a folder's contents into a dat/fat pair.

I dont know how dunia2 tools did it, but putting back 200000+ files with total size of 6GIG+ is not a good idea. I can make a tool to replace only needed files though.

bouvrie wrote:
I assumed Sir Kane uncovered a dictionary function within the game itself, returning the source string from a specified hash, but I misread his post. Would've been cool though. :)

Such function is never present in games, because its obviously not needed by the game code.

bouvrie wrote:
I always wondered if/whether sense can be made of both model files and audio files

Audio can be done too. Zench's DecUbiSnd is not perfect, its based on workarounds. I recently reversed Prince of Persia audiobanks format, which allows to properly extract all audio from UBI games, including those not extracted before with DecUbiSnd tool. Unfortunately I had no time to write a tool yet.

bouvrie wrote:
In your Mammoth tutorial video I see you have a Far Cry Primal file-list already. How did you compile that, playing the game, analyzing subdats or something?

The devs have left the full lists of filenames in game files. So no extra work needed here. For example, one of them is primal_main.dpv - its zip archive.


Top
 Profile  
 
 Post subject: Re: Far Cry Primal models
PostPosted: Sun Jan 15, 2017 1:16 pm 
Offline
double-veteran
double-veteran

Joined: Tue Mar 24, 2015 8:12 pm
Posts: 1209
Has thanked: 20 times
Have thanks: 574 times
couple of examples of data files


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.



Top
 Profile  
 
 Post subject: Re: Far Cry Primal models
PostPosted: Sun Jan 15, 2017 3:33 pm 
Offline
advanced

Joined: Sat Mar 18, 2006 5:29 pm
Posts: 49
Has thanked: 13 times
Have thanks: 1 time
daemon1 wrote:
couple of examples of data files
Yay, success! Dunia Tools converts the fcb just fine! As for the material bin file, I don't think I (or other FC modders) know what/how to edit that file further. But both filenames ring a bell in terms of Far Cry modding! Here's the fcb converted to XML, it defines a sector in the worldmap:
Code:
<object name="WorldSector">
  <field name="Id" type="Int32">16842</field>
  <field hash="B7B2364B" type="BinHex">2A000000</field> // Float32:0, Int32:42, UInt32:42, Hash32:CRC32b(x)='0000002A'
  <field hash="C0B506DD" type="BinHex">69000000</field> // Int32:105, UInt32:105, Hash32:CRC32b(x)='00000069'
  <object name="MissionLayer">
    <field hash="B88F49FD" type="BinHex">6400000000000000</field>
    <object name="Entity">
      <field name="hidName" type="StringId">lightprobes_16842</field>
      <field name="disEntityId" type="UInt64">14484421259298931741</field>
      <field name="text_hidEntityClass" type="String">CEntity</field>
      <field name="hidEntityClass" type="Hash32">6750C950</field>   // 'CEntity'
      <field name="hidResourceCount" type="Int32">3</field>
      <field name="hidPos" type="Vector3">-2432,1600,0</field>
      <field name="hidAngles" type="Vector3">0,0,0</field>
      <field name="hidPos_precise" type="Vector3">-2432,1600,0</field>
      <field name="hidConstEntity" type="Boolean">False</field>
      <field name="hidIsLargeEntity" type="Boolean">False</field>
      <field hash="B435B769" type="String"></field>
      <field hash="2D90D933" type="UInt64">18446744073709551615</field>
      <object name="Components">
        <object hash="7C34E822">
          <field name="hidHasAliasName" type="Boolean">False</field>
          <field name="positions" type="Vector193">2,-2428,1604,455.984,-2420,1604,467.875,-2412,1604,0,-2404,1604,0,(...)</field>
          <field hash="EFE7E642" type="BinHex">00000000</field>
          <field hash="718373E1" type="BinHex">00000000</field>
          <field hash="06844377" type="Vector1665">(...)</field>
          <field hash="EAC5287A" type="Vector3">-2433.5,1598.5,392.906</field>
          <field hash="D6C81723" type="Vector3">-2366.5,1665.5,470.203</field>
          <field hash="6C1AAC52" type="BinHex">00001801000017000050726F626573456469746F7250726F70657274696573000000</field>
        </object>
        <object name="CEventComponent">
          <field name="hidHasAliasName" type="Boolean">False</field>
          <object name="hidLinks" />
        </object>
      </object>
    </object>
  </object>
</object>
:D
daemon1 wrote:
I dont know how dunia2 tools did it, but putting back 200000+ files with total size of 6GIG+ is not a good idea. I can make a tool to replace only needed files though.
We do not edit the 6GB file, but Far Cry 3/4 looks for a patch_hd.dat/fat pair which is used to override files loaded into the game. FC:Primal doesn't load this file, but I believe we can exploit a currently nonexistent patch_sound.dat/fat file to accommodate the mods. However, for this type of modding to work, I'm afraid it would be a requirement to allow new files to be added to dat/fats, rather than replacing pre-existing ones...

If the compression used on the dat/fat is backward compatibele with earlier versions, perhaps the Dunia tools could still work. In that case, we'd only need your unpacker. :)

If you could locate and share an .xbt texture used in something obvious (like Sayla, or a mammoth or something) and give me the filepath it's stored in, I could see if I can make the game load a modified one as part of a mod using the Dunia tools.


Top
 Profile  
 
 Post subject: Re: Far Cry Primal models
PostPosted: Tue Jan 17, 2017 4:59 pm 
Offline
double-veteran
double-veteran

Joined: Tue Mar 24, 2015 8:12 pm
Posts: 1209
Has thanked: 20 times
Have thanks: 574 times
bouvrie wrote:
If the compression used on the dat/fat is backward compatibele with earlier versions, perhaps the Dunia tools could still work. In that case, we'd only need your unpacker. :)


No, its not compatible. But I can always put them back uncompressed. This worked in Watch Dogs.

So now its time to decide. I have lots of other projects in queue. I can do something quick now, but that will not be much, just some simple solution if it works. If you want better tools, you have to wait until I finish other projects.

p.s. Don't update your messages, this way I won't probably notice it.


Top
 Profile  
 
 Post subject: Re: Far Cry Primal models
PostPosted: Tue Jan 17, 2017 7:36 pm 
Offline
advanced

Joined: Sat Mar 18, 2006 5:29 pm
Posts: 49
Has thanked: 13 times
Have thanks: 1 time
daemon1 wrote:
So now its time to decide. I have lots of other projects in queue. I can do something quick now, but that will not be much, just some simple solution if it works. If you want better tools, you have to wait until I finish other projects.
Seeing time is a factor, I'd already be very much interested in just a plain dat/fat unpacker. If you can do that quick, I can work on uncovering the file/object structure, start a Dunia2 project definition for Primal, and perhaps get some more insights to help me with Far Cry 4 modding in general as well.

Putting things back into existing dat/fats, or creating dat/fats from scratch would be of later concern to me. Don't let me distract you from your other projects, time is precious as it is! :)


Top
 Profile  
 
 Post subject: Re: Far Cry Primal models
PostPosted: Wed Jan 18, 2017 2:46 pm 
Offline
ultra-n00b

Joined: Sun Mar 06, 2016 1:36 am
Posts: 5
Has thanked: 1 time
Have thanks: 0 time
Hey guys!

Sorry for it's a bit off and that I'm kinda noob, but if you could unpack the patch.fat/.dat then it would be possible to get the oasisstrings.bin (for localization), right? At least I think there is an oasisstring.bin, based on FC3.

If you could look into that, it would be appreciated. :wink:


Top
 Profile  
 
 Post subject: Re: Far Cry Primal models
PostPosted: Wed Jan 18, 2017 5:04 pm 
Offline
advanced

Joined: Sat Mar 18, 2006 5:29 pm
Posts: 49
Has thanked: 13 times
Have thanks: 1 time
FartingSquirrel wrote:
if you could unpack the patch.fat/.dat then it would be possible to get the oasisstrings.bin (for localization), right?
Yep, that's what I'm expecting, along with more insight in the NomadObjects file for future modding. I'm even hoping to find something that may counteract Far Cry 4's LOD pixelation pop, if it can be ported over to FC4! :)


Top
 Profile  
 
 Post subject: Re: Far Cry Primal models
PostPosted: Wed Jan 18, 2017 8:57 pm 
Offline
double-veteran
double-veteran

Joined: Tue Mar 24, 2015 8:12 pm
Posts: 1209
Has thanked: 20 times
Have thanks: 574 times
Ok i got first results. Loaded all the filenames and checked.

From the main 6gig file i have 173612 files with names, and 33601 still have no names.

They only provided names for main files, so "common.dat" has no names yet.


Top
 Profile  
 
 Post subject: Re: Far Cry Primal models
PostPosted: Wed Jan 18, 2017 9:53 pm 
Offline
double-veteran
double-veteran

Joined: Tue Mar 24, 2015 8:12 pm
Posts: 1209
Has thanked: 20 times
Have thanks: 574 times
Now I extracted LANGUAGES\english\oasisstrings.oasis.bin from common.dat and it really has lzo1x compressed text inside (as was said before). Here's an example of the very first string I'm getting from there:

Code:
Some Wenja need your help to reach a sacred place where they will honor the spirits. <font color='#f46b00'>Escort</font> the Wenja to their destination and defend against any threats.
<font color='#f46b00'>Rescued Wenja</font> will join your village and increase the population.


Top
 Profile  
 
 Post subject: Re: Far Cry Primal models
PostPosted: Thu Jan 19, 2017 1:26 am 
Offline
advanced

Joined: Sat Mar 18, 2006 5:29 pm
Posts: 49
Has thanked: 13 times
Have thanks: 1 time
Nice! it really does look much like the older Far Cry modding. :) Speaking of the dpv compressed file, FC3 is again present:
Quote:
<Archetype ArchetypeId="7660420242520" hidArchetypeResId="entityarchetypeslibrary\7660420242520.ark.fcb" Name="WeaponProperties:FC3/MP5" />
In case you want a filelist dictionary to 'unpack' more of the remaining dat/fat files: The majority can be found in the archive at http://janne252.com/downloads/fc4/gibbed_fc4project.zip , in the "Far Cry 4\files\" dir. For Far Cry 4, nonetheless.


Top
 Profile  
 
 Post subject: Re: Far Cry Primal models
PostPosted: Thu Jan 19, 2017 6:06 pm 
Offline
ultra-n00b

Joined: Sun Mar 06, 2016 1:36 am
Posts: 5
Has thanked: 1 time
Have thanks: 0 time
daemon1 wrote:
Now I extracted LANGUAGES\english\oasisstrings.oasis.bin from common.dat and it really has lzo1x compressed text inside (as was said before).


Wow, cool. So, that means the texts are editable now, and only a repacking method is needed for them?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 123 posts ]  Go to page 1, 2, 3, 4, 5 ... 9  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 7 guests


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:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group