How to unpack data packs on Linux

How to unpack data packs on Linux

Introduction

When Feral ported Medieval 2 to Linux they unfortunately left out the tools to unpack the data packs. I found a guide[www.twcenter.net] that works, but didn't see it on steam so I'm putting in the effort of copying it here for ease of access.

This guide will more or less completely mirror the steps for unpacking for Windows but will contain additional steps to make everything accommodate our choice of OS. The original guide was written with Ubuntu in mind and I myself just saw it to completion with no errors on Manjaro; while I can't say for certain it'll work with your distro I'm confident that it'll function for most.

Preperation

Downloading the Unpacker FilesAgain, the files needed to unpack were never shipped with the Linux version, so download them from here[www.twcenter.net] . The contents of the archive should be as such:

unpacker.exe ReadMe.txt unpack_all.bat unpack_americas.bat unpack_britannia.bat unpack_crusades.bat unpack_teutonic.bat files_individual.bat files_types.bat

Required ProgramsA text editorThe original author saw fit to remind the reader that they should have a text editor available, whether it be the distro default or any other. I'm keeping in this reminder.

WINEThis should be readily available on your package manager. Run the distro appropriate command such as, for Ubuntu:

sudo apt install --install-recommends winehq-stableor, for Arch:

sudo pacman -Syu wine

WINEtricksA good GUI front end for configuring WINE. The original guide links to another guide[askubuntu.com] for configuring WINE so it may do things more complicated than simply unpacking the data packs. I don't think all of that work is necessary for the scope of our guide here, however it wouldn't hurt to search up how to best configure WINE w/ or w/o WINEtricks for your distro here before proceeding.

File Placement


How to unpack data packs on Linux image 12
How to unpack data packs on Linux image 13

You can quickly access your Medieval 2 install location by clicking the cog on the left hand side and navigating to browse local files. From here enter share and then data. You're going to want to create two new folders here to house the unpackers so that they may work properly. Create a tools folder here and inside it create an unpacker folder.

Alternatively: cd /home/USER/.local/share/Steam/steamapps/common/"Medieval II Total War"/share/data mkdir tools && $_ mkdir unpacker && $_

Extract all the files from the .zip downloaded earlier into the unpacker folder.

Unpacking The Data Packs

Editing the .batsYou're going to have to edit the .bat file you want to use before running it through WINE. By default the destination folder for all of the .bats is /home/user/unpack Go ahead and fill in user with your actual user name. I glossed over this a few months back on my first go with the original guide and couldn't figure out at all why the unpacker crashed on the first item.

The unpacker also comes with two additional files that allow for the unpacking for a singular file or file extension: files_individual.bat and files_types.bat. At the end of the former finish the filter command with the file you want. Example:

unpacker.exe --source=..\..\packs\*.pack --destination=/home/user/unpack --filter=export_descr_unit.txtIf you wish to restrict this further to a single campaign specify that before \packs\*.pack. An example of that with an example of the latter .bat:

unpacker.exe --source=..\..\mods\americas\packs\*.pack --destination=/home/user/unpack --filter= *.TGA

Running the .batsNow we simply have to execute WINE from the directory that the .bats should be in. Here is an example of the commands to unpack everything:

wine cmd start unpack_all.batWINE should open a new window. You must accept three times for the process to continue. You're going to be here for a while. Don't close until WINE finishes and it's recommended to enter the command exit before closing your terminal to prevent any arcane dark magic from corrupting the extracted files. While you're waiting go into the /home/USER/.local/share/feral-interactive/Medieval II Total War/VFS/Local/preferences/ directory and edit your preference.cfg You must append this to the end of the file to force the game to use the unpacked files when booting and not go into the data packs:

[io] file_first = trueYou'll then have to set this file to read only like on Windows to prevent Medieval 2 from removing that from the config on boot. If you don't you'll see that subsequent boots will discard any changes you may have made to the unpacked files.

When the process is done go into the /home/USER/unpacker/data directory and move everything to /home/USER/.local/share/Steam/steamapps/common/Medieval II Total War/share/data/data/. On Windows everything would've extracted here. You should be able to edit the destination directory in the .bats to automate this if you wish. The Windows version of the .bats use --destination=..\..\ to automatically extract to the data folder. I don't know if this would work on Linux with Wine but I'll give it a chance myself another day. Feel free to try that and report to me if it works so we can cut this guide down a little.

Trouble ShootingIf the unpacker tells you a DLL file is missing you should be able to find that at Medieval 2's main directory. Simply copy and paste it into the unpacker directory

If the unpacker gives you a success message and you don't see your files check the .bat for any typos. They default to home/USER/unpacker

If you're told the pack is corrupt then verify the integrity of Medieval 2.

Conclusion

And that should be everything. Credit to Socrates1984 of the TWCenter forums for his original unpacking on Linux guide. Feel free to give feedback, correct grammatical errors, and propose revisions for improved clarity.

Source: https://steamcommunity.com/sharedfiles/filedetails/?id=2690265578					

More Total War: MEDIEVAL II - Definitive Edition guilds