Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installed games don't show as "installed" #10

Open
doughsay opened this issue Jan 7, 2021 · 16 comments
Open

Installed games don't show as "installed" #10

doughsay opened this issue Jan 7, 2021 · 16 comments

Comments

@doughsay
Copy link

doughsay commented Jan 7, 2021

Additionally, clicking the "install" button from inside GoG Galaxy just launches the game. So, it does "work", it just doesn't mark the game as installed.

@doughsay
Copy link
Author

doughsay commented Jan 7, 2021

I disconnected the plugin, installed the game through amazon games client, then re-connected the plugin and it recognized the game I installed.

@Rall3n
Copy link
Owner

Rall3n commented Jan 8, 2021

@doughsay Would you mind uploading your plugin log files for further analysis?

They should be located at C:\ProgramData\GOG.com\Galaxy\logs.

@doughsay
Copy link
Author

doughsay commented Jan 8, 2021

Here's today's log. I just booted up and the two games I have installed in Amazon Games no longer show as installed in GoG Galaxy.

plugin-amazon-c2cd2e29-8b02-35a9-86fc-3faf90255857.log

I have "Cultist Simulator" and "Along the Edge" installed, and they were showing as installed yesterday, but they now no longer are.

Here are the only other two logs I have:

plugin-amazon-c2cd2e29-8b02-35a9-86fc-3faf90255857-1.log
plugin-amazon-c2cd2e29-8b02-35a9-86fc-3faf90255857-2.log

@Rall3n
Copy link
Owner

Rall3n commented Jan 8, 2021

As I thought. This is an issue I already observed happening over the week.

For some unknown reason Galaxy is not calling the necessary functions for importing local games (also updating the owned games) after plugin start until much later (I observed a minimum of an hour).

I don´t know why this is happening, as there is no indication of an error in any of the Galaxy logs. It will resume functionality on some specific edge cases (for example restarting the plugin).

@rodrigovda
Copy link

rodrigovda commented Jan 28, 2021

I have the same issue, I just Installed the plugin, it fetched my owned games correctly but it doesn't show the installed ones. This is the only log I got for this plugin:
plugin-amazon-c2cd2e29-8b02-35a9-86fc-3faf90255857.log

My currently installed games are "Ape Out" and "Enter the Gungeon"

@RodrigoTomeES
Copy link

RodrigoTomeES commented Feb 1, 2021

I have the same issue, but I think the problem is that the plugin doesn't sync with Amazon app after the first sync. I believe this because it has also not synced the new February free games that I purchased today.

Edit: After one day, the plugin shows the new games

@mbanczerowski
Copy link

GOG dev here. Issue confirmed and passed to investigation. As a workaround I can propose sending update_local_game_status shortly after handshake_complete

@Rall3n
Copy link
Owner

Rall3n commented Feb 6, 2021

I have released a new version (v0.3.0) with a workaround. But I will keep this issue open until the main issue has been fixed.

@mbanczerowski
Copy link

Hi @Rall3n, the problem does not occur already. Could you confirm?

@Rall3n
Copy link
Owner

Rall3n commented May 25, 2021

@mbanczerowski Unfortunately I can not confirm. Latest log still shows no call of tasks import_local_games and import_owned_games.

@mbanczerowski
Copy link

Thanks for checking. Looks like only some plugins are affected, I'm passing that back to Galaxy issue.

@mbanczerowski
Copy link

Hi @Rall3n, the Galaxy version 2.0.37 has included some fixes for that matter. Could you confirm if it works this time?

@Rall3n
Copy link
Owner

Rall3n commented Aug 7, 2021

@mbanczerowski I saw the changelog of the latest beta version. I could observe that import_local_games is now called. Unfortunately it runs before authentication has finished, but that is something I have already dealt with.

Only thing not working now is import_owned_games, but I think the the topic of this issue has been resolved.

@mbanczerowski
Copy link

@Rall3n Reproduced and passed to Galaxy team.

Is far as I know both get_owned_games and get_local_games (again) should be called after authorization.
Is the issue with

Traceback (most recent call last):
  File "C:\Users\<username>\AppData\Local\GOG.com\Galaxy\plugins\installed\amazon_c2cd2e29-8b02-35a9-86fc-3faf90255857\plugin.py", line 80, in _get_local_games
    for row in self._local_games_db.select('DbSet', rows=['Id', 'Installed']) if row['Installed']

is this log error related to asking for local games before authentication? If so, consider raising galaxy.api.errors.AuthenticationRequired. It is currently not handle in Galaxy, but at least we'll gather some stats for future. Could you also explain why authentication is needed to access the db? It may be relevant for Galaxy future release as we considered separating local and owned games at all.

I is up to you to leave the current issue or resolve it and create another one. In the second case please leave a link so we can follow up. Thanks!

@Rall3n
Copy link
Owner

Rall3n commented Aug 16, 2021

@mbanczerowski

Is the issue with [...] is this log error related to asking for local games before authentication?

Yes. That is the error that is being thrown when trying to access the database before authentication has finished.

Could you also explain why authentication is needed to access the db? It may be relevant for Galaxy future release as we considered separating local and owned games at all.

As you may know, this plugin requires the Amazon Games app to be installed and authenticated in order to access relevant game data as the plugin does not use API endpoints in its current state. This includes both owned games and local games, both of which have their own SQLite database file.

The authentication process ensures that the app is installed and that both databases are present. If the application is removed between quitting and starting Galaxy, get_local_games would throw an error when trying to access the database, as the variables are not set.

I could hardcode the paths to both databases to ensure task completion without the need for authentication using pathlib and Windows environment variables, but I would like to avoid hardcoding a complete path.

If so, consider raising galaxy.api.errors.AuthenticationRequired. It is currently not handle in Galaxy, but at least we'll gather some stats for future.

I will consider throwing an exception with this class.

I is up to you to leave the current issue or resolve it and create another one. In the second case please leave a link so we can follow up.

I will keep this issue open for now, but will create another issue regarding the same problem with get_owned_games with a reference to this issue and a ping at you.

@mbanczerowski
Copy link

mbanczerowski commented Aug 17, 2021

@Rall3n thanks for explanation.

The authentication process ensures that the app is installed and that both databases are present. If the application is removed between quitting and starting Galaxy, get_local_games would throw an error when trying to access the database, as the variables are not set.

I've just checked your code and looks like no externally-dependent logic is performed on _on_auth. For the first time AmazonGames launcher installation state is checked here https://github.com/Rall3n/galaxy-integration-amazon/blob/master/src/client.py#L16 - on the plugin construction time. So I've just moved AmazonGamesPlugin._init_db to the plugin constructor and everything works (at least when Amazon client is installed). But it looks more logically correct to call AmazonGamesPlugin._init_db for the first time whenever the Amazon client installation is detected (which is actually already tracked periodically on a tick method). For example:

def tick(self):
    self._client.update_install_location()
    if self._client.is_installed:

      	if not self._owned_games_db:
            self._owned_games_db = ...
        if not self._local_games_db:
            self._local_games_db = ...

        # ...

Then returning empty list from get_local_games always when the client is not installed seems to be safe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants