Heroic-Games-Launcher / HeroicGamesLauncher

A games launcher for GOG, Amazon and Epic Games for Linux, Windows and macOS.
https://heroicgameslauncher.com
GNU General Public License v3.0
7.91k stars 417 forks source link

Feral Game Mode cannot be not activated #151

Closed kpj closed 3 years ago

kpj commented 3 years ago

Describe the bug After enabling "Use GameMode" in the settings, the gamemode is not actually enabled when starting games.

In particular, the executed command is (when used with some other options)

DXVK_HUD=fps   STEAM_COMPAT_DATA_PATH='XXX/.wine'  /opt/heroic/resources/app.asar.unpacked/build/bin/legendary launch XXX  --no-wine --wrapper "'XXX/.local/share/Steam/steamapps/common/Proton 5.13/proton' run

It seems like it should be

DXVK_HUD=fps   STEAM_COMPAT_DATA_PATH='XXX/.wine'  gamemoderun /opt/heroic/resources/app.asar.unpacked/build/bin/legendary launch XXX  --no-wine --wrapper "'XXX/.local/share/Steam/steamapps/common/Proton 5.13/proton' run

Note the call to gamemoderun. When executed manually this launches the game in gamemode.

To Reproduce Steps to reproduce the behavior:

  1. Go to Settings, Other
  2. Click on Use GameMode
  3. Go to any game
  4. Launch game
  5. Observe that it is not running in gamemode

Expected behavior The game should be launched in gamemode.

Desktop (please complete the following information):

Additional context I checked how heroic uses gamemoderun in electron/utils.ts and it seems like it should work

  // check if Gamemode is installed
  await execAsync(`which gamemoderun`)
    .then(({ stdout }) => (gameMode = stdout.split('\n')[0]))
    .catch(() => console.log('GameMode not installed'))

  const runWithGameMode = useGameMode && gameMode ? gameMode : ''

  const command = `${envVars} ${runWithGameMode} ${legendaryBin} launch ${appName}  ${wine} ${prefix} ${launcherArgs}`

Running which gamemoderun manually shows /usr/bin/gamemoderun and the error message "GameMode not installed" is also not shown. Maybe useGameMode is not propagated correctly?

flavioislima commented 3 years ago

Just tried and it works for me: Launch Command: PULSE_LATENCY_MSEC=60 MANGOHUD=1 STEAM_COMPAT_DATA_PATH='/home/flavio/Games/Prefixes/heroic_proton' /usr/bin/gamemoderun /opt/heroic/resources/app.asar.unpacked/build/bin/legendary launch d7db33dfe7634d6b8a188c708f2caa3c --no-wine --wrapper "'/usr/share/steam/compatibilitytools.d/proton-ge-custom/proton' run"

Maybe try to disable and enable again. Also, check the game config file on .config/heroic/GameConfig/XXX.json Check if the flag is enabled

kpj commented 3 years ago

Thanks for the quick reply!

I checked .config/heroic/GamesConfig/XXX.json and useGameMode is indeed always set to false, no matter how I click the button in the settings. After setting it to true manually, gamemoderun works as expected.

My issue is that, in order to reach the settings, I clicked settings in the upper left corner of the screen. Any changes I then did were apparently discarded. However, when I enter the settings by clicking on a game and then selecting settings in the menu on the right side of the screen, everything works as expected. Am I just misunderstanding how the settings context is working?

flavioislima commented 3 years ago

@kpj This is because Heroic has Global and Game Settings. If the Game setting was already created (this happens when you open the game settings the first time), and something is set to false, like the Game Mode option, even if you go to the general settings and change it to true, that game will keep with Game Mode set to false.

So, Game config > Global Config.

kpj commented 3 years ago

Ah, thanks a lot for the explanation. That makes total sense!

Would it maybe be a good idea to make the game config more visually distinct from the global config? Maybe by putting the game title prominently as a header.

flavioislima commented 3 years ago

@kpj since 1.5 I added a header to the Settings page. So now should be easier to understand.