akiver / boiler-writter

MIT License
30 stars 3 forks source link

Demo file is not saved #7

Closed Xoma163 closed 6 months ago

Xoma163 commented 11 months ago

Hi I decoded share code and try to run script like this:

>boiler-writter.exe <path_to_demo>\demo.dem 37510458017159***** 36510401332904***** 64***
Setting breakpad minidump AppID = 730
SteamInternal_SetMinidumpSteamID:  Caching Steam ID:  7656119799553*** [API loaded no]
STEAMID:7656119799553****

And demo.dem generated, but it was 5kb file, not real demo. What am I doing wrong?

Windows 10 I can download demo in cs2, it works, but not throw this project

Xoma163 commented 11 months ago

Oh. I open this file in txt editor and find link to download .dem file. Thanks! How I can to decode it? I read that I need use protobuf, yes?

robbie-andersen commented 7 months ago

Sorry for the late bump. Did you have any issues downloading the demo from the link provided in the output file? I get a link like; http://replay171.valve.net/730/XXXXXXXXXXXXXXXXXXXXX_XXXXXXXXXX.dem.bz2, however it returns 404.

If I look at the demo download links in steamcommunity.com premier match history i don't find any links matching the one produced by boiler-writter. Is there additional work to be done to use the link to download the demo?

I have used other share code decoders to see if that was the issue but all return the same result.

Xoma163 commented 7 months ago

Sorry for the late bump. Did you have any issues downloading the demo from the link provided in the output file? I get a link like; http://replay171.valve.net/730/XXXXXXXXXXXXXXXXXXXXX_XXXXXXXXXX.dem.bz2, however it returns 404.

If I look at the demo download links in steamcommunity.com premier match history i don't find any links matching the one produced by boiler-writter. Is there additional work to be done to use the link to download the demo?

I have used other share code decoders to see if that was the issue but all return the same result.

Hm, probably not. Check this code, it works for me https://github.com/Xoma163/CS2Rank/blob/98f7f5f44b77cebdc9c11b82da5c1aeb6c90c660/src/match.py#L97

akiver commented 7 months ago

This tool doesn't download .dem files but generates a file that contains a protobuf message (CMsgGCCStrike15_v2_MatchList or CDataGCCStrike15_v2_MatchInfo).

The field map of the last entry of the array roundstatsall in a CDataGCCStrike15_v2_MatchInfo message contains the demo link. As mentioned here, the proper way to retrieve the demo link would be to parse the proto message.

csgo-protobuf provides ready-to-use CS proto classes for JS. You could use it or generate proto-classes for your target language. The readme shows an example, to retrieve the demo link, it would be:

import fs from "fs";
import { CDataGCCStrike15_v2_MatchInfo } from "csgo-protobuf";

fs.readFile("./sample.info", (error, bytes) => {
  if (error) {
    console.error(error);
    return;
  }

  const matchInfo = CDataGCCStrike15_v2_MatchInfo.fromBinary(bytes);
  const demoUrl = matchInfo.roundstatsall[matchInfo.roundstatsall.length-1].map;
  console.log(demoUrl);
});

Links expire after ~1 month, so if you have a 404, it means the link has expired.