tylerbrawl / Galaxy-Plugin-Rockstar

MIT License
70 stars 7 forks source link

Tracking hours does not work with the plugin #97

Closed naobug closed 4 years ago

naobug commented 4 years ago

HI, although I have successfully connected GOG with the Rockstar plugin and also lists GTA5/GTAOline it does not track my game hours although I started it through GOG (which starts the Rockstar launcher, which starts GTA5, where I then select "play online").

Before I used the Rockstar plugin, I just added the GTA.exe manually. Doing so I could track the hours. But with the plugin it doesn't work for me, it doesn't count up.

Maybe this due to the new Rockstar Launcher?

tylerbrawl commented 4 years ago

Unfortunately, the GPU for my computer had to be replaced via RMA due to graphical artifacts, so it will be some time before I will be able to look into this.

In the mean time, however, could you post your latest log file for the Rockstar plugin?

naobug commented 4 years ago

Could you tell me whre the logs are stored? I looked under C:\Users\userone\AppData\Local\GOG.com\Galaxy\plugins\installed\rockstar_774732b5-69c4-405c-b6c9-92cd55740cfe But there are no logs.

tylerbrawl commented 4 years ago

This is the location of the log file, although I am unable to see anything about launching GTA V in it. Would you be able to launch GTA V from Galaxy 2.0 and then submit the log file again? This should ensure that launch requests are detailed within it.

naobug commented 4 years ago

Sure, I started the Game around 22:03

plugin-rockstar-774732b5-69c4-405c-b6c9-92cd55740cfe.log

naobug commented 4 years ago

2020-02-25 22:03:04,362 - galaxy.api.jsonrpc - DEBUG - Received 66 bytes of data 2020-02-25 22:03:04,362 - galaxy.api.jsonrpc - INFO - Handling notification: method=launch_game, params={'game_id': '11'} 2020-02-25 22:03:04,362 - galaxy.task_manager - DEBUG - Task manager jsonrpc server: creating task 285 (launch_game) 2020-02-25 22:03:04,362 - galaxy.task_manager - DEBUG - Task manager plugin external: creating task 426 (launch_game) 2020-02-25 22:03:04,362 - root - DEBUG - ROCKSTAR_INSTALLER_PATH: 2020-02-25 22:03:04,362 - root - DEBUG - ROCKSTAR_LAUNCH_REQUEST: Requesting to launch E:\Grand Theft Auto V\PlayGTAV.exe... 2020-02-25 22:03:05,516 - galaxy.task_manager - ERROR - Task manager jsonrpc server: exception raised in task 285 (launch_game) Traceback (most recent call last): File "C:\Users\userone\AppData\Local\GOG.com\Galaxy\plugins\installed\rockstar_774732b5-69c4-405c-b6c9-92cd55740cfe\galaxy\task_manager.py", line 21, in task_wrapper result = await coro File "C:\Users\userone\AppData\Local\GOG.com\Galaxy\plugins\installed\rockstar_774732b5-69c4-405c-b6c9-92cd55740cfe\galaxy\api\plugin.py", line 295, in wrapper return await self._external_task_manager.create_task(handler(args, kwargs), name, False) File "C:\Users\userone\AppData\Local\GOG.com\Galaxy\plugins\installed\rockstar_774732b5-69c4-405c-b6c9-92cd55740cfe\galaxy\task_manager.py", line 21, in task_wrapper result = await coro File "C:\Users\userone\AppData\Local\GOG.com\Galaxy\plugins\installed\rockstar_774732b5-69c4-405c-b6c9-92cd55740cfe\plugin.py", line 652, in launch_game game_pid = await self._local_client.launch_game_from_title_id(title_id) File "C:\Users\userone\AppData\Local\GOG.com\Galaxy\plugins\installed\rockstar_774732b5-69c4-405c-b6c9-92cd55740cfe\local.py", line 90, in launch_game_from_title_id launcher_pid = await self.game_pid_from_tasklist("launcher") File "C:\Users\userone\AppData\Local\GOG.com\Galaxy\plugins\installed\rockstar_774732b5-69c4-405c-b6c9-92cd55740cfe\local.py", line 70, in game_pid_from_tasklist for line in output.decode(locale.getpreferredencoding()).splitlines(): File "D:\obj\Windows-Release\37win32_Release\msi_python\zip_win32\cp1252.py", line 15, in decode UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 74: character maps to \

tylerbrawl commented 4 years ago

I have attached a build that could potentially fix the issues that you are having. I will not be pushing the changes until I can test them myself, but I would appreciate it if you could report whether or not this fixes your issue.

To install the build, place the Rockstar folder within Plugin.zip into C:\Users\[Your-Username]\AppData\Local\GOG.com\Galaxy\plugins\installed\Rockstar. Replace all files as necessary, although you may want to create a backup of your personal config.cfg file.

Plugin.zip

naobug commented 4 years ago

