From 0e9d050296ba754d23e82752eb1bd61221768586 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 22 Nov 2023 17:59:36 -0500 Subject: [PATCH] psp: Hook up event subsystem init/quit. Fixes #8554. --- src/video/psp/SDL_pspevents.c | 9 ++++----- src/video/psp/SDL_pspevents_c.h | 2 ++ src/video/psp/SDL_pspvideo.c | 8 +++++++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/video/psp/SDL_pspevents.c b/src/video/psp/SDL_pspevents.c index 321e102c01..f47e50dec5 100644 --- a/src/video/psp/SDL_pspevents.c +++ b/src/video/psp/SDL_pspevents.c @@ -237,7 +237,7 @@ void PSP_InitOSKeymap(_THIS) #endif } -void PSP_EventInit(_THIS) +int PSP_EventInit(_THIS) { #ifdef PSPIRKEYB int outputmode = PSP_IRKBD_OUTPUT_MODE_SCANCODE; @@ -251,14 +251,13 @@ void PSP_EventInit(_THIS) #endif /* Start thread to read data */ if ((event_sem = SDL_CreateSemaphore(1)) == NULL) { - SDL_SetError("Can't create input semaphore"); - return; + return SDL_SetError("Can't create input semaphore"); } running = 1; if ((thread = SDL_CreateThreadInternal(EventUpdate, "PSPInputThread", 4096, NULL)) == NULL) { - SDL_SetError("Can't create input thread"); - return; + return SDL_SetError("Can't create input thread"); } + return 0; } void PSP_EventQuit(_THIS) diff --git a/src/video/psp/SDL_pspevents_c.h b/src/video/psp/SDL_pspevents_c.h index 9183def4ca..7377c83802 100644 --- a/src/video/psp/SDL_pspevents_c.h +++ b/src/video/psp/SDL_pspevents_c.h @@ -23,5 +23,7 @@ extern void PSP_InitOSKeymap(_THIS); extern void PSP_PumpEvents(_THIS); +extern int PSP_EventInit(_THIS); +extern void PSP_EventQuit(_THIS); /* end of SDL_pspevents_c.h ... */ diff --git a/src/video/psp/SDL_pspvideo.c b/src/video/psp/SDL_pspvideo.c index a7212bea6e..ba8b9628cb 100644 --- a/src/video/psp/SDL_pspvideo.c +++ b/src/video/psp/SDL_pspvideo.c @@ -145,6 +145,10 @@ int PSP_VideoInit(_THIS) SDL_VideoDisplay display; SDL_DisplayMode current_mode; + if (PSP_EventInit(_this) == -1) { + return -1; /* error string would already be set */ + } + SDL_zero(current_mode); current_mode.w = 480; @@ -169,11 +173,13 @@ int PSP_VideoInit(_THIS) SDL_AddDisplayMode(&display, ¤t_mode); SDL_AddVideoDisplay(&display, SDL_FALSE); - return 1; + + return 0; } void PSP_VideoQuit(_THIS) { + PSP_EventQuit(_this); } void PSP_GetDisplayModes(_THIS, SDL_VideoDisplay *display)