Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- setlocal ENABLEDELAYEDEXPANSION
- set AISAVEPATH=!LOCALAPPDATA!\The Creative Assembly\Alien Isolation
- set DATETIME=!date:~-4,4!.!date:~-7,2!.!date:~0,2!_!time:~0,2!.!time:~3,2!
- set DATETIME=!DATETIME: =0!
- set BACKUPDIR=!AISAVEPATH!\Backup\!DATETIME!
- set /a SAVECOUNT=0
- echo Alien Isolation Start Script
- echo ----------------------------
- :: start game normally when no saves exist yet
- if not exist "!AISAVEPATH!\CHSV0*" (
- call:StartAI
- exit /b
- )
- :: backup save files
- echo -Backing up save files...
- xcopy /y "!AISAVEPATH!\*.ais" "!BACKUPDIR!\" > NUL
- :: get previous save file
- for /f "tokens=*" %%i in ('dir "!AISAVEPATH!\CHSV0*" /b /o-d') do set PREVSAVE=%%i
- for %%i in ("!AISAVEPATH!\!PREVSAVE!") do set PREVSAVE_MTIME_BEFORE=%%~ti
- :: start game
- call:StartAI
- :: count saves while waiting for AI.exe to quit
- echo -Waiting for game quit... (Do NOT close this window.)
- :WaitForProcessStop
- timeout /t 5 > NUL
- for %%i in ("!AISAVEPATH!\!PREVSAVE!") do set PREVSAVE_MTIME_NOW=%%~ti
- if not "!SAVECOUNT!" == "2" (
- if not "!PREVSAVE_MTIME_NOW!" == "!PREVSAVE_MTIME_BEFORE!" (
- set PREVSAVE_MTIME_BEFORE=!PREVSAVE_MTIME_NOW!
- set /a SAVECOUNT=!SAVECOUNT!+1
- )
- )
- tasklist /FO LIST|find "AI.exe" >NUL
- if "%ERRORLEVEL%" == "0" goto WaitForProcessStop
- :: do nothing if it wasn't saved (no new campaign start and/or DLC missions without checkpoint saves)
- if "!SAVECOUNT!" == "0" exit /b
- :: do nothing if it saved more than once (new campaign start autosave, load previous and at least one new save)
- if "!SAVECOUNT!" == "2" exit /b
- :: restore backup if it was saved only once (new campaign start autosave, (load previous) and no saves afterwards)
- :: necessary since on next new campaign start the last save gets overwritten
- echo -Restoring backup save to prevent overwrite on next start...
- if "!SAVECOUNT!" == "1" xcopy /y "!BACKUPDIR!\*" "!AISAVEPATH!\" > NUL
- timeout /t 3 > NUL
- exit /b
- :StartAI
- :: start AI.exe with params
- echo -Starting Alien Isolation...
- start /b "" AI.exe -EpicPortal
- :: start Alias Isolation Injector
- echo -Inject Alias Isolation...
- aliasIsolationInjector.exe
- exit /b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement