[android, qt] 16 bit debug knob set for quick development toggles (#3076)

**Aims to dismiss the needing of developers to wait for someone to provide new toggles only to test temporary stuff**

This is a classic debug knob set for development use.
Developers will be able to call Settings::getDebugKnobAt(0 to 15) to pick one of the 16 bits of that setting, allowing users to easily enable or disable multiple features in testing builds, by entering values instructed by the developers.

Co-authored-by: Allison Cunha <allisonbzk@gmail.com>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3076
Reviewed-by: Lizzie <lizzie@eden-emu.dev>
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com>
Co-authored-by: xbzk <xbzk@eden-emu.dev>
Co-committed-by: xbzk <xbzk@eden-emu.dev>
This commit is contained in:
xbzk
2025-11-25 00:41:45 +01:00
committed by crueter
parent 027085e5ba
commit e63f71c787
10 changed files with 79 additions and 4 deletions

View File

@@ -61,7 +61,8 @@ enum class IntSetting(override val key: String) : AbstractIntSetting {
LOGIN_SHARE_APPLET("login_share_applet_mode"),
WIFI_WEB_AUTH_APPLET("wifi_web_auth_applet_mode"),
MY_PAGE_APPLET("my_page_applet_mode"),
INPUT_OVERLAY_AUTO_HIDE("input_overlay_auto_hide")
INPUT_OVERLAY_AUTO_HIDE("input_overlay_auto_hide"),
DEBUG_KNOBS("debug_knobs")
;
override fun getInt(needsGlobal: Boolean): Int = NativeConfig.getInt(key, needsGlobal)

View File

@@ -788,6 +788,16 @@ abstract class SettingsItem(
descriptionId = R.string.use_auto_stub_description
)
)
put(
SpinBoxSetting(
IntSetting.DEBUG_KNOBS,
titleId = R.string.debug_knobs,
descriptionId = R.string.debug_knobs_description,
valueHint = R.string.debug_knobs_hint,
min = 0,
max = 65535
)
)
val fastmem = object : AbstractBooleanSetting {
override fun getBoolean(needsGlobal: Boolean): Boolean =

View File

@@ -186,6 +186,12 @@ class SettingsDialogFragment : DialogFragment(), DialogInterface.OnClickListener
updateButtonState(isValid)
}
/*
* xbzk: these two events, along with attachRepeat feature,
* were causing spinbox buttons to respond twice per press
* cutting these out to retain accelerated press functionality
* TODO: clean this out later if no issues arise
*
spinboxBinding.buttonDecrement.setOnClickListener {
val current = spinboxBinding.editValue.text.toString().toIntOrNull() ?: currentValue
val newValue = current - 1
@@ -199,6 +205,7 @@ class SettingsDialogFragment : DialogFragment(), DialogInterface.OnClickListener
spinboxBinding.editValue.setText(newValue.toString())
updateValidity(newValue)
}
*/
fun attachRepeat(button: View, delta: Int) {
val handler = Handler(Looper.getMainLooper())

View File

@@ -1167,9 +1167,10 @@ class SettingsFragmentPresenter(
add(IntSetting.CPU_ACCURACY.key)
add(BooleanSetting.USE_AUTO_STUB.key)
add(SettingsItem.FASTMEM_COMBINED)
add(HeaderSetting(R.string.log))
add(BooleanSetting.DEBUG_FLUSH_BY_LINE.key)
add(HeaderSetting(R.string.general))
add(IntSetting.DEBUG_KNOBS.key)
}
}
}

View File

@@ -135,6 +135,9 @@
<string name="memory_layout_description">(EXPERIMENTAL) Change the emulated memory layout. This setting will not increase performance, but may help with games utilizing high resolutions via mods. Do not use on phones with 8GB of RAM or less. Only works on the Dynarmic (JIT) backend.</string>
<string name="dma_accuracy">DMA Accuracy</string>
<string name="dma_accuracy_description">Controls the DMA precision accuracy. Safe precision can fix issues in some games, but it can also impact performance in some cases. If unsure, leave this on Default.</string>
<string name="debug_knobs">Debug knobs</string>
<string name="debug_knobs_description">For development use only.</string>
<string name="debug_knobs_hint">0 to 65535</string>
<!-- Shader Backend -->
<string name="shader_backend">Shader Backend</string>
@@ -534,6 +537,8 @@
<string name="flush_by_line">Flush debug logs by line</string>
<string name="flush_by_line_description">Flushes debugging logs on each line written, making debugging easier in cases of crashing or freezing.</string>
<string name="general">General</string>
<!-- Audio settings strings -->
<string name="audio_output_engine">Output engine</string>
<string name="audio_volume">Volume</string>

