@ -8,7 +8,9 @@ This guide will walk you through adding a new boolean toggle setting to Eden's c
## Step 1 - src/common/settings.
## Step 1 - src/common/settings.
Firstly add your desired toggle inside `setting.h` ,
Firstly add your desired toggle inside `setting.h` ,
Example:
Example:
```SwitchableSetting< bool > your_setting_name{linkage, false, "your_setting_name", Category::RendererExtensions};```
```
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,` .
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:
### Remember to add your toggle to the appropriate category, for example:
Common Categories:
Common Categories:
@ -22,12 +24,14 @@ Common Categories:
Now you can add the toggle to the QT (PC) UI inside `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.
Find where you wish for it to appear and place it there.
Example:
Example:
```INSERT(Settings,
```
INSERT(Settings,
your_setting_name,
your_setting_name,
tr("Your Setting Display Name"),
tr("Your Setting Display Name"),
tr("Detailed description of what this setting does.\n"
tr("Detailed description of what this setting does.\n"
"You can use multiple lines.\n"
"You can use multiple lines.\n"
"Explain any caveats or requirements."));```
"Explain any caveats or requirements."));
```
### Make sure to:
### Make sure to:
- Keep display naming consistant
- Keep display naming consistant
- Put detailed info in the description
- Put detailed info in the description
@ -36,41 +40,51 @@ Example:
## Step 3 - src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt
## 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.
Now add it inside `BooleanSetting.kt` where it should be in the settings.
Example:
Example:
```RENDERER_YOUR_SETTING_NAME("your_setting_name"),```
```
RENDERER_YOUR_SETTING_NAME("your_setting_name"),
```
Remember to make sure the naming of the prefix matches the desired category.
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` .
Now you may add the toggle to the Kotlin (Android) UI inside `SettingsItem.kt` .
Example:
Example:
```put(
```
put(
SwitchSetting(
SwitchSetting(
BooleanSetting.RENDERER_YOUR_SETTING_NAME,
BooleanSetting.RENDERER_YOUR_SETTING_NAME,
titleId = R.string.your_setting_name,
titleId = R.string.your_setting_name,
descriptionId = R.string.your_setting_name_description
descriptionId = R.string.your_setting_name_description
)
)
)```
)
```
## 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.
Now add your setting to the correct location inside `SettingsFragmentPresenter.kt` within the right category.
Example:
Example:
```add(BooleanSetting.RENDERER_YOUR_SETTING_NAME.key)```
```
add(BooleanSetting.RENDERER_YOUR_SETTING_NAME.key)
```
Remember, placing matters! Settings appear in the order of where you add them.
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.
Now add your setting and description to `strings.xml` in the appropriate place.
Example:
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 > ```
```
< 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!
## Step 7 - Use Your Toggle!
Now the UI part is done find a place in the code for the toggle,
Now the UI part is done find a place in the code for the toggle,
And use it to your heart's desire!
And use it to your heart's desire!
Example:
Example:
```const bool your_value = Settings::values.your_setting_name.GetValue();
```
const bool your_value = Settings::values.your_setting_name.GetValue();
if (your_value) {
if (your_value) {
// Do something when enabled
// Do something when enabled
}```
}
```
If you wish to do something only when the toggle is disabled,
If you wish to do something only when the toggle is disabled,
Use `if (!your_value) {` instead of `if (your_value) {` .
Use `if (!your_value) {` instead of `if (your_value) {` .