Jump to content


Photo

The Linux User's Guide to Installing Mods on the Enhanced Editions


2 replies to this topic

#1 corvias

corvias
  • Members
  • 66 posts

Posted 20 January 2017 - 10:09 PM

The Linux User's Guide to Installing Mods on the Enhanced Editions
 
Installing mods for the Linux versions of Beamdog's Enhanced Editions is a bit of a trashfire. The problem starts from the fact that Linux is a case-sensitive OS. In other words, foo.txt and FOO.txt are two different files. On Windows and macOS, which are case-insensitive, these are the same file. Before the EE's, Linux gamers could just use the tolower tool that comes with Weidu. This method still works for installing mods on EE versions... until you try to start the game. It crashes because it is looking for a number of mixed case filenames that are no longer there. Sigh.
 
There have been a number of solutions that work to varying degrees using bash scripts that do the job of tolower AND keep track of the filenames so they can be restored later, or create a crap ton of mix-case symlinks to tolowered game files. However there always seems to be some situation that derails these methods.
 
Fortunately, I found a post on Pocket Plane by Koteko that forms the base for a pretty solid solution that I would like to flesh out and improve here. I have been using this method myself to test K4thos's Enhanced Edition Trilogy mod, which has a very intensive install process. So far it's been rock solid. (mostly)
 
Here's the summary of what we're going to do:
 
Part I - Creating a Virtual Disk to store the games and modding tools
1. Create a disk image.
2. Put an NTFS filesystem on it.
3. Mount it with Tuxera's ntfs-3g fuse driver in CASE SENSITIVE mode.
4. Move EE games to the mounted image.
5. Replace the emptied game folders with symlinks to the games on the mounted image.
6. Edit /etc/fstab so the image gets mounted on boot.
 
Part II - Install Weidu and other mod Tools
1. Create a directory in our modbox for tools
2. Add the tools directory to your $Path
3. Install Weidu
4. Install modmerge
5. Unpack Siege of Dragonspear
6. Finish
 
Part III - How-To's, Caveats, and PAQ's (Preemptively Answered Questions)
1. Installing Mods
2. Quickly Converting Line Endings
3. Chitin.key, Backslashes, and You
4. Re-mounting as Case-Sensitive
5. Some Notes for Steam Users
6. PAQ: "Why not just make /mnt/modbox a Steam Library?"
7. PAQ: "ciopfs can do this too..." or "dd is better..." or "truncate is better..."
8. PAQ: "Why not just use a REAL OS?"
 
When we're done, you'll have your EE games in a place where you can install weidu mods without having to screw around with filename or symlinks AND run the game.
 
Ready? Let's do it!
 
Part I - Creating a Virtual Disk to store the games and modding tools
 
1. Create a disk image.
 We're going to make a 30G image. That should be enough room for vanilla copies of BG:EE, BG2:EE, and IWD:EE with some extra room for mods. We are naming our image file "ee_modbox.img"
fallocate -l 30G ee_modbox.img
 
2. Put an NTFS filesystem on it.
You'll need ntfs-3g on your system. Install it using whatever method suits your distro.
mkntfs -F ee_modbox.img
You may get some stern warnings. I believe they only matter if we were going to boot a windows installation from the image... which we aren't. So ignore them.
 
