Het forum

[Script] Need for Speed II Special Edition

Auteur Antwoorden
artsyfartsy Donderdag 14 Januari 2016 om 19:40
artsyfartsyAnonymous

Hello folks,

here is yet another my first POL script! I was looking for a way to play this nice old game on linux and finally ended up in developing this script. It wasn't quite trivial, due to some quikrs of this game. But among others especially this post in the appdb of winehq helped me a lot:
https://appdb.winehq.org/objectManager.php?sClass=version&iId=10902&iTestingId=91908

What you get in the end is a working configuration with an included glide wrapper which works in the same resolution as your desktop is configured. My Gamepad (Logitech Wingman) is working too as expected. The CD is not needed after installation because the content will be copied into the wine container and mounted as cd (so there is no crack involved).

However, there is one piece missing to get a working configuration: the game needs CPU affinity as statet in the winehq article. I've found several ways to achive this, but non if them is quite satisfiing:
- start playonlinux with this command: "schedtool -a 0x1 -e playonlinux". Drawbacks: difficult to implement and to communicate to a potential user, plus this will affect every POL game
- set the config value "BEFORE_WINE=schedtool -a 0x1 -e" with the command POL_Config_Write during setup. Drawback: this configuration is for all POL games
- prefix the windows executable with this command: "start /affinity 1", but sadly his didn't work for me as it looked very promising

So I hope someone knows a way to solve this problem. I think otherwise this script can not be added to the repository.

To users with the game "Need for Speed II" (without "Special Edition"): I think it should be very easy to modify this script to dynamically handle both version. I think the only difference should be the name of the exe file and the corresponding icon? Maybe someone can post the answer.

 

Script

#!/usr/bin/env playonlinux-bash
# Date : (2016-01-12 18-00)
# Last revision : (2016-01-12 18-00)
# Wine version used : 1.9.0
# Distribution used to test : ubuntu 14.04.3
# Author : artsyfartsy

# skip gecko installation
# skip mono installation
# ignore errors at the beginnig of the game setup
# keep default folder
# select minimum option in the game setup
# dont create a link on the desktop

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

TITLE="Need for Speed II SE"
PREFIX="nfs2se"

POL_SetupWindow_Init
POL_Debug_Init

POL_SetupWindow_presentation "$TITLE" "EA Games" "N/A" "NSLW" "$PREFIX"

POL_Wine_SelectPrefix $PREFIX
POL_Wine_PrefixCreate "1.9.0"
POL_System_SetArch "x86"
Set_OS "win98"

POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "nfs2sea.exe"

POL_SetupWindow_wait_next_signal "Installation in progress..." "$TITLE"
POL_SetupWindow_menu "What language do you prefer?" "Language" "english german spanish italian swedish french" " "

POL_Wine_WaitExit "$TITLE"
if [ ! -e "$CDROM/setup/$APP_ANSWER/setup.exe" ]; then
    POL_Wine $CDROM/setup/english/setup.exe
else
    POL_Wine $CDROM/setup/$APP_ANSWER/setup.exe
fi

POL_SetupWindow_message "$TITLE has been installed successfully" "$TITLE"

# copy the cd contents into the container so it's not needed in the future
mkdir "${WINEPREFIX}/drive_c/cdrom"
cp -r ${CDROM}/* "${WINEPREFIX}/drive_c/cdrom"
# remove setup files
chmod -R +w "${WINEPREFIX}/drive_c/cdrom/"{redist,setup,utility}
rm -rf "${WINEPREFIX}/drive_c/cdrom/"{redist,setup,utility}

# mount cdrom
letter=d
cd "$WINEPREFIX/dosdevices"
rm -f "$letter:" 2> /dev/null
rm -f "$letter::" 2> /dev/null
ln -s "${WINEPREFIX}/drive_c/cdrom" "$letter:"
ln -s "${WINEPREFIX}/drive_c/cdrom" "$letter::"
# POL_Call POL_Wine_LinkCDROM n

POL_LoadVar_PROGRAMFILES

cp "$CDROM/nfs2sea.exe" "${WINEPREFIX}/drive_c/${PROGRAMFILES}/Electronic Arts/Need For Speed II SE"
chmod 775 "${WINEPREFIX}/drive_c/${PROGRAMFILES}/Electronic Arts/Need For Speed II SE/nfs2sea.exe"
Set_OS "winxp"

POL_System_TmpCreate nfs2se
cd $POL_System_TmpDir

# patch game
POL_Download "http://jeffz.name/pe.exe" "98643fb9f7549e132ba9425562fc90e2"
POL_Wine pe.exe "${WINEPREFIX}/drive_c/${PROGRAMFILES}/Electronic Arts/Need For Speed II SE/nfs2sea.exe"
POL_Wine pe.exe "${WINEPREFIX}/drive_c/${PROGRAMFILES}/Electronic Arts/Need For Speed II SE/nfs2sen.exe"

# prepare glide wrapper nGlide
POL_Download "http://www.zeus-software.com/downloads/nglide/d-1.html" "4bcc72be562ad034e5a3690e153ca065"
POL_Wine_WaitExit "$TITLE"
mv d-1.html nGlide104_setup.exe
POL_Wine nGlide104_setup.exe

# writing settings to registry
echo "REGEDIT4" > nglide.reg
echo "" > nglide.reg
echo "[HKEY_CURRENT_USER\\Software\\Zeus Software\\nGlide]" > nglide.reg
echo "\"Aspect\"=\"1\"" >> nglide.reg
echo "\"Gamma\"=\"5\"" >> nglide.reg
echo "\"Refresh\"=\"0\"" >> nglide.reg
echo "\"Resolution\"=\"1\"" >> nglide.reg
echo "\"Splash\"=\"0\"" >> nglide.reg
echo "\"Vsync\"=\"1\"" >> nglide.reg
POL_Wine regedit nglide.reg

# launcher icon
cp "$CDROM/nfs2sea.ico" "$REPERTOIRE/icones/32/$TITLE"
cp "$CDROM/nfs2sea.ico" "$REPERTOIRE/icones/full_size/$TITLE"
cp "$CDROM/nfs2sen.ico" "$REPERTOIRE/icones/32/$TITLE (no 3dfx)"
cp "$CDROM/nfs2sen.ico" "$REPERTOIRE/icones/full_size/$TITLE (no 3dfx)"

# Uncommenting the next line results in a working configuration out of the box.
# But you better be careful: this setting is stored in the global config and thus will affect every POL game
#POL_Config_Write BEFORE_WINE "schedtool -a 0x1 -e"
POL_Shortcut "${PROGRAMFILES}/Electronic Arts/Need For Speed II SE/nfs2sea.exe" "$TITLE"
POL_Shortcut "${PROGRAMFILES}/Electronic Arts/Need For Speed II SE/nfs2sen.exe" "$TITLE (no 3dfx)"

# fixes the "empty hard disc" error
Set_OS "winme"

POL_System_TmpDelete
POL_SetupWindow_free_presentation "$TITLE" "The Installation has finished! \n\nIt's recommended to configure the graphics settings in the game. Normally everything can be set to the maximum value, except the gamma which is good with the value 3"
POL_SetupWindow_Close
exit

 

Aangepast door artsyfartsy

schotty Dinsdag 16 Februari 2016 om 2:26
schotty

I have the cd for the normal edition I think somewhere.  I have an old computing lair that is an absolute warzone.  People used to call it the museum due to the amount of old crap I stockpiled (not intentionally).  SGIs, Commodores ... And somewhere in there is NFS 1, 2, and 3 cd's.  I played the crap out of those back in the day, both on PC and PSX.

 

Ill check how things need to be and edit them for you, if anything needs to be done.