You are here    Forums    Your creations.    Sanitarium (GoG) nl sv ru pl es de fr

The forum

Sanitarium (GoG)

Author Replies
petch Wednesday 28 December 2011 at 19:16

Hi all,
An easy script this time, but for an excellent adventure game: Sanitarium.
Main trick is to use win98 compatibility, the GoG wrapper simply crashes under Wine.
Also, it doesn't like really recent versions of Wine (sound subsystem rewrite maybe?)
# Date : (2011-12-28 18-20)
# Last revision : (2011-12-28 18-50)
# Wine version used : 1.3.23
# Distribution used to test : Debian Sid (Unstable)
# Author : Pierre Etchemaite
# Script licence : GPL v.2
# Program licence : Retail
# Depend :

#    Lockup with 1.3.35 when reaching to top of the stairs
#    Same with 1.3.34
#    Same with 1.3.30
#    Crash with 1.3.29 when statue "lights up"
#    Heavy flickering with 1.3.27-rawinput2
#    Ok with 1.3.24?
#    Ok with 1.3.23?
#    Ok with 1.2.3?

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

check_install_archive () {

    POL_SetupWindow_wait "$(eval_gettext 'Checking install archive...')" "$TITLE"
    # Temporarily prevent word splitting
    NAME="$(basename $FILE)"
    SIZE="$(stat -c%s $FILE)"
    MD5="$(POL_MD5_file $FILE)"

    if [ $SIZE -ne $EXPECTED_SIZE -o "$MD5" != "$EXPECTED_MD5" ]; then
        POL_Debug_Error "$(eval_gettext 'Install archive mismatch.\\nEither your install archive is corrupted, or is not the expected version.\\nThis script cannot guarantee that installation will work correctly. Please report success or failure to PlayOnLinux forums.')\\n$(eval_gettext 'Name:') $NAME ($(eval_gettext 'expected') $EXPECTED_NAME)\\n$(eval_gettext 'Size:') $SIZE ($(eval_gettext 'expected') $EXPECTED_SIZE)\\n$(eval_gettext 'MD5:') $MD5\\n     ($(eval_gettext 'expected') $EXPECTED_MD5)"
        POL_SetupWindow_question "$(eval_gettext 'Continue?')" "$TITLE"
        [ "$APP_ANSWER" != "TRUE" ] && POL_Debug_Fatal "$(eval_gettext 'Not the expected archive')"


TITLE="$(eval_gettext 'Sanitarium (GoG release)')"
SHORTCUT_DOC="$SHORTCUT_NAME - $(eval_gettext 'User manual')"
SHORTCUT_README="$SHORTCUT_NAME - $(eval_gettext 'Readme')"


POL_SetupWindow_presentation "$TITLE" "DreamForge Intertainment / XS Games" "" "Pierre Etchemaite" "$PREFIX"

POL_Wine_SelectPrefix "$PREFIX"

cd $HOME
POL_SetupWindow_browse "$(eval_gettext 'Please select the setup file to run.')" "$TITLE"

check_install_archive "$ARCHIVE" setup_sanitarium.exe 1235894636 "c60d04ddd0614988c7be7c86fa5fe7d8"

POL_SetupWindow_wait "$(eval_gettext 'Please wait while $TITLE is installed.')" "$TITLE"

# Associate .PDF with native app
# Do it before installing the game, so you have the possibility to open
# PDFs with Win32 reader if you choose to install it
cat <<'_EOF_' > "$REPERTOIRE/tmp/pdfnativereader.reg"
"Content Type"="application/pdf"
@="winebrowser \\"%1\\""
POL_Wine regedit "$REPERTOIRE/tmp/pdfnativereader.reg"
rm "$REPERTOIRE/tmp/pdfnativereader.reg"

POL_Wine start /unix "$ARCHIVE" || POL_Debug_Fatal "$(eval_gettext 'Error while installing archive')"

POL_Wine_WaitExit "$TITLE"

Set_OS win98

POL_SetupWindow_VMS "32"
## PlayOnMac Section
[ -n "$PLAYONMAC" ] && Set_SoundDriver "alsa"
[ -n "$PLAYONMAC" ] || Set_Managed "Off"
## End Section

# Doesn't hurt ;)

POL_Shortcut "sntrm.exe" "$SHORTCUT_NAME"
POL_Shortcut "sntrm.exe" "$SHORTCUT_NAME $(eval_gettext '(windowed)')" "" "-w"
POL_Shortcut "start.exe" "$SHORTCUT_DOC" "" "'C:/$PROGRAMFILES/'"
POL_Shortcut "start.exe" "$SHORTCUT_README" "" "'C:/$PROGRAMFILES/'"



Edited by petch

Hartza Sunday 24 February 2013 at 17:44
Hartza Anonymous

I've purchased the game from, installed with POL. I usually get an error message:

MapViewOfFile for file 'RES.104' failed ErrorCode=8
Abort game? (Yes/No)

If I click yes crashes with this message:
Runtime Error!
Program: C:\\Program Files\\\\Sanitarium\\sntrm.exe
abnormal program termination

If I click no it crashes too.

I get this debug logfile:

[02/24/13 17:38:10] - Running wine-1.3.23 sntrm.exe (Working directory : /home/hartza/.PlayOnLinux/wineprefix/Sanitarium_gog/drive_c/Program Files/
fixme:win:EnumDisplayDevicesW ((null),0,0x32f760,0x00000000), stub!
fixme:mixer:ALSA_MixerInit No master control found on HDA NVidia, disabling mixer
fixme:dsalsa:IDsDriverBufferImpl_SetVolumePan (0x165408,0x165848): stub
fixme:ddraw:ddraw7_WaitForVerticalBlank iface 0x1523f0, flags 0x1, event (nil) stub!
fixme:ddraw:ddraw7_FlipToGDISurface iface 0x1523f0 stub!
err:mmtime:TIME_MMTimeStop Timer still active?!
petch Sunday 24 February 2013 at 18:42

I don't think any of the fixme is important and the error line is probably a consequence of the crash rather than the reason.

What video driver do you use?
Hartza Sunday 24 February 2013 at 20:24
Hartza Anonymous

I changed to Wine 1.5.20 and everything got OK. Now it works perfect.
petch Sunday 24 February 2013 at 21:29

Does it work for you with 1.4.1 ?
Edit: Nah, forget it, with 1.4.1 it freezes for me at the usual place (after climbing the stairs). Need to check 1.5.x

Edited by petch

petch Sunday 24 February 2013 at 23:41

1.4.1: freeze when reaching the top of stairs
1.5.0: crash when statue "lights up" (like 1.3.29 did)
1.5.3: crash when reaching the top of stairs
1.5.4, 1.5.5, 1.5.10, 1.5.15, 1.5.20, 1.5.24: seems to work ok

I assume any version above 1.5.4 should do, switching script to 1.5.20 if that's what you use, feel free to report any further issue...