whb: Use OSGetTitleID to check if we were launched from WHB.

This commit is contained in:
James Benton 2017-06-02 14:24:00 +01:00
parent d796876a35
commit 574eeef4f0
3 changed files with 18 additions and 8 deletions

View File

@ -43,7 +43,7 @@ int main(int argc, char **argv)
int result = 0; int result = 0;
WHBLogUdpInit(); WHBLogUdpInit();
WHBProcInit(TRUE); WHBProcInit();
WHBGfxInit(); WHBGfxInit();
if (!WHBMountSdCard()) { if (!WHBMountSdCard()) {

View File

@ -12,7 +12,7 @@ extern "C" {
#endif #endif
void void
WHBProcInit(BOOL fromHBL); WHBProcInit();
void void
WHBProcShutdown(); WHBProcShutdown();

View File

@ -1,14 +1,20 @@
#include <coreinit/core.h> #include <coreinit/core.h>
#include <coreinit/exit.h> #include <coreinit/exit.h>
#include <coreinit/foreground.h> #include <coreinit/foreground.h>
#include <coreinit/systeminfo.h>
#include <coreinit/messagequeue.h> #include <coreinit/messagequeue.h>
#include <coreinit/systeminfo.h>
#include <coreinit/title.h>
#include <gx2/event.h> #include <gx2/event.h>
#include <proc_ui/procui.h> #include <proc_ui/procui.h>
#include <sysapp/launch.h> #include <sysapp/launch.h>
#include <whb/log.h> #include <whb/log.h>
#include <whb/proc.h> #include <whb/proc.h>
#define HBL_TITLE_ID (0x0005000013374842)
#define MII_MAKER_JPN_TITLE_ID (0x000500101004A000)
#define MII_MAKER_USA_TITLE_ID (0x000500101004A100)
#define MII_MAKER_EUR_TITLE_ID (0x000500101004A200)
static uint32_t static uint32_t
sMainCore; sMainCore;
@ -40,20 +46,24 @@ procHomeButtonDenied(void *context)
} }
void void
WHBProcInit(BOOL fromHBL) WHBProcInit()
{ {
sMainCore = OSGetCoreId(); uint64_t titleID = OSGetTitleID();
sRunning = TRUE;
// Homebrew Launcher does not like the standard ProcUI application loop, // Homebrew Launcher does not like the standard ProcUI application loop,
// so instead we disable the home buttom menu and use the home button // so instead we disable the home buttom menu and use the home button
// to trigger an exit. // to trigger an exit.
sFromHBL = fromHBL; if (titleID == HBL_TITLE_ID ||
if (sFromHBL) { titleID == MII_MAKER_JPN_TITLE_ID ||
titleID == MII_MAKER_USA_TITLE_ID ||
titleID == MII_MAKER_EUR_TITLE_ID) {
// Important: OSEnableHomeButtonMenu must come before ProcUIInitEx. // Important: OSEnableHomeButtonMenu must come before ProcUIInitEx.
OSEnableHomeButtonMenu(FALSE); OSEnableHomeButtonMenu(FALSE);
sFromHBL = TRUE;
} }
sMainCore = OSGetCoreId();
sRunning = TRUE;
ProcUIInitEx(&procSaveCallback, NULL); ProcUIInitEx(&procSaveCallback, NULL);
ProcUIRegisterCallback(PROCUI_CALLBACK_HOME_BUTTON_DENIED, &procHomeButtonDenied, NULL, 100); ProcUIRegisterCallback(PROCUI_CALLBACK_HOME_BUTTON_DENIED, &procHomeButtonDenied, NULL, 100);
} }