3. Mount it in CASE SENSITIVE mode.
After mkntfs has done its thing, create or pick a directory somewhere as the mountpoint for the image. Depending on your distro, you'll either need to be root or use "sudo". I'm going to use /mnt/modbox for this example. We are going to temporarily mount this in case-sensitive mode for the copy job. We might not have to, but its more of a precaution from Steam sometimes getting grouchy later on.
ntfs-3g ee_modbox.img /mnt/modbox
4. Move EE games to the mounted image.
Create a new directory for each of the games you will be moving. use something short and lowercase.
mkdir /mnt/modbox/{bgee,bg2ee,iwdee}
Now move your game files to these directories. If you are using Steam, which I am in the examples below, make sure it is not running. The game files will be located in the SteamApps/common directory of wherever your Steam Library is located. By default, this would be ~/.local/share/Steam/SteamApps/common, but you can look in Steam's "Download" settings to find out for sure.
mv ~/.local/share/Steam/SteamApps/common/Baldur\'s\ Gate\ Enhanced\ Edition/* /mnt/modbox/bgee
mv ~/.local/share/Steam/SteamApps/common/Baldur\'s\ Gate\ II\ Enhanced\ Edition/* /mnt/modbox/bg2ee
mv ~/.local/share/Steam/SteamApps/common/Icewind\ Dale\ Enhanced\ Edition/* /mnt/modbox/iwdee
5. Replace the emptied game folders with symlinks to the games on the mounted image.
rmdir ~/.local/share/Steam/SteamApps/common/Baldur\'s\ Gate\ Enhanced\ Edition
rmdir ~/.local/share/Steam/SteamApps/common/Baldur\'s\ Gate\ II\ Enhanced\ Edition
rmdir ~/.local/share/Steam/SteamApps/common/Icewind\ Dale\ Enhanced\ Edition


ln -s /mnt/modbox/bgee ~/.local/share/Steam/SteamApps/common/Baldur\'s\ Gate\ Enhanced\ Edition
ln -s /mnt/modbox/bg2ee ~/.local/share/Steam/SteamApps/common/Baldur\'s\ Gate\ II\ Enhanced\ Edition
ln -s /mnt/modbox/iwdee ~/.local/share/Steam/SteamApps/common/Icewind\ Dale\ Enhanced\ Edition
Test that the games run before proceeding.
 
6. Edit /etc/fstab so the image gets mounted on boot.
Edit your /etc/fstab in your text editor of choice and add this line:
/path/to/ee_modbox.img    /mnt/modbox lowntfs-3g    windows_names,ignore_case,umask=007,uid=your_user_name       0       0
Be sure to change "your_user_name".
Save, reboot, and check to see that the virtual drive was mounted and that the games work.
 
Part II - Install Weidu and other mod Tools
 
1. Create a directory in your modbox for tools
mkdir /mnt/modbox/tools
2. Add the tools directory to your $Path
PATH=$PATH:/mnt/modbox/tools
export PATH
Put the above in your ~/.bash.rc so it persists across reboots.
 
3. Install Weidu
 
Download Weidu for Linux from: http://www.weidu.org/~thebigg/. Extract the contents for your architecture from the archive to your tools directory. You can exclude tolower ;-).
 
4. Install modmerge
 
You only need this if you have BG:EE and SoD. Download Scott Brook's "modmerge" tool for your architecture from: https://github.com/S...dmerge/releases and extract it to the tools directory.
 
5. Unpack Siege of Dragonspear
From a terminal, cd into your bgee directory and run:
modmerge
Answer "y" and wait for the process to complete.
 
6. Finish
That's it! You now have a handy environment that will allow you to easily install mods AND play the games without screwing around with renaming files or symlinks. Read on for some guidance on installing mods and potential caveats.
 
Part III - How-To's, Caveats, and PAQ's (Preemptively Answered Questions)
1. Installing Mods
Download a mod and extract it. There is usually a directory named after the mod that contains its resources. The mod directory itself goes into the game's directory, not the contents of the mod directory. To install the mod, open a terminal, cd into the game's directory, and run:
weinstall name_of_mod
If the mod is not arranged as described, or if for some reason the method above doesn't work, look for a .tp2 file and run:
weidu name_of_mod.tp2
IMPORTANT: Installation order of mods matters! However, this is not a guide about installation order. Look around the various IE modding sites where there are resources, such as Big World Project, that can give you much better guidance in this area than I can.
 
2. Quickly Converting Line Endings
Speaking of Big World Project, if you are planning on doing a Mega Mod install, chances are you are going to be installing the Big World Fixpack. This unique mod works differently than other ones. You first have to extract all your mods, but NOT install them. Then you run the BWFP and it looks through those extracted mods and modifies them to fix cross-mod incompatibilities... except it won't for us because text files in the Linux world use one type of line ending, and Windows uses another, so BWFP won't be able to find any of the search strings it's looking for. dos2unix to the rescue! Just to be safe, extract all of your mods, including BWFP, to an empty directory rather than your game folder. cd into the directory with your mods and run the following one-liner:
find ./ -type f -print0 | xargs -0 dos2unix --

This line will save you from having to run dos2linux yourself a couple hundred times. I wish I could take credit for this, but someone way smarter posted it on stack overflow. Note: You may have to install dos2unix from you friendly neighborhood package repository.

 
3. Chitin.key, Backslashes, and You
There's one other issue unique to Linux (and macOS) that we haven't entirely dealt with. Mods that recompile the chitin.key file with additional paths will use backslashes as path separators (because windows). Argent77 has written some code for his DLCbuilder tool that replaces the wrongslashes with rightslashes. I have packaged it into a separate mod which can be downloaded below. You ONLY need this if you aren't using DLCbuilder or K4thos's Enhanced Edition Trilogy, which has this built into the installation process as well. It should probably be the last mod in terms of install order. This is a temporary workaround until Weidu gets updated to handle this scenario. If you know of other solutions, please inform me and I will update this guide.
 
UPDATE: While doing my own mega install, I noticed that this tool is a bit more necessary than I thought. EET does it's chitin.key fix at the end of the "core" phase, before you've installed all of your other mods. Some of those other mods changed chitin.key and added more backslashes, and thus prevented the game from launching until I ran this fix. So depending on your mod loadout, you will definitely want to give this a run at the end of your install. 
 
Attached File  nix-wrongslashes.zip   798bytes   22 downloads
 
4. Re-mounting as Case-Sensitive
At some point, you might want to mount your modbox in case-sensitive mode. To do this, first unmount the virtual disk:
umount /mnt/modbox
and mount it again like this:
ntfs-3g ee_modbox.img /mnt/modbox
5. Some Notes for Steam Users
There is always the lurking danger of an update coming out and Steam hosing your carefully crafted mod loadout. And there is no way to turn off the Great God Auto Update. But there are a few things you can do to decrease the risk. First is to do a periodic backup of your game folder. I personally use backintime which lets me take snapshots of my game folders over the course of a large install. Next, you can set the game to update only when you run it, so you at least have a chance to catch a news item somewhere that a game updated. Last, you can go into steam settings and set a particular time to allow auto updates. Set it to a time when Steam will not be running. I suppose you might change the directory permissions for the game folders, but I have not experimented with the implications of this. Please feel free to share your ideas.
 
One last thing, don't use the "verify game files" in Steam's properties for the game. See below.
 
6. PAQ: "Why not just make /mnt/modbox a Steam Library?"
I know, it totally makes sense. I tried it that way first. It did not go well. I foolishly decided to verify the game's files in steam, and it wanted to perpetually re-download the game. Please feel free to experiment and let me know how it goes.
 
7. PAQ: "ciopfs can do this too..."
There have been other posts here and there about getting around the case-sensitivity issue with ciopfs. I tried it that way, too. I found it weird, confusing and counter intuitive for this particular use-case. YMMV.
 
8. PAQ: "You should use dd/truncate instead, because..."
You are absolutely welcome to use whatever tool suits your technical ideology. Freedom is a beautiful thing. I chose to use fallocate because the command was easy to remember. That's all.
 
9. PAQ: "Why don't you just use Windows?"
Please don't. I'm trying to help my fellow penguins reach the mod nirvana that other OS users enjoy, and that's good for everyone!

Edited by corvias, 25 January 2017 - 09:48 AM.


#2 lynx

lynx
  • Modders
  • 2848 posts
  • Gender:Male
  • Location:Ljubljana, Slovenija

Posted 21 January 2017 - 08:19 AM

Just two notes:

- the rms should be rmdirs

- the first mkdir line will likely confuse copy-pasters, so I suggest you either write all three explicitly or use brace expansion


GemRB - IE anywhere.
Mages needed! Looking for Planescape: Torment testers
Market android version IS NOT SUPPORTED ANYMORE: reported bugs will be ignored! Still looking for builders ...

#3 corvias

corvias
  • Members
  • 66 posts

Posted 21 January 2017 - 09:53 AM

Just two notes:

- the rms should be rmdirs

- the first mkdir line will likely confuse copy-pasters, so I suggest you either write all three explicitly or use brace expansion

- Good call.

- LOL. I had it that way originally, but I thought I would get complaints about the opposite. Plus I screwed up the command in the first place.





Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users