Просмотр исходного кода

core: settings: Add setting for debug assertions and disable by default.

- This is a developer-only setting and no longer needs to be enabled by default.
- Also adds "use_auto_stub" setting to SDL frontend while we are here.
- Supersedes #1340.
bunnei 5 лет назад
Родитель
Сommit
c6c0771b12

+ 5 - 2
src/common/assert.cpp

@@ -3,9 +3,12 @@
 // Refer to the license.txt file included.
 
 #include "common/assert.h"
-
 #include "common/common_funcs.h"
 
+#include "core/settings.h"
+
 void assert_handle_failure() {
-    Crash();
+    if (Settings::values.use_debug_asserts) {
+        Crash();
+    }
 }

+ 1 - 0
src/core/settings.h

@@ -223,6 +223,7 @@ struct Values {
     bool quest_flag;
     bool disable_macro_jit;
     bool extended_logging;
+    bool use_debug_asserts;
     bool use_auto_stub;
 
     // Miscellaneous

+ 3 - 0
src/yuzu/configuration/config.cpp

@@ -641,6 +641,8 @@ void Config::ReadDebuggingValues() {
         ReadSetting(QStringLiteral("disable_macro_jit"), false).toBool();
     Settings::values.extended_logging =
         ReadSetting(QStringLiteral("extended_logging"), false).toBool();
+    Settings::values.use_debug_asserts =
+        ReadSetting(QStringLiteral("use_debug_asserts"), false).toBool();
     Settings::values.use_auto_stub = ReadSetting(QStringLiteral("use_auto_stub"), false).toBool();
 
     qt_config->endGroup();
@@ -1238,6 +1240,7 @@ void Config::SaveDebuggingValues() {
     WriteSetting(QStringLiteral("dump_exefs"), Settings::values.dump_exefs, false);
     WriteSetting(QStringLiteral("dump_nso"), Settings::values.dump_nso, false);
     WriteSetting(QStringLiteral("quest_flag"), Settings::values.quest_flag, false);
+    WriteSetting(QStringLiteral("use_debug_asserts"), Settings::values.use_debug_asserts, false);
     WriteSetting(QStringLiteral("disable_macro_jit"), Settings::values.disable_macro_jit, false);
 
     qt_config->endGroup();

+ 2 - 0
src/yuzu/configuration/configure_debug.cpp

@@ -34,6 +34,7 @@ void ConfigureDebug::SetConfiguration() {
     ui->homebrew_args_edit->setText(QString::fromStdString(Settings::values.program_args));
     ui->reporting_services->setChecked(Settings::values.reporting_services);
     ui->quest_flag->setChecked(Settings::values.quest_flag);
+    ui->use_debug_asserts->setChecked(Settings::values.use_debug_asserts);
     ui->use_auto_stub->setChecked(Settings::values.use_auto_stub);
     ui->enable_graphics_debugging->setEnabled(!Core::System::GetInstance().IsPoweredOn());
     ui->enable_graphics_debugging->setChecked(Settings::values.renderer_debug);
@@ -48,6 +49,7 @@ void ConfigureDebug::ApplyConfiguration() {
     Settings::values.program_args = ui->homebrew_args_edit->text().toStdString();
     Settings::values.reporting_services = ui->reporting_services->isChecked();
     Settings::values.quest_flag = ui->quest_flag->isChecked();
+    Settings::values.use_debug_asserts = ui->use_debug_asserts->isChecked();
     Settings::values.use_auto_stub = ui->use_auto_stub->isChecked();
     Settings::values.renderer_debug = ui->enable_graphics_debugging->isChecked();
     Settings::values.disable_macro_jit = ui->disable_macro_jit->isChecked();

+ 7 - 0
src/yuzu/configuration/configure_debug.ui

@@ -185,6 +185,13 @@
         </property>
        </widget>
       </item>
+       <item>
+         <widget class="QCheckBox" name="use_debug_asserts">
+           <property name="text">
+             <string>Enable Debug Asserts</string>
+           </property>
+         </widget>
+       </item>
        <item>
          <widget class="QCheckBox" name="use_auto_stub">
            <property name="text">

+ 4 - 0
src/yuzu_cmd/config.cpp

@@ -428,6 +428,10 @@ void Config::ReadValues() {
     Settings::values.reporting_services =
         sdl2_config->GetBoolean("Debugging", "reporting_services", false);
     Settings::values.quest_flag = sdl2_config->GetBoolean("Debugging", "quest_flag", false);
+    Settings::values.use_debug_asserts =
+        sdl2_config->GetBoolean("Debugging", "use_debug_asserts", false);
+    Settings::values.use_auto_stub = sdl2_config->GetBoolean("Debugging", "use_auto_stub", false);
+
     Settings::values.disable_macro_jit =
         sdl2_config->GetBoolean("Debugging", "disable_macro_jit", false);
 

+ 6 - 0
src/yuzu_cmd/default_ini.h

@@ -325,6 +325,12 @@ dump_nso=false
 # Determines whether or not yuzu will report to the game that the emulated console is in Kiosk Mode
 # false: Retail/Normal Mode (default), true: Kiosk Mode
 quest_flag =
+# Determines whether debug asserts should be enabled, which will throw an exception on asserts.
+# false: Disabled (default), true: Enabled
+use_debug_asserts =
+# Determines whether unimplemented HLE service calls should be automatically stubbed.
+# false: Disabled (default), true: Enabled
+use_auto_stub =
 # Enables/Disables the macro JIT compiler
 disable_macro_jit=false