feat(entitlement): gate 60 fps output through Steam

This commit is contained in:
2026-11-04 12:14:46 -08:00
parent 1993e7cc8b
commit 7216c95449
12 changed files with 188 additions and 72 deletions
+22 -4
View File
@@ -17,6 +17,7 @@ public sealed class SteamEntitlement : IEntitlement
private bool _initAttempted;
private bool _available;
private bool? _cached;
private string? _errorMessage;
public SteamEntitlement(uint paidAppId)
: this(
@@ -42,11 +43,18 @@ public sealed class SteamEntitlement : IEntitlement
/// <summary>Configured with no paid app ID; ownership fails closed without touching Steam.</summary>
public static SteamEntitlement NotConfigured() => new(0);
public string? ErrorMessage => _errorMessage;
public bool IsAppOwned
{
get
{
if (_paidAppId == 0) return false;
if (_paidAppId == 0)
{
_cached = false;
_errorMessage = "The paid Steam app ID is not configured for this build. Contact the creator or support.";
return false;
}
if (_cached is { } known) return known;
if (!_initAttempted)
@@ -56,22 +64,31 @@ public sealed class SteamEntitlement : IEntitlement
{
_available = _initializeSteam();
}
catch (Exception)
catch (Exception ex)
{
_available = false;
_errorMessage = $"Steam could not start ({ex.Message}). Open Steam, sign in, then restart LlamaCasty.";
}
}
if (!_available) { _cached = false; return false; }
if (!_available)
{
_cached = false;
_errorMessage ??= "Steam could not verify ownership. Open Steam, sign in, then restart LlamaCasty.";
return false;
}
try
{
var owned = _isAppSubscribed(_paidAppId);
_cached = owned;
_errorMessage = null;
return owned;
}
catch (Exception)
catch (Exception ex)
{
_cached = false;
_errorMessage = $"Steam could not check ownership ({ex.Message}). Open Steam, sign in, then restart LlamaCasty.";
return false;
}
}
@@ -83,5 +100,6 @@ public sealed class SteamEntitlement : IEntitlement
_available = false;
_cached = null;
_initAttempted = false;
_errorMessage = null;
}
}