diff --git a/README.md b/README.md index 74ce438..09c6ca5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # Comet [![Build nightly](https://github.com/imLinguin/comet/actions/workflows/build.yml/badge.svg)](https://github.com/imLinguin/comet/actions/workflows/build.yml) +![Version](https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2FimLinguin%2Fcomet%2Fmain%2FCargo.toml&query=%24.package.version&label=version&labelColor=darkslategrey) +[![Static Badge](https://img.shields.io/badge/Steam%20Deck%20Usage%20Guide-darkslategrey?logo=steamdeck)](docs/steamdeck/USAGE.md) + Open Source implementation of GOG Galaxy's Communication Service @@ -11,6 +14,7 @@ This will provide minimal and platform-agnostic SDK. For use in game launchers l Project is continuation of Yepoleb's work https://gitlab.com/Yepoleb/comet/ but in ~~Python~~ [now in Rust](https://github.com/imLinguin/comet/issues/15) + ## Supported Requests > [!NOTE] diff --git a/docs/steamdeck/USAGE.md b/docs/steamdeck/USAGE.md index d0fa8fe..b50b569 100644 --- a/docs/steamdeck/USAGE.md +++ b/docs/steamdeck/USAGE.md @@ -1,20 +1,62 @@ # Using with the Steam Deck -Using Comet with Valve's Steam Deck (running SteamOS) is possible in both Desktop and Game Mode. Comet will only function with games that do support [GOG Galaxy's achievement system](https://www.gog.com/en/games?features=achievements). **If your game does not work out of the box, check Known Issues below.** +Using Comet with Valve's Steam Deck (running SteamOS) is possible in both Desktop and Game Mode. Comet will only function with games that do support [GOG Galaxy's achievement system](https://www.gog.com/en/games?features=achievements) or any other online related functionality like Leaderboards. **If your game does not work out of the box, check Known Issues below.** -Using `comet_shortcut.sh` will simplify the process of launching Heroic Games Launcher generated non-Steam game shortcuts with Comet in the background. That script works in both Modes. +Using `comet_shortcut.sh` will simplify the process of launching Heroic Games Launcher games with Comet in the background. That script works in both Modes. -## How to Use -1. Install Comet and its shortcut script. (See the installation steps below.) -2. Change the Heroic shortcuts on Steam to include a reference to the shortcut script. -3. Launch the game through either Desktop or Game Mode! -4. **When stopping your game**: close the game by using the Steam button to get to the overlay, selecting the window of your running game and close it with the X button. **Directly exiting the game through Steam will not sync your GOG playtime via Heroic!** After the game's closed through the mentioned "close window" method, you can simply close the remaining Comet window through the same manner or by selecting the "Exit game" option through Steam itself. +This instruction also applies for desktop users who want to use comet in launchers that do not support comet natively. + + +## Installation steps + +1. Make sure you are logged into GOG on your launcher of choice. +2. Download the latest release of Comet from [the latest release](https://github.com/imLinguin/comet/releases/latest) or [the latest GitHub Actions run](https://github.com/imLinguin/comet/actions/workflows/build.yml) labelled `comet-x86_64-unknown-linux-gnu` (a 64bit executable for Linux). +3. Extract the downloaded archive to a desired place. + > It is recommended to have the `comet` binary put into the `~/Documents` directory. Otherwise: choose any directory where Heroic has access to. +4. Open the `comet_shortcut.sh` file with Kate (right click on the file > Open with Kate), and edit the following values: + - `gog_username` + > Change the `username` value after `=` to your GOG username. If your name includes any special characters make sure to quote the username accordingly + - `path_to_comet` + > Change the `path_to_comet` value after `=` (while keeping the `'` characters in tact) to the full file path of the `comet` binary. +5. Start any game that has the shortcut script included (see instructions for [Heroic](#use-with-heroic) or [Lutris](#use-with-lutris)) to play the game with achievement support! + +> [!NOTE] +> On the startup comet downloads `GalaxyPeer` libraries (~100 MiB) into `$XDG_DATA_HOME/comet/redist/peer`. +> The download is triggered if there is an update available or if the files aren't downloaded already. +> On Mac, both native and windows libraries are being downloaded + + +## Use with Heroic +1. Install Comet and its shortcut script. (See the installation steps above.) +2. In Heroic Games Launcher, set the `comet_shortcut.sh` as a script that is going to be ran before the game (Game Settings > Advanced > Scripts) +4. Launch the game through either Desktop or Game Mode! +5. **Directly exiting the game through Steam will not sync your GOG playtime via Heroic!** Make sure to always exit the game via in-game menu. + +> [!TIP] +> Use Heroic's Add to Steam feature for the best experience +> in accessing your games from the Gaming Mode + +## Use with Lutris + +If you want to use the same script with Lutris, modify it to include `--from-lutris` instead of `--from-heroic`. You need to be logged in the GOG runner in Lutris. + +Steps to add a script to Lutris game + +1. Install Comet and its shortcut script. (See the installation steps above.) +2. Right click on the game and click Configure +3. Head over to `System options` and enable `Advanced` mode (next to save button) +4. Scroll down into `Game execution` section and set the path to `comet_shortcut.sh` as Command prefix or Pre-launch script. +5. Launch the game normally! + +> [!TIP] +> Setting the script as Command prefix will allow Lutris to wait for both comet and game process. +> Thus it's a recommended way ## Known Issues -- **Not all GOG achievement games are supported** - some games (e.g. [Cuphead](https://www.gog.com/en/game/cuphead)) do not support the way Comet currently works on its own, due to an outdated SDK used for GOG Galaxy features. +- **Not all GOG games are supported out of the box** - some games (e.g. [Cuphead](https://www.gog.com/game/cuphead)) do not support the way Comet works on its own, due to some checks performed by SDK used for GOG Galaxy features. - **To solve it**: you will need to install the `GalaxyCommunications` dummy application. (For Steam Deck users, the necessary files (the `.bat` script and the dummy `.exe`) have been included in the Linux artifact.) + **To solve it**: you will need to install the `GalaxyCommunications` dummy application. (The necessary files (the `.bat` script and the dummy `.exe`) have been included in the archive together with comet binary.) 1. Keep the `comet` Linux artifact items in a directory Heroic has access to, such as `~/Documents` or `~/Desktop`. 2. Go to Heroic Games Launcher, to the malfunctioning game's settings screen.. @@ -22,23 +64,11 @@ Using `comet_shortcut.sh` will simplify the process of launching Heroic Games La 4. Drag and drop the `install-dummy-service.bat` onto `RUN EXE ON PREFIX` to install the dummy service for the game to detect. 5. Play the game as you would expect. It should now function with Comet's features! -## Installation steps +- Currently there is no visible feedback on when the achievement has been unlocked, there is a [decky-loader plugin planned](https://github.com/imLinguin/comet/issues/18) + +## Offline support + +Comet should be able to register achievements and statistics while offline just fine and report them to the server next time you play the game online. + +**Please make sure to report issues if you encounter any.** -1. Make sure you are logged into GOG on Heroic Games Launcher. -2. Download the latest release of Comet from [the latest GitHub Actions run](https://github.com/imLinguin/comet/actions) labelled `comet-x86_64-unknown-linux-gnu`. -3. Extract the downloaded `.zip` archive to a desired place. - > It is recommended to have the `comet` binary put into the `~/Documents` directory. Otherwise: choose any directory where Heroic has access to. -6. Mark both `comet_shortcut.sh` and `comet` as `is Executable`. (Right click on the file > Properties > Permissions tab > click on the `Is executable` checkbox.) -7. Use Heroic Games Launcher to create non-Steam game shortcuts of any of your GOG games to use with Comet. -8. Restart Steam to have the newly created shortcuts show up. -9. For each Heroic Games Launcher shortcut: - - Move the current launch options (`run com.heroicgameslauncher.hgl ...`) into the target field, next to `flatpak`. - - Put the following in the launch options field: - `"" %command%` - > Replace what's between `< >` with the full file path (e.g. `~/Documents/comet/comet_shortcut.sh`) -10. Open the `comet_shortcut.sh` file with Kate (right click on the file > Open with Kate), and edit the following values: - - `gog_username` - > Change the `username` value after `=` to your GOG username - - `path_to_comet` - > Change the `path_to_comet` value after `=` (while keeping the `'` characters in tact) to the full file path of the `comet` binary. -11. Start any game shortcut that has the shortcut script included (see step 9.) in its launch options to play the game with achievement support! diff --git a/docs/steamdeck/comet_shortcut.sh b/docs/steamdeck/comet_shortcut.sh old mode 100644 new mode 100755 index efe5649..e4f279f --- a/docs/steamdeck/comet_shortcut.sh +++ b/docs/steamdeck/comet_shortcut.sh @@ -2,11 +2,11 @@ # Comet shortcut script # -# Meant for Heroic generated non-Steam game shortcuts -# Minor tweaks necessary in the shortcut: -# - Move the launch options (run com.heroicgameslauncher.hgl ...) of the shortcut into the target, next to "flatpak" -# - Put the following in the launch options of the shortcut: -# "" %command% +# Meant for usage as a pre-launch script +# Although the script can be used as a wrapper as well +# Heroic Game settings > Advanced > Scripts > Select a script to run before the game is launched +# Make sure the script is in location that's always accessible by Heroic +# such as /home/deck/Documents # Variables @@ -15,14 +15,20 @@ gog_username=username path_to_comet='/home/deck/Documents/comet/comet' # Uncomment if debug logs are wanted to be visible in Comet #export COMET_LOG=debug +# A timeout after which comet will quit when last client disconnects +export COMET_IDLE_WAIT=5 # 15 seconds is the default -# Running Comet as a separate Konsole window -konsole -e "$path_to_comet --from-heroic --username $gog_username" & +# Running Comet as a background app +# If you want to use this script in Lutris change --from-heroic to --from-lutris +exec "$path_to_comet" --from-heroic --username "$gog_username" -q & -# Grabbing process ID of Comet -comet_pid=$! +# If parameters were provided we are in wrapper mode +if [ $# -ne 0 ]; then + comet_pid=$! + exec "$@" & + game_pid=$! + echo "Waiting for $comet_pid and $game_pid" + trap 'kill $game_pid; wait $game_pid $comet_pid' SIGINT SIGTERM + wait $game_pid $comet_pid +fi -# Running the game shortcut under the same process ID as Comet -# Necessary to put Comet and the game in "one opened game" on the Steam Deck's Game Mode - -exec -a "$comet_pid" "$@" diff --git a/docs/wiki/steamdeck/Usage.md b/docs/wiki/steamdeck/Usage.md index 495c208..b50b569 100644 --- a/docs/wiki/steamdeck/Usage.md +++ b/docs/wiki/steamdeck/Usage.md @@ -1,20 +1,62 @@ # Using with the Steam Deck -Using Comet with Valve's Steam Deck (running SteamOS) is possible in both Desktop and Game Mode. Comet will only function with games that do support [GOG Galaxy's achievement system](https://www.gog.com/en/games?features=achievements). **If your game does not work out of the box, check Known Issues below.** +Using Comet with Valve's Steam Deck (running SteamOS) is possible in both Desktop and Game Mode. Comet will only function with games that do support [GOG Galaxy's achievement system](https://www.gog.com/en/games?features=achievements) or any other online related functionality like Leaderboards. **If your game does not work out of the box, check Known Issues below.** -Using `comet_shortcut.sh` will simplify the process of launching Heroic Games Launcher generated non-Steam game shortcuts with Comet in the background. That script works in both Modes. +Using `comet_shortcut.sh` will simplify the process of launching Heroic Games Launcher games with Comet in the background. That script works in both Modes. -## How to Use -1. Install Comet and its shortcut script. (See the installation steps below.) -2. Change the Heroic shortcuts on Steam to include a reference to the shortcut script. -3. Launch the game through either Desktop or Game Mode! -4. **When stopping your game**: close the game by using the Steam button to get to the overlay, selecting the window of your running game and close it with the X button. **Directly exiting the game through Steam will not sync your GOG playtime via Heroic!** After the game's closed through the mentioned "close window" method, you can simply close the remaining Comet window through the same manner or by selecting the "Exit game" option through Steam itself. +This instruction also applies for desktop users who want to use comet in launchers that do not support comet natively. + + +## Installation steps + +1. Make sure you are logged into GOG on your launcher of choice. +2. Download the latest release of Comet from [the latest release](https://github.com/imLinguin/comet/releases/latest) or [the latest GitHub Actions run](https://github.com/imLinguin/comet/actions/workflows/build.yml) labelled `comet-x86_64-unknown-linux-gnu` (a 64bit executable for Linux). +3. Extract the downloaded archive to a desired place. + > It is recommended to have the `comet` binary put into the `~/Documents` directory. Otherwise: choose any directory where Heroic has access to. +4. Open the `comet_shortcut.sh` file with Kate (right click on the file > Open with Kate), and edit the following values: + - `gog_username` + > Change the `username` value after `=` to your GOG username. If your name includes any special characters make sure to quote the username accordingly + - `path_to_comet` + > Change the `path_to_comet` value after `=` (while keeping the `'` characters in tact) to the full file path of the `comet` binary. +5. Start any game that has the shortcut script included (see instructions for [Heroic](#use-with-heroic) or [Lutris](#use-with-lutris)) to play the game with achievement support! + +> [!NOTE] +> On the startup comet downloads `GalaxyPeer` libraries (~100 MiB) into `$XDG_DATA_HOME/comet/redist/peer`. +> The download is triggered if there is an update available or if the files aren't downloaded already. +> On Mac, both native and windows libraries are being downloaded + + +## Use with Heroic +1. Install Comet and its shortcut script. (See the installation steps above.) +2. In Heroic Games Launcher, set the `comet_shortcut.sh` as a script that is going to be ran before the game (Game Settings > Advanced > Scripts) +4. Launch the game through either Desktop or Game Mode! +5. **Directly exiting the game through Steam will not sync your GOG playtime via Heroic!** Make sure to always exit the game via in-game menu. + +> [!TIP] +> Use Heroic's Add to Steam feature for the best experience +> in accessing your games from the Gaming Mode + +## Use with Lutris + +If you want to use the same script with Lutris, modify it to include `--from-lutris` instead of `--from-heroic`. You need to be logged in the GOG runner in Lutris. + +Steps to add a script to Lutris game + +1. Install Comet and its shortcut script. (See the installation steps above.) +2. Right click on the game and click Configure +3. Head over to `System options` and enable `Advanced` mode (next to save button) +4. Scroll down into `Game execution` section and set the path to `comet_shortcut.sh` as Command prefix or Pre-launch script. +5. Launch the game normally! + +> [!TIP] +> Setting the script as Command prefix will allow Lutris to wait for both comet and game process. +> Thus it's a recommended way ## Known Issues -- **Not all GOG achievement games are supported** - some games (e.g. [Cuphead](https://www.gog.com/game/cuphead)) do not support the way Comet currently works on its own, due to an outdated SDK used for GOG Galaxy features. +- **Not all GOG games are supported out of the box** - some games (e.g. [Cuphead](https://www.gog.com/game/cuphead)) do not support the way Comet works on its own, due to some checks performed by SDK used for GOG Galaxy features. - **To solve it**: you will need to install the `GalaxyCommunications` dummy application. (For Steam Deck users, the necessary files (the `.bat` script and the dummy `.exe`) have been included in the Linux artifact.) + **To solve it**: you will need to install the `GalaxyCommunications` dummy application. (The necessary files (the `.bat` script and the dummy `.exe`) have been included in the archive together with comet binary.) 1. Keep the `comet` Linux artifact items in a directory Heroic has access to, such as `~/Documents` or `~/Desktop`. 2. Go to Heroic Games Launcher, to the malfunctioning game's settings screen.. @@ -22,23 +64,11 @@ Using `comet_shortcut.sh` will simplify the process of launching Heroic Games La 4. Drag and drop the `install-dummy-service.bat` onto `RUN EXE ON PREFIX` to install the dummy service for the game to detect. 5. Play the game as you would expect. It should now function with Comet's features! -## Installation steps +- Currently there is no visible feedback on when the achievement has been unlocked, there is a [decky-loader plugin planned](https://github.com/imLinguin/comet/issues/18) + +## Offline support + +Comet should be able to register achievements and statistics while offline just fine and report them to the server next time you play the game online. + +**Please make sure to report issues if you encounter any.** -1. Make sure you are logged into GOG on Heroic Games Launcher. -2. Download the latest release of Comet from [the latest GitHub Actions run](https://github.com/imLinguin/comet/actions) labelled `comet-x86_64-unknown-linux-gnu`. -3. Extract the downloaded `.zip` archive to a desired place. - > It is recommended to have the `comet` binary put into the `~/Documents` directory. Otherwise: choose any directory where Heroic has access to. -6. Mark both `comet_shortcut.sh` and `comet` as `is Executable`. (Right click on the file > Properties > Permissions tab > click on the `Is executable` checkbox.) -7. Use Heroic Games Launcher to create non-Steam game shortcuts of any of your GOG games to use with Comet. -8. Restart Steam to have the newly created shortcuts show up. -9. For each Heroic Games Launcher shortcut: - - Move the current launch options (`run com.heroicgameslauncher.hgl ...`) into the target field, next to `flatpak`. - - Put the following in the launch options field: - `"" %command%` - > Replace what's between `< >` with the full file path (e.g. `~/Documents/comet/comet_shortcut.sh`) -10. Open the `comet_shortcut.sh` file with Kate (right click on the file > Open with Kate), and edit the following values: - - `gog_username` - > Change the `username` value after `=` to your GOG username - - `path_to_comet` - > Change the `path_to_comet` value after `=` (while keeping the `'` characters in tact) to the full file path of the `comet` binary. -11. Start any game shortcut that has the shortcut script included (see step 9.) in its launch options to play the game with achievement support!