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

SteamDir::apps() not returning complete list of apps #6

Closed
super-continent opened this issue Apr 24, 2022 · 13 comments · Fixed by #9
Closed

SteamDir::apps() not returning complete list of apps #6

super-continent opened this issue Apr 24, 2022 · 13 comments · Fixed by #9
Assignees

Comments

@super-continent
Copy link

I tried using this crate to try and find a specific game (Guilty Gear XX Accent Core +R) with the ID 348550 and could not find it in the list returned by apps() or app(&384550), I looked in the steam library folder and the appmanifest_384550.acf is there and appears valid. I skimmed the code in this repository and couldn't seem to find any obvious bugs. Is there a possible solution?

@CosmicHorrorDev
Copy link
Collaborator

CosmicHorrorDev commented Apr 27, 2022

Can you share:

  • The version of this lib you're using (cargo pkgid steamlocate should show this info when you run it within the project)
  • The relevant portion of the code you're using
  • Your OS (helps debugging platform specific differences)

I bought the game to try and repro and didn't run into any issues. Note: I didn't test on windows, but it should work fine there too.

Cargo.toml

[package]
name = "repro"
version = "0.1.0"
edition = "2021"

[dependencies]
steamlocate = "1.0.1"

main.rs

fn main() {
    let mut steam_dir = steamlocate::SteamDir::locate().unwrap();
    println!("{:#?}", steam_dir.app(&348550).unwrap());
}

Anonymized output:

SteamApp {
    appid: 348550,
    path: "/path/to/steam_home/Steam/steamapps/common/Guilty Gear XX Accent Core Plus R",
    vdf: Table(
        {
            ...
        }
    ),
    name: Some(
        "GUILTY GEAR XX ACCENT CORE PLUS R",
    ),
    last_user: Some(
        12312312312312312,
    ),
}

@super-continent
Copy link
Author

I'm running Windows 10 right now, and I'm using steamlocate 1.0.1

My relevant code is this, which is essentially a copy-paste of your example above:

fn main() {
    let mut steam_dir = SteamDir::locate().unwrap();
    println!("{:#?}", steam_dir.app(&348550).unwrap());
}

the above code yields None despite the needed files being where all the others are

@super-continent
Copy link
Author

would you like the contents of the appmanifest? It seems that this issue occurs with many titles in my library, but not the entirety of the library, just a very large portion. That makes me think it may be an issue with the appmanifest contents themselves

@CosmicHorrorDev
Copy link
Collaborator

The two main relevant files will be libraryfolders.vdf and the app manifest. Here are the relevant bits of mine

"libraryfolders"
{
	"contentstatsid"		"-123123123123"
	"0"
	{
		"path"		"/path/to/steam_home/Steam"
		...
		"apps"
		{
			...
			"348550"		"2253444850"
			...
		}
	}
	"1"
	{
		"path"		"/path/to/second/lib"
		...
		"apps"
		{
			...
		}
	}
}

So you can see I have two libraries and we see the entry for the game you mention in the first along with its size in bytes, and then there is also the manifest

"AppState"
{
	"appid"		"348550"
	...
	"name"		"GUILTY GEAR XX ACCENT CORE PLUS R"
	...
}

I believe that None is kinda a generic 'Something unexpected may have happened' response, so it's possible that any number of things tripped it up. I'll have to try and check on my windows machine, but anti-virus kept silently killing the last executable I cross-compiled to test

@super-continent
Copy link
Author

My libraryfolders.vdf and appmanifest_348550.acf seem to contain the same exact info as what you posted, I'm really unsure what could be the issue now

@CosmicHorrorDev
Copy link
Collaborator

If you want to post them in full and scramble any seemingly personal ids you can. You can also email me a copy of both of them if you don't feel comfortable posting them publicly, and I can dig in more (email is on my github profile). Vdf is not well defined and the parser we use for the table is known to be problematic, so it could be that parser failing

@super-continent
Copy link
Author

I sent libraryfolders.vdf over through email, hoping that contains the thing triggering out possible parser bug

@super-continent
Copy link
Author

At a glance though, I didnt notice anything different from other VDF file examples, it seems to conform to the format. Maybe some of the whitespace characters are causing a problem

@CosmicHorrorDev
Copy link
Collaborator

CosmicHorrorDev commented Apr 27, 2022

Thanks for sending that over!

I received it and there doesn't seem to be anything abnormal about it (and testing it out indicates that it picks up the paths to the libraries just fine. From what you said before where it was only picking up some of your games it sounds like the issue is parsing some specific app manifests, so the likely problematic file would be the app manifests for any apps that should show up and don't

Just to give some context this library currently uses 2 different VDF parsers. The one that was originally used for everything and is known to be problematic, steamy_vdf, and the new one that was added that I wrote keyvalues-parser. I've been meaning to switch everything over to using keyvalues-parser, but have been busy with life

Even something simple like having the string "" will break the steamy_vdf parser and is why I originally implemented a whole new parser (since I was trying to use it to parse valheim server's app manifest way back when I was helping on a docker image for hosting servers and it had a value that was just ""), and is also why this library partially switched over when steam changed the libraryfolders.vdf format to typically hold a "label" "" in #4

That's a lot of history to say that likely the issue is with the app manifest parsing, and that at least the problem wasn't my parser 😄. If you want you can send me your app manifest file and I can check to see if it fails parsing with steamy_vdf (or you can setup a test program that tries parsing its contents if you want)

@super-continent
Copy link
Author

I sent over an app manifest, hopefully thats where the issue is

@CosmicHorrorDev
Copy link
Collaborator

Thanks for working with me on all of this. I know it can be hard to keep up with issues that require a lot of back and forth :)

It's a VDF parse error from the empty string issue I mentioned above 🎉! The good news is that it parses fine with keyvalues-parser, so the logical fix is to swap all parsing over. That'll be a breaking change, so I'll throw together a 'v2.0 Roadmap' sometime over the next couple of days since we may as well lump in other changes and cleanup. Just for reference here is the problematic path

"AppState"
{
    // ...
    "UserConfig"
    {
        // ...
        "betakey"    ""  // <-- empty string here fails parsing with `steamy-vdf`
    }
}

Let me know if you want a workaround of some sorts. It's worth noting that putting a value in the empty string, or removing the line that has the empty string causes steamy-vdf to be able to parse it successfully. I can also put up a branch with a temporary fix, but the proper fix will take more work and I'll be moving in a couple weeks, so it probably won't be out until a few weeks from now at the earliest

@CosmicHorrorDev CosmicHorrorDev self-assigned this May 2, 2022
@super-continent
Copy link
Author

Nice! Glad the issue was found, I hopefully will be able to contribute to moving parsing over to keyvalues-parser sometime as the roadmap is developed

@CosmicHorrorDev
Copy link
Collaborator

This should be fixed in the 2.0.0-alpha.0 release

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

Successfully merging a pull request may close this issue.

2 participants