Feat:Add per-game frame generation profiles (#2473)

This commit is contained in:
LunaDL authored and GitHub committed 2026-11-12 14:36:55 -05:00
1 parent b1b6ab7931
commit b52ce7e4c5
46 files changed
+598 -43

No files matched your search

@@ -2,6 +2,8 @@ package com.droiddeck.launcher.gpu
import android.content.Context
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@@ -45,4 +47,22 @@ class FrameGenTest {
.putString("engine", "winfg").putInt("multiplier", 2).commit()
assertEquals(FrameGen.Mode(FrameGen.ENGINE_DDFG, 2), FrameGen.mode(context))
}
@Test fun perGameOverrideIsIsolatedFromGlobalMode() {
val global = FrameGen.Mode(FrameGen.ENGINE_LSFG, target = 90)
val game = FrameGen.Mode(FrameGen.ENGINE_DDFG, 3)
FrameGen.set(context, global)
FrameGen.setForGame(context, "12345", game)
assertEquals(global, FrameGen.mode(context))
assertEquals(game, FrameGen.mode(context, "12345"))
assertTrue(FrameGen.hasGameOverride(context, "12345"))
FrameGen.clearGame(context, "12345")
assertFalse(FrameGen.hasGameOverride(context, "12345"))
assertEquals(global, FrameGen.mode(context, "12345"))
}
}
@@ -2,6 +2,7 @@ package com.droiddeck.launcher.session
import com.droiddeck.launcher.core.GameEnvironment
import com.droiddeck.launcher.frontend.Library
import com.droiddeck.launcher.gpu.FrameGen
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNull
@@ -116,6 +117,17 @@ class SelectedGameProfileTest {
assertEquals(ProfileValue("PERFORMANCE_TSO", true), resolve(environment = inherited)!!.fexPreset)
}
@Test fun frameGenOverrideMakesProfileCustom() {
val profile = resolve(
frameGenMode = FrameGen.Mode.OFF,
frameGenInherited = false,
)
assertEquals(FrameGen.Mode.OFF, profile!!.frameGen)
assertFalse(profile.frameGenInherited)
assertTrue(profile.hasOverrides)
}
private fun resolve(
selectedAppId: Long = 3180310,
games: List<Library.SteamGame> = listOf(game),
@@ -123,6 +135,8 @@ class SelectedGameProfileTest {
gameChoice: ProtonDefault.GameChoice? = null,
gameComponents: Map<String, String> = emptyMap(),
gameWindowsComponents: List<String> = emptyList(),
frameGenMode: FrameGen.Mode = FrameGen.Mode.OFF,
frameGenInherited: Boolean = true,
) = SelectedGameProfile.resolve(
selectedAppId = selectedAppId,
games = games,
@@ -134,6 +148,8 @@ class SelectedGameProfileTest {
gameProtonId = "p1",
gameComponents = gameComponents,
gameWindowsComponents = gameWindowsComponents,
frameGenMode = frameGenMode,
frameGenInherited = frameGenInherited,
)
private fun component(label: String) =