add app and apps icons

This commit is contained in:
olcxja 2026-09-25 18:42:03 +02:00
commit 7508811374
16 changed files with 554 additions and 7 deletions

View file

@ -75,6 +75,8 @@ function parseArgs(args) {
return out
}
const GRACE_MS = 60000
function runGame({ game, wine, systemWine, onExit }) {
const isProton = wine && wine.type === 'proton'
const { env } = buildEnv({ game, wine })
@ -112,9 +114,15 @@ function runGame({ game, wine, systemWine, onExit }) {
child.stderr.pipe(ws)
child.on('error', reject)
child.unref()
const startedAt = Date.now()
child.on('exit', (code, signal) => {
ws.end()
require('./library').updateGame(game.id, { lastPlayed: Date.now() })
const playedMs = Date.now() - startedAt
const counted = playedMs > GRACE_MS ? Math.round((playedMs - GRACE_MS) / 1000) : 0
require('./library').updateGame(game.id, {
lastPlayed: Date.now(),
playSeconds: (game.playSeconds || 0) + counted
})
if (onExit) onExit(code, signal)
})
resolve({ pid: child.pid, logFile })