Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Etaash-mathamsetty committed Sep 29, 2024
1 parent 2f95ae0 commit 072355d
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/backend/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,8 @@ async function callRunner(
runner: RunnerProps,
options?: CallRunnerOptions
): Promise<ExecResult> {
const appName = appNameFromCommandParts(commandParts, runner.name)
const appName =
options?.app_name || appNameFromCommandParts(commandParts, runner.name)

// Necessary to get rid of possible undefined or null entries, else
// TypeError is triggered
Expand Down
40 changes: 35 additions & 5 deletions src/backend/storeManagers/storeManagerCommon/games.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ import { constants as FS_CONSTANTS } from 'graceful-fs'
import i18next from 'i18next'
import {
callRunner,
getRunnerCallWithoutCredentials,
launchCleanup,
prepareLaunch,
prepareWineLaunch,
runWineCommand,
setupEnvVars,
setupWineEnvVars,
setupWrapperEnvVars,
setupWrappers
} from '../../launcher'
Expand Down Expand Up @@ -190,11 +192,6 @@ export async function launchGame(
return false
}

appendGamePlayLog(
gameInfo,
`Launch Command: ${executable} ${launcherArgs ?? ''}\n`
)

sendGameStatusUpdate({
appName,
runner,
Expand Down Expand Up @@ -226,6 +223,16 @@ export async function launchGame(
executable = extraArgs.shift()!
}

const fullCommand = getRunnerCallWithoutCredentials(
extraArgs,
env,
executable
)
appendGamePlayLog(
gameInfo,
`Launch Command: ${fullCommand}\n\nGame Log:\n`
)

await callRunner(
extraArgs,
{
Expand All @@ -237,6 +244,7 @@ export async function launchGame(
{
env,
wrappers,
app_name: appName,
logFile: lastPlayLogFileLocation(appName),
logMessagePrefix: LogPrefix.Backend,
onOutput: (output) => {
Expand All @@ -258,6 +266,27 @@ export async function launchGame(
LogPrefix.Backend
)

const logCommand = [
...wrappers,
gameSettings.wineVersion.bin,
executable,
...extraArgs
]
const logExec = logCommand.shift()!

const fullCommand = getRunnerCallWithoutCredentials(
logCommand,
{
GAMEID: 'umu-0',
...setupEnvVars(gameSettings, gameInfo.install.install_path),
...setupWineEnvVars(gameSettings, dirname(executable)),
PROTON_VERB: 'waitforexitandrun'
},
logExec
)

appendGamePlayLog(gameInfo, `Launch Command: ${fullCommand}\n\nGame Log:\n`)

await runWineCommand({
commandParts: [executable, ...extraArgs],
gameSettings,
Expand All @@ -266,6 +295,7 @@ export async function launchGame(
startFolder: dirname(executable),
options: {
wrappers,
app_name: appName,
logFile: lastPlayLogFileLocation(appName),
logMessagePrefix: LogPrefix.Backend,
onOutput: (output) => {
Expand Down
2 changes: 1 addition & 1 deletion src/backend/utils/helperBinaries/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async function getCometVersion(): Promise<string> {

if (error) return 'invalid'

return stdout.toString()
return stdout.toString().trimEnd()
}

async function getNileVersion(): Promise<string> {
Expand Down
1 change: 1 addition & 0 deletions src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ export interface CallRunnerOptions {
wrappers?: string[]
onOutput?: (output: string, child: ChildProcess) => void
abortId?: string
app_name?: string
}

export interface EnviromentVariable {
Expand Down

0 comments on commit 072355d

Please sign in to comment.