Hexedit stronghold.cfg to easily unlock military campaign missions

When I installed the Stronghold HD patch to take my CD installation of Stronghold v1.2 up to the latest, version 1.3, I had to rearrange the savegame files as indicated in the helpful documentation (for me, that was file ~/.wine/drive_c/Program Files/FireFly Studios/Stronghold/readme_en.html).

Old savegames and settings

Stronghold HD stores user maps, saves and settings in the Documents\Stronghold folder. If you have upgraded to Stronghold HD from an old version of Stronghold you will need to copy the maps, saves and settings from the Program Files\Firefly Studios\Stronghold folder (default location) to the Documents\Stronghold folder.

Savegames (.sav files)

Old Location: Program Files\Firefly Studios\Stronghold\saves
New Location: Documents\Stronghold\Saves

Maps (custom .map files)

Old Location: Program Files\Firefly Studios\Stronghold\maps
New Location: Documents\Stronghold\maps

Settings (stronghold.cfg)

Old Location: Program Files\Firefly Studios\Stronghold
New Location: Documents\Stronghold

Because I’m using the proper ISO saved from the original game disc, I’ve never needed a no-cd patch.
Anyway, I noticed that my military campaign mission status was not transferred to the new HD installation. I ensured the .sco files were in the new spot (the Saves directory) but it did not unlock the missions. I helpfully had a mission 17 b save that was right at the tail end of that mission, so loading and finishing it got me up to mission 18. However, I didn’t want to have to go through the difficult fixed-force invasion of the Pig’s castle, so I looked for cheat codes for a computer game for the first time in about a decade. Believe it or not, but I couldn’t find any (working) cheats that just declare “success” for a mission. So, I decided to hack the stronghold.cfg.

I’m old-school, so I whipped out vim and :%!xxd and here is the results of my research:

To set the military campaign level unlocked, modify byte 0x147 which is in line:

    00000140: 0000 0055 0000 0013 0000 0021 0000 0000  ...U.......!....
#                               ^
#                               +-- this is hex 0x13 or decimal 19.
This corresponds to being able to play level 19 of the military campaign.

You can use vi with :%!xxd and :%!xxd -r to convert stronghold.cfg to hexedecimal and back.

For Stronghold HD, that is file ~/Documents/Stronghold/stronghold.cfg

Of course you could abuse this, but I was just using it to recover my progress.
castle gate with soldiers garrisoned

References

My own original research and hacking on the config file.

Play Beyond the Titanic on GNU/Linux

The story

Ship iconOne game I played in the past was Beyond the Titanic. It was a shareware game for MS-DOS, in the genre of text adventure (now known as interactive fiction).
In 2009 its source code was released under the GPL (reference 2). An enterprising individual (not this author) modified it and made it possible to build with the Free Pascal Compiler (probably known as fpc in your distro packages).
The game has an interesting quirk in that it really, really depends on having a terminal with size 80×24 and not anything else.
And of course, my Fedora COPR was having trouble building the package, but I promise you the rpm spec works on Fedora 28 (reference 4) and the dpkg spec works on Devuan 2.0 beowulf/ceres.
Although you could of course just run the BEYOND.COM version in Dosbox. I did observe the savegame files are not compatible between builds. Loading the fpc-version savegames into the DOS version of the game caused some funny and tragic endings where the monster killed me while I was standing on the deck of the Titanic.
Happy typing!

Credits

The icon I used for my project is linkware, so by linking to the author’s requested page at https://malagatravelguide.net/, I can use the icon.

References

Weblinks

  1. gitlab: beyond-the-titanic/History/History.txt
  2. Original release of source ftp://ftp.3drealms.com/freeware/tit_free.zip
  3. Gamespot walkthrough for Beyond the Titanic
  4. rpm and dpkg specs on my gitlab

Age of Empires 2 on Linux – 2019 Edition

# Installing AoC on Linux without PlayOnLinux

## Variables

export AOCWINEPREFIX=~/.wine
export AOCDIR="${AOCWINEPREFIX}"/drive_c/Program\ Files/Microsoft\ Games/Age\ of\ Empires\ II
export voobly_desktop=~/.local/share/applications/Voobly.desktop
export aofe_desktop=~/.local/share/applications/TheForgottenEmpires.desktop
export aoc_desktop=~/.local/share/applications/TheConquerors.desktop
mkdir -p "$( dirname "${voobly_desktop}" )"

# Learn OS and flavor
. /usr/share/bgscripts/framework.sh

