Kapiainen / Lauhdutin

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

init.lua errors for latest stable and beta 4 releases #165

Open humanspida opened 3 years ago

humanspida commented 3 years ago

Short description of the issue

After installing skin, restarting Rainmeter, loading the skin, opening settings and making changes to the size and number of frames to display, then inputting the Steam client path... my Steam username is automatically added at this point. No other settings changed. No other platforms or windows shortcuts are enabled for the skin, only Steam. After saving and closing the settings - then refreshing, the skin throws an init.lua error and goes no further.

Expected behaviour was to load all the Steam games, which obviously didn't happen.

Lauhdutin version

Old Version 3.0.4 (with large grey settings window) - stopped working on 11 Sept' 2021, removed for latest stable

Version 3.0.4 (latest stable release) - didn't work, threw an error - provided below

Version 3.1.0 beta 4 - also didn't work, threw same error as stable, provided below

Rainmeter version

Version 4.5 (latest from website)

Python version

Version 3.9

Windows version

Windows 10 Pro 21H1 - Build 19043.1165

Error messages

Version 3.0.4 (old grey settings window) - only said "processing", no other details.

Version 3.0.4 (latest stable release) - init.lua:189: attempt to call method 'endsWith' (a nil value)

Version 3.1.0 beta 4 - init.lua:188: attempt to call method 'endsWith' (a nil value)

Steps to reproduce the issue

Not sure what's causing the issue to be honest. I only know from those init.lua errors that it's not finding what it wants in whichever lua file it's looking in and kacks itself when the information isn't present. If it cant find the games that probably just means it doesn't know where my games are because they're not in the default location. Strange, this wans't an issue before.

Steam client is in the default location of C:\Program Files (x86)\Steam Non-game programs from Steam are stored in the default location

Games are stored on a separate drive with the location of D:\Steam\Steamapps\Common This hasn't changed in years.

I see no way to add another steam location to the skin settings anywhere though... How would I add an alternative location?

Not using community profile parsing, have it disabled. Steam profile is all set to public anyway.

humanspida commented 3 years ago

Some added information that might help that I noticed was asked for on another, near 3 year old issue thread for games not displaying:

Have tried removing the \documents\Rainmeter\Skins\Lauhdutin\@Resources\cache folder and refreshing skin / reloading Rainmeter. Unsure if this is what fixed the init.lua error for the beta 4 release or not. Games still not displaying though obviously.

There are appmanifest files in the C:\Program Files (x86)\Steam\Steamapps folder - but only for the 3 programs that are installed in that location.

There are also appmanifest files in the D:\Steam\Steamapps folder - which would be for the games themselves as those are stored on that drive, separately from the non-game steamapps in the default location.

I don't think renaming the appmanifest files is necessary as everything worked fine up till today without having to do that ever in the past.

games.json is empty aside from a single string: {"games":[],"version":2,"tagsDictionary":[]}

Nathipha commented 3 years ago

Getting the same error. There was a big-ish Steam update yesterday (download queue looks different) and I'm worried that they changed something that the skin relies on. :/ I did also add a couple of non-Steam shortcuts myself but those don't show up either, unless I close the skin through Rainmeter, then open it again.

humanspida commented 3 years ago

Yes, now that you mention it, I remember opening the Steam client and seeing that the whole layout / look had changed rather dramatically and that's a recent change. It's entirely possible that they have changed how certain data is processed and accessed now.

Hopefully the skins most talented author can provide some tips on how to fix this or if that's not something we can do - update the skin to fix it for us from that end.

BanCrash commented 3 years ago

What Steam version do you have? @humanspida @Nathipha

I tried a fresh install of Lauhdutin and I'm not getting any issue of getting all my steam games (both installed and uninstalled) with the last Lauhdutin beta.

I have this steam version: image

EDIT: also not having any kind of issue in my used version.

EDIT2:

image

Only Steam selected on the fresh install, as you stated. This is what I get.

humanspida commented 3 years ago

I have same version of Steam, literally identical.

I get black bar with the words 'No games to show' on the left side

BanCrash commented 3 years ago

I have same version of Steam, literally identical.

I get black bar with the words 'No games to show' on the left side

Could you open filter.ini and check what do you get? I am interested on the "hidden games" part. Maybe your issue is that your games are detected as hidden games?

