From 57cbd944694957e361a169f2ac2393c4d40aeede Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 6 Feb 2024 11:52:14 +1100 Subject: [PATCH] PSP: Fix launcher not displaying and fix game usually crashing after several seconds (Thanks Zekiu, fixes #1144 and fixes #1145) --- readme.md | 6 +++--- src/Platform_PSP.c | 5 +++++ src/Window_PSP.c | 3 ++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index d9ed92a13..1f0f6b51a 100644 --- a/readme.md +++ b/readme.md @@ -76,10 +76,10 @@ And also runs on: * Wii - unfinished, but usable (can [download from here](https://www.classicube.net/download/wii)) * GameCube - unfinished, but usable (can [download from here](https://www.classicube.net/download/gamecube)) * Dreamcast - unfinished, but renders (can [download from here](https://www.classicube.net/download/dreamcast)) -* PSP - unfinished, rendering issues (can [download from here](https://www.classicube.net/download/psp), **untested on real hardware**) -* PS Vita - unfinished, rendering issues (can [download from here](https://www.classicube.net/download/vita), **untested on real hardware**) +* PSP - unfinished, rendering issues (can [download from here](https://www.classicube.net/download/psp)) +* PS Vita - unfinished, rendering issues (can [download from here](https://www.classicube.net/download/vita)) * Xbox - unfinished, major rendering issues (can [download from here](https://www.classicube.net/download/xbox), **untested on real hardware**) -* PS3 - unfinished, rendering issues (can [download from here](https://www.classicube.net/download/ps3), **untested on real hardware**) +* PS3 - unfinished, rendering issues (can [download from here](https://www.classicube.net/download/ps3), **usually outdated**) * Nintendo 64 - unfinished, moderate rendering issues * PS2 - unfinished, major rendering and stability issues diff --git a/src/Platform_PSP.c b/src/Platform_PSP.c index bd6b7139d..60578405f 100644 --- a/src/Platform_PSP.c +++ b/src/Platform_PSP.c @@ -398,6 +398,11 @@ cc_result Socket_CheckWritable(cc_socket s, cc_bool* writable) { *#########################################################################################################################*/ void Platform_Init(void) { /*pspDebugSioInit();*/ + + // Disabling FPU exceptions avoids sometimes crashing with this line in Physics.c + // *tx = vel->x == 0.0f ? MATH_LARGENUM : Math_AbsF(dx / vel->x); + // TODO: work out why this error is actually happening (inexact or underflow?) and properly fix it + pspSdkDisableFPUExceptions(); } void Platform_Free(void) { } diff --git a/src/Window_PSP.c b/src/Window_PSP.c index 33408a08d..84f78cb86 100644 --- a/src/Window_PSP.c +++ b/src/Window_PSP.c @@ -13,6 +13,7 @@ #include #include #include +#include #define BUFFER_WIDTH 512 #define SCREEN_WIDTH 480 @@ -124,7 +125,7 @@ void Window_DrawFramebuffer(Rect2D r, struct Bitmap* bmp) { void* fb = sceGeEdramGetAddr(); sceDisplayWaitVblankStart(); - sceDisplaySetFrameBuf(fb, BUFFER_WIDTH, PSP_DISPLAY_PIXEL_FORMAT_8888, PSP_DISPLAY_SETBUF_IMMEDIATE); + sceDisplaySetFrameBuf(fb, BUFFER_WIDTH, PSP_DISPLAY_PIXEL_FORMAT_8888, PSP_DISPLAY_SETBUF_NEXTBUF); cc_uint32* src = (cc_uint32*)bmp->scan0 + r.x; cc_uint32* dst = (cc_uint32*)fb + r.x;