All pastes #412757 Raw Edit

Unnamed

public text v1 · immutable
#412757 ·published 2007-03-27 22:42 UTC
rendered paste body
# 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

GAME="Warcraft 3"

# Diablo 2 options
D2PATH="$HOME/.wine/drive_c/Program Files/Warcraft III/"
D2OPTIONS="-opengl"
# uncomment to enable
#D2OPTIONS="-skiptobnet"
EXE=war3.exe
GAME_EXE_ORIG=$EXE.orig
GAME_EXE_CRACKED=$EXE.cracked
# 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=wine
# 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=0

# ati powerstate switch
ATI_POWER=1

# dualhead xrandr options
NATIVE_RES=0
GAME_RES=1

###
### DON'T CHANGE ANYTHING BELOW THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING
###

echo
echo "Linux $GAME Loader v0.02b by hifi (Toni Spets) hacked by Medha"
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 $GAME path!"
	exit
else
	cd "$D2PATH"
	echo " ok"
fi

echo -n "Checking if user really renamed $EXE..."
if [ ! -h "$EXE" ]; then
	if [ -e "$EXE" ]; then
		echo " no!"
	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 $EXE
cp $GAME_EXE_CRACKED $EXE

if [ "$ATI_POWER" -eq 1 ]; then
        aticonfig --set-powerstate 3
fi

$WINE $EXE $D2OPTIONS &> game.log.wine &
D2PID=$!
echo " done"

echo -n "Waiting $SLEEP_SECONDS seconds before linking the original $EXE back..."
sleep $SLEEP_SECONDS
echo " done"

echo "Quickly changing back to real Game.exe"
rm -f $EXE
cp $GAME_EXE_ORIG $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

if [ "$ATI_POWER" -eq 1 ]; then
        aticonfig --set-powerstate 1
fi

cd "$OLD_DIR"

# EOF