コード例 #1
0
def readCompressedSprite(rom, offset, width, height):
    '''
    Reads an LZSS10 or LZSS11 compressed sprite from ROM.
    Returns a matrix containing palette indices.
    '''
    blob = lzss.decompress_bytes(rom.bytes[offset:])
    return _genmatrix(blob, width, height)
コード例 #2
0
    def toPNG(self, f, back=False, shiny=False):
        if not back:
            sp_offset = self.sp_front
        else:
            sp_offset = self.sp_back
        
        if not shiny:
            palettebytes = decompress_bytes(self.rom.bytes[self.pal_normal:])
        else:
            palettebytes = decompress_bytes(self.rom.bytes[self.pal_shiny:])

        palette = Palette16.read(ByteArrayReader(palettebytes), 0)
        sprite = readCompressedSprite(self.rom, sp_offset, 64, 64)
        return toPNG(f, sprite, palette)
        
        
コード例 #3
0
 def __init__(self, rom, trainerspriteid):
     md = rom.metadata
     _, spritepointer = rom.readPointer(md['table_trainer_sprites'] + 8 * trainerspriteid)
     _, palpointer = rom.readPointer(md['table_trainer_palettes'] + 8 * trainerspriteid)
     
     palettebytes = decompress_bytes(rom.bytes[palpointer:])
     self.palette = Palette16.read(ByteArrayReader(palettebytes), 0)
     self.sprite = readCompressedSprite(rom, spritepointer, 64, 64)