Saturday, 3 December 2022

Multiple monitors with DOSBox games (via DOSBox Staging)

 

In case you're not familiar, DOSBox Staging is designed to address the headaches caused by DOSBox's decrepit code, most notably (for me, anyway) its refusal to accept more than one monitor. This is obviously brilliant and good, but unfortunately GOG games are not set up to use DOSBox Staging. Thankfully, it's pretty easy to do yourself. This post is meant for Linux users only, but I'm sure a Windows user could figure out a way themselves, with a bit of tinkering. In my case, I'm using Linux Mint with the Flatpak version of DOSBox Staging, and the commands I show will reflect that. Adjust according to your own setup. With that said, we can get started.

Our first test subject is the GOG Linux version of Ravenloft: Strahd's Possession, but really any GOG DOS game with a Linux download should work. Once you've installed the game, we should cover ourselves with some backups (unless you're simply too skilled for that). Navigate to the game's directory and make a copy of dosbox_strahd.conf and dosbox_strahd_single.conf, then enter the sub-directory support and make a backup of gog_com.shlib. DOSBox Staging uses a slightly different layout for its configuration files, so we will need to update the one GOG provides. Start DOSBox Staging and create a configuration file with the command config -wc, then navigate to the directory it outputs and open the file. Copy the whole text of the new file and overwrite the text of dosbox_strahd.conf. Make any adjustments as you see fit afterwards.

Next, open up gog_com.shlib and edit the run_dosbox function to this:

run_dosbox() {
local conf_1="${1}"
local conf_2="${2}"
flatpak run io.github.dosbox-staging -conf "${conf_1}" -conf "${conf_2}" -no-console -c exit
}

If this game was already configured for Linux, that should be all you need to do. Go back to the game's main directory and run start.sh, and it should start up in DOSBox Staging. I can't account for every game on the service, however, and there may be cases where extra modification is required. If you are having problems, I would suggest examining the [game title]_single.conf file in each GOG DOS release, and looking for anything that might somehow conflict with our other changes.

So, what about when a game hasn't gotten an official Linux release from GOG? You'd think it wouldn't be too hard to provide these for DOS games, but a fair few of them are Windows only, or Windows and Mac at best. With a bit of extra modification, we can make these run in DOSBox Staging as well. My test game for this was Hammer of the Gods, installed via Wine (version wine-6.0.3 (Ubuntu 6.0.3~repack-1)), but again you are free to apply this to any game you want. To begin with, copy the flatpak_run line of that run_dosbox function we edited in the last part, update the config files it mentions and save it to the game's main directory as start.sh, we will need it later. Next, repeat the process of replacing the configuration file with a DOSBox Staging version, and making whatever changes you need.

Now open dosbox_hammer_single.conf. Our target is any mount command that refers to ". .", which will cause us problems on Linux. Edit the [autoexec] section to the following:

[autoexec]
# Lines in this section will be run at startup.
# You can put your MOUNT lines here.

@echo off
cls
mount c .
mount C "\cloud_saves" -t overlay
imgmount d "game.ins" -t iso -fs iso
c:
goto launcher

With this change, you should be able to start the game with that start.sh script we prepared earlier (remember to allow it to execute as a program if you haven't already). This is obviously all a botch, so I can't guarantee it will work as well as it could or should. Chances are there are many of you out there who could do a much better job of it, and I encourage it. All I wanted was to play my DOS games without my second monitor getting trapped in the shadow realm.

No comments:

Post a Comment