@echo off
:main
cls
echo Rusty Hearts Transfer utility v0.01-dirty by DarkKaine
echo.
:: Defining variables.
set x64path="HKLM\SOFTWARE\Wow6432Node\PWE\Service\ENG\RustyHearts"
set x86path="HKLM\SOFTWARE\PWE\Service\ENG\RustyHearts"
set CheckCPU=reg query "HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0" /v "Platform ID"
set regpath=
set RHInstallPath=
:: Choice Menu
echo What do you want to do?
echo.
echo.
echo [1] Create a package that can be installed on another computer or flash drive.
echo [2] Repair registry path.
echo [3] Install Rusty Hearts from a previously created package.
echo [4] Play the game from the current directory.
echo [5] Exit.
echo.
set /p choice=
echo.
if "%choice%"=="1" goto detect
if "%choice%"=="2" goto detect
if "%choice%"=="3" goto detect
if "%choice%"=="4" goto detect
if "%choice%"=="5" exit
goto main
:: Check if the operating system runs in 32 or 64-bits.
:detect
for /f "tokens=1-3* " %%a in ( ' %CheckCPU% ^| find "Platform ID" ' ) do set CheckCPU=%%d
:: Appoint the correct registry path for the operating system architecture.
if "%CheckCPU%"=="0x2" (
set regpath=%x64path%
) else (
set regpath=%x86path%
)
:: Decide task 1
if "%choice%"=="2" goto manual
if "%choice%"=="3" goto installgame
if "%choice%"=="4" goto play
:: Find the Rusty Hearts Installation path in the registry and check if it's correct.
set CheckPath=reg query "%regpath%" /v "InstallPath"
FOR /f "tokens=1-2* " %%a in ( ' %CheckPath% ^| find "InstallPath" ' ) do set RHInstallPath=%%c
:findpath
if "%RHInstallPath%"=="" (
echo Could not detect the Rusty Hearts installation path. Please enter it manually.
:manual
set RHInstallPath=
set /p RHInstallPath=Install Path:
goto findpath
) else (
if exist "%RHInstallPath%\rustyhearts.exe" (
echo Installation found in "%RHInstallPath%"
) else (
echo Could not find "%RHInstallPath%\rustyhearts.exe". Please enter a path manually.
goto manual
)
)
if "%choice%"=="2" goto repair
:: File copy
:copy
echo Where do you want to copy the files to? ^(example: F:^)
set /p copypath=
xcopy "%RHInstallPath%" %copypath%\RHFiles /E /I
copy RHTransfer.bat %copypath%\RHFiles\RHTransfer.bat
pause
goto main
:: Registry repair
:repair
echo This will modify a registry entry and you may need Administrator privileges. Do you want to continue?
set /p regcontinue=Y/N:
if "%regcontinue%"=="Y" (
reg add "%regpath%" /v InstallPath /t reg_sz /d "%RHInstallPath%"
echo Done.
pause
goto main
) else (
goto main
)
::Installation
:installgame
echo Where do you want to install Rusty Hearts?
set /p RHInstallPath=Install Path:
echo.
if exist rustyhearts.exe (
xcopy * %RHInstallPath% /E /I
reg add "%regpath%" /v InstallPath /t reg_sz /d "%RHInstallPath%"
goto installruntimes
) else (
echo Rusty Hearts files not found. Please make sure that the Rusty Hearts game files are in the same directory as this script.
pause
goto main
)
:installruntimes
if "%CheckCPU%"=="0x2" (
redist\vcredist_x64.exe
) else (
redist\vcredist_x86_1.exe
redist\vcredist_x86_2.exe
)
goto main
:: Play game
:play
if exist rustyhearts.exe (
echo This will modify a registry entry and you may need Administrator privileges. Do you want to continue?
set /p regcontinue=Y/N:
) else (
echo Rusty Hearts files not found. Please make sure that the Rusty Hearts game files are in the same directory as this script.
pause
goto main
)
if "%regcontinue%"=="Y" (
reg add "%regpath%" /v InstallPath /t reg_sz /d "%CD%"
echo Done.
start ClientLauncher.exe
pause
goto main
) else (
goto main
)