Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixes #42 Incorrect resource transfer events.

The multiplier needs to have its trailing 4 bits shifted off and
should not be used when it has a value of zero (and isn't necessary).
  • Loading branch information...
commit 25de52801e36e8c36b893a324055a62525fb0e63 1 parent 8b03fbb
@GraylinKim authored
Showing with 5 additions and 2 deletions.
  1. +5 −2 sc2reader/readers.py
View
7 sc2reader/readers.py
@@ -383,8 +383,11 @@ def parse_hotkey_event(self, buffer, frames, type, code, pid):
def parse_transfer_event(self, buffer, frames, type, code, pid):
def read_resource(buffer):
block = buffer.read_int(BIG_ENDIAN)
- base, multiplier, extension = block >> 8, block & 0xF0, block & 0x0F
- return base*multiplier+extension
+ base, multiplier, extension = block >> 8, block & 0xF0 >> 4, block & 0x0F
+ if multiplier == 0:
+ return base+extension
+ else:
+ return base*multiplier+extension
target = code >> 4
buffer.skip(1) #Always 84
Please sign in to comment.
Something went wrong with that request. Please try again.