ZetaTwo / csgo_demo_parser

CS:GO Demo file parser library
MIT License
1 stars 2 forks source link

Parse message bodies #1

Open ZetaTwo opened 6 years ago

ZetaTwo commented 6 years ago

Packet frames contain messages. Messages has an "outer" type which is parsed. Some of them contain additional "inner" data which needs to be parsed. There are basically X ways to do this:

  1. Create script to translate protobuf to Kaitai specs
  2. Manually translate protobuf to Kaitai specs
  3. Use glue script to parse inner message

First I started doing 3 but that breaks the possibility to use multiple languages. Then I started thinking about 1 but realized that it is overkill for now and I'll probably just go with 2.

0BuRner commented 3 years ago

Hello, any news ? =) Seems the idea was good

ZetaTwo commented 3 years ago

Haven't really worked on this since. I had some issues with missing features in Kaitai and then I lost interest at some point. I may pick up the project again later. Are you looking for a demo parser?

0BuRner commented 3 years ago

Hello, well in fact I'm not looking for a demo parser since I already worked on one long time ago (statshelix/demoinfo). At that time I already thought of using both kaitai and protobuf together but never took time to get further. It's good to see someone at least tried it :p

In fact I'm trying to parse .dem file recorded for Counter-Strike Source and not CS:GO. So I tried to analyze the differences in the bytes between the two files. I thought using kaitai might help me in this task. In fact don't need to parse everything but I just want to be able to extract the frags to recompose the scoreboard. But sadly it seems both protocols are too different from one another...

ZetaTwo commented 3 years ago

Ah cool. Yeah Kaitai mostly worked for parsing the outer layer but I encountered issues at when point since Kaitai (at least back then) didn't support dictionary-like back references. I have not looked at the CS:S format but I would be surprised if there wasn't enough public info in the modders wikis etc to build a parser. Whether the same issue appears with Kaitai is a different question though.

0BuRner commented 3 years ago

Yeah I also thought it should exists but except this https://github.com/alliedmodders/hl2sdk/blob/css/public/demofile/demoformat.h and https://github.com/alliedmodders/hl2sdk/blob/c33f7155e9aff9573c20d86e10c8158425a3d67a/common/proto_version.h which is pretty light, I can't find anything else useful...

The thing is with CSGO, Valve made the proto files public, which they didn't with CSS...

ZetaTwo commented 3 years ago

Ah, I see. Yeah that's really annoying. You can of course recover the "wire types" from the protocol but it will be quite a pain to figure out what each value corresponds to I guess.