OpenWorldGames Server ONE

Video games => Far Cry 2 => Far Cry series => Single player modding => Topic started by: wobatt on January 18, 2015, 04:25:53 PM

Title: Far Cry 2 XML File Decoder v0.4
Post by: wobatt on January 18, 2015, 04:25:53 PM
I've just uploaded the new version 0.4 of my XML file decoder here  :)

This started as a program to translate more of the hashes in the XML produced by the Gibbed tools, but I have also improved the tools created by Gibbed to identify more files an translate hashes more completely, so it is much easier to mod.

Key changes in version 0.4:

Key changes to Gibbed tools:

I've added it to the downloads here at OWG (http://www.openworldgames.org/owg/forums/index.php?action=downloads;sa=view;down=189).
Title: Re: Far Cry 2 XML File Decoder v0.3
Post by: PZ on January 18, 2015, 10:57:37 PM
Done, wobatt  :-X
Title: Re: Far Cry 2 XML File Decoder v0.3
Post by: wobatt on January 19, 2015, 02:13:38 PM
Thanks  :-X
Title: Re: Far Cry 2 XML File Decoder v0.3
Post by: aleeque on February 01, 2015, 03:58:50 PM
Wow, nice tool!

Do you think you could decode more words? I think I'm onto something regarding changing weather conditions in FC2. Basically, it goes like this:

Unpack worlds.fat and navigate to this folder: \worlds\world1\generated\. There will be a file called "world1.managers.fcb". Open it with a hex editor and search for the string "Default.StormIntensity.Default." In Far Cry 3, there was also a similar binary file with the exact same tag and the bytes under it are used to control weather! I've even written a detailed guide on how to do it here (http://forums.nexusmods.com/index.php?/topic/2492899-how-to-make-rain-moreless-frequent-tutorial/).

So if you somehow managed to translate this .fcb file into a readable .xml, I believe we would be able to change weather conditions in FC2.
Title: Re: Far Cry 2 XML File Decoder v0.3
Post by: Art Blade on February 01, 2015, 04:09:05 PM
Hello and welcome to OWG, aleeque :)

Nice information there and good luck with it :)

I usually lock weather conditions using the timescale 0 cheat but can't change those conditions.
Title: Re: Far Cry 2 XML File Decoder v0.3
Post by: aleeque on February 01, 2015, 04:30:35 PM
Yeah, I set my timescale to 18 (three times faster than normal) so that it gives me some day/night and weather variety.

In Far Cry 3 though, I'm able to control weather entirely which is even better, especially considering how awesome rain looks in that game.
Title: Re: Far Cry 2 XML File Decoder v0.3
Post by: Art Blade on February 01, 2015, 05:22:31 PM
cool. I liked the long nights in FC2. FC3 is laughable by comparison. Is there a way to get longer nights in FC3, too? If, how?

I just skimmed your nexus article. Hehe, so I suppose you're a fan of Ziggy's mod, too  ^-^
Title: Re: Far Cry 2 XML File Decoder v0.3
Post by: aleeque on February 01, 2015, 05:49:21 PM
there is, actually
http://www.reddit.com/r/farcry/comments/2jpoxx/how_do_i_changemod_the_timescale_in_far_cry_3/ (http://www.reddit.com/r/farcry/comments/2jpoxx/how_do_i_changemod_the_timescale_in_far_cry_3/)

though I set mine to default in FC3.
Title: Re: Far Cry 2 XML File Decoder v0.3
Post by: PZ on February 02, 2015, 08:44:17 AM
Nice w@&k, aleeque - welcome to the forum  ;)
Title: Re: Far Cry 2 XML File Decoder v0.3
Post by: OWGKID on February 02, 2015, 09:33:59 AM
Quote from: aleeque on February 01, 2015, 05:49:21 PM
there is, actually
http://www.reddit.com/r/farcry/comments/2jpoxx/how_do_i_changemod_the_timescale_in_far_cry_3/ (http://www.reddit.com/r/farcry/comments/2jpoxx/how_do_i_changemod_the_timescale_in_far_cry_3/)

