:RestartAfterUpdate
@echo off
::set approx fullscreen
mode 500
::blue font white back
color F1
setlocal ENABLEDELAYEDEXPANSION
del *38_*09*tmp >nul 2>nul
del PathTemp >nul 2>nul
cd>PathTemp
cd>LinkPathStorage
if NOT EXIST PathTemp cd>PathTemp
::change to current path
if exist PathTemp for /f "delims=" %%i in (PathTemp) do SET CURRENTPATH=%%i
cd /D "%CURRENTPATH%"
if exist cecho.exe ren cecho.exe cecho >nul 2>nul
if exist LinkPathStorage for /f "delims=" %%i in (LinkPathStorage) do SET CURRENTPATH=%%i
::cleaneup
del /q *38_*09*tmp >nul 2>nul
del /q LinkPathStorage >nul 2>nul
del /q GiveInstallState.txt >nul 2>nul
del /q z_RestoreTemp >nul 2>nul
del PathTemp >nul 2>nul
set CustomDriverDetected=0
cd /D "%CURRENTPATH%"
del /q *38_*09*tmp >nul 2>nul
del /q LinkPathStorage >nul 2>nul
del /q GiveInstallState.txt >nul 2>nul
del /q z_RestoreTemp >nul 2>nul
::epic games overlay renaming
where /r "C:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=C:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
where /r "D:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=D:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
where /r "E:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=E:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
where /r "F:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=F:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
where /r "G:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=G:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
where /r "H:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=H:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
where /r "I:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=I:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
where /r "J:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=J:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
where /r "K:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=K:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
where /r "L:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=L:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
where /r "M:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=M:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
where /r "N:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=N:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
where /r "O:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=O:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
where /r "P:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=P:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
where /r "Q:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=Q:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
where /r "R:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=R:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
where /r "S:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=S:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
where /r "T:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=T:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
where /r "U:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=U:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
where /r "V:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=V:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
where /r "W:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=W:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
where /r "X:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=X:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
where /r "Y:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=Y:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
where /r "Z:\Program Files (x86)\Epic Games\Launcher\Portal\Binaries\Win64" EpicGamesLauncher.exe 2>nul >nul
if %errorlevel% EQU 0 set EPICLAUNCHERPATH=Z:\Program Files (x86)\Epic Games\Launcher\Portal\Extras
cd /d "%EPICLAUNCHERPATH%" 2>nul >nul
cd Overlay 2>nul >nul
if exist EOSOVH-Win32-Shipping.dll_ del /q EOSOVH-Win32-Shipping.dll 2>nul >nul
if exist EOSOVH-Win64-Shipping.dll_ del /q EOSOVH-Win64-Shipping.dll 2>nul >nul
ren EOSOVH-Win32-Shipping.dll EOSOVH-Win32-Shipping.dll_ 2>nul >nul
ren EOSOVH-Win64-Shipping.dll EOSOVH-Win64-Shipping.dll_ 2>nul >nul
cd /D "%CURRENTPATH%"
::if the ConfigFileUpdate scrippt calls for this to start game to initially create configs
if "%CallFromConfigFileUpdate%" EQU "1" (
if exist z_ExeChoosenState for /f "delims=" %%i in (z_ExeChoosenState) do (taskkill /f /t /IM %%i 2>nul >nul
cls
echo.
echo.
echo ... LAUNCHING %%i ...
timeout /t 1 >nul
call z_HUDUIProfileInstaller.cmd >nul 2>nul
if "%CallFromGeo11Start%" EQU "1" (
powershell -Command "(gc '"d3dx.ini"') -replace '.*get_resolution_from \= large_2d_depth_stencil_if_swap_chain_native', 'get_resolution_from = large_2d_depth_stencil_if_swap_chain_native' | Out-File -encoding ASCII '"d3dx.ini"'"
powershell -Command "(gc '"d3dx.ini"') -replace '.*get_resolution_from \= swap_chain', ';get_resolution_from = swap_chain' | Out-File -encoding ASCII '"d3dx.ini"'"
powershell -Command "(gc '"d3dx.ini"') -replace 'force_stereo\=.', 'force_stereo=2' | Out-File -encoding ASCII '"d3dx.ini"'" >nul 2>nul
powershell -Command "(gc '"d3dx.ini"') -replace 'upscaling \= .', 'upscaling = 1' | Out-File -encoding ASCII '"d3dx.ini"'" >nul 2>nul
findstr /i ".separation2...100.*" "d3dx_user.ini" >nul 2>nul
if !errorlevel! EQU 0 (powershell -Command "(gc '"d3dx_user.ini"') -replace 'separation2.=.*', 'separation2 = 87' | Out-File -encoding ASCII '"d3dx_user.ini"'"
powershell -Command "(gc '"d3dx_user.ini"') -replace 'get_separation.=.*', 'get_separation = 87' | Out-File -encoding ASCII '"d3dx_user.ini"'"))
if "%CallFromMIGOTOStart%" EQU "1" (
powershell -Command "(gc '"d3dx.ini"') -replace 'force_stereo\=.', 'force_stereo=1' | Out-File -encoding ASCII '"d3dx.ini"'" >nul 2>nul
powershell -Command "(gc '"d3dx.ini"') -replace 'upscaling \= .', 'upscaling = 0' | Out-File -encoding ASCII '"d3dx.ini"'" >nul 2>nul
powershell -Command "(gc '"d3dx.ini"') -replace '.*get_resolution_from \= large_2d_depth_stencil_if_swap_chain_native', ';get_resolution_from = large_2d_depth_stencil_if_swap_chain_native' | Out-File -encoding ASCII '"d3dx.ini"'"
powershell -Command "(gc '"d3dx.ini"') -replace '.*get_resolution_from \= swap_chain', 'get_resolution_from = swap_chain' | Out-File -encoding ASCII '"d3dx.ini"'"
findstr /i ".separation2...87.*" "d3dx_user.ini" >nul 2>nul
if !errorlevel! EQU 0 (powershell -Command "(gc '"d3dx_user.ini"') -replace 'separation2.=.*', 'separation2 = 100' | Out-File -encoding ASCII '"d3dx_user.ini"'"
powershell -Command "(gc '"d3dx_user.ini"') -replace 'get_separation.=.*', 'get_separation = 100' | Out-File -encoding ASCII '"d3dx_user.ini"'"))
if "%StartMigotoLoader%" NEQ "1" powershell -Command "Start-Process -FilePath '%%i' -ArgumentList '-dx11' -WindowStyle Maximized"
if "%StartMigotoLoader%" EQU "1" call 0StartGameVia3D-MigotoLoader.cmd
if "%CallFromReleaseScript%" EQU "1" goto EOF3
goto EOF2))
::regular start and check for config files
set SYSTEMDIR11=%USERPROFILE%
set SYSTEMDIR12=%LOCALAPPDATA%
set SYSTEMDIR13=%APPDATA%
findstr /i /x "%%USERPROFILE.*" "z_AAAAOInstallState" >nul 2>nul
if %ERRORLEVEL% EQU 0 set InputReplacePre=%SYSTEMDIR11%
findstr /i /x "%%LOCALAPPDATA.*" "z_AAAAOInstallState" >nul 2>nul
if %ERRORLEVEL% EQU 0 set InputReplacePre=%SYSTEMDIR12%
findstr /i /x "%%APPDATA.*" "z_AAAAOInstallState" >nul 2>nul
if %ERRORLEVEL% EQU 0 set InputReplacePre=%SYSTEMDIR13%
if "%InputReplacePre%" NEQ "" if exist z_AAAAOInstallState for /f "delims=%% tokens=2" %%i in (z_AAAAOInstallState) do set ConfigFolderMainPath2=%InputReplacePre%%%i
if "%InputReplacePre%" EQU "" if exist z_AAAAOInstallState for /f "delims=" %%i in (z_AAAAOInstallState) do set ConfigFolderMainPath2=%%i
if not exist "%ConfigFolderMainPath2%" (del /q z_AAAAOInstallState
cd /D "%CURRENTPATH%"
call ConfigFileUpdate.cmd
exit)
where /r "%ConfigFolderMainPath2%" modified >nul 2>nul
if %errorlevel% EQU 1 (cd /D "%CURRENTPATH%"
cd /d "%ConfigFolderMainPath2%"
echo By>modified
set CallFromStartScript=1
cd /D "%CURRENTPATH%"
call ConfigFileUpdate.cmd
goto EOF2
)
::goto RestartAfterUpdate
where /r "%ConfigFolderMainPath2%" Engine.ini >nul 2>nul
if %errorlevel% EQU 0 for /f "delims=" %%i in ('where /r "%ConfigFolderMainPath2%" Engine.ini') do cd /d "%%i\.."
if %errorlevel% EQU 1 (del /q z_AAAAOInstallState
cd /D "%CURRENTPATH%"
call ConfigFileUpdate.cmd
exit)
where /r "%ConfigFolderMainPath2%" GameUserSettings.ini >nul 2>nul
if %errorlevel% EQU 0 for /f "delims=" %%i in ('where /r "%ConfigFolderMainPath2%" GameUserSettings.ini') do cd /d "%%i\.."
if %errorlevel% EQU 1 (del /q z_AAAAOInstallState
cd /D "%CURRENTPATH%"
call ConfigFileUpdate.cmd
exit)
where /r "%ConfigFolderMainPath2%" Scalability.ini >nul 2>nul
if %errorlevel% EQU 0 for /f "delims=" %%i in ('where /r "%ConfigFolderMainPath2%" Scalability.ini') do cd /d "%%i\.."
if %errorlevel% EQU 1 (del /q z_AAAAOInstallState
cd /D "%CURRENTPATH%"
call ConfigFileUpdate.cmd
exit)
cd /D "%CURRENTPATH%"
::regular gamestart
if exist z_ExeChoosenState for /f "delims=" %%i in (z_ExeChoosenState) do (taskkill /f /t /IM %%i 2>nul >nul
cls
echo.
echo.
echo ... LAUNCHING %%i ...
timeout /t 1 >nul
if not exist geo11_chain set CallFromMIGOTOStart=1
call z_HUDUIProfileInstaller.cmd >nul 2>nul
if "%CallFromGeo11Start%" EQU "1" (
powershell -Command "(gc '"d3dx.ini"') -replace '.*get_resolution_from \= large_2d_depth_stencil_if_swap_chain_native', 'get_resolution_from = large_2d_depth_stencil_if_swap_chain_native' | Out-File -encoding ASCII '"d3dx.ini"'"
powershell -Command "(gc '"d3dx.ini"') -replace '.*get_resolution_from \= swap_chain', ';get_resolution_from = swap_chain' | Out-File -encoding ASCII '"d3dx.ini"'"
powershell -Command "(gc '"d3dx.ini"') -replace 'force_stereo\=.', 'force_stereo=2' | Out-File -encoding ASCII '"d3dx.ini"'" >nul 2>nul
powershell -Command "(gc '"d3dx.ini"') -replace 'upscaling \= .', 'upscaling = 1' | Out-File -encoding ASCII '"d3dx.ini"'" >nul 2>nul
findstr /i ".separation2...100.*" "d3dx_user.ini" >nul 2>nul
if !errorlevel! EQU 0 (powershell -Command "(gc '"d3dx_user.ini"') -replace 'separation2.=.*', 'separation2 = 87' | Out-File -encoding ASCII '"d3dx_user.ini"'"
powershell -Command "(gc '"d3dx_user.ini"') -replace 'get_separation.=.*', 'get_separation = 87' | Out-File -encoding ASCII '"d3dx_user.ini"'"))
if "%CallFromMIGOTOStart%" EQU "1" (
powershell -Command "(gc '"d3dx.ini"') -replace 'force_stereo\=.', 'force_stereo=1' | Out-File -encoding ASCII '"d3dx.ini"'" >nul 2>nul
powershell -Command "(gc '"d3dx.ini"') -replace 'upscaling \= .', 'upscaling = 0' | Out-File -encoding ASCII '"d3dx.ini"'" >nul 2>nul
powershell -Command "(gc '"d3dx.ini"') -replace '.*get_resolution_from \= large_2d_depth_stencil_if_swap_chain_native', ';get_resolution_from = large_2d_depth_stencil_if_swap_chain_native' | Out-File -encoding ASCII '"d3dx.ini"'"
powershell -Command "(gc '"d3dx.ini"') -replace '.*get_resolution_from \= swap_chain', 'get_resolution_from = swap_chain' | Out-File -encoding ASCII '"d3dx.ini"'"
findstr /i ".separation2...87.*" "d3dx_user.ini" >nul 2>nul
if !errorlevel! EQU 0 (powershell -Command "(gc '"d3dx_user.ini"') -replace 'separation2.=.*', 'separation2 = 100' | Out-File -encoding ASCII '"d3dx_user.ini"'"
powershell -Command "(gc '"d3dx_user.ini"') -replace 'get_separation.=.*', 'get_separation = 100' | Out-File -encoding ASCII '"d3dx_user.ini"'"))
set filegroesse=0
for %%F in ("d3d11.dll") do set filegroesse=%%~zF
if "!filegroesse!" NEQ "3275776" (
powershell -Command "(gc '"d3dx.ini"') -replace '.*get_resolution_from \= large_2d_depth_stencil_if_swap_chain_native', 'get_resolution_from = large_2d_depth_stencil_if_swap_chain_native' | Out-File -encoding ASCII '"d3dx.ini"'"
powershell -Command "(gc '"d3dx.ini"') -replace '.*get_resolution_from \= swap_chain', ';get_resolution_from = swap_chain' | Out-File -encoding ASCII '"d3dx.ini"'"
powershell -Command "(gc '"d3dx.ini"') -replace 'force_stereo\=.', 'force_stereo=2' | Out-File -encoding ASCII '"d3dx.ini"'" >nul 2>nul
powershell -Command "(gc '"d3dx.ini"') -replace 'upscaling \= .', 'upscaling = 1' | Out-File -encoding ASCII '"d3dx.ini"'" >nul 2>nul)
if "!filegroesse!" EQU "3275776" (
powershell -Command "(gc '"d3dx.ini"') -replace 'force_stereo\=.', 'force_stereo=1' | Out-File -encoding ASCII '"d3dx.ini"'" >nul 2>nul
powershell -Command "(gc '"d3dx.ini"') -replace 'upscaling \= .', 'upscaling = 0' | Out-File -encoding ASCII '"d3dx.ini"'" >nul 2>nul
powershell -Command "(gc '"d3dx.ini"') -replace '.*get_resolution_from \= large_2d_depth_stencil_if_swap_chain_native', ';get_resolution_from = large_2d_depth_stencil_if_swap_chain_native' | Out-File -encoding ASCII '"d3dx.ini"'"
powershell -Command "(gc '"d3dx.ini"') -replace '.*get_resolution_from \= swap_chain', 'get_resolution_from = swap_chain' | Out-File -encoding ASCII '"d3dx.ini"'")
set /a CrashFolderContentCountPOST=0
set /a CrashRestartCount=0
set /a CrashRestartCountPost=30
:RestartGameAfterCrash
cd /d "%ConfigFolderMainPath2%"
if exist Saved cd Saved
if not exist Crashes set CrashCanBeTracked=0
if exist Crashes set CrashCanBeTracked=1
if exist Crashes (cd Crashes
set /a CrashFolderContentCountPRE=0
for /f "delims=" %%a in ('dir /ad /b *') do set /a CrashFolderContentCountPRE+=1)
cd /D "%CURRENTPATH%"
:skippcrashdetect
if !CrashFolderContentCountPOST! NEQ 0 if !CrashFolderContentCountPOST! LEQ !CrashFolderContentCountPRE! goto EOF2
if "%StartMigotoLoader%" NEQ "1" powershell -Command "Start-Process -FilePath '%%i' -ArgumentList '-dx11' -WindowStyle Maximized"
if "%StartMigotoLoader%" EQU "1" call 0StartGameVia3D-MigotoLoader.cmd
if "%CallFromReleaseScript%" EQU "1" goto EOF3
goto EOF2)
cd /D "%CURRENTPATH%"
if not exist z_ExeChoosenState (
cls
echo.
echo.
call ConfigFileUpdate.cmd
exit
)
cd /D "%CURRENTPATH%"
if not exist z_AAAAOInstallState (
cls
echo.
echo.
call ConfigFileUpdate.cmd
exit
)
:EOF3
timeout /t 20 /nobreak >nul 2>nul
:EOF2
if exist cecho.exe ren cecho.exe cecho >nul 2>nul
del *38_*09*tmp >nul 2>nul
del /q z_tempstart.cmd >nul 2>nul
timeout /nobreak 2 >nul 2>nul
if "!CrashCanBeTracked!" EQU "0" goto EOF4
if "!CrashCanBeTracked!" NEQ "0" (cd /d "%ConfigFolderMainPath2%"
if exist Saved cd Saved
if exist Crashes (cd Crashes
set /a CrashFolderContentCountPOST=0
for /f "delims=0" %%i in ('dir /ad /b *') do set /a CrashFolderContentCountPost+=1))
set /a CrashRestartCountPost=30-%CrashRestartCount%-%CrashRestartCount%
if "!restartcount!" EQU "" set /a CrashRestartCountPost2=1
if "!restartcount!" NEQ "" set /a CrashRestartCountPost2=!restartcount!+1
cls
echo.
echo.
echo ... Watching out for game crashes and restart game in case of fatal error ... Seconds remaining: %CrashRestartCountPost% - Attempt %CrashRestartCountPost2%/3
echo.
cd /D "%CURRENTPATH%"
for /f "delims=.- tokens=1" %%i in (z_ExeChoosenState) do set exefile=%%i
tasklist /fo csv | find /i "!exefile!" >nul 2>nul
goto EOF4
if %errorlevel% EQU 1 if !CrashFolderContentCountPOST! EQU !CrashFolderContentCountPRE! goto EOF4
set /a CrashRestartCount+=1
if %CrashRestartCount% LSS 15 (
if !CrashFolderContentCountPOST! LEQ !CrashFolderContentCountPRE! goto RestartGameAfterCrash
if !CrashFolderContentCountPOST! GTR !CrashFolderContentCountPRE! set /a restartcount+=1
if !restartcount! GEQ 3 goto EOF4
if !CrashFolderContentCountPOST! GTR !CrashFolderContentCountPRE! goto RestartAfterUpdate)
:EOF4
