SUBSIM Radio Room Forums

SUBSIM Radio Room Forums (https://www.subsim.com/radioroom/index.php)
-   SH5 Mods Workshop (https://www.subsim.com/radioroom/forumdisplay.php?f=249)
-   -   I need a batch file (https://www.subsim.com/radioroom/showthread.php?t=236467)

vdr1981 01-31-18 04:30 PM

I need a batch file
 
I need a set of batch file commands which would, when executed, create cfg file on the very same location on HDD with following content:

Code:

ClientAreaWidth=1184
ClientAreaHeight=765
CameraManager.act=D:\INSTALIRANE IGRE-Win7\Silent Hunter 5
EnvSim.act=D:\INSTALIRANE IGRE-Win7\Silent Hunter 5
kernel.dll=D:\INSTALIRANE IGRE-Win7\Silent Hunter 5
sh5.exe=D:\INSTALIRANE IGRE-Win7\Silent Hunter 5
SHCollisions.act=D:\INSTALIRANE IGRE-Win7\Silent Hunter 5
SHSim.act=D:\INSTALIRANE IGRE-Win7\Silent Hunter 5
SHSound.act=D:\INSTALIRANE IGRE-Win7\Silent Hunter 5
SH_NClient.dll=D:\INSTALIRANE IGRE-Win7\Silent Hunter 5
SimData.dll=D:\INSTALIRANE IGRE-Win7\Silent Hunter 5
LanguagePackInUse=

The trick is that colored parts of the text should be variable and match the actual path of SH5 installation. (taken from registry or anything simmilar)


As you can probably see, I would like to further simplify process of Wolves of Steel installation so my first question would be, is this possible at all?

Thanks in advance! :salute:

XenonSurf 01-31-18 04:45 PM

I think it's helpful if you take a look in the AODCD game patches (the official ones for the game Aces of the Deep; DOS version); there are batch file commands for any possible directory configuration. I have modified them in the past for making the game playable with DosBox where it was necessary for the patch to run correctly.

I will go in my VMWare and pubhish here these batch commands, but I cannot guarantee that it will be any help for you... The command contains a %, that's for sure.

vdr1981 01-31-18 04:47 PM

Quote:

Originally Posted by XenonSurf (Post 2539398)
I think it's helpful if you take a look in the AOD game patches (the official ones); there are batch file commands for any possible directory configuration. I have modified them in the past for making the game playable with DosBox where it was necessary that the patch did run correctly.

I will go in my VMWare and pubhish here these batch commands, but I cannot guarantee that it will be any help for you...

That would be quite helpful for the start...:yep: Thanks.

XenonSurf 01-31-18 04:52 PM

What you can do in the meantime if you have DosBox (or try it in Windows console or by starting Start > Execute 'cmd' is:
Start the DOS session and type '-?' or 'help'
This should fire-up the help for DOS commands, you can use these in batch files.


[EDITED]

XenonSurf 01-31-18 05:05 PM

Ok, here it goes, first the patch install batch file must decide which language must be installed, then which .bat file to execute.


****************
Code:


@echo off
mode co80

:langSel
cls
echo.
echo.
echo                        AOD Expansion install                   
echo                        internet suply peoples                 
echo                                                               
echo                                                             
echo          If you want to run the program in English, press 'E'. 
echo                                                             
echo        Pour utiliser le programme en fran‡ais, appuyez sur 'F'.
echo                                                               
echo            Um das Spiel in Deutsch zu spielen, 'D' eingeben.   
echo                                                             
echo                                                             
echo     
echo.
echo.


CHUNK\GK.COM

:checkKey
IF ERRORLEVEL 113 IF NOT ERRORLEVEL 114 GOTO end
IF ERRORLEVEL 102 IF NOT ERRORLEVEL 103 GOTO French
IF ERRORLEVEL 101 IF NOT ERRORLEVEL 102 GOTO English
IF ERRORLEVEL 100 IF NOT ERRORLEVEL 101 GOTO German
IF ERRORLEVEL 81  IF NOT ERRORLEVEL 82  GOTO end
IF ERRORLEVEL 70  IF NOT ERRORLEVEL 71  GOTO French
IF ERRORLEVEL 69  IF NOT ERRORLEVEL 70  GOTO English
IF ERRORLEVEL 68  IF NOT ERRORLEVEL 69  GOTO German
goto end

:English
cls
call eng.bat %1
goto end

:German
cls
call ger.bat %1
goto end

:French
cls
call frn.bat %1
goto end

:end

**********************************

ENG.BAT:

Code:


@echo off


rem ------ first find out what drive we're installing from ---------
call CHUNK\DRIVE.EXE
IF ERRORLEVEL 25 IF NOT ERRORLEVEL 26 SET IDRIVE=Z
IF ERRORLEVEL 24 IF NOT ERRORLEVEL 25 SET IDRIVE=Y
IF ERRORLEVEL 23 IF NOT ERRORLEVEL 24 SET IDRIVE=X
IF ERRORLEVEL 22 IF NOT ERRORLEVEL 23 SET IDRIVE=W
IF ERRORLEVEL 21 IF NOT ERRORLEVEL 22 SET IDRIVE=V
IF ERRORLEVEL 20 IF NOT ERRORLEVEL 21 SET IDRIVE=U
IF ERRORLEVEL 19 IF NOT ERRORLEVEL 20 SET IDRIVE=T
IF ERRORLEVEL 18 IF NOT ERRORLEVEL 19 SET IDRIVE=S
IF ERRORLEVEL 17 IF NOT ERRORLEVEL 18 SET IDRIVE=R
IF ERRORLEVEL 16 IF NOT ERRORLEVEL 17 SET IDRIVE=Q
IF ERRORLEVEL 15 IF NOT ERRORLEVEL 16 SET IDRIVE=P
IF ERRORLEVEL 14 IF NOT ERRORLEVEL 15 SET IDRIVE=O
IF ERRORLEVEL 13 IF NOT ERRORLEVEL 14 SET IDRIVE=N
IF ERRORLEVEL 12 IF NOT ERRORLEVEL 13 SET IDRIVE=M
IF ERRORLEVEL 11 IF NOT ERRORLEVEL 12 SET IDRIVE=L
IF ERRORLEVEL 10 IF NOT ERRORLEVEL 11 SET IDRIVE=K
IF ERRORLEVEL 9  IF NOT ERRORLEVEL 10 SET IDRIVE=J
IF ERRORLEVEL 8  IF NOT ERRORLEVEL 9  SET IDRIVE=I
IF ERRORLEVEL 7  IF NOT ERRORLEVEL 8  SET IDRIVE=H
IF ERRORLEVEL 6  IF NOT ERRORLEVEL 7  SET IDRIVE=G
IF ERRORLEVEL 5  IF NOT ERRORLEVEL 6  SET IDRIVE=F
IF ERRORLEVEL 4  IF NOT ERRORLEVEL 5  SET IDRIVE=E
IF ERRORLEVEL 3  IF NOT ERRORLEVEL 4  SET IDRIVE=D
IF ERRORLEVEL 2  IF NOT ERRORLEVEL 3  SET IDRIVE=C
IF ERRORLEVEL 1  IF NOT ERRORLEVEL 2  SET IDRIVE=B
IF ERRORLEVEL 0  IF NOT ERRORLEVEL 1  SET IDRIVE=A



:skipit
if '%1' == '' goto chkdef

rem ----  extract the destination drive letter and path from command line

IF NOT '%2'=='' GOTO ChangeD
IF NOT EXIST %1\NUL GOTO BadDir
FOR %%f IN (/%1) DO %0 %%f %1


:========= ChangeD ===========
%1:
CD %2 > NUL

rem --------- make sure they've saved careers properly -----------
goto warning


:startcopy
:next
IF NOT EXIST resource.cfg goto nosim
IF NOT EXIST SIM\NUL    goto nosim
IF NOT EXIST SHELL\NUL  goto nosim
IF NOT EXIST SOUND\NUL  goto nosim

rem ============ Unpack the files =============
cls
echo.
echo        *************      Unpacking Files...      *************
echo.
copy %IDRIVE%:resource.000              >nul
copy %IDRIVE%:chunk\unchunk.exe        >nul
unchunk resource.000 . > nul
if  ERRORLEVEL 1 goto BadChunk

rem ===== copy language specific files =========
IF EXIST ENGLISH\NUL goto copystuff
mkdir english > nul
:======= copystuff =========
copy %IDRIVE%:chunk\readme.eng english\readme.  >nul
IF EXIST readme.old goto skip1
IF EXIST readme.    copy readme. readme.old
IF EXIST read.me    copy read.me readme.old

:skip1
IF NOT EXIST readme. goto chngname
@copy english\readme.                >nul
goto skip2
:chngname
@copy english\readme. read.me        >nul


:skip2
cls
goto playNow



IF EXIST SAVE\NUL  goto CDVERSION
IF NOT EXIST SIM\SAVE\NUL  goto nosim
goto playNow


:CDVERSION


:playNow
echo.
echo.
echo        ***********  AOD Mission Disk Installed !  ************
echo        *                                                      *
echo        *                                                      *
echo ˙      *          To play NOW:                                *
echo ˙      *              Type AOD and press [ENTER].            *
echo        *                                                      *
echo ˙      *          To play LATER:                              *
echo ˙      *              CD to the game directory.              *
echo ˙      *              Type AOD and press [ENTER].            *
echo        *                                                      *
echo        *  If you should ever need to change your sound card  *
echo        *  selection or settings, CD to the game directory    *
echo        *  and run SOUNDSET again.                            *
echo        *********************************************************
goto done


:usage 
echo To install AOD expansion disk to a specific directory name:
echo.
echo Type "install" followed by the drive letter and path
echo where ACES OF THE DEEP is installed.
echo.
echo For example: "install C:\DYNAMIX\AOD" will attempt to install the
echo mission disk to the DYNAMIX\AOD directory on the C drive.
echo.
echo.
%IDRIVE%:
goto end


:BadDir
:nosim
:noshell
cls
echo.
echo.
echo  An installed version of AOD was not found in the specified
echo  directory. Please check the drive and directory path and
echo  try install again.
echo.
echo.
echo.
echo.
goto usage


:========= chkdef ============
rem
rem  check for aod installation in default directories

IF EXIST C:\DYNAMIX\AOD\SIM\SUBSIM.EXE  goto def1
IF EXIST C:\DYNAMIX\AODCD\SIM\SUBSIM.EXE goto def2
IF EXIST C:\GAMES\AOD\SIM\SUBSIM.EXE    goto def3
IF EXIST C:\GAMES\AODCD\SIM\SUBSIM.EXE  goto def4
goto usage


:def1
c:
cd c:\dynamix\aod
cls
echo.
echo.
echo.
echo                      AOD found at C:\DYNAMIX\AOD 
goto confirm

:def2
c:
cd c:\dynamix\aodcd
cls
echo.
echo.
echo.
echo                    AOD found at C:\DYNAMIX\AODCD
goto confirm

:def3
c:
cd c:\games\aod
cls
echo.
echo.
echo.
echo                      AOD found at C:\GAMES\AOD
goto confirm

:def4
c:
cd c:\games\aodcd
cls
echo.
echo.
echo.
echo                      AOD found at C:\GAMES\AODCD
goto confirm


:confirm
echo.
echo  Do you wish to install the AOD expansion disk to this directory? (Y/N)
echo.
echo.


%IDRIVE%:\CHUNK\GK.COM
IF ERRORLEVEL 121 IF NOT ERRORLEVEL 122 GOTO warning
IF ERRORLEVEL 110 IF NOT ERRORLEVEL 111 GOTO usage
IF ERRORLEVEL 89  IF NOT ERRORLEVEL 90  GOTO warning
IF ERRORLEVEL 78  IF NOT ERRORLEVEL 79  GOTO usage
goto usage


:=========== warning ==============
echo                    ******  Saved Games  ******
echo.
echo  Career games saved under AoD or AoD CD will not load properly into your
echo  simulation once you have installed the Expansion Disk, unless you saved
echo  the game while in port.  To preserve a career saved while at sea you
echo  must first bring your skipper into port and save the game before you
echo  install the expansion disk.
echo.
echo                      Continue with install? (Y/N)
echo.
echo.

%IDRIVE%:\CHUNK\GK.COM
IF ERRORLEVEL 121 IF NOT ERRORLEVEL 122 GOTO startcopy
IF ERRORLEVEL 110 IF NOT ERRORLEVEL 111 GOTO earlyexit
IF ERRORLEVEL 89  IF NOT ERRORLEVEL 90  GOTO startcopy
IF ERRORLEVEL 78  IF NOT ERRORLEVEL 79  GOTO earlyexit


:======= earlyexit ============
%IDRIVE%:
goto end


rem *********** error handling and clean up *********

:BadChunk
echo unable to extract resource file.
goto done

:Delchunk
del unchunk.exe
goto done

:DelRes
del resource.000
goto done

:done
IF EXIST unchunk.exe goto Delchunk
IF EXIST resource.000 goto DelRes
SET IDRIVE=
SET DEFD=
SET DEFP=
:end

***************************

I hope you can get what you want by association. Good luck :up:
Cheers,

vdr1981 01-31-18 06:01 PM

Thank you very much XenonSurf although this may be indeed to advanced for me...:hmmm:

Can you please edit your post with code tags and spoilers so we can keep this tread as clear as possible for anyone with possible solution?:yep:

XenonSurf 01-31-18 06:31 PM

Additionally, I know from making batch files that any names with spaces must be kept in brackets, like "C:\ xxxx xxxx", so your initial example won't work probably.

I still have a printed version of the MS-DOS 5.0 manual :D
Believe me or not, it helps me still today... Thats' how MS Windows is put together... There must be an electronic version. Get it, it has all possible commands.

vdr1981 02-01-18 03:18 AM

Anyone else? OldCoder? :hmm2:

sputterfish 02-01-18 07:09 AM

Quote:

Originally Posted by vdr1981 (Post 2539460)
Anyone else? OldCoder? :hmm2:

Hello, VDR. I've created a tool in C# that can generate the config file for you by reading a sh5 regkey. All that is needed is to run the exe and it spits out the cfg file. Can be built using Visual Studio 2017 Community.

https://github.com/sputterfish/silenthuntercfgmaker

It will drop the cfg file in the same directory where it is run, you can of course edit this or if its any use i can help as needed. Not savvy in batch here so if this of no use, oh well.

Cheers

vdr1981 02-01-18 09:20 AM

Quote:

Originally Posted by sputterfish (Post 2539485)
Hello, VDR. I've created a tool in C# that can generate the config file for you by reading a sh5 regkey. All that is needed is to run the exe and it spits out the cfg file. Can be built using Visual Studio 2017 Community.

https://github.com/sputterfish/silenthuntercfgmaker

It will drop the cfg file in the same directory where it is run, you can of course edit this or if its any use i can help as needed. Not savvy in batch here so if this of no use, oh well.

Cheers

That sounds very much like my original idea, thank you very much! :up:
I'm having troubles to download the exe? Should I be registered on GitHub in order to download the file?

sputterfish 02-01-18 09:23 AM

Quote:

Originally Posted by vdr1981 (Post 2539515)
That sounds very much like my original idea, thank you very much! :up:
I'm having troubles to download the exe? Should I be registered on GitHub in order to download the file?

https://github.com/sputterfish/silen...lderReader.exe

You should be able to download directly using this link. I can make any changes to the output if needed.

vdr1981 02-01-18 09:30 AM

Quote:

Originally Posted by sputterfish (Post 2539516)
https://github.com/sputterfish/silen...lderReader.exe

You should be able to download directly using this link. I can make any changes to the output if needed.

Very very nice and exactly what I was looking for! :yeah:

But it needs few tweaks:

The file should be named GenericPatcher.cfg

Also output text should have no " marks or spaces around = mark :yep: Can you edit the app please?

Code:

ClientAreaWidth = 1184
ClientAreaHeight = 765
CameraManager.act_=_"D:\INSTALIRANE IGRE-Win7\Silent Hunter 5"
EnvSim.act = "D:\INSTALIRANE IGRE-Win7\Silent Hunter 5"
kernel.dll = "D:\INSTALIRANE IGRE-Win7\Silent Hunter 5"
sh5.exe = "D:\INSTALIRANE IGRE-Win7\Silent Hunter 5"
SHCollisions.act = "D:\INSTALIRANE IGRE-Win7\Silent Hunter 5"
SHSound.act = "D:\INSTALIRANE IGRE-Win7\Silent Hunter 5"
SH_NClient.dll = "D:\INSTALIRANE IGRE-Win7\Silent Hunter 5"
SimData.dll = "D:\INSTALIRANE IGRE-Win7\Silent Hunter 5"
LanguagePackInUse =


sputterfish 02-01-18 09:36 AM

Alright changes made. Should reflect the requested.

https://github.com/sputterfish/silen...oad/2/SHFR.exe

Cheers

vdr1981 02-01-18 09:44 AM

Quote:

Originally Posted by sputterfish (Post 2539519)
Alright changes made. Should reflect the requested.

https://github.com/sputterfish/silen...oad/2/SHFR.exe

Cheers

OK...Much better but the output misses following line:
Code:

ClientAreaWidth=1184
ClientAreaHeight=765
CameraManager.act=D:\INSTALIRANE IGRE-Win7\Silent Hunter 5
EnvSim.act=D:\INSTALIRANE IGRE-Win7\Silent Hunter 5
kernel.dll=D:\INSTALIRANE IGRE-Win7\Silent Hunter 5
sh5.exe=D:\INSTALIRANE IGRE-Win7\Silent Hunter 5
SHCollisions.act=D:\INSTALIRANE IGRE-Win7\Silent Hunter 5
SHSim.act=D:\INSTALIRANE IGRE-Win7\Silent Hunter 5
SHSound.act=D:\INSTALIRANE IGRE-Win7\Silent Hunter 5
SH_NClient.dll=D:\INSTALIRANE IGRE-Win7\Silent Hunter 5
SimData.dll=D:\INSTALIRANE IGRE-Win7\Silent Hunter 5
LanguagePackInUse=

Also, just to be on a safe side, you can also remove spaces in ClientAreaWidth/Height lines...:yep::up:

sputterfish 02-01-18 09:49 AM

Fixed. Same link as before.

https://github.com/sputterfish/silen...oad/2/SHFR.exe


All times are GMT -5. The time now is 02:56 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 1995- 2024 Subsim®
"Subsim" is a registered trademark, all rights reserved.