mirror of
https://github.com/wiiu-env/wut.git
synced 2025-01-06 02:28:14 +01:00
whb: Fix proc to better support HBL launched applications.
Should exit cleanly to HBL now. TODO: Is it possible to auto detect if we were launched from HBL?
This commit is contained in:
parent
79345f239f
commit
2c18b246ae
@ -1,8 +1,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <wut.h>
|
#include <wut.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \defgroup whb_proc ProcUI Utilities
|
||||||
|
* \ingroup whb
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
WHBProcInit();
|
WHBProcInit(BOOL fromHBL);
|
||||||
|
|
||||||
void
|
void
|
||||||
WHBProcShutdown();
|
WHBProcShutdown();
|
||||||
@ -12,3 +22,9 @@ WHBProcStopRunning();
|
|||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
WHBProcIsRunning();
|
WHBProcIsRunning();
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
#include <whb/proc.h>
|
|
||||||
#include <coreinit/core.h>
|
#include <coreinit/core.h>
|
||||||
|
#include <coreinit/exit.h>
|
||||||
#include <coreinit/foreground.h>
|
#include <coreinit/foreground.h>
|
||||||
|
#include <coreinit/systeminfo.h>
|
||||||
|
#include <coreinit/messagequeue.h>
|
||||||
#include <gx2/event.h>
|
#include <gx2/event.h>
|
||||||
#include <proc_ui/procui.h>
|
#include <proc_ui/procui.h>
|
||||||
|
#include <sysapp/launch.h>
|
||||||
|
#include <whb/log.h>
|
||||||
|
#include <whb/proc.h>
|
||||||
|
|
||||||
static uint32_t
|
static uint32_t
|
||||||
sMainCore;
|
sMainCore;
|
||||||
@ -10,28 +15,59 @@ sMainCore;
|
|||||||
static BOOL
|
static BOOL
|
||||||
sRunning = FALSE;
|
sRunning = FALSE;
|
||||||
|
|
||||||
|
static BOOL
|
||||||
|
sFromHBL = FALSE;
|
||||||
|
|
||||||
static ProcUICallback
|
static ProcUICallback
|
||||||
sAcquireCallback = NULL;
|
sAcquireCallback = NULL;
|
||||||
|
|
||||||
static uint32_t
|
static uint32_t
|
||||||
ProcSaveCallback(void *context)
|
procSaveCallback(void *context)
|
||||||
{
|
{
|
||||||
OSSavesDone_ReadyToRelease();
|
OSSavesDone_ReadyToRelease();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static uint32_t
|
||||||
|
procHomeButtonDenied(void *context)
|
||||||
|
{
|
||||||
|
if (sFromHBL) {
|
||||||
|
WHBProcStopRunning();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
WHBProcInit()
|
WHBProcInit(BOOL fromHBL)
|
||||||
{
|
{
|
||||||
sMainCore = OSGetCoreId();
|
sMainCore = OSGetCoreId();
|
||||||
sRunning = TRUE;
|
sRunning = TRUE;
|
||||||
ProcUIInitEx(&ProcSaveCallback, NULL);
|
|
||||||
|
// Homebrew Launcher does not like the standard ProcUI application loop,
|
||||||
|
// so instead we disable the home buttom menu and use the home button
|
||||||
|
// to trigger an exit.
|
||||||
|
sFromHBL = fromHBL;
|
||||||
|
if (sFromHBL) {
|
||||||
|
// Important: OSEnableHomeButtonMenu must come before ProcUIInitEx.
|
||||||
|
OSEnableHomeButtonMenu(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
ProcUIInitEx(&procSaveCallback, NULL);
|
||||||
|
ProcUIRegisterCallback(PROCUI_CALLBACK_HOME_BUTTON_DENIED, &procHomeButtonDenied, NULL, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
WHBProcShutdown()
|
WHBProcShutdown()
|
||||||
{
|
{
|
||||||
sRunning = FALSE;
|
sRunning = FALSE;
|
||||||
|
|
||||||
|
// If we're running from Homebrew Launcher we must do a SYSRelaunchTitle to
|
||||||
|
// correctly return to HBL.
|
||||||
|
if (sFromHBL) {
|
||||||
|
SYSRelaunchTitle(0, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -58,7 +94,6 @@ WHBProcIsRunning()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!sRunning) {
|
if (!sRunning) {
|
||||||
GX2DrawDone();
|
|
||||||
ProcUIShutdown();
|
ProcUIShutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user