Kapiainen / Lauhdutin

A Rainmeter skin for launching games.
MIT License
67 stars 8 forks source link

Certain non-steam games not launching. #25

Closed rig0 closed 7 years ago

rig0 commented 7 years ago

Short description of the issue

-Certain non-steam games don't launch when I click them. Can't really track down why. I'm still able to launch the games with the older version (before major overhaul) and I haven't done anything to break the steam shortcut (ex. change name or file path of game).

-I'm also stuck with "Downloading..." text on first banner. Doesn't go away even after the banners download.

Lauhdutin version

Lauhdutin 2.3.0 (Same problem with 2.4.0)

Rainmeter version

Latest Stable 4.0

Python version

Python 3.5 Installer

Windows version

Windows 7

Error messages

ERRO (16:26:11.229) : !ShowMeterGroup: Skin "Steam" not found ERRO (16:26:13.461) : !HideMeterGroup: Skin "Steam" not found

Steps to reproduce the issue

-Fresh install on lauhdutin 2.4.0 -Initial setup with GUI (steam folder, steam profile, banner size and count) -After banners load up (and i add my non-steam ones) "Downloading..." stays on the first banner even after a "rebuild skin" -I then test the banners and the official steam games work but not all non-steam games do.

Python stack traceback

screen

rig0 commented 7 years ago

After inspecting the "games.json" file I noticed that the shortcut paths for some non-steam games are not accurate. I double checked the ones that weren't working by adding a shortcut to my desktop and comparing the appid's. I suspect my problem lies in "shortcuts.vdf" or the parsing of it but I'm not exactly sure how to read that file. I tried Notepad++ (with the vdf languages) with no luck.

Kapiainen commented 7 years ago

Which of the non-Steam games are not working and which are working? You can open shortcuts.vdf in e.g. Sublime Text if you force it to be opened with UTF-8 encoding, but there will be some garbage characters. Perhaps NP++ has similar functionality. I'm not sure why a few .vdf files are not in plain text while most others are. The AppIDs for non-Steam game shortcuts are not stored in shortcuts.vdf though and they have to be generated, which is done by concatenating two strings (the path and the name of the shortcut), converting them to a bytes object, calculating the CRC32 checksum of that object, and then doing some bitwise operations on the checksum. If you could give me the name, path, and the valid AppID generated by Steam for one of the non-functioning shortcuts, then I could try to figure out why my script is generating invalid AppIDs in some cases. A couple sets of the aforementioned values would be even better.

I'm curious as to the origin (which skin triggered them) of the two error messages you listed and I just want to make sure that they are relevant. Have you specified a set of bangs to execute when starting game and/or a game stops running? If not, then try clearing Rainmeter's log and refreshing Lauhdutin. Do the errors still show up? When do they show up? Do they show up at a specific point in e.g. the execution of the backend scripts?

The issue with the Downloading... status message is really weird. The main backend Python script is clearly able to successfully execute Rainmeter bangs (or else Downloading... would not have shown up at all) and if the banners do show up, then the Lua function, which is responsible for hiding all status messages and displaying the banners, has been executed. It must be an issue on the Rainmeter/Lua side of things.

rig0 commented 7 years ago

Alright that clears up most things. So I think I figured out the problem and was able to replicate it for both cases. There are only 2 games that don't work, Overwatch and The Witcher 3 - Wild Hunt.

Overwatch The Witcher 3 - Wild Hunt
"G:\Overwatch\bnetlauncher.exe" pro "G:\The Witcher 3 Wild Hunt\bin\x64\witcher3.exe"
Steam AppID: 14319242745229606912 Steam AppID: 11050366780038971392
Skin AppID: 16449766400601358336 Skin AppID: 11519613212920119296

The first problem I suspect to be with the script to move "The" to the end of the name. Steam must be generating the AppID for The Witcher 3 - Wild Hunt while your script is generating the AppID for Witcher 3 - Wild Hunt, The. I was able to replicate it by adding another game beginning in "The". (See "The non-steam Test" below)

The second problem is with handling arguments passed to steam. As you can see above, I passed an argument to the Overwatch launcher in steam. The argument must be causing an issue with your AppID script. I replicated this issue by adding another game both with and without an argument. (See "Arguments Test" below)

The non-steam Test Arguments Test
"C:\Users\User\Desktop\Manager\test.exe" "C:\Users\ADMIN\Desktop\Test" pro
Steam AppID: 12819642840678137856 Steam AppID: 14965587966968201216
Skin AppID: 15302447929940246528 Skin AppID: 15833381985956397056

I tried "Arguments Test" without the argument first and it launched. I then added the argument and rebuilt the skin. When I tried to launch it again it didn't launch at all and the AppID in games.json changed.

As far as the error's from the rainmeter log, they happen every time I refresh or rebuild the skin. I am not using any custom bangs.

Kapiainen commented 7 years ago

Thanks for the thorough investigation. The issue encountered with The Witcher 3 - Wild Hunt should be fixed in the second alpha version of 2.4.0 that I just released. I'll look into adding support for arguments.

What is the path to the skin? Is it along the lines of \Rainmeter\Skins\Lauhdutin\ or have you modified the folder structure? There are a few places in the code that executes the !ShowMeterGroup and !HideMeterGroup bangs, but they would normally use Lauhdutin as the config/skin that they affect. I included a tentative fix for this in the new alpha as well.

Kapiainen commented 7 years ago

A new alpha version, which should fix the issue with non-Steam game shortcuts with arguments, is out. Regular Windows shortcuts with arguments still don't work properly.

rig0 commented 7 years ago

Thanks for the fast response. I admittedly changed the name of the skin to "Steam Launcher 2.4.0" so the path did change. I restored it to Lauhdutin and now the Downloading... is gone!

I also downloaded and tested the latest (2.4.0 Alpha 3) and can confirm both AppID issues have been fixed!

rig0 commented 7 years ago

Can also confirm that I'm able to rename the skin with no problem.

Kapiainen commented 7 years ago

Am I correct in assuming that the error messages are not appearing in the Rainmeter log now?

Adding support for arguments in regular Windows shortcuts is going to be tricky with my current quick and dirty method for parsing .lnk files.

rig0 commented 7 years ago

Yes, the Rainmeter log is clean of errors now.

I will take a look at the code for windows shortcuts and see if there's anything I can possibly contribute.

Kapiainen commented 7 years ago

The method that I'm currently using is opening the .lnk files as binary files, reading all of the contents one byte at a time, and going from there. The advantage is that I don't need to add any additional dependencies (e.g. pywin32) for the user to download and install, but it does mean that there are some limitations because it's all a bit of a mess when you do it like that. Lately I've been looking into what could be done with Python's ctypes module.

Kapiainen commented 7 years ago

Currently playing around with using scripts written in VBScript to get the target path and arguments.

Kapiainen commented 7 years ago

Support for arguments has been implemented and will be in the next alpha release.