# Install wine-staging
# References:
#    https://wine-staging.com/installation.html
#    https://wiki.winehq.org/Debian
case "${thisflavor}" in
   ubuntu|debian|mint|devuan)
      sudo su -
      #wget -nc https://repos.wine-staging.com/wine/Release.key
      dpkg --add-architecture i386 # needed for winehq.org packages
      wget -nc https://dl.winehq.org/wine-builds/Release.key
      apt-key add Release.key && /bin/rm -f Release.key
      {
         echo "# And for Debian Sid this one:"
         echo "deb https://dl.winehq.org/wine-builds/debian/ sid main"
      } >> /etc/apt/sources.list.d/winehq.list
      apt-get update
      apt-get install -y winehq-staging winetricks
      test "${USER}" = "root" && exit
      ;;

   fedora|korora|centos|redhat)
      # Fedora already has wine staging
      sudo dnf -y install wine.i686 winetricks
      ;;
esac 

export WINEPREFIX="${AOCWINEPREFIX}"
export WINEARCH=win32

winetricks -q directplay

# mount AoE2 disc
sudo mkdir -p /mnt/aoe2
sudo mount -v -o loop /mnt/public/CDROMs/Games/AgeOfEmpires/ISO/AOE2.ISO /mnt/aoe2

# install AoE2
wine /mnt/aoe2/AOESETUP.EXE

# mount AoC disc
sudo mkdir -p /mnt/age2_x1
sudo mount -v -o loop /mnt/public/CDROMs/Games/AgeOfEmpires/ISO/AGE2_X1.ISO /mnt/age2_x1

# install AoC
wine /mnt/age2_x1/AOCSETUP.EXE

sudo umount -lv /mnt/age2_x1 ; sudo umount -lv /mnt/aoe2 ; sudo rmdir /mnt/aoe2 /mnt/age2_x1

# Install aoc 1.0c
cp -p /mnt/public/Support/Setups/Games/Age2XPatch.exe "${AOCDIR}"
wine "${AOCDIR}"/Age2XPatch.exe

