From 7169db1e62a1d0c2bc155d85ee44cc1bd52bb37f Mon Sep 17 00:00:00 2001 From: rofl0r Date: Sun, 17 Mar 2024 20:15:53 +0100 Subject: [PATCH] PSP: don't block on joystick event query using the blocking sceCtrlReadBufferPositive() effectively turns SDL_PollEvent() into WaitForVblank(), because the functions does exactly that if no input is buffered. due to this, calling SDL_PollEvent() once per frame averaged in 7 ms delay out of the available 16ms budget to get a frame calculated and drawn to achieve 60 fps. (cherry picked from commit 86f223d66426ad1a42db156d1f1d155ad987959b) --- src/joystick/psp/SDL_sysjoystick.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/joystick/psp/SDL_sysjoystick.c b/src/joystick/psp/SDL_sysjoystick.c index 31cbb8a712..c8cf85614b 100644 --- a/src/joystick/psp/SDL_sysjoystick.c +++ b/src/joystick/psp/SDL_sysjoystick.c @@ -209,7 +209,7 @@ static void PSP_JoystickUpdate(SDL_Joystick *joystick) static unsigned char old_x = 0, old_y = 0; Uint64 timestamp = SDL_GetTicksNS(); - sceCtrlReadBufferPositive(&pad, 1); + if(sceCtrlPeekBufferPositive(&pad, 1) <= 0) return; buttons = pad.Buttons; x = pad.Lx; y = pad.Ly;