Add base settings to the root of the config

This commit is contained in:
Maschell 2024-03-03 17:44:56 +01:00
parent fa1421f33b
commit 19fa1e0fe2

View File

@ -59,18 +59,15 @@ 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,
settings.add(WUPSConfigItemBoolean::Create(ENABLED_CONFIG_STRING,
"Plugin enabled", "Plugin enabled",
DEFAULT_ENABLED_CONFIG_VALUE, gEnabled, DEFAULT_ENABLED_CONFIG_VALUE, gEnabled,
&boolItemChangedConfig)); &boolItemChangedConfig));
settings.add(WUPSConfigItemBoolean::Create(ENABLE_NOTIFICATIONS_CONFIG_STRING, root.add(WUPSConfigItemBoolean::Create(ENABLE_NOTIFICATIONS_CONFIG_STRING,
"Show notifications", "Show notifications",
DEFAULT_ENABLE_NOTIFICATIONS_CONFIG_VALUE, gShowNotifications, DEFAULT_ENABLE_NOTIFICATIONS_CONFIG_VALUE, gShowNotifications,
&boolItemChangedConfig)); &boolItemChangedConfig));
settings.add(WUPSConfigItemBoolean::Create(SWAP_SCREENS_CONFIG_STRING, root.add(WUPSConfigItemBoolean::Create(SWAP_SCREENS_CONFIG_STRING,
"Swap screens", "Swap screens",
DEFAULT_SWAP_SCREENS_CONFIG_VALUE, gDoScreenSwap, DEFAULT_SWAP_SCREENS_CONFIG_VALUE, gDoScreenSwap,
&boolItemChangedConfig)); &boolItemChangedConfig));
@ -82,14 +79,12 @@ 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");
buttonCombos.add(WUPSConfigItemBoolean::Create(ENABLED_SWAP_SCREENS_COMBO_CONFIG_STRING, buttonCombos.add(WUPSConfigItemBoolean::Create(ENABLED_SWAP_SCREENS_COMBO_CONFIG_STRING,
@ -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;
} }