From 3635b6e6026623134242bb58d4f60240960756db Mon Sep 17 00:00:00 2001 From: Zephyron Date: Thu, 16 Jan 2025 17:05:02 +1000 Subject: [PATCH] android: Add USE_AUTO_STUB setting Implements the USE_AUTO_STUB setting in the Android frontend: - Added USE_AUTO_STUB to BooleanSetting enum - Added UI switch setting with description in SettingsItem - Added setting to system settings section in SettingsFragmentPresenter - Added string resources for setting title and description The setting allows users to toggle automatic stubbing of missing services and functions, which may improve compatibility at the cost of stability. --- .../citron_emu/features/settings/model/BooleanSetting.kt | 3 ++- .../features/settings/model/view/SettingsItem.kt | 8 ++++++++ .../features/settings/ui/SettingsFragmentPresenter.kt | 1 + src/android/app/src/main/res/values/strings.xml | 4 ++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/android/app/src/main/java/org/citron/citron_emu/features/settings/model/BooleanSetting.kt b/src/android/app/src/main/java/org/citron/citron_emu/features/settings/model/BooleanSetting.kt index 79d163196..895194db5 100644 --- a/src/android/app/src/main/java/org/citron/citron_emu/features/settings/model/BooleanSetting.kt +++ b/src/android/app/src/main/java/org/citron/citron_emu/features/settings/model/BooleanSetting.kt @@ -26,7 +26,8 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting { SHOW_PERFORMANCE_OVERLAY("show_performance_overlay"), SHOW_INPUT_OVERLAY("show_input_overlay"), TOUCHSCREEN("touchscreen"), - SHOW_THERMAL_OVERLAY("show_thermal_overlay"); + SHOW_THERMAL_OVERLAY("show_thermal_overlay"), + USE_AUTO_STUB("use_auto_stub"); override fun getBoolean(needsGlobal: Boolean): Boolean = NativeConfig.getBoolean(key, needsGlobal) diff --git a/src/android/app/src/main/java/org/citron/citron_emu/features/settings/model/view/SettingsItem.kt b/src/android/app/src/main/java/org/citron/citron_emu/features/settings/model/view/SettingsItem.kt index 26991b059..8a0b12f14 100644 --- a/src/android/app/src/main/java/org/citron/citron_emu/features/settings/model/view/SettingsItem.kt +++ b/src/android/app/src/main/java/org/citron/citron_emu/features/settings/model/view/SettingsItem.kt @@ -386,6 +386,14 @@ abstract class SettingsItem( override fun reset() = setBoolean(defaultValue) } put(SwitchSetting(fastmem, R.string.fastmem)) + + put( + SwitchSetting( + BooleanSetting.USE_AUTO_STUB, + titleId = R.string.use_auto_stub, + descriptionId = R.string.use_auto_stub_description + ) + ) } } } diff --git a/src/android/app/src/main/java/org/citron/citron_emu/features/settings/ui/SettingsFragmentPresenter.kt b/src/android/app/src/main/java/org/citron/citron_emu/features/settings/ui/SettingsFragmentPresenter.kt index 79b563f3d..763bf8c35 100644 --- a/src/android/app/src/main/java/org/citron/citron_emu/features/settings/ui/SettingsFragmentPresenter.kt +++ b/src/android/app/src/main/java/org/citron/citron_emu/features/settings/ui/SettingsFragmentPresenter.kt @@ -158,6 +158,7 @@ class SettingsFragmentPresenter( add(BooleanSetting.RENDERER_USE_SPEED_LIMIT.key) add(ShortSetting.RENDERER_SPEED_LIMIT.key) add(BooleanSetting.USE_DOCKED_MODE.key) + add(BooleanSetting.USE_AUTO_STUB.key) add(IntSetting.REGION_INDEX.key) add(IntSetting.LANGUAGE_INDEX.key) add(BooleanSetting.USE_CUSTOM_RTC.key) diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml index 5b8fc30c4..6474cdbec 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml @@ -1,6 +1,10 @@ + + Use Auto Stub + Automatically stub missing services and functions. This may improve compatibility but can cause crashes and stability issues. + citron This software will run games for the Nintendo Switch game console. No game titles or keys are included.<br /><br />Before you begin, please locate your prod.keys ]]> file on your device storage.<br /><br />Learn more]]>