[Loader] Check the current titleid before calling hooks.

This commit is contained in:
Maschell 2018-04-04 14:33:22 +02:00
parent 720762d891
commit a8d1960dc3
4 changed files with 11 additions and 6 deletions

View File

@ -2,6 +2,7 @@
#include "myutils/overlay_helper.h"
replacement_data_t gbl_replacement_data __attribute__((section(".data")));
u8 gAppStatus __attribute__((section(".data"))) = 0;
u64 gGameTitleID __attribute__((section(".data"))) = 0;
volatile u8 gSDInitDone __attribute__((section(".data"))) = 0;
void * ntfs_mounts __attribute__((section(".data"))) = NULL;

View File

@ -4,6 +4,7 @@
extern replacement_data_t gbl_replacement_data;
extern u8 gAppStatus;
extern u64 gGameTitleID;
extern volatile u8 gSDInitDone;

View File

@ -86,6 +86,7 @@ extern "C" int Menu_Main(int argc, char **argv) {
//setup_os_exceptions();
Init();
gGameTitleID = OSGetTitleID();
s32 result = 0;

View File

@ -7,18 +7,20 @@
#include "utils.h"
DECL(void, __PPCExit, void) {
// Only continue if we are in the "right" application.
if(OSGetTitleID() == gGameTitleID) {
DEBUG_FUNCTION_LINE("__PPCExit\n");
CallHook(WUPS_LOADER_HOOK_ENDING_APPLICATION);
DeInit();
}
real___PPCExit();
}
DECL(u32, ProcUIProcessMessages, u32 u) {
u32 res = real_ProcUIProcessMessages(u);
if(res != gAppStatus) {
// Only continue if we are in the "right" application.
if(res != gAppStatus && OSGetTitleID() == gGameTitleID) {
DEBUG_FUNCTION_LINE("App status changed from %d to %d \n",gAppStatus,res);
gAppStatus = res;
CallHook(WUPS_LOADER_HOOK_APP_STATUS_CHANGED);