mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
053f2a8d22
Specifically: - Add support for detecting FLIM format - Add support for more color formats - Add a small decoded image type that knows how to write itself out as a PNG - Improve ETC1 decoder to work with images whose dimensions are not powers of two, images with no alpha channel, and images with the strange FLIM pixel order - Port the gen 6/7 extractor to Construct 2.8 - Switch to using script tags in language names, to distinguish Japanese kana from kanji and Simplified from Traditional Chinese - Drop the load-time merging of kanji and kana - Add paths to various text files in SUMO - Add form names for SUMO Pokémon - Clean up identifiers a bit, especially the distinction between species and Pokémon - Use the Pokémon schema type to dump what we have so far, and give it a couple more fields that didn't exist in gen 1 - Get movesets dumping correctly - Special-case a bunch of weirdness, where the number of dex sprites doesn't match the number of models in SUMO
22 lines
724 B
Python
22 lines
724 B
Python
"""Allegedly stands for 'Pokémon Container'. Completely generic, dead-simple
|
|
container format.
|
|
"""
|
|
from .base import _ContainerFile, Substream
|
|
|
|
|
|
class PokemonContainerFile(_ContainerFile):
|
|
magic = b'PC'
|
|
|
|
def __init__(self, stream):
|
|
self.stream = stream = Substream(stream)
|
|
|
|
magic, entry_ct = stream.unpack('<2sH')
|
|
assert magic in (b'PC', b'PS', b'BL')
|
|
|
|
# Offsets are "A B C ...", where entry 0 ranges from A to B, entry 1
|
|
# from B to C, etc.
|
|
offsets = stream.unpack('<{}L'.format(entry_ct + 1))
|
|
self.slices = []
|
|
for i in range(entry_ct):
|
|
start, end = offsets[i:i + 2]
|
|
self.slices.append(self.stream.slice(start, end - start))
|