24 #include <pspkernel.h>
29 #include "../SDL_sysjoystick.h"
30 #include "../SDL_joystick_c.h"
34 #include "SDL_thread.h"
35 #include "SDL_mutex.h"
39 static SceCtrlData
pad = { .Lx = 0, .Ly = 0, .Buttons = 0 };
44 PSP_CTRL_TRIANGLE, PSP_CTRL_CIRCLE, PSP_CTRL_CROSS, PSP_CTRL_SQUARE,
45 PSP_CTRL_LTRIGGER, PSP_CTRL_RTRIGGER,
46 PSP_CTRL_DOWN, PSP_CTRL_LEFT, PSP_CTRL_UP, PSP_CTRL_RIGHT,
47 PSP_CTRL_SELECT, PSP_CTRL_START, PSP_CTRL_HOME, PSP_CTRL_HOLD };
57 static point
a = { 0, 0 };
58 static point
b = { 50, 0 };
59 static point
c = { 78, 32767 };
60 static point
d = { 128, 32767 };
65 dest->x = a->x + (b->x - a->x)*t;
66 dest->y = a->y + (b->y - a->y)*t;
72 point ab, bc, cd, abbc, bccd, dest;
76 lerp (&abbc, &ab, &bc, t);
77 lerp (&bccd, &bc, &cd, t);
78 lerp (&dest, &abbc, &bccd, t);
89 sceCtrlPeekBufferPositive(&
pad, 1);
92 sceKernelDelayThread(1000000 / 60);
111 sceCtrlSetSamplingCycle(0);
112 sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
125 for (i = 0; i < 128; i++)
127 float t = (float)i/127.0
f;
152 return "PSP builtin joypad";
165 return "PSP controller";
199 enum PspCtrlButtons buttons;
200 enum PspCtrlButtons changed;
202 static enum PspCtrlButtons old_buttons = 0;
203 static unsigned char old_x = 0, old_y = 0;
206 buttons =
pad.Buttons;
222 changed = old_buttons ^ buttons;
223 old_buttons = buttons;
235 sceKernelDelayThread(0);
DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value)
struct SDL_semaphore SDL_sem
int SDL_SYS_NumJoysticks()
static __inline__ void lerp(point *dest, point *a, point *b, float t)
DECLSPEC int SDLCALL SDL_SemWait(SDL_sem *sem)
int SDL_PrivateJoystickButton(SDL_Joystick *joystick, Uint8 button, Uint8 state)
GLboolean GLboolean GLboolean GLboolean a
EGLImageKHR EGLint * name
void SDL_SYS_JoystickQuit(void)
int SDL_PrivateJoystickAxis(SDL_Joystick *joystick, Uint8 axis, Sint16 value)
DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
static int calc_bezier_y(float t)
void SDL_SYS_JoystickDetect()
static int analog_map[256]
DECLSPEC int SDLCALL SDL_SetError(const char *fmt,...)
const char * SDL_SYS_JoystickNameForDeviceIndex(int device_index)
int JoystickUpdate(void *data)
void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick)
DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem)
DECLSPEC SDL_Thread *SDLCALL SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data)
SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick *joystick)
SDL_bool SDL_SYS_JoystickNeedsPolling()
DECLSPEC size_t SDLCALL SDL_strlen(const char *str)
int SDL_SYS_JoystickInit(void)
static SDL_Thread * thread
static enum PspCtrlButtons button_map[]
EGLSurface EGLint EGLint y
const char * SDL_SYS_JoystickName(int index)
DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src, size_t len)
SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
GLdouble GLdouble GLdouble b
int SDL_SYS_JoystickOpen(SDL_Joystick *joystick, int device_index)
void SDL_SYS_JoystickClose(SDL_Joystick *joystick)
DECLSPEC int SDLCALL SDL_SemPost(SDL_sem *sem)
SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID(int device_index)