mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-12-26 21:10:05 +00:00
android: Add optional androidDefault property to settings
Certain settings have specific defaults for Android only. This lets us reflect them in the Kotlin side with very little code.
This commit is contained in:
parent
45280a0342
commit
21ad5f5cc5
@ -9,6 +9,8 @@ interface AbstractSetting {
|
|||||||
val key: String
|
val key: String
|
||||||
val category: Settings.Category
|
val category: Settings.Category
|
||||||
val defaultValue: Any
|
val defaultValue: Any
|
||||||
|
val androidDefault: Any?
|
||||||
|
get() = null
|
||||||
val valueAsString: String
|
val valueAsString: String
|
||||||
get() = ""
|
get() = ""
|
||||||
|
|
||||||
|
@ -7,17 +7,18 @@ import org.yuzu.yuzu_emu.utils.NativeConfig
|
|||||||
|
|
||||||
enum class BooleanSetting(
|
enum class BooleanSetting(
|
||||||
override val key: String,
|
override val key: String,
|
||||||
override val category: Settings.Category
|
override val category: Settings.Category,
|
||||||
|
override val androidDefault: Boolean? = null
|
||||||
) : AbstractBooleanSetting {
|
) : AbstractBooleanSetting {
|
||||||
CPU_DEBUG_MODE("cpu_debug_mode", Settings.Category.Cpu),
|
CPU_DEBUG_MODE("cpu_debug_mode", Settings.Category.Cpu),
|
||||||
FASTMEM("cpuopt_fastmem", Settings.Category.Cpu),
|
FASTMEM("cpuopt_fastmem", Settings.Category.Cpu),
|
||||||
FASTMEM_EXCLUSIVES("cpuopt_fastmem_exclusives", Settings.Category.Cpu),
|
FASTMEM_EXCLUSIVES("cpuopt_fastmem_exclusives", Settings.Category.Cpu),
|
||||||
RENDERER_USE_SPEED_LIMIT("use_speed_limit", Settings.Category.Core),
|
RENDERER_USE_SPEED_LIMIT("use_speed_limit", Settings.Category.Core),
|
||||||
USE_DOCKED_MODE("use_docked_mode", Settings.Category.System),
|
USE_DOCKED_MODE("use_docked_mode", Settings.Category.System, false),
|
||||||
RENDERER_USE_DISK_SHADER_CACHE("use_disk_shader_cache", Settings.Category.Renderer),
|
RENDERER_USE_DISK_SHADER_CACHE("use_disk_shader_cache", Settings.Category.Renderer),
|
||||||
RENDERER_FORCE_MAX_CLOCK("force_max_clock", Settings.Category.Renderer),
|
RENDERER_FORCE_MAX_CLOCK("force_max_clock", Settings.Category.Renderer),
|
||||||
RENDERER_ASYNCHRONOUS_SHADERS("use_asynchronous_shaders", Settings.Category.Renderer),
|
RENDERER_ASYNCHRONOUS_SHADERS("use_asynchronous_shaders", Settings.Category.Renderer),
|
||||||
RENDERER_REACTIVE_FLUSHING("use_reactive_flushing", Settings.Category.Renderer),
|
RENDERER_REACTIVE_FLUSHING("use_reactive_flushing", Settings.Category.Renderer, false),
|
||||||
RENDERER_DEBUG("debug", Settings.Category.Renderer),
|
RENDERER_DEBUG("debug", Settings.Category.Renderer),
|
||||||
PICTURE_IN_PICTURE("picture_in_picture", Settings.Category.Android),
|
PICTURE_IN_PICTURE("picture_in_picture", Settings.Category.Android),
|
||||||
USE_CUSTOM_RTC("custom_rtc_enabled", Settings.Category.System);
|
USE_CUSTOM_RTC("custom_rtc_enabled", Settings.Category.System);
|
||||||
@ -27,7 +28,9 @@ enum class BooleanSetting(
|
|||||||
|
|
||||||
override fun setBoolean(value: Boolean) = NativeConfig.setBoolean(key, value)
|
override fun setBoolean(value: Boolean) = NativeConfig.setBoolean(key, value)
|
||||||
|
|
||||||
override val defaultValue: Boolean by lazy { NativeConfig.getBoolean(key, true) }
|
override val defaultValue: Boolean by lazy {
|
||||||
|
androidDefault ?: NativeConfig.getBoolean(key, true)
|
||||||
|
}
|
||||||
|
|
||||||
override val valueAsString: String
|
override val valueAsString: String
|
||||||
get() = if (boolean) "1" else "0"
|
get() = if (boolean) "1" else "0"
|
||||||
|
@ -7,13 +7,14 @@ import org.yuzu.yuzu_emu.utils.NativeConfig
|
|||||||
|
|
||||||
enum class IntSetting(
|
enum class IntSetting(
|
||||||
override val key: String,
|
override val key: String,
|
||||||
override val category: Settings.Category
|
override val category: Settings.Category,
|
||||||
|
override val androidDefault: Int? = null
|
||||||
) : AbstractIntSetting {
|
) : AbstractIntSetting {
|
||||||
CPU_ACCURACY("cpu_accuracy", Settings.Category.Cpu),
|
CPU_ACCURACY("cpu_accuracy", Settings.Category.Cpu),
|
||||||
REGION_INDEX("region_index", Settings.Category.System),
|
REGION_INDEX("region_index", Settings.Category.System),
|
||||||
LANGUAGE_INDEX("language_index", Settings.Category.System),
|
LANGUAGE_INDEX("language_index", Settings.Category.System),
|
||||||
RENDERER_BACKEND("backend", Settings.Category.Renderer),
|
RENDERER_BACKEND("backend", Settings.Category.Renderer),
|
||||||
RENDERER_ACCURACY("gpu_accuracy", Settings.Category.Renderer),
|
RENDERER_ACCURACY("gpu_accuracy", Settings.Category.Renderer, 0),
|
||||||
RENDERER_RESOLUTION("resolution_setup", Settings.Category.Renderer),
|
RENDERER_RESOLUTION("resolution_setup", Settings.Category.Renderer),
|
||||||
RENDERER_VSYNC("use_vsync", Settings.Category.Renderer),
|
RENDERER_VSYNC("use_vsync", Settings.Category.Renderer),
|
||||||
RENDERER_SCALING_FILTER("scaling_filter", Settings.Category.Renderer),
|
RENDERER_SCALING_FILTER("scaling_filter", Settings.Category.Renderer),
|
||||||
@ -27,7 +28,9 @@ enum class IntSetting(
|
|||||||
|
|
||||||
override fun setInt(value: Int) = NativeConfig.setInt(key, value)
|
override fun setInt(value: Int) = NativeConfig.setInt(key, value)
|
||||||
|
|
||||||
override val defaultValue: Int by lazy { NativeConfig.getInt(key, true) }
|
override val defaultValue: Int by lazy {
|
||||||
|
androidDefault ?: NativeConfig.getInt(key, true)
|
||||||
|
}
|
||||||
|
|
||||||
override val valueAsString: String
|
override val valueAsString: String
|
||||||
get() = int.toString()
|
get() = int.toString()
|
||||||
|
Loading…
Reference in New Issue
Block a user