From 09fe101c3d1635833c6ad67fa5ccc7a9b4aef434 Mon Sep 17 00:00:00 2001 From: Andrew Hawes <117602754+Andrew1Hawes@users.noreply.github.com> Date: Thu, 22 Aug 2024 23:25:03 +0100 Subject: [PATCH] Add config option to enable/disable preserving SYSCONF Off by default. Located under Other settings. --- src/config.cpp | 12 ++++++++++++ src/config.h | 32 +++++++++++++++++--------------- src/globals.cpp | 1 + src/globals.hpp | 1 + src/main.cpp | 3 ++- 5 files changed, 33 insertions(+), 16 deletions(-) diff --git a/src/config.cpp b/src/config.cpp index 809122a..19972b1 100755 --- a/src/config.cpp +++ b/src/config.cpp @@ -16,6 +16,9 @@ void boolItemCallback(ConfigItemBoolean *item, bool newValue) if (std::string_view(USE_CUSTOM_DIALOGS_CONFIG_ID) == item->identifier) { gUseCustomDialogs = newValue; WUPSStorageAPI::Store(item->identifier, gUseCustomDialogs); + } else if (std::string_view(PRESERVE_SYSCONF_CONFIG_ID) == item->identifier) { + gPreserveSysconf = newValue; + WUPSStorageAPI::Store(item->identifier, gPreserveSysconf); } } } @@ -189,6 +192,13 @@ WUPSConfigAPICallbackStatus ConfigMenuOpenedCallback(WUPSConfigCategoryHandle ro notificationThemeValues, &multipleValueItemCallback)); + // Preserve SYSCONF + otherSettings.add(WUPSConfigItemBoolean::Create(PRESERVE_SYSCONF_CONFIG_ID, + "Preserve SYSCONF on Wii VC title launch", + DEFAULT_PRESERVE_SYSCONF_VALUE, + gPreserveSysconf, + &boolItemCallback)); + root.add(std::move(otherSettings)); } catch (const std::exception &e) { DEBUG_FUNCTION_LINE_ERR("Exception: %s", e.what()); @@ -227,4 +237,6 @@ void initConfig() WUPSStorageAPI::GetOrStoreDefault(FORWARDER_DISPLAY_OVERRIDE_CONFIG_ID, gForwarderDisplayOverride, DEFAULT_FORWARDER_DISPLAY_OVERRIDE); WUPSStorageAPI::GetOrStoreDefault(NOTIFICATION_THEME_CONFIG_ID, gNotificationTheme, DEFAULT_NOTIFICATION_THEME_VALUE); + + WUPSStorageAPI::GetOrStoreDefault(PRESERVE_SYSCONF_CONFIG_ID, gPreserveSysconf, DEFAULT_PRESERVE_SYSCONF_VALUE); } diff --git a/src/config.h b/src/config.h index 035f928..47a538c 100755 --- a/src/config.h +++ b/src/config.h @@ -1,35 +1,37 @@ #pragma once // Wii VC -#define DEFAULT_AUTOLAUNCH_DRC_SUPPORTED_VALUE DISPLAY_OPTION_CHOOSE +#define DEFAULT_AUTOLAUNCH_DRC_SUPPORTED_VALUE DISPLAY_OPTION_CHOOSE #define DEFAULT_AUTOLAUNCH_NO_DRC_SUPPORT_VALUE DISPLAY_OPTION_CHOOSE -#define DEFAULT_DISPLAY_OPTIONS_ORDER_VALUE DISPLAY_OPTIONS_ORDER_RECENT -#define DEFAULT_SET_RESOLUTION_VALUE SET_RESOLUTION_NONE -#define DEFAULT_USE_CUSTOM_DIALOGS_VALUE true +#define DEFAULT_DISPLAY_OPTIONS_ORDER_VALUE DISPLAY_OPTIONS_ORDER_RECENT +#define DEFAULT_SET_RESOLUTION_VALUE SET_RESOLUTION_NONE +#define DEFAULT_USE_CUSTOM_DIALOGS_VALUE true // Wii Mode -#define DEFAULT_WII_MENU_SET_RESOLUTION_VALUE SET_RESOLUTION_NONE +#define DEFAULT_WII_MENU_SET_RESOLUTION_VALUE SET_RESOLUTION_NONE // WUHB Forwarder -#define DEFAULT_FORWARDER_DISPLAY_OVERRIDE DISPLAY_OPTION_CHOOSE +#define DEFAULT_FORWARDER_DISPLAY_OVERRIDE DISPLAY_OPTION_CHOOSE // Other -#define DEFAULT_NOTIFICATION_THEME_VALUE NOTIFICATION_THEME_LIGHT +#define DEFAULT_NOTIFICATION_THEME_VALUE NOTIFICATION_THEME_LIGHT +#define DEFAULT_PRESERVE_SYSCONF_VALUE false // Wii VC -#define AUTOLAUNCH_DRC_SUPPORTED_CONFIG_ID "gAutolaunchDRCSupported" -#define AUTOLAUNCH_NO_DRC_SUPPORT_CONFIG_ID "gAutolaunchNoDRCSupport" -#define DISPLAY_OPTIONS_ORDER_CONFIG_ID "gDisplayOptionsOrder" -#define SET_RESOLUTION_CONFIG_ID "gSetResolution" -#define USE_CUSTOM_DIALOGS_CONFIG_ID "gUseCustomDialogs" +#define AUTOLAUNCH_DRC_SUPPORTED_CONFIG_ID "gAutolaunchDRCSupported" +#define AUTOLAUNCH_NO_DRC_SUPPORT_CONFIG_ID "gAutolaunchNoDRCSupport" +#define DISPLAY_OPTIONS_ORDER_CONFIG_ID "gDisplayOptionsOrder" +#define SET_RESOLUTION_CONFIG_ID "gSetResolution" +#define USE_CUSTOM_DIALOGS_CONFIG_ID "gUseCustomDialogs" // Wii Mode -#define WII_MENU_SET_RESOLUTION_CONFIG_ID "wiiMenuSetResolution" +#define WII_MENU_SET_RESOLUTION_CONFIG_ID "wiiMenuSetResolution" // WUHB Forwarder -#define FORWARDER_DISPLAY_OVERRIDE_CONFIG_ID "forwarderDisplayOverride" +#define FORWARDER_DISPLAY_OVERRIDE_CONFIG_ID "forwarderDisplayOverride" // Other -#define NOTIFICATION_THEME_CONFIG_ID "notificationTheme" +#define NOTIFICATION_THEME_CONFIG_ID "notificationTheme" +#define PRESERVE_SYSCONF_CONFIG_ID "preserveSysconf" void initConfig(); diff --git a/src/globals.cpp b/src/globals.cpp index 5a006b7..c86080d 100755 --- a/src/globals.cpp +++ b/src/globals.cpp @@ -16,5 +16,6 @@ int32_t gForwarderDisplayOverride = DEFAULT_FORWARDER_DISPLAY_OVERRIDE; // Other int32_t gNotificationTheme = DEFAULT_NOTIFICATION_THEME_VALUE; +bool gPreserveSysconf = DEFAULT_PRESERVE_SYSCONF_VALUE; bool gInWiiUMenu = false; diff --git a/src/globals.hpp b/src/globals.hpp index 629fc74..9636fdb 100755 --- a/src/globals.hpp +++ b/src/globals.hpp @@ -50,5 +50,6 @@ extern int32_t gForwarderDisplayOverride; // Other extern int32_t gNotificationTheme; +extern bool gPreserveSysconf; extern bool gInWiiUMenu; diff --git a/src/main.cpp b/src/main.cpp index af7ae3d..564c3df 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -499,7 +499,8 @@ DECL_FUNCTION(int32_t, ACPGetLaunchMetaXml, ACPMetaXml *metaXml) DECL_FUNCTION(int32_t, CMPTExPrepareLaunch, uint32_t unk1, void *unk2, uint32_t unk3) { setResolution(gSetResolution); - backupSysconf(); + if (gPreserveSysconf) + backupSysconf(); return real_CMPTExPrepareLaunch(unk1, unk2, unk3); }