Skip to content

Commit

Permalink
parameter PRX=true/false
Browse files Browse the repository at this point in the history
  • Loading branch information
humbertodias committed Mar 2, 2024
1 parent f22f504 commit 6afc812
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 29 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ ensure-mingw:
@x86_64-w64-mingw32-g++-posix --version > /dev/null || { exit 1; }
@echo "Ok."

# Default values
PRX := false
psp:
./easy-compile-docker-psp && ./release/release-psp
./easy-compile-docker-psp -prx $(PRX) && \
./release/release-psp -prx $(PRX)

clean:
rm -rf .tmp build build-*
32 changes: 31 additions & 1 deletion easy-compile-docker-psp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,43 @@

EXE=paintown-psp.elf
BUILD_DIR=/tmp

# usage: ./easy-compile-docker-psp -prx true

# Default values
PRX=false

# Parse named arguments
while [[ $# -gt 0 ]]; do
case "$1" in
-prx)
PRX="$2"
shift 2
;;
*)
echo "Invalid option: $1" >&2
exit 1
;;
esac
done
echo PRX=$PRX


export DOCKER_DEFAULT_PLATFORM=linux/amd64
docker build -t paintown-psp-build -f docker/Dockerfile.psp .
docker run --rm -iv${PWD}:/paintown-bin -w /paintown-bin paintown-psp-build sh -s <<EOF
# copy for further modification
cp misc/psp/mips32-eabi-psp.txt ${BUILD_DIR}/mips32-eabi-psp.txt
if [[ '$PRX' == 'false' ]]; then
# Clean link_flags_prx
sed -i '/^link_flags_prx = /c\link_flags_prx = \[\]' ${BUILD_DIR}/mips32-eabi-psp.txt
fi
# setup
misc/psp-environment.sh
meson setup --cross-file misc/psp/mips32-eabi-psp.txt ${BUILD_DIR}
meson setup --cross-file ${BUILD_DIR}/mips32-eabi-psp.txt ${BUILD_DIR}
# compile
(cd ${BUILD_DIR}; meson configure -Dbuild_tests=false)
Expand Down
6 changes: 2 additions & 4 deletions misc/psp/mips32-eabi-psp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ common_args = ['-I' + psp_root / 'include'
, '-lpspdebug'
, '-fno-rtti'
]
link_flags = ['-specs=' + psp_root + '/psp/sdk/lib/prxspecs'
, '-Wl,-q,-T' + psp_root + '/psp/sdk/lib/linkfile.prx'
]
link_flags_prx = ['-specs=' + psp_root + '/psp/sdk/lib/prxspecs' , '-Wl,-q,-T' + psp_root + '/psp/sdk/lib/linkfile.prx']

[binaries]
c = 'psp-gcc'
Expand All @@ -34,7 +32,7 @@ sdl2-config = psp_root / 'psp/bin/sdl2-config'

[built-in options]
cpp_args = common_args
cpp_link_args = common_args + link_flags
cpp_link_args = common_args + link_flags_prx

[host_machine]
system = 'psp'
Expand Down
77 changes: 54 additions & 23 deletions release/release-psp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,26 @@ else
APPVERSION=$APPVERSION_COMMIT
fi

# usage: ./release/release-psp -prx true

# Default values
PRX=false

# Parse named arguments
while [[ $# -gt 0 ]]; do
case "$1" in
-prx)
PRX="$2"
shift 2
;;
*)
echo "Invalid option: $1" >&2
exit 1
;;
esac
done
echo PRX=$PRX

# inside tmp
cd $SCRIPT_DIR
rm -rf tmp && mkdir tmp && cd tmp
Expand All @@ -25,42 +45,53 @@ rm -rf tmp && mkdir tmp && cd tmp
cp $EXEDIR/misc/psp/ICON0.PNG $EXEDIR/misc/psp/ICON1.PNG .
cp $EXEDIR/misc/psp/PIC0.PNG $EXEDIR/misc/psp/PIC1.PNG .
cp $EXEDIR/misc/psp/SND0.AT3 .
cp $EXEDIR/paintown-psp.elf .
cp $EXEDIR/paintown-psp.elf EBOOT.ELF

