Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 5 additions & 2 deletions .github/platform-builds.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,15 @@
"port_dir": "ps2",
"backend": "SDL2",
"build_system": "Makefile",
"ci": false,
"runs_on": "ubuntu-22.04",
"build_command": "sh ./ps2/ci-docker-run.sh sh -c \"sh ./ps2/ci-prepare.sh && sh ./ps2/ci-build.sh\"",
"artifact_name": "ps2-build",
"artifact_path": "ps2/OpenSupaplex-ps2.zip",
"release": false
},
{
"id": "ps3",
"name": "PS3",
"name": "PlayStation 3",
"port_dir": "ps3",
"backend": "SDL2",
"build_system": "Makefile",
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ ps3/*.elf
ps3/*.pkg
ps3/*.map

# PS2 stuff
ps2/*.elf

# WASM stuff
wasm/opensupaplex.data
wasm/opensupaplex.html
Expand All @@ -77,3 +80,5 @@ riscos/\!OSupaplex/*,ff8
riscos/\!OSupaplex/audio
riscos/\!OSupaplex/data

/ps2/OpenSupaplex
ps2/OpenSupaplex-ps2.zip
4 changes: 2 additions & 2 deletions PLATFORM_SUPPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ This document is generated from `.github/platform-builds.json`.
| Linux | SDL2 | Makefile | `linux` | Yes | Yes |
| PS Vita | SDL2 | CMake | `vita` | Yes | Yes |
| PSP | SDL1 | Makefile | `psp` | Yes | Yes |
| PlayStation 2 | SDL2 | Makefile | `ps2` | No | No |
| PS3 | SDL2 | Makefile | `ps3` | Yes | Yes |
| PlayStation 2 | SDL2 | Makefile | `ps2` | Yes | No |
| PlayStation 3 | SDL2 | Makefile | `ps3` | Yes | Yes |
| Nintendo DS | SDL1 | Makefile | `nds` | Yes | Yes |
| Nintendo 3DS | SDL1 | Makefile | `3ds` | Yes | Yes |
| Wii | SDL1 | Makefile | `wii` | Yes | Yes |
Expand Down
8 changes: 8 additions & 0 deletions ci/Dockerfile-ps2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM ps2dev/ps2dev:latest

MAINTAINER Sergio Padrino (@sergiou87)

RUN apk add --no-cache make zip gmp mpfr4 mpc1

WORKDIR /src
CMD ["/bin/sh"]
17 changes: 11 additions & 6 deletions ps2/Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
DEBUG = 0

TARGET = OpenSupaplex-debug.elf
TARGET = OpenSupaplex.elf
TARGET_DEBUG = OpenSupaplex-debug.elf
TARGET_RELEASE = OpenSupaplex.elf

ifeq ($(DEBUG), 1)
TARGET := $(TARGET_DEBUG)
OPTIMIZE_LV := -O0 -g
RARCH_DEFINES += -DDEBUG
else
TARGET := $(TARGET_RELEASE)
OPTIMIZE_LV := -O3
LDFLAGS := -s
endif

INCDIR = -I$(PS2DEV)/gsKit/include -I$(PS2SDK)/ports/include
INCDIR = -I$(PS2DEV)/gsKit/include -I$(PS2SDK)/ports/include -I$(PS2SDK)/ports/include/SDL2
CFLAGS = $(OPTIMIZE_LV) -ffast-math -fsingle-precision-constant
ASFLAGS = $(CFLAGS)

CFLAGS += -D__PS2__ -Dmain=SDL_main -DHAVE_SDL2

LDFLAGS += -L$(PS2DEV)/gsKit/lib -L$(PS2SDK)/ports/lib -L.
LIBS += -lSDL2main -lSDL2 -lSDL2_mixer -lpatches -lgskit -ldmakit -lps2_drivers -lxmp -lmodplug
LIBS += -lSDL2main -lSDL2 -lSDL2_mixer -lpatches -lmodplug -lxmp -lgskit -ldmakit -lps2_drivers -lstdc++ -lm -lc

SRC = $(wildcard ../src/*.c) $(wildcard ../src/sdl_common/*.c) $(wildcard ../src/sdl2/*.c) ../src/null/virtualKeyboard.c ../src/lib/ini/ini.c
EXCLUDE = ../src/sdl1/video.c
Expand All @@ -38,11 +41,13 @@ EE_GPVAL = $(GPVAL)
all: $(EE_BIN)

clean:
rm -f $(EE_BIN) $(EE_OBJS)
rm -f $(TARGET_DEBUG) $(TARGET_RELEASE) $(TARGET_RELEASE).packed $(EE_OBJS)

release: all
ps2-packer $(EE_BIN) $(TARGET_RELEASE)
rm -f $(TARGET_RELEASE).packed
ps2-packer $(EE_BIN) $(TARGET_RELEASE).packed
mv $(TARGET_RELEASE).packed $(TARGET_RELEASE)

#Include preferences
include $(PS2SDK)/samples/Makefile.pref
include $(PS2SDK)/samples/Makefile.eeglobal_cpp
include $(PS2SDK)/samples/Makefile.eeglobal
16 changes: 13 additions & 3 deletions ps2/ci-build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
#!/bin/bash
#!/bin/sh

set -euo pipefail
set -eu

cd "$(dirname "$0")"

bundle_dir=OpenSupaplex

make clean
make -j8 release
make -j8

rm -rf "$bundle_dir" OpenSupaplex-ps2.zip
mkdir "$bundle_dir"
cp OpenSupaplex.elf "$bundle_dir"/
cp -R ../resources/* "$bundle_dir"/

zip -r OpenSupaplex-ps2.zip "$bundle_dir"
10 changes: 10 additions & 0 deletions ps2/ci-docker-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

repo_root=$(cd "$(dirname "$0")/.." && pwd)
image_name=sergiou87/ps2dev-docker-open-supaplex:7.2

if ! docker pull "$image_name"; then
docker build -f "$repo_root/ci/Dockerfile-ps2" -t "$image_name" "$repo_root/ci"
fi

docker run --rm -v "$repo_root":/src -w /src "$image_name" "$@"
9 changes: 2 additions & 7 deletions ps2/ci-prepare.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
#!/bin/bash
#!/bin/sh

set -euo pipefail
set -eu

: "${PS2DEV:?PS2DEV must be set}"
: "${PS2SDK:?PS2SDK must be set}"

if ! command -v ps2-packer >/dev/null 2>&1; then
echo "ps2-packer not found in PATH" >&2
exit 1
fi

test -d "$PS2DEV/gsKit/include"
test -d "$PS2DEV/gsKit/lib"
test -d "$PS2SDK/ports/include"
Expand Down
10 changes: 10 additions & 0 deletions src/sdl2/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ void initializeVideo(uint8_t fastMode)
// Disable vsync in fast mode to prevent limiting FPS rate
if (fastMode == 0)
{
#ifdef __PS2__
SDL_SetHint(SDL_HINT_PS2_DYNAMIC_VSYNC, "1");
#endif
rendererFlags |= SDL_RENDERER_PRESENTVSYNC;
}

Expand All @@ -105,6 +108,9 @@ void initializeVideo(uint8_t fastMode)
#ifdef __PSP__
format = SDL_PIXELFORMAT_ABGR32;
#endif
#ifdef __PS2__
format = SDL_PIXELFORMAT_ABGR1555;
#endif

gTexture = SDL_CreateTexture(gRenderer,
format,
Expand All @@ -118,7 +124,11 @@ void initializeVideo(uint8_t fastMode)
exit(1);
}

#ifdef __PS2__
gTextureSurface = SDL_CreateRGBSurfaceWithFormat(0, kScreenWidth, kScreenHeight, 8, SDL_PIXELFORMAT_ABGR1555);
#else
gTextureSurface = SDL_CreateRGBSurfaceWithFormat(0, kScreenWidth, kScreenHeight, 8, SDL_PIXELFORMAT_RGB24);
#endif

if (gTextureSurface == NULL)
{
Expand Down
4 changes: 4 additions & 0 deletions src/supaplex.c
Original file line number Diff line number Diff line change
Expand Up @@ -1941,7 +1941,11 @@ void readConfig() // proc near ; CODE XREF: start:loc_46F0Fp
FILE *file = openWritableFile("SUPAPLEX.CFG", "rb");
if (file == NULL)
{
#ifdef __PS2__ // PS2 for now is not returning errno code properly
if (1) // ax == 2? ax has error code, 2 is file not found (http://stanislavs.org/helppc/dos_error_codes.html)
#else
if (errno == ENOENT || errno == ENOSYS || errno == EIO) // ax == 2? ax has error code, 2 is file not found (http://stanislavs.org/helppc/dos_error_codes.html)
#endif
{
// loc_47551: //; CODE XREF: readConfig+Fj
// ; readConfig+17j
Expand Down
Loading