diff --git a/MGSV-Custom-Texture-Path-Hex-Replacer.bat b/MGSV-Custom-Texture-Path-Hex-Replacer.bat
index e046177..2218f50 100644
--- a/MGSV-Custom-Texture-Path-Hex-Replacer.bat
+++ b/MGSV-Custom-Texture-Path-Hex-Replacer.bat
@@ -6,7 +6,7 @@
:: Requirements: GzsTool (BobDoleOwndU version), XVI32 hex editor
:: URL: https://github.com/chocmake/MGSV-Custom-Texture-Path-Hex-Replacer
:: Author: choc
-:: Version: 0.1.1 (2017-12-03)
+:: Version: 0.1.2 (2018-05-03)
:: -----------------------------------------------------------------------------------------
@@ -14,7 +14,7 @@
setlocal EnableExtensions EnableDelayedExpansion
:: Script version
-set version=0.1.1
+set version=0.1.2
:: Command prompt styling (global)
color F0
@@ -35,7 +35,6 @@ if exist "%temp%" (
)
:: Check for user settings, existing program path variables
-call :checksettings
call :checkpaths
if defined gzstoolpath if defined xvi32path goto :pathsadded
@@ -110,6 +109,286 @@ endlocal
:: --------------------------------- The Rest of the Script --------------------------------
:: -----------------------------------------------------------------------------------------
+:pathsadded
+setlocal EnableExtensions EnableDelayedExpansion
+mode con: cols=60 lines=38
+
+:: Input check if script launched with prior input (file dropped on script, etc)
+set filepath="%~1"
+set "filepath=!filepath:"=!"
+if defined filepath (
+ rem obtain correct path with ampersands but no spaces
+ set "filepath=!cmdcmdline:~0,-1!"
+ set "filepath=!filepath:*" =!"
+ set "filepath=!filepath:"=!"
+ set filepath="!filepath!"
+ for /f "delims=" %%a in ("!filepath!") do (
+ rem obtain any exclamation marks in filename
+ setlocal EnableExtensions DisableDelayedExpansion
+ set "filepath=%%~dpa%%~na%%~xa"
+ )
+ setlocal EnableExtensions EnableDelayedExpansion
+ rem Quotes must be added outside here else the problematic characters will be stripped from variable
+ set filepath="!filepath!"
+ set filepathhowtocheck=1
+ )
+
+:top
+cls
+echo.
+echo.
+echo Target Model File _____________________________________
+echo.
+echo.
+
+:: Target file
+if defined filepath goto :filepathprocessed
+:filepathprompt
+set /p filepath=!BS! ^> Drag and drop file here then press Enter: !BS!
+if not defined filepath (
+ goto :filepathprompt
+ ) else (
+ goto :top
+ )
+
+:: Target file processed
+:filepathprocessed
+set longstr=!filepath!&call:newlines
+echo.
+echo.
+echo.
+
+:originalpathheader
+echo Original FTEX Path ____________________________________
+echo.
+echo.
+
+:: Original FTEX path
+if defined originalpath goto :originalpathprocessed
+:originalpathprompt
+set /p originalpath=!BS! ^> Drag and drop file here then press Enter: !BS!
+if not defined originalpath (
+ goto :originalpathprompt
+ ) else (
+ call :formatpath1 originalpath originalpath
+ rem Check if the texture file is within Assets or not
+ if not x%originalpath:Assets=%==x%originalpath% (
+ call :formatpath2 originalpath originalpath
+ set originalpathraw=!originalpath!
+ echo !originalpath!
+ for /f %%i in ('!gzstoolpath! -d -hwe !originalpath!') do set originalpath=%%i
+ ) else (
+ rem Root directory path formatting
+ for %%i in (!originalpath!) do (
+ set originalpath=%%~ni
+ set originalpathraw=/%%~ni%%~xi
+ )
+ if "!originalpath:~12,1!"=="" (
+ set originalpath=68!originalpath!
+ ) else (
+ if /i "!originalpath:~0,1!"=="1" set originalpath=69!originalpath:~1!
+ if /i "!originalpath:~0,1!"=="2" set originalpath=6A!originalpath:~1!
+ if /i "!originalpath:~0,1!"=="3" set originalpath=6B!originalpath:~1!
+ )
+ set originalpath=15!originalpath!
+ )
+ goto :top
+ )
+
+:: Original FTEX path processed
+:originalpathprocessed
+set longstr=!originalpathraw!&call:newlines
+echo.
+call :formathex originalpath originalpathhex
+echo !originalpathhex!
+echo.
+echo.
+echo.
+echo Custom FTEX Path ______________________________________
+echo.
+echo.
+
+:: Custom FTEX path
+if defined custompath goto :custompathprocessed
+:custompathprompt
+set /p custompath=!BS! ^> Drag and drop file here then press Enter: !BS!
+if not defined custompath (
+ goto :custompathprompt
+ ) else (
+ call :formatpath1 custompath custompath
+ rem Check if the texture file is within Assets or not
+ if not x%custompath:Assets=%==x%custompath% (
+ call :formatpath2 custompath custompath
+ ) else (
+ set custompath=
+ goto :top
+ )
+ set custompathraw=!custompath!
+ for /f %%i in ('!gzstoolpath! -d -hwe !custompath!') do set custompath=%%i
+ goto :top
+ )
+
+:: Custom FTEX path processed
+:custompathprocessed
+set longstr=!custompathraw!&call:newlines
+echo.
+call :formathex custompath custompathhex
+echo !custompathhex!
+
+:: Prepare the temp find and replace script, run the hex editor
+set scriptfile="!scriptdir!HexRepl-temp.xsc"
+set "xviscript=ADR 0!lf!REPLACEALL %%1 BY %%2!lf!EXIT"
+echo !xviscript! > !scriptfile!
+call :datemodified filepath datemodified1
+!xvi32path! !filepath! /S=!scriptfile! "!originalpathhex!" "!custompathhex!"
+call :datemodified filepath datemodified2
+
+:: Delete the temp script file
+del !scriptfile!
+
+:: Exit
+echo.
+echo.
+echo.
+if /i "!datemodified1!"=="!datemodified2!" (
+ echo Modification unsuccessful. Check the FTEX paths. It may
+ echo be the custom hex string already exists in the model
+ echo file or the original hex string does not.
+ echo.
+ pause>nul|set /p =!BS! Press any key to close... !BS!
+ ) else (
+ pause>nul|set /p =!BS! Modification successful^^! Press any key to close... !BS!
+ )
+
+:: ------------------------------------ Call Functions -------------------------------------
+:: -----------------------------------------------------------------------------------------
+
+:: Break strings longer than visual window margins into new lines
+:newlines
+ setlocal
+ set longstr=!longstr:"=!
+ echo !longstr:~0,55!
+ set longstr=!longstr:~55!
+ if defined longstr goto newlines
+ endlocal
+ exit /b
+
+:: Strip double quotes from input, replace backslashes with forwardslashes
+:formatpath1