fix: Game detection improvements
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-linux (push) Has been cancelled
Queue Release Build / build-windows (push) Has been cancelled
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-linux (push) Has been cancelled
Queue Release Build / build-windows (push) Has been cancelled
This commit is contained in:
@@ -120,7 +120,7 @@ export class GameActivityService implements OnDestroy {
|
||||
|
||||
const api = this.electron.getApi();
|
||||
|
||||
if (!api?.getRunningProcessNames) {
|
||||
if (!api?.getRunningProcessNames && !api?.getActiveGameCandidate) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -154,14 +154,33 @@ export class GameActivityService implements OnDestroy {
|
||||
|
||||
const api = this.electron.getApi();
|
||||
|
||||
if (!api?.getRunningProcessNames) {
|
||||
if (!api?.getRunningProcessNames && !api?.getActiveGameCandidate) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.scanInFlight = true;
|
||||
|
||||
try {
|
||||
const processNames = (await api.getRunningProcessNames()).slice(0, MAX_PROCESS_NAMES_PER_REQUEST);
|
||||
const candidateResult = api.getActiveGameCandidate
|
||||
? await api.getActiveGameCandidate().catch(() => null)
|
||||
: null;
|
||||
|
||||
let processNames: string[];
|
||||
let preferredProcessName: string | undefined;
|
||||
|
||||
if (candidateResult?.candidate) {
|
||||
// Main process already scored & filtered this; trust it.
|
||||
preferredProcessName = candidateResult.candidate.rawProcessName ?? candidateResult.candidate.processName;
|
||||
processNames = [preferredProcessName];
|
||||
} else if (candidateResult && candidateResult.fallbackProcessNames.length > 0) {
|
||||
processNames = candidateResult.fallbackProcessNames.slice(0, MAX_PROCESS_NAMES_PER_REQUEST);
|
||||
} else if (!candidateResult && api.getRunningProcessNames) {
|
||||
// Old preload without the new API: fall back to legacy whole-system scan.
|
||||
processNames = (await api.getRunningProcessNames()).slice(0, MAX_PROCESS_NAMES_PER_REQUEST);
|
||||
} else {
|
||||
processNames = [];
|
||||
}
|
||||
|
||||
const processHash = this.buildProcessHash(processNames);
|
||||
|
||||
if (processHash === this.lastProcessHash) {
|
||||
@@ -170,6 +189,12 @@ export class GameActivityService implements OnDestroy {
|
||||
|
||||
this.lastProcessHash = processHash;
|
||||
|
||||
if (processNames.length === 0) {
|
||||
this.ngZone.run(() => this.applyMatchedGame(null));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const matchedGame = await this.matchRunningGame(processNames);
|
||||
|
||||
this.ngZone.run(() => this.applyMatchedGame(matchedGame));
|
||||
|
||||
Reference in New Issue
Block a user