mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2025-01-04 22:21:52 +01:00
android: Implement Adreno Turbo setting for eligible GPUs (#227)
Co-authored-by: Ishan09811 <156402647+Ishan09811@users.noreply.github.com> Co-authored-by: Gamer64 <76565986+Gamer64ytb@users.noreply.github.com> Co-authored-by: OpenSauce04 <opensauce04@gmail.com>
This commit is contained in:
parent
277914a873
commit
582462808b
@ -172,6 +172,8 @@ object NativeLibrary {
|
||||
fileRedirectDir: String?
|
||||
)
|
||||
|
||||
external fun enableAdrenoTurboMode(enable: Boolean)
|
||||
|
||||
external fun areKeysAvailable(): Boolean
|
||||
|
||||
external fun getHomeMenuPath(region: Int): String
|
||||
|
@ -33,6 +33,7 @@ import io.github.lime3ds.android.contracts.OpenFileResultContract
|
||||
import io.github.lime3ds.android.databinding.ActivityEmulationBinding
|
||||
import io.github.lime3ds.android.display.ScreenAdjustmentUtil
|
||||
import io.github.lime3ds.android.features.hotkeys.HotkeyUtility
|
||||
import io.github.lime3ds.android.features.settings.model.BooleanSetting
|
||||
import io.github.lime3ds.android.features.settings.model.SettingsViewModel
|
||||
import io.github.lime3ds.android.features.settings.model.view.InputBindingSetting
|
||||
import io.github.lime3ds.android.fragments.EmulationFragment
|
||||
@ -73,6 +74,8 @@ class EmulationActivity : AppCompatActivity() {
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
NativeLibrary.enableAdrenoTurboMode(BooleanSetting.ADRENO_GPU_BOOST.boolean)
|
||||
|
||||
binding = ActivityEmulationBinding.inflate(layoutInflater)
|
||||
screenAdjustmentUtil = ScreenAdjustmentUtil(windowManager, settingsViewModel.settings)
|
||||
hotkeyUtility = HotkeyUtility(screenAdjustmentUtil)
|
||||
@ -129,6 +132,7 @@ class EmulationActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
NativeLibrary.enableAdrenoTurboMode(false)
|
||||
EmulationLifecycleUtil.clear()
|
||||
isEmulationRunning = false
|
||||
instance = null
|
||||
|
@ -13,7 +13,8 @@ enum class BooleanSetting(
|
||||
ASYNC_SHADERS("async_shader_compilation", Settings.SECTION_RENDERER, false),
|
||||
PLUGIN_LOADER("plugin_loader", Settings.SECTION_SYSTEM, false),
|
||||
ALLOW_PLUGIN_LOADER("allow_plugin_loader", Settings.SECTION_SYSTEM, true),
|
||||
SWAP_SCREEN("swap_screen", Settings.SECTION_LAYOUT, false);
|
||||
SWAP_SCREEN("swap_screen", Settings.SECTION_LAYOUT, false),
|
||||
ADRENO_GPU_BOOST("adreno_gpu_boost", Settings.SECTION_RENDERER, false);
|
||||
|
||||
override var boolean: Boolean = defaultValue
|
||||
|
||||
@ -33,7 +34,8 @@ enum class BooleanSetting(
|
||||
companion object {
|
||||
private val NOT_RUNTIME_EDITABLE = listOf(
|
||||
PLUGIN_LOADER,
|
||||
ALLOW_PLUGIN_LOADER
|
||||
ALLOW_PLUGIN_LOADER,
|
||||
ADRENO_GPU_BOOST
|
||||
)
|
||||
|
||||
fun from(key: String): BooleanSetting? =
|
||||
|
@ -450,7 +450,7 @@ class SettingsAdapter(
|
||||
R.string.setting_not_editable_description
|
||||
).show((fragmentView as SettingsFragment).childFragmentManager, MessageDialogFragment.TAG)
|
||||
}
|
||||
|
||||
|
||||
fun onClickRegenerateConsoleId() {
|
||||
MaterialAlertDialogBuilder(context)
|
||||
.setTitle(R.string.regenerate_console_id)
|
||||
|
@ -38,6 +38,7 @@ import io.github.lime3ds.android.features.settings.model.view.SwitchSetting
|
||||
import io.github.lime3ds.android.features.settings.utils.SettingsFile
|
||||
import io.github.lime3ds.android.fragments.ResetSettingsDialogFragment
|
||||
import io.github.lime3ds.android.utils.BirthdayMonth
|
||||
import io.github.lime3ds.android.utils.GpuDriverHelper
|
||||
import io.github.lime3ds.android.utils.Log
|
||||
import io.github.lime3ds.android.utils.SystemSaveGame
|
||||
import io.github.lime3ds.android.utils.ThemeUtil
|
||||
@ -724,6 +725,17 @@ class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView)
|
||||
IntSetting.SHADERS_ACCURATE_MUL.defaultValue
|
||||
)
|
||||
)
|
||||
if (GpuDriverHelper.supportsCustomDriverLoading()) {
|
||||
add(
|
||||
SwitchSetting(
|
||||
BooleanSetting.ADRENO_GPU_BOOST,
|
||||
R.string.adreno_gpu_boost,
|
||||
R.string.adreno_gpu_boost_description,
|
||||
BooleanSetting.ADRENO_GPU_BOOST.key,
|
||||
BooleanSetting.ADRENO_GPU_BOOST.defaultValue
|
||||
)
|
||||
)
|
||||
}
|
||||
add(
|
||||
SwitchSetting(
|
||||
IntSetting.DISK_SHADER_CACHE,
|
||||
|
@ -34,13 +34,10 @@ class SwitchSettingViewHolder(val binding: ListItemSettingSwitchBinding, adapter
|
||||
}
|
||||
|
||||
binding.switchWidget.isEnabled = setting.isEditable
|
||||
if (setting.isEditable) {
|
||||
binding.textSettingName.alpha = 1f
|
||||
binding.textSettingDescription.alpha = 1f
|
||||
} else {
|
||||
binding.textSettingName.alpha = 0.5f
|
||||
binding.textSettingDescription.alpha = 0.5f
|
||||
}
|
||||
|
||||
val textAlpha = if (setting.isEditable) 1f else 0.5f
|
||||
binding.textSettingName.alpha = textAlpha
|
||||
binding.textSettingDescription.alpha = textAlpha
|
||||
}
|
||||
|
||||
override fun onClick(clicked: View) {
|
||||
|
@ -257,6 +257,12 @@ static Core::System::ResultStatus RunCitra(const std::string& filepath) {
|
||||
return Core::System::ResultStatus::Success;
|
||||
}
|
||||
|
||||
void EnableAdrenoTurboMode(bool enable) {
|
||||
#if defined(ENABLE_VULKAN) && CITRA_ARCH(arm64)
|
||||
adrenotools_set_turbo(enable);
|
||||
#endif
|
||||
}
|
||||
|
||||
void InitializeGpuDriver(const std::string& hook_lib_dir, const std::string& custom_driver_dir,
|
||||
const std::string& custom_driver_name,
|
||||
const std::string& file_redirect_dir) {
|
||||
@ -334,6 +340,12 @@ void JNICALL Java_io_github_lime3ds_android_NativeLibrary_initializeGpuDriver(
|
||||
GetJString(env, custom_driver_name), GetJString(env, file_redirect_dir));
|
||||
}
|
||||
|
||||
void JNICALL Java_io_github_lime3ds_android_NativeLibrary_enableAdrenoTurboMode(JNIEnv* env,
|
||||
jobject obj,
|
||||
jboolean enable) {
|
||||
EnableAdrenoTurboMode(enable);
|
||||
}
|
||||
|
||||
void Java_io_github_lime3ds_android_NativeLibrary_notifyOrientationChange(
|
||||
[[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj, jint layout_option, jint rotation) {
|
||||
Settings::values.layout_option = static_cast<Settings::LayoutOption>(layout_option);
|
||||
|
@ -263,6 +263,8 @@
|
||||
<string name="use_shader_jit">Shader JIT</string>
|
||||
<string name="use_disk_shader_cache">Disk Shader Cache</string>
|
||||
<string name="use_disk_shader_cache_description">Reduce stuttering by storing and loading generated shaders to disk. It cannot be used without Enabling Hardware Shader.</string>
|
||||
<string name="adreno_gpu_boost">Adreno GPU Boost (Experimental)</string>
|
||||
<string name="adreno_gpu_boost_description">Increases graphics throughput on supported devices, improving performance. Use of this setting can increase power usage and temperature. May cause stability issues on certain devices.</string>
|
||||
<string name="utility">Utility</string>
|
||||
<string name="dump_textures">Dump Textures</string>
|
||||
<string name="dump_textures_description">Textures are dumped to dump/textures/[Title ID]/.</string>
|
||||
|
Loading…
Reference in New Issue
Block a user