Add base settings to the root of the config

This commit is contained in:
Maschell 2024-03-03 17:44:56 +01:00
parent 3e88213027
commit c9bc7b2545

View File

@ -59,21 +59,18 @@ WUPSConfigAPICallbackStatus ConfigMenuOpenedCallback(WUPSConfigCategoryHandle ro
try { try {
WUPSConfigCategory root = WUPSConfigCategory(rootHandle); WUPSConfigCategory root = WUPSConfigCategory(rootHandle);
auto settings = WUPSConfigCategory::Create("Settings"); root.add(WUPSConfigItemBoolean::Create(ENABLED_CONFIG_STRING,
"Plugin enabled",
DEFAULT_ENABLED_CONFIG_VALUE, gEnabled,
settings.add(WUPSConfigItemBoolean::Create(ENABLED_CONFIG_STRING, &boolItemChangedConfig));
"Plugin enabled", root.add(WUPSConfigItemBoolean::Create(ENABLE_NOTIFICATIONS_CONFIG_STRING,
DEFAULT_ENABLED_CONFIG_VALUE, gEnabled, "Show notifications",
&boolItemChangedConfig)); DEFAULT_ENABLE_NOTIFICATIONS_CONFIG_VALUE, gShowNotifications,
settings.add(WUPSConfigItemBoolean::Create(ENABLE_NOTIFICATIONS_CONFIG_STRING, &boolItemChangedConfig));
"Show notifications", root.add(WUPSConfigItemBoolean::Create(SWAP_SCREENS_CONFIG_STRING,
DEFAULT_ENABLE_NOTIFICATIONS_CONFIG_VALUE, gShowNotifications, "Swap screens",
&boolItemChangedConfig)); DEFAULT_SWAP_SCREENS_CONFIG_VALUE, gDoScreenSwap,
settings.add(WUPSConfigItemBoolean::Create(SWAP_SCREENS_CONFIG_STRING, &boolItemChangedConfig));
"Swap screens",
DEFAULT_SWAP_SCREENS_CONFIG_VALUE, gDoScreenSwap,
&boolItemChangedConfig));
constexpr WUPSConfigItemMultipleValues::ValuePair audioModeMap[] = { constexpr WUPSConfigItemMultipleValues::ValuePair audioModeMap[] = {
{AUDIO_MODE_NONE, "Normal"}, {AUDIO_MODE_NONE, "Normal"},
@ -82,13 +79,11 @@ WUPSConfigAPICallbackStatus ConfigMenuOpenedCallback(WUPSConfigCategoryHandle ro
{AUDIO_MODE_COMBINE, "Combine TV and GamePad sound"}, {AUDIO_MODE_COMBINE, "Combine TV and GamePad sound"},
{AUDIO_MODE_LEFT_TV_RIGHT_DRC, "Left: TV; Right: GamePad"}}; {AUDIO_MODE_LEFT_TV_RIGHT_DRC, "Left: TV; Right: GamePad"}};
settings.add(WUPSConfigItemMultipleValues::CreateFromValue(AUDIO_MODE_CONFIG_STRING, root.add(WUPSConfigItemMultipleValues::CreateFromValue(AUDIO_MODE_CONFIG_STRING,
"Audio mode:", "Audio mode:",
DEFAULT_AUDIO_MODE_CONFIG_VALUE, gCurAudioMode, DEFAULT_AUDIO_MODE_CONFIG_VALUE, gCurAudioMode,
audioModeMap, audioModeMap,
&default_audio_mode_changed)); &default_audio_mode_changed));
root.add(std::move(settings));
auto buttonCombos = WUPSConfigCategory::Create("Button Combos"); auto buttonCombos = WUPSConfigCategory::Create("Button Combos");
@ -113,7 +108,7 @@ WUPSConfigAPICallbackStatus ConfigMenuOpenedCallback(WUPSConfigCategoryHandle ro
&buttonComboItemChanged)); &buttonComboItemChanged));
root.add(std::move(buttonCombos)); root.add(std::move(buttonCombos));
} catch (std::exception &e) { } catch (std::exception &e) {
OSReport("Exception T_T : %s\n", e.what()); OSReport("Exception: %s\n", e.what());
return WUPSCONFIG_API_CALLBACK_RESULT_ERROR; return WUPSCONFIG_API_CALLBACK_RESULT_ERROR;
} }