aboutsummaryrefslogtreecommitdiff
path: root/port
diff options
context:
space:
mode:
authorNicholas Rodrigues Lordello <[email protected]>2026-10-30 13:16:18 +0100
committerNicholas Rodrigues Lordello <[email protected]>2026-10-30 13:16:18 +0100
commita64aa9dfa8abd7934f7969eaa2ee1086d4189eeb (patch)
tree213a19870aa851510efd0349298d825f6bb6efa0 /port
parent4bfe4900b80c17702d9e2c02b1740c790537d5bd (diff)
Fix Build for PS Vita Port
I forgot to commit the makefile configuration, and also added some other small improvements to help with the poor performance (still only around 20 FPS).
Diffstat (limited to 'port')
-rw-r--r--port/vita/config.mk5
-rw-r--r--port/vita/rules.mk12
-rw-r--r--port/vita/src/vita.c12
3 files changed, 29 insertions, 0 deletions
diff --git a/port/vita/config.mk b/port/vita/config.mk
new file mode 100644
index 0000000..3cb4d20
--- /dev/null
+++ b/port/vita/config.mk
@@ -0,0 +1,5 @@
+CC := arm-vita-eabi-gcc
+
+PKGCONFIG := arm-vita-eabi-pkg-config
+ARCH := arm32
+LDFLAGS := $(shell $(PKGCONFIG) sdl3 --static --libs) -lm
diff --git a/port/vita/rules.mk b/port/vita/rules.mk
index 6ac47c7..a914195 100644
--- a/port/vita/rules.mk
+++ b/port/vita/rules.mk
@@ -1,6 +1,18 @@
TITLE := picow
TITLEID := PICO00008
+# Some magic flags:
+# - `-mcpu=cortext-a9`: specifically target the PS Vita CPU which may
+# help with some optimizations (instead of generic `armv7`).
+# - `-Wl,-q`: make the ELF file relocatable which is required for the
+# executable to run (otherwise it crashes on startup).
+# - `-Wl,--defsym=__sce_headroom=0x10000`: add some extra space for
+# the code segment, otherwise linking fails sporadically.
+# - `-lScePower_stub`: link in the power management library to allow us
+# to overclock the PS Vita for performance
+CFLAGS += -mcpu=cortex-a9
+LDFLAGS += -Wl,-q -Wl,--defsym=__sce_headroom=0x10000 -lScePower_stub
+
port: $(TARGET)/picow.vpk
$(TARGET)/picow.vpk: $(TARGET)/eboot.bin $(TARGET)/param.sfo
diff --git a/port/vita/src/vita.c b/port/vita/src/vita.c
index bc5ca60..0f4814b 100644
--- a/port/vita/src/vita.c
+++ b/port/vita/src/vita.c
@@ -1,4 +1,16 @@
+#include <psp2/power.h>
+
// By default the VitaSDK only allocates a small stack for the main thread
// which is not enough for the PICO-8 engine. Specify a larter stack, 1 MiB
// should be more than enough, and we can grow it if needed.
unsigned int sceUserMainThreadStackSize = 1024 * 1024;
+
+// The Vita runs applications at 333 MHz by default, bump up our clock
+// speed to get some more performance. Failing to change the clocks isn't
+// fatal, we just runs slower.
+__attribute__((constructor)) static void vita_set_clocks(void) {
+ scePowerSetArmClockFrequency(444);
+ scePowerSetBusClockFrequency(222);
+ scePowerSetGpuClockFrequency(222);
+ scePowerSetGpuXbarClockFrequency(166);
+}