Nathipha commented 3 years ago

Yes, that's my Steam version too. Lauhdutin is version 3.1.0 beta 4. I did hide a bunch of Steam games, checking the ini in a second.

Edit: My Filter.ini hasn't been edited since 2018 (according to Windows' file explorer) and I'm not sure what to look for tbh (there's not "hidden games" part).

humanspida commented 3 years ago

oh wait... i clicked detect games and it spat the init.lua error at me again so I dont think opening the filter .ini is going to give me anything to work with...

That said... the filter.ini does have a line that points to an init.lua file and thats the error im getting init.lua:188: attempt to call method 'endsWith' (a nil value)

I ran the .ini file and cleared all filters, nothing. thats when I tried to detect games and got the init.lua error again

BanCrash commented 3 years ago

Sorry guys, you misunderstood me. I mean to open the Filter skin, you can also do it on the toolbar.

I mean, this:

image

and check if your games are being detected as "hidden games"

humanspida commented 3 years ago

no filters in play

only poxy init.lua:188: attempt to call method 'endsWith' (a nil value)

which would perhaps help... IF IT TOLD ME which bloody init.lua file it was because theres more than one init.lua and they're in different folders

What that DOES tell me is that on line 188 is where the issue is - obviously not finding the data it wants there

Nathipha commented 3 years ago

Oh sorry. The filter doesn't display anything, it just says "Filter" and the bottom part is empty. I tried to scroll down and the filter window displayed a different error: Error: init.lua:804: attempt to compare nil with number

@BanCrash Btw, thanks for looking into this! Sorry, I didn't see your last message in the other thread about looking at stuff.

@humanspida Before this error started appearing I kept getting a different lua error every time I started up my PC and I had to do "Reload Games" every time to actually display any games.

humanspida commented 3 years ago

same behaviour with my filter window if i launch it now i have the init.lua error on the bar

BanCrash commented 3 years ago

no filters in play

only poxy init.lua:188: attempt to call method 'endsWith' (a nil value)

which would perhaps help... IF IT TOLD ME which bloody init.lua file it was because theres more than one init.lua and they're in different folders

What that DOES tell me is that on line 188 is where the issue is - obviously not finding the data it wants there

Here you go, checking with notepad is easy to check what line is getting you the error:

image

This is part of the getLibraries function of Steam:

image

So yeah, there seems to be some kind of error with Steam in your case. Odd...

Let me think about it a little and see if I can think of something to test if we can know what is not working.

EDIT: The file is Lauhdutin\@Resources\main\platforms\steam\init.lua

humanspida commented 3 years ago

thanks for pinpointing the specific init.lua file, at least that's some small step farward... we know what file is kicking the error out and where it is now.

BanCrash commented 3 years ago

Ok @Nathipha @humanspida , let's try this little change:

if value and value:endsWith('\\') then

on the line 188 of the file that I pointed before.

EDIT: Be carerul, Github removes one of the backlash! now it's fixed

humanspida commented 3 years ago

same init.lua error if you exit rainmeter and restart it says 'no games to show' but when you click detect it throws that line 188 error again

BanCrash commented 3 years ago

same init.lua error

Yeah, I didn't think about it enough. I will take more time xD

humanspida commented 3 years ago

that whole getLibraries function starts at line 175 could there be an issue earlier in that section that causes the line 188 to not get what it needs?

my D:\Steam\Steamapps\libraryfolders.vdf has plenty of entries

BanCrash commented 3 years ago

I think the issue is that there is not getting the rainmeter_helpers on that function for some reason.

Just to check if I'm right, could you add this on line 176 and see if this solves the issue? dofile(('%s%s'):format(STATE.PATHS.RESOURCES, 'lib\\rainmeter_helpers.lua'))

Please understand that since I can't replicate the bug all I'm saying it's for testing since I don't have a way to check if it works.

humanspida commented 3 years ago

so add that on line 176 BEFORE what is currently on that line? pushing whats currently on that line down one line, yes ?

BanCrash commented 3 years ago

so add that on line 176 BEFORE what is currently on that line? pushing whats currently on that line down one line, yes ?

That's correct:

image

humanspida commented 3 years ago

i get the error moved to line 189 now which makes sense since everythings moved down one line

init lua

