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

Use Steam manifest format #476

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

NicknineTheEagle
Copy link
Contributor

@NicknineTheEagle NicknineTheEagle commented Feb 12, 2024

This migrates DepotDownloader to the original manifest format used by Steam, phasing out the pseudo-format from the old days before Steam itself was using protobuf. The output manifest files stored in download dir are compatible with Steam client and match what you can find in Steam's depotcache dir.

@NicknineTheEagle
Copy link
Contributor Author

NicknineTheEagle commented Feb 22, 2024

Needs SteamKit with SteamRE/SteamKit#1337 merged since very large depots are slow to serialize without it.

@xPaw
Copy link
Member

xPaw commented Jul 21, 2024

This would be a breaking change. Can we have a backwards compat for the ProtoManifest.LoadFromFile?

And can you make a separate PR for the error related commits.

@NicknineTheEagle
Copy link
Contributor Author

This would be a breaking change. Can we have a backwards compat for the ProtoManifest.LoadFromFile?

Not sure how to handle it. Option A is converting from ProtoManifest to DepotManifest which would be tricky since the former doesn't have all the data from the latter. Option B is handling both of these types in tandem which would be a pure nightmare.

@xPaw
Copy link
Member

xPaw commented Jul 21, 2024

the former doesn't have all the data from the latter.

What data that is needed is missing?

@xPaw
Copy link
Member

xPaw commented Aug 6, 2024

@azuisleet what do you think? I currently can't update to last SK because it changed the chunk checksum from byte[] to uint, and the breaks the proto contract of the ProtoManifest.

@NicknineTheEagle can you rebase and undo the log message changes please.

@NicknineTheEagle NicknineTheEagle force-pushed the nn/steam-manifest branch 2 times, most recently from fd5b78b to 5a15493 Compare August 6, 2024 13:45
@NicknineTheEagle
Copy link
Contributor Author

@NicknineTheEagle can you rebase and undo the log message changes please.

Done.

What data that is needed is missing?

I don't believe anything that is needed by DepotDownloader is missing but ProtoManifest format is missing a few fields from Steam manifest, for example, filename hashes and symlinks. We can convert from ProtoManifest to DepotManifest and the result will be valid for DepotDownloader but probably not valid for other tools that work with Steam manifest format.

@xPaw
Copy link
Member

xPaw commented Aug 6, 2024

We can convert from ProtoManifest to DepotManifest and the result will be valid for DepotDownloader but probably not valid for other tools that work with Steam manifest format.

We only care about backwards compat on ProtoManifest.LoadFromFile for the cached files, we don't need to save them back.

If .bin exists, load proto, then the proper .manifest, always save .manifest.

DepotDownloader/Util.cs Outdated Show resolved Hide resolved
@NicknineTheEagle
Copy link
Contributor Author

NicknineTheEagle commented Aug 6, 2024

We can convert from ProtoManifest to DepotManifest and the result will be valid for DepotDownloader but probably not valid for other tools that work with Steam manifest format.

We only care about backwards compat on ProtoManifest.LoadFromFile for the cached files, we don't need to save them back.

If .bin exists, load proto, then the proper .manifest, always save .manifest.

I don't quite get it. If proto exists, should I load it to check if it's valid then download the proper manifest from Steam servers?

@xPaw
Copy link
Member

xPaw commented Aug 6, 2024

The proto is loaded from disk to diff it against latest manifest to see which files need to be updated, no?

@NicknineTheEagle
Copy link
Contributor Author

The proto is loaded from disk to diff it against latest manifest to see which files need to be updated, no?

So are you proposing to use them in tandem then? That would still require internally converting ProtoManifest to DepotManifest (just without re-saving, as you said) but that's probably manageable.
What should be done if the latest manifest id matches user's current ProtoManifest? Just keep ProtoManifest file untouched?

@xPaw
Copy link
Member

xPaw commented Aug 6, 2024

Keeping it as is instead of resaving sounds simpler.

@NicknineTheEagle
Copy link
Contributor Author

@xPaw Converting ProtoManifest into SteamKit2.DepotManifest seems to be impossible because DepotManifest.FileData and DepotManifest.ChunkData do not have any public constructors. What should I do?

@xPaw
Copy link
Member

xPaw commented Oct 18, 2024

One way I can think of is decode ProtoManifest, and re-encode it as ContentManifestPayload, which seems like a silly round trip.

Easier way would be to just make all the properties in FileData public (ChunkData is already public so that's not a problem). But don't you also need DepotManifest properties to have public setters?

@NicknineTheEagle
Copy link
Contributor Author

One way I can think of is decode ProtoManifest, and re-encode it as ContentManifestPayload, which seems like a silly round trip.

Easier way would be to just make all the properties in FileData public (ChunkData is already public so that's not a problem). But don't you also need DepotManifest properties to have public setters?

Right, but updating properties would require updating SteamKit once again. Should I proceed with that?

@NicknineTheEagle
Copy link
Contributor Author

Here, this PR is needed before manifest converter can be implemented: SteamRE/SteamKit#1459

@NicknineTheEagle NicknineTheEagle force-pushed the nn/steam-manifest branch 2 times, most recently from a132530 to d3da656 Compare October 21, 2024 13:37
@NicknineTheEagle
Copy link
Contributor Author

Here, ProtoManifest is now converted to DepotManifest at runtime. I can't test this because the downloads seem to be broken, I think DD doesn't properly get licenses list.

@xPaw
Copy link
Member

xPaw commented Oct 21, 2024

I probably broke that in 9f64bd0

@NicknineTheEagle
Copy link
Contributor Author

Ok, the conversion code works correctly after a small fix. You can download a depot with old DD and then run validation with PR build and it'll properly load legacy manifest.

@xPaw xPaw requested a review from azuisleet October 22, 2024 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants