Browse Source

[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>
pull/3091/head
xbzk 4 weeks ago
committed by crueter
parent
commit
e63f71c787
No known key found for this signature in database GPG Key ID: 425ACD2D4830EBC6
  1. 3
      src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/IntSetting.kt
  2. 10
      src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt
  3. 7
      src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsDialogFragment.kt
  4. 3
      src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt
  5. 5
      src/android/app/src/main/res/values/strings.xml
  6. 4
      src/common/settings.cpp
  7. 12
      src/common/settings.h
  8. 8
      src/yuzu/configuration/configure_debug.cpp
  9. 6
      src/yuzu/configuration/configure_debug.h
  10. 25
      src/yuzu/configuration/configure_debug.ui

3
src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/IntSetting.kt

@ -61,7 +61,8 @@ enum class IntSetting(override val key: String) : AbstractIntSetting {
LOGIN_SHARE_APPLET("login_share_applet_mode"), LOGIN_SHARE_APPLET("login_share_applet_mode"),
WIFI_WEB_AUTH_APPLET("wifi_web_auth_applet_mode"), WIFI_WEB_AUTH_APPLET("wifi_web_auth_applet_mode"),
MY_PAGE_APPLET("my_page_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) override fun getInt(needsGlobal: Boolean): Int = NativeConfig.getInt(key, needsGlobal)

10
src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt

@ -788,6 +788,16 @@ abstract class SettingsItem(
descriptionId = R.string.use_auto_stub_description 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 { val fastmem = object : AbstractBooleanSetting {
override fun getBoolean(needsGlobal: Boolean): Boolean = override fun getBoolean(needsGlobal: Boolean): Boolean =

7
src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsDialogFragment.kt

@ -186,6 +186,12 @@ class SettingsDialogFragment : DialogFragment(), DialogInterface.OnClickListener
updateButtonState(isValid) 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 { spinboxBinding.buttonDecrement.setOnClickListener {
val current = spinboxBinding.editValue.text.toString().toIntOrNull() ?: currentValue val current = spinboxBinding.editValue.text.toString().toIntOrNull() ?: currentValue
val newValue = current - 1 val newValue = current - 1
@ -199,6 +205,7 @@ class SettingsDialogFragment : DialogFragment(), DialogInterface.OnClickListener
spinboxBinding.editValue.setText(newValue.toString()) spinboxBinding.editValue.setText(newValue.toString())
updateValidity(newValue) updateValidity(newValue)
} }
*/
fun attachRepeat(button: View, delta: Int) { fun attachRepeat(button: View, delta: Int) {
val handler = Handler(Looper.getMainLooper()) val handler = Handler(Looper.getMainLooper())

3
src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt

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

5
src/android/app/src/main/res/values/strings.xml

@ -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="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">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="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 --> <!-- Shader Backend -->
<string name="shader_backend">Shader Backend</string> <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">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="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 --> <!-- Audio settings strings -->
<string name="audio_output_engine">Output engine</string> <string name="audio_output_engine">Output engine</string>
<string name="audio_volume">Volume</string> <string name="audio_volume">Volume</string>

4
src/common/settings.cpp

@ -141,6 +141,10 @@ void LogSettings() {
log_path("DataStorage_SDMCDir", Common::FS::GetEdenPath(Common::FS::EdenPath::SDMCDir)); 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() { void UpdateGPUAccuracy() {
values.current_gpu_accuracy = values.gpu_accuracy.GetValue(); values.current_gpu_accuracy = values.gpu_accuracy.GetValue();
} }

12
src/common/settings.h

@ -739,6 +739,16 @@ struct Values {
Setting<bool> perform_vulkan_check{linkage, true, "perform_vulkan_check", Category::Debugging}; Setting<bool> perform_vulkan_check{linkage, true, "perform_vulkan_check", Category::Debugging};
Setting<bool> disable_web_applet{linkage, true, "disable_web_applet", 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 // Miscellaneous
Setting<std::string> serial_battery{linkage, std::string(), "serial_battery", Category::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}; Setting<std::string> serial_unit{linkage, std::string(), "serial_unit", Category::Miscellaneous};
@ -768,6 +778,8 @@ struct Values {
extern Values values; extern Values values;
bool getDebugKnobAt(u8 i);
void UpdateGPUAccuracy(); void UpdateGPUAccuracy();
bool IsGPULevelExtreme(); bool IsGPULevelExtreme();
bool IsGPULevelHigh(); bool IsGPULevelHigh();

8
src/yuzu/configuration/configure_debug.cpp

@ -88,6 +88,13 @@ void ConfigureDebug::SetConfiguration() {
ui->disable_loop_safety_checks->setEnabled(runtime_lock); ui->disable_loop_safety_checks->setEnabled(runtime_lock);
ui->disable_loop_safety_checks->setChecked(Settings::values.disable_shader_loop_safety_checks.GetValue()); 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->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() { void ConfigureDebug::ApplyConfiguration() {
@ -118,6 +125,7 @@ void ConfigureDebug::ApplyConfiguration() {
Settings::values.extended_logging = ui->extended_logging->isChecked(); Settings::values.extended_logging = ui->extended_logging->isChecked();
Settings::values.perform_vulkan_check = ui->perform_vulkan_check->isChecked(); Settings::values.perform_vulkan_check = ui->perform_vulkan_check->isChecked();
Settings::values.disable_web_applet = ui->disable_web_applet->isChecked(); Settings::values.disable_web_applet = ui->disable_web_applet->isChecked();
Settings::values.debug_knobs = ui->debug_knobs_spinbox->value();
Debugger::ToggleConsole(); Debugger::ToggleConsole();
Common::Log::Filter filter; Common::Log::Filter filter;
filter.ParseFilterString(Settings::values.log_filter.GetValue()); filter.ParseFilterString(Settings::values.log_filter.GetValue());

6
src/yuzu/configuration/configure_debug.h

@ -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 #pragma once
#include <memory> #include <memory>
#include <QScrollArea> #include <QScrollArea>
class QSpinBox;
namespace Core { namespace Core {
class System; class System;
} }

25
src/yuzu/configuration/configure_debug.ui

@ -507,6 +507,31 @@
</layout> </layout>
</widget> </widget>
</item> </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"> <item row="7" column="0">
<widget class="QWidget" name="serial_board_widget" native="true"> <widget class="QWidget" name="serial_board_widget" native="true">
<property name="sizePolicy"> <property name="sizePolicy">

Loading…
Cancel
Save