Results 1 to 1 of 1

Thread: [Modding] Shogun2: Editing the new startpos.esf files

  1. #1

    Default [Modding] Shogun2: Editing the new startpos.esf files



    Author: Akaie
    Original Thread: [Tutorial] Editing the new startpos.esf Files

    Editing the new startpos.esf Files

    Editing the new startpos.esf Files


    Preamble
    As of the late March 2012 patch, CA has rolled out .esf files with greater compression (around 10% of their original sizes, which is great for TWC bandwidth ). taw quickly came to our rescue, updating his esfxml tool so we can open and edit these new .esf files. Credits go to taw for both the tools and conveying how to use them .

    I wrote this tutorial because there will no doubt be some lack of understanding as to how it works. It can be daunting, so hopefully this tutorial will make things clear. As a side note, this thread documents things about the .esf changes.

    Firstly, you’ll need to download two things:
    -taw’s tools
    -lzma SDK

    I also assume you have these/know how to use these:
    -Windows (Specifically, I assume you’re working with Windows 7)
    -A program that can open both .bz2 and .zip files (7zip works, and it’s free)
    -Pack File Manager (to extract the .esf files)
    -Concentration

    ---

    Extract the first download to a place on your computer you will remember. In the file “taw-etwng-c0d4476.zip” will be a folder with the same name, minus the .zip bit, and a collection of folders inside it. The important one is “esfxml”.

    To make decompressing and compressing quicker, extract all the files inside “lzma920.tar.bz2” into the “esfxml” folder as highlighted above. As a side note, if you use WinRAR, it will take you to the numerous files you’ll need. If you use 7zip, you need to open “lzma920.tar” that will show up in the 7zip window when you open "lzma920.tar.bz2" with 7zip. Just make sure you are extracting several folders and .exe files. If you did this right, the “esfxml” folder should look like this:
    Spoiler Alert, click show to read: 


    To be able to use any of taw’s tools, you need to install JRuby and then nokogiri. You can download Jruby here. If you don’t know what you’re doing, just download this version of JRuby. When that is done, go to your “esfxml” folder and double click on “install_nokogiri.bat”. Make sure you right-click and “Run as administrator” because UAC will most likely block it without telling you (I learnt that the frustrating way).

    Now that that is all done, the tools should work. Using your keen PFM skills, extract the startpos.esf and paste it in the “esfxml” folder. Here’s where it may seem complicated. Hold your left “shift” key, right click on the window that is displaying the contents of the “esfxml” folder and select “Open command window here”. What this is doing is telling command prompt to make all of our demands relative to the “esfxml” folder, where ever on the computer you’ve placed it.

    From here, you need to copy and paste a few things.

    First of all, paste
    Spoiler Alert, click show to read: 
    jruby esf2xml startpos.esf startpos_dir
    into the command window by right-clicking and clicking “paste”. Now hit enter. If the command worked properly, you should now see a new folder named “startpos_dir” and the command window should give you the same response as it gives me. Here’s a pic of that:
    Spoiler Alert, click show to read: 


    Now for the second command line. Just as you did last time, paste
    Spoiler Alert, click show to read: 
    lzma d startpos_dir/compressed_data.esf.xz startpos_dir/compressed_data.esf

    into the command window and hit enter. If it worked, you should be able to find a file called “compressed_data.esf” in the “startpos_dir” folder. Here is yet another pic, showing both the “compressed_data.esf” file in the “startpos_dir” and the response the command window gives after running the second line.
    Spoiler Alert, click show to read: 


    Lastly, enter this line in the same way as you did with the last two:
    Spoiler Alert, click show to read: 
    jruby esf2xml startpos_dir/compressed_data.esf startpos_dir_nested

    This one will take much longer than the other two lines. It is kind enough to give you a percentage of how much it is done every few seconds. If it worked, you should see a new folder, “startpos_dir_nested” and quite a list of things in the command prompt window. If it looks like this, keep going:
    Spoiler Alert, click show to read: 


    Inside the “startpos_dir_nested” folder is all the uncompressed data in a generally understandable fashion. Because this is a more lengthy process in comparison to using ESFEditor, you may not be able to find your away as well as you could with that program. As such, I’ll try to help you out there. Those who have used taw’s tools before will have a good idea where everything is, as it seems the core .esf setup is much of the same.

    The last steps are re-compiling the data into what will be a modified startpos.esf file. All you have to do now is reverse the three command lines. As you did before, open the command window (if you closed it, here is the instructions: Hold your left “shift” key, right click on the window that is displaying the contents of the “esfxml” folder and select “Open command window here”).

    Firstly, paste this line
    Spoiler Alert, click show to read: 
    jruby xml2esf startpos_dir_nested startpos_dir/compressed_data.esf
    and wait until it is finished. There is no percentage indicator like before, so just wait until a second directory line shows up, which indicates completion.


    Secondly, paste this
    Spoiler Alert, click show to read: 
    lzma e startpos_dir/compressed_data.esf startpos_dir/compressed_data.esf.xz
    It will be completed quickly.


    Lastly, paste this
    Spoiler Alert, click show to read: 
    jruby xml2esf startpos_dir startpos.esf

    To make sure everything went smoothly, check the date at which the startpos.esf was last modified and cross-check it with what the time is at the moment.

    If you have an issue, I need you to be specific. Before telling me you have a problem, make sure you try and go through the tutorial again with greater concentration. If you don't quite understand something, post instead of giving yourself a headache and I'll try to help .
    Last edited by Sir Adrian; December 07, 2013 at 01:03 PM. Reason: updated author name

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •