aboutsummaryrefslogtreecommitdiff
path: root/src/android
diff options
context:
space:
mode:
authorcrueter <crueter@eden-emu.dev>2025-07-11 10:05:01 +0200
committercrueter <crueter@eden-emu.dev>2025-07-11 10:05:01 +0200
commite5074c90ad5bdd94e24cd339ea09c83a1006d1c2 (patch)
tree0b5fe56324b6b6baed0b5383de9a842ace109ba4 /src/android
parent2f421923a64006605adeb1b1d8466d56346c8a8b (diff)
[android] Fix charging indicator and dynamic state setting (#36)
Co-authored-by: Pavel Barabanov <pavelbarabanov94@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/36
Diffstat (limited to 'src/android')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SingleChoiceSetting.kt9
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt8
-rw-r--r--src/android/app/src/main/res/values/strings.xml6
3 files changed, 18 insertions, 5 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SingleChoiceSetting.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SingleChoiceSetting.kt
index 624bc2445c..aea72946f7 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SingleChoiceSetting.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SingleChoiceSetting.kt
@@ -5,6 +5,7 @@ package org.yuzu.yuzu_emu.features.settings.model.view
import androidx.annotation.ArrayRes
import androidx.annotation.StringRes
+import org.yuzu.yuzu_emu.features.settings.model.AbstractByteSetting
import org.yuzu.yuzu_emu.features.settings.model.AbstractIntSetting
import org.yuzu.yuzu_emu.features.settings.model.AbstractSetting
@@ -24,8 +25,14 @@ class SingleChoiceSetting(
fun getSelectedValue(needsGlobal: Boolean = false) =
when (setting) {
is AbstractIntSetting -> setting.getInt(needsGlobal)
+ is AbstractByteSetting -> setting.getByte(needsGlobal).toInt()
else -> -1
}
- fun setSelectedValue(value: Int) = (setting as AbstractIntSetting).setInt(value)
+ fun setSelectedValue(value: Int) =
+ when (setting) {
+ is AbstractIntSetting -> setting.setInt(value)
+ is AbstractByteSetting -> setting.setByte(value.toByte())
+ else -> -1
+ }
}
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt
index 05c14e278d..6cce31a4eb 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt
@@ -643,13 +643,19 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
val battery: BatteryManager =
requireContext().getSystemService(Context.BATTERY_SERVICE) as BatteryManager
+ val batteryIntent = requireContext().registerReceiver(null,
+ IntentFilter(Intent.ACTION_BATTERY_CHANGED))
val capacity = battery.getIntProperty(BATTERY_PROPERTY_CAPACITY)
val nowUAmps = battery.getIntProperty(BATTERY_PROPERTY_CURRENT_NOW)
sb.append(String.format("%.1fA (%d%%)", nowUAmps / 1000000.0, capacity))
- if (battery.isCharging || nowUAmps > 0.0) {
+ val status = batteryIntent?.getIntExtra(BatteryManager.EXTRA_STATUS, -1)
+ val isCharging = status == BatteryManager.BATTERY_STATUS_CHARGING ||
+ status == BatteryManager.BATTERY_STATUS_FULL
+
+ if (isCharging) {
sb.append(" ${getString(R.string.charging)}")
}
}
diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml
index ac9141863c..602be31027 100644
--- a/src/android/app/src/main/res/values/strings.xml
+++ b/src/android/app/src/main/res/values/strings.xml
@@ -74,7 +74,7 @@
<string name="veil_extensions">GPU Extensions</string>
<string name="dyna_state">Extended Dynamic State</string>
- <string name="dyna_state_description">Enables Vulkan features to improve performance, rendering, and save resources on pipeline creation while maintaining lower CPU/GPU usage. These extensions may increase device temperature, and GPUs belonging to the older A6XX line may not react properly. Set to 0 to use Legacy emulated formats.</string>
+ <string name="dyna_state_description">Enables Vulkan features to improve performance, rendering, and save resources on pipeline creation while maintaining lower CPU/GPU usage. These extensions may increase device temperature, and GPUs belonging to the older A6XX line may not react properly. Disable to emulate scaled formats.</string>
<string name="disabled">Disabled</string>
<string name="provoking_vertex">Provoking Vertex</string>
<string name="provoking_vertex_description">Improves lighting and vertex handling in certain games. Only supported on Vulkan 1.0+ GPUs.</string>
@@ -95,11 +95,11 @@
<string name="firmware_uninstalling">Uninstalling firmware</string>
<string name="firmware_uninstalled_success">Firmware uninstalled successfully</string>
- <string name="veil_misc">Miscellaneous</string>
+ <string name="veil_misc">CPU and Memory</string>
<string name="use_sync_core">Synchronize Core Speed</string>
<string name="use_sync_core_description">Synchronize the core tick speed to the maximum speed percentage to improve performance without altering the game\'s actual speed.</string>
<string name="use_lru_cache">Enable LRU Cache</string>
- <string name="use_lru_cache_description">Enable or disable the Least Recently Used (LRU) cache, increasing performance by saving CPU process usage. Some games have issue with it, notably TotK 1.2.1, so disable if the game doesn\'t boot or crashes randomly.</string>
+ <string name="use_lru_cache_description">Enable or disable the Least Recently Used (LRU) cache, increasing performance by saving CPU process usage. Some games have issues with it, notably TotK 1.2.1, so disable if the game doesn\'t boot or crashes randomly.</string>
<string name="use_fast_cpu_time">Fast CPU Time</string>
<string name="use_fast_cpu_time_description">Forces the emulated CPU to run at a higher clock, reducing certain FPS limiters. This option is hacky and may cause issues, and weaker CPUs may see reduced performance.</string>
<string name="custom_cpu_ticks">Custom CPU Ticks</string>