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

Implemented decoding of ZigZag-encoded varints. #9

Merged
merged 1 commit into from
Apr 6, 2016
Merged

Implemented decoding of ZigZag-encoded varints. #9

merged 1 commit into from
Apr 6, 2016

Conversation

moritzuehling
Copy link
Contributor

The parser breaks with the netcode from the 13501-update. This fixes it.

Source for the implementation: The official parser

@taylorfinnell
Copy link

Sweet! it should be this.varInt32 not reader.ReadVarInt. I think the 13501 update causes this line to be called too

jsgo/lib/jsgo.js

Line 1215 in 8434927

return stream.bits(prop.numBits); // hmm
. I don't think it's implemented the same as the official implementation either. Trying to dig into it

@moritzuehling
Copy link
Contributor Author

@taylorfinnell I just fixed it, mind trying it again?

@moritzuehling
Copy link
Contributor Author

@taylorfinnell And even if the line is called it reads the right amount of bits - the working code looks like this:

int CBitRead::ReadSBitLong( int numbits )
{
    int nRet = ReadUBitLong( numbits );
    // sign extend
    return ( nRet << ( 32 - numbits ) ) >> ( 32 - numbits );
}

The right amout of bits is read, so it shouldn't bring the parser in a crashing state.

@taylorfinnell
Copy link

Thanks! I gave it a shot, still crashing on my demo. Here is the demo I am using. http://www.megafileupload.com/9muE/nerf_update.dem I am still looking into it. I also used the implementation of ReadSBitLong that you put above with no luck

@HarasimowiczKamil
Copy link

should fix #7

@mikeemoo mikeemoo merged commit d363561 into mikeemoo:master Apr 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants