random/bin/D2Loader-current.sh

139 lines
3.2 KiB
Bash
Executable File

# Linux D2Loader v0.02b (any Diablo version) by hifi (Toni Spets)
# additional fixes by Merl
#
# ChangeLog
# v0.02b - Added Merl's fixes for slow computers:
# call Game.exe instead Diablo II.exe
# wait n seconds before linking back the original Game.exe
#
# removed that stupid loop when using dualhead
#
# v0.01 - Initial release
#
# Howto use:
# 0. Install Wine (http://www.winehq.com)
# 1. Install Diablo 2 with Wine
# 1b. Optional: Update to Lord of Destruction
# 2. Patch to v1.11b
# 3. Go to your Diablo 2 directory
# 3. Rename Game.exe to Game.exe.orig
# 4. Download fixed Game.exe from e.g. GameBurnWorld
# 5. Rename the fixed Game.exe to Game.exe.crk
# 6. Make sure all paths and options below are correct
# 7. Run this script and pray
#
#!/bin/bash
# Diablo 2 options
D2PATH="$HOME/.wine/drive_c/Diablo II"
# uncomment to enable
#D2OPTIONS="-skiptobnet"
GAME_EXE_ORIG=Game.exe.orig
GAME_EXE_CRACKED=Game.exe.crk
# you can find fixed exe for D2:LoD 1.11b from GameBurnWorld (cracked by DEViANCE)
# wine and system options (e.g. wine or cvswine)
WINE=cxstart
# if the script fails because you have a slow computer, increase this value to wait up before linking back to the original Game.exe
SLEEP_SECONDS=2
# dualhead hack (running windowed mode [see winecfg] with lower resolution)
DUALHEAD=1
# dualhead xrandr options
NATIVE_RES=0
GAME_RES=0
## ACHTUNG!
# remove the line below when you have configured this script (it's actually harmless but makes you sweat alot ;-)
###
### DON'T CHANGE ANYTHING BELOW THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING
###
echo
echo "Linux D2Loader v0.02b by hifi (Toni Spets)"
echo
if [ "$DUALHEAD" -eq 1 ]; then
echo "Dualhead: Changing to game resolution..."
xrandr -s $GAME_RES
fi
echo -n "Changing directory to $D2PATH..."
OLD_DIR="$PWD"
if [ ! -d "$D2PATH" ]; then
echo " failed!"
echo "Check your Diablo 2 path!"
exit
else
cd "$D2PATH"
echo " ok"
fi
echo -n "Checking if user really renamed Game.exe..."
if [ ! -h "Game.exe" ]; then
if [ -e "Game.exe" ]; then
echo " no!"
echo
echo "Deleting all your files AGAIN because you didn't read the instructions properly. Please wait..."; find / &> /dev/null; echo "Owned by hifi!"; exit
else
echo " yes"
fi
else
echo " yes"
fi
echo -n "Checking if there are original and cracked exe..."
if [ -f "$GAME_EXE_ORIG" ]; then
echo -n " $GAME_EXE_ORIG"
else
echo " no!"
echo "Can't find original Game.exe: $GAME_EXE_ORIG"
exit
fi
if [ -f "$GAME_EXE_CRACKED" ]; then
echo " $GAME_EXE_CRACKED"
else
echo " no!"
echo "Can't find cracked Game.exe: $GAME_EXE_CRACKED"
exit
fi
echo -n "Using cracked exe to start Diablo 2..."
rm -f Game.exe
ln -s Game.exe.crk Game.exe
$WINE Game.exe $D2OPTIONS &> d2log.wine &
D2PID=$!
echo " done"
echo -n "Waiting $SLEEP_SECONDS seconds before linking the original Game.exe back..."
sleep $SLEEP_SECONDS
echo " done"
echo "Quickly changing back to real Game.exe"
rm -f Game.exe
ln -s Game.exe.orig Game.exe
echo
echo "/////////////////////////////////"
echo "You may now connect to Battle.Net"
echo "/////////////////////////////////"
echo
echo -n "Waiting for Diablo 2 to exit..."
wait $D2PID
echo " done"
if [ "$DUALHEAD" -eq 1 ]; then
echo "Dualhead: Reseting resolution"
xrandr -s $NATIVE_RES
fi
cd "$OLD_DIR"
# EOF