mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2026-08-23 11:24:34 -05:00
Add support for notifications on error
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#include "NotificationsUtils.h"
|
||||
#include "PluginManagement.h"
|
||||
#include "coreinit/interrupts.h"
|
||||
#include "coreinit/scheduler.h"
|
||||
@@ -7,12 +8,14 @@
|
||||
#include "plugin/PluginDataFactory.h"
|
||||
#include "utils/utils.h"
|
||||
#include <coreinit/debug.h>
|
||||
#include <notifications/notifications.h>
|
||||
#include <wums.h>
|
||||
|
||||
WUMS_MODULE_EXPORT_NAME("homebrew_wupsbackend");
|
||||
WUMS_USE_WUT_DEVOPTAB();
|
||||
WUMS_DEPENDS_ON(homebrew_functionpatcher);
|
||||
WUMS_DEPENDS_ON(homebrew_memorymapping);
|
||||
WUMS_DEPENDS_ON(homebrew_notifications);
|
||||
|
||||
WUMS_INITIALIZE() {
|
||||
initLogging();
|
||||
@@ -21,6 +24,14 @@ WUMS_INITIALIZE() {
|
||||
OSFatal("homebrew_wupsbackend: FunctionPatcher_InitLibrary failed");
|
||||
}
|
||||
|
||||
NotificationModuleStatus res;
|
||||
if ((res = NotificationModule_InitLibrary()) != NOTIFICATION_MODULE_RESULT_SUCCESS) {
|
||||
DEBUG_FUNCTION_LINE_ERR("Failed to init NotificationModule");
|
||||
gNotificationModuleLoaded = false;
|
||||
} else {
|
||||
gNotificationModuleLoaded = true;
|
||||
}
|
||||
|
||||
DEBUG_FUNCTION_LINE("Patching functions");
|
||||
for (uint32_t i = 0; i < method_hooks_static_size; i++) {
|
||||
if (FunctionPatcher_AddFunctionPatch(&method_hooks_static[i], nullptr, nullptr) != FUNCTION_PATCHER_RESULT_SUCCESS) {
|
||||
@@ -43,6 +54,7 @@ WUMS_APPLICATION_ENDS() {
|
||||
if (upid != 2 && upid != 15) {
|
||||
return;
|
||||
}
|
||||
|
||||
CallHook(gLoadedPlugins, WUPS_LOADER_HOOK_APPLICATION_ENDS);
|
||||
CallHook(gLoadedPlugins, WUPS_LOADER_HOOK_FINI_WUT_SOCKETS);
|
||||
CallHook(gLoadedPlugins, WUPS_LOADER_HOOK_FINI_WUT_DEVOPTAB);
|
||||
@@ -52,6 +64,8 @@ WUMS_APPLICATION_ENDS() {
|
||||
}
|
||||
gUsedRPLs.clear();
|
||||
|
||||
StopNotificationThread();
|
||||
|
||||
deinitLogging();
|
||||
}
|
||||
|
||||
@@ -65,6 +79,8 @@ WUMS_APPLICATION_STARTS() {
|
||||
|
||||
OSReport("Running WiiUPluginLoaderBackend " VERSION_FULL "\n");
|
||||
|
||||
StartNotificationThread();
|
||||
|
||||
gUsedRPLs.clear();
|
||||
|
||||
// If an allocated rpl was not released properly (e.g. if something else calls OSDynload_Acquire without releasing it) memory get leaked.
|
||||
|
||||
Reference in New Issue
Block a user