forked from PretendoNetwork/Inkay
feat: Show notification is plugin is missing or module was never initialized
This commit is contained in:
parent
fa59526cd0
commit
1ffb9cf65a
7 changed files with 45 additions and 17 deletions
|
|
@ -62,7 +62,8 @@ DEINITIALIZE_PLUGIN() {
|
|||
}
|
||||
|
||||
ON_APPLICATION_START() {
|
||||
|
||||
// Tell the module the plugin is running!
|
||||
Inkay_SetPluginRunning();
|
||||
}
|
||||
|
||||
ON_APPLICATION_ENDS() {
|
||||
|
|
|
|||
|
|
@ -15,17 +15,18 @@
|
|||
*/
|
||||
|
||||
#include "module.h"
|
||||
#include <coreinit/dynload.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "Notification.h"
|
||||
#include "utils/logger.h"
|
||||
#include "sysconfig.h"
|
||||
#include "lang.h"
|
||||
|
||||
#include <coreinit/dynload.h>
|
||||
|
||||
static OSDynLoad_Module module;
|
||||
static void (*moduleInitialize)(bool) = nullptr;
|
||||
static InkayStatus (*moduleGetStatus)() = nullptr;
|
||||
static void (*moduleSetPluginRunning)() = nullptr;
|
||||
|
||||
static const char *get_module_not_found_message() {
|
||||
return get_config_strings(get_system_language()).module_not_found.data();
|
||||
|
|
@ -61,6 +62,7 @@ void Inkay_Finalize() {
|
|||
OSDynLoad_Release(module);
|
||||
moduleInitialize = nullptr;
|
||||
moduleGetStatus = nullptr;
|
||||
moduleSetPluginRunning = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -76,3 +78,16 @@ InkayStatus Inkay_GetStatus() {
|
|||
|
||||
return moduleGetStatus();
|
||||
}
|
||||
|
||||
void Inkay_SetPluginRunning() {
|
||||
if (!module) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!moduleSetPluginRunning && OSDynLoad_FindExport(module, OS_DYNLOAD_EXPORT_FUNC, "Inkay_SetPluginRunning", reinterpret_cast<void * *>(&moduleSetPluginRunning)) != OS_DYNLOAD_OK) {
|
||||
DEBUG_FUNCTION_LINE("Failed to find \"Inkay_SetPluginRunning\" function");
|
||||
return;
|
||||
}
|
||||
|
||||
moduleSetPluginRunning();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,3 +27,4 @@ enum class InkayStatus {
|
|||
void Inkay_Initialize(bool apply_patches);
|
||||
void Inkay_Finalize();
|
||||
InkayStatus Inkay_GetStatus();
|
||||
void Inkay_SetPluginRunning();
|
||||
|
|
|
|||
Loading…
Reference in a new issue