mirror of
https://github.com/azahar-emu/azahar
synced 2025-11-06 15:09:58 +01:00
android: Reimplemented performance overlay setting as a regular BooleanSetting
This commit is contained in:
parent
5c89977605
commit
ed451a72d9
@ -19,6 +19,7 @@ enum class BooleanSetting(
|
|||||||
INSTANT_DEBUG_LOG("instant_debug_log", Settings.SECTION_DEBUG, false),
|
INSTANT_DEBUG_LOG("instant_debug_log", Settings.SECTION_DEBUG, false),
|
||||||
ENABLE_RPC_SERVER("enable_rpc_server", Settings.SECTION_DEBUG, false),
|
ENABLE_RPC_SERVER("enable_rpc_server", Settings.SECTION_DEBUG, false),
|
||||||
CUSTOM_LAYOUT("custom_layout",Settings.SECTION_LAYOUT,false),
|
CUSTOM_LAYOUT("custom_layout",Settings.SECTION_LAYOUT,false),
|
||||||
|
OVERLAY_ENABLE("overlay_enable", Settings.SECTION_LAYOUT, false),
|
||||||
OVERLAY_SHOW_FPS("overlay_show_fps", Settings.SECTION_LAYOUT, true),
|
OVERLAY_SHOW_FPS("overlay_show_fps", Settings.SECTION_LAYOUT, true),
|
||||||
OVERLAY_SHOW_FRAMETIME("overlay_show_frame_time", Settings.SECTION_LAYOUT, false),
|
OVERLAY_SHOW_FRAMETIME("overlay_show_frame_time", Settings.SECTION_LAYOUT, false),
|
||||||
OVERLAY_SHOW_SPEED("overlay_show_speed", Settings.SECTION_LAYOUT, false),
|
OVERLAY_SHOW_SPEED("overlay_show_speed", Settings.SECTION_LAYOUT, false),
|
||||||
|
|||||||
@ -1293,20 +1293,11 @@ class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView)
|
|||||||
|
|
||||||
add(
|
add(
|
||||||
SwitchSetting(
|
SwitchSetting(
|
||||||
object : AbstractBooleanSetting {
|
BooleanSetting.OVERLAY_ENABLE,
|
||||||
override val key = null
|
|
||||||
override val section = Settings.SECTION_LAYOUT
|
|
||||||
override val defaultValue = false
|
|
||||||
override var boolean: Boolean
|
|
||||||
get() = EmulationMenuSettings.showPerformanceOverlay
|
|
||||||
set(value) { EmulationMenuSettings.showPerformanceOverlay = value }
|
|
||||||
override val isRuntimeEditable = true
|
|
||||||
override val valueAsString: String get() = boolean.toString()
|
|
||||||
},
|
|
||||||
R.string.performance_overlay_enable,
|
R.string.performance_overlay_enable,
|
||||||
0,
|
0,
|
||||||
null,
|
BooleanSetting.OVERLAY_ENABLE.key,
|
||||||
false
|
BooleanSetting.OVERLAY_ENABLE.defaultValue
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -66,6 +66,7 @@ import org.citra.citra_emu.display.ScreenAdjustmentUtil
|
|||||||
import org.citra.citra_emu.display.ScreenLayout
|
import org.citra.citra_emu.display.ScreenLayout
|
||||||
import org.citra.citra_emu.features.settings.model.BooleanSetting
|
import org.citra.citra_emu.features.settings.model.BooleanSetting
|
||||||
import org.citra.citra_emu.features.settings.model.IntSetting
|
import org.citra.citra_emu.features.settings.model.IntSetting
|
||||||
|
import org.citra.citra_emu.features.settings.model.Settings
|
||||||
import org.citra.citra_emu.features.settings.model.SettingsViewModel
|
import org.citra.citra_emu.features.settings.model.SettingsViewModel
|
||||||
import org.citra.citra_emu.features.settings.ui.SettingsActivity
|
import org.citra.citra_emu.features.settings.ui.SettingsActivity
|
||||||
import org.citra.citra_emu.features.settings.utils.SettingsFile
|
import org.citra.citra_emu.features.settings.utils.SettingsFile
|
||||||
@ -100,6 +101,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
|
|||||||
|
|
||||||
private val emulationViewModel: EmulationViewModel by activityViewModels()
|
private val emulationViewModel: EmulationViewModel by activityViewModels()
|
||||||
private val settingsViewModel: SettingsViewModel by viewModels()
|
private val settingsViewModel: SettingsViewModel by viewModels()
|
||||||
|
private val settings get() = settingsViewModel.settings
|
||||||
|
|
||||||
private val onPause = Runnable{ togglePause() }
|
private val onPause = Runnable{ togglePause() }
|
||||||
private val onShutdown = Runnable{ emulationState.stop() }
|
private val onShutdown = Runnable{ emulationState.stop() }
|
||||||
@ -158,7 +160,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
|
|||||||
retainInstance = true
|
retainInstance = true
|
||||||
emulationState = EmulationState(game.path)
|
emulationState = EmulationState(game.path)
|
||||||
emulationActivity = requireActivity() as EmulationActivity
|
emulationActivity = requireActivity() as EmulationActivity
|
||||||
screenAdjustmentUtil = ScreenAdjustmentUtil(requireContext(), requireActivity().windowManager, settingsViewModel.settings)
|
screenAdjustmentUtil = ScreenAdjustmentUtil(requireContext(), requireActivity().windowManager, settings)
|
||||||
EmulationLifecycleUtil.addPauseResumeHook(onPause)
|
EmulationLifecycleUtil.addPauseResumeHook(onPause)
|
||||||
EmulationLifecycleUtil.addShutdownHook(onShutdown)
|
EmulationLifecycleUtil.addShutdownHook(onShutdown)
|
||||||
}
|
}
|
||||||
@ -671,7 +673,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
|
|||||||
popupMenu.menu.apply {
|
popupMenu.menu.apply {
|
||||||
findItem(R.id.menu_show_overlay).isChecked = EmulationMenuSettings.showOverlay
|
findItem(R.id.menu_show_overlay).isChecked = EmulationMenuSettings.showOverlay
|
||||||
findItem(R.id.menu_performance_overlay_show).isChecked =
|
findItem(R.id.menu_performance_overlay_show).isChecked =
|
||||||
EmulationMenuSettings.showPerformanceOverlay
|
BooleanSetting.OVERLAY_ENABLE.boolean
|
||||||
findItem(R.id.menu_haptic_feedback).isChecked = EmulationMenuSettings.hapticFeedback
|
findItem(R.id.menu_haptic_feedback).isChecked = EmulationMenuSettings.hapticFeedback
|
||||||
findItem(R.id.menu_emulation_joystick_rel_center).isChecked =
|
findItem(R.id.menu_emulation_joystick_rel_center).isChecked =
|
||||||
EmulationMenuSettings.joystickRelCenter
|
EmulationMenuSettings.joystickRelCenter
|
||||||
@ -688,7 +690,8 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
|
|||||||
}
|
}
|
||||||
|
|
||||||
R.id.menu_performance_overlay_show -> {
|
R.id.menu_performance_overlay_show -> {
|
||||||
EmulationMenuSettings.showPerformanceOverlay = !EmulationMenuSettings.showPerformanceOverlay
|
BooleanSetting.OVERLAY_ENABLE.boolean = !BooleanSetting.OVERLAY_ENABLE.boolean
|
||||||
|
settings.saveSetting(BooleanSetting.OVERLAY_ENABLE, SettingsFile.FILE_NAME_CONFIG)
|
||||||
updateShowPerformanceOverlay()
|
updateShowPerformanceOverlay()
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
@ -1211,7 +1214,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
|
|||||||
perfStatsUpdateHandler.removeCallbacks(perfStatsUpdater!!)
|
perfStatsUpdateHandler.removeCallbacks(perfStatsUpdater!!)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EmulationMenuSettings.showPerformanceOverlay) {
|
if (BooleanSetting.OVERLAY_ENABLE.boolean) {
|
||||||
val SYSTEM_FPS = 0
|
val SYSTEM_FPS = 0
|
||||||
val FPS = 1
|
val FPS = 1
|
||||||
val SPEED = 2
|
val SPEED = 2
|
||||||
|
|||||||
@ -35,13 +35,6 @@ object EmulationMenuSettings {
|
|||||||
.apply()
|
.apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
var showPerformanceOverlay: Boolean
|
|
||||||
get() = preferences.getBoolean("EmulationMenuSettings_showPerformanceOverlay", false)
|
|
||||||
set(value) {
|
|
||||||
preferences.edit()
|
|
||||||
.putBoolean("EmulationMenuSettings_showPerformanceOverlay", value)
|
|
||||||
.apply()
|
|
||||||
}
|
|
||||||
var hapticFeedback: Boolean
|
var hapticFeedback: Boolean
|
||||||
get() = preferences.getBoolean("EmulationMenuSettings_HapticFeedback", true)
|
get() = preferences.getBoolean("EmulationMenuSettings_HapticFeedback", true)
|
||||||
set(value) {
|
set(value) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user