Skip to content

Commit

Permalink
Add config option to enable/disable preserving SYSCONF
Browse files Browse the repository at this point in the history
Off by default.
Located under Other settings.
  • Loading branch information
Andrew1Hawes committed Aug 22, 2024
1 parent 227d54e commit 09fe101
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 16 deletions.
12 changes: 12 additions & 0 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -227,4 +237,6 @@ void initConfig()
WUPSStorageAPI::GetOrStoreDefault<int32_t>(FORWARDER_DISPLAY_OVERRIDE_CONFIG_ID, gForwarderDisplayOverride, DEFAULT_FORWARDER_DISPLAY_OVERRIDE);

WUPSStorageAPI::GetOrStoreDefault<int32_t>(NOTIFICATION_THEME_CONFIG_ID, gNotificationTheme, DEFAULT_NOTIFICATION_THEME_VALUE);

WUPSStorageAPI::GetOrStoreDefault(PRESERVE_SYSCONF_CONFIG_ID, gPreserveSysconf, DEFAULT_PRESERVE_SYSCONF_VALUE);
}
32 changes: 17 additions & 15 deletions src/config.h
Original file line number Diff line number Diff line change
@@ -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();
1 change: 1 addition & 0 deletions src/globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
1 change: 1 addition & 0 deletions src/globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@ extern int32_t gForwarderDisplayOverride;

// Other
extern int32_t gNotificationTheme;
extern bool gPreserveSysconf;

extern bool gInWiiUMenu;
3 changes: 2 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 09fe101

Please sign in to comment.