The forum

[script] Mafia

Author Replies
NSLW Saturday 23 May 2009 at 20:09
NSLW

Hello,
I wrote script which installs Mafia. It's very demanding setup so it wasn't easy to meet all his conditions. It also can patch the game after it's been installed
Wine version : 1.1.21
Distribution : Fedora
Distribution Version : 10 (32 bit)
Graphics card : Nvidia, GeForce 9xxx
Drivers of the graphics card : 185.18.08
Comments
-game won't run with original Game.exe
-don't set Multipass rendering

Icon for the game:




#!/bin/bash
# Date : (2009-05-30 17-30)
# Last revision : (2009-05-30 17-30)
# Wine version used : 1.1.21
# Distribution used to test : Fedora 10
# Author : NSLW
# Licence : Retail
# Depend : unzip, ImageMagick

[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

TYTUL="Mafia"
PREFIX="Mafia"
 
#procedure for patching Mafia
patch_mafia()
{
POL_SetupWindow_browse "Select patch file" "$TYTUL" ""
wine "$APP_ANSWER"
POL_SetupWindow_message "Patch for $TYTUL has been installed successfully" "$TYTUL"
}

copy_cd()
{
POL_SetupWindow_message "Please insert $1 cd" "$TYTUL"
POL_SetupWindow_cdrom
CDROM[$2]=$CDROM
POL_SetupWindow_check_cdrom "/MafiaGame/$4"
POL_SetupWindow_wait_next_signal "Copying $1 CD" "$TYTUL"
rm -fr "$WINEPREFIX/drive_c/windows/temp/MAFIA_CD_$[$2-1]"
cd "$WINEPREFIX/drive_c/windows/temp"
mkdir "MAFIA_CD_$2"
cd $CDROM
cp -fr * "$WINEPREFIX/drive_c/windows/temp/MAFIA_CD_$2"
chmod 777 "$WINEPREFIX/drive_c/windows/temp/MAFIA_CD_$2" -R
cd "$WINEPREFIX/drive_c/windows/temp"
echo "MAFIA_CD_$2" > "./MAFIA_CD_$2/.windows-label"

cd "$WINEPREFIX/dosdevices"
ln -fs "$WINEPREFIX/drive_c/windows/temp/MAFIA_CD_$2" $3
cd "$WINEPREFIX/drive_c/windows/temp"
echo "[HKEY_LOCAL_MACHINE\\\\Software\\\\Wine\\\\Drives]" > cdrom.reg
echo "\\"$3\\"=\\"cdrom\\"" >> cdrom.reg
regedit cdrom.reg

POL_SetupWindow_detect_exit
POL_SetupWindow_message "Wait 5 seconds then click next" "$TYTUL"
}

POL_SetupWindow_Init
POL_SetupWindow_presentation "$TYTUL" "Illusion Softworks" "www.illusionsoftworks.com" "NSLW" "$PREFIX" 
 
select_prefix "$REPERTOIRE/wineprefix/$PREFIX"

#asking about patching
POL_SetupWindow_menu "What do you want to do?" "Actions" "install-game patch-game" " "
if [ "$APP_ANSWER" == "patch-game" ]; then
	if [ -e "$REPERTOIRE/wineprefix/$PREFIX" ]; then
	patch_mafia
	POL_SetupWindow_Close
	fi
fi

POL_SetupWindow_prefixcreate 

#downloading MS Visual C++ 6 sp4 libraries
cd "$REPERTOIRE/ressources/"
if [ ! -e $REPERTOIRE/ressources/vc6redistsetup_enu.exe ]; then
POL_SetupWindow_download "Downloading MS Visual C++ 6 sp4 libraries" "$TYTUL" "http://download.microsoft.com/download/vc60pro/update/1/w9xnt4/en-us/vc6redistsetup_enu.exe"
fi

#copying mfc42.dll
cd "$WINEPREFIX/drive_c/windows/temp/"
cabextract "$REPERTOIRE/ressources/vc6redistsetup_enu.exe"
cabextract "vcredist.exe"
cp mfc42.dll "$WINEPREFIX/drive_c/windows/system32"

copy_cd "first" "1" "d:" "A1.dta"
POL_SetupWindow_message "ATL+TAB here if the game asks for second CD" "$TYTUL"

#starting installation
cp "$CDROM/m.ico" "$REPERTOIRE/icones/32/$TYTUL"
cp "$CDROM/m.ico" "$REPERTOIRE/icones/32/$TYTUL Setup"
#cd $CDROM
wine d:\\MafiaLauncher.exe

copy_cd "second" "2" "d:" "A4.dta"
POL_SetupWindow_message "ATL+TAB here if the game asks for third CD\\nPlease ALT+TAB to installer now" "$TYTUL"

copy_cd "third" "3" "d:" "A0.dta"

POL_SetupWindow_message "Please ALT+TAB to installer now\\nPress \\"Forward\\" if installer finishes" "$TYTUL"

#adding CD-ROM as drive d: to winecfg
cd $WINEPREFIX/dosdevices
ln -fs $CDROM[1] d:
cd "$WINEPREFIX/drive_c/windows/temp/"
echo "[HKEY_LOCAL_MACHINE\\\\Software\\\\Wine\\\\Drives]" > cdrom.reg
echo "\\"d:\\"=\\"cdrom\\"" >> cdrom.reg
regedit cdrom.reg

#setting OffscreenRenderingMode to fbo
echo "[HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\Direct3D]" > fbo.reg
echo "\\"OffscreenRenderingMode\\"=\\"fbo\\"" >> fbo.reg
regedit fbo.reg
 
#asking about memory size
POL_SetupWindow_menu_list "How much memory do your graphic card have got?" "$TYTUL" "32-64-128-256-384-512-768-1024-2048" "-" "256"
VMS="$APP_ANSWER"
 
echo "[HKEY_CURRENT_USER\\\\Software\\\\Wine\\\\Direct3D]" > vms.reg
echo "\\"VideoMemorySize\\"=\\"$VMS\\"" >> vms.reg
regedit vms.reg
 
#cleaning temp
cd "$WINEPREFIX/drive_c/windows/temp/"
rm -rf *
 
#making shortcut
POL_SetupWindow_make_shortcut "$PREFIX" "Program Files/Mafia" "Game.exe" "" "$TYTUL" "" ""
POL_SetupWindow_make_shortcut "$PREFIX" "Program Files/Mafia" "Setup.exe" "" "$TYTUL Setup" "" ""
POL_SetupWindow_message "$TYTUL has been installed successfully" "$TYTUL"
 
#asking about patching
POL_SetupWindow_question "Do you want to patch your game?" "$TYTUL"
if [ "$APP_ANSWER" == "TRUE" ] ;then
patch_mafia
fi

POL_SetupWindow_message_image "Please note that this game has a copy protection system\\nand sadly, it prevents Wine from running the game.\\n\\nPlayOnLinux will not provide any help concerning any illegal\\nstuff." "Note about copy protection" "/usr/share/playonlinux/themes/tango/warning.png"

POL_SetupWindow_Close
exit

Edited by NSLW

Rave2Rave Saturday 30 October 2010 at 1:08
Rave2RaveAnonymous

works fine, but the sound lags sometimes...solution?
lahtis Wednesday 20 February 2013 at 21:04
lahtis

i cant get cd-rom working. Not found correct cd-rom mount
i have a /media/valvoja/MAFIA_CD_1/

using Ubuntu 12.10

Using Ubuntu 18.04.4 LTS and latest Playonlinux.
My scripts: https://github.com/lahtis/playonlinux
atirage21 Tuesday 11 June 2013 at 12:21
atirage21Anonymous


          
     
     
                    i cant get cd-rom working. Not found correct cd-rom mount
i tried version of one DVD and also 3 cd

using Ubuntu 13.04