Saints Row 2 Peg Texture Tool

I made a new texture tool...
Many thanks for this amazing tool, OP -- great work! 👍 As a green-like-a-grass on SR2 modding myself this tool is indispensable.

Anyway, as I'm looking to make the process much easier [for me] I went creating a script to batch execute both the files extracting and rebuilding, but coming as a self-taught-amateur I stuck at part which it did extract all the textures, but the PEG_DESC's missing the filename.

Here's how the code's looking [which is an assembly from several sources of other games] --
Code:
::///////////////////////////////////////////////////////////////////////////////////////////////////
:: PEG_PC Batch Execute for Masamaru's sr2pegtool
::///////////////////////////////////////////////////////////////////////////////////////////////////
:: Version        : BETA
:: Compiled by    : _eb_ of Saints Row Mods [https://www.saintsrowmods.com/forum/members/_eb_.307476/]
:: Compiled on    : October 23, 2021
:: Based on        : DarthParametric of Deadly Stream's "NSS2NCS Batch Compile"
::                : ReiKaz of Resident Evil Modding Forum [https://residentevilmodding.boards.net/thread/12359/wem-ogg-wav-converter-batch]
::                : Flachzangen of Nexus Mods [https://www.nexusmods.com/kotor/mods/1384]
::///////////////////////////////////////////////////////////////////////////////////////////////////

@ECHO OFF
SETLOCAL EnableDelayedExpansion
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (set "DEL=%%a")

title [SR2] PEG_PC Batch Execute for Masamaru's sr2pegtool
echo.----------------------------------------------------
echo PEG_PC Batch Execute for Masamaru's sr2pegtool BETA
echo.----------------------------------------------------
echo.
echo Howdy, Saints. Please be sure this script and the relevant PEG_PC files are
echo -- located in the same folder to where sr2pegtool.EXE's located, 'aight?
echo.
echo.
echo.
echo 1: Extract
echo 2: Rebuild
echo.
Set /P _inputtype= Choose which option ya want, Saints? [1 / 2] :
echo.
IF /I "%_inputtype%"=="1" GOTO :extract
IF /I "%_inputtype%"=="2" GOTO :rebuild
echo Error: Oops, unknown input -- abort process...
echo.
call :colorEcho 0e "[EXIT]"
echo.
echo.
pause
exit

Rem 1: Extract
:extract
echo.
echo [hitting ENTER without assigning any KEY will abort this process]
echo.
set /P input="  Continue [anyKEY] / Exit [N] :"
if %input% ==N exit
if %input% ==n exit
echo.
echo.=====[extracting files]==========
echo.
:: START
Rem For files in PEG_PC format, execute them using sr2pegtool --
for %%F in (*.peg_pc) do (
    sr2pegtool.exe %%~nF.peg_pc
)
:: END
echo.
echo.
call :colorEcho 0e "[EXIT]"
echo.
echo.
pause
exit

Rem 2: Rebuild [UNTESTED]
:rebuild
echo.
echo Make sure all the extracted files [textures and PEG_DESC] are located
echo -- in the same folder to where sr2pegtool.EXE's located, 'aight?
echo.
echo.
echo [hitting ENTER without assigning any KEY will abort this process]
echo.
set /P input="  Continue [anyKEY] / Exit [N] :"
if %input% ==N exit
if %input% ==n exit
echo.
echo.=====[rebuilding files]==========
echo.
:: START
Rem For files in PEG_DESC format, execute them using sr2pegtool --
for %%F in (*.peg_desc) do (
    sr2pegtool.exe %%~nF.peg_desc
)
:: END
echo.
echo.
call :colorEcho 0e "[EXIT]"
echo.
echo.
pause
exit

:colorEcho
echo off
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1i
-- P.S. the :rebuild one isn't tested yet.

I must've missed some things there hence the invalid PEG_DESC's filename.

Do you or anyone reading this have any idea what could be done to make it right? I'd love to see as well if someone take over this attempt and improve the provided script or even better creating one that essentially get it done. Much thanks for considering this. Cheers.
 
Top