Skip to main content

Settings

Warning

This guide is intended for developers ONLY. If you're looking for configuring the emulator itself, read the user documentation.

Settings on the emulator are very important, toggles and such can be used to guard and/or add branches to paths where some games may crash while others won't, and viceversa.

However, this process can be tedious for those unfamiliar; this document serves as an outline/documentation for the settings subsystem.

Index​

Adding Boolean Settings Toggles​

This guide walks through adding a boolean setting to the common settings registry and exposing it in the Qt and Android interfaces.

Step 1 - Common Setting​

Add the setting to Settings::Values in src/common/settings.h. SwitchableSetting<bool> is the common setting type used for a boolean that can be overridden.

src/common/settings.h
// Inside Settings::Values
SwitchableSetting<bool> your_setting_name{linkage, false, "your_setting_name", Category::RendererExtensions};

Choose the matching Settings::Category for the setting; for example, use Category::RendererExtensions only for renderer extension settings. The false is the default value; use true only if enabled by default is intended.

Warning

The setting label is its serialized configuration key. Keep it stable and use the same key in frontend entries.

SwitchableSetting<bool> is already explicitly instantiated in src/common/settings.cpp; no generated settings file or additional instantiation is needed for this type.

Step 2 - Qt Toggle​

Add its display name and tooltip to the translation map in src/qt_common/config/shared_translation.cpp. The macro is INSERT (uppercase); the translation map supplies text, not widget placement.

src/qt_common/config/shared_translation.cpp
INSERT(Settings, your_setting_name,
tr("Your Setting Display Name"),
tr("Detailed description of this setting."));

Step 4 - Use Your Toggle​

Read the value where the behavior belongs:

Example use
const bool your_value = Settings::values.your_setting_name.GetValue();

if (your_value) {
// Feature enabled
}
Required follow-up

When adding a setting, update every frontend you support, add localized Android strings, and test the setting's default and behavior. The Qt translation entry and Android enum, item, presenter, and resources are separate follow-ups. src/frontend_common/settings_generator.cpp creates runtime token and serial values; it does not generate setting declarations or UI files.

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.

Adding Debug Knobs​

Debug Knobs is a 16-bit integer setting (debug_knobs) in the Eden Emulator that serves as a bitmask for gating various testing and debugging features. This allows developers and advanced users to enable or disable specific debug behaviors without requiring deploying of complete but temporary toggles.

The setting ranges from 0 to 65535 (0x0000 to 0xFFFF), where each bit represents a different debug feature flag.


Advantages​

The main advantage is to avoid deploying new disposable toggles (those made only for testing stage, and are disposed once new feature gets good to merge). This empowers devs to be free of all frontend bureaucracy and hassle of new toggles.

Common advantages recap:

  • Fine-Grained Control: Enable or disable up to 16 individual debug features independently using bit manipulation on a single build
  • Runtime Configuration: Change debug behavior at runtime the same way as new toggles would do
  • Safe incremental development: New debug features can be added while impact can be isolated from previous deployments

Usage​

Accessing Debug Knobs (dev side)​

Use the Settings::GetDebugKnobAt(u8 i) function to check if a specific bit is set:

C++
#include "common/settings.h"

const u16 debug_knobs = Settings::values.debug_knobs.GetValue();

// Check if bit 0 is set
bool feature_enabled = Settings::GetDebugKnobAt(0);

// Check if bit 15 is set
bool another_feature = Settings::GetDebugKnobAt(15);
Android configuration model
// Read the configured value; Android exposes this as UShortSetting.
val debugKnobs = UShortSetting.DEBUG_KNOBS.getInt()

Settings::GetDebugKnobAt is the C++ helper and returns true if the specified bit is set. The Android setting model exposes the integer value; it does not provide this C++ helper.

Setting Debug Knobs (user side)​

Developers must inform which knobs are tied to each functionality to be tested.

The debug knobs value can be set through:

  1. Desktop UI: The setting is available in the debug configuration.
  2. Android UI: It is exposed as an unsigned-short integer setting in the Debug section.
  3. Configuration files: Set the debug_knobs value (0–65535).

Bit Manipulation Examples​

To enable specific features, calculate the decimal value by setting the appropriate bits:

  • Enable only bit 0: Value = 1 (2^0)
  • Enable only bit 1: Value = 2 (2^1)
  • Enable bits 0 and 1: Value = 3 (2^0 + 2^1)
  • Enable bit 15: Value = 32768 (2^15)

Terminology and user communication​

There are two main confusions when talking about knobs:

Whether it's zero-based or one-based​

Sometimes when an user reports: knobs 1 and 2 gets better performance, dev may get confuse whether he means the knobs 1 and 2 literally, or the 1st and 2nd knobs (knobs 0 and 1).

Debug knobs are zero-based, which means:

  • The first knob is the knob(0) (or knob0 henceforth), and the last one is the 15 (knob15, likewise)
  • You can talk: "knob0 is enabled/disabled", "In this video i was using only knobs 0 and 2", etc.

Whether one is talking about the knob itself or about the entire parameter value (which represents all knobs)​

Sometimes when an user reports: knob 3 results, it's unclear whether he's referring to knob setting with value 3 (which means both knob 0 and 1 are enabled), or to knob(3) specifically. Whenever you're instructing tests or reporting results, be precise about whether one you're talking to avoid confusion:

Setting based terminology​

ALWAYS use the word in PLURAL (knobs), without mentioning which one, to refer to the setting, aka multiple knobs at once: Examples:

  • knobs=0: no knobs enabled
  • knobs=1: knob0 enabled, others disabled
  • knobs=2: knob1 enabled, others disabled
  • knobs=3: knobs 0 and 1 enabled, others disabled

...

Knob based terminology​

Use the word in SINGULAR (knob), or in plural but referring which ones, when meaning multiple knobs at once: Examples:

  • knob0: knob 0 enabled, others disabled
  • knob1: knob 1 enabled, others disabled
  • knobs 0 and 1: knobs 0 and 1 enabled, others disabled

...

Examples​

Example 1: Conditional Debug Logging​

void SomeFunction() {
if (Settings::GetDebugKnobAt(0)) {
LOG_DEBUG(Common, "Debug feature 0 is enabled");
// Additional debug code here
}

if (Settings::GetDebugKnobAt(1)) {
LOG_DEBUG(Common, "Debug feature 1 is enabled");
// Different debug behavior
}
}

Example 2: Performance Tuning​

bool UseOptimizedPath() {
// Skip optimization if debug bit 2 is set for testing
return !Settings::GetDebugKnobAt(2);
}

Example 3: Feature Gating​

void ExperimentalFeature() {
static constexpr u8 EXPERIMENTAL_FEATURE_BIT = 3;

if (!Settings::GetDebugKnobAt(EXPERIMENTAL_FEATURE_BIT)) {
// Fallback to stable implementation
StableImplementation();
return;
}

// Experimental implementation
ExperimentalImplementation();
}

Best Practices​

  • This setting is intended for development and testing purposes only
  • Remove temporary feature wiring before submitting a change, unless the knob is intentionally retained and documented
  • The setting is per-game configurable, allowing different debug setups for different titles