View File

@@ -141,6 +141,10 @@ void LogSettings() {
log_path("DataStorage_SDMCDir", Common::FS::GetEdenPath(Common::FS::EdenPath::SDMCDir));
}
bool getDebugKnobAt(u8 i) {
return (values.debug_knobs.GetValue() & (1 << (i & 0xF))) != 0;
}
void UpdateGPUAccuracy() {
values.current_gpu_accuracy = values.gpu_accuracy.GetValue();
}

View File

@@ -739,6 +739,16 @@ struct Values {
Setting<bool> perform_vulkan_check{linkage, true, "perform_vulkan_check", Category::Debugging};
Setting<bool> disable_web_applet{linkage, true, "disable_web_applet", Category::Debugging};
SwitchableSetting<u16, true> debug_knobs{linkage,
0,
0,
65535,
"debug_knobs",
Category::Debugging,
Specialization::Countable,
true,
true};
// Miscellaneous
Setting<std::string> serial_battery{linkage, std::string(), "serial_battery", Category::Miscellaneous};
Setting<std::string> serial_unit{linkage, std::string(), "serial_unit", Category::Miscellaneous};
@@ -768,6 +778,8 @@ struct Values {
extern Values values;
bool getDebugKnobAt(u8 i);
void UpdateGPUAccuracy();
bool IsGPULevelExtreme();
bool IsGPULevelHigh();

View File

@@ -88,6 +88,13 @@ void ConfigureDebug::SetConfiguration() {
ui->disable_loop_safety_checks->setEnabled(runtime_lock);
ui->disable_loop_safety_checks->setChecked(Settings::values.disable_shader_loop_safety_checks.GetValue());
ui->perform_vulkan_check->setChecked(Settings::values.perform_vulkan_check.GetValue());
ui->debug_knobs_spinbox->setValue(Settings::values.debug_knobs.GetValue());
#ifdef YUZU_USE_QT_WEB_ENGINE
ui->disable_web_applet->setChecked(Settings::values.disable_web_applet.GetValue());
#else
ui->disable_web_applet->setChecked(true);
ui->disable_web_applet->setVisible(false);
#endif
}
void ConfigureDebug::ApplyConfiguration() {
@@ -118,6 +125,7 @@ void ConfigureDebug::ApplyConfiguration() {
Settings::values.extended_logging = ui->extended_logging->isChecked();
Settings::values.perform_vulkan_check = ui->perform_vulkan_check->isChecked();
Settings::values.disable_web_applet = ui->disable_web_applet->isChecked();
Settings::values.debug_knobs = ui->debug_knobs_spinbox->value();
Debugger::ToggleConsole();
Common::Log::Filter filter;
filter.ParseFilterString(Settings::values.log_filter.GetValue());

View File

@@ -1,11 +1,13 @@
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <memory>
#include <QScrollArea>
class QSpinBox;
namespace Core {
class System;
}

View File

@@ -507,6 +507,31 @@
</layout>
</widget>
</item>
<item row="8" column="0">
<widget class="QSpinBox" name="debug_knobs_spinbox">
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="toolTip">
<string>Bitmask for quick development toggles</string>
</property>
<property name="statusTip">
<string>Set debug knobs (bitmask)</string>
</property>
<property name="whatsThis">
<string>16-bit debug knob set for quick development toggles</string>
</property>
<property name="suffix">
<string> (bitmask)</string>
</property>
<property name="prefix">
<string>Debug Knobs: </string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QWidget" name="serial_board_widget" native="true">
<property name="sizePolicy">