181 lines
9.7 KiB
Batchfile
181 lines
9.7 KiB
Batchfile
@echo off
|
|
setlocal enabledelayedexpansion
|
|
|
|
:: build.bat - PS Vita Minecraft build script
|
|
:: Run from Windows Command Prompt
|
|
|
|
:: ── Resolve script directory ──────────────────────────────────────────────────
|
|
set "SCRIPT_DIR=%~dp0"
|
|
:: Remove trailing backslash
|
|
if "%SCRIPT_DIR:~-1%"=="\" set "SCRIPT_DIR=%SCRIPT_DIR:~0,-1%"
|
|
|
|
set PACKAGENAME=MINECRAFTVIT0000
|
|
|
|
|
|
:: ── Territory selection ───────────────────────────────────────────────────────
|
|
echo Select territory:
|
|
echo 1) US (SCEA)
|
|
echo 2) EU (SCEE)
|
|
echo 3) JP (SCEJ)
|
|
set /p TERRITORY_CHOICE="Enter choice [1/2/3]: "
|
|
|
|
if "%TERRITORY_CHOICE%"=="1" goto :set_us
|
|
if /i "%TERRITORY_CHOICE%"=="US" goto :set_us
|
|
if "%TERRITORY_CHOICE%"=="2" goto :set_eu
|
|
if /i "%TERRITORY_CHOICE%"=="EU" goto :set_eu
|
|
if "%TERRITORY_CHOICE%"=="3" goto :set_jp
|
|
if /i "%TERRITORY_CHOICE%"=="JP" goto :set_jp
|
|
echo ERROR: Invalid choice '%TERRITORY_CHOICE%'. Exiting.
|
|
exit /b 1
|
|
|
|
:set_us
|
|
set TERRITORY=SCEA
|
|
set CONTENTID=UP4433-PCSE00491
|
|
set "SELECTEDGP4=%SCRIPT_DIR%\us.gp4p"
|
|
goto :territory_done
|
|
|
|
:set_eu
|
|
set TERRITORY=SCEE
|
|
set CONTENTID=EP4433-PCSB00560
|
|
set "SELECTEDGP4=%SCRIPT_DIR%\eu.gp4p"
|
|
goto :territory_done
|
|
|
|
:set_jp
|
|
set TERRITORY=SCEJ
|
|
set CONTENTID=JP0127-PCSG00302
|
|
set "SELECTEDGP4=%SCRIPT_DIR%\jp.gp4p"
|
|
goto :territory_done
|
|
|
|
:territory_done
|
|
echo.
|
|
echo Territory : %TERRITORY%
|
|
echo Content ID: %CONTENTID%
|
|
echo.
|
|
|
|
:: ── Target directory ──────────────────────────────────────────────────────────
|
|
set "DEFAULT_TARGETDIR=%SCRIPT_DIR%\build"
|
|
set /p TARGETDIR_INPUT="Enter target directory [default: %DEFAULT_TARGETDIR%]: "
|
|
if "%TARGETDIR_INPUT%"=="" (
|
|
set "TARGETDIR=%DEFAULT_TARGETDIR%"
|
|
) else (
|
|
set "TARGETDIR=%TARGETDIR_INPUT%"
|
|
)
|
|
|
|
set "OUTDIR=%TARGETDIR%\%TERRITORY%"
|
|
echo Output dir: %OUTDIR%
|
|
echo.
|
|
|
|
:: ── Create output directories ─────────────────────────────────────────────────
|
|
if not exist "%OUTDIR%\app\sce_sys\livearea\contents" mkdir "%OUTDIR%\app\sce_sys\livearea\contents"
|
|
if not exist "%OUTDIR%\app\sce_sys\retail\livearea\contents" mkdir "%OUTDIR%\app\sce_sys\retail\livearea\contents"
|
|
if not exist "%OUTDIR%\app\sce_sys\trophy\NPWR06859_00" mkdir "%OUTDIR%\app\sce_sys\trophy\NPWR06859_00"
|
|
if not exist "%OUTDIR%\app\PSVita" mkdir "%OUTDIR%\app\PSVita"
|
|
if not exist "%OUTDIR%\app\Common\Media" mkdir "%OUTDIR%\app\Common\Media"
|
|
if not exist "%OUTDIR%\app\sce_module" mkdir "%OUTDIR%\app\sce_module"
|
|
|
|
:: ── Copy SCE modules ──────────────────────────────────────────────────────────
|
|
echo [1/6] Copying SCE modules...
|
|
xcopy /I /Y /S "%SCE_PSP2_SDK_DIR%\target\sce_module" "%OUTDIR%\app\sce_module\"
|
|
|
|
:: ── Copy app files ────────────────────────────────────────────────────────────
|
|
echo [2/6] Copying app files...
|
|
|
|
|
|
:: Territory-specific param.sfo
|
|
copy /Y "%SCRIPT_DIR%\Minecraft.Client\PSVita\app\Region\%TERRITORY%\param.sfo" "%OUTDIR%\app\sce_sys\param.sfo"
|
|
|
|
:: Livearea XMLs
|
|
copy /Y "%SCRIPT_DIR%\Minecraft.Client\PSVita\app\Region\%TERRITORY%\template-trial.xml" "%OUTDIR%\app\sce_sys\livearea\contents\template.xml"
|
|
copy /Y "%SCRIPT_DIR%\Minecraft.Client\PSVita\app\Region\%TERRITORY%\template.xml" "%OUTDIR%\app\sce_sys\retail\livearea\contents\template.xml"
|
|
|
|
:: Manual
|
|
xcopy /I /Y /S "%SCRIPT_DIR%\Minecraft.Client\PSVita\app\Region\%TERRITORY%\manual" "%OUTDIR%\app\sce_sys\manual\"
|
|
|
|
:: Remove Region folder from output
|
|
if exist "%OUTDIR%\app\Region" rmdir /S /Q "%OUTDIR%\app\Region"
|
|
|
|
:: ── Copy game files ───────────────────────────────────────────────────────────
|
|
echo [3/6] Copying game files...
|
|
|
|
:: Clear any Common folder brought in by PSVita\app xcopy — only res and Media belong here
|
|
if exist "%OUTDIR%\app\Common" rmdir /S /Q "%OUTDIR%\app\Common"
|
|
mkdir "%OUTDIR%\app\Common\Media"
|
|
|
|
xcopy /I /Y /S "%SCRIPT_DIR%\Minecraft.Client\Common\Media\font" "%OUTDIR%\app\Common\Media\font\"
|
|
copy /Y "%SCRIPT_DIR%\Minecraft.Client\Common\Media\MediaPSVita.arc" "%OUTDIR%\app\Common\Media\MediaPSVita.arc"
|
|
xcopy /I /Y /S "%SCRIPT_DIR%\Minecraft.Client\Common\res" "%OUTDIR%\app\Common\res\"
|
|
xcopy /I /Y /S "%SCRIPT_DIR%\Minecraft.Client\music" "%OUTDIR%\app\music\"
|
|
xcopy /I /Y /S "%SCRIPT_DIR%\Minecraft.Client\PSVita\Sound" "%OUTDIR%\app\PSVita\Sound\"
|
|
copy /Y "%SCRIPT_DIR%\Minecraft.Client\PSVita\PSVitaProductCodes.bin" "%OUTDIR%\app\PSVita\PSVitaProductCodes.bin"
|
|
copy /Y "%SCRIPT_DIR%\Minecraft.Client\PSVita\session_image.png" "%OUTDIR%\app\PSVita\session_image.png"
|
|
xcopy /I /Y /S "%SCRIPT_DIR%\Minecraft.Client\PSVitaMedia\DLC" "%OUTDIR%\app\PSVita\DLC\"
|
|
copy /Y "%SCRIPT_DIR%\Minecraft.Client\sce_sys\trophy\NPWR06859_00\TROPHY.TRP" "%OUTDIR%\app\sce_sys\trophy\NPWR06859_00\TROPHY.TRP"
|
|
copy /Y "%SCRIPT_DIR%\Minecraft.Client\PSVita\app\sce_sys\icon0.png" "%OUTDIR%\app\sce_sys\icon0.png"
|
|
copy /Y "%SCRIPT_DIR%\Minecraft.Client\PSVita\app\sce_sys\pic0.png" "%OUTDIR%\app\sce_sys\pic0.png"
|
|
xcopy /I /Y /S "%SCRIPT_DIR%\Minecraft.Client\PSVita\app\sce_sys\retail\livearea\contents" "%OUTDIR%\app\sce_sys\livearea\contents\"
|
|
|
|
|
|
:: ── Remove unwanted files ─────────────────────────────────────────────────────
|
|
echo [4/6] Cleaning up unwanted files...
|
|
|
|
if exist "%OUTDIR%\app\Common\res\TitleUpdate\GameRules\BuildOnly" rmdir /S /Q "%OUTDIR%\app\Common\res\TitleUpdate\GameRules\BuildOnly"
|
|
if exist "%OUTDIR%\app\Common\res\achievement" rmdir /S /Q "%OUTDIR%\app\Common\res\achievement"
|
|
if exist "%OUTDIR%\app\Common\res\1_2_2\achievement" rmdir /S /Q "%OUTDIR%\app\Common\res\1_2_2\achievement"
|
|
|
|
del /F /Q "%OUTDIR%\app\Common\Media\font\KOR\BOKMSD.ttf" 2>nul
|
|
del /F /Q "%OUTDIR%\app\Common\Media\font\RU\SpaceMace.ttf" 2>nul
|
|
del /F /Q "%OUTDIR%\app\Common\Media\font\JPN\DFGMaruGothic-Md.ttf" 2>nul
|
|
del /F /Q "%OUTDIR%\app\Common\Media\font\CHT\DFHeiMedium-B5.ttf" 2>nul
|
|
|
|
:: Japanese logo overrides (SCEJ only)
|
|
if "%TERRITORY%"=="SCEJ" (
|
|
echo Applying Japanese logo overrides...
|
|
copy /Y "%SCRIPT_DIR%\Minecraft.Client\PSVita\app\Japanese\icon.png" "%OUTDIR%\app\sce_sys\icon0.png"
|
|
copy /Y "%SCRIPT_DIR%\Minecraft.Client\PSVita\app\Japanese\pic0.png" "%OUTDIR%\app\sce_sys\pic0.png"
|
|
copy /Y "%SCRIPT_DIR%\Minecraft.Client\PSVita\app\Japanese\startup.png" "%OUTDIR%\app\sce_sys\livearea\contents\startup.png"
|
|
copy /Y "%SCRIPT_DIR%\Minecraft.Client\PSVita\app\Japanese\startup.png" "%OUTDIR%\app\sce_sys\retail\livearea\contents\startup.png"
|
|
copy /Y "%SCRIPT_DIR%\Minecraft.Client\PSVita\app\Japanese\Minecraft_BOXART_VITA_240.png" "%OUTDIR%\app\sce_sys\livearea\contents\Minecraft_BOXART_VITA_240.png"
|
|
)
|
|
|
|
:: Remove Japanese folder from output (files already applied above for SCEJ)
|
|
if exist "%OUTDIR%\app\Japanese" rmdir /S /Q "%OUTDIR%\app\Japanese"
|
|
|
|
:: ── Create EBOOT.bin ──────────────────────────────────────────────────────────
|
|
echo [5/6] Creating EBOOT.bin...
|
|
|
|
set "PSP2BIN=%SCE_PSP2_SDK_DIR%\host_tools\build\bin\psp2bin"
|
|
set "SELF_IN=%SCRIPT_DIR%\PSVita_ContentPackage\Minecraft.Client.self"
|
|
|
|
"%PSP2BIN%" -i "%SELF_IN%" --strip-all -o "%OUTDIR%\app\eboot.bin"
|
|
copy /Y "%SELF_IN%" "%OUTDIR%\%TERRITORY%.self"
|
|
|
|
|
|
:: Delete old package if present
|
|
set PACKAGENAME=MINECRAFTVIT0000
|
|
if exist "%SCRIPT_DIR%\..\%CONTENTID%_00-%PACKAGENAME%.pkg" (
|
|
echo Removing old package...
|
|
del /F /Q "%SCRIPT_DIR%\..\%CONTENTID%_00-%PACKAGENAME%.pkg"
|
|
)
|
|
|
|
:: ── Build package ─────────────────────────────────────────────────────────────
|
|
:: ── DEV/TESTKIT package ───────────────────────────────────────────────────────
|
|
echo [6/6] Building package...
|
|
:: Uncomment to generate a pkg build for dev/testkit
|
|
:: psp2pubcmd.exe pkg_create "%SELECTEDGP4%" "%CONTENTID%_00-%PACKAGENAME%.pkg" > "%SCRIPT_DIR%\PackageBuildOutput.txt"
|
|
|
|
:: ── VPK ─────────────────────────────────────────────────────────────────────
|
|
|
|
if exist "%SCRIPT_DIR%\output.vpk" del /F /Q "%SCRIPT_DIR%\output.vpk"
|
|
pushd "%OUTDIR%\app"
|
|
"C:\Program Files\7-Zip\7z.exe" a -tzip -mx0 "%SCRIPT_DIR%\%TERRITORY%-%PACKAGENAME%.vpk" *
|
|
popd
|
|
:: ── Done ──────────────────────────────────────────────────────────────────────
|
|
echo.
|
|
echo Done!
|
|
echo Territory : %TERRITORY% (%CONTENTID%)
|
|
echo Staged at : %OUTDIR%
|
|
echo Package : %BUILD_OUT%
|
|
echo Build log : %SCRIPT_DIR%\PackageBuildOutput.txt
|
|
pause
|
|
endlocal
|