# Install AoFE
# If the download is working.
#cp -p '/mnt/public/Age Of Empires/Downloaded/AoFE_Launcher.exe' "${AOCDIR}"
#pushd "${AOCDIR}"; wine "${AOCDIR}"/AoFE_Launcher.exe ; popd
# Alternate instruction for getting AoFE
pushd "${AOCDIR}" ; unzip '/mnt/public/Age Of Empires/Downloaded/fe_update.zip' ; mv Age2_x1/* age2_x1/ && rmdir Age2_x1 ; popd

# Install voobly
cp -p /mnt/public/Age\ Of\ Empires/Downloaded/voobly-v2.2.4.51.exe "${AOCDIR}"
wine "${AOCDIR}"/voobly-v2.2.4.51.exe

# get WololoKingdoms, as of 2018-09-22
# which I generated on my one Windows machine with the tool from https://github.com/AoE2CommunityGitHub/WololoKingdoms/releases and the Steam version of the game.
wk_dir="${AOCDIR}/Voobly Mods/AOC/Data Mods"
mkdir -p "${wk_dir}"
pushd "${wk_dir}" ; time 7za x /mnt/public/Age\ Of\ Empires/Wololo\ Kingdoms/WololoKingdoms.full.2018-09-11.zip ; popd

# customize voobly desktop file
tf=${AOCWINEPREFIX}/voobly.sh
touch "${tf}"; chmod 0755 "${tf}"
cat < "${tf}"
#!/bin/sh
env WINEPREFIX="${WINEPREFIX}" STAGING_WRITECOPY=1 /usr/bin/wine C:\\\\Program\\ Files\\\\Voobly\\\\voobly.exe
EOFVOOBLYSH

mkdir -p ~/.local/share/icons
cp -p '/mnt/public/Age Of Empires/Images/voobly.png' ~/.local/share/icons/
touch "${voobly_desktop}"; chmod 0755 "${voobly_desktop}"
cat < "${voobly_desktop}"
[Desktop Entry]
Name=Voobly
Exec="${tf}"
Type=Application
StartupNotify=true
Path=${WINEPREFIX}/dosdevices/c:/Program Files/Voobly
Icon=/home/${USER}/.local/share/icons/voobly.png
StartupWMClass=voobly.exe
Comment=Matchmaking service for AoC
Categories=Game;StrategyGame;
EOFVOOBLY

# customize AoFE desktop file
cp -p '/mnt/public/Age Of Empires/Images/age2_x2.png' ~/.local/share/icons/
touch "${aofe_desktop}"; chmod 0755 "${aofe_desktop}"
cat < "${aofe_desktop}"
[Desktop Entry]
Name=The Forgotten Empires
Exec=env WINEPREFIX="${WINEPREFIX}" /usr/bin/wine "${AOCDIR}/age2_x1/age2_x2.exe" /nostartup
Type=Application
StartupNotify=true
Path=${AOCDIR}
Icon=/home/${USER}/.local/share/icons/age2_x2.png
StartupWMClass=age2_x1.exe
Comment=Forgotten Empires 2.2 mod for AoC
Categories=Game;StrategyGame;
EOFAOFE

# customize AoC desktop file
thisicon="$( find ~ -regex '.*.local.*age2_x1.*png' 2>/dev/null | sort | tail -n1 )"
touch "${aoc_desktop}"; chmod 0755 "${aoc_desktop}"
cat < "${aoc_desktop}"
[Desktop Entry]
Name=The Conquerors
Exec=env WINEPREFIX="${WINEPREFIX}" /usr/bin/wine "${AOCDIR}/age2_x1/age2_x1.exe" /nostartup
Type=Application
StartupNotify=true
Path=${AOCDIR}
Icon=${thisicon}
StartupWMClass=age2_x1.exe
Comment=Age of Empires 2: The Conquerors Expansion
Categories=Game;StrategyGame;
EOFAOC

echo done

Voobly notes

Voobly on Wine in Linux

For some reason, one of my voobly installations in Wine on Linux (devuan specifically) runs like a dog. While the system is indeed really old, Voobly was running smoother on it before the OS reinstall.

After an strace, I learned it kept looking for a tzres.dll in C:\Program Files\Voobly\, and there wasn’t one. So I copied it in from the system32 directory and re-ran Voobly. It seems to operate a little better now, although it’s still not exactly a smooth experience.

cp -p ~/.wine/drive_c/windows/system32/tzres.dll ~/.wine/drive_c/Program\ Files/Voobly/

Fix Jazz Jackrabbit 2 on Wine

0009:err:seh:setup_exception_record stack overflow 992 bytes in thread 0009 eip 7e572f2a esp 00240f50 stack 0x240000-0x241000-0x340000
0044:err:ntdll:RtlpWaitForCriticalSection section 0x7e5cb7a0 "freetype.c: freetype_cs" wait timed out in thread 0044, blocked by 0009, retrying (60 sec)
^C0045:fixme:console:CONSOLE_DefaultHandler Terminating process 8 on event 0

This issue was particularly difficult to nail down. At one point, I saw a stack trace (but failed to save the output) where some amd driver was the next-to-last in the stack, so I think this issue is related to my AMD Radeon card (nothing to write home about).

The error tends to happen when loading a new level of the game. However, it is possible to trigger it within a level.

Running the game with the “-Safe” flag to run in safe mode prevents the crashes entirely.

I thought at first the freetype.c thing meant it was font-related, and that possibly I was missing an i686 package for a font. However, I had every i686 package for every x86_64 one, so it wasn’t loading the wrong type. I also ensured I started wine with WINEARCH=win32.

I eventually fixed the issue by changing the game settings for the audio! To prevent game crashes, you need to configure “Sound & Music Properties” and uncheck “Use DirectSound (faster).” If you leave that option checked, it will crash the game usually when loading levels.

Install Logical Journey of the Zoombinis (1996) on Linux

Introduction

The game Logical Journey of the Zoombinis was an amazing game when I was young. It was fun, and apparently I learned a lot. I decided to try to install it on my Devuan ceres laptop. Here is the optimal route for making it work.

How to Install Zoombinis on Linux

The Zoombinis game was published in 1996, and it supports Windows 3.1 and Windows 95. We are going to install Windows 3.1 in DOSBox, install drivers, and then install the game.

Prepare Windows 3.1

Install DOSBox, which is probably in the main package manager on your GNU/Linux platform.

sudo dnf install dosbox
sudo apt-get install dosbox

Extract the Windows 3.1 VHD file (which I had from my old MSDN AA days). Also extract into sub-folders the Zoombinis disc contents, the sound drivers that DOSBox emulates, and the emulated video drivers.

mkdir -p ~/win31 ; cd ~/win31 ; 7z x ~/Downloads/Windows\ 3.1.vhd
mkdir -p ~/win31/zoominst ; cd ~/win31/zoominst && 7z x ~/Downloads/Logical\ Journey\ of\ the\ Zoombinis.iso
mkdir -p ~/win31/drivers/SB ; cd ~/win31/drivers/SB && 7z x ~/Downloads/SB16W3x.zip
mkdir -p ~/win31/drivers/S3 ; cd ~/win31/drivers/S3 && 7z x ~/Downloads/s3drivers.zip

Prepare a batch file for mounting the right drives in the emulated environment.

cat <<'EOF' > win31.bat
REM for Zoombinis
MOUNT C ~/win31
MOUNT D ~/win31/zoominst

EOF

Run DOSBox:

dosbox win31.bat

Run Windows:

WINDOWS\WIN.COM

It might prompt you about deleting a corrupt swap file. You can select “Y” to do so, and then go into the Control Panel, “386 Enhanced,” Virtual Memory button, and save the information that is present. Then it shouldn’t prompt you anymore.

Install sound and video drivers

Zoombinis will warn you about sound and video settings, so the driver we loaded earlier should cover this. Now we have to install them. DOSBox emulates the SoundBlaster and S3 video hardware, so we just apply those drivers for Windows 3.1, and then audio will work and higher graphics settings too.
In DOSBox, cd to DRIVERS\SB and run the INSTALL utility.

cd DRIVERS\SB
INSTALL.EXE

Press enter to install the driver now.
Press enter to do a full installation.
Navigate with the arrow keys down to the Windows 3.1 path and enter in the “C:\Windows” value.

Change the Interrupt setting to the DOSBOX default of 7, as seen in this screenshot (unless you modified it in the dosbox.conf).

If it prompts you about replacing a file, feel free. It will not harm anything to replace it.
When that finishes, you can either reboot or stay on the current session.
Now it is time to install the video drivers. In DOSBox, run the Windows SETUP.EXE utility.

cd WINDOWS
SETUP.EXE

Select the DISPLAY option and press enter.

Scroll all the way to the bottom of the list and select “Other (requires disk…)”
Type in the directory where the video drivers are, e.g. “C:\DRIVERS\S3”
I am uncertain if Windows 3.1 has the ability to change the display resolution, so just pick your preferred screen resolution here.

I picked the 800×600 64K color with small fonts (as opposed to large-print fonts).
The SETUP utility will then return to the full list of system information, and you can select “Accept the configuration shown above.”
You might need to point it to the “C:\DRIVERS\S3” folder once more.
Now you can run Windows 3.1 with sound and an 800×600 display!

WINDOWS\WIN.COM

Install Zoombinis

Use File Manager to navigate to where we injected the install files.

Run the setup.exe!
Make sure you have enough disk space.

I installed QuickTime as well, although I don’t know what its omission would do.
Now you should have “Broderbund Software” group in Program Manager and the Zoombinis launcher inside it!

History

First of all, I had to find my old .VCD file (from my Virtual Drive Manager days on a non-free OS). I know those are basically ISO files and can just loop-mount them. Unfortunately, my .VCD file was corrupted. I then had to scrounge around for the old .FCD file and finally found it. But then, I had to try to get the contents out of it. I spent about 45 minutes researching online before I found IsoBuster. That software is shareware, but its free components worked enough to let me copy out the contents of the FCD file. On GNU/Linux these days, it’s all ISOs, and those are much easier to work with and find tutorials.

Did you know that 7zip can extract files from ISO and VHD files? That was very neat to learn.
I tried installing the game in Wine, and after getting the cd check part to work (by modifying the ini file “INSTALLFROMDRIVE=D”), I ran into an error: “Cannot initialize graphics.” And it included some contents of a register, and I never solved it.

err:int21:INT21_Ioctl_Block int21: unknown/not implemented parameters:
int21: AX 440d, BX 0004, CX 0848, DX db46, SI 0000, DI 0000, DS 0000, ES 0000
fixme:reg:RegOpenUserClassesRoot (0x7c, 0x0, 0x2000000, 0xe2e6d8) semi-stub
err:int21:INT21_Ioctl_Block int21: unknown/not implemented parameters:
int21: AX 440d, BX 0004, CX 0848, DX dde2, SI 0000, DI 0000, DS 0000, ES 0000

I think that’s functionality that just hasn’t been added to Wine. I’m pretty sure the game does some early DirectX fullscreen mumbo-jumbo and this version of how it does that was not implemented in wine. Ah, well.
But, during all this work I had read the Zoombini readme and it indicates it can be installed in Windows 3.1, ergo the main part of this article.

Reference

Weblinks

IsoBuster https://www.isobuster.com/download.php
General Win 3.1 howto https://www.howtogeek.com/230359/how-to-install-windows-3.1-in-dosbox-set-up-drivers-and-play-16-bit-games/
Another general Win.31 howto, with sound and video driver installations https://joshmccarty.com/run-windows-3-1-in-dosbox/
Sound driver SB16W3X https://joshmccarty.com/wp-content/uploads/2013/08/SB16W3X.zip
Video driver S3 https://joshmccarty.com/wp-content/uploads/2013/08/s3drivers.zip