Fast fix to process version 27. maps

master
AndrejIT 2017-04-08 16:07:08 +03:00
parent 1676225054
commit 03fcf8e832
4 changed files with 24 additions and 20 deletions

0
clrmap.py Normal file → Executable file
View File

2
domap.py Normal file → Executable file
View File

@ -89,7 +89,7 @@ for row in sourcecursor.execute(" SELECT "+
print "Block parse error:", row[0], row[1], row[2]
else:
if useful_block_evidence.search(block.nameIdMappingsRead)!=None:
if row[0] - minX < 0 or height - row[2] + minZ < 0:
if row[0] - minX < 0 or width <= row[0] - minX or height - row[2] + minZ < 0 or height <= height - row[2] + minZ:
print "Do not fit to image:", row[0], row[1], row[2]
else:
impixel[ row[0] - minX, height - row[2] + minZ ] = (255, 255, 200)

0
mirrormap.py Normal file → Executable file
View File

View File

@ -66,11 +66,16 @@ class MtBlockParser:
cursor+= 1
self.flags = struct.unpack('B', blockBlob[cursor:cursor + 1])[0]
cursor+= 1
#Skipping two FF bits from 27. version map format. No idea about their purpose.
if struct.unpack('B', blockBlob[cursor:cursor + 1])[0] != 2:
cursor+= 1
if struct.unpack('B', blockBlob[cursor:cursor + 1])[0] != 2:
cursor+= 1
if self.content_width != struct.unpack('B', blockBlob[cursor:cursor + 1])[0]:
print("Content width not supported!")
print("Content width not supported!", struct.unpack('B', blockBlob[cursor:cursor + 1])[0])
cursor+= 1
if self.params_width != struct.unpack('B', blockBlob[cursor:cursor + 1])[0]:
print("Params width not supported!")
print("Params width not supported!", struct.unpack('B', blockBlob[cursor:cursor + 1])[0])
cursor+= 1
decompressor = zlib.decompressobj()
self.nodeDataRead = decompressor.decompress( blockBlob[cursor:] )
@ -280,4 +285,3 @@ class MtBlockParser:
self.timersRead+= struct.pack('>H', position)
self.timersRead+= struct.pack('>i', timeout)
self.timersRead+= struct.pack('>i', self.arrayTimerElapsed[position])