diff options
| author | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
| commit | 5a079a2d114f96d4847d1ee305d5b7c16eeec50e (patch) | |
| tree | 8926ab44f168acf787d8e19608857b3af0f82758 /contrib/SDL-3.2.8/src/video/psp/SDL_pspvideo.c | |
Initial commit
Diffstat (limited to 'contrib/SDL-3.2.8/src/video/psp/SDL_pspvideo.c')
| -rw-r--r-- | contrib/SDL-3.2.8/src/video/psp/SDL_pspvideo.c | 499 |
1 files changed, 499 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/src/video/psp/SDL_pspvideo.c b/contrib/SDL-3.2.8/src/video/psp/SDL_pspvideo.c new file mode 100644 index 0000000..2458235 --- /dev/null +++ b/contrib/SDL-3.2.8/src/video/psp/SDL_pspvideo.c | |||
| @@ -0,0 +1,499 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "SDL_internal.h" | ||
| 23 | |||
| 24 | #ifdef SDL_VIDEO_DRIVER_PSP | ||
| 25 | |||
| 26 | // SDL internals | ||
| 27 | #include "../SDL_sysvideo.h" | ||
| 28 | #include "../../events/SDL_mouse_c.h" | ||
| 29 | #include "../../events/SDL_keyboard_c.h" | ||
| 30 | |||
| 31 | // PSP declarations | ||
| 32 | #include "SDL_pspvideo.h" | ||
| 33 | #include "SDL_pspevents_c.h" | ||
| 34 | #include "SDL_pspgl_c.h" | ||
| 35 | #include "../../render/psp/SDL_render_psp_c.h" | ||
| 36 | |||
| 37 | #include <psputility.h> | ||
| 38 | #include <pspgu.h> | ||
| 39 | #include <pspdisplay.h> | ||
| 40 | #include <vram.h> | ||
| 41 | |||
| 42 | /* unused | ||
| 43 | static bool PSP_initialized = false; | ||
| 44 | */ | ||
| 45 | |||
| 46 | static void PSP_Destroy(SDL_VideoDevice *device) | ||
| 47 | { | ||
| 48 | SDL_free(device->internal); | ||
| 49 | SDL_free(device); | ||
| 50 | } | ||
| 51 | |||
| 52 | static SDL_VideoDevice *PSP_Create(void) | ||
| 53 | { | ||
| 54 | SDL_VideoDevice *device; | ||
| 55 | SDL_VideoData *phdata; | ||
| 56 | SDL_GLDriverData *gldata; | ||
| 57 | |||
| 58 | // Initialize SDL_VideoDevice structure | ||
| 59 | device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); | ||
| 60 | if (!device) { | ||
| 61 | return NULL; | ||
| 62 | } | ||
| 63 | |||
| 64 | // Initialize internal PSP specific data | ||
| 65 | phdata = (SDL_VideoData *)SDL_calloc(1, sizeof(SDL_VideoData)); | ||
| 66 | if (!phdata) { | ||
| 67 | SDL_free(device); | ||
| 68 | return NULL; | ||
| 69 | } | ||
| 70 | |||
| 71 | gldata = (SDL_GLDriverData *)SDL_calloc(1, sizeof(SDL_GLDriverData)); | ||
| 72 | if (!gldata) { | ||
| 73 | SDL_free(device); | ||
| 74 | SDL_free(phdata); | ||
| 75 | return NULL; | ||
| 76 | } | ||
| 77 | device->gl_data = gldata; | ||
| 78 | |||
| 79 | device->internal = phdata; | ||
| 80 | |||
| 81 | phdata->egl_initialized = true; | ||
| 82 | |||
| 83 | // Setup amount of available displays | ||
| 84 | device->num_displays = 0; | ||
| 85 | |||
| 86 | // Set device free function | ||
| 87 | device->free = PSP_Destroy; | ||
| 88 | |||
| 89 | // Setup all functions which we can handle | ||
| 90 | device->VideoInit = PSP_VideoInit; | ||
| 91 | device->VideoQuit = PSP_VideoQuit; | ||
| 92 | device->GetDisplayModes = PSP_GetDisplayModes; | ||
| 93 | device->SetDisplayMode = PSP_SetDisplayMode; | ||
| 94 | device->CreateSDLWindow = PSP_CreateWindow; | ||
| 95 | device->SetWindowTitle = PSP_SetWindowTitle; | ||
| 96 | device->SetWindowPosition = PSP_SetWindowPosition; | ||
| 97 | device->SetWindowSize = PSP_SetWindowSize; | ||
| 98 | device->ShowWindow = PSP_ShowWindow; | ||
| 99 | device->HideWindow = PSP_HideWindow; | ||
| 100 | device->RaiseWindow = PSP_RaiseWindow; | ||
| 101 | device->MaximizeWindow = PSP_MaximizeWindow; | ||
| 102 | device->MinimizeWindow = PSP_MinimizeWindow; | ||
| 103 | device->RestoreWindow = PSP_RestoreWindow; | ||
| 104 | device->DestroyWindow = PSP_DestroyWindow; | ||
| 105 | device->GL_LoadLibrary = PSP_GL_LoadLibrary; | ||
| 106 | device->GL_GetProcAddress = PSP_GL_GetProcAddress; | ||
| 107 | device->GL_UnloadLibrary = PSP_GL_UnloadLibrary; | ||
| 108 | device->GL_CreateContext = PSP_GL_CreateContext; | ||
| 109 | device->GL_MakeCurrent = PSP_GL_MakeCurrent; | ||
| 110 | device->GL_SetSwapInterval = PSP_GL_SetSwapInterval; | ||
| 111 | device->GL_GetSwapInterval = PSP_GL_GetSwapInterval; | ||
| 112 | device->GL_SwapWindow = PSP_GL_SwapWindow; | ||
| 113 | device->GL_DestroyContext = PSP_GL_DestroyContext; | ||
| 114 | device->HasScreenKeyboardSupport = PSP_HasScreenKeyboardSupport; | ||
| 115 | device->ShowScreenKeyboard = PSP_ShowScreenKeyboard; | ||
| 116 | device->HideScreenKeyboard = PSP_HideScreenKeyboard; | ||
| 117 | device->IsScreenKeyboardShown = PSP_IsScreenKeyboardShown; | ||
| 118 | |||
| 119 | device->PumpEvents = PSP_PumpEvents; | ||
| 120 | |||
| 121 | return device; | ||
| 122 | } | ||
| 123 | |||
| 124 | static void configure_dialog(pspUtilityMsgDialogParams *dialog, size_t dialog_size) | ||
| 125 | { | ||
| 126 | // clear structure and setup size | ||
| 127 | SDL_memset(dialog, 0, dialog_size); | ||
| 128 | dialog->base.size = dialog_size; | ||
| 129 | |||
| 130 | // set language | ||
| 131 | sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_LANGUAGE, &dialog->base.language); | ||
| 132 | |||
| 133 | // set X/O swap | ||
| 134 | sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_UNKNOWN, &dialog->base.buttonSwap); | ||
| 135 | |||
| 136 | // set thread priorities | ||
| 137 | // TODO: understand how these work | ||
| 138 | dialog->base.soundThread = 0x10; | ||
| 139 | dialog->base.graphicsThread = 0x11; | ||
| 140 | dialog->base.fontThread = 0x12; | ||
| 141 | dialog->base.accessThread = 0x13; | ||
| 142 | } | ||
| 143 | |||
| 144 | static void *setup_temporal_gu(void *list) | ||
| 145 | { | ||
| 146 | // Using GU_PSM_8888 for the framebuffer | ||
| 147 | int bpp = 4; | ||
| 148 | |||
| 149 | void *doublebuffer = vramalloc(PSP_FRAME_BUFFER_SIZE * bpp * 2); | ||
| 150 | void *backbuffer = doublebuffer; | ||
| 151 | void *frontbuffer = ((uint8_t *)doublebuffer) + PSP_FRAME_BUFFER_SIZE * bpp; | ||
| 152 | |||
| 153 | sceGuInit(); | ||
| 154 | |||
| 155 | sceGuStart(GU_DIRECT,list); | ||
| 156 | sceGuDrawBuffer(GU_PSM_8888, vrelptr(frontbuffer), PSP_FRAME_BUFFER_WIDTH); | ||
| 157 | sceGuDispBuffer(PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT, vrelptr(backbuffer), PSP_FRAME_BUFFER_WIDTH); | ||
| 158 | |||
| 159 | sceGuOffset(2048 - (PSP_SCREEN_WIDTH >> 1), 2048 - (PSP_SCREEN_HEIGHT >> 1)); | ||
| 160 | sceGuViewport(2048, 2048, PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT); | ||
| 161 | |||
| 162 | sceGuDisable(GU_DEPTH_TEST); | ||
| 163 | |||
| 164 | // Scissoring | ||
| 165 | sceGuScissor(0, 0, PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT); | ||
| 166 | sceGuEnable(GU_SCISSOR_TEST); | ||
| 167 | |||
| 168 | sceGuFinish(); | ||
| 169 | sceGuSync(0,0); | ||
| 170 | |||
| 171 | sceDisplayWaitVblankStart(); | ||
| 172 | sceGuDisplay(GU_TRUE); | ||
| 173 | |||
| 174 | return doublebuffer; | ||
| 175 | } | ||
| 176 | |||
| 177 | static void term_temporal_gu(void *guBuffer) | ||
| 178 | { | ||
| 179 | sceGuTerm(); | ||
| 180 | vfree(guBuffer); | ||
| 181 | sceDisplayWaitVblankStart(); | ||
| 182 | } | ||
| 183 | |||
| 184 | bool PSP_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID) | ||
| 185 | { | ||
| 186 | unsigned char list[64] __attribute__((aligned(64))); | ||
| 187 | pspUtilityMsgDialogParams dialog; | ||
| 188 | int status; | ||
| 189 | void *guBuffer = NULL; | ||
| 190 | |||
| 191 | // check if it's possible to use existing video context | ||
| 192 | if (SDL_GetKeyboardFocus() == NULL) { | ||
| 193 | guBuffer = setup_temporal_gu(list); | ||
| 194 | } | ||
| 195 | |||
| 196 | // configure dialog | ||
| 197 | configure_dialog(&dialog, sizeof(dialog)); | ||
| 198 | |||
| 199 | // setup dialog options for text | ||
| 200 | dialog.mode = PSP_UTILITY_MSGDIALOG_MODE_TEXT; | ||
| 201 | dialog.options = PSP_UTILITY_MSGDIALOG_OPTION_TEXT; | ||
| 202 | |||
| 203 | // copy the message in, 512 bytes max | ||
| 204 | SDL_snprintf(dialog.message, sizeof(dialog.message), "%s\r\n\r\n%s", messageboxdata->title, messageboxdata->message); | ||
| 205 | |||
| 206 | // too many buttons | ||
| 207 | if (messageboxdata->numbuttons > 2) | ||
| 208 | return SDL_SetError("messageboxdata->numbuttons valid values are 0, 1, 2"); | ||
| 209 | |||
| 210 | // we only have two options, "yes/no" or "ok" | ||
| 211 | if (messageboxdata->numbuttons == 2) | ||
| 212 | dialog.options |= PSP_UTILITY_MSGDIALOG_OPTION_YESNO_BUTTONS | PSP_UTILITY_MSGDIALOG_OPTION_DEFAULT_NO; | ||
| 213 | |||
| 214 | // start dialog | ||
| 215 | if (sceUtilityMsgDialogInitStart(&dialog) != 0) | ||
| 216 | return SDL_SetError("sceUtilityMsgDialogInitStart() failed for some reason"); | ||
| 217 | |||
| 218 | // loop while the dialog is active | ||
| 219 | status = PSP_UTILITY_DIALOG_NONE; | ||
| 220 | do | ||
| 221 | { | ||
| 222 | sceGuStart(GU_DIRECT, list); | ||
| 223 | sceGuClearColor(0); | ||
| 224 | sceGuClearDepth(0); | ||
| 225 | sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT); | ||
| 226 | sceGuFinish(); | ||
| 227 | sceGuSync(0,0); | ||
| 228 | |||
| 229 | status = sceUtilityMsgDialogGetStatus(); | ||
| 230 | |||
| 231 | switch (status) | ||
| 232 | { | ||
| 233 | case PSP_UTILITY_DIALOG_VISIBLE: | ||
| 234 | sceUtilityMsgDialogUpdate(1); | ||
| 235 | break; | ||
| 236 | |||
| 237 | case PSP_UTILITY_DIALOG_QUIT: | ||
| 238 | sceUtilityMsgDialogShutdownStart(); | ||
| 239 | break; | ||
| 240 | } | ||
| 241 | |||
| 242 | sceDisplayWaitVblankStart(); | ||
| 243 | sceGuSwapBuffers(); | ||
| 244 | |||
| 245 | } while (status != PSP_UTILITY_DIALOG_NONE); | ||
| 246 | |||
| 247 | // cleanup | ||
| 248 | if (guBuffer) | ||
| 249 | { | ||
| 250 | term_temporal_gu(guBuffer); | ||
| 251 | } | ||
| 252 | |||
| 253 | // success | ||
| 254 | if (dialog.buttonPressed == PSP_UTILITY_MSGDIALOG_RESULT_YES) | ||
| 255 | *buttonID = messageboxdata->buttons[0].buttonID; | ||
| 256 | else if (dialog.buttonPressed == PSP_UTILITY_MSGDIALOG_RESULT_NO) | ||
| 257 | *buttonID = messageboxdata->buttons[1].buttonID; | ||
| 258 | else | ||
| 259 | *buttonID = messageboxdata->buttons[0].buttonID; | ||
| 260 | |||
| 261 | return true; | ||
| 262 | } | ||
| 263 | |||
| 264 | VideoBootStrap PSP_bootstrap = { | ||
| 265 | "psp", | ||
| 266 | "PSP Video Driver", | ||
| 267 | PSP_Create, | ||
| 268 | PSP_ShowMessageBox, | ||
| 269 | false | ||
| 270 | }; | ||
| 271 | |||
| 272 | /*****************************************************************************/ | ||
| 273 | // SDL Video and Display initialization/handling functions | ||
| 274 | /*****************************************************************************/ | ||
| 275 | bool PSP_VideoInit(SDL_VideoDevice *_this) | ||
| 276 | { | ||
| 277 | SDL_DisplayMode mode; | ||
| 278 | |||
| 279 | if (!PSP_EventInit(_this)) { | ||
| 280 | return false; // error string would already be set | ||
| 281 | } | ||
| 282 | |||
| 283 | SDL_zero(mode); | ||
| 284 | mode.w = PSP_SCREEN_WIDTH; | ||
| 285 | mode.h = PSP_SCREEN_HEIGHT; | ||
| 286 | mode.refresh_rate = 60.0f; | ||
| 287 | |||
| 288 | // 32 bpp for default | ||
| 289 | mode.format = SDL_PIXELFORMAT_ABGR8888; | ||
| 290 | |||
| 291 | if (SDL_AddBasicVideoDisplay(&mode) == 0) { | ||
| 292 | return false; | ||
| 293 | } | ||
| 294 | return true; | ||
| 295 | } | ||
| 296 | |||
| 297 | void PSP_VideoQuit(SDL_VideoDevice *_this) | ||
| 298 | { | ||
| 299 | PSP_EventQuit(_this); | ||
| 300 | } | ||
| 301 | |||
| 302 | bool PSP_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display) | ||
| 303 | { | ||
| 304 | SDL_DisplayMode mode; | ||
| 305 | |||
| 306 | SDL_zero(mode); | ||
| 307 | mode.w = PSP_SCREEN_WIDTH; | ||
| 308 | mode.h = PSP_SCREEN_HEIGHT; | ||
| 309 | mode.refresh_rate = 60.0f; | ||
| 310 | |||
| 311 | // 32 bpp for default | ||
| 312 | mode.format = SDL_PIXELFORMAT_ABGR8888; | ||
| 313 | SDL_AddFullscreenDisplayMode(display, &mode); | ||
| 314 | |||
| 315 | // 16 bpp secondary mode | ||
| 316 | mode.format = SDL_PIXELFORMAT_BGR565; | ||
| 317 | SDL_AddFullscreenDisplayMode(display, &mode); | ||
| 318 | return true; | ||
| 319 | } | ||
| 320 | |||
| 321 | bool PSP_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode) | ||
| 322 | { | ||
| 323 | return true; | ||
| 324 | } | ||
| 325 | |||
| 326 | #define EGLCHK(stmt) \ | ||
| 327 | do { \ | ||
| 328 | EGLint err; \ | ||
| 329 | \ | ||
| 330 | stmt; \ | ||
| 331 | err = eglGetError(); \ | ||
| 332 | if (err != EGL_SUCCESS) { \ | ||
| 333 | SDL_SetError("EGL error %d", err); \ | ||
| 334 | return true; \ | ||
| 335 | } \ | ||
| 336 | } while (0) | ||
| 337 | |||
| 338 | bool PSP_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props) | ||
| 339 | { | ||
| 340 | SDL_WindowData *wdata; | ||
| 341 | |||
| 342 | // Allocate window internal data | ||
| 343 | wdata = (SDL_WindowData *)SDL_calloc(1, sizeof(SDL_WindowData)); | ||
| 344 | if (!wdata) { | ||
| 345 | return false; | ||
| 346 | } | ||
| 347 | |||
| 348 | // Setup driver data for this window | ||
| 349 | window->internal = wdata; | ||
| 350 | |||
| 351 | SDL_SetKeyboardFocus(window); | ||
| 352 | |||
| 353 | // Window has been successfully created | ||
| 354 | return true; | ||
| 355 | } | ||
| 356 | |||
| 357 | void PSP_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window) | ||
| 358 | { | ||
| 359 | } | ||
| 360 | bool PSP_SetWindowPosition(SDL_VideoDevice *_this, SDL_Window *window) | ||
| 361 | { | ||
| 362 | return SDL_Unsupported(); | ||
| 363 | } | ||
| 364 | void PSP_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window) | ||
| 365 | { | ||
| 366 | } | ||
| 367 | void PSP_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window) | ||
| 368 | { | ||
| 369 | } | ||
| 370 | void PSP_HideWindow(SDL_VideoDevice *_this, SDL_Window *window) | ||
| 371 | { | ||
| 372 | } | ||
| 373 | void PSP_RaiseWindow(SDL_VideoDevice *_this, SDL_Window *window) | ||
| 374 | { | ||
| 375 | } | ||
| 376 | void PSP_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window) | ||
| 377 | { | ||
| 378 | } | ||
| 379 | void PSP_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window) | ||
| 380 | { | ||
| 381 | } | ||
| 382 | void PSP_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window) | ||
| 383 | { | ||
| 384 | } | ||
| 385 | void PSP_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window) | ||
| 386 | { | ||
| 387 | } | ||
| 388 | |||
| 389 | bool PSP_HasScreenKeyboardSupport(SDL_VideoDevice *_this) | ||
| 390 | { | ||
| 391 | return true; | ||
| 392 | } | ||
| 393 | |||
| 394 | void PSP_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props) | ||
| 395 | { | ||
| 396 | char list[0x20000] __attribute__((aligned(64))); // Needed for sceGuStart to work | ||
| 397 | int i; | ||
| 398 | int done = 0; | ||
| 399 | int input_text_length = 32; // SDL_SendKeyboardText supports up to 32 characters per event | ||
| 400 | unsigned short outtext[input_text_length]; | ||
| 401 | char text_string[input_text_length]; | ||
| 402 | |||
| 403 | SceUtilityOskData data; | ||
| 404 | SceUtilityOskParams params; | ||
| 405 | |||
| 406 | SDL_memset(outtext, 0, input_text_length * sizeof(unsigned short)); | ||
| 407 | |||
| 408 | data.language = PSP_UTILITY_OSK_LANGUAGE_DEFAULT; | ||
| 409 | data.lines = 1; | ||
| 410 | data.unk_24 = 1; | ||
| 411 | switch (SDL_GetTextInputType(props)) { | ||
| 412 | default: | ||
| 413 | case SDL_TEXTINPUT_TYPE_TEXT: | ||
| 414 | data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_ALL; | ||
| 415 | break; | ||
| 416 | case SDL_TEXTINPUT_TYPE_TEXT_NAME: | ||
| 417 | data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_ALL; | ||
| 418 | break; | ||
| 419 | case SDL_TEXTINPUT_TYPE_TEXT_EMAIL: | ||
| 420 | data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_ALL; | ||
| 421 | break; | ||
| 422 | case SDL_TEXTINPUT_TYPE_TEXT_USERNAME: | ||
| 423 | data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_ALL; | ||
| 424 | break; | ||
| 425 | case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN: | ||
| 426 | data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_ALL; | ||
| 427 | break; | ||
| 428 | case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE: | ||
| 429 | data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_ALL; | ||
| 430 | break; | ||
| 431 | case SDL_TEXTINPUT_TYPE_NUMBER: | ||
| 432 | data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_LATIN_DIGIT; | ||
| 433 | break; | ||
| 434 | case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN: | ||
| 435 | data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_LATIN_DIGIT; | ||
| 436 | break; | ||
| 437 | case SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE: | ||
| 438 | data.inputtype = PSP_UTILITY_OSK_INPUTTYPE_LATIN_DIGIT; | ||
| 439 | break; | ||
| 440 | } | ||
| 441 | data.desc = NULL; | ||
| 442 | data.intext = NULL; | ||
| 443 | data.outtextlength = input_text_length; | ||
| 444 | data.outtextlimit = input_text_length; | ||
| 445 | data.outtext = outtext; | ||
| 446 | |||
| 447 | params.base.size = sizeof(params); | ||
| 448 | sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_LANGUAGE, ¶ms.base.language); | ||
| 449 | sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_UNKNOWN, ¶ms.base.buttonSwap); | ||
| 450 | params.base.graphicsThread = 17; | ||
| 451 | params.base.accessThread = 19; | ||
| 452 | params.base.fontThread = 18; | ||
| 453 | params.base.soundThread = 16; | ||
| 454 | params.datacount = 1; | ||
| 455 | params.data = &data; | ||
| 456 | |||
| 457 | sceUtilityOskInitStart(¶ms); | ||
| 458 | |||
| 459 | while(!done) { | ||
| 460 | sceGuStart(GU_DIRECT, list); | ||
| 461 | sceGuClearColor(0); | ||
| 462 | sceGuClearDepth(0); | ||
| 463 | sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT); | ||
| 464 | sceGuFinish(); | ||
| 465 | sceGuSync(0,0); | ||
| 466 | |||
| 467 | switch(sceUtilityOskGetStatus()) | ||
| 468 | { | ||
| 469 | case PSP_UTILITY_DIALOG_VISIBLE: | ||
| 470 | sceUtilityOskUpdate(1); | ||
| 471 | break; | ||
| 472 | case PSP_UTILITY_DIALOG_QUIT: | ||
| 473 | sceUtilityOskShutdownStart(); | ||
| 474 | break; | ||
| 475 | case PSP_UTILITY_DIALOG_NONE: | ||
| 476 | done = 1; | ||
| 477 | break; | ||
| 478 | default : | ||
| 479 | break; | ||
| 480 | } | ||
| 481 | sceDisplayWaitVblankStart(); | ||
| 482 | sceGuSwapBuffers(); | ||
| 483 | } | ||
| 484 | |||
| 485 | // Convert input list to string | ||
| 486 | for (i = 0; i < input_text_length; i++) { | ||
| 487 | text_string[i] = outtext[i]; | ||
| 488 | } | ||
| 489 | SDL_SendKeyboardText((const char *) text_string); | ||
| 490 | } | ||
| 491 | void PSP_HideScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window) | ||
| 492 | { | ||
| 493 | } | ||
| 494 | bool PSP_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window) | ||
| 495 | { | ||
| 496 | return false; | ||
| 497 | } | ||
| 498 | |||
| 499 | #endif // SDL_VIDEO_DRIVER_PSP | ||