# builder
docker run --rm -iv `pwd`:/paintown-bin -w /paintown-bin paintown-psp-build bash -s <<EOF
echo 1. Creating PARAM.SFO files.
mksfo "Paintown $APPVERSION" PARAM.SFO && echo "OK" || echo "Error"
echo 2. Fixing up import tables post-linking to remove unused functions from the executable.
psp-fixup-imports paintown-psp.elf && echo "OK" || echo "Error"
if [[ '$PRX' == 'true' ]]; then
echo 2. Fixing up import tables post-linking to remove unused functions from the executable.
psp-fixup-imports EBOOT.ELF && echo "OK" || echo "Error"
echo 3. Converting specially made ELFs to PRX files.
psp-prxgen EBOOT.ELF EBOOT.PRX && echo "OK" || echo "Error"
chown $(id -u):$(id -g) EBOOT.PRX
ls -lh EBOOT.PRX
echo 3. Converting specially made ELFs to PRX files.
psp-prxgen paintown-psp.elf EBOOT.PRX && echo "OK" || echo "Error"
else
# pack-pbp <output.pbp> <param.sfo> <icon0.png> <icon1.pmf> <pic0.png> <pic1.png> <snd0.at3> <data.psp> <data.psar>
# <output.pbp>: The desired name for your PBP file.
# <param.sfo> : The PARAM.SFO file containing metadata about your application.
# <icon0.png> : The icon image that represents your application on the PSP menu.
# <icon1.pmf> : The 44x44 pixel image file.
# <pic0.png> : The background image for the PSP menu. (PSP menu background): 480x272 pixels
# <pic1.png> : The background image for the settings screen. (Settings screen background): 480x272 pixels
# <snd0.at3> : The startup sound file.
# <data.psp> : The main executable file (EBOOT.BIN).
# <data.psar> : An optional data file in PSAR format.
# pack-pbp <output.pbp> <param.sfo> <icon0.png> <icon1.pmf> <pic0.png> <pic1.png> <snd0.at3> <data.psp> <data.psar>
# <output.pbp>: The desired name for your PBP file.
# <param.sfo> : The PARAM.SFO file containing metadata about your application.
# <icon0.png> : The icon image that represents your application on the PSP menu.
# <icon1.pmf> : The 44x44 pixel image file.
# <pic0.png> : The background image for the PSP menu. (PSP menu background): 480x272 pixels
# <pic1.png> : The background image for the settings screen. (Settings screen background): 480x272 pixels
# <snd0.at3> : The startup sound file.
# <data.psp> : The main executable file (EBOOT.BIN).
# <data.psar> : An optional data file in PSAR format.
echo 4. Generating EBOOT.PBP
pack-pbp EBOOT.PBP PARAM.SFO ICON0.PNG ICON1.PNG PIC0.PNG PIC1.PNG SND0.AT3 paintown-psp.elf NULL && echo "OK" || echo "Error"
echo 2. Generating EBOOT.PBP
pack-pbp EBOOT.PBP PARAM.SFO ICON0.PNG ICON1.PNG PIC0.PNG PIC1.PNG SND0.AT3 EBOOT.ELF NULL && echo "OK" || echo "Error"
chown $(id -u):$(id -g) EBOOT.PBP EBOOT.PRX
chown $(id -u):$(id -g) EBOOT.PBP
ls -lh EBOOT.PBP
fi
ls -lh EBOOT.PBP
ls -lh EBOOT.PRX
EOF

tree

# Move to root
mv EBOOT.PRX $EXEDIR/paintown-psp-$APPVERSION.prx
mv EBOOT.PBP $EXEDIR/paintown-psp-$APPVERSION.pbp
# Move outside the contiainer
if [[ "$PRX" == "true" ]]; then
mv EBOOT.PRX $EXEDIR/paintown-psp-$APPVERSION.prx
else
mv EBOOT.PBP $EXEDIR/paintown-psp-$APPVERSION.pbp
fi

0 comments on commit 6afc812

Please sign in to comment.