android: Rename performance overlay setting keys, strings and enums for clarity

This commit is contained in:
OpenSauce04 2025-09-10 21:36:35 +01:00 committed by OpenSauce
parent f27490aeab
commit 72c924a456
5 changed files with 88 additions and 88 deletions

View File

@ -19,14 +19,14 @@ enum class BooleanSetting(
INSTANT_DEBUG_LOG("instant_debug_log", Settings.SECTION_DEBUG, false),
ENABLE_RPC_SERVER("enable_rpc_server", Settings.SECTION_DEBUG, 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_FRAMETIME("overlay_show_frame_time", Settings.SECTION_LAYOUT, false),
OVERLAY_SHOW_SPEED("overlay_show_speed", Settings.SECTION_LAYOUT, false),
OVERLAY_SHOW_APP_RAM_USAGE("overlay_show_app_ram_usage", Settings.SECTION_LAYOUT, false),
OVERLAY_SHOW_AVAILABLE_RAM("overlay_show_available_ram", Settings.SECTION_LAYOUT, false),
OVERLAY_SHOW_BATTERY_TEMP("overlay_show_battery_temp", Settings.SECTION_LAYOUT, false),
OVERLAY_BACKGROUND("overlay_background", Settings.SECTION_LAYOUT, false),
PERF_OVERLAY_ENABLE("performance_overlay_enable", Settings.SECTION_LAYOUT, false),
PERF_OVERLAY_SHOW_FPS("performance_overlay_show_fps", Settings.SECTION_LAYOUT, true),
PERF_OVERLAY_SHOW_FRAMETIME("performance_overlay_show_frame_time", Settings.SECTION_LAYOUT, false),
PERF_OVERLAY_SHOW_SPEED("performance_overlay_show_speed", Settings.SECTION_LAYOUT, false),
PERF_OVERLAY_SHOW_APP_RAM_USAGE("performance_overlay_show_app_ram_usage", Settings.SECTION_LAYOUT, false),
PERF_OVERLAY_SHOW_AVAILABLE_RAM("performance_overlay_show_available_ram", Settings.SECTION_LAYOUT, false),
PERF_OVERLAY_SHOW_BATTERY_TEMP("performance_overlay_show_battery_temp", Settings.SECTION_LAYOUT, false),
PERF_OVERLAY_BACKGROUND("performance_overlay_background", Settings.SECTION_LAYOUT, false),
DELAY_START_LLE_MODULES("delay_start_for_lle_modules", Settings.SECTION_DEBUG, true),
DETERMINISTIC_ASYNC_OPERATIONS("deterministic_async_operations", Settings.SECTION_DEBUG, false),
REQUIRED_ONLINE_LLE_MODULES("enable_required_online_lle_modules", Settings.SECTION_SYSTEM, false),
@ -86,7 +86,7 @@ enum class BooleanSetting(
USE_ARTIC_BASE_CONTROLLER,
COMPRESS_INSTALLED_CIA_CONTENT,
ANDROID_HIDE_IMAGES,
OVERLAY_ENABLE // Works in overlay options, but not from the settings menu
PERF_OVERLAY_ENABLE // Works in overlay options, but not from the settings menu
)
fun from(key: String): BooleanSetting? =

View File

@ -1293,29 +1293,29 @@ class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView)
add(
SwitchSetting(
BooleanSetting.OVERLAY_ENABLE,
BooleanSetting.PERF_OVERLAY_ENABLE,
R.string.performance_overlay_enable,
0,
BooleanSetting.OVERLAY_ENABLE.key,
BooleanSetting.OVERLAY_ENABLE.defaultValue
BooleanSetting.PERF_OVERLAY_ENABLE.key,
BooleanSetting.PERF_OVERLAY_ENABLE.defaultValue
)
)
add(
SwitchSetting(
BooleanSetting.OVERLAY_BACKGROUND,
R.string.overlay_background,
R.string.overlay_background_description,
BooleanSetting.OVERLAY_BACKGROUND.key,
BooleanSetting.OVERLAY_BACKGROUND.defaultValue
BooleanSetting.PERF_OVERLAY_BACKGROUND,
R.string.performance_overlay_background,
R.string.performance_overlay_background_description,
BooleanSetting.PERF_OVERLAY_BACKGROUND.key,
BooleanSetting.PERF_OVERLAY_BACKGROUND.defaultValue
)
)
add(
SingleChoiceSetting(
IntSetting.PERFORMANCE_OVERLAY_POSITION,
R.string.overlay_position,
R.string.overlay_position_description,
R.string.performance_overlay_position,
R.string.performance_overlay_position_description,
R.array.statsPosition,
R.array.statsPositionValues,
)
@ -1326,61 +1326,61 @@ class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView)
add(
SwitchSetting(
BooleanSetting.OVERLAY_SHOW_FPS,
R.string.overlay_show_fps,
R.string.overlay_show_fps_description,
BooleanSetting.OVERLAY_SHOW_FPS.key,
BooleanSetting.OVERLAY_SHOW_FPS.defaultValue
BooleanSetting.PERF_OVERLAY_SHOW_FPS,
R.string.performance_overlay_show_fps,
R.string.performance_overlay_show_fps_description,
BooleanSetting.PERF_OVERLAY_SHOW_FPS.key,
BooleanSetting.PERF_OVERLAY_SHOW_FPS.defaultValue
)
)
add(
SwitchSetting(
BooleanSetting.OVERLAY_SHOW_FRAMETIME,
R.string.overlay_show_frametime,
R.string.overlay_show_frametime_description,
BooleanSetting.OVERLAY_SHOW_FRAMETIME.key,
BooleanSetting.OVERLAY_SHOW_FRAMETIME.defaultValue
BooleanSetting.PERF_OVERLAY_SHOW_FRAMETIME,
R.string.performance_overlay_show_frametime,
R.string.performance_overlay_show_frametime_description,
BooleanSetting.PERF_OVERLAY_SHOW_FRAMETIME.key,
BooleanSetting.PERF_OVERLAY_SHOW_FRAMETIME.defaultValue
)
)
add(
SwitchSetting(
BooleanSetting.OVERLAY_SHOW_SPEED,
R.string.overlay_show_speed,
R.string.overlay_show_speed_description,
BooleanSetting.OVERLAY_SHOW_SPEED.key,
BooleanSetting.OVERLAY_SHOW_SPEED.defaultValue
BooleanSetting.PERF_OVERLAY_SHOW_SPEED,
R.string.performance_overlay_show_speed,
R.string.performance_overlay_show_speed_description,
BooleanSetting.PERF_OVERLAY_SHOW_SPEED.key,
BooleanSetting.PERF_OVERLAY_SHOW_SPEED.defaultValue
)
)
add(
SwitchSetting(
BooleanSetting.OVERLAY_SHOW_APP_RAM_USAGE,
R.string.overlay_show_app_ram_usage,
R.string.overlay_show_app_ram_usage_description,
BooleanSetting.OVERLAY_SHOW_APP_RAM_USAGE.key,
BooleanSetting.OVERLAY_SHOW_APP_RAM_USAGE.defaultValue
BooleanSetting.PERF_OVERLAY_SHOW_APP_RAM_USAGE,
R.string.performance_overlay_show_app_ram_usage,
R.string.performance_overlay_show_app_ram_usage_description,
BooleanSetting.PERF_OVERLAY_SHOW_APP_RAM_USAGE.key,
BooleanSetting.PERF_OVERLAY_SHOW_APP_RAM_USAGE.defaultValue
)
)
add(
SwitchSetting(
BooleanSetting.OVERLAY_SHOW_AVAILABLE_RAM,
R.string.overlay_show_available_ram,
R.string.overlay_show_available_ram_description,
BooleanSetting.OVERLAY_SHOW_AVAILABLE_RAM.key,
BooleanSetting.OVERLAY_SHOW_AVAILABLE_RAM.defaultValue
BooleanSetting.PERF_OVERLAY_SHOW_AVAILABLE_RAM,
R.string.performance_overlay_show_available_ram,
R.string.performance_overlay_show_available_ram_description,
BooleanSetting.PERF_OVERLAY_SHOW_AVAILABLE_RAM.key,
BooleanSetting.PERF_OVERLAY_SHOW_AVAILABLE_RAM.defaultValue
)
)
add(
SwitchSetting(
BooleanSetting.OVERLAY_SHOW_BATTERY_TEMP,
R.string.overlay_show_battery_temp,
R.string.overlay_show_battery_temp_description,
BooleanSetting.OVERLAY_SHOW_BATTERY_TEMP.key,
BooleanSetting.OVERLAY_SHOW_BATTERY_TEMP.defaultValue
BooleanSetting.PERF_OVERLAY_SHOW_BATTERY_TEMP,
R.string.performance_overlay_show_battery_temp,
R.string.performance_overlay_show_battery_temp_description,
BooleanSetting.PERF_OVERLAY_SHOW_BATTERY_TEMP.key,
BooleanSetting.PERF_OVERLAY_SHOW_BATTERY_TEMP.defaultValue
)
)
}

View File

@ -673,7 +673,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
popupMenu.menu.apply {
findItem(R.id.menu_show_overlay).isChecked = EmulationMenuSettings.showOverlay
findItem(R.id.menu_performance_overlay_show).isChecked =
BooleanSetting.OVERLAY_ENABLE.boolean
BooleanSetting.PERF_OVERLAY_ENABLE.boolean
findItem(R.id.menu_haptic_feedback).isChecked = EmulationMenuSettings.hapticFeedback
findItem(R.id.menu_emulation_joystick_rel_center).isChecked =
EmulationMenuSettings.joystickRelCenter
@ -690,8 +690,8 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
}
R.id.menu_performance_overlay_show -> {
BooleanSetting.OVERLAY_ENABLE.boolean = !BooleanSetting.OVERLAY_ENABLE.boolean
settings.saveSetting(BooleanSetting.OVERLAY_ENABLE, SettingsFile.FILE_NAME_CONFIG)
BooleanSetting.PERF_OVERLAY_ENABLE.boolean = !BooleanSetting.PERF_OVERLAY_ENABLE.boolean
settings.saveSetting(BooleanSetting.PERF_OVERLAY_ENABLE, SettingsFile.FILE_NAME_CONFIG)
updateShowPerformanceOverlay()
true
}
@ -1214,7 +1214,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
perfStatsUpdateHandler.removeCallbacks(perfStatsUpdater!!)
}
if (BooleanSetting.OVERLAY_ENABLE.boolean) {
if (BooleanSetting.PERF_OVERLAY_ENABLE.boolean) {
val SYSTEM_FPS = 0
val FPS = 1
val SPEED = 2
@ -1229,11 +1229,11 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
val perfStats = NativeLibrary.getPerfStats()
val dividerString = "\u00A0\u2502 "
if (perfStats[FPS] > 0) {
if (BooleanSetting.OVERLAY_SHOW_FPS.boolean) {
if (BooleanSetting.PERF_OVERLAY_SHOW_FPS.boolean) {
sb.append(String.format("FPS:\u00A0%d", (perfStats[FPS] + 0.5).toInt()))
}
if (BooleanSetting.OVERLAY_SHOW_FRAMETIME.boolean) {
if (BooleanSetting.PERF_OVERLAY_SHOW_FRAMETIME.boolean) {
if (sb.isNotEmpty()) sb.append(dividerString)
sb.append(
String.format(
@ -1248,7 +1248,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
)
}
if (BooleanSetting.OVERLAY_SHOW_SPEED.boolean) {
if (BooleanSetting.PERF_OVERLAY_SHOW_SPEED.boolean) {
if (sb.isNotEmpty()) sb.append(dividerString)
sb.append(
String.format(
@ -1258,14 +1258,14 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
)
}
if (BooleanSetting.OVERLAY_SHOW_APP_RAM_USAGE.boolean) {
if (BooleanSetting.PERF_OVERLAY_SHOW_APP_RAM_USAGE.boolean) {
if (sb.isNotEmpty()) sb.append(dividerString)
val appRamUsage =
File("/proc/self/statm").readLines()[0].split(' ')[1].toLong() * 4096 / 1000000
sb.append("Process\u00A0RAM:\u00A0$appRamUsage\u00A0MB")
}
if (BooleanSetting.OVERLAY_SHOW_AVAILABLE_RAM.boolean) {
if (BooleanSetting.PERF_OVERLAY_SHOW_AVAILABLE_RAM.boolean) {
if (sb.isNotEmpty()) sb.append(dividerString)
context?.let { ctx ->
val activityManager =
@ -1278,14 +1278,14 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
}
}
if (BooleanSetting.OVERLAY_SHOW_BATTERY_TEMP.boolean) {
if (BooleanSetting.PERF_OVERLAY_SHOW_BATTERY_TEMP.boolean) {
if (sb.isNotEmpty()) sb.append(dividerString)
val batteryTemp = getBatteryTemperature()
val tempF = celsiusToFahrenheit(batteryTemp)
sb.append(String.format("%.1f°C/%.1f°F", batteryTemp, tempF))
}
if (BooleanSetting.OVERLAY_BACKGROUND.boolean) {
if (BooleanSetting.PERF_OVERLAY_BACKGROUND.boolean) {
binding.performanceOverlayShowText.setBackgroundResource(R.color.citra_transparent_black)
} else {
binding.performanceOverlayShowText.setBackgroundResource(0)

View File

@ -148,12 +148,12 @@
</integer-array>
<string-array name="statsPosition">
<item>@string/overlay_position_top_left</item>
<item>@string/overlay_position_center_top</item>
<item>@string/overlay_position_top_right</item>
<item>@string/overlay_position_bottom_left</item>
<item>@string/overlay_position_center_bottom</item>
<item>@string/overlay_position_bottom_right</item>
<item>@string/performance_overlay_position_top_left</item>
<item>@string/performance_overlay_position_center_top</item>
<item>@string/performance_overlay_position_top_right</item>
<item>@string/performance_overlay_position_bottom_left</item>
<item>@string/performance_overlay_position_center_bottom</item>
<item>@string/performance_overlay_position_bottom_right</item>
</string-array>
<integer-array name="statsPositionValues">
<item>0</item>

View File

@ -585,28 +585,28 @@
<string name="performance_overlay_options">Performance Overlay</string>
<string name="performance_overlay_enable">Enable Performance Overlay</string>
<string name="performance_overlay_options_description">Configure whether the performance overlay is shown and what information is displayed.</string>
<string name="overlay_show_fps">Show FPS</string>
<string name="overlay_show_fps_description">Display current frames per second.</string>
<string name="overlay_show_frametime">Show Frametime</string>
<string name="overlay_show_frametime_description">Display current frametime.</string>
<string name="overlay_show_speed">Show Speed</string>
<string name="overlay_show_speed_description">Display current emulation speed percentage.</string>
<string name="overlay_show_app_ram_usage">Show App Memory Usage</string>
<string name="overlay_show_app_ram_usage_description">Display the amount of RAM getting used by the emulator.</string>
<string name="overlay_show_available_ram">Show Available Memory</string>
<string name="overlay_show_available_ram_description">Display the amount of RAM which is available.</string>
<string name="overlay_show_battery_temp">Show Battery Temperature</string>
<string name="overlay_show_battery_temp_description">Display current Battery temperature in Celsius and Fahrenheit.</string>
<string name="overlay_position">Overlay Position</string>
<string name="overlay_position_description">Choose where the performance overlay is displayed on the screen.</string>
<string name="overlay_position_top_left">Top Left</string>
<string name="overlay_position_top_right">Top Right</string>
<string name="overlay_position_bottom_left">Bottom Left</string>
<string name="overlay_position_bottom_right">Bottom Right</string>
<string name="overlay_position_center_top">Center Top</string>
<string name="overlay_position_center_bottom">Center Bottom</string>
<string name="overlay_background">Overlay Background</string>
<string name="overlay_background_description">Adds a background behind the overlay for easier reading.</string>
<string name="performance_overlay_show_fps">Show FPS</string>
<string name="performance_overlay_show_fps_description">Display current frames per second.</string>
<string name="performance_overlay_show_frametime">Show Frametime</string>
<string name="performance_overlay_show_frametime_description">Display current frametime.</string>
<string name="performance_overlay_show_speed">Show Speed</string>
<string name="performance_overlay_show_speed_description">Display current emulation speed percentage.</string>
<string name="performance_overlay_show_app_ram_usage">Show App Memory Usage</string>
<string name="performance_overlay_show_app_ram_usage_description">Display the amount of RAM getting used by the emulator.</string>
<string name="performance_overlay_show_available_ram">Show Available Memory</string>
<string name="performance_overlay_show_available_ram_description">Display the amount of RAM which is available.</string>
<string name="performance_overlay_show_battery_temp">Show Battery Temperature</string>
<string name="performance_overlay_show_battery_temp_description">Display current Battery temperature in Celsius and Fahrenheit.</string>
<string name="performance_overlay_position">Overlay Position</string>
<string name="performance_overlay_position_description">Choose where the performance overlay is displayed on the screen.</string>
<string name="performance_overlay_position_top_left">Top Left</string>
<string name="performance_overlay_position_top_right">Top Right</string>
<string name="performance_overlay_position_bottom_left">Bottom Left</string>
<string name="performance_overlay_position_bottom_right">Bottom Right</string>
<string name="performance_overlay_position_center_top">Center Top</string>
<string name="performance_overlay_position_center_bottom">Center Bottom</string>
<string name="performance_overlay_background">Overlay Background</string>
<string name="performance_overlay_background_description">Adds a background behind the overlay for easier reading.</string>
<!-- Cheats -->
<string name="cheats">Cheats</string>