From 56088fbaf204e33be351b91ef5a01b6e9d697f11 Mon Sep 17 00:00:00 2001 From: Ash Logan Date: Thu, 3 Jan 2019 09:38:17 +1100 Subject: [PATCH] video/wiiu: Start adding "events" stuff --- src/video/wiiu/SDL_wiiuevents.c | 52 +++++++++++++++++++++++++++++++ src/video/wiiu/SDL_wiiuevents_c.h | 24 ++++++++++++++ src/video/wiiu/SDL_wiiuvideo.c | 11 ++----- 3 files changed, 79 insertions(+), 8 deletions(-) create mode 100644 src/video/wiiu/SDL_wiiuevents.c create mode 100644 src/video/wiiu/SDL_wiiuevents_c.h diff --git a/src/video/wiiu/SDL_wiiuevents.c b/src/video/wiiu/SDL_wiiuevents.c new file mode 100644 index 000000000..a4dc4ee3e --- /dev/null +++ b/src/video/wiiu/SDL_wiiuevents.c @@ -0,0 +1,52 @@ +/* + 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_WIIU + +#include +#include + +// for SDL_SendQuit +#include "../../events/SDL_events_c.h" + +static bool proc_init = false; + +void WIIU_PumpEvents(_THIS) { + if (proc_init) { + bool running = WHBProcIsRunning(); + if (!running) { + SDL_SendQuit(); + proc_init = false; + } + } +} + +void WIIU_EventsInit() { + WHBProcInit(); + proc_init = true; +} + +void WIIU_EventsShutdown() { + WHBProcShutdown(); +} + +#endif diff --git a/src/video/wiiu/SDL_wiiuevents_c.h b/src/video/wiiu/SDL_wiiuevents_c.h new file mode 100644 index 000000000..36d50c972 --- /dev/null +++ b/src/video/wiiu/SDL_wiiuevents_c.h @@ -0,0 +1,24 @@ +/* + 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. +*/ + +void WIIU_PumpEvents(_THIS); +void WIIU_EventsInit(); +void WIIU_EventsShutdown(); diff --git a/src/video/wiiu/SDL_wiiuvideo.c b/src/video/wiiu/SDL_wiiuvideo.c index 4f4d9f128..414ef221d 100644 --- a/src/video/wiiu/SDL_wiiuvideo.c +++ b/src/video/wiiu/SDL_wiiuvideo.c @@ -33,6 +33,7 @@ #include "../../events/SDL_mouse_c.h" #include "../../events/SDL_keyboard_c.h" #include "SDL_wiiuvideo.h" +#include "SDL_wiiuevents_c.h" #include #include @@ -41,7 +42,6 @@ #include #include #include -#include #include #include #include @@ -52,7 +52,6 @@ static int WIIU_VideoInit(_THIS); static int WIIU_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode); static void WIIU_VideoQuit(_THIS); -static void WIIU_PumpEvents(_THIS); static int WIIU_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch); static int WIIU_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects); static void WIIU_DestroyWindowFramebuffer(_THIS, SDL_Window *window); @@ -93,7 +92,7 @@ static int WIIU_VideoInit(_THIS) SDL_DisplayMode mode; void *buffer = NULL; - WHBProcInit(); + WIIU_EventsInit(); WHBGfxInit(); // setup shader @@ -133,7 +132,7 @@ static void WIIU_VideoQuit(_THIS) GX2RDestroyBufferEx(&tex_coord_buffer, 0); wiiuFreeTextureShader(); WHBGfxShutdown(); - WHBProcShutdown(); + WIIU_EventsShutdown(); } static int WIIU_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch) @@ -244,10 +243,6 @@ static int WIIU_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode return 0; } -static void WIIU_PumpEvents(_THIS) -{ -} - static int WIIU_Available(void) { return 1;