Closed jnovack closed 8 years ago
I have StormLib working as a node-gyp module. I'm literally randomly throwing letters into my editor and hoping it compiles.
All I have right now is the ability to extract a file (as is). I believe I need the header info (with build version) before it can be used in heroprotocoljs (as a few calculations rely on the build verison).
You can see in heroprotocoljs
that the replay header is obtained by parsing the MPQArchive header content.
mpyqjs
line 127:
header.content = this.file.slice(16, 16 + header.userDataHeaderSize);
heroprotocoljs
line 72:
header = archive.data[HEADER] = parseStrings(protocol29406.decodeReplayHeader(archive.header.userDataHeader.content));
If the header content is correctly extracted from the MPQArchive, heroprotocol
should be able to correctly parse it into a replay header.
StormLib did not provide a way to parse the header exclusively, so either I have to write it in C or parse it in JS.
Right now, I'm working on getting heroprotocoljs
to use the extracted file via StormLib rather than the extract it through mpqjs
, it's so tightly integrated, it's proving to be a rewrite of certain functions. :/
@Farof thank you for your assistance. Between Day 2 of C++ and Day 4 of ECMAScript 6, I don't know HOW it works, but it does.
I can extract the header and pass it to parseStrings(protocol29406.decodeReplayHeader())
to get a proper JSON return.
It's already showing promise, now on to files...
[~/Source/heroprotocoljs]$ time node bin/heroprotocol.js replays/garden-of-terror.StormReplay -H
{ m_dataBuildNum: 32524,
m_elapsedGameLoops: 29242,
m_ngdpRootKey: {},
m_signature: 'Heroes of the Storm replay\u001b11',
m_type: 2,
m_useScaledTime: false,
m_version:
{ m_baseBuild: 32524,
m_build: 32524,
m_flags: 1,
m_major: 0,
m_minor: 6,
m_revision: 5 } }
real 0m0.168s
user 0m0.153s
sys 0m0.026s
[~/Source/heroprotocoljs]$ time node bin/storm.js replays/garden-of-terror.StormReplay
{ m_signature: 'Heroes of the Storm replay\u001b11',
m_version:
{ m_flags: 1,
m_major: 0,
m_minor: 6,
m_revision: 5,
m_build: 32524,
m_baseBuild: 32524 },
m_type: 2,
m_elapsedGameLoops: 29242,
m_useScaledTime: false,
m_ngdpRootKey: {},
m_dataBuildNum: 32524 }
real 0m0.093s
user 0m0.074s
sys 0m0.019s
I'm at a functional spot in the storm-replay rewrite.
Extracts headers, extracts files, and removes replay.message.events (for privacy).
As this repo is designed to be a faithful javascript port of the python repo, I am closing this issue (as it's a non-issue), just wanted to give people an option when using heroprotocoljs
.
This works as is, but to be optimized this should really be a C++ module compiled by node-gyp. This is where any processing time can be saved.
Anyone know any C around here?