@echo OFF
rem  This uses SoCPUP to extract the SEVA suit OGF file to
rem  correct a wrong texture reference. Once the OGF file
rem  is extracted it is patched to use the correct texture.
rem  Original file fix by MrSeyker - Patch by NatVac
rem  Run batch file in SoC install directory with SoCPUP.

rem  First extract the OGF file if not already available
echo ***********************************
echo *** SEVA Suit Texture Fix, v1.0 ***
echo ***********************************
if NOT EXIST gamedata\meshes\actors\hero\stalker_scien.ogf goto ExtractSuitOGF
echo -------------- SEVA suit OGF file already exists
goto PatchFile

:ExtractSuitOGF
echo ... Extracting SEVA suit OGF file ...
SoCPUP -extractx meshes\actors\hero\stalker_scien.ogf -dir gamedata gamedata.db4
if ERRORLEVEL 2 goto FixErrorFirst

:PatchFile
echo ... Patching SEVA suit OGF file ...
SoCPUP -patchfile _SEVA_SuitTextureFix.patch
if ERRORLEVEL 2 goto FixErrorFirst
if ERRORLEVEL 1 goto AlreadyPatched
goto PatchDone

:AlreadyPatched
echo ...
echo The SEVA suit OGF file is apparently already patched.
echo ...
goto PatchExit

:FixErrorFirst
echo ...
echo Please fix the problem before trying again.
echo ...
goto PatchExit

:PatchDone
echo ...
echo Patch of SEVA suit OGF file is complete.

:PatchExit
pause