diff options
| author | xbzk <xbzk@eden-emu.dev> | 2025-12-07 20:33:14 +0100 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2025-12-07 20:33:14 +0100 |
| commit | 5b019a81a72d84cfd17434cc779cca8975cdf231 (patch) | |
| tree | a38114d90d89893e2bcda7bf046f44cab0979f20 /docs/user/AddingBooleanToggles.md | |
| parent | 83332316aa382e11e6af79b8432520ff4c9950b6 (diff) | |
[docs] debug knobs user guide (#3159)
* initial debug knobs guide
* integration with add boolean guide
Co-authored-by: Caio Oliveira <caiooliveirafarias0@gmail.com>
Co-authored-by: Allison Cunha <allisonbzk@gmail.com>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3159
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com>
Co-authored-by: xbzk <xbzk@eden-emu.dev>
Co-committed-by: xbzk <xbzk@eden-emu.dev>
Diffstat (limited to 'docs/user/AddingBooleanToggles.md')
| -rw-r--r-- | docs/user/AddingBooleanToggles.md | 96 |
1 files changed, 75 insertions, 21 deletions
diff --git a/docs/user/AddingBooleanToggles.md b/docs/user/AddingBooleanToggles.md index 29dc661b77..0c4b58a47c 100644 --- a/docs/user/AddingBooleanToggles.md +++ b/docs/user/AddingBooleanToggles.md @@ -2,28 +2,59 @@ > [!WARNING] > This guide is intended for developers ONLY. If you are not a developer, this likely irrelevant to yourself. +> +> If you want to add temporary toggles, please refer to **[Adding Debug Knobs](AddingDebugKnobs.md)** This guide will walk you through adding a new boolean toggle setting to Eden's configuration across both Qt's (PC) and Kotlin's (Android) UIs. +## Index + +1. [Step 1 - src/common/settings](#step-1-src-common-settings) +2. [Qt's (PC) Steps](#qt-pc-steps) + + * [Step 2 - src/qt_common/config/shared_translation.cpp](#step-2-src-qt_common-config-shared_translation-cpp) +3. [ Kotlin's (Android) Steps](#android-steps) + + * [Step 3 - BooleanSetting.kt](#step-3-src-android-app-src-main-java-org-yuzu-yuzu_emu-features-settings-model-booleansetting-kt) + * [Step 4 - SettingsItem.kt](#step-4-src-android-app-src-main-java-org-yuzu-yuzu_emu-features-settings-model-view-settingsitem-kt) + * [Step 5 - SettingsFragmentPresenter.kt](#step-5-src-android-app-src-main-java-org-yuzu-yuzu_emu-features-settings-ui-settingsfragmentpresenter-kt) + * [Step 6 - strings.xml](#step-6-src-android-app-src-main-res-values-strings-xml) +4. [Step 7 - Use Your Toggle](#step-7-use-your-toggle) +5. [Best Practices](#best-practices) + +--- + ## Step 1 - src/common/settings. + Firstly add your desired toggle inside `setting.h`, Example: + ``` SwitchableSetting<bool> your_setting_name{linkage, false, "your_setting_name", Category::RendererExtensions}; ``` + NOTE - If you wish for your toggle to be on by default then change `false` to `true` after `linkage,`. + ### Remember to add your toggle to the appropriate category, for example: + Common Categories: -- Category::Renderer -- Category::RendererAdvanced -- Category::RendererExtensions -- Category::System -- Category::Core -## Step 2 - src/qt_common/config/shared_translation.cpp +* Category::Renderer +* Category::RendererAdvanced +* Category::RendererExtensions +* Category::System +* Category::Core + +--- + +## Qt (PC) Steps + +### Step 2 - src/qt_common/config/shared_translation.cpp + Now you can add the toggle to the QT (PC) UI inside `shared_translation.cpp`, Find where you wish for it to appear and place it there. Example: + ``` INSERT(Settings, your_setting_name, @@ -32,22 +63,33 @@ INSERT(Settings, "You can use multiple lines.\n" "Explain any caveats or requirements.")); ``` + ### Make sure to: -- Keep display naming consistant -- Put detailed info in the description -- Use `\n` for line breaks in descriptions -## Step 3 - src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt +* Keep display naming consistant +* Put detailed info in the description +* Use `\n` for line breaks in descriptions + +--- + +## Android Steps + +### Step 3 - src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt + Now add it inside `BooleanSetting.kt` where it should be in the settings. Example: + ``` RENDERER_YOUR_SETTING_NAME("your_setting_name"), ``` + Remember to make sure the naming of the prefix matches the desired category. -## Step 4 - src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt +### Step 4 - src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt + Now you may add the toggle to the Kotlin (Android) UI inside `SettingsItem.kt`. Example: + ``` put( SwitchSetting( @@ -58,26 +100,35 @@ put( ) ``` -## Step 5 - src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt +### Step 5 - src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt + Now add your setting to the correct location inside `SettingsFragmentPresenter.kt` within the right category. Example: + ``` add(BooleanSetting.RENDERER_YOUR_SETTING_NAME.key) ``` + Remember, placing matters! Settings appear in the order of where you add them. -## Step 6 - src/android/app/src/main/res/values/strings.xml +### Step 6 - src/android/app/src/main/res/values/strings.xml + Now add your setting and description to `strings.xml` in the appropriate place. Example: + ``` <string name="your_setting_name">Your Setting Display Name</string> <string name="your_setting_name_description">Detailed description of what this setting does. Explain any caveats, requirements, or warnings here.</string> ``` +--- + ## Step 7 - Use Your Toggle! + Now the UI part is done find a place in the code for the toggle, And use it to your heart's desire! Example: + ``` const bool your_value = Settings::values.your_setting_name.GetValue(); @@ -85,16 +136,19 @@ if (your_value) { // Do something when enabled } ``` + If you wish to do something only when the toggle is disabled, Use `if (!your_value) {` instead of `if (your_value) {`. +--- ## Best Practices -- Naming - Use clear, descriptive names. Something for both the devs and the users. -- Defaults - Choose safe default values (usually false for new features). -- Documentation - Write clear descriptions explaining when and why to use the setting. -- Categories - Put settings in the appropriate category. -- Order - Place related settings near each other. -- Testing - Always test on both PC and Android before committing when possible. - -### Thank you for reading, I hope this guide helped you making your toggle!
\ No newline at end of file + +* Naming - Use clear, descriptive names. Something for both the devs and the users. +* Defaults - Choose safe default values (usually false for new features). +* Documentation - Write clear descriptions explaining when and why to use the setting. +* Categories - Put settings in the appropriate category. +* Order - Place related settings near each other. +* Testing - Always test on both PC and Android before committing when possible. + +### Thank you for reading, I hope this guide helped you making your toggle! |