though I set mine to default in FC3.


Cool  :-X Would be nice to mod the timescale to a realistic 24-hour cycle for the ULTIMATE REALISM  :-() :-()
Title: Re: Far Cry 2 XML File Decoder v0.3
Post by: Art Blade on February 02, 2015, 09:40:13 AM
thanks for the link, and a surprisingly nice read going down that thread, too.  :)
Title: Re: Far Cry 2 XML File Decoder v0.3
Post by: OWGKID on February 02, 2015, 09:42:52 AM
Quote from: wobatt on January 18, 2015, 04:25:53 PM
I've just uploaded the new version 0.3 of my XML file decoder here  :)

In the XML files produced by the Gibbed extractor, it can convert most hashes into readable names, and translate most BinHex values into numbers and readable text.
It should make modding a bit easier  :-D

I've added it to the downloads here at OWG (http://www.openworldgames.org/owg/forums/index.php?action=downloads;sa=view;down=189).

Err, I get an error message called "Error loading MIDAS.DLL" What does that mean?  ???? ????
Title: Re: Far Cry 2 XML File Decoder v0.3
Post by: aleeque on February 02, 2015, 01:04:22 PM
you need to download that .dll. It's some sort of Delphi library.
Title: Re: Far Cry 2 XML File Decoder v0.3
Post by: Hell Diguner on February 02, 2015, 08:28:14 PM
Quote from: aleeque on February 01, 2015, 03:58:50 PM
Wow, nice tool!

Do you think you could decode more words? I think I'm onto something regarding changing weather conditions in FC2. Basically, it goes like this:

Unpack worlds.fat and navigate to this folder: \worlds\world1\generated\. There will be a file called "world1.managers.fcb". Open it with a hex editor and search for the string "Default.StormIntensity.Default." In Far Cry 3, there was also a similar binary file with the exact same tag and the bytes under it are used to control weather! I've even written a detailed guide on how to do it here (http://forums.nexusmods.com/index.php?/topic/2492899-how-to-make-rain-moreless-frequent-tutorial/).

So if you somehow managed to translate this .fcb file into a readable .xml, I believe we would be able to change weather conditions in FC2.
Gibbed's tools can extract the contents of .fcb files. See http://www.openworldgames.org/owg/forums/index.php?topic=3620.0 (http://www.openworldgames.org/owg/forums/index.php?topic=3620.0) for something similar to the procedure you'd have to follow.

Then you can run wobatt's tools to further de-mystify the .xml files.
Title: Re: Far Cry 2 XML File Decoder v0.3
Post by: wobatt on February 03, 2015, 04:00:20 AM
Quote from: aleeque on February 01, 2015, 03:58:50 PM
Wow, nice tool!
Thanks!

Quote from: aleeque on February 01, 2015, 03:58:50 PM
Do you think you could decode more words?
Working on it, I may have something to release soon  :-D

I've downloaded the source code for the Gibbed tools, and I've made a few improvements, like adding support for 8 bit integer type. The names decoded in my program can be put into the binary_classes.xml file in the Gibbed tool so it can decode as it is extracting the files. This is better than my program, as it is MUCH faster.

