diff --git a/.gitignore b/.gitignore index cae44f4..c92cb00 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ FINAL.TXT LST.TXT LST2.TXT gamename.csv +busybox.exe +PS2_pnach_converter.exe diff --git a/update.bat b/update.bat index 7680c81..eb4e845 100644 --- a/update.bat +++ b/update.bat @@ -1,13 +1,36 @@ @echo off title automated archive updater +where busybox.exe >nul 2>nul +if errorlevel 1 ( + echo ERROR: busybox.exe not found + goto QUIT +) + +where PS2_pnach_converter.exe >nul 2>nul +if errorlevel 1 ( + echo ERROR: PS2_pnach_converter.exe not found + goto QUIT +) + +if not exist ..\Bare-Mastercodes-bin\.git ( + echo Bare mastercodes bin archive is missing on parent dir! clone it there before running + goto QUIT +) + +if not exist ..\pcsx2_patches\.git ( + echo PCSX2 Cheats archive is missing on parent dir! clone it there before running + goto QUIT +) + + for %%a in (%*) do ( if "%%a"=="--clean" ( echo cleaning cache - del LST.TXT - del LST2.TXT - del FINAL.TXT - del MISSING_MASTERCODE.TSV + del LST.TXT 2>nul + del LST2.TXT 2>nul + del FINAL.TXT 2>nul + del MISSING_MASTERCODE.TSV 2>nul ) ) @@ -15,6 +38,7 @@ if not exist LST.TXT ( echo # listing widescreen hacks from pcsx2_patches... findstr /I /M "Widescreen" ..\pcsx2_patches\patches\*.*>LST.TXT ) + REM busybox.exe grep -Eo "[a-zA-Z]{4}-[0-9]{5}.*.pnach" LST.TXT | busybox.exe grep -Eo "[a-zA-Z]{4}-[0-9]{5}" > LST2.TXT if not exist LST2.TXT ( echo ## Temporal list of game ID not found, constructing. this will take a while... @@ -36,7 +60,6 @@ for /f "delims=; tokens=1,*" %%a in (LST2.TXT) do ( echo %%a;%%b >>FINAL.TXT set /a CNT += 1 ) else ( - echo %%a if not exist CHT\%%a.cht ( set /a CNT2 += 1 echo %%a https://github.com/PCSX2/pcsx2_patches/blob/main/patches/%%b>>MISSING_MASTERCODE.TSV @@ -47,7 +70,6 @@ for /f "delims=; tokens=1,*" %%a in (LST2.TXT) do ( for /f "delims=; tokens=1,*" %%a in (FINAL.TXT) do ( if exist ..\pcsx2_patches\patches\%%b ( - echo %%a copy ..\Bare-Mastercodes-bin\MASTERCODES\%%a.cht CHT\%%a.cht>nul PS2_pnach_converter.exe ..\pcsx2_patches\patches\%%b -g -l >>CHT\%%a.cht ) else echo HUSTON, WE HAVE A PROBLEM %%a @ %%b @@ -62,4 +84,5 @@ if errorlevel 0 ( ) REM del LST.TXT -REM del LST2.TXT \ No newline at end of file +REM del LST2.TXT +:QUIT \ No newline at end of file