Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build PSP #93

Open
wants to merge 95 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
ab2f8e9
[wip] add psp build
humbertodias Feb 20, 2024
97e5e28
Add build badge for PSP
humbertodias Feb 21, 2024
b5d20d6
build ps3 using paintown as default
humbertodias Feb 21, 2024
79e4751
optional meson SDL_gfx and yaml-cpp
humbertodias Feb 21, 2024
54124ed
skiping yaml-cpp/SDL_gfx for psp
humbertodias Feb 21, 2024
299324e
add parameter have_pic "Position-Independent Code (PIC)" if is not a …
humbertodias Feb 21, 2024
cb4fb58
forcing BLARGG_BIG_ENDIAN=1
humbertodias Feb 21, 2024
fc7852c
-DMINPSPW=1
humbertodias Feb 21, 2024
e0f5bcb
No endian specified; assume little-endian, since it's most common
humbertodias Feb 21, 2024
e59c9be
flag have_pic for r-tech1
humbertodias Feb 21, 2024
2b93d21
add include sdl and freetype2
humbertodias Feb 21, 2024
8eba9ac
typo
humbertodias Feb 21, 2024
0bd8a5f
DEPRECATION: "pkgconfig" entry is deprecated and should be replaced b…
humbertodias Feb 21, 2024
4fb3f4d
defining dumb_off_t as 64 bytes
humbertodias Feb 21, 2024
d85109e
mpg123 is optional
humbertodias Feb 22, 2024
09f30be
add pic compilation flag dynamically
humbertodias Feb 22, 2024
9d5abdf
default docker build platform as linux/amd64
humbertodias Feb 22, 2024
43f7738
ambiguous overload for ‘operator<<’ (operand types are ‘Token’ and ‘c…
humbertodias Feb 22, 2024
c803080
Revert "ambiguous overload for ‘operator<<’ (operand types are ‘Token…
humbertodias Feb 22, 2024
4bd6679
add psp info on README
humbertodias Feb 22, 2024
152fb23
Do not include ghc filesystem for wii and other systems.
humbertodias Feb 22, 2024
07d586c
Fix more link errors.
humbertodias Feb 22, 2024
659fe81
Ensure <regex> is included.
Feb 21, 2024
99e18da
ambiguous overload for ‘operator<<’ (operand types are ‘Token’ and ‘c…
humbertodias Feb 22, 2024
252c92b
sbrk is deprecated replacing for malloc instead
humbertodias Feb 22, 2024
8793a3c
siginfo_t from signal.h cannot be used outside
humbertodias Feb 22, 2024
49520e4
replacing strdup for string that automatically handles memory allocat…
humbertodias Feb 22, 2024
cb11bd6
create a non-const copy of the string
humbertodias Feb 22, 2024
78d6a64
using pspdev image
humbertodias Feb 22, 2024
70721b0
PSP_HEAP_SIZE_MAX - call it inside the main
humbertodias Feb 22, 2024
ed0e17e
typedef Uint32 (*SDL_TimerCallback)(Uint32 interval, void *param)
humbertodias Feb 22, 2024
567f1ae
add SDL2_gfx
humbertodias Feb 22, 2024
47155ba
add -latomic
humbertodias Feb 22, 2024
bcf5e10
copy paintown to root as paintown-psp.elf
humbertodias Feb 22, 2024
4d5b137
constants on psp-cross
humbertodias Feb 22, 2024
6c26b9d
reading elf and show symbols
humbertodias Feb 22, 2024
7183c7c
clean psp tmp files
humbertodias Feb 22, 2024
85c289d
add prx
humbertodias Feb 22, 2024
0111740
xenon and mips supports int type
humbertodias Feb 22, 2024
f07f25e
define DUMB_OFF_T_CUSTOM for mips
humbertodias Feb 22, 2024
95ec896
add XTest
humbertodias Feb 22, 2024
366e43c
add xtest.sh
humbertodias Feb 22, 2024
8af2980
add pulseaudio
humbertodias Feb 22, 2024
106dbc6
add alsa-utils
humbertodias Feb 22, 2024
811cbd9
x-test no sound or music
humbertodias Feb 22, 2024
20ef7fc
add mesa-utils
humbertodias Feb 22, 2024
ba74064
Revert "add mesa-utils"
humbertodias Feb 22, 2024
1b8a2b3
setting DISPLAY=:1
humbertodias Feb 22, 2024
fe41611
add alsa-utils
humbertodias Feb 22, 2024
fb90003
load ALSA loopback module
humbertodias Feb 22, 2024
8d1ebd8
add snd-dummy
humbertodias Feb 22, 2024
493b1a8
install snd-aloop
humbertodias Feb 22, 2024
a3ce39d
add linux-modules-extra
humbertodias Feb 22, 2024
3597bad
removing x-test from ci
humbertodias Feb 22, 2024
5f9a564
alias timeout for gtimeout on macos
humbertodias Feb 22, 2024
a103d6a
add psp-packer
humbertodias Feb 22, 2024
8edd6da
Fixing up import tables post-linking to remove unused functions from …
humbertodias Feb 22, 2024
e133dc7
Merge branch 'master' into build-psp
humbertodias Feb 23, 2024
881768f
semantic rename
humbertodias Feb 23, 2024
a8b7b61
move cross compiler file to misc/psp
humbertodias Feb 23, 2024
b74e823
add scaffold for file-system+system
humbertodias Feb 23, 2024
d74328f
make psp-docker
humbertodias Feb 23, 2024
d295c0c
replace long define for CROSS_BUILD
humbertodias Feb 23, 2024
470a0bc
initial implementation of fs/system
humbertodias Feb 23, 2024
0f4e8c5
speed up compilation
humbertodias Feb 24, 2024
61aa72c
stop the flow when compilation fails
humbertodias Feb 24, 2024
9e42e39
compile and print OK or ERROR and abort
humbertodias Feb 24, 2024
6032899
get files supporting regex
humbertodias Feb 24, 2024
ee45ee4
remove psp-packer
humbertodias Feb 24, 2024
e07cf81
add Globber
humbertodias Feb 24, 2024
e83687c
semantic rename
humbertodias Feb 26, 2024
de901e6
Merge branch 'master' into build-psp
humbertodias Feb 29, 2024
2d04ec7
typo
humbertodias Feb 29, 2024
20158d9
setting DATA_PATH for cross-platform and native builds
humbertodias Feb 29, 2024
b7330a7
avoiding redefinition of DATA_PATH
humbertodias Feb 29, 2024
cabb995
DATA_PATH for psp
humbertodias Feb 29, 2024
64c6c45
add sdl2-sample
humbertodias Feb 29, 2024
656c72f
add -DDEBUG
humbertodias Feb 29, 2024
7196c48
move setup+compile psp inside docker
humbertodias Mar 2, 2024
03ddc54
enable debug for psp
humbertodias Mar 2, 2024
b8558d5
-DDATA_PATH="data"
humbertodias Mar 2, 2024
2098e1e
add missing file
humbertodias Mar 2, 2024
589781b
Merge branch 'master' into build-psp
humbertodias Mar 2, 2024
612c579
remove unused code
humbertodias Mar 2, 2024
cb6aed2
make an elf file in the box, then move it out
humbertodias Mar 2, 2024
15f5fc8
add file not found on log
humbertodias Mar 2, 2024
6e8be3e
Revert "add file not found on log"
humbertodias Mar 2, 2024
95b7162
DATA_PATH=ms0:/PSP/GAME/paintown/data
humbertodias Mar 2, 2024
f22f504
add prx
humbertodias Mar 2, 2024
6afc812
parameter PRX=true/false
humbertodias Mar 2, 2024
2ad6a0c
always fixing up import tables
humbertodias Mar 2, 2024
6ffa116
[psp] add yaml-cpp
humbertodias Mar 2, 2024
da3bd81
unused
humbertodias Mar 2, 2024
1e9e67f
deploy .prx or .pbp
humbertodias Mar 3, 2024
4b5cce5
Merge branch 'master' into build-psp
humbertodias Mar 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: linux ubuntu build

on:
push
on: push

jobs:
build:
Expand All @@ -15,7 +14,7 @@ jobs:
run: |
sudo apt update
./easy-compile-ubuntu

- name: Run Release
if: startsWith(github.ref, 'refs/tags/')
run: ./release/release-ubuntu
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/compile-psp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: psp build

on:
push

jobs:
build:
name: Compile
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Run build
run: ./easy-compile-docker-psp

- name: Run Release
if: startsWith(github.ref, 'refs/tags/')
run: ./release/release-psp

- name: Archive Folder
uses: actions/upload-artifact@v4
with:
name: artifact
path: |
${{github.workspace}}/*.pbp
${{github.workspace}}/*.prx

publish-release:
needs: build
runs-on: ubuntu-latest

steps:
- name: Download Artifact
uses: actions/download-artifact@v4
if: startsWith(github.ref, 'refs/tags/')
with:
name: artifact
path: ${{github.workspace}}

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{ github.workspace }}/*.pbp
${{ github.workspace }}/*.prx
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
build
build-debug
build-psp
mingw-bin
/paintown
.scon*
Expand All @@ -17,3 +18,8 @@ peg_*.py
*.dmg.sparseimage
*.deb
.idea


*.pbp
*.prx
*.elf
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +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 -prx $(PRX) && \
./release/release-psp -prx $(PRX)

clean:
rm -rf build-debug build-release build-mingw
rm -rf .tmp build build-*
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Paintown is a 2-d fighting game that is similar in style to Streets of Rage. Pai
![Mac Arm Build](https://github.com/kazzmir/paintown/actions/workflows/compile-mac-arm.yml/badge.svg)
![Mingw Cross-Compile Build](https://github.com/kazzmir/paintown/actions/workflows/mingw-cross.yml/badge.svg)
![Devkitpro Cross-Compile Build](https://github.com/kazzmir/paintown/actions/workflows/compile-dkp.yml/badge.svg)
![PSP Cross-Compile Build](https://github.com/kazzmir/paintown/actions/workflows/compile-psp.yml/badge.svg)
![Steam Cross-Compile Build](https://github.com/kazzmir/paintown/actions/workflows/compile-steam.yml/badge.svg)

## Releases
Expand All @@ -44,6 +45,7 @@ You need the following things to compile Paintown:
* *Note that you will need to have c++11 support*
* Software construction tools
* [Meson](https://mesonbuild.com/)
* [Docker](http://docker.com)
* [zlib](http://www.zlib.net/)
* [libpng](http://www.libpng.org/pub/png/libpng.html)
* [SDL2](https://github.com/libsdl-org/SDL/tree/SDL2)
Expand Down Expand Up @@ -92,11 +94,14 @@ $ ./easy-compile-mingw
`
$ ./easy-compile-fedora
`

### Mac Arm
`
$ ./easy-compile-mac-arm
`
### PSP
```shell
./easy-compile-docker-psp
```

## Scripting

Expand Down
Binary file added data/sprites/paintown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions docker/Dockerfile.psp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM pspdev/pspdev

# build : DOCKER_DEFAULT_PLATFORM=linux/amd64 docker build -t paintown-psp-build -f Dockerfile.psp .
# shell : DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm -itv${PWD}:/paintown-bin -w /paintown-bin paintown-psp-build bash

ENV PSPSDK $PSPDEV/psp
ENV PATH $PATH:$PSPDEV/bin:$PSPSDK/bin

RUN apk add meson build-base bash git autoconf automake python3 py3-pip cmake pkgconfig libarchive-dev openssl-dev gpgme-dev libtool curl-dev
RUN psp-pacman -Sy && echo y | psp-pacman -Syu yaml-cpp
59 changes: 59 additions & 0 deletions easy-compile-docker-psp
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash -e

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 ${BUILD_DIR}/mips32-eabi-psp.txt ${BUILD_DIR}

# compile
(cd ${BUILD_DIR}; meson configure -Dbuild_tests=false)
meson compile -C ${BUILD_DIR} || { echo "Compilation ERROR"; exit 1; }

# copy
chown $(id -u):$(id -g) ${BUILD_DIR}/paintown
cp ${BUILD_DIR}/paintown ${EXE}
psp-readelf -S ${EXE}
EOF

echo "
To run you will need a CFW [custom firmware] or system that can boot unsigned applications
"
ls -l ${EXE}
file ${EXE}
echo "Here is the executable ${EXE}. To run you need to package as a pbp file"

1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ sdl_graphics_dependency = []
sdl_graphics_library = []
yaml_cpp_dependency = []
yaml_cpp_library = []
have_pic = not meson.is_cross_build()
other_dependencies = []

# Not supported in mingw
Expand Down
6 changes: 6 additions & 0 deletions misc/psp-environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

echo "
Isn't necessary to install any dependency.
Because docker image pspdev/pspdev already contains: SDL2,SDL2_image,SDL2_mixer,SDL2_image,SDL2_gfx,yaml-cpp
"
Binary file added misc/psp/ICON0.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added misc/psp/ICON1.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added misc/psp/PIC0.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added misc/psp/PIC1.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added misc/psp/SND0.AT3
Binary file not shown.
43 changes: 43 additions & 0 deletions misc/psp/mips32-eabi-psp.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[constants]
psp_root = '/usr/local/pspdev'
psp_sdk_root = psp_root / 'psp/sdk'
common_args = ['-I' + psp_root / 'include'
, '-I' + psp_sdk_root / '/include'
, '-I' + psp_root / 'psp/include'
, '-I' + psp_root / 'include/freetype2'
, '-I' + psp_root / 'include/SDL'
, '-I' + psp_sdk_root / 'include'
, '-DDEBUG'
, '-DMINPSPW'
, '-DHAVE_YAML_CPP'
, '-DDATA_PATH="ms0:/PSP/GAME/paintown/data"'
, '-D_PSP_FW_VERSION=500'
, '-DINCLUDE_SCE_MODULE_INFO'
, '-L' + psp_root / 'sdk/lib'
, '-L' + psp_root / 'lib'
, '-L' + psp_sdk_root / 'lib'
, '-lSDL2_gfx'
, '-latomic'
, '-lpspdebug'
, '-lyaml-cpp'
, '-fno-rtti'
]
link_flags_prx = ['-specs=' + psp_root + '/psp/sdk/lib/prxspecs' , '-Wl,-q,-T' + psp_root + '/psp/sdk/lib/linkfile.prx']

[binaries]
c = 'psp-gcc'
cpp = 'psp-g++'
ar = 'psp-ar'
strip = 'psp-strip'
pkg-config = 'psp-pkgconf'
sdl2-config = psp_root / 'psp/bin/sdl2-config'

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

[host_machine]
system = 'psp'
cpu_family = 'mips'
cpu = 'mipsel'
endian = 'little'
96 changes: 96 additions & 0 deletions release/release-psp
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!/bin/bash -e

SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
EXEDIR="$SCRIPT_DIR/.."
EXE=paintown.pbp

APPVERSION_TAG=`git tag --sort=-committerdate | head -n 1`
APPVERSION_COMMIT=`git log --format=%h -n 1`

# Regular expression to match 'v' followed by a number version
TAG_VERSION_REGEX='^v[0-9]+\.[0-9]+'

# Check if the variable matches the regular expression
if [[ $APPVERSION_TAG =~ $TAG_VERSION_REGEX ]]; then
APPVERSION=$APPVERSION_TAG
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

# copy resources
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 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 EBOOT.ELF && echo "OK" || echo "Error"

if [[ '$PRX' == 'true' ]]; then

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

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.

echo 3. 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
ls -lh EBOOT.PBP

fi
EOF

tree

# 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
28 changes: 28 additions & 0 deletions runtime-test-nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# Check if running on macOS
if [[ "$(uname)" == "Darwin" ]]; then
# Check if gtimeout is available
if command -v gtimeout &> /dev/null; then
alias timeout="gtimeout"
else
echo "brew install coreutils"
fi
fi

# Another display
export DISPLAY=:1

# Setup xvfb for screen 0
Xvfb $DISPLAY -screen 0 800x600x24 &

# Test
timeout 3s ./paintown -s nosound -m nomusic --data `pwd`/data | tee paintown.log

# Check if the application started and terminated successfully based on the log
if grep -q "Set graphics mode: Ok" paintown.log && grep -q "Bye" paintown.log ; then
echo "Test passed"
else
echo "Test failed"
exit 1
fi
2 changes: 1 addition & 1 deletion src/main-menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* On consoles set it to -1 to disable all text output.
* If you are debugging then higher values like 1 or 2 are ok.
*/
#if defined(XENON) || defined(DEVKITPRO)
#if defined(XENON) || defined(DEVKITPRO) || defined(MINPSPW)
//static const int DEFAULT_DEBUG = -1;
static const int DEFAULT_DEBUG = 3;
#else
Expand Down
Loading
Loading