Now the error line relating to Unicode and charmap looks like this: UnicodeDecodeError: 'utf-8' codec can't decode byte 0x81 in position 74: invalid start byte And the time still didn't count up.

tylerbrawl commented 4 years ago

I have another build that you can test. Let me know if this version fixes your issue.

Plugin.zip

naobug commented 4 years ago

No success, sadly. 2020-02-26 13:00:05,066 - galaxy.api.jsonrpc - INFO - Handling notification: method=launch_game, params={'game_id': '11'} 2020-02-26 13:00:05,066 - galaxy.task_manager - DEBUG - Task manager jsonrpc server: creating task 9 (launch_game) 2020-02-26 13:00:05,067 - galaxy.task_manager - DEBUG - Task manager plugin external: creating task 12 (launch_game) 2020-02-26 13:00:05,067 - root - DEBUG - ROCKSTAR_INSTALLER_PATH: *** 2020-02-26 13:00:05,067 - root - DEBUG - ROCKSTAR_LAUNCH_REQUEST: Requesting to launch E:\Grand Theft Auto V\PlayGTAV.exe... 2020-02-26 13:00:06,108 - galaxy.task_manager - ERROR - Task manager jsonrpc server: exception raised in task 9 (launch_game) Traceback (most recent call last): File "C:\Users\userone\AppData\Local\GOG.com\Galaxy\plugins\installed\rockstar_774732b5-69c4-405c-b6c9-92cd55740cfe\galaxy\task_manager.py", line 21, in task_wrapper result = await coro File "C:\Users\userone\AppData\Local\GOG.com\Galaxy\plugins\installed\rockstar_774732b5-69c4-405c-b6c9-92cd55740cfe\galaxy\api\plugin.py", line 295, in wrapper return await self._external_task_manager.create_task(handler(*args, **kwargs), name, False) File "C:\Users\userone\AppData\Local\GOG.com\Galaxy\plugins\installed\rockstar_774732b5-69c4-405c-b6c9-92cd55740cfe\galaxy\task_manager.py", line 21, in task_wrapper result = await coro File "C:\Users\userone\AppData\Local\GOG.com\Galaxy\plugins\installed\rockstar_774732b5-69c4-405c-b6c9-92cd55740cfe\plugin.py", line 652, in launch_game game_pid = await self._local_client.launch_game_from_title_id(title_id) File "C:\Users\userone\AppData\Local\GOG.com\Galaxy\plugins\installed\rockstar_774732b5-69c4-405c-b6c9-92cd55740cfe\local.py", line 90, in launch_game_from_title_id launcher_pid = await self.game_pid_from_tasklist("launcher") File "C:\Users\userone\AppData\Local\GOG.com\Galaxy\plugins\installed\rockstar_774732b5-69c4-405c-b6c9-92cd55740cfe\local.py", line 67, in game_pid_from_tasklist f' /FO LIST', stdout=subprocess.PIPE, stderr=subprocess.PIPE) File "D:\obj\Windows-Release\37win32_Release\msi_python\zip_win32\subprocess.py", line 775, in __init__ File "D:\obj\Windows-Release\37win32_Release\msi_python\zip_win32\subprocess.py", line 1178, in _execute_child FileNotFoundError: [WinError 2] Das System kann die angegebene Datei nicht finden

The last bit means: The system couldn't find the specified file. Also on my system there is no path called D:\obj\Windows-Release\ There is no obj folder under D:\ Also a subprocess.py can rather be found under "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.496.0_x64__qbz5n2kfra8p0\Lib" plugin-rockstar-774732b5-69c4-405c-b6c9-92cd55740cfe.log

tylerbrawl commented 4 years ago

Judging from the error in the log file, is it safe to assume that the language of the computer is not set to English? This would explain the error relating to attempting to decode byte 0x81 (the character ü in CP437) with the original decoding scheme used by this plugin (CP1252, which has no character for the byte 0x81).

In an attempt to fix this, I wanted to send the chcp 65001 command to the console to ensure that the UTF-8 (CP65001) encoding is used, but this version produced the FileNotFoundError exception seen in the last log file. I believe this is due to not having the shell parameter of subprocess.Popen set to True, causing the module to attempt to open the application called chcp 65001 & [...]; since this file does not exist, however, we get the aptly titled FileNotFoundError exception.

I wish to thank you for your patience in helping me diagnose and debug this problem. I have attached another build to this post.

Plugin.zip

naobug commented 4 years ago

Thank you. Yes the language is set to German. And with yourlatest modification it finally counts the time. Also now a new file has been created under F:\Daten\Documents called "RockstarPlayTimeCache.txt"

tylerbrawl commented 4 years ago

Thanks for debugging this issue. I will leave the issue open and refrain from pushing the changes until I can test that it works on my own computer.

tylerbrawl commented 4 years ago

I tested this fix on my computer, and it still works fine. I have pushed the changes to the fog_release branch, so they should appear in the next update. As such, I will close this issue.