mirror of
https://github.com/wiiu-env/ScreenshotWUPS.git
synced 2024-11-22 14:39:14 +01:00
OSFatal when the Notification Module is missing
This commit is contained in:
parent
046d587ec5
commit
c0a2308edb
@ -1,7 +1,9 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "common.h"
|
||||||
#include "retain_vars.hpp"
|
#include "retain_vars.hpp"
|
||||||
#include "utils/WUPSConfigItemButtonCombo.h"
|
#include "utils/WUPSConfigItemButtonCombo.h"
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
|
#include "utils/utils.h"
|
||||||
#include <vpad/input.h>
|
#include <vpad/input.h>
|
||||||
#include <wups.h>
|
#include <wups.h>
|
||||||
#include <wups/config/WUPSConfigItemBoolean.h>
|
#include <wups/config/WUPSConfigItemBoolean.h>
|
||||||
@ -146,6 +148,9 @@ void boolItemCallback(ConfigItemBoolean *item, bool newValue) {
|
|||||||
DEBUG_FUNCTION_LINE("New value in %s changed: %d", item->configId, newValue);
|
DEBUG_FUNCTION_LINE("New value in %s changed: %d", item->configId, newValue);
|
||||||
if (std::string_view(item->configId) == ENABLED_CONFIG_STRING) {
|
if (std::string_view(item->configId) == ENABLED_CONFIG_STRING) {
|
||||||
gEnabled = newValue;
|
gEnabled = newValue;
|
||||||
|
if (gEnabled) {
|
||||||
|
InitNotificationModule();
|
||||||
|
}
|
||||||
WUPS_StoreBool(nullptr, item->configId, gEnabled);
|
WUPS_StoreBool(nullptr, item->configId, gEnabled);
|
||||||
} else if (std::string_view(item->configId) == RESERVED_BIT_USAGE_CONFIG_STRING) {
|
} else if (std::string_view(item->configId) == RESERVED_BIT_USAGE_CONFIG_STRING) {
|
||||||
gReservedBitUsage = newValue;
|
gReservedBitUsage = newValue;
|
||||||
|
@ -7,4 +7,4 @@
|
|||||||
#define SCREEN_CONFIG_STRING "screen"
|
#define SCREEN_CONFIG_STRING "screen"
|
||||||
#define RESERVED_BIT_USAGE_CONFIG_STRING "reservedBitUsage"
|
#define RESERVED_BIT_USAGE_CONFIG_STRING "reservedBitUsage"
|
||||||
|
|
||||||
void InitConfig();
|
void InitConfig();
|
||||||
|
@ -23,13 +23,10 @@ WUPS_USE_WUT_DEVOPTAB();
|
|||||||
// Gets called once the loader exists.
|
// Gets called once the loader exists.
|
||||||
INITIALIZE_PLUGIN() {
|
INITIALIZE_PLUGIN() {
|
||||||
initLogging();
|
initLogging();
|
||||||
|
|
||||||
NotificationModuleStatus res;
|
|
||||||
if ((res = NotificationModule_InitLibrary()) != NOTIFICATION_MODULE_RESULT_SUCCESS) {
|
|
||||||
DEBUG_FUNCTION_LINE_ERR("NotificationModule_InitLibrary failed: %s", NotificationModule_GetStatusStr(res));
|
|
||||||
}
|
|
||||||
|
|
||||||
InitConfig();
|
InitConfig();
|
||||||
|
if (gEnabled) {
|
||||||
|
InitNotificationModule();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DEINITIALIZE_PLUGIN() {
|
DEINITIALIZE_PLUGIN() {
|
||||||
|
@ -25,3 +25,5 @@ int32_t gThreadPriorityIncrease = 1;
|
|||||||
|
|
||||||
bool gBlockDRCScreenshots = false;
|
bool gBlockDRCScreenshots = false;
|
||||||
bool gBlockScreenshots = false;
|
bool gBlockScreenshots = false;
|
||||||
|
|
||||||
|
bool gInitNotificationModule = false;
|
||||||
|
@ -28,3 +28,5 @@ extern int32_t gThreadPriorityIncrease;
|
|||||||
|
|
||||||
extern bool gBlockDRCScreenshots;
|
extern bool gBlockDRCScreenshots;
|
||||||
extern bool gBlockScreenshots;
|
extern bool gBlockScreenshots;
|
||||||
|
|
||||||
|
extern bool gInitNotificationModule;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "StringTools.h"
|
#include "StringTools.h"
|
||||||
|
#include "config.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "retain_vars.hpp"
|
#include "retain_vars.hpp"
|
||||||
#include <coreinit/title.h>
|
#include <coreinit/title.h>
|
||||||
@ -78,6 +79,34 @@ std::string GetSanitizedNameOfCurrentApplication() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void InitNotificationModule() {
|
||||||
|
if (gInitNotificationModule) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
NotificationModuleStatus res;
|
||||||
|
if ((res = NotificationModule_InitLibrary()) != NOTIFICATION_MODULE_RESULT_SUCCESS) {
|
||||||
|
gInitNotificationModule = true;
|
||||||
|
std::string error = string_format("Failed to init Screenshot Plugin: \n"
|
||||||
|
"NotificationModule_InitLibrary returned:\n%s\n\n"
|
||||||
|
"Please update to latest Aroma before using the plugin.\n\n"
|
||||||
|
"The plugin has been disabled. You need to enable again in the\n"
|
||||||
|
"config menu after updating\n\n"
|
||||||
|
"Hold the POWER button of your CONSOLE for 5 seconds to shut down.",
|
||||||
|
NotificationModule_GetStatusStr(res));
|
||||||
|
gEnabled = false;
|
||||||
|
WUPSStorageError storageRes = WUPS_OpenStorage();
|
||||||
|
if (storageRes == WUPS_STORAGE_ERROR_SUCCESS) {
|
||||||
|
if (WUPS_StoreBool(nullptr, ENABLED_CONFIG_STRING, gEnabled) != WUPS_STORAGE_ERROR_SUCCESS) {
|
||||||
|
DEBUG_FUNCTION_LINE_ERR("Failed to store value");
|
||||||
|
}
|
||||||
|
WUPS_CloseStorage();
|
||||||
|
}
|
||||||
|
|
||||||
|
OSFatal(error.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ApplyGameSpecificPatches() {
|
void ApplyGameSpecificPatches() {
|
||||||
uint64_t titleID = OSGetTitleID();
|
uint64_t titleID = OSGetTitleID();
|
||||||
// Mario Kart 8 has noticeable slowdown when taking screenshots in multiplayer
|
// Mario Kart 8 has noticeable slowdown when taking screenshots in multiplayer
|
||||||
|
@ -17,3 +17,5 @@ inline uint8_t RGBComponentToSRGB(uint8_t ci) {
|
|||||||
std::string GetSanitizedNameOfCurrentApplication();
|
std::string GetSanitizedNameOfCurrentApplication();
|
||||||
|
|
||||||
void ApplyGameSpecificPatches();
|
void ApplyGameSpecificPatches();
|
||||||
|
|
||||||
|
void InitNotificationModule();
|
Loading…
Reference in New Issue
Block a user