Skip to content

Commit 114280c

Browse files
dkosmariDaniel K. O. (dkosmari)
andauthored
Wii U: Clean up ProcUI on exit. (#101)
* Clean up ProcUI on exit. * Don't process ProcUI messages in PumpEvents after it entered EXIT/shutdown state. --------- Co-authored-by: Daniel K. O. (dkosmari) <none@none>
1 parent e24b719 commit 114280c

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/video/wiiu/SDL_wiiuvideo.c

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848

4949
#include <coreinit/foreground.h>
5050
#include <proc_ui/procui.h>
51+
#include <sysapp/launch.h>
5152

5253
#include <gx2/context.h>
5354
#include <gx2/display.h>
@@ -290,6 +291,27 @@ static void WIIU_VideoQuit(_THIS)
290291
{
291292
WIIU_VideoData *videodata = (WIIU_VideoData *) _this->driverdata;
292293

294+
if (videodata->handleProcUI) {
295+
// Put ProcUI into EXIT/shutdown state if user stopped processing events
296+
// before SDL_QUIT was generated.
297+
if (ProcUIIsRunning() && !ProcUIInShutdown()) {
298+
SDL_bool procui_running = SDL_TRUE;
299+
SYSLaunchMenu();
300+
while (procui_running) {
301+
switch (ProcUIProcessMessages(TRUE)) {
302+
case PROCUI_STATUS_RELEASE_FOREGROUND:
303+
ProcUIDrawDoneRelease();
304+
break;
305+
case PROCUI_STATUS_EXITING:
306+
procui_running = SDL_FALSE;
307+
break;
308+
default:
309+
;
310+
}
311+
}
312+
}
313+
}
314+
293315
// if we're in foreground, destroy foreground data
294316
if (videodata->hasForeground) {
295317
WIIU_ForegroundReleased(_this);
@@ -344,7 +366,7 @@ static void WIIU_PumpEvents(_THIS)
344366
{
345367
WIIU_VideoData *videodata = (WIIU_VideoData *) _this->driverdata;
346368

347-
if (videodata->handleProcUI) {
369+
if (videodata->handleProcUI && !ProcUIInShutdown()) {
348370
if (videodata->enteringBackground) {
349371
// The previous ProcUIProcessMessages() received a
350372
// PROCUI_STATUS_RELEASE_FOREGROUND.

0 commit comments

Comments
 (0)