SDL: PSP: don't block on joystick event query

From 86f223d66426ad1a42db156d1f1d155ad987959b Mon Sep 17 00:00:00 2001
From: rofl0r <[EMAIL REDACTED]>
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.
---
 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 11e6acc183f9a..fc4c56e6f28b0 100644
--- a/src/joystick/psp/SDL_sysjoystick.c
+++ b/src/joystick/psp/SDL_sysjoystick.c
@@ -210,7 +210,7 @@ static void PSP_JoystickUpdate(SDL_Joystick *joystick)
     static enum PspCtrlButtons old_buttons = 0;
     static unsigned char old_x = 0, old_y = 0;
 
-    sceCtrlReadBufferPositive(&pad, 1);
+    if(sceCtrlPeekBufferPositive(&pad, 1) <= 0) return;
     buttons = pad.Buttons;
     x = pad.Lx;
     y = pad.Ly;