heres a screenie of that section of my init.lua file

BanCrash commented 3 years ago

i get the error moved to line 189 now which makes sense since everythings moved down one line

Do you know if that file stores any kind of personal information? If no, could you paste here one line of that file? I mean, libraryfolders.vdf file. I don't know how to debug this since I can't replicate the bug.

humanspida commented 3 years ago

the librayfolders.vdf just names content folders by their number ID and links the appmanifest file to it it seems EG: appmanifest 400 is a file in the steamapps folder

libraryfolders vdf
BanCrash commented 3 years ago

Since you don't have any trouble showing it, could you upload the file here then? So I can replace mine and check what it's going on.

humanspida commented 3 years ago

which file you want? my init.lua from main\platforms?

or you want the libraryfolders.vdf ? I dont think the vdf will be any use to you coz it just tells my steam client whats in the folders and which appmanifest goes with which folder / game...without the associated folders its not a lot of use, just junk data, no?

BanCrash commented 3 years ago

which file you want? my init.lua from main\platforms?

or you want the libraryfolders.vdf ? I dont think the vdf will be any use to you coz it just tells my steam client whats in the folders and which appmanifest goes with which folder / game...without the associated folders its not a lot of use, just junk data, no?

libraryfolders.vdf it's the file that are making you to have that error. If you send me that file, I should be able to replicate the bug (at least I think so checking the code).

humanspida commented 3 years ago

So, probably should block out one piece of data on that VDF - the contentstatsid which I've seen replaced with many X's on other threads so I'll redact it and re-add it shortly... Probably shouldn't send it to anyone either.

For a little test, I yanked the VDF file out of its home in the Steam folder in the default location and restarted steam. As you would expect, Steam recreated the VDF when it opened. It's identical to the original, games launch fine and are recognised as installed in steam library window.

This leads me to believe that the format of the VDF has changed or there's something off about the way the skin accesses the information in the VDF

This thread mentions differences in the VDF structure usage for another game: https://playnite.link/forum/thread-705-post-4836.html

This thread also speaks of the format change: https://www.reddit.com/r/LogitechG/comments/oujeo9/update_broke_game_detection/

There's also this, that talks about changes to the VDF and how they broke a bunch of shit with it: https://githubmemory.com/repo/LostDragonist/steam-library-setup-tool/issues

humanspida commented 3 years ago

OK... Based on the information in those threads I provided just above. I decided to do a bit more testing. I managed to PARTIALLY fix the behaviour and make the skin detect games again and start downloading banners by reverting to the OLD format for the VDF file, which looks like this in my case:

"LibraryFolders" { "ContentStatsID" "XXXXXXXXXXXXXXXXXXX" "1" "D:\Steam" }

The problen now is that it thinks Steam isn't running for some reason and when you click a game tile it crashes the skin... AND also that Steam just overwrites the VDF file with the new version format whenever it feels like it - usually on start/restart.

BanCrash commented 3 years ago

Ok, since you cant send me the file, could you tell me how I can generate it? Mine is empty (well, only one line but unrelated I think)

BanCrash commented 3 years ago

Okay, using your reddit link I think I made a solution, please let me know if this works for you. Replace all the function getLibraries with this:

getLibraries = function(self)
      log('Getting Steam libraries from libraryfolders.vdf')
      local libraries = {
        io.joinPaths(self.steamPath, 'steamapps\\')
      }
      local libraryFoldersPath = io.joinPaths(self.steamPath, 'steamapps\\libraryfolders.vdf')
      if io.fileExists(libraryFoldersPath, false) then
        local file = io.readFile(libraryFoldersPath, false)
        local lines = file:splitIntoLines()
        local vdf = utility.parseVDF(lines)
        if type(vdf.libraryfolders) == 'table' then
          for key, value in pairs(vdf.libraryfolders) do
            if tonumber(key) ~= nil then
              if type(value) == 'table' then
                for subkey, subvalue in pairs(value) do
                    if subkey == 'path' then
                        if subvalue:endsWith('\\') then
                        subvalue = subvalue .. '\\'
                        end
                        table.insert(libraries, io.joinPaths((subvalue:gsub('\\\\', '\\')), 'steamapps\\'))
                    end
                end
              else
                  if value:endsWith('\\') then
                    value = value .. '\\'
                  end
                  table.insert(libraries, io.joinPaths((value:gsub('\\\\', '\\')), 'steamapps\\'))
            end
            end
          end
        else
          log('\\Steam\\steamapps\\libraryfolders.vdf does not contain a table called "libraryfolders".')
        end
      else
        log('Could not find "\\Steam\\steamapps\\libraryfolders.vdf"')
      end
      self.libraries = libraries
    end,

