Skip to content

Commit

Permalink
docs: update usage to use --quit flag (#31)
Browse files Browse the repository at this point in the history
* docs: update usage to use --quit flag

* docs: add lutris

* docs: restructure the sections layout

* docs: add new readme badges
  • Loading branch information
imLinguin authored Jul 11, 2024
1 parent 3d95012 commit 417ded2
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 69 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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]
Expand Down
86 changes: 58 additions & 28 deletions docs/steamdeck/USAGE.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,74 @@
# 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.

This comment has been minimized.

Copy link
@kevin-wijnen

kevin-wijnen Jul 11, 2024

Contributor

Maybe generalise it, considering this script also should work Lutris shortcuts or any other non-Steam game shortcuts made by Steam?


## 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.

This comment has been minimized.

Copy link
@kevin-wijnen

kevin-wijnen Jul 11, 2024

Contributor

I could be misremembering - but was there no way of manually providing the GOG cookies to Comet so it is not reliant on either Heroic or Lutris? Might be worth mentioning as a last resort.



## 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..
3. Scroll down the WINE tab of the game's settings screen until you see `RUN EXE ON PREFIX`.
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:
`"<file path of comet_shortcut.sh>" %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!
32 changes: 19 additions & 13 deletions docs/steamdeck/comet_shortcut.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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:
# "<location of this comet_shortcut.sh>" %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

Expand All @@ -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

This comment has been minimized.

Copy link
@kevin-wijnen

kevin-wijnen Jul 11, 2024

Contributor

"15 seconds is the default" yet the wait is here 5 seconds?


# 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

This comment has been minimized.

Copy link
@kevin-wijnen

kevin-wijnen Jul 11, 2024

Contributor

Out of own curiosity: any info on this "wrapper mode" available somewhere?

This comment has been minimized.

Copy link
@imLinguin

imLinguin Jul 11, 2024

Author Owner

I added it as another way to use the script. Mostly for Lutris to allow for stopping the comet together with the game. It's nothing special really. I'll try to elaborate on that

if [ $# -ne 0 ]; then
comet_pid=$!
exec "$@" &

This comment has been minimized.

Copy link
@kevin-wijnen

kevin-wijnen Jul 11, 2024

Contributor

Has there been testing done with the removal of the -a flag on any Linux system yet? I believe it was a necessary part to get it running on the Steam Deck, but I could be misremembering.

This comment has been minimized.

Copy link
@imLinguin

imLinguin Jul 11, 2024

Author Owner

it shouldn't be problematic, now the Heroic will handle the script instead of Steam

This comment has been minimized.

Copy link
@kevin-wijnen

kevin-wijnen Jul 11, 2024

Contributor

it shouldn't be problematic, now the Heroic will handle the script instead of Steam

That is problematic for any non-Heroic/Lutris solutions, however. It could break non-launcher shortcuts. I'd consider that a noteworthy downgrade. Could it be at least documented somewhere, to restore said functionality?

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" "$@"
86 changes: 58 additions & 28 deletions docs/wiki/steamdeck/Usage.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,74 @@
# 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.

This comment has been minimized.

Copy link
@kevin-wijnen

kevin-wijnen Jul 11, 2024

Contributor

Like before - maybe generalise it to any launcher's (or non-launcher) non-Steam game shortcuts present in Steam?

Non-Steam game shortcut is the official terminology from Valve used through out the Steam interface - hence I referred any shortcut made by Heroic, Lutris or the like as those.


## 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.

This comment has been minimized.

Copy link
@kevin-wijnen

kevin-wijnen Jul 11, 2024

Contributor

(If/After) applying the suggested changes from above - check if the Wiki is synced up/displaying the same information just in case.



## 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..
3. Scroll down the WINE tab of the game's settings screen until you see `RUN EXE ON PREFIX`.
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:
`"<file path of comet_shortcut.sh>" %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!

0 comments on commit 417ded2

Please sign in to comment.