feat: Add sync core speed setting

- Implemented `useSyncCoreSpeedSetting` to handle `BooleanSetting.SYNC_CORE_SPEED`.
- Mirrored structure from the existing multi-core setting for consistency.
This commit is contained in:
Phoenix 2024-09-11 18:18:40 +10:00
parent 651e8960f7
commit a707ba7c14
2 changed files with 22 additions and 3 deletions

View File

@ -28,7 +28,7 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting {
TOUCHSCREEN("touchscreen"),
SHOW_THERMAL_OVERLAY("show_thermal_overlay"),
CORE_USE_MULTI_CORE("use_multi_core"),
CORE_SYNC_SPEED("core_sync_speed");
SYNC_CORE_SPEED("sync_core_speed");
override fun getBoolean(needsGlobal: Boolean): Boolean =
NativeConfig.getBoolean(key, needsGlobal)

View File

@ -177,7 +177,7 @@ private fun addPhoenixHacksSubmenu(sl: ArrayList<SettingsItem>) {
// Add settings using keys directly
add(BooleanSetting.CORE_USE_MULTI_CORE.key)
add(BooleanSetting.CORE_SYNC_SPEED.key)
add(BooleanSetting.SYNC_CORE_SPEED.key)
add(IntSetting.RENDERER_SHADER_BACKEND.key)
add(IntSetting.RENDERER_NVDEC_EMULATION.key)
add(IntSetting.RENDERER_ASTC_DECODE_METHOD.key)
@ -186,6 +186,25 @@ private fun addPhoenixHacksSubmenu(sl: ArrayList<SettingsItem>) {
}
}
private val useSyncCoreSpeedSetting = object : AbstractBooleanSetting {
override val key = BooleanSetting.SYNC_CORE_SPEED.key
override fun getBoolean(needsGlobal: Boolean): Boolean {
return BooleanSetting.SYNC_CORE_SPEED.getBoolean(needsGlobal)
}
override fun setBoolean(value: Boolean) {
BooleanSetting.SYNC_CORE_SPEED.setBoolean(value)
}
override val defaultValue = BooleanSetting.SYNC_CORE_SPEED.defaultValue
override fun getValueAsString(needsGlobal: Boolean): String =
BooleanSetting.SYNC_CORE_SPEED.getValueAsString(needsGlobal)
override fun reset() = BooleanSetting.SYNC_CORE_SPEED.reset()
}
private val useMultiCoreSetting = object : AbstractBooleanSetting {
override val key = BooleanSetting.CORE_USE_MULTI_CORE.key
@ -210,7 +229,7 @@ private fun addPhoenixHacksSettings(sl: ArrayList<SettingsItem>) {
// Add the multi-core setting to Phoenix Hacks submenu
add(
SwitchSetting(
BooleanSetting.CORE_SYNC_SPEED,
useSyncCoreSpeedSetting,
titleId = R.string.sync_core_speed,
descriptionId = R.string.sync_core_speed_description
)