Ver Fonte

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.
rofl0r há 1 ano atrás
pai
commit
86f223d664
1 ficheiros alterados com 1 adições e 1 exclusões
  1. 1 1
      src/joystick/psp/SDL_sysjoystick.c

+ 1 - 1
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;