Quote from: GKID7891 on February 02, 2015, 09:42:52 AM
Err, I get an error message called "Error loading MIDAS.DLL" What does that mean?  ???? ????
Sorry! I missed that dependency  :-[ 

Quote from: aleeque on February 02, 2015, 01:04:22 PM
you need to download that .dll. It's some sort of Delphi library.
It was written in Delphi, which usually does a good job of compiling dependencies into the program itself, so I wasn't aware of this. I will include this DLL in the next release.
Title: Re: Far Cry 2 XML File Decoder v0.3
Post by: OWGKID on February 03, 2015, 04:38:55 AM
Quote
Sorry! I missed that dependency  :-[ 
It was written in Delphi, which usually does a good job of compiling dependencies into the program itself, so I wasn't aware of this. I will include this DLL in the next release.

No problem  ;) :-X
Title: Re: Far Cry 2 XML File Decoder v0.3
Post by: aleeque on February 03, 2015, 05:14:42 AM
Quote from: Hell Diguner on February 02, 2015, 08:28:14 PM
Gibbed's tools can extract the contents of .fcb files. See http://www.openworldgames.org/owg/forums/index.php?topic=3620.0 (http://www.openworldgames.org/owg/forums/index.php?topic=3620.0) for something similar to the procedure you'd have to follow.

Then you can run wobatt's tools to further de-mystify the .xml files.
Yeah, that's what I did. Problem is, Wobatt's tool doesn't support all of the Dunia keywords at the moment, so it couldn't decipher world1.managers_converted.xml.
Title: Re: Far Cry 2 XML File Decoder v0.4
Post by: wobatt on March 02, 2015, 10:03:01 AM
Just uploaded version 0.4 of my tools, plus a modified version of the Gibbed tools that can extract more  >:D
Title: Re: Far Cry 2 XML File Decoder v0.4
Post by: OWGKID on March 02, 2015, 10:26:42 AM
Quote from: wobatt on January 18, 2015, 04:25:53 PM
I've just uploaded the new version 0.4 of my XML file decoder here  :)

This started as a program to translate more of the hashes in the XML produced by the Gibbed tools, but I have also improved the tools created by Gibbed to identify more files an translate hashes more completely, so it is much easier to mod.

Key changes in version 0.4:
  • Fixed bug where it wasn't loading some strings from the dictionary due to case sensitivity
  • Corrects RML tag duplications
  • Changed the way hashes are looked up, resulting in a massive performance improvement
  • Modified Gibbed tools included

Key changes to Gibbed tools:
  • Fixed a bug where converting XML to FCB and back again would cause additional nested <rml> elements to be added
  • Fixed a bug where it was impossible to extract art files from FAT/DAT as the "no art" option defaulted to true
  • Improved binary class definitions (FCB to XML convertions)
  • Improved file lists (unknown file translations)
  • Improved file type detection for unknown files

I've added it to the downloads here at OWG (http://www.openworldgames.org/owg/forums/index.php?action=downloads;sa=view;down=189).

1+  :-X :-D
Title: Re: Far Cry 2 XML File Decoder v0.4
Post by: PZ on March 02, 2015, 11:48:12 AM
Nice w@&k wobatt! +1  :-X
Title: Re: Far Cry 2 XML File Decoder v0.4
Post by: wobatt on March 02, 2015, 04:24:59 PM
Thanks  :-D

I've just counted up the differences between the original Gibbed tools and my modified version.






OriginalModified
Files identified:88284 (55%)155514 (97%)
Object names:15622120
Value names:4992493

Now to w@&k on shadersobj.fat   :D
Damn colliding hashes  :angry-new:
Title: Re: Far Cry 2 XML File Decoder v0.4
Post by: OWGKID on March 03, 2015, 12:23:06 AM


Could you make the FC3 tools compatible with Far Cry 4? :-D
Title: Re: Far Cry 2 XML File Decoder v0.4
Post by: wobatt on March 03, 2015, 03:56:52 AM
Quote from: GKID7891 on March 03, 2015, 12:23:06 AM
Could you make the FC3 tools compatible with Far Cry 4? :-D

That would mean buying FC4   :-\\
And I've not even got around to playing FC3 yet.
Title: Re: Far Cry 2 XML File Decoder v0.4
Post by: OWGKID on March 03, 2015, 04:16:19 AM

I have FC4 and the Dunia 2 tools. How did you updated Gibbed's tools? I can do it myself if you can tell me how to do it ;)  :-D Btw, your xml decoder seems to replace "." with ",". Can I fix that myself?
Title: Re: Far Cry 2 XML File Decoder v0.4
Post by: wobatt on March 03, 2015, 08:31:33 AM
Could you give me some more details about which file the . -> , replacement happens in? Is it only on particular values or all floats? Just thinking if it could be picking up a regional setting from your computer, which is why it would be fine for me.
I'll take a look at it when I get home from w@&k.


As for making changes yourself...

First step: Learn how to program in C#. I don't really have any tips on the best way to do this. I've used Java before, and Java code and C# code are almost the same, so even though I learnt C# for this project it wasn't much of a jump. You could use any other programming language in theory, but you would have to write new tools from scratch.

You will need a compiler; for C# this is usually Microsoft Visual Studio. It is quite expensive to buy retail, but if you are in/w@&k in education then you may be able to get a copy of this for free (or at least discounted) with DreamSpark (https://www.dreamspark.com/).
Otherwise, there is an open source IDE called MonoDevelop (http://www.monodevelop.com/) that should w@&k.

You will then need to use Subversion (SVN) (http://en.wikipedia.org/wiki/Apache_Subversion) to download the source code for the tools for FC2 (http://svn.gib.me/public/dunia/trunk/) or FC3 (http://svn.gib.me/public/dunia2/trunk/). There are several free programs that you can use for this.

After that I'm not sure. It really depends on how much the data files have changed in FC4.
What happens if you try to use the FC3 tools to extract the FC4 data files?
Title: Re: Far Cry 2 XML File Decoder v0.4
Post by: OWGKID on March 03, 2015, 08:53:57 AM
I'm using the ENGLISH version of Windows 8.1. Unfortunately, the school I am attending doesn't have any programming classes. Which means I don't know a thing about programming  :D  :( The float values in the 41_WeaponProperties and player.xml seems to get the "." -> "," conversation. Other values looks fine. Regarding the Dunia2 tool: I can unpack the .dat files, but I cannot open the files the tool produces. If I attempt to decompile a .fcb file, it will only give out a xml/rml... 
Title: Re: Far Cry 2 XML File Decoder v0.4
Post by: wobatt on March 03, 2015, 09:27:19 AM
Quote from: GKID7891 on March 03, 2015, 08:53:57 AM
Unfortunately, the school I am attending doesn't have any programming classes. Which means I don't know a thing about programming  :D  :(

Java is generally a good language to start learning from, partly because everything you need to get started is free  :-D  It's also quite widely used in business as it is the main language used for writing Android apps, so good to have on your CV. There are online courses and free tutorials widely available for it.
In contrast to C#, both commonly used Java IDEs are free, NetBeans (https://netbeans.org/) or Eclipse (https://eclipse.org/).
And once you can write Java, then you can write C#.

Quote from: GKID7891 on March 03, 2015, 08:53:57 AM
The float values in the 41_WeaponProperties and player.xml seems to get the "." -> "," conversation. Other values looks fine.

I will investigate later. Seems odd, not sure what could cause it. I've probably changed something by accident  :-\\

Quote from: GKID7891 on March 03, 2015, 08:53:57 AM
Regarding the Dunia2 tool: I can unpack the .dat files, but I cannot open the files the tool produces. If I attempt to decompile a .fcb file, it will only give out a xml/rml... 

That is actually very good. It means that the overall structure of the data files hasn't changed, so now it's 'just' a case of identifying the files  :-D

If you open them in a hex editor (e.g. HxD (http://mh-nexus.de/en/hxd/)), then the first few bytes can usually tell you what type of file it is. For example FCB files all have the first 4 bytes "nbCF". I have a program that I wrote to help me identify files in FC2, I could upload it, but I will need to write some instructions on how to use it first.

For decoding the XML extracted from the FCB files, my tool should still w@&k (in theory), but will need a different dictionary. The names are probably in one of the DLLs, but it is not trivial to extract them.
Title: Re: Far Cry 2 XML File Decoder v0.4
Post by: OWGKID on March 03, 2015, 11:52:52 AM
Regarding the Dunia2: In the "projects" folder, there are folders with xmls which shows the files the program are supposed to decode. Can I re-write them for Far Cry 4?
Title: Re: Far Cry 2 XML File Decoder v0.4
Post by: wobatt on March 03, 2015, 12:15:17 PM
Quote from: GKID7891 on March 03, 2015, 11:52:52 AM
Regarding the Dunia2: In the "projects" folder, there are folders with xmls which shows the files the program are supposed to decode. Can I re-write them for Far Cry 4?

Yes, well spotted :-X
Provided that nothing has majorly changed in how files are saved, that should be all that is needed.

I've uploaded a new version (http://www.openworldgames.org/owg/forums/index.php?action=downloads;sa=view;down=189) of my tools that should fix the comma problem.
Title: Re: Far Cry 2 XML File Decoder v0.4
Post by: OWGKID on March 03, 2015, 11:31:28 PM


The guys at nexusforums managed to mod the files by using a hex editor. Another forum stated that they had contacted "Rick/Gibbed" about FC4 support. Regarding that: Seems like the Dunia 2 tools need to be updated  ???
http://fc4modding.janne252.com/index.php?area=misc (http://fc4modding.janne252.com/index.php?area=misc) Those guys did the job alredy :o  ;)  :-D

Regarding floats: It doesn't process all floats correctly with a "."

   <value name="iRecoilRecoveryLevel" hash="158EFFD8" type="Int32">1</value> <!-- type="BinHex" value="01000000" -->
              <value name="fRecoilAchieveTime" hash="C0671E89" type="Float">0,1</value> <!-- type="BinHex" value="CDCCCC3D" -->
              <value name="fRecoilAnimationWeight" hash="641C31C5" type="Float">1,0</value> <!-- type="BinHex" value="0000803F" -->
              <value name="fRecoilMax" hash="0788D065" type="Float">45,0</value> <!-- type="BinHex" value="00003442" -->
              <object hash="F9FB3361" type="RecoilIK">
                <value name="fIKRecoilBurstSpeedIn" hash="9818FA35" type="Float">11.0</value> <!-- type="BinHex" value="00003041" -->
                <value name="fIKRecoilBurstPitchRandom" hash="7400B78C" type="Float">0.12</value> <!-- type="BinHex" value="8FC2F53D" -->
                <value name="fIKRecoilBurstSpeedOut" hash="7EFA3159" type="Float">7.0</value> <!-- type="BinHex" value="0000E040" -->
                <value name="fIKRecoilBurstPitchRate" hash="CC366276" type="Float">1.35</value> <!-- type="BinHex" value="CDCCAC3F" -->
Title: Re: Far Cry 2 XML File Decoder v0.4
Post by: PZ on March 04, 2015, 12:25:59 AM
These will be ready soon, I'll bet so even the novice modder can use them  :-X
Title: Re: Far Cry 2 XML File Decoder v0.4
Post by: wobatt on March 04, 2015, 02:23:48 PM
Quote from: GKID7891 on March 03, 2015, 11:31:28 PM
Regarding floats: It doesn't process all floats correctly with a "."

I've uploaded version 0.4.2, which should finally fix this issue. I'm still not completely sure why it's doing this for you and not me  :-\\
I added an extra step in the converter so that after it has formatted the floats it does a string replace for any "," with ".".
Title: Re: Far Cry 2 XML File Decoder v0.4
Post by: OWGKID on March 04, 2015, 11:32:36 PM

Umm, the 0.4.1 version works fine now, I had to re-set my modding directory( re-run bootstrap) and then, run decodeXml. ;) It worked :-D :-D :-D Nice tool :-() :-() :-() :-() I used the old version (0.4) to process the files and used 0.4.1 after that. Seems like that caused the error  :D  :angel: Maybe you should add it to the Wob_ReadME that re-setting bootstrap may be necessary and remove older versions of your tool.
Title: Re: Far Cry 2 XML File Decoder v0.4
Post by: wobatt on March 05, 2015, 04:28:55 AM
Ok, will add it to the readme  :-X
The way I wrote the fix in 0.4.2 would have corrected any "," that were put in by 0.4 anyway, but it's still probably best to reset.