fix: new Steam installs start with shader pre-caching off (#1861)

This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-10-30 14:17:45 -04:00
1 parent fa4a54f64a
commit c8c5e22a34
3 files changed
+46 -4

No files matched your search

@@ -442,11 +442,15 @@ object SessionPrefs {
/**
* Shader pre-caching as the launcher last set it, until a session reports it written into the
* client's config.vdf; after that the client's own toggle is the user's again.
* client's config.vdf; after that the client's own toggle is the user's again. A client that
* has never written a config.vdf starts with pre-caching off.
*/
fun pendingShaderPrecache(context: Context): Boolean? {
val prefs = prefs(context)
if (!prefs.contains("shaderPrecache")) return null
if (!prefs.contains("shaderPrecache")) {
if (steamConfig(context).exists()) return null
prefs.edit().putBoolean("shaderPrecache", false).apply()
}
val on = prefs.getBoolean("shaderPrecache", true)
val applied = shaderPrecacheApplied(context)
val written = runCatching { applied.readText().trim() }.getOrNull() ?: return on
@@ -461,9 +465,12 @@ object SessionPrefs {
prefs(context).edit().putBoolean("shaderPrecache", on).apply()
}
private fun steamConfig(context: Context) =
java.io.File(steamRoot(context, steamClientArch(context)), "config/config.vdf")
fun shaderPrecache(context: Context): Boolean = pendingShaderPrecache(context)
?: runCatching { com.droiddeck.launcher.storage.SteamStorage.shaderPrecache(
java.io.File(steamRoot(context, steamClientArch(context)), "config/config.vdf").readText()) }.getOrDefault(true)
steamConfig(context).readText()) }.getOrDefault(true)
fun stretch16x9(context: Context): Boolean = prefs(context).getBoolean("stretch16x9", false)