Skip to content

Commit

Permalink
给部分机型允许高刷dc
Browse files Browse the repository at this point in the history
  • Loading branch information
hosizoraru committed May 23, 2023
1 parent e70e8ec commit c186ad4
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,13 @@ class PowerKeeperPage : BasePage() {
}
})
)
Line()
TitleText(textId = R.string.scope_mi_settings)
TextSummaryWithSwitch(
TextSummaryV(
textId = R.string.dc_fps,
tipsId = R.string.dc_fps_summary
), SwitchV("dc_fps")
)
}
}
2 changes: 2 additions & 0 deletions app/src/main/kotlin/star/sky/voyager/hook/apps/MiSettings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package star.sky.voyager.hook.apps

import de.robv.android.xposed.callbacks.XC_LoadPackage
import star.sky.voyager.hook.hooks.misettings.CustomRefreshRateS
import star.sky.voyager.hook.hooks.misettings.DcFps
import star.sky.voyager.utils.init.AppRegister

object MiSettings : AppRegister() {
Expand All @@ -11,6 +12,7 @@ object MiSettings : AppRegister() {
autoInitHooks(
lpparam,
CustomRefreshRateS, // 自定义高刷新率应用
DcFps, // 高刷DC同开
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package star.sky.voyager.hook.hooks.misettings

import com.github.kyuubiran.ezxhelper.ClassUtils.loadClass
import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHooks
import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder
import star.sky.voyager.utils.init.HookRegister
import star.sky.voyager.utils.key.hasEnable

object DcFps : HookRegister() {
override fun init() = hasEnable("dc_fps") {
loadClass("miui.util.FeatureParser")
.methodFinder()
.filterByName("getBoolean")
.toList()
.createHooks {
before {
if (it.args[0] == "dc_backlight_fps_incompatible") {
it.result = false
}
}
}
}
}
4 changes: 4 additions & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<string name="scope_guard_provider">Miui安全组件</string>
<string name="scope_pkg_installer">应用包管理组件</string>
<string name="scope_music">音乐</string>
<string name="scope_mi_settings">小米设置</string>

<string name="reboot">重启</string>
<string name="reboot_system">重启系统</string>
Expand Down Expand Up @@ -310,6 +311,9 @@

<string name="remove_open_ad">移除开屏广告</string>

<string name="dc_fps">允许DC+高刷同开</string>
<string name="dc_fps_summary">比如mix4/mi12/mi12s无法高刷dc的机型</string>

<string name="custom_refresh_rate">自定义高刷新率应用</string>
<string name="do_not_clear_app">防止杀死后台应用</string>
<string name="do_not_clear_app_plus">更激进的防止杀死后台应用</string>
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<string name="scope_guard_provider">MiuiGuardProvider</string>
<string name="scope_pkg_installer">Package Installer</string>
<string name="scope_music">Music</string>
<string name="scope_mi_settings">Mi Settings</string>

<string name="reboot">Reboot</string>
<string name="reboot_system">Reboot system</string>
Expand Down Expand Up @@ -313,6 +314,9 @@

<string name="remove_open_ad">Remove AD on Start Activity</string>

<string name="dc_fps">Support DC + HighFps</string>
<string name="dc_fps_summary">for mix4/mi12/mi12s</string>

<string name="custom_refresh_rate">Custom refresh rate</string>
<string name="do_not_clear_app">Prevent killing background apps</string>
<string name="do_not_clear_app_plus">Prevent killing background apps(more aggressive)</string>
Expand Down

0 comments on commit c186ad4

Please sign in to comment.