fix: Game detection improvements
Some checks failed
Queue Release Build / prepare (push) Successful in 27s
Deploy Web Apps / deploy (push) Successful in 10m8s
Queue Release Build / finalize (push) Has been cancelled
Queue Release Build / build-windows (push) Has been cancelled
Queue Release Build / build-linux (push) Has been cancelled

This commit is contained in:
2026-05-17 17:47:40 +02:00
parent 8631290c01
commit a173299ad3
14 changed files with 1942 additions and 34 deletions

View File

@@ -18,6 +18,7 @@ export interface DesktopSettings {
autoStart: boolean;
closeToTray: boolean;
hardwareAcceleration: boolean;
ignoredGameProcesses: string[];
localApi: LocalApiSettings;
manifestUrls: string[];
preferredVersion: string | null;
@@ -42,6 +43,7 @@ const DEFAULT_DESKTOP_SETTINGS: DesktopSettings = {
autoStart: true,
closeToTray: true,
hardwareAcceleration: true,
ignoredGameProcesses: [],
localApi: { ...DEFAULT_LOCAL_API_SETTINGS },
manifestUrls: [],
preferredVersion: null,
@@ -80,6 +82,31 @@ function normalizeManifestUrls(value: unknown): string[] {
return manifestUrls;
}
function normalizeIgnoredGameProcesses(value: unknown): string[] {
if (!Array.isArray(value)) {
return [];
}
const ignored: string[] = [];
for (const entry of value) {
if (typeof entry !== 'string') {
continue;
}
const trimmed = entry.trim().toLowerCase()
.replace(/\.(exe|bin|app|out)$/iu, '');
if (!trimmed || trimmed.length > 96 || ignored.includes(trimmed)) {
continue;
}
ignored.push(trimmed);
}
return ignored.sort();
}
function normalizePort(value: unknown, fallback: number): number {
if (typeof value !== 'number' || !Number.isFinite(value)) {
return fallback;
@@ -171,6 +198,7 @@ export function readDesktopSettings(): DesktopSettings {
hardwareAcceleration: typeof parsed.hardwareAcceleration === 'boolean'
? parsed.hardwareAcceleration
: DEFAULT_DESKTOP_SETTINGS.hardwareAcceleration,
ignoredGameProcesses: normalizeIgnoredGameProcesses(parsed.ignoredGameProcesses),
localApi: normalizeLocalApiSettings(parsed.localApi),
manifestUrls: normalizeManifestUrls(parsed.manifestUrls),
preferredVersion: normalizePreferredVersion(parsed.preferredVersion)
@@ -200,6 +228,7 @@ export function updateDesktopSettings(patch: Partial<DesktopSettings>): DesktopS
hardwareAcceleration: typeof mergedSettings.hardwareAcceleration === 'boolean'
? mergedSettings.hardwareAcceleration
: DEFAULT_DESKTOP_SETTINGS.hardwareAcceleration,
ignoredGameProcesses: normalizeIgnoredGameProcesses(mergedSettings.ignoredGameProcesses),
localApi: normalizeLocalApiSettings(mergedSettings.localApi),
manifestUrls: normalizeManifestUrls(mergedSettings.manifestUrls),
preferredVersion: normalizePreferredVersion(mergedSettings.preferredVersion),