[Linux] Version Switch Script

If you are experiencing issues with Diablo II (or a Bloodline game), you can post here.
Post Reply
hedgesparrow
Skeleton
Posts: 80
Joined: Thu Jan 06, 2022 5:14 pm

[Linux] Version Switch Script

Post by hedgesparrow »

I thought I'd share the script I've written that does a similar job in Linux, that the Cactus version switcher does for Windows. This script assumes you have installed Cactus into the Diablo II game folder, ie the Platforms folder. The script also needs to be in the game folder. Finally, you need to edit the parameters at the top of the script to match your own installation.

Usage:
./switch.sh <version>
eg:
./switch.sh 1.05b

The old version files are removed, new version files copied and the wine registry is adjusted to a new saves folder, eg Saves/1.05b. Extra game files, such as ddraw.dll or dsound.dll etc are not touched.

Code: Select all

#!/bin/sh

wineprefix=~/wine/d2
savepath='D:\d2\Saves'

gamefiles="
Bnclient.dll
D2CMP.dll
D2Client.dll
D2Common.dll
D2DDraw.dll
D2Direct3D.dll
D2Game.dll
D2Gdi.dll
D2Glide.dll
D2Lang.dll
D2Launch.dll
D2MCPClient.dll
D2Multi.dll
D2Net.dll
D2VidTst.exe
D2Win.dll
D2gfx.dll
D2sound.dll
Diablo II.exe
Fog.dll
Game.exe
Patch_D2.mpq
SmackW32.dll
Storm.dll
binkw32.dll
ijl11.dll
"

if [ $# -eq 1 ]; then
        ver=$1
else
        echo "Usage: `basename $0` <version>" 1>&2
        exit 1
fi

dir=Platforms/$ver
if [ -d "$dir" ]; then
        rm -f $gamefiles
        cp $dir/* .

        WINEPREFIX=$wineprefix wineconsole REG ADD \
                'HKEY_CURRENT_USER\Software\Blizzard Entertainment\Diablo II' \
                /v "Save Path" /d "$savepath\\$ver" /f

        echo "$ver" > ver
else
        echo "Platform directory $dir not found" 1>&2
        exit 2
fi

exit 0
fearedbliss
Site Admin
Posts: 453
Joined: Sun Dec 19, 2021 11:23 am

Re: [Linux] Version Switch Script

Post by fearedbliss »

Nice ;), Thanks for posting. Props for using POSIX sh rather than bash lol.
Post Reply