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

Binary VDF support? #6

Open
SteffanDonal opened this issue Dec 11, 2017 · 6 comments
Open

Binary VDF support? #6

SteffanDonal opened this issue Dec 11, 2017 · 6 comments

Comments

@SteffanDonal
Copy link

Hey!

Recently you fixed an issue where it would throw if the VDF was empty - thanks for that. I've been poking around Steam and I've found a very useful looking file: Steam\appcache\appinfo.vdf

Problem is it's using binary VDF, which doesn't seem to be supported.

Are there any plans to extend this library to support it? If not, would you be open to accepting a pull request that adds support?

@shravan2x
Copy link
Owner

I have no plans to implement binary VDF support right now, but a PR sounds great if you can work on it!

The text-based VDF format is fairly documented, but the binary one isn't. There are some good links at this Reddit post. There's also the leaked Source engine code from a while back.

We'll have to see how significant a change this would be for the API. Given a stream, can we detect if it is regular VDF or binary? Are there changes to how the data is structured?

@shravan2x
Copy link
Owner

@SteffanDonal If you haven't worked on this yet, I plan to do so sometime soon.

@shravan2x
Copy link
Owner

Okay so I looked into this a while back, and the biggest problem is that most of Steam's VDF files like appinfo.vdf use built-in models along with the binary VDF data. To read a file like that, the library would need to store Steam specific models somewhere, which I'd like to avoid.

On idea would be to use a separate package like Gameloop.Vdf.Steam.Models to store them.

@FlaminSarge
Copy link

Heads up, it seems like the binary format for VDF files is pretty straightforward when it comes to grabbing field names/values, as per shortcuts.vdf and https://github.com/CorporalQuesadilla/Steam-Shortcut-Manager/wiki/Steam-Shortcuts-Documentation (though that's slightly outdated as it's missing fields and misunderstands little-endian ints as booleans with 3-byte 00 padding).
The main issue would be getting past the file header (as in appinfo.vdf); from what I understand, VdfConvert only needs the field/property names, values, and value types, is that correct?

@shravan2x
Copy link
Owner

@FlaminSarge

from what I understand, VdfConvert only needs the field/property names, values, and value types, is that correct?

In text based VDF (i.e. KV1), all values are strings. In KV2, they have specific types. I'm unsure about binary VDF.

The main issue would be getting past the file header (as in appinfo.vdf)

It's been a while since my deep dive on binary VDF. IIRC each file like appinfo.vdf or shortcuts.vdf had custom structures that were specific to each file. This led to my suggestion on creating a separate package for them. But it's possible I may be misremembering it.

I'm happy to consider/discuss any suggestions you may have for this. One TODO is to see how the leaked source engine code does it.

@tekgator
Copy link

tekgator commented Jul 6, 2022

Just a heads up: The guys responsible for ValveKeyValue have implemented it in there library. They have a Sample project available as well.

Maybe it helps implementing it in your amazing library.

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

No branches or pull requests

4 participants