From 5b0a397165ce54b6b7a094530fdd053fbc9d5db0 Mon Sep 17 00:00:00 2001 From: lynxnb Date: Mon, 6 Feb 2023 18:58:07 +0100 Subject: [PATCH] Update native settings after toggling frame throttling --- .../main/java/emu/skyline/EmulationActivity.kt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/emu/skyline/EmulationActivity.kt b/app/src/main/java/emu/skyline/EmulationActivity.kt index 810e986b..0835e850 100644 --- a/app/src/main/java/emu/skyline/EmulationActivity.kt +++ b/app/src/main/java/emu/skyline/EmulationActivity.kt @@ -77,6 +77,8 @@ class EmulationActivity : AppCompatActivity(), SurfaceHolder.Callback, View.OnTo @Inject lateinit var preferenceSettings : PreferenceSettings + lateinit var nativeSettings : NativeSettings + @Inject lateinit var inputManager : InputManager @@ -196,7 +198,7 @@ class EmulationActivity : AppCompatActivity(), SurfaceHolder.Callback, View.OnTo GpuDriverHelper.ensureFileRedirectDir(this) emulationThread = Thread { - executeApplication(rom.toString(), romType, romFd.detachFd(), NativeSettings(this, preferenceSettings), applicationContext.getPublicFilesDir().canonicalPath + "/", applicationContext.filesDir.canonicalPath + "/", applicationInfo.nativeLibraryDir + "/", assets) + executeApplication(rom.toString(), romType, romFd.detachFd(), nativeSettings, applicationContext.getPublicFilesDir().canonicalPath + "/", applicationContext.filesDir.canonicalPath + "/", applicationInfo.nativeLibraryDir + "/", assets) returnFromEmulation() } @@ -208,7 +210,10 @@ class EmulationActivity : AppCompatActivity(), SurfaceHolder.Callback, View.OnTo super.onCreate(savedInstanceState) requestedOrientation = preferenceSettings.orientation window.attributes.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES + inputHandler = InputHandler(inputManager, preferenceSettings) + nativeSettings = NativeSettings(this, preferenceSettings) + setContentView(binding.root) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { @@ -250,9 +255,13 @@ class EmulationActivity : AppCompatActivity(), SurfaceHolder.Callback, View.OnTo } }, 250) setOnClickListener { - preferenceSettings.disableFrameThrottling = !preferenceSettings.disableFrameThrottling - var color = if (preferenceSettings.disableFrameThrottling) getColor(R.color.colorPerfStatsSecondary) else getColor(R.color.colorPerfStatsPrimary) + val newValue = !preferenceSettings.disableFrameThrottling + preferenceSettings.disableFrameThrottling = newValue + nativeSettings.disableFrameThrottling = newValue + + var color = if (newValue) getColor(R.color.colorPerfStatsSecondary) else getColor(R.color.colorPerfStatsPrimary) binding.perfStats.setTextColor(color) + nativeSettings.updateNative() } } }