You have to delete from line 175 to line 201 (or 202 if you have added the previous line I've told you, the dofile line) and add this code on that line.

It's not respecting indentation and that kind of stuff, if this works I will made the change to moon file directly.

EDIT: This is how it should looks like: image

humanspida commented 3 years ago

Ok, since you cant send me the file, could you tell me how I can generate it? Mine is empty (well, only one line but unrelated I think)

Your libraryfolders.vdf will autopopulate when you have a separate steam library from the default location with things installed to it. So, create a folder somewhere else, point the steam library settings to it as an additional library folder and install a few things to make steam populate the VDF for you.

I had to jet out to take care of a few things and am about to cook some food but I will test your revision to that section of code after wards, probably be an hour or so before I can test it and get back to you.

BanCrash commented 3 years ago

Ok, since you cant send me the file, could you tell me how I can generate it? Mine is empty (well, only one line but unrelated I think)

Your libraryfolders.vdf will autopopulate when you have a separate steam library from the default location with things installed to it. So, create a folder somewhere else, point the steam library settings to it as an additional library folder and install a few things to make steam populate the VDF for you.

I had to jet out to take care of a few things and am about to cook some food but I will test your revision to that section of code after wards, probably be an hour or so before I can test it and get back to you.

No need to hurry, test it whenever you can. If it doesn't work I will follow your steps to generate my own file.

humanspida commented 3 years ago

Yea, that broke Rainmeter entirely for me - couldn't see any of the 2 other simple skins or open rainmeter at all. Resorted to deleting Lauhdutin and replacing the entire skin file instead of messing about.

Now I've restored the Lauhdutin skin folder from the zip-file download and made those changes in the init.lua file in the \platforms\steam folder it can now see that I have games installed and has downloaded the banners for the tiles but it still thinks steam isn't running when it most certainly IS running.

Here's a screenie of that section of my init.lua:

init lua-1

BanCrash commented 3 years ago

Yea, that broke Rainmeter entirely for me - couldn't see any of the 2 other simple skins or open rainmeter at all. Resorted to deleting Lauhdutin and replacing the entire skin file instead of messing about

Could you try again without refreshing and show me on notepad? I think you replaced it wrong since it was working fine to me

humanspida commented 3 years ago

One step closer, sees all the steam installed items and downloads banners for the tiles. You're probably right about that first attempt and getting it misplaced. Need to somehow make it recognise that Steam is running - clicking a tile does now launch the game BUT it also crashes the skin and it then needs unloading and reloading to bring it back. Doesn't matter if Steam is just sitting in system tray or is open on the desktop - apparently it's not running

BanCrash commented 3 years ago

One step closer, sees all the steam installed items and downloads banners for the tiles. You're probably right about that first attempt and getting it misplaced. Need to somehow make it recognise that Steam is running - clicking a tile does now launch the game BUT it also crashes the skin and it then needs unloading and reloading to bring it back. Doesn't matter if Steam is just sitting in system tray or is open on the desktop - apparently it's not running

Are u sure it's crashing? There is an option to hide the skin while playing a game, could you check if you have it enabled?

About the not running issue, IIRC I solved that issue some time ago. When I am at home I will check it.

humanspida commented 3 years ago

Yea, you were right about that hide while game running setting being selected. It wasn't crashing - it was sneaking off for a cheeky break when it thought I wasn't looking. Thanks for pointing that out, would have driven me nutty otherwise.

BanCrash commented 3 years ago

Glad to read it. So, that code solves your initial issue, right?

humanspida commented 3 years ago

In the words of the legendary Austin Powers: Yeah Baby !!

Its just that odd Steam is not running thing on hover which is a trivial thing really.

Oh and I've discovered it throws a different init.lua error if you try to open the Game.ini in the menu, the error is as follows:

init.lua:926: attempt to index field 'GAME_BEING_MODIFIED' (a nil value)

I was just poking about the settings looking to reaccustomise myself with it now its changed from what I knew. This doesn't persist if you close that ini window and refresh the skin. All goes back as it was with the not running thing on hover

BanCrash commented 3 years ago

In the words of the legendary Austin Powers: Yeah Baby !!

Its just that odd Steam is not running thing on hover which is a trivial thing really.

Oh and I've discovered it throws a different init.lua error if you try to open the Game.ini in the menu, the error is as follows:

init.lua:926: attempt to index field 'GAME_BEING_MODIFIED' (a nil value)

I was just poking about the settings looking to reaccustomise myself with it now its changed from what I knew. This doesn't persist if you close that ini window and refresh the skin. All goes back as it was with the not running thing on hover

Nice!

I can confirm you that I solved the steam not running that issue long time ago and it's a simple change, when I am at home I will let you know how to do it.

About the other, could be the second time you open the same game? I mean, if you open game.ini for, for example, "Cs go", it works well the first time, but not for the second. And if the second time instead of opening again the game.ini menu for "cs go" you open the menu for "cs 1.6" it works fine.

humanspida commented 3 years ago

Thats great, thanks for all your assistance with troubleshooting this awesome skin to keep it working for me.

Have noticed it doesn't save your sorting choice across refreshing the skin, I have to change the sort option everytime it loads/refreshes to what I want - is there any way to make it remember your selection?

Doesn't seem to matter which game I try to open Game.ini for, they all throw up the same init.lua:926 etc, etc That particular line in the init.lua in the game folder is part of a section of code that starts at line 905 by the looks of it

Not that it's a huge deal for me, I'm not going to be making any advanced changes myself, I only use the skin to help keep my desktop clean and for the swag factor of having a sexy game launcher embedded on my desktop. Figured I'd bring up the Game.ini error though since, I've got someones attention who knows what they're doing

Nathipha commented 3 years ago

@humanspida What did you do to fix the problem exactly? Did you just replace parts of the code with the code BanCrash posted?

humanspida commented 3 years ago

Yep, input your preferences for how you want it to look and slap in your setup options in the settings window, then follow BanCrash's steps and instructions on replacing the getLibraries section of the code in the init.lua found in main\platforms\steam folder and restart Rainmeter. It should then start to download banners for the game tiles and launch according to your settings.

The issue seemed to stem from a change in the format of the data that's written to the VDF file by Steam and how the skin was trying to read it, if with my limited understanding of the code and what I read on a couple posts elsewhere is correct.

It still shows "steam not running" if you have the overlay enabled but you can disable the overlay and you wont see that anymore. BanCrash said they have a fix for that though and said they'd share it when they get home and have a moment to do so. Good times, eh?

Nathipha commented 3 years ago

Did you also reinstall the skin beforehand?

humanspida commented 3 years ago

I did because when I added that block of replacement code I botched it the first time. Probably not necessary to completely replace the entire folder if you dont botch the code paste.

BanCrash commented 3 years ago

I did because when I added that block of replacement code I botched it the first time. Probably not necessary to completely replace the entire folder if you dont botch the code paste.

Yep, shouldn't be necessary.

@Nathipha I will make (maybe tomorrow) a PR to this repository if you prefer to wait, though since it won't be merged you will have to download the file manually and replace it, but maybe it's better to you than to manually modify the file.

@humanspida the fix for steam not running:

In the same file (Lauhdutin@Resources\main\platforms\steam\init.lua), go to line 589 and replace this original line: self.platformProcess = 'Steam.exe' with this: self.platformProcess = 'steam.exe'

I will include this change also on that PR.

humanspida commented 3 years ago

That line of code for me is on line 590 for whatever reason now.... and that's all it is - a simple switch from an upper case S to a lowercase one. Thats excellent, who doesn't like a beautifully simple fix every once in a while.

Thanks very much

humanspida commented 3 years ago

Is it possible to have the sort options persist across restarts?... I like to have my display sorted by most recently played usually.

BanCrash commented 3 years ago

Is it possible to have the sort options persist across restarts?... I like to have my display sorted by most recently played usually.

Not with the actual version. Again IIRC I also added that change on my own version, but can't confirm now. Until I check that, you can see if my answer to this issue solves your issue at the moment: #153