@echo off
:: _SCUS_94476
::
:: This uses "gsar.exe" http://gnuwin32.sourceforge.net/packages/gsar.htm
:: Put this in the directory with the BASE.PBP, KEYS.BIN, popstation.exe
:: Put psx.iso's in "psxisos" directory (default) in there with this and them.
:: PSP compat isos will be in "GAME" (default)
::
:: A file named "saveid.log" will be generated to make sure the same number
:: isn't chosen 2 times. (this is so zhitty).
::
set isotype=bin&:: Set to iso type. ie. .iso, .bin, whatever
set psppsxs=GAME&:: Set to PSP_PSX iso directory, base only, not full path.
set psxisos=psxisos&:: Set to psx iso directory, base only, not full path.
::
::
if /i not exist "%~dp0%psxisos%" mkdir "%~dp0%psxisos%"
if /i not exist "%~dp0%psppsxs%" mkdir "%~dp0%psppsxs%"
::
::
for /f "usebackq tokens=*" %%i in (`dir /b/s %~dp0%psxisos%\*.%isotype%`) do call :_idcheck "%psppsxs%" "%psxisos%" "%%i"
goto :exit
::
::
:_idcheck
set gsaveid=%RANDOM%&::
if not %gsaveid% GTR 9999 goto :_idcheck
for /f "usebackq" %%i in (`find /i "%gsaveid%" "%~dp0saveid.log"`) do if /i "%gsaveid%a"=="%%ia" goto :_idcheck
echo %gsaveid% >> %~dp0saveid.log
::
::
set serstring=_SCUS_94476&::
set repstring=_SCUS_%gsaveid%&::
echo %1 %2 %3
set psxiso=%~dpnx1&::
set psppsx=%~dpnx2&::
set gamename=%~n3&::
echo psxiso=%~dpnx1&::
echo psppsx=%~dpnx2&::
echo gamename=%~n3&::
"%~dp0gsar.exe" -s_SCUS_94476 -r%repstring% "%~dp0popstation.exe" "%~dp0popstation%repstring%.exe"
if /i exist "%~dp0%psppsxs%\%gamename%_ICON0.PNG" copy /y "%~dp0%psppsxs%\%gamename%_ICON0.PNG" "%~dp0ICON0.PNG"
if /i exist "%~dp0%psppsxs%\%gamename%_PIC0.PNG" copy /y "%~dp0%psppsxs%\%gamename%_PIC0.PNG" "%~dp0PIC0.PNG"
if /i exist "%~dp0%psppsxs%\%gamename%_PIC1.PNG" copy /y "%~dp0%psppsxs%\%gamename%_PIC1.PNG" "%~dp0PIC1.PNG"
move %3 "%~dp0"
"%~dp0popstation%repstring%.exe" "%~dp0%gamename%.%isotype%"
move "%~dp0%gamename%.%isotype%" "%~dp0%psxisos%"
if /i not exist "%~dp0%psppsxs%\%gamename%" mkdir "%~dp0%psppsxs%\%gamename%"
move "%~dp0EBOOT.PBP" "%~dp0%psppsxs%\%gamename%\"
copy "%~dp0KEYS.BIN" "%~dp0%psppsxs%\%gamename%\"
pause
::
::
::
::
::
::
:exit