mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
I swear to god this compression thing will be the death of me
This commit is contained in:
parent
ffd888011e
commit
69f1d3a1ca
1 changed files with 2 additions and 2 deletions
|
@ -95,7 +95,7 @@ class GARCEntry(object):
|
||||||
start, length = self.slices[i]
|
start, length = self.slices[i]
|
||||||
ss = self.stream.slice(start, length)
|
ss = self.stream.slice(start, length)
|
||||||
peek = ss.peek(1)
|
peek = ss.peek(1)
|
||||||
if peek == b'\x11':
|
if peek == b'\x11' and length >= 128:
|
||||||
from .compressed import DecompressionError, LZSS11CompressedStream
|
from .compressed import DecompressionError, LZSS11CompressedStream
|
||||||
decompressor = LZSS11CompressedStream(ss)
|
decompressor = LZSS11CompressedStream(ss)
|
||||||
try:
|
try:
|
||||||
|
@ -106,7 +106,7 @@ class GARCEntry(object):
|
||||||
return ss
|
return ss
|
||||||
else:
|
else:
|
||||||
return decompressor
|
return decompressor
|
||||||
elif ss.peek(1) in b'\x10\x11':
|
elif ss.peek(1) in b'\x10\x11' and length >= 128:
|
||||||
# XXX this sucks but there's no real way to know for sure whether
|
# XXX this sucks but there's no real way to know for sure whether
|
||||||
# data is compressed or not. maybe just bake this into the caller
|
# data is compressed or not. maybe just bake this into the caller
|
||||||
# and let them deal with it, same way we do with text decoding?
|
# and let them deal with it, same way we do with text decoding?
|
||||||
|
|
Loading…
Reference in a new issue