Linux Gaming Experience – 2

Even with Steam making available more titles to game on Linux, certain things were still “Windows only”, like modding the game. Some video games are popular only because of the plethora of mods available, like the Elder Scrolls series or the Fallout series. It is really too much to ask the mod author to also support another platform, when he is already distributing mods for free, developing which he must have put numerous hours in, without any monetary expectations. Especially if mods require some “dll” files to be modified – which are Windows specific.

But if WINE or Proton can run an executable, why can’t they run those cooked dlls too? Of course they can, so lets see how it turned out!

2/n: Modding the Elder Scrolls 4: Oblivion on Linux

The Elder Scrolls 4: Oblivion (2006) for PC is available on Steam as a Delux edition containing all DLCs and official mods. It was a big hit on non-PC platforms like XBOX and Playstation as well, but unfortunately, controller support is not great for PC editions. It is a shame really, for games released also on consoles to not have native gamepad support on PC, when it is just a matter of providing multiple input controls config. There is no justification why the PC master race cannot have the best of both worlds. But more on that in another post maybe.

In order to use a XBOX controller on PC, we have to install a mod, which not just replaces some static files in the data directory, but also uses some cooked dlls, since it has to alter the input configuration at runtime. The Oblivion modding community uses OBSE for the purpose. OBSE has support for both Steam and Non-Steam versions, though I found that it required some additional steps to run via Proton in Linux.

After installing Steam Oblivion on Linux (and running it once, so that Proton creates the required Windows directories), we need to

1. Download the mod archive from Nexus

2. Download OBSE and install to game Data directory. Then follow these steps as it seems there is some issue with OBSE running via Proton.

3. Extract the mod to some location

Here is where things are a little different in Linux compared to Windows – Oblivion uses timestamp of the files in Data directory to determine whether to use loose files (assets) that exist there, in place of the packed assets (.bsa files) that were installed with the game. For loose files to be recognized, they must have a later timestamp than the installed files. Steam sets timestamp of the files as the one during installation, so any mod that has a past timestamp compared to this (i.e. virtually all mods) will not be picked up by the game during launch.

There are two ways to overcome this. First is to use archive invalidation. There are multiple ways to do so, among which this mod is simplest to use. It is basically a .bsa file that we register manually in Oblivion.ini, so that the game ignores this rule. It did not work just by itself in my case, so I had to do an additional thing – artificially alter the timestamps of all asset files of the mod before putting them in the Data directory.

4. Open a terminal in the mod extracted location and run

find . -exec touch {} \;

This will run the Linux “touch” command on all files inside the current directory recursively, which basically sets the modified timestamp to current. This would be later than the Steam installation timestamp, so our mod will now be recognized by the game.

5. Copy the contents of mod directory now, to game Data/

Another thing to note in Linux is that filenames are case sensitive. So “meshes” and “Meshes” are different! So if we install multiple mods, one way is to convert all asset filenames in lowercase, or another way is to keep track of what files are being replaced, and convert only the required ones but keep it consistent.

6. Apart from the above mod, I also used a texture pack for which I had to ensure this was the case.

7. For OBSE to work, we need Steam Overlay to be active. Although sometimes it breaks controller support, assuming our mod will take care of it, I enabled it.

8. Now I could launch Oblivion from Steam through OBSE – it will first be launched, and it will in turn launch the main executable. Once in the game, I could use controller as if it has native support, with button prompts changed as well. The mod also offers XBOX or Playstation theme for the buttons.

The only issue I faced was in the inventory menu, where controller did not give me a way to switch between main, quest, and magic inventories – I had to do that using the mouse! This looks like a mod issue, and would probably occur in Windows too.

Oblivion is an award-winning game, and being able to play with controller and using some high resolution textures in a 2006 game was really a great experience. Whatever concerns I had about modding the game on Linux, were completely taken care of. I played it on Linux as if I was playing on a console!

Linux Gaming Experience – 1

Gaming on Linux has evolved leaps and bounds. Compared to some 10 years ago, when we had to run games as Windows executables on WINE, Linux now has much better native support, and cross-platform compatibility thanks to Steam’s Proton.

But lets keep that discussion for another day. For now, let me share some unique experiences I have had while gaming on Linux in an n-part series. Most of these happened in the past, but never had a chance to put up here till now.

1/n. What happens to your Steam games if you re-install Linux

By re-installing Linux, I mean the whole shebang, not just “upgrading” to a newer version of the same distribution in place. I have had Linux Mint for a long time, and decided to try out Pop OS on the same partition after reading favorable reviews. So I formatted clean and installed Pop.

I had some Steam games installed on a secondary drive, one of them being Doom (2016). Since it was a mechanical drive, the game would take 5 mins to load into menu and another couple to load into a map, not to mention occasional micro-stuttering. I wanted to try it out on the home partition (SSD), but did not have space on it earlier so had installed on the mechanical drive. With the new Pop OS installation, I now had space in the home directory to do so.

But I did not want to re-download 70 GB for the experiment. So I copied the game directory and manifest from original location into the new steam installation. Booted up Steam, and it automatically found that Doom was playable (though it did download around 100 MB of shaders and the newer Proton 4.11). Clicked on Play, and it ran like a fresh installation! SSD made it much better than earlier, with absolutely no stutter, and frames locked at 60 fps. And with Steam cloud saves, you continue in the new installation right from where you left off in the previous!

Though performance boost was due to SSD, the main thing to note here is how easy it was to simply copy an existing game installation into fresh Linux partition and start playing. It would have worked even if the game was originally on the partition I wiped clean, just that I would have had to take a backup to external drive. This is not the same as adding back the secondary steam games location to the library since that location was not formatted (which also works flawlessly).

Credit is to Steam of course, since this situation would work in case of Windows also, but had to mention how Linux, Steam, Proton, Vulkan, all came together to offer an efficient and smooth experience to the consumer.

Gaming on Linux is not just easy, but so is taking backups and restoring them, without having to download scores of gigabytes thereby preventing unnecessary wastage of network.

Dual Boot modern OSes in Legacy Mode

Most new Linux distributions come these days with out of the box support for EFI boot (UEFI). However, if you are stuck with an ancient pc where maybe you installed Windows years ago, it would probably be on legacy BIOS mode. Moreover, GRUB, the legacy BIOS mode of Linux, is now old and has given way to UEFI based newer entrants, like systemd-boot that are used in the latest distributions of Arch, Linux Mint etc. So when we install a latest Linux distro, chances are that its systemd-boot loader has overwritten grub, and if your Windows installation happened to be on another drive altogether, then it would definitely not recognize that.

So the situation we are going to fix is:

  1. Existing Windows installation on /dev/sdb1 in BIOS (Legacy) mode
  2. New Linux installation on /dev/sda1 using systemd-bootin BIOS (Legacy) mode
  3. Possibly other linux/ windows installations in /dev/sdb or a third, /dev/sdc (yes, power users do like to use the choices available to them).

I faced this situation with a brand new installation of System76’s Pop OS, which is based on Ubuntu but getting some good reviews these days. To resolve the issue, I had to update grub after probing for existing OS across my drives (all of which were recognized in GParted or Parted disk utilities).

Follow the below steps to restore Windows or other OS installations, if you are in a similar situation:

1. List your partitions


$ lsblk -l
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 167.7G 0 disk
sda1 8:1 0 9.5G 0 part
sda2 8:3 0 142.9G 0 part /
sda3 8:5 0 15.3G 0 part
sdb 8:16 0 931.5G 0 disk
sdb1 8:17 0 200G 0 part
sdb2 8:18 0 200G 0 part
sdb3 8:19 0 84G 0 part
sr0 11:0 1 1024M 0 rom
cryptswap 253:0 0 15.3G 0 crypt [SWAP]

2. Identify your windows partition and mount it:


$ mkdir -p /media/user/sdb1
$ sudo mount /dev/sdb1 /media/user/sdb1

$ mkdir -p /media/user/sdb2
$ sudo mount /dev/sdb2 /media/user/sdb2

Here, sdb1 and sdb2 contain the previously installed OSes, like Windows and Linux.

(Steps 1 and 2 can also be done by simply mounting the Windows partition from File explorer: Files > Other Locations > click on the required partition among the list)

3. Install and run a utility ‘os-prober’ – it may not come with the distro – as in the case for Pop OS.


$ sudo apt-get install os-prober
$ sudo os-prober

In the output, we can see that it has picked the other OS installations across mounted drives. If the drive is not mounted, it wont search for bootloaders there, so we need to mount secondary and tertiary drives first (steps 1, 2).

4. Update good old GRUB, which systemd-boot would actually use in case of BIOS (Legacy) mode – to confirm we can check under /boot, which will have /grub as a subdirectory instead of /efi


$ sudo update-grub

Thats it*. Now restart the system to load into Grub Menu, from where we can boot into other OSes. (Curiously, Pop OS shows up as Ubuntu; probably they did not think of this use case so did not fix).

EDIT:

*In case this is a dual/ triple boot scenario with a second Linux distribution, this may or may not work always. The above procedure basically “updates” GRUB from the newest OS installed, i.e. Pop in this case. Pop is still in charge of the system GRUB after this. The previous Linux distro (not Windows) in my system was Linux Mint, which was in charge of GRUB before this (i.e. GRUB was last updated from there).

Now, some distros like Manjaro do not like being not in charge of GRUB. One issue with Manjaro is that it loads a Intel microcode kernel before the actual Linux kernel in it, and when Pop updated grub, it searched only for the Linux kernel as the file pointer, but since Manjaro expects it to be Intel microcode instead, it threw Kernel Panic on selecting the option from Pop’s GRUB. More details can be found here.

The solution to this is to put Manjaro in charge of GRUB, i.e run the os-prober from Manjaro and then update GRUB. For this to work, we first need to boot into Manjaro. When I installed Pop OS 20.04, at that time Manjaro was the previously installed OS in charge of GRUB. But it was in second hard drive, i.e. sda, so I simply changed the boot priority in BIOS and it booted into Manjaro desktop. From there, I ran the above commands and it recognized the newly installed Pop and previously installed Windows, not to mention itself as well. GRUB was updated and I was able to boot into all 3 OSes.

In case we had Manjaro in same drive as Pop OS, we would have to do this using Manjaro live USB stick/ DVD. There is an option to chroot into existing installation, from where we can run the above commands.