Skip to content

Commit

Permalink
small code cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
YGOmod committed Dec 30, 2024
1 parent 2c80e7a commit ff692f2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ class PerformanceManager(private val activity: MainActivity) {
fun force60HzRefreshRate(enable: Boolean, activity: MainActivity) {
// Hack for MIUI devices since they don't support the standard Android APIs
try {
val setFpsIntent = Intent("com.miui.powerkeeper.SET_ACTIVITY_FPS")
setFpsIntent.putExtra("package_name", "org.ryujinx.android")
setFpsIntent.putExtra("isEnter", enable)
val setFpsIntent = Intent("com.miui.powerkeeper.SET_ACTIVITY_FPS").apply {
putExtra("package_name", "org.ryujinx.android")
putExtra("isEnter", enable)
}
activity.sendBroadcast(setFpsIntent)
} catch (_: Exception) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.ryujinx.android

import android.app.ActivityManager
import android.content.Context.ACTIVITY_SERVICE
import android.util.Log
import androidx.compose.runtime.MutableState
import java.io.RandomAccessFile

Expand All @@ -10,18 +11,15 @@ class PerformanceMonitor {

fun getFrequencies(frequencies: MutableList<Double>){
frequencies.clear()
for (i in 0..<numberOfCores) {
for (i in 0 until numberOfCores) {
var freq = 0.0
try {
val reader = RandomAccessFile(
"/sys/devices/system/cpu/cpu${i}/cpufreq/scaling_cur_freq",
"r"
)
val f = reader.readLine()
reader.close()
freq = f.toDouble() / 1000.0
RandomAccessFile("/sys/devices/system/cpu/cpu${i}/cpufreq/scaling_cur_freq", "r").use { reader->
val f = reader.readLine()
freq = f.toDouble() / 1000.0
}
} catch (e: Exception) {

Log.e("Performance Monitor", "Failed to read CPU freq", e);
}

frequencies.add(freq)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ class PhysicalControllerManager(val activity: MainActivity) {
}
}
return true
} else if (!isNotFallback) {
} //else if (!isNotFallback) {
return true
}
// }
}

return false
}

fun onMotionEvent(ev: MotionEvent) {
if (true) {
// if (true) {
if (ev.action == MotionEvent.ACTION_MOVE) {
val leftStickX = ev.getAxisValue(MotionEvent.AXIS_X)
val leftStickY = ev.getAxisValue(MotionEvent.AXIS_Y)
Expand Down Expand Up @@ -121,7 +121,7 @@ class PhysicalControllerManager(val activity: MainActivity) {
}
}
}
}
// }
}

fun connect(): Int {
Expand Down

0 comments on commit ff692f2

Please sign in to comment.