Thread: Deck Gun Stuck
View Single Post
Old 10-24-23, 11:17 AM   #18
mazzi
Bosun
 
Join Date: Mar 2018
Posts: 64
Downloads: 559
Uploads: 0
Default

Quote:
Originally Posted by propbeanie View Post
Have you ever tried to use the Windows Path setting for similar reasons?
I have the opinion that certain sections of the game code do not work correctly, when the wrong game folder is registered in the Windows registry. That's why I always use this script:
Code:
@echo off

for /F "Tokens=2*" %%I in ('Reg Query "hklm\software\WOW6432Node\Ubisoft\Silent Hunter 4 Wolves of the Pacific\GameUpdate" /v installdir') do set dir_reestr=%%J
rem echo.
rem echo The game folder spelled out in the registry:
rem echo %dir_reestr%
rem echo. 
rem pause
set p=%~dp0%
set "curent_dir=%p:~0,-1%\"
rem echo.
rem echo Current folder of the launched game:
rem echo %curent_dir%
rem echo.
rem pause
rem echo.
rem echo Folder paths are compared with each other:
rem echo.
if /i "%curent_dir%"=="%dir_reestr%" (GOTO YES ) else (GOTO NO)

:YES
rem echo The paths coincide! :)
rem echo.
rem pause
rem echo.
rem echo The game starts...
start "" "%curent_dir%\sh4.exe"
goto :EOF

:NO
rem echo The paths are different! :(
rem echo.
rem pause
rem echo.
rem echo The proper current folder of the launched game is recorded in the register:
rem echo %curent_dir%
rem echo.
REM for sh4 v1.00.0000
reg add "hklm\software\WOW6432Node\Ubisoft\Silent Hunter Wolves of the Pacific\GameUpdate" /v execPath /t reg_sz /f /d "%~dp0%sh4.exe
reg add "hklm\software\WOW6432Node\Ubisoft\Silent Hunter Wolves of the Pacific\GameUpdate" /v installdir /t reg_sz /f /d "%~dp0%
REM for sh4 v1.05.0000
reg add "hklm\software\WOW6432Node\Ubisoft\Silent Hunter 4 Wolves of the Pacific\GameUpdate" /v execPath /t reg_sz /f /d "%~dp0%sh4.exe
reg add "hklm\software\WOW6432Node\Ubisoft\Silent Hunter 4 Wolves of the Pacific\GameUpdate" /v installdir /t reg_sz /f /d "%~dp0%
rem pause
rem echo.
rem echo The game starts...
start "" "%curent_dir%\sh4.exe"
GOTO :EOF
It must be placed in ALL game folders, next to the sh4.exe file. Then launch all games using this script. This script.bat or script.cmd must be run as administrator.

This .bat script can be converted into an .exe file using the program "Bat To Exe Converter". In the 'Bat To Exe Converter' itself, when converting .bat to .exe, you can set administrator rights.

If you remove all the small 'rem' in the script, leaving the large 'REM' intact, you can see what the script does step by step.

Last edited by mazzi; 10-25-23 at 12:39 AM.
mazzi is offline   Reply With Quote