From 3011504dd5d006b9004232f7439e68aeeb8edcf7 Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 28 Jan 2019 13:20:28 +0800 Subject: +sdl freetype --- Source/3rdParty/SDL2/src/video/psp/SDL_pspevents.c | 290 +++++++++++++++++++++ 1 file changed, 290 insertions(+) create mode 100644 Source/3rdParty/SDL2/src/video/psp/SDL_pspevents.c (limited to 'Source/3rdParty/SDL2/src/video/psp/SDL_pspevents.c') diff --git a/Source/3rdParty/SDL2/src/video/psp/SDL_pspevents.c b/Source/3rdParty/SDL2/src/video/psp/SDL_pspevents.c new file mode 100644 index 0000000..14277b3 --- /dev/null +++ b/Source/3rdParty/SDL2/src/video/psp/SDL_pspevents.c @@ -0,0 +1,290 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_PSP + +/* Being a null driver, there's no event stream. We just define stubs for + most of the API. */ + +#include "SDL.h" +#include "../../events/SDL_sysevents.h" +#include "../../events/SDL_events_c.h" +#include "../../events/SDL_keyboard_c.h" +#include "SDL_pspvideo.h" +#include "SDL_pspevents_c.h" +#include "SDL_keyboard.h" +#include "../../thread/SDL_systhread.h" +#include + +#ifdef PSPIRKEYB +#include +#include + +#define IRKBD_CONFIG_FILE NULL /* this will take ms0:/seplugins/pspirkeyb.ini */ + +static int irkbd_ready = 0; +static SDL_Keycode keymap[256]; +#endif + +static enum PspHprmKeys hprm = 0; +static SDL_sem *event_sem = NULL; +static SDL_Thread *thread = NULL; +static int running = 0; +static struct { + enum PspHprmKeys id; + SDL_Keycode sym; +} keymap_psp[] = { + { PSP_HPRM_PLAYPAUSE, SDLK_F10 }, + { PSP_HPRM_FORWARD, SDLK_F11 }, + { PSP_HPRM_BACK, SDLK_F12 }, + { PSP_HPRM_VOL_UP, SDLK_F13 }, + { PSP_HPRM_VOL_DOWN, SDLK_F14 }, + { PSP_HPRM_HOLD, SDLK_F15 } +}; + +int EventUpdate(void *data) +{ + while (running) { + SDL_SemWait(event_sem); + sceHprmPeekCurrentKey(&hprm); + SDL_SemPost(event_sem); + /* Delay 1/60th of a second */ + sceKernelDelayThread(1000000 / 60); + } + return 0; +} + +void PSP_PumpEvents(_THIS) +{ + int i; + enum PspHprmKeys keys; + enum PspHprmKeys changed; + static enum PspHprmKeys old_keys = 0; + SDL_Keysym sym; + + SDL_SemWait(event_sem); + keys = hprm; + SDL_SemPost(event_sem); + + /* HPRM Keyboard */ + changed = old_keys ^ keys; + old_keys = keys; + if(changed) { + for(i=0; i= 0) { + if((length % sizeof(SIrKeybScanCodeData)) == 0){ + count = length / sizeof(SIrKeybScanCodeData); + for( i=0; i < count; i++ ) { + unsigned char raw, pressed; + scanData=(SIrKeybScanCodeData*) buffer+i; + raw = scanData->raw; + pressed = scanData->pressed; + sym.scancode = raw; + sym.sym = keymap[raw]; + /* not tested */ + /* SDL_PrivateKeyboard(pressed?SDL_PRESSED:SDL_RELEASED, &sym); */ + SDL_SendKeyboardKey((keys & keymap_psp[i].id) ? + SDL_PRESSED : SDL_RELEASED, SDL_GetScancodeFromKey(keymap[raw])); + + } + } + } + } +#endif + sceKernelDelayThread(0); + + return; +} + +void PSP_InitOSKeymap(_THIS) +{ +#ifdef PSPIRKEYB + int i; + for (i=0; i