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

NHA2: Decode CS2 store data #1441

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

NHA2: Decode CS2 store data #1441

wants to merge 3 commits into from

Conversation

yaakov-h
Copy link
Member

@yaakov-h yaakov-h commented Sep 30, 2024

  • Adds support for LZMA-decoded Binary KV to NHA2
  • Adds support for 0x0B (AlternateEnd) to KeyValue
  • Allow decoding of KV, KV-LZMA, and Protobuf data even above the 400 byte limit. (Performance of the application is not guaranteed.)

This needs tests but PR is up for people to build themselves or use GHA artefacts.

Addresses the issue described in discussion #1440.

The payload is a binary blob with the four-byte magic LZMA. This doe not seem to be a standard but is possibly a Valve creation, as seen elsewhere in ValveResourceFormat.

It also uses a different type of KeyValues binary serialisation, using AlternateEndfrom VBKV as seen here: ValveResourceFormat/ValveKeyValue#9

These changes probably need some new tests for the modified KV logic, and ideally also for the new LzmaUtil class.

Adds support for LZMA-decoded Binary KV to NHA2
Adds support for 0x0B (AlternateEnd) to KeyValue
/// <summary>
/// Internal helper to decode data blobs with the 'LZMA' magic header.
/// </summary>
public static class LzmaUtil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would avoid exposing this publicly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd need InternalsVisibleTo for NHA2 then, or to move the whole thing into NHA2.

If GC are using it at the protocol level somehow then it would be needed by SK2 clients.
If they're not and its game-specific then I'd be on the fence about including it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just put it in NH.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I need a second copy of the LZMA SDK to get at the Decoder. 😞

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's annoying. InternalsVisibleTo then? :(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, seems like the least evil option for now

@yaakov-h yaakov-h marked this pull request as ready for review October 1, 2024 08:58
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