@echo off setlocal :: ------------------------------------------------------- :: Paths :: ------------------------------------------------------- set TOOLS=C:\Program Files (x86)\SCE\ORBIS\Tools\Publishing Tools\bin set SRC_GAME=Minecraft.Client\PS4_GAME set SRC_ELF=ORBIS_Release\Minecraft.Client.elf set STAGING=CUSA00283-app set OUT_PKG=CUSA00283-app.pkg :: ------------------------------------------------------- :: 1. Clean and create staging folder :: ------------------------------------------------------- echo [1/5] Staging files... if exist "%STAGING%" rmdir /S /Q "%STAGING%" xcopy /E /I /Y "%SRC_GAME%" "%STAGING%" :: ------------------------------------------------------- :: 2. Replace eboot.bin with freshly compiled ELF :: ------------------------------------------------------- echo [2/5] Injecting eboot.bin... copy /Y "%SRC_ELF%" "%STAGING%\eboot.bin" :: ------------------------------------------------------- :: 3. Create placeholder keystone (256 zero bytes) :: Required by gengp4_app before it will generate the GP4 :: ------------------------------------------------------- echo [3/5] Creating keystone... powershell -NoProfile -Command ^ copy /Y "keystone" "%STAGING%\sce_sys\keystone' :: ------------------------------------------------------- :: 4. Generate GP4 project file :: Backup param.sfo first as gengp4 may modify it :: ------------------------------------------------------- echo [4/5] Generating GP4... copy /Y "%STAGING%\sce_sys\param.sfo" "%STAGING%\sce_sys\param.sfo.bak" "%TOOLS%\gengp4_app.exe" "%STAGING%" :: ------------------------------------------------------- :: 4b. Fix gengp4 bug: default_id is 1-indexed but scenario id is 0-indexed :: ------------------------------------------------------- echo [4b/5] Patching GP4 default_id... powershell -NoProfile -Command ^ "(Get-Content '%STAGING%.gp4') -replace 'default_id=""1""', 'default_id=""0""' | Set-Content '%STAGING%.gp4'" :: ------------------------------------------------------- :: 5. Build PKG :: ------------------------------------------------------- echo [5/5] Building PKG... if exist "%OUT_PKG%" del /Q "%OUT_PKG%" "%TOOLS%\orbis-pub-cmd.exe" img_create "%STAGING%.gp4" "%OUT_PKG%" echo. echo Done! Output: %OUT_PKG% pause