shithub: pokecrystal

Download patch

ref: 2b7237e299d5018e837bae550d18deeff3c7db7d
parent: f1513ae8ad47c603abdba2749ef3e4e046817623
author: aaaaaa123456789 <[email protected]>
date: Sat May 23 10:30:04 EDT 2020

Match LZ compressed files (#724)

Replace lzcomp with new version and match all LZ compressed files

--- a/Makefile
+++ b/Makefile
@@ -108,16 +108,13 @@
 	$(RGBFIX) -Cjv -t PM_CRYSTAL -i BYTU -k 01 -l 0x33 -m 0x10 -r 3 -p 0 $@
 
 
-# For files that the compressor can't match, there will be a .lz file suffixed with the md5 hash of the correct uncompressed file.
-# If the hash of the uncompressed file matches, use this .lz instead.
-# This allows pngs to be used for compressed graphics and still match.
+### LZ compression rules
 
-%.lz: hash = $(shell tools/md5 $(*D)/$(*F) | sed "s/\(.\{8\}\).*/\1/")
+# Delete this line if you don't care about matching and just want optimal compression.
+include gfx/lz.mk
+
 %.lz: %
-	$(eval filename := $@.$(hash))
-	$(if $(wildcard $(filename)),\
-		cp $(filename) $@,\
-		tools/lzcomp -- $< $@)
+	tools/lzcomp $(LZFLAGS) -- $< $@
 
 
 ### Pokemon pic animation rules
binary files a/gfx/battle/dude.2bpp.lz.d13fb490 /dev/null differ
binary files a/gfx/battle_anims/aeroblast.2bpp.lz.2f07c4ea /dev/null differ
binary files a/gfx/battle_anims/angels.2bpp.lz.b026d81e /dev/null differ
binary files a/gfx/battle_anims/beam.2bpp.lz.80b6d613 /dev/null differ
binary files a/gfx/battle_anims/bubble.2bpp.lz.03b8ac99 /dev/null differ
binary files a/gfx/battle_anims/charge.2bpp.lz.95d3ea98 /dev/null differ
binary files a/gfx/battle_anims/cut.2bpp.lz.03d343ed /dev/null differ
binary files a/gfx/battle_anims/egg.2bpp.lz.41dd1a53 /dev/null differ
binary files a/gfx/battle_anims/explosion.2bpp.lz.55fc334f /dev/null differ
binary files a/gfx/battle_anims/fire.2bpp.lz.d7701cda /dev/null differ
binary files a/gfx/battle_anims/flower.2bpp.lz.1bc2e9d2 /dev/null differ
binary files a/gfx/battle_anims/globe.2bpp.lz.710dbb8e /dev/null differ
binary files a/gfx/battle_anims/haze.2bpp.lz.91424607 /dev/null differ
binary files a/gfx/battle_anims/hit.2bpp.lz.2b3c83f2 /dev/null differ
binary files a/gfx/battle_anims/horn.2bpp.lz.48908aae /dev/null differ
binary files a/gfx/battle_anims/ice.2bpp.lz.664d900f /dev/null differ
binary files a/gfx/battle_anims/lightning.2bpp.lz.a88fc131 /dev/null differ
binary files a/gfx/battle_anims/misc.2bpp.lz.4b20c3d7 /dev/null differ
binary files a/gfx/battle_anims/noise.2bpp.lz.acb4a76e /dev/null differ
binary files a/gfx/battle_anims/objects.2bpp.lz.83f812de /dev/null differ
--- a/gfx/battle_anims/plant.2bpp.lz.4a00c417
+++ /dev/null
@@ -1,3 +1,0 @@
-a<<~B��ߡ>�����
-<$xx��c	>2��88i��~Bø}c}CC��➆�xx<$|D~B^b3=a��C	e00PpC��
-=%}EC_c�����<�>��c����_aOq'83<e
79Nr����
)���`�@I@�  00<,.2/1'9a��
,4\d����	������
\ No newline at end of file
binary files a/gfx/battle_anims/poison.2bpp.lz.fc7dc9c1 /dev/null differ
binary files a/gfx/battle_anims/pokeball.2bpp.lz.c58f7e01 /dev/null differ
--- a/gfx/battle_anims/powder.2bpp.lz.bfd566bb
+++ /dev/null
@@ -1,1 +1,0 @@
-@@��GEa8(@@��EG��Î
\ No newline at end of file
binary files a/gfx/battle_anims/psychic.2bpp.lz.d80f285c /dev/null differ
binary files a/gfx/battle_anims/reflect.2bpp.lz.9a9c822d /dev/null differ
binary files a/gfx/battle_anims/rocks.2bpp.lz.73d0153e /dev/null differ
binary files a/gfx/battle_anims/rope.2bpp.lz.209d63dd /dev/null differ
binary files a/gfx/battle_anims/sand.2bpp.lz.c87c0eaa /dev/null differ
binary files a/gfx/battle_anims/shapes.2bpp.lz.262d77f0 /dev/null differ
binary files a/gfx/battle_anims/shine.2bpp.lz.5fb79056 /dev/null differ
binary files a/gfx/battle_anims/skyattack.2bpp.lz.31738ab8 /dev/null differ
binary files a/gfx/battle_anims/smoke.2bpp.lz.aa05905e /dev/null differ
binary files a/gfx/battle_anims/speed.2bpp.lz.1732b364 /dev/null differ
binary files a/gfx/battle_anims/status.2bpp.lz.0c0aa13e /dev/null differ
binary files a/gfx/battle_anims/water.2bpp.lz.7b52ed12 /dev/null differ
binary files a/gfx/battle_anims/wave.2bpp.lz.bee99402 /dev/null differ
binary files a/gfx/battle_anims/web.2bpp.lz.80e3d480 /dev/null differ
binary files a/gfx/battle_anims/whip.2bpp.lz.d80d8d6e /dev/null differ
binary files a/gfx/battle_anims/wind.2bpp.lz.5a785180 /dev/null differ
binary files a/gfx/card_flip/card_flip_1.2bpp.lz.86f267e8 /dev/null differ
binary files a/gfx/card_flip/card_flip_2.2bpp.lz.6a6c671d /dev/null differ
binary files a/gfx/card_flip/card_flip_3.2bpp.lz.53679db7 /dev/null differ
binary files a/gfx/diploma/diploma.2bpp.lz.7b56f7e5 /dev/null differ
binary files a/gfx/dummy_game/dummy_game.2bpp.lz.821ba441 /dev/null differ
binary files a/gfx/intro/background.2bpp.lz.b58b3984 /dev/null differ
--- a/gfx/intro/background.attrmap.lz.9f90366a
+++ /dev/null
@@ -1,1 +1,0 @@
-��_��_���
\ No newline at end of file
binary files a/gfx/intro/background.tilemap.lz.4c7562ee /dev/null differ
binary files a/gfx/intro/crystal_unowns.2bpp.lz.e7f8ad51 /dev/null differ
binary files a/gfx/intro/crystal_unowns.attrmap.lz.1bfc5a89 /dev/null differ
binary files a/gfx/intro/crystal_unowns.tilemap.lz.e4772015 /dev/null differ
binary files a/gfx/intro/logo.2bpp.lz.e03ee257 /dev/null differ
binary files a/gfx/intro/pichu_wooper.2bpp.lz.4bccf7f4 /dev/null differ
binary files a/gfx/intro/pulse.2bpp.lz.9fb06bb6 /dev/null differ
binary files a/gfx/intro/suicune_back.2bpp.lz.c6f529b0 /dev/null differ
binary files a/gfx/intro/suicune_back.attrmap.lz.18e3115f /dev/null differ
binary files a/gfx/intro/suicune_back.tilemap.lz.7b59259d /dev/null differ
binary files a/gfx/intro/suicune_close.2bpp.lz.7e362923 /dev/null differ
binary files a/gfx/intro/suicune_close.attrmap.lz.bb066632 /dev/null differ
binary files a/gfx/intro/suicune_close.tilemap.lz.bc182264 /dev/null differ
binary files a/gfx/intro/suicune_jump.2bpp.lz.1b09fb64 /dev/null differ
--- a/gfx/intro/suicune_jump.attrmap.lz.911a1ace
+++ /dev/null
@@ -1,1 +1,0 @@
-��#πˀ�ߟ�U
\ No newline at end of file
binary files a/gfx/intro/suicune_jump.tilemap.lz.2717d106 /dev/null differ
binary files a/gfx/intro/suicune_run.2bpp.lz.ef999ad2 /dev/null differ
--- a/gfx/intro/unown_a.attrmap.lz.c2341875
+++ /dev/null
@@ -1,1 +1,0 @@
-s%�ŀ����
\ No newline at end of file
binary files a/gfx/intro/unown_a.tilemap.lz.54d5b74b /dev/null differ
binary files a/gfx/intro/unown_back.2bpp.lz.740c4d28 /dev/null differ
binary files a/gfx/intro/unown_hi.attrmap.lz.bed1ff6d /dev/null differ
binary files a/gfx/intro/unown_hi.tilemap.lz.c8756972 /dev/null differ
binary files a/gfx/intro/unowns.2bpp.lz.3a1f185e /dev/null differ
binary files a/gfx/intro/unowns.attrmap.lz.a9cbcbca /dev/null differ
binary files a/gfx/intro/unowns.tilemap.lz.f12ed6d9 /dev/null differ
--- /dev/null
+++ b/gfx/lz.mk
@@ -1,0 +1,67 @@
+# Delete these rules if you don't care about matching.
+
+%.lz: LZFLAGS = --compressor multipass
+
+gfx/battle_anims/%.lz: LZFLAGS += --method 2 --align 4
+
+gfx/battle/dude.2bpp.lz: LZFLAGS += --align 4
+
+gfx/diploma/diploma.2bpp.lz: LZFLAGS += --method 8 --align 1
+
+gfx/dummy_game/dummy_game.2bpp.lz: LZFLAGS += --method 2 --align 4
+
+gfx/intro/%.lz: LZFLAGS += --align 4
+gfx/intro/logo.2bpp.lz: LZFLAGS += --method 2 --align 4
+gfx/intro/suicune_close.2bpp.lz: LZFLAGS += --method 2 --align 4
+gfx/intro/unown_back.2bpp.lz: LZFLAGS += --method 2 --align 4
+
+gfx/mobile/mobile_trade.%.lz: LZFLAGS += --align 4
+gfx/mobile/mobile_trade_sprites.2bpp.lz: LZFLAGS += --align 4
+
+gfx/new_game/shrink1.2bpp.lz: LZFLAGS += --align 4
+gfx/new_game/shrink2.2bpp.lz: LZFLAGS += --align 4
+
+gfx/pc/pc.2bpp.lz: LZFLAGS = --compressor null --method 1 --align 1
+
+gfx/player/chris_back.2bpp.lz: LZFLAGS += --align 4
+
+gfx/pokedex/pokedex.2bpp.lz: LZFLAGS += --method 8 --align 1
+gfx/pokedex/pokedex_sgb.2bpp.lz: LZFLAGS += --method 8 --align 1
+gfx/pokedex/question_mark.2bpp.lz: LZFLAGS += --align 4
+gfx/pokedex/slowpoke.2bpp.lz: LZFLAGS = --compressor null --method 1 --align 1
+
+gfx/pokegear/pokegear.2bpp.lz: LZFLAGS = --compressor null --method 1 --align 1
+gfx/pokegear/pokegear_sprites.2bpp.lz: LZFLAGS += --align 4
+gfx/pokegear/town_map.2bpp.lz: LZFLAGS = --compressor null --method 1 --align 1
+
+gfx/pokemon/hitmontop/back.2bpp.lz: LZFLAGS += --method 4
+gfx/pokemon/voltorb/front.animated.2bpp.lz: LZFLAGS += --method 4
+
+gfx/sgb/gbc_only.2bpp.lz: LZFLAGS = --compressor null --method 1 --align 1
+
+gfx/slots/slots_1.2bpp.lz: LZFLAGS += --method 2 --align 4
+gfx/slots/slots_2.2bpp.lz: LZFLAGS += --align 4
+gfx/slots/slots_3.2bpp.lz: LZFLAGS += --align 4
+
+gfx/tilesets/%.lz: LZFLAGS += --align 4
+gfx/tilesets/aerodactyl_word_room.2bpp.lz: LZFLAGS = --compressor null --method 1 --align 1
+gfx/tilesets/battle_tower_outside.2bpp.lz: LZFLAGS = --compressor null --method 1 --align 1
+gfx/tilesets/beta_word_room.2bpp.lz: LZFLAGS = --compressor null --method 1 --align 1
+gfx/tilesets/ho_oh_word_room.2bpp.lz: LZFLAGS = --compressor null --method 1 --align 1
+gfx/tilesets/house.2bpp.lz: LZFLAGS += --method 2 --align 4
+gfx/tilesets/johto.2bpp.lz: LZFLAGS = --compressor null --method 1 --align 1
+gfx/tilesets/johto_modern.2bpp.lz: LZFLAGS = --compressor null --method 1 --align 1
+gfx/tilesets/kabuto_word_room.2bpp.lz: LZFLAGS = --compressor null --method 1 --align 1
+gfx/tilesets/kanto.2bpp.lz: LZFLAGS = --compressor null --method 1 --align 1
+gfx/tilesets/mansion.2bpp.lz: LZFLAGS += --method 2 --align 4
+gfx/tilesets/mart.2bpp.lz: LZFLAGS += --method 2 --align 4
+gfx/tilesets/omanyte_word_room.2bpp.lz: LZFLAGS = --compressor null --method 1 --align 1
+gfx/tilesets/ruins_of_alph.2bpp.lz: LZFLAGS = --compressor null --method 1 --align 1
+gfx/tilesets/tower.2bpp.lz: LZFLAGS += --method 2 --align 4
+
+gfx/title/crystal.2bpp.lz: LZFLAGS += --align 4
+gfx/title/logo.2bpp.lz: LZFLAGS = --compressor null --method 1 --align 1
+gfx/title/suicune.2bpp.lz: LZFLAGS += --align 4
+
+gfx/unown_puzzle/%.lz: LZFLAGS += --align 4
+gfx/unown_puzzle/start_cancel.2bpp.lz: LZFLAGS += --method 8 --align 1
binary files a/gfx/mobile/electro_ball.2bpp.lz.3eaf004f /dev/null differ
binary files a/gfx/mobile/mobile_trade.2bpp.lz.aad8592b /dev/null differ
binary files a/gfx/mobile/mobile_trade.attrmap.lz.ea4f2cbe /dev/null differ
binary files a/gfx/mobile/mobile_trade.tilemap.lz.12882d37 /dev/null differ
binary files a/gfx/mobile/mobile_trade_sprites.2bpp.lz.eef1e11d /dev/null differ
binary files a/gfx/mobile/pichu_animated.2bpp.lz.5d6d2ad4 /dev/null differ
binary files a/gfx/new_game/shrink1.2bpp.lz.d4443930 /dev/null differ
binary files a/gfx/new_game/shrink2.2bpp.lz.3f58480a /dev/null differ
binary files a/gfx/pc/pc.2bpp.lz.2201c1aa /dev/null differ
binary files a/gfx/player/chris_back.2bpp.lz.0312ddce /dev/null differ
binary files a/gfx/pokedex/pokedex.2bpp.lz.3726dd3f /dev/null differ
binary files a/gfx/pokedex/pokedex_sgb.2bpp.lz.82bc0a7b /dev/null differ
binary files a/gfx/pokedex/question_mark.2bpp.lz.6e639380 /dev/null differ
binary files a/gfx/pokedex/slowpoke.2bpp.lz.49a91b42 /dev/null differ
binary files a/gfx/pokegear/pokegear.2bpp.lz.42315ab4 /dev/null differ
binary files a/gfx/pokegear/pokegear_sprites.2bpp.lz.7a3cc91f /dev/null differ
binary files a/gfx/pokegear/town_map.2bpp.lz.c0587c86 /dev/null differ
binary files a/gfx/pokemon/abra/back.2bpp.lz.9ac09a32 /dev/null differ
binary files a/gfx/pokemon/abra/front.animated.2bpp.lz.12e14d9a /dev/null differ
binary files a/gfx/pokemon/aerodactyl/back.2bpp.lz.e2da1f61 /dev/null differ
binary files a/gfx/pokemon/aerodactyl/front.animated.2bpp.lz.3bceb33e /dev/null differ
binary files a/gfx/pokemon/aipom/back.2bpp.lz.597d4dda /dev/null differ
binary files a/gfx/pokemon/aipom/front.animated.2bpp.lz.fba7c862 /dev/null differ
binary files a/gfx/pokemon/alakazam/back.2bpp.lz.75e7e1c6 /dev/null differ
binary files a/gfx/pokemon/alakazam/front.animated.2bpp.lz.b246e050 /dev/null differ
binary files a/gfx/pokemon/ampharos/back.2bpp.lz.06af98c8 /dev/null differ
binary files a/gfx/pokemon/ampharos/front.animated.2bpp.lz.4b908a28 /dev/null differ
binary files a/gfx/pokemon/arbok/back.2bpp.lz.7b18cb93 /dev/null differ
binary files a/gfx/pokemon/arbok/front.animated.2bpp.lz.1589a977 /dev/null differ
binary files a/gfx/pokemon/arcanine/back.2bpp.lz.f5b35ebf /dev/null differ
binary files a/gfx/pokemon/arcanine/front.animated.2bpp.lz.5ae8eff3 /dev/null differ
binary files a/gfx/pokemon/ariados/back.2bpp.lz.9fb1c3fc /dev/null differ
binary files a/gfx/pokemon/ariados/front.animated.2bpp.lz.5ac5c83c /dev/null differ
binary files a/gfx/pokemon/articuno/back.2bpp.lz.c263c2aa /dev/null differ
binary files a/gfx/pokemon/articuno/front.animated.2bpp.lz.650aef29 /dev/null differ
binary files a/gfx/pokemon/azumarill/back.2bpp.lz.f7fa0db9 /dev/null differ
binary files a/gfx/pokemon/azumarill/front.animated.2bpp.lz.cc9fd2ed /dev/null differ
binary files a/gfx/pokemon/bayleef/back.2bpp.lz.c4783e65 /dev/null differ
binary files a/gfx/pokemon/bayleef/front.animated.2bpp.lz.147649f2 /dev/null differ
binary files a/gfx/pokemon/beedrill/back.2bpp.lz.dfd6a87b /dev/null differ
binary files a/gfx/pokemon/beedrill/front.animated.2bpp.lz.1b5d3117 /dev/null differ
binary files a/gfx/pokemon/bellossom/back.2bpp.lz.10d31691 /dev/null differ
binary files a/gfx/pokemon/bellossom/front.animated.2bpp.lz.289eaecf /dev/null differ
binary files a/gfx/pokemon/bellsprout/back.2bpp.lz.9dacbda8 /dev/null differ
binary files a/gfx/pokemon/bellsprout/front.animated.2bpp.lz.44df413d /dev/null differ
binary files a/gfx/pokemon/blastoise/back.2bpp.lz.b90e8d5a /dev/null differ
binary files a/gfx/pokemon/blastoise/front.animated.2bpp.lz.3899aed0 /dev/null differ
binary files a/gfx/pokemon/blissey/back.2bpp.lz.d2763673 /dev/null differ
binary files a/gfx/pokemon/blissey/front.animated.2bpp.lz.04f2353a /dev/null differ
binary files a/gfx/pokemon/bulbasaur/back.2bpp.lz.84f8d1c4 /dev/null differ
binary files a/gfx/pokemon/bulbasaur/front.animated.2bpp.lz.04627405 /dev/null differ
binary files a/gfx/pokemon/butterfree/back.2bpp.lz.a8543d86 /dev/null differ
binary files a/gfx/pokemon/butterfree/front.animated.2bpp.lz.33ba7e24 /dev/null differ
binary files a/gfx/pokemon/caterpie/back.2bpp.lz.57e32015 /dev/null differ
binary files a/gfx/pokemon/caterpie/front.animated.2bpp.lz.ec4f7cb8 /dev/null differ
binary files a/gfx/pokemon/celebi/back.2bpp.lz.17ea5fe6 /dev/null differ
binary files a/gfx/pokemon/celebi/front.animated.2bpp.lz.16f259a5 /dev/null differ
binary files a/gfx/pokemon/chansey/back.2bpp.lz.14d90ba1 /dev/null differ
binary files a/gfx/pokemon/chansey/front.animated.2bpp.lz.158fc381 /dev/null differ
binary files a/gfx/pokemon/charizard/back.2bpp.lz.f04ac62c /dev/null differ
binary files a/gfx/pokemon/charizard/front.animated.2bpp.lz.0068f820 /dev/null differ
binary files a/gfx/pokemon/charmander/back.2bpp.lz.bcb371c6 /dev/null differ
binary files a/gfx/pokemon/charmander/front.animated.2bpp.lz.704bfc17 /dev/null differ
binary files a/gfx/pokemon/charmeleon/back.2bpp.lz.cf73268f /dev/null differ
binary files a/gfx/pokemon/charmeleon/front.animated.2bpp.lz.0e629968 /dev/null differ
binary files a/gfx/pokemon/chikorita/back.2bpp.lz.27a21938 /dev/null differ
binary files a/gfx/pokemon/chikorita/front.animated.2bpp.lz.18de5fe9 /dev/null differ
binary files a/gfx/pokemon/chinchou/back.2bpp.lz.ea061e91 /dev/null differ
binary files a/gfx/pokemon/chinchou/front.animated.2bpp.lz.901aa690 /dev/null differ
binary files a/gfx/pokemon/clefable/back.2bpp.lz.d57ec142 /dev/null differ
binary files a/gfx/pokemon/clefable/front.animated.2bpp.lz.59d160ad /dev/null differ
binary files a/gfx/pokemon/clefairy/back.2bpp.lz.f8aff3dd /dev/null differ
binary files a/gfx/pokemon/clefairy/front.animated.2bpp.lz.0918b60d /dev/null differ
binary files a/gfx/pokemon/cleffa/back.2bpp.lz.ea9b3d08 /dev/null differ
binary files a/gfx/pokemon/cleffa/front.animated.2bpp.lz.49630c80 /dev/null differ
binary files a/gfx/pokemon/cloyster/back.2bpp.lz.5ad194b3 /dev/null differ
binary files a/gfx/pokemon/cloyster/front.animated.2bpp.lz.fe85709f /dev/null differ
binary files a/gfx/pokemon/corsola/back.2bpp.lz.2b6c7860 /dev/null differ
binary files a/gfx/pokemon/corsola/front.animated.2bpp.lz.2e7905aa /dev/null differ
binary files a/gfx/pokemon/crobat/back.2bpp.lz.30850b2e /dev/null differ
binary files a/gfx/pokemon/crobat/front.animated.2bpp.lz.dc386ff0 /dev/null differ
binary files a/gfx/pokemon/croconaw/back.2bpp.lz.a605c82f /dev/null differ
binary files a/gfx/pokemon/croconaw/front.animated.2bpp.lz.a797986d /dev/null differ
binary files a/gfx/pokemon/cubone/back.2bpp.lz.bd849dfb /dev/null differ
binary files a/gfx/pokemon/cubone/front.animated.2bpp.lz.0d63a3a4 /dev/null differ
binary files a/gfx/pokemon/cyndaquil/back.2bpp.lz.68baeeeb /dev/null differ
binary files a/gfx/pokemon/cyndaquil/front.animated.2bpp.lz.0d5dce8d /dev/null differ
binary files a/gfx/pokemon/delibird/back.2bpp.lz.11463d76 /dev/null differ
binary files a/gfx/pokemon/delibird/front.animated.2bpp.lz.a3126c48 /dev/null differ
binary files a/gfx/pokemon/dewgong/back.2bpp.lz.4e1fef76 /dev/null differ
binary files a/gfx/pokemon/dewgong/front.animated.2bpp.lz.cc53359c /dev/null differ
binary files a/gfx/pokemon/diglett/back.2bpp.lz.31d8cacc /dev/null differ
binary files a/gfx/pokemon/diglett/front.animated.2bpp.lz.52b0361e /dev/null differ
binary files a/gfx/pokemon/ditto/back.2bpp.lz.b01a9d91 /dev/null differ
binary files a/gfx/pokemon/ditto/front.animated.2bpp.lz.344c90fd /dev/null differ
binary files a/gfx/pokemon/dodrio/back.2bpp.lz.a5480e88 /dev/null differ
binary files a/gfx/pokemon/dodrio/front.animated.2bpp.lz.2aaff569 /dev/null differ
binary files a/gfx/pokemon/doduo/back.2bpp.lz.05a57563 /dev/null differ
binary files a/gfx/pokemon/doduo/front.animated.2bpp.lz.89c4acbd /dev/null differ
binary files a/gfx/pokemon/donphan/back.2bpp.lz.5067b370 /dev/null differ
binary files a/gfx/pokemon/donphan/front.animated.2bpp.lz.9e1b7048 /dev/null differ
binary files a/gfx/pokemon/dragonair/back.2bpp.lz.9b6fda5b /dev/null differ
binary files a/gfx/pokemon/dragonair/front.animated.2bpp.lz.bb9ee373 /dev/null differ
binary files a/gfx/pokemon/dragonite/back.2bpp.lz.c408806f /dev/null differ
binary files a/gfx/pokemon/dragonite/front.animated.2bpp.lz.b914dfd9 /dev/null differ
binary files a/gfx/pokemon/dratini/back.2bpp.lz.be4d6a2a /dev/null differ
binary files a/gfx/pokemon/dratini/front.animated.2bpp.lz.838e4248 /dev/null differ
binary files a/gfx/pokemon/drowzee/back.2bpp.lz.55367f5a /dev/null differ
binary files a/gfx/pokemon/drowzee/front.animated.2bpp.lz.1f23711a /dev/null differ
binary files a/gfx/pokemon/dugtrio/back.2bpp.lz.e821a89c /dev/null differ
binary files a/gfx/pokemon/dugtrio/front.animated.2bpp.lz.5c9e668c /dev/null differ
binary files a/gfx/pokemon/dunsparce/back.2bpp.lz.aee69114 /dev/null differ
binary files a/gfx/pokemon/dunsparce/front.animated.2bpp.lz.04ea863c /dev/null differ
binary files a/gfx/pokemon/eevee/back.2bpp.lz.bc34ce62 /dev/null differ
binary files a/gfx/pokemon/eevee/front.animated.2bpp.lz.04e72b48 /dev/null differ
binary files a/gfx/pokemon/egg/front.animated.2bpp.lz.7b468eff /dev/null differ
binary files a/gfx/pokemon/egg/unused_front.2bpp.lz.a5b6cbfa /dev/null differ
binary files a/gfx/pokemon/ekans/back.2bpp.lz.671d14d9 /dev/null differ
binary files a/gfx/pokemon/ekans/front.animated.2bpp.lz.018a1c72 /dev/null differ
binary files a/gfx/pokemon/electabuzz/back.2bpp.lz.e97330fe /dev/null differ
binary files a/gfx/pokemon/electabuzz/front.animated.2bpp.lz.381e1c6e /dev/null differ
binary files a/gfx/pokemon/electrode/back.2bpp.lz.874e1f1c /dev/null differ
binary files a/gfx/pokemon/electrode/front.animated.2bpp.lz.d7943ad8 /dev/null differ
binary files a/gfx/pokemon/elekid/back.2bpp.lz.227a1b23 /dev/null differ
binary files a/gfx/pokemon/elekid/front.animated.2bpp.lz.3bbb6b61 /dev/null differ
binary files a/gfx/pokemon/entei/back.2bpp.lz.d1e1986a /dev/null differ
binary files a/gfx/pokemon/entei/front.animated.2bpp.lz.ebaf8024 /dev/null differ
binary files a/gfx/pokemon/espeon/back.2bpp.lz.0e77f26e /dev/null differ
binary files a/gfx/pokemon/espeon/front.animated.2bpp.lz.069f57ec /dev/null differ
binary files a/gfx/pokemon/exeggcute/back.2bpp.lz.060c38b0 /dev/null differ
binary files a/gfx/pokemon/exeggcute/front.animated.2bpp.lz.578a4722 /dev/null differ
binary files a/gfx/pokemon/exeggutor/back.2bpp.lz.e012643e /dev/null differ
binary files a/gfx/pokemon/exeggutor/front.animated.2bpp.lz.3915d572 /dev/null differ
binary files a/gfx/pokemon/farfetch_d/back.2bpp.lz.6f28ebc4 /dev/null differ
binary files a/gfx/pokemon/farfetch_d/front.animated.2bpp.lz.a4ae9393 /dev/null differ
binary files a/gfx/pokemon/fearow/back.2bpp.lz.a7a39118 /dev/null differ
binary files a/gfx/pokemon/fearow/front.animated.2bpp.lz.393b11d6 /dev/null differ
binary files a/gfx/pokemon/feraligatr/back.2bpp.lz.f95abe99 /dev/null differ
binary files a/gfx/pokemon/feraligatr/front.animated.2bpp.lz.fade72cc /dev/null differ
binary files a/gfx/pokemon/flaaffy/back.2bpp.lz.461855e4 /dev/null differ
binary files a/gfx/pokemon/flaaffy/front.animated.2bpp.lz.6a27aac3 /dev/null differ
binary files a/gfx/pokemon/flareon/back.2bpp.lz.d58af0e5 /dev/null differ
binary files a/gfx/pokemon/flareon/front.animated.2bpp.lz.7b68c716 /dev/null differ
binary files a/gfx/pokemon/forretress/back.2bpp.lz.2b8e5f48 /dev/null differ
binary files a/gfx/pokemon/forretress/front.animated.2bpp.lz.761b9f80 /dev/null differ
binary files a/gfx/pokemon/furret/back.2bpp.lz.24792550 /dev/null differ
binary files a/gfx/pokemon/furret/front.animated.2bpp.lz.f72a2758 /dev/null differ
binary files a/gfx/pokemon/gastly/back.2bpp.lz.4078fa56 /dev/null differ
binary files a/gfx/pokemon/gastly/front.animated.2bpp.lz.84148c1e /dev/null differ
binary files a/gfx/pokemon/gengar/back.2bpp.lz.5237ee63 /dev/null differ
binary files a/gfx/pokemon/gengar/front.animated.2bpp.lz.65ddc6f5 /dev/null differ
binary files a/gfx/pokemon/geodude/back.2bpp.lz.d5aa5e9f /dev/null differ
binary files a/gfx/pokemon/geodude/front.animated.2bpp.lz.d743f2c9 /dev/null differ
binary files a/gfx/pokemon/girafarig/back.2bpp.lz.5dd68457 /dev/null differ
binary files a/gfx/pokemon/girafarig/front.animated.2bpp.lz.76d809c4 /dev/null differ
binary files a/gfx/pokemon/gligar/back.2bpp.lz.ee922122 /dev/null differ
binary files a/gfx/pokemon/gligar/front.animated.2bpp.lz.4dcc41b3 /dev/null differ
binary files a/gfx/pokemon/gloom/back.2bpp.lz.9a321f63 /dev/null differ
binary files a/gfx/pokemon/gloom/front.animated.2bpp.lz.c6ef04a5 /dev/null differ
binary files a/gfx/pokemon/golbat/back.2bpp.lz.e277e260 /dev/null differ
binary files a/gfx/pokemon/golbat/front.animated.2bpp.lz.c35ffe9b /dev/null differ
binary files a/gfx/pokemon/goldeen/back.2bpp.lz.d0e5751e /dev/null differ
binary files a/gfx/pokemon/goldeen/front.animated.2bpp.lz.c451a8c4 /dev/null differ
binary files a/gfx/pokemon/golduck/back.2bpp.lz.2d022642 /dev/null differ
binary files a/gfx/pokemon/golduck/front.animated.2bpp.lz.09e97414 /dev/null differ
binary files a/gfx/pokemon/golem/back.2bpp.lz.ae903dee /dev/null differ
binary files a/gfx/pokemon/golem/front.animated.2bpp.lz.a16f21c8 /dev/null differ
binary files a/gfx/pokemon/granbull/back.2bpp.lz.7f1208ed /dev/null differ
binary files a/gfx/pokemon/granbull/front.animated.2bpp.lz.4504768b /dev/null differ
binary files a/gfx/pokemon/graveler/back.2bpp.lz.c7867de7 /dev/null differ
binary files a/gfx/pokemon/graveler/front.animated.2bpp.lz.68d07c61 /dev/null differ
binary files a/gfx/pokemon/grimer/back.2bpp.lz.833bd626 /dev/null differ
binary files a/gfx/pokemon/grimer/front.animated.2bpp.lz.dfe40e91 /dev/null differ
binary files a/gfx/pokemon/growlithe/back.2bpp.lz.7f5831f6 /dev/null differ
binary files a/gfx/pokemon/growlithe/front.animated.2bpp.lz.f7b376fa /dev/null differ
binary files a/gfx/pokemon/gyarados/back.2bpp.lz.fc577f9e /dev/null differ
binary files a/gfx/pokemon/gyarados/front.animated.2bpp.lz.1b498e2b /dev/null differ
binary files a/gfx/pokemon/haunter/back.2bpp.lz.8a5dc2c1 /dev/null differ
binary files a/gfx/pokemon/haunter/front.animated.2bpp.lz.aeed5f7e /dev/null differ
binary files a/gfx/pokemon/heracross/back.2bpp.lz.ba09608b /dev/null differ
binary files a/gfx/pokemon/heracross/front.animated.2bpp.lz.0742fe2b /dev/null differ
binary files a/gfx/pokemon/hitmonchan/back.2bpp.lz.68e28b98 /dev/null differ
binary files a/gfx/pokemon/hitmonchan/front.animated.2bpp.lz.61836c4c /dev/null differ
binary files a/gfx/pokemon/hitmonlee/back.2bpp.lz.374e3caa /dev/null differ
binary files a/gfx/pokemon/hitmonlee/front.animated.2bpp.lz.d174eba1 /dev/null differ
binary files a/gfx/pokemon/hitmontop/back.2bpp.lz.ea3f1576 /dev/null differ
binary files a/gfx/pokemon/hitmontop/front.animated.2bpp.lz.1b3e96fc /dev/null differ
binary files a/gfx/pokemon/ho_oh/back.2bpp.lz.1412f260 /dev/null differ
binary files a/gfx/pokemon/ho_oh/front.animated.2bpp.lz.db80b5eb /dev/null differ
binary files a/gfx/pokemon/hoothoot/back.2bpp.lz.7ebb0b29 /dev/null differ
binary files a/gfx/pokemon/hoothoot/front.animated.2bpp.lz.752ab202 /dev/null differ
binary files a/gfx/pokemon/hoppip/back.2bpp.lz.5684c023 /dev/null differ
binary files a/gfx/pokemon/hoppip/front.animated.2bpp.lz.a03efe74 /dev/null differ
binary files a/gfx/pokemon/horsea/back.2bpp.lz.50b6afb9 /dev/null differ
binary files a/gfx/pokemon/horsea/front.animated.2bpp.lz.8b84f98e /dev/null differ
binary files a/gfx/pokemon/houndoom/back.2bpp.lz.5fa55a47 /dev/null differ
binary files a/gfx/pokemon/houndoom/front.animated.2bpp.lz.2d450e90 /dev/null differ
binary files a/gfx/pokemon/houndour/back.2bpp.lz.ae5f2dc9 /dev/null differ
binary files a/gfx/pokemon/houndour/front.animated.2bpp.lz.f847f4f6 /dev/null differ
binary files a/gfx/pokemon/hypno/back.2bpp.lz.c091ce88 /dev/null differ
binary files a/gfx/pokemon/hypno/front.animated.2bpp.lz.638333a3 /dev/null differ
binary files a/gfx/pokemon/igglybuff/back.2bpp.lz.c0c17dcb /dev/null differ
binary files a/gfx/pokemon/igglybuff/front.animated.2bpp.lz.1e00afc3 /dev/null differ
binary files a/gfx/pokemon/ivysaur/back.2bpp.lz.bed1ff58 /dev/null differ
binary files a/gfx/pokemon/ivysaur/front.animated.2bpp.lz.3abed0fa /dev/null differ
binary files a/gfx/pokemon/jigglypuff/back.2bpp.lz.87d5730b /dev/null differ
binary files a/gfx/pokemon/jigglypuff/front.animated.2bpp.lz.9fd159f4 /dev/null differ
binary files a/gfx/pokemon/jolteon/back.2bpp.lz.f248aac4 /dev/null differ
binary files a/gfx/pokemon/jolteon/front.animated.2bpp.lz.b2b07d79 /dev/null differ
binary files a/gfx/pokemon/jumpluff/back.2bpp.lz.b258a699 /dev/null differ
binary files a/gfx/pokemon/jumpluff/front.animated.2bpp.lz.6d1d8175 /dev/null differ
binary files a/gfx/pokemon/jynx/back.2bpp.lz.1eef1c1b /dev/null differ
binary files a/gfx/pokemon/jynx/front.animated.2bpp.lz.6aaf67b0 /dev/null differ
binary files a/gfx/pokemon/kabuto/back.2bpp.lz.0717a29b /dev/null differ
binary files a/gfx/pokemon/kabuto/front.animated.2bpp.lz.afe4e2dc /dev/null differ
binary files a/gfx/pokemon/kabutops/back.2bpp.lz.98a1dfc4 /dev/null differ
binary files a/gfx/pokemon/kabutops/front.animated.2bpp.lz.d5e4bfeb /dev/null differ
binary files a/gfx/pokemon/kadabra/back.2bpp.lz.6b26c1a0 /dev/null differ
binary files a/gfx/pokemon/kadabra/front.animated.2bpp.lz.bc78f9cf /dev/null differ
binary files a/gfx/pokemon/kakuna/back.2bpp.lz.3bffa4c3 /dev/null differ
binary files a/gfx/pokemon/kakuna/front.animated.2bpp.lz.c7425e72 /dev/null differ
binary files a/gfx/pokemon/kangaskhan/back.2bpp.lz.0d7cc337 /dev/null differ
binary files a/gfx/pokemon/kangaskhan/front.animated.2bpp.lz.09c81009 /dev/null differ
binary files a/gfx/pokemon/kingdra/back.2bpp.lz.e48ecb3f /dev/null differ
binary files a/gfx/pokemon/kingdra/front.animated.2bpp.lz.668c0516 /dev/null differ
binary files a/gfx/pokemon/kingler/back.2bpp.lz.88e96d65 /dev/null differ
binary files a/gfx/pokemon/kingler/front.animated.2bpp.lz.35305199 /dev/null differ
binary files a/gfx/pokemon/koffing/back.2bpp.lz.8c0a2526 /dev/null differ
binary files a/gfx/pokemon/koffing/front.animated.2bpp.lz.00044b3f /dev/null differ
binary files a/gfx/pokemon/krabby/back.2bpp.lz.2bc2487b /dev/null differ
binary files a/gfx/pokemon/krabby/front.animated.2bpp.lz.39592514 /dev/null differ
binary files a/gfx/pokemon/lanturn/back.2bpp.lz.8e9c7c1a /dev/null differ
binary files a/gfx/pokemon/lanturn/front.animated.2bpp.lz.1bfac161 /dev/null differ
binary files a/gfx/pokemon/lapras/back.2bpp.lz.d09351a1 /dev/null differ
binary files a/gfx/pokemon/lapras/front.animated.2bpp.lz.8290ef8e /dev/null differ
binary files a/gfx/pokemon/larvitar/back.2bpp.lz.4b2ac395 /dev/null differ
binary files a/gfx/pokemon/larvitar/front.animated.2bpp.lz.83859c57 /dev/null differ
binary files a/gfx/pokemon/ledian/back.2bpp.lz.48657bbb /dev/null differ
binary files a/gfx/pokemon/ledian/front.animated.2bpp.lz.83e819c3 /dev/null differ
binary files a/gfx/pokemon/ledyba/back.2bpp.lz.d50e8860 /dev/null differ
binary files a/gfx/pokemon/ledyba/front.animated.2bpp.lz.1700dc27 /dev/null differ
binary files a/gfx/pokemon/lickitung/back.2bpp.lz.a127e40b /dev/null differ
binary files a/gfx/pokemon/lickitung/front.animated.2bpp.lz.328a7c53 /dev/null differ
binary files a/gfx/pokemon/lugia/back.2bpp.lz.ad953eb5 /dev/null differ
binary files a/gfx/pokemon/lugia/front.animated.2bpp.lz.7293eddc /dev/null differ
binary files a/gfx/pokemon/machamp/back.2bpp.lz.757f4c29 /dev/null differ
binary files a/gfx/pokemon/machamp/front.animated.2bpp.lz.2d408542 /dev/null differ
binary files a/gfx/pokemon/machoke/back.2bpp.lz.2634245e /dev/null differ
binary files a/gfx/pokemon/machoke/front.animated.2bpp.lz.f38b95a7 /dev/null differ
binary files a/gfx/pokemon/machop/back.2bpp.lz.bc17b50a /dev/null differ
binary files a/gfx/pokemon/machop/front.animated.2bpp.lz.0fd8735f /dev/null differ
binary files a/gfx/pokemon/magby/back.2bpp.lz.e50ccadb /dev/null differ
binary files a/gfx/pokemon/magby/front.animated.2bpp.lz.172d0807 /dev/null differ
binary files a/gfx/pokemon/magcargo/back.2bpp.lz.56b096bc /dev/null differ
binary files a/gfx/pokemon/magcargo/front.animated.2bpp.lz.53a425f4 /dev/null differ
binary files a/gfx/pokemon/magikarp/back.2bpp.lz.7f25810a /dev/null differ
binary files a/gfx/pokemon/magikarp/front.animated.2bpp.lz.031ee449 /dev/null differ
binary files a/gfx/pokemon/magmar/back.2bpp.lz.6916c87b /dev/null differ
binary files a/gfx/pokemon/magmar/front.animated.2bpp.lz.0048e21c /dev/null differ
binary files a/gfx/pokemon/magnemite/back.2bpp.lz.e00bd515 /dev/null differ
binary files a/gfx/pokemon/magnemite/front.animated.2bpp.lz.e4b07135 /dev/null differ
binary files a/gfx/pokemon/magneton/back.2bpp.lz.f7a7089b /dev/null differ
binary files a/gfx/pokemon/magneton/front.animated.2bpp.lz.cd3b65a6 /dev/null differ
binary files a/gfx/pokemon/mankey/back.2bpp.lz.42cb1b61 /dev/null differ
binary files a/gfx/pokemon/mankey/front.animated.2bpp.lz.48eac19a /dev/null differ
binary files a/gfx/pokemon/mantine/back.2bpp.lz.1320b7f3 /dev/null differ
binary files a/gfx/pokemon/mantine/front.animated.2bpp.lz.9eb40d04 /dev/null differ
binary files a/gfx/pokemon/mareep/back.2bpp.lz.b9bdc89c /dev/null differ
binary files a/gfx/pokemon/mareep/front.animated.2bpp.lz.f660483d /dev/null differ
binary files a/gfx/pokemon/marill/back.2bpp.lz.87e2be16 /dev/null differ
binary files a/gfx/pokemon/marill/front.animated.2bpp.lz.7f742686 /dev/null differ
binary files a/gfx/pokemon/marowak/back.2bpp.lz.055ba40e /dev/null differ
binary files a/gfx/pokemon/marowak/front.animated.2bpp.lz.ef1553a0 /dev/null differ
binary files a/gfx/pokemon/meganium/back.2bpp.lz.d25a5edb /dev/null differ
binary files a/gfx/pokemon/meganium/front.animated.2bpp.lz.fe0b9df4 /dev/null differ
binary files a/gfx/pokemon/meowth/back.2bpp.lz.4196bd91 /dev/null differ
binary files a/gfx/pokemon/meowth/front.animated.2bpp.lz.144f12f0 /dev/null differ
binary files a/gfx/pokemon/metapod/back.2bpp.lz.b580afc8 /dev/null differ
binary files a/gfx/pokemon/metapod/front.animated.2bpp.lz.5025baa2 /dev/null differ
binary files a/gfx/pokemon/mew/back.2bpp.lz.9947d6eb /dev/null differ
binary files a/gfx/pokemon/mew/front.animated.2bpp.lz.b6da9713 /dev/null differ
binary files a/gfx/pokemon/mewtwo/back.2bpp.lz.a7d2c077 /dev/null differ
binary files a/gfx/pokemon/mewtwo/front.animated.2bpp.lz.45e8b40d /dev/null differ
binary files a/gfx/pokemon/miltank/back.2bpp.lz.b7787e72 /dev/null differ
binary files a/gfx/pokemon/miltank/front.animated.2bpp.lz.91da7c3b /dev/null differ
binary files a/gfx/pokemon/misdreavus/back.2bpp.lz.8bdebfce /dev/null differ
binary files a/gfx/pokemon/misdreavus/front.animated.2bpp.lz.5f73baa2 /dev/null differ
binary files a/gfx/pokemon/moltres/back.2bpp.lz.356242c8 /dev/null differ
binary files a/gfx/pokemon/moltres/front.animated.2bpp.lz.281bc0ec /dev/null differ
binary files a/gfx/pokemon/mr__mime/back.2bpp.lz.0fb88006 /dev/null differ
binary files a/gfx/pokemon/mr__mime/front.animated.2bpp.lz.f948d1b8 /dev/null differ
binary files a/gfx/pokemon/muk/back.2bpp.lz.a1f2f370 /dev/null differ
binary files a/gfx/pokemon/muk/front.animated.2bpp.lz.530363b2 /dev/null differ
binary files a/gfx/pokemon/murkrow/back.2bpp.lz.0c347b5b /dev/null differ
binary files a/gfx/pokemon/murkrow/front.animated.2bpp.lz.5d2805e8 /dev/null differ
binary files a/gfx/pokemon/natu/back.2bpp.lz.c8339fb4 /dev/null differ
binary files a/gfx/pokemon/natu/front.animated.2bpp.lz.997efaf6 /dev/null differ
binary files a/gfx/pokemon/nidoking/back.2bpp.lz.93211604 /dev/null differ
binary files a/gfx/pokemon/nidoking/front.animated.2bpp.lz.bd38fa1e /dev/null differ
binary files a/gfx/pokemon/nidoqueen/back.2bpp.lz.f1eb0f0c /dev/null differ
binary files a/gfx/pokemon/nidoqueen/front.animated.2bpp.lz.0bf11b0a /dev/null differ
binary files a/gfx/pokemon/nidoran_f/back.2bpp.lz.9b6990f1 /dev/null differ
binary files a/gfx/pokemon/nidoran_f/front.animated.2bpp.lz.0a4602e7 /dev/null differ
binary files a/gfx/pokemon/nidoran_m/back.2bpp.lz.c9e54720 /dev/null differ
binary files a/gfx/pokemon/nidoran_m/front.animated.2bpp.lz.b121beaa /dev/null differ
binary files a/gfx/pokemon/nidorina/back.2bpp.lz.a00ecf4a /dev/null differ
binary files a/gfx/pokemon/nidorina/front.animated.2bpp.lz.51532540 /dev/null differ
binary files a/gfx/pokemon/nidorino/back.2bpp.lz.8504fdd1 /dev/null differ
binary files a/gfx/pokemon/nidorino/front.animated.2bpp.lz.ba11ef23 /dev/null differ
binary files a/gfx/pokemon/ninetales/back.2bpp.lz.999b3894 /dev/null differ
binary files a/gfx/pokemon/ninetales/front.animated.2bpp.lz.eef934ff /dev/null differ
binary files a/gfx/pokemon/noctowl/back.2bpp.lz.9c8ac57f /dev/null differ
binary files a/gfx/pokemon/noctowl/front.animated.2bpp.lz.7d6594fe /dev/null differ
binary files a/gfx/pokemon/octillery/back.2bpp.lz.48b6e47d /dev/null differ
binary files a/gfx/pokemon/octillery/front.animated.2bpp.lz.de99954b /dev/null differ
binary files a/gfx/pokemon/oddish/back.2bpp.lz.4f9ec682 /dev/null differ
binary files a/gfx/pokemon/oddish/front.animated.2bpp.lz.ea2e0dcd /dev/null differ
binary files a/gfx/pokemon/omanyte/back.2bpp.lz.f442a670 /dev/null differ
binary files a/gfx/pokemon/omanyte/front.animated.2bpp.lz.15b343dc /dev/null differ
binary files a/gfx/pokemon/omastar/back.2bpp.lz.c75932db /dev/null differ
binary files a/gfx/pokemon/omastar/front.animated.2bpp.lz.b3f6c3dc /dev/null differ
binary files a/gfx/pokemon/onix/back.2bpp.lz.cb580eb9 /dev/null differ
binary files a/gfx/pokemon/onix/front.animated.2bpp.lz.84b7e9ef /dev/null differ
binary files a/gfx/pokemon/paras/back.2bpp.lz.b5a4d1e2 /dev/null differ
binary files a/gfx/pokemon/paras/front.animated.2bpp.lz.37a2c2f8 /dev/null differ
binary files a/gfx/pokemon/parasect/back.2bpp.lz.ed08ef08 /dev/null differ
binary files a/gfx/pokemon/parasect/front.animated.2bpp.lz.f78f9f36 /dev/null differ
binary files a/gfx/pokemon/persian/back.2bpp.lz.0e1c1c9a /dev/null differ
binary files a/gfx/pokemon/persian/front.animated.2bpp.lz.0e6a2521 /dev/null differ
binary files a/gfx/pokemon/phanpy/back.2bpp.lz.a5c509b8 /dev/null differ
binary files a/gfx/pokemon/phanpy/front.animated.2bpp.lz.53b49445 /dev/null differ
binary files a/gfx/pokemon/pichu/back.2bpp.lz.c5580983 /dev/null differ
binary files a/gfx/pokemon/pichu/front.animated.2bpp.lz.9c1c3bef /dev/null differ
binary files a/gfx/pokemon/pidgeot/back.2bpp.lz.7d9e44a5 /dev/null differ
binary files a/gfx/pokemon/pidgeot/front.animated.2bpp.lz.c161ad71 /dev/null differ
binary files a/gfx/pokemon/pidgeotto/back.2bpp.lz.8a0dd470 /dev/null differ
binary files a/gfx/pokemon/pidgeotto/front.animated.2bpp.lz.8ce78b51 /dev/null differ
binary files a/gfx/pokemon/pidgey/back.2bpp.lz.027129e8 /dev/null differ
binary files a/gfx/pokemon/pidgey/front.animated.2bpp.lz.9acd46ca /dev/null differ
binary files a/gfx/pokemon/pikachu/back.2bpp.lz.98998807 /dev/null differ
binary files a/gfx/pokemon/pikachu/front.animated.2bpp.lz.9c100565 /dev/null differ
binary files a/gfx/pokemon/piloswine/back.2bpp.lz.6fe7da21 /dev/null differ
binary files a/gfx/pokemon/piloswine/front.animated.2bpp.lz.f6f37ed2 /dev/null differ
binary files a/gfx/pokemon/pineco/back.2bpp.lz.70df8ca3 /dev/null differ
binary files a/gfx/pokemon/pineco/front.animated.2bpp.lz.82d91497 /dev/null differ
binary files a/gfx/pokemon/pinsir/back.2bpp.lz.09ac7dd4 /dev/null differ
binary files a/gfx/pokemon/pinsir/front.animated.2bpp.lz.1e3839f2 /dev/null differ
binary files a/gfx/pokemon/politoed/back.2bpp.lz.7873e52f /dev/null differ
binary files a/gfx/pokemon/politoed/front.animated.2bpp.lz.408a9c1a /dev/null differ
binary files a/gfx/pokemon/poliwag/back.2bpp.lz.35b9ee20 /dev/null differ
binary files a/gfx/pokemon/poliwag/front.animated.2bpp.lz.c7d26488 /dev/null differ
binary files a/gfx/pokemon/poliwhirl/back.2bpp.lz.76564593 /dev/null differ
binary files a/gfx/pokemon/poliwhirl/front.animated.2bpp.lz.9a36033f /dev/null differ
binary files a/gfx/pokemon/poliwrath/back.2bpp.lz.240e911e /dev/null differ
binary files a/gfx/pokemon/poliwrath/front.animated.2bpp.lz.fb1157ec /dev/null differ
binary files a/gfx/pokemon/ponyta/back.2bpp.lz.10ddc7ea /dev/null differ
binary files a/gfx/pokemon/ponyta/front.animated.2bpp.lz.2c8708d6 /dev/null differ
binary files a/gfx/pokemon/porygon/back.2bpp.lz.b3d71350 /dev/null differ
binary files a/gfx/pokemon/porygon/front.animated.2bpp.lz.70fc1333 /dev/null differ
binary files a/gfx/pokemon/porygon2/back.2bpp.lz.5bba6e40 /dev/null differ
binary files a/gfx/pokemon/porygon2/front.animated.2bpp.lz.a6410e75 /dev/null differ
binary files a/gfx/pokemon/primeape/back.2bpp.lz.690e407d /dev/null differ
binary files a/gfx/pokemon/primeape/front.animated.2bpp.lz.218352ec /dev/null differ
binary files a/gfx/pokemon/psyduck/back.2bpp.lz.d68cddb2 /dev/null differ
binary files a/gfx/pokemon/psyduck/front.animated.2bpp.lz.e4efd065 /dev/null differ
binary files a/gfx/pokemon/pupitar/back.2bpp.lz.100020c1 /dev/null differ
binary files a/gfx/pokemon/pupitar/front.animated.2bpp.lz.418c0962 /dev/null differ
binary files a/gfx/pokemon/quagsire/back.2bpp.lz.64b2ec05 /dev/null differ
binary files a/gfx/pokemon/quagsire/front.animated.2bpp.lz.bd292a94 /dev/null differ
binary files a/gfx/pokemon/quilava/back.2bpp.lz.500906e1 /dev/null differ
binary files a/gfx/pokemon/quilava/front.animated.2bpp.lz.f42f4c67 /dev/null differ
binary files a/gfx/pokemon/qwilfish/back.2bpp.lz.b2bb83c6 /dev/null differ
binary files a/gfx/pokemon/qwilfish/front.animated.2bpp.lz.9e79c033 /dev/null differ
binary files a/gfx/pokemon/raichu/back.2bpp.lz.fa4c7423 /dev/null differ
binary files a/gfx/pokemon/raichu/front.animated.2bpp.lz.25f943cb /dev/null differ
binary files a/gfx/pokemon/raikou/back.2bpp.lz.657ddfaf /dev/null differ
binary files a/gfx/pokemon/raikou/front.animated.2bpp.lz.464b6fd7 /dev/null differ
binary files a/gfx/pokemon/rapidash/back.2bpp.lz.fdd1946c /dev/null differ
binary files a/gfx/pokemon/rapidash/front.animated.2bpp.lz.d5ac5a96 /dev/null differ
binary files a/gfx/pokemon/raticate/back.2bpp.lz.b2a77d02 /dev/null differ
binary files a/gfx/pokemon/raticate/front.animated.2bpp.lz.ef1a4689 /dev/null differ
binary files a/gfx/pokemon/rattata/back.2bpp.lz.86979cd5 /dev/null differ
binary files a/gfx/pokemon/rattata/front.animated.2bpp.lz.5bdaea2b /dev/null differ
binary files a/gfx/pokemon/remoraid/back.2bpp.lz.8a6e4f29 /dev/null differ
binary files a/gfx/pokemon/remoraid/front.animated.2bpp.lz.4eaf1230 /dev/null differ
binary files a/gfx/pokemon/rhydon/back.2bpp.lz.4a3ea4af /dev/null differ
binary files a/gfx/pokemon/rhydon/front.animated.2bpp.lz.7257fc4f /dev/null differ
binary files a/gfx/pokemon/rhyhorn/back.2bpp.lz.b9a8e755 /dev/null differ
binary files a/gfx/pokemon/rhyhorn/front.animated.2bpp.lz.bdfdf7dc /dev/null differ
binary files a/gfx/pokemon/sandshrew/back.2bpp.lz.7655193f /dev/null differ
binary files a/gfx/pokemon/sandshrew/front.animated.2bpp.lz.758def3d /dev/null differ
binary files a/gfx/pokemon/sandslash/back.2bpp.lz.2999f4c6 /dev/null differ
binary files a/gfx/pokemon/sandslash/front.animated.2bpp.lz.d6498722 /dev/null differ
binary files a/gfx/pokemon/scizor/back.2bpp.lz.85149f27 /dev/null differ
binary files a/gfx/pokemon/scizor/front.animated.2bpp.lz.afd0131a /dev/null differ
binary files a/gfx/pokemon/scyther/back.2bpp.lz.1d7f8a87 /dev/null differ
binary files a/gfx/pokemon/scyther/front.animated.2bpp.lz.86d1a281 /dev/null differ
binary files a/gfx/pokemon/seadra/back.2bpp.lz.354a02e4 /dev/null differ
binary files a/gfx/pokemon/seadra/front.animated.2bpp.lz.efa9c88c /dev/null differ
binary files a/gfx/pokemon/seaking/back.2bpp.lz.3e699249 /dev/null differ
binary files a/gfx/pokemon/seaking/front.animated.2bpp.lz.fb4eb288 /dev/null differ
binary files a/gfx/pokemon/seel/back.2bpp.lz.518a4d40 /dev/null differ
binary files a/gfx/pokemon/seel/front.animated.2bpp.lz.2dc48023 /dev/null differ
binary files a/gfx/pokemon/sentret/back.2bpp.lz.c19b7f3b /dev/null differ
binary files a/gfx/pokemon/sentret/front.animated.2bpp.lz.07c594c0 /dev/null differ
binary files a/gfx/pokemon/shellder/back.2bpp.lz.61e27953 /dev/null differ
binary files a/gfx/pokemon/shellder/front.animated.2bpp.lz.df57d475 /dev/null differ
binary files a/gfx/pokemon/shuckle/back.2bpp.lz.8d66899b /dev/null differ
binary files a/gfx/pokemon/shuckle/front.animated.2bpp.lz.dee153d4 /dev/null differ
binary files a/gfx/pokemon/skarmory/back.2bpp.lz.f5e2e2e4 /dev/null differ
binary files a/gfx/pokemon/skarmory/front.animated.2bpp.lz.7de4675e /dev/null differ
binary files a/gfx/pokemon/skiploom/back.2bpp.lz.54e87a0c /dev/null differ
binary files a/gfx/pokemon/skiploom/front.animated.2bpp.lz.6436d556 /dev/null differ
binary files a/gfx/pokemon/slowbro/back.2bpp.lz.3676b1f1 /dev/null differ
binary files a/gfx/pokemon/slowbro/front.animated.2bpp.lz.257e2e84 /dev/null differ
binary files a/gfx/pokemon/slowking/back.2bpp.lz.a90de69e /dev/null differ
binary files a/gfx/pokemon/slowking/front.animated.2bpp.lz.4c2f7140 /dev/null differ
binary files a/gfx/pokemon/slowpoke/back.2bpp.lz.f2d1bb5c /dev/null differ
binary files a/gfx/pokemon/slowpoke/front.animated.2bpp.lz.42347014 /dev/null differ
binary files a/gfx/pokemon/slugma/back.2bpp.lz.dc25c77a /dev/null differ
binary files a/gfx/pokemon/slugma/front.animated.2bpp.lz.c1a44906 /dev/null differ
binary files a/gfx/pokemon/smeargle/back.2bpp.lz.2de2de8c /dev/null differ
binary files a/gfx/pokemon/smeargle/front.animated.2bpp.lz.82ec0f51 /dev/null differ
binary files a/gfx/pokemon/smoochum/back.2bpp.lz.af01f906 /dev/null differ
binary files a/gfx/pokemon/smoochum/front.animated.2bpp.lz.5977720b /dev/null differ
binary files a/gfx/pokemon/sneasel/back.2bpp.lz.5298828d /dev/null differ
binary files a/gfx/pokemon/sneasel/front.animated.2bpp.lz.8f7db3e9 /dev/null differ
binary files a/gfx/pokemon/snorlax/back.2bpp.lz.90570272 /dev/null differ
binary files a/gfx/pokemon/snorlax/front.animated.2bpp.lz.8253357b /dev/null differ
binary files a/gfx/pokemon/snubbull/back.2bpp.lz.26eaaa5d /dev/null differ
binary files a/gfx/pokemon/snubbull/front.animated.2bpp.lz.a1b4eb88 /dev/null differ
binary files a/gfx/pokemon/spearow/back.2bpp.lz.b8e760aa /dev/null differ
binary files a/gfx/pokemon/spearow/front.animated.2bpp.lz.59d61986 /dev/null differ
binary files a/gfx/pokemon/spinarak/back.2bpp.lz.14002836 /dev/null differ
binary files a/gfx/pokemon/spinarak/front.animated.2bpp.lz.31ab6868 /dev/null differ
binary files a/gfx/pokemon/squirtle/back.2bpp.lz.76295ae8 /dev/null differ
binary files a/gfx/pokemon/squirtle/front.animated.2bpp.lz.9b6f9ec9 /dev/null differ
binary files a/gfx/pokemon/stantler/back.2bpp.lz.16502aac /dev/null differ
binary files a/gfx/pokemon/stantler/front.animated.2bpp.lz.46b7dd06 /dev/null differ
binary files a/gfx/pokemon/starmie/back.2bpp.lz.a8923741 /dev/null differ
binary files a/gfx/pokemon/starmie/front.animated.2bpp.lz.522b6699 /dev/null differ
binary files a/gfx/pokemon/staryu/back.2bpp.lz.79ea9d00 /dev/null differ
binary files a/gfx/pokemon/staryu/front.animated.2bpp.lz.22f1d06b /dev/null differ
binary files a/gfx/pokemon/steelix/back.2bpp.lz.f3c03e61 /dev/null differ
binary files a/gfx/pokemon/steelix/front.animated.2bpp.lz.42f3f8d1 /dev/null differ
binary files a/gfx/pokemon/sudowoodo/back.2bpp.lz.728036c6 /dev/null differ
binary files a/gfx/pokemon/sudowoodo/front.animated.2bpp.lz.b0f04991 /dev/null differ
binary files a/gfx/pokemon/suicune/back.2bpp.lz.5c49d112 /dev/null differ
binary files a/gfx/pokemon/suicune/front.animated.2bpp.lz.64698c0a /dev/null differ
binary files a/gfx/pokemon/sunflora/back.2bpp.lz.9d0684f0 /dev/null differ
binary files a/gfx/pokemon/sunflora/front.animated.2bpp.lz.258c3e67 /dev/null differ
binary files a/gfx/pokemon/sunkern/back.2bpp.lz.d28f6303 /dev/null differ
binary files a/gfx/pokemon/sunkern/front.animated.2bpp.lz.316c5261 /dev/null differ
binary files a/gfx/pokemon/swinub/back.2bpp.lz.1ebbfabf /dev/null differ
binary files a/gfx/pokemon/swinub/front.animated.2bpp.lz.228147a5 /dev/null differ
binary files a/gfx/pokemon/tangela/back.2bpp.lz.435194a6 /dev/null differ
binary files a/gfx/pokemon/tangela/front.animated.2bpp.lz.7cb3fed8 /dev/null differ
binary files a/gfx/pokemon/tauros/back.2bpp.lz.f487c586 /dev/null differ
binary files a/gfx/pokemon/tauros/front.animated.2bpp.lz.982dd0db /dev/null differ
binary files a/gfx/pokemon/teddiursa/back.2bpp.lz.53f6e34e /dev/null differ
binary files a/gfx/pokemon/teddiursa/front.animated.2bpp.lz.5f9648c7 /dev/null differ
binary files a/gfx/pokemon/tentacool/back.2bpp.lz.ae7b2102 /dev/null differ
binary files a/gfx/pokemon/tentacool/front.animated.2bpp.lz.7a86457c /dev/null differ
binary files a/gfx/pokemon/tentacruel/back.2bpp.lz.0e344f19 /dev/null differ
binary files a/gfx/pokemon/tentacruel/front.animated.2bpp.lz.f13e5904 /dev/null differ
binary files a/gfx/pokemon/togepi/back.2bpp.lz.0e22cc02 /dev/null differ
binary files a/gfx/pokemon/togepi/front.animated.2bpp.lz.0cf7ba07 /dev/null differ
binary files a/gfx/pokemon/togetic/back.2bpp.lz.62cbb330 /dev/null differ
binary files a/gfx/pokemon/togetic/front.animated.2bpp.lz.5797583e /dev/null differ
binary files a/gfx/pokemon/totodile/back.2bpp.lz.ab6bc2a1 /dev/null differ
binary files a/gfx/pokemon/totodile/front.animated.2bpp.lz.afce8cd0 /dev/null differ
binary files a/gfx/pokemon/typhlosion/back.2bpp.lz.83be0292 /dev/null differ
binary files a/gfx/pokemon/typhlosion/front.animated.2bpp.lz.65adc1e1 /dev/null differ
binary files a/gfx/pokemon/tyranitar/back.2bpp.lz.05b022c9 /dev/null differ
binary files a/gfx/pokemon/tyranitar/front.animated.2bpp.lz.e0e9187e /dev/null differ
binary files a/gfx/pokemon/tyrogue/back.2bpp.lz.5d84cef1 /dev/null differ
binary files a/gfx/pokemon/tyrogue/front.animated.2bpp.lz.a3790421 /dev/null differ
binary files a/gfx/pokemon/umbreon/back.2bpp.lz.55e50b8c /dev/null differ
binary files a/gfx/pokemon/umbreon/front.animated.2bpp.lz.b484be57 /dev/null differ
binary files a/gfx/pokemon/unown_a/back.2bpp.lz.b8389572 /dev/null differ
binary files a/gfx/pokemon/unown_a/front.animated.2bpp.lz.47e16756 /dev/null differ
binary files a/gfx/pokemon/unown_b/back.2bpp.lz.72a0840f /dev/null differ
binary files a/gfx/pokemon/unown_b/front.animated.2bpp.lz.5742d494 /dev/null differ
binary files a/gfx/pokemon/unown_c/back.2bpp.lz.f92b665a /dev/null differ
binary files a/gfx/pokemon/unown_c/front.animated.2bpp.lz.5fef639b /dev/null differ
binary files a/gfx/pokemon/unown_d/back.2bpp.lz.c8213d32 /dev/null differ
binary files a/gfx/pokemon/unown_d/front.animated.2bpp.lz.7810a57f /dev/null differ
binary files a/gfx/pokemon/unown_e/back.2bpp.lz.777a8ecd /dev/null differ
binary files a/gfx/pokemon/unown_e/front.animated.2bpp.lz.83f43ff7 /dev/null differ
binary files a/gfx/pokemon/unown_f/back.2bpp.lz.3fe1c85a /dev/null differ
binary files a/gfx/pokemon/unown_f/front.animated.2bpp.lz.ec888954 /dev/null differ
binary files a/gfx/pokemon/unown_g/back.2bpp.lz.91650439 /dev/null differ
binary files a/gfx/pokemon/unown_g/front.animated.2bpp.lz.c0b74162 /dev/null differ
binary files a/gfx/pokemon/unown_h/back.2bpp.lz.78421e5b /dev/null differ
binary files a/gfx/pokemon/unown_h/front.animated.2bpp.lz.9a6afeb9 /dev/null differ
binary files a/gfx/pokemon/unown_i/back.2bpp.lz.7feb4b30 /dev/null differ
binary files a/gfx/pokemon/unown_i/front.animated.2bpp.lz.f5e7f816 /dev/null differ
binary files a/gfx/pokemon/unown_j/back.2bpp.lz.b0f3bec2 /dev/null differ
binary files a/gfx/pokemon/unown_j/front.animated.2bpp.lz.d8bf9223 /dev/null differ
binary files a/gfx/pokemon/unown_k/back.2bpp.lz.745fda48 /dev/null differ
binary files a/gfx/pokemon/unown_k/front.animated.2bpp.lz.fb25b385 /dev/null differ
binary files a/gfx/pokemon/unown_l/back.2bpp.lz.e38e0d57 /dev/null differ
binary files a/gfx/pokemon/unown_l/front.animated.2bpp.lz.26195a59 /dev/null differ
binary files a/gfx/pokemon/unown_m/back.2bpp.lz.38d93bc8 /dev/null differ
binary files a/gfx/pokemon/unown_m/front.animated.2bpp.lz.2659315e /dev/null differ
binary files a/gfx/pokemon/unown_n/back.2bpp.lz.c8b7d3a4 /dev/null differ
binary files a/gfx/pokemon/unown_n/front.animated.2bpp.lz.96ce7c62 /dev/null differ
binary files a/gfx/pokemon/unown_o/back.2bpp.lz.89ba693c /dev/null differ
binary files a/gfx/pokemon/unown_o/front.animated.2bpp.lz.a9151b66 /dev/null differ
binary files a/gfx/pokemon/unown_p/back.2bpp.lz.09c618c4 /dev/null differ
binary files a/gfx/pokemon/unown_p/front.animated.2bpp.lz.83a096fc /dev/null differ
binary files a/gfx/pokemon/unown_q/back.2bpp.lz.e32430b4 /dev/null differ
binary files a/gfx/pokemon/unown_q/front.animated.2bpp.lz.44dad60c /dev/null differ
binary files a/gfx/pokemon/unown_r/back.2bpp.lz.5df8287c /dev/null differ
binary files a/gfx/pokemon/unown_r/front.animated.2bpp.lz.8e67e3fc /dev/null differ
binary files a/gfx/pokemon/unown_s/back.2bpp.lz.abd4ad58 /dev/null differ
binary files a/gfx/pokemon/unown_s/front.animated.2bpp.lz.f3db4e89 /dev/null differ
binary files a/gfx/pokemon/unown_t/back.2bpp.lz.87d48ca0 /dev/null differ
binary files a/gfx/pokemon/unown_t/front.animated.2bpp.lz.8bdc40ae /dev/null differ
binary files a/gfx/pokemon/unown_u/back.2bpp.lz.40b63dfb /dev/null differ
binary files a/gfx/pokemon/unown_u/front.animated.2bpp.lz.2690db54 /dev/null differ
binary files a/gfx/pokemon/unown_v/back.2bpp.lz.5b1a6acc /dev/null differ
binary files a/gfx/pokemon/unown_v/front.animated.2bpp.lz.d196c60e /dev/null differ
binary files a/gfx/pokemon/unown_w/back.2bpp.lz.a55282bf /dev/null differ
binary files a/gfx/pokemon/unown_w/front.animated.2bpp.lz.5b45fa3d /dev/null differ
binary files a/gfx/pokemon/unown_x/back.2bpp.lz.0001a198 /dev/null differ
binary files a/gfx/pokemon/unown_x/front.animated.2bpp.lz.3362c680 /dev/null differ
binary files a/gfx/pokemon/unown_y/back.2bpp.lz.292d9ff2 /dev/null differ
binary files a/gfx/pokemon/unown_y/front.animated.2bpp.lz.8cd89db4 /dev/null differ
binary files a/gfx/pokemon/unown_z/back.2bpp.lz.a41240a1 /dev/null differ
binary files a/gfx/pokemon/unown_z/front.animated.2bpp.lz.2d4170a0 /dev/null differ
binary files a/gfx/pokemon/ursaring/back.2bpp.lz.0966cee1 /dev/null differ
binary files a/gfx/pokemon/ursaring/front.animated.2bpp.lz.5bcb8114 /dev/null differ
binary files a/gfx/pokemon/vaporeon/back.2bpp.lz.aafe2ea4 /dev/null differ
binary files a/gfx/pokemon/vaporeon/front.animated.2bpp.lz.6e1ee993 /dev/null differ
binary files a/gfx/pokemon/venomoth/back.2bpp.lz.ba3cccb7 /dev/null differ
binary files a/gfx/pokemon/venomoth/front.animated.2bpp.lz.6c0096ec /dev/null differ
binary files a/gfx/pokemon/venonat/back.2bpp.lz.63b1017a /dev/null differ
binary files a/gfx/pokemon/venonat/front.animated.2bpp.lz.02a36f08 /dev/null differ
binary files a/gfx/pokemon/venusaur/back.2bpp.lz.1d5b9ebe /dev/null differ
binary files a/gfx/pokemon/venusaur/front.animated.2bpp.lz.48d131f4 /dev/null differ
binary files a/gfx/pokemon/victreebel/back.2bpp.lz.a80b1dc4 /dev/null differ
binary files a/gfx/pokemon/victreebel/front.animated.2bpp.lz.d5d535c1 /dev/null differ
binary files a/gfx/pokemon/vileplume/back.2bpp.lz.9f944092 /dev/null differ
binary files a/gfx/pokemon/vileplume/front.animated.2bpp.lz.db2287e6 /dev/null differ
binary files a/gfx/pokemon/voltorb/back.2bpp.lz.f19cefe9 /dev/null differ
binary files a/gfx/pokemon/voltorb/front.animated.2bpp.lz.64051f97 /dev/null differ
binary files a/gfx/pokemon/vulpix/back.2bpp.lz.0c7852c8 /dev/null differ
binary files a/gfx/pokemon/vulpix/front.animated.2bpp.lz.df94d884 /dev/null differ
binary files a/gfx/pokemon/wartortle/back.2bpp.lz.f2338cb4 /dev/null differ
binary files a/gfx/pokemon/wartortle/front.animated.2bpp.lz.f50d25f5 /dev/null differ
binary files a/gfx/pokemon/weedle/back.2bpp.lz.f26ac339 /dev/null differ
binary files a/gfx/pokemon/weedle/front.animated.2bpp.lz.9e1dedbd /dev/null differ
binary files a/gfx/pokemon/weepinbell/back.2bpp.lz.f84a5fe6 /dev/null differ
binary files a/gfx/pokemon/weepinbell/front.animated.2bpp.lz.7b06c092 /dev/null differ
binary files a/gfx/pokemon/weezing/back.2bpp.lz.5ac5b672 /dev/null differ
binary files a/gfx/pokemon/weezing/front.animated.2bpp.lz.75928bd0 /dev/null differ
binary files a/gfx/pokemon/wigglytuff/back.2bpp.lz.fee674ac /dev/null differ
binary files a/gfx/pokemon/wigglytuff/front.animated.2bpp.lz.49311d0b /dev/null differ
binary files a/gfx/pokemon/wobbuffet/back.2bpp.lz.a862192a /dev/null differ
binary files a/gfx/pokemon/wobbuffet/front.animated.2bpp.lz.f1f4687d /dev/null differ
binary files a/gfx/pokemon/wooper/back.2bpp.lz.4f4b7917 /dev/null differ
binary files a/gfx/pokemon/wooper/front.animated.2bpp.lz.4e440469 /dev/null differ
binary files a/gfx/pokemon/xatu/back.2bpp.lz.4de765ff /dev/null differ
binary files a/gfx/pokemon/xatu/front.animated.2bpp.lz.4f452e43 /dev/null differ
binary files a/gfx/pokemon/yanma/back.2bpp.lz.2ca27ab3 /dev/null differ
binary files a/gfx/pokemon/yanma/front.animated.2bpp.lz.25f91adf /dev/null differ
binary files a/gfx/pokemon/zapdos/back.2bpp.lz.a44c7524 /dev/null differ
binary files a/gfx/pokemon/zapdos/front.animated.2bpp.lz.05cb214a /dev/null differ
binary files a/gfx/pokemon/zubat/back.2bpp.lz.aa77eb62 /dev/null differ
binary files a/gfx/pokemon/zubat/front.animated.2bpp.lz.f12e6581 /dev/null differ
binary files a/gfx/sgb/gbc_only.2bpp.lz.4a5bba0e /dev/null differ
binary files a/gfx/slots/slots_1.2bpp.lz.b22ddc13 /dev/null differ
binary files a/gfx/slots/slots_2.2bpp.lz.b28f76e3 /dev/null differ
binary files a/gfx/slots/slots_3.2bpp.lz.70c2984c /dev/null differ
binary files a/gfx/tilesets/aerodactyl_word_room.2bpp.lz.8b42470b /dev/null differ
binary files a/gfx/tilesets/battle_tower_inside.2bpp.lz.467b6a2d /dev/null differ
binary files a/gfx/tilesets/battle_tower_outside.2bpp.lz.391603fb /dev/null differ
binary files a/gfx/tilesets/beta_word_room.2bpp.lz.8b42470b /dev/null differ
binary files a/gfx/tilesets/cave.2bpp.lz.3437812a /dev/null differ
binary files a/gfx/tilesets/champions_room.2bpp.lz.93800351 /dev/null differ
binary files a/gfx/tilesets/dark_cave.2bpp.lz.25b9c4b6 /dev/null differ
binary files a/gfx/tilesets/elite_four_room.2bpp.lz.c1f2ed8f /dev/null differ
binary files a/gfx/tilesets/facility.2bpp.lz.454cfd8b /dev/null differ
binary files a/gfx/tilesets/forest.2bpp.lz.6b0ac896 /dev/null differ
binary files a/gfx/tilesets/game_corner.2bpp.lz.71d29a2f /dev/null differ
binary files a/gfx/tilesets/gate.2bpp.lz.f5a55006 /dev/null differ
binary files a/gfx/tilesets/ho_oh_word_room.2bpp.lz.8b42470b /dev/null differ
binary files a/gfx/tilesets/house.2bpp.lz.c848ef13 /dev/null differ
binary files a/gfx/tilesets/ice_path.2bpp.lz.e23bc89f /dev/null differ
binary files a/gfx/tilesets/johto.2bpp.lz.0c7e555a /dev/null differ
binary files a/gfx/tilesets/johto_modern.2bpp.lz.391603fb /dev/null differ
binary files a/gfx/tilesets/kabuto_word_room.2bpp.lz.8b42470b /dev/null differ
binary files a/gfx/tilesets/kanto.2bpp.lz.a29f5d51 /dev/null differ
binary files a/gfx/tilesets/lab.2bpp.lz.b8d0f547 /dev/null differ
binary files a/gfx/tilesets/lighthouse.2bpp.lz.0c1544c1 /dev/null differ
binary files a/gfx/tilesets/mansion.2bpp.lz.63b414d4 /dev/null differ
binary files a/gfx/tilesets/mart.2bpp.lz.e2e94f92 /dev/null differ
binary files a/gfx/tilesets/omanyte_word_room.2bpp.lz.8b42470b /dev/null differ
binary files a/gfx/tilesets/park.2bpp.lz.7fcb81d6 /dev/null differ
binary files a/gfx/tilesets/players_house.2bpp.lz.252cbd8f /dev/null differ
binary files a/gfx/tilesets/players_room.2bpp.lz.35e51007 /dev/null differ
binary files a/gfx/tilesets/pokecenter.2bpp.lz.e1c4014c /dev/null differ
binary files a/gfx/tilesets/pokecom_center.2bpp.lz.febbc4ec /dev/null differ
binary files a/gfx/tilesets/port.2bpp.lz.56b1a405 /dev/null differ
binary files a/gfx/tilesets/radio_tower.2bpp.lz.27cdd9ad /dev/null differ
binary files a/gfx/tilesets/ruins_of_alph.2bpp.lz.8b42470b /dev/null differ
binary files a/gfx/tilesets/tower.2bpp.lz.bc56789c /dev/null differ
binary files a/gfx/tilesets/traditional_house.2bpp.lz.dd51d079 /dev/null differ
binary files a/gfx/tilesets/train_station.2bpp.lz.1600ca86 /dev/null differ
binary files a/gfx/tilesets/underground.2bpp.lz.cace291c /dev/null differ
binary files a/gfx/title/crystal.2bpp.lz.cd5aabdd /dev/null differ
binary files a/gfx/title/logo.2bpp.lz.f22013e3 /dev/null differ
binary files a/gfx/title/suicune.2bpp.lz.30e490d0 /dev/null differ
binary files a/gfx/trade/game_boy.2bpp.lz.71a5f644 /dev/null differ
binary files a/gfx/trainers/beauty.2bpp.lz.c1c13787 /dev/null differ
binary files a/gfx/trainers/biker.2bpp.lz.cb40f7cd /dev/null differ
binary files a/gfx/trainers/bird_keeper.2bpp.lz.1e56954c /dev/null differ
binary files a/gfx/trainers/blackbelt_t.2bpp.lz.4ef2481c /dev/null differ
binary files a/gfx/trainers/blaine.2bpp.lz.00a3b6f5 /dev/null differ
binary files a/gfx/trainers/blue.2bpp.lz.9fdbab8f /dev/null differ
binary files a/gfx/trainers/boarder.2bpp.lz.5d6881a8 /dev/null differ
binary files a/gfx/trainers/brock.2bpp.lz.5bdeb7bf /dev/null differ
binary files a/gfx/trainers/bruno.2bpp.lz.22f3c222 /dev/null differ
binary files a/gfx/trainers/bug_catcher.2bpp.lz.43144f97 /dev/null differ
binary files a/gfx/trainers/bugsy.2bpp.lz.c070450d /dev/null differ
binary files a/gfx/trainers/burglar.2bpp.lz.e063f42e /dev/null differ
binary files a/gfx/trainers/cal.2bpp.lz.aac54a14 /dev/null differ
binary files a/gfx/trainers/camper.2bpp.lz.cc2357ea /dev/null differ
binary files a/gfx/trainers/champion.2bpp.lz.0175f5ea /dev/null differ
binary files a/gfx/trainers/chuck.2bpp.lz.cab13edd /dev/null differ
binary files a/gfx/trainers/clair.2bpp.lz.a1771075 /dev/null differ
binary files a/gfx/trainers/cooltrainer_f.2bpp.lz.6fb1e652 /dev/null differ
binary files a/gfx/trainers/cooltrainer_m.2bpp.lz.0aa81882 /dev/null differ
binary files a/gfx/trainers/erika.2bpp.lz.58985f01 /dev/null differ
binary files a/gfx/trainers/executive_f.2bpp.lz.c8b5dc9c /dev/null differ
binary files a/gfx/trainers/executive_m.2bpp.lz.211746a6 /dev/null differ
binary files a/gfx/trainers/falkner.2bpp.lz.6ec6bbaf /dev/null differ
binary files a/gfx/trainers/firebreather.2bpp.lz.a790feb1 /dev/null differ
binary files a/gfx/trainers/fisher.2bpp.lz.95bfbfd6 /dev/null differ
binary files a/gfx/trainers/gentleman.2bpp.lz.d3d78e00 /dev/null differ
binary files a/gfx/trainers/grunt_f.2bpp.lz.522aecd7 /dev/null differ
binary files a/gfx/trainers/grunt_m.2bpp.lz.916e09d2 /dev/null differ
binary files a/gfx/trainers/guitarist.2bpp.lz.be5a9b71 /dev/null differ
binary files a/gfx/trainers/hiker.2bpp.lz.07a4e386 /dev/null differ
binary files a/gfx/trainers/janine.2bpp.lz.5350f3ce /dev/null differ
binary files a/gfx/trainers/jasmine.2bpp.lz.dcd58308 /dev/null differ
binary files a/gfx/trainers/juggler.2bpp.lz.2d7625ba /dev/null differ
binary files a/gfx/trainers/karen.2bpp.lz.7fc3d941 /dev/null differ
binary files a/gfx/trainers/kimono_girl.2bpp.lz.e8833d48 /dev/null differ
binary files a/gfx/trainers/koga.2bpp.lz.7a066020 /dev/null differ
binary files a/gfx/trainers/lass.2bpp.lz.e3726508 /dev/null differ
binary files a/gfx/trainers/lt_surge.2bpp.lz.4ac586d0 /dev/null differ
binary files a/gfx/trainers/medium.2bpp.lz.db642b9e /dev/null differ
binary files a/gfx/trainers/misty.2bpp.lz.2ded1a10 /dev/null differ
binary files a/gfx/trainers/morty.2bpp.lz.aec5773b /dev/null differ
binary files a/gfx/trainers/mysticalman.2bpp.lz.35d01215 /dev/null differ
binary files a/gfx/trainers/oak.2bpp.lz.91a27df3 /dev/null differ
binary files a/gfx/trainers/officer.2bpp.lz.630b057a /dev/null differ
binary files a/gfx/trainers/picnicker.2bpp.lz.6842b86a /dev/null differ
binary files a/gfx/trainers/pokefan_f.2bpp.lz.9cbd3f20 /dev/null differ
binary files a/gfx/trainers/pokefan_m.2bpp.lz.5bc5a3e1 /dev/null differ
binary files a/gfx/trainers/pokemaniac.2bpp.lz.786c5fce /dev/null differ
binary files a/gfx/trainers/pryce.2bpp.lz.1a98cae8 /dev/null differ
binary files a/gfx/trainers/psychic_t.2bpp.lz.ecd603f4 /dev/null differ
binary files a/gfx/trainers/red.2bpp.lz.51104ac6 /dev/null differ
binary files a/gfx/trainers/rival1.2bpp.lz.e43b32ef /dev/null differ
binary files a/gfx/trainers/rival2.2bpp.lz.562de263 /dev/null differ
binary files a/gfx/trainers/sabrina.2bpp.lz.d09a2b46 /dev/null differ
binary files a/gfx/trainers/sage.2bpp.lz.2038324b /dev/null differ
binary files a/gfx/trainers/sailor.2bpp.lz.0f7f3386 /dev/null differ
binary files a/gfx/trainers/schoolboy.2bpp.lz.6d26b31b /dev/null differ
binary files a/gfx/trainers/scientist.2bpp.lz.2ef10474 /dev/null differ
binary files a/gfx/trainers/skier.2bpp.lz.399d4240 /dev/null differ
binary files a/gfx/trainers/super_nerd.2bpp.lz.c5362664 /dev/null differ
binary files a/gfx/trainers/swimmer_f.2bpp.lz.c60d0ad6 /dev/null differ
binary files a/gfx/trainers/swimmer_m.2bpp.lz.2c1a716e /dev/null differ
binary files a/gfx/trainers/teacher.2bpp.lz.1d131210 /dev/null differ
binary files a/gfx/trainers/twins.2bpp.lz.462fd733 /dev/null differ
binary files a/gfx/trainers/whitney.2bpp.lz.dcb46ea6 /dev/null differ
binary files a/gfx/trainers/will.2bpp.lz.842af358 /dev/null differ
binary files a/gfx/trainers/youngster.2bpp.lz.4bef139d /dev/null differ
binary files a/gfx/unown_puzzle/aerodactyl.2bpp.lz.f546fb5e /dev/null differ
binary files a/gfx/unown_puzzle/hooh.2bpp.lz.e440a572 /dev/null differ
binary files a/gfx/unown_puzzle/kabuto.2bpp.lz.0ed9882d /dev/null differ
binary files a/gfx/unown_puzzle/omanyte.2bpp.lz.27bfcbde /dev/null differ
binary files a/gfx/unown_puzzle/start_cancel.2bpp.lz.e07fe7bd /dev/null differ
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -20,5 +20,9 @@
 
 gfx md5: common.h
 
+lzcomp: CFLAGS = -O3 -flto -std=c11 -Wall -Wextra -pedantic -Wno-strict-overflow -Wno-sign-compare
+lzcomp: $(wildcard lz/*.c) $(wildcard lz/*.h)
+	$(CC) $(CFLAGS) -o $@ lz/*.c
+
 %: %.c
 	$(CC) $(CFLAGS) -o $@ $<
--- /dev/null
+++ b/tools/lz/global.c
@@ -1,0 +1,35 @@
+#include "proto.h"
+
+const struct compressor compressors[] = {
+  // NOTE: the "flags" field for each compressor will be set to the chosen/current method number minus the base
+  // number for that particular compressor. That means that each compressor will use a zero-based flags value.
+  {.methods = 72, .name = "singlepass",  .function = &try_compress_single_pass}, //  0-71
+  {.methods =  2, .name = "null",        .function = &store_uncompressed},       // 72-73
+  {.methods =  6, .name = "repetitions", .function = &try_compress_repetitions}, // 74-79
+  {.methods = 16, .name = "multipass",   .function = &try_compress_multi_pass},  // 80-95
+  {0} // end of the list
+};
+
+const unsigned char bit_flipping_table[] = {
+  // For each byte, the table contains that same byte with its bits flipped around (for instance,
+  // 0x58 (01011000 binary) becomes 0x1a (00011010 binary)). This is faster than flipping bits
+  // manually at runtime.
+  0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
+  0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
+  0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
+  0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
+  0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
+  0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
+  0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
+  0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
+  0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
+  0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
+  0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
+  0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
+  0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
+  0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
+  0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
+  0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
+};
+
+char option_name_buffer[] = "-?"; // used to extract the name of a short option (separated from its argument)
--- /dev/null
+++ b/tools/lz/main.c
@@ -1,0 +1,51 @@
+#include "proto.h"
+
+int main (int argc, char ** argv) {
+  struct options options = get_options(argc, argv);
+  unsigned short size;
+  unsigned char * file_buffer = read_file_into_buffer(options.input, &size);
+  struct command * commands;
+  if (options.mode & 2) {
+    unsigned short original_size = size, remainder;
+    commands = get_commands_from_file(file_buffer, &size, &remainder);
+    if (!commands) error_exit(1, "invalid command stream");
+    if (options.mode == 2) {
+      unsigned char * uncompressed = get_uncompressed_data(commands, file_buffer, &size);
+      if (!uncompressed) error_exit(1, "output data is too large");
+      write_raw_data_to_file(options.output, uncompressed, size);
+      free(uncompressed);
+    } else
+      write_commands_and_padding_to_textfile(options.output, commands, size, file_buffer, original_size - remainder, remainder);
+  } else {
+    commands = compress(file_buffer, &size, options.method);
+    (options.mode ? write_commands_to_textfile : write_commands_to_file)(options.output, commands, size, file_buffer, options.alignment);
+  }
+  free(file_buffer);
+  free(commands);
+  return 0;
+}
+
+struct command * compress (const unsigned char * data, unsigned short * size, unsigned method) {
+  unsigned char * bitflipped = malloc(*size);
+  unsigned current;
+  for (current = 0; current < *size; current ++) bitflipped[current] = bit_flipping_table[data[current]];
+  const struct compressor * compressor = compressors;
+  struct command * result;
+  if (method < COMPRESSION_METHODS) {
+    while (method >= compressor -> methods) method -= (compressor ++) -> methods;
+    result = compressor -> function(data, bitflipped, size, method);
+  } else {
+    struct command * compressed_sequences[COMPRESSION_METHODS];
+    unsigned short lengths[COMPRESSION_METHODS];
+    unsigned flags = compressor -> methods;
+    for (current = 0; current < COMPRESSION_METHODS; current ++) {
+      lengths[current] = *size;
+      if (!flags) flags = (++ compressor) -> methods;
+      compressed_sequences[current] = compressor -> function(data, bitflipped, lengths + current, -- flags);
+    }
+    result = select_command_sequence(compressed_sequences, lengths, COMPRESSION_METHODS, size);
+    for (current = 0; current < COMPRESSION_METHODS; current ++) free(compressed_sequences[current]);
+  }
+  free(bitflipped);
+  return result;
+}
--- /dev/null
+++ b/tools/lz/merging.c
@@ -1,0 +1,61 @@
+#include "proto.h"
+
+struct command * select_command_sequence (struct command ** sequences, const unsigned short * lengths, unsigned count, unsigned short * final_length) {
+  unsigned short min_sequence = 0, min_length = compressed_length(*sequences, *lengths);
+  unsigned short seq, len;
+  for (seq = 1; seq < count; seq ++) {
+    len = compressed_length(sequences[seq], lengths[seq]);
+    if (len < min_length) {
+      min_sequence = seq;
+      min_length = len;
+    }
+  }
+  *final_length = lengths[min_sequence];
+  struct command * current = malloc(*final_length * sizeof(struct command));
+  memcpy(current, sequences[min_sequence], *final_length * sizeof(struct command));
+  struct command * new;
+  for (seq = 1; seq < count; seq ++) {
+    new = merge_command_sequences(current, *final_length, sequences[(seq + min_sequence) % count], lengths[(seq + min_sequence) % count], final_length);
+    free(current);
+    current = new;
+  }
+  return current;
+}
+
+struct command * merge_command_sequences (const struct command * current, unsigned short current_length, const struct command * new, unsigned short new_length,
+                                          unsigned short * result_length) {
+  struct command * result = malloc(sizeof(struct command) * (current_length + new_length));
+  struct command * current_command = result;
+  const struct command * saved_current;
+  const struct command * saved_new;
+  unsigned short current_pos, new_pos;
+  while (current_length) {
+    if (current -> count == new -> count) {
+      *(current_command ++) = pick_best_command(2, *(current ++), *(new ++));
+      current_length --;
+      continue;
+    }
+    saved_current = current;
+    saved_new = new;
+    current_pos = (current ++) -> count;
+    new_pos = (new ++) -> count;
+    current_length --;
+    while (current_pos != new_pos)
+      if (current_pos < new_pos) {
+        current_pos += (current ++) -> count;
+        current_length --;
+      } else
+        new_pos += (new ++) -> count;
+    current_pos = compressed_length(saved_current, current - saved_current);
+    new_pos = compressed_length(saved_new, new - saved_new);
+    if (new_pos < current_pos) {
+      memcpy(current_command, saved_new, sizeof(struct command) * (new - saved_new));
+      current_command += new - saved_new;
+    } else {
+      memcpy(current_command, saved_current, sizeof(struct command) * (current - saved_current));
+      current_command += current - saved_current;
+    }
+  }
+  *result_length = current_command - result;
+  return result;
+}
--- /dev/null
+++ b/tools/lz/mpcomp.c
@@ -1,0 +1,112 @@
+#include "proto.h"
+
+/*
+   Multi-pass compressor: performs an initial pass generating a single command for each byte position in the data and
+                          refines the command stream further in subsequent passes.
+   Methods defined: 16
+   Flags values: the flags are a bitfield; each bit triggers some alternate behavior if set:
+     1: always emit a literal command (0) for the first byte of the file
+     2: when reducing a two-byte repetition (2) command in the overlap elimination pass, don't force it to contain a
+        whole number of repetitions (i.e., an even count)
+     4: don't emit copy commands (4, 5, 6) with a count of 3
+     8: don't emit single-byte repetition (1) commands
+*/
+
+struct command * try_compress_multi_pass (const unsigned char * data, const unsigned char * flipped, unsigned short * size, unsigned flags) {
+  struct command * result = calloc(*size, sizeof(struct command));
+  unsigned char * reversed = malloc(*size);
+  short * sources = malloc(*size * sizeof(short));
+  unsigned short pos, next, current = 0;
+  for (pos = 0; pos < *size; pos ++) {
+    reversed[pos] = data[*size - 1 - pos];
+    sources[pos] = -1;
+  }
+  for (pos = (flags & 1); pos < *size; pos += (result[pos].count >= MULTIPASS_SKIP_THRESHOLD) ? result[pos].count : 1) {
+    result[pos] = pick_command_for_pass(data, flipped, reversed, sources, *size, pos, flags);
+    if ((result[pos].command >= 4) || (result[pos].count < MULTIPASS_SKIP_THRESHOLD)) sources[current ++] = pos;
+  }
+  free(reversed);
+  free(sources);
+  for (pos = 0; pos < *size; pos ++) {
+    for (current = 1; current < result[pos].count; current ++) if (result[pos + current].count > result[pos].count) {
+      result[pos].count = current;
+      if ((result[pos].command == 2) && (current & 1) && !(flags & 2)) result[pos].count --;
+    }
+    if (result[pos].count <= command_size(result[pos])) result[pos] = (struct command) {.command = 0, .count = 0};
+  }
+  for (pos = 0; pos < *size; pos ++)
+    if (!result[pos].command) {
+      for (current = 1; (current < MAX_COMMAND_COUNT) && ((pos + current) < *size); current ++) if (result[pos + current].command) break;
+      result[pos] = (struct command) {.command = 0, .count = current, .value = pos};
+    } else if (result[pos].count > MAX_COMMAND_COUNT) {
+      result[pos + MAX_COMMAND_COUNT] = result[pos];
+      result[pos + MAX_COMMAND_COUNT].count -= MAX_COMMAND_COUNT;
+      if ((result[pos + MAX_COMMAND_COUNT].command >= 4) && (result[pos + MAX_COMMAND_COUNT].value >= 0))
+        result[pos + MAX_COMMAND_COUNT].value += (result[pos].command == 6) ? -MAX_COMMAND_COUNT : MAX_COMMAND_COUNT;
+      result[pos].count = MAX_COMMAND_COUNT;
+    }
+  for (next = pos = 0; pos < *size; pos ++)
+    if (pos == next)
+      next += result[pos].count;
+    else
+      result[pos].command = 7;
+  repack(&result, size);
+  return result;
+}
+
+struct command pick_command_for_pass (const unsigned char * data, const unsigned char * flipped, const unsigned char * reversed, const short * sources,
+                                      unsigned short length, unsigned short position, unsigned flags) {
+  struct command result = pick_repetition_for_pass(data, length, position, flags);
+  if (result.count >= MULTIPASS_SKIP_THRESHOLD) return result;
+  unsigned char p;
+  for (p = 0; p < 3; p ++) {
+    struct command temp = pick_copy_for_pass(data, p[(const unsigned char * []) {data, flipped, reversed}], sources, p + 4, length, position, flags);
+    if (temp.command == 7) continue;
+    if (temp.count > result.count) result = temp;
+  }
+  if ((result.command >= 4) && (result.value >= (position - LOOKBACK_LIMIT))) result.value -= position;
+  return result;
+}
+
+struct command pick_repetition_for_pass (const unsigned char * data, unsigned short length, unsigned short position, unsigned flags) {
+  unsigned short p;
+  if (data[position]) {
+    if ((position + 1) >= length) return (struct command) {.command = 1, .count = 1, .value = data[position]};
+    struct command result;
+    if (!(flags & 8) && (data[position] == data[position + 1]))
+      result = (struct command) {.command = 1, .value = data[position]};
+    else
+      result = (struct command) {.command = 2, .value = data[position] | (data[position + 1] << 8)};
+    for (p = 1; ((position + p) < length) && (p < LOOKAHEAD_LIMIT); p ++) if (data[position + p] != data[position + (p & 1)]) break;
+    result.count = p;
+    return result;
+  } else {
+    for (p = position + 1; (p < length) && (p < (position + LOOKAHEAD_LIMIT)); p ++) if (data[p]) break;
+    return (struct command) {.command = 3, .count = p - position};
+  }
+}
+
+struct command pick_copy_for_pass (const unsigned char * data, const unsigned char * reference, const short * sources, unsigned char command_type,
+                                   unsigned short length, unsigned short position, unsigned flags) {
+  struct command result = {.command = 7, .count = (flags & 4) ? 4 : 3};
+  if (length < 3) return result;
+  unsigned refpos, count;
+  const unsigned char * current;
+  unsigned char buffer[6] = {0};
+  memcpy(buffer, reference + length - 3, 3);
+  while (*sources >= 0) {
+    refpos = *(sources ++);
+    if (command_type == 6) refpos = length - 1 - refpos;
+    if (refpos >= (length - 3))
+      current = buffer + refpos - (length - 3);
+    else
+      current = reference + refpos;
+    if (memcmp(data + position, current, 4)) continue;
+    for (count = 4; (count < (length - position)) && (count < (length - refpos)); count ++) if (data[position + count] != current[count]) break;
+    if (count > (length - refpos)) count = length - refpos;
+    if (count > (length - position)) count = length - position;
+    if (result.count > count) continue;
+    result = (struct command) {.command = command_type, .count = count, .value = sources[-1]};
+  }
+  return result;
+}
--- /dev/null
+++ b/tools/lz/nullcomp.c
@@ -1,0 +1,20 @@
+#include "proto.h"
+
+/*
+   Null compressor: stores data uncompressed, using literal (0) commands only.
+   Methods defined: 2
+   Flags values: 0 = split a trailing 33-to-64-byte block at the end into two short blocks; 1 = don't
+*/
+
+struct command * store_uncompressed (__attribute__((unused)) const unsigned char * data, __attribute__((unused)) const unsigned char * bitflipped, unsigned short * size, unsigned flags) {
+  unsigned short position, block, remainder = *size;
+  struct command * result = NULL;
+  *size = 0;
+  for (position = 0; remainder; position += block, remainder -= block) {
+    block = (remainder > MAX_COMMAND_COUNT) ? MAX_COMMAND_COUNT : remainder;
+    if (!(flags & 1) && (block <= (2 * SHORT_COMMAND_COUNT)) && (block > SHORT_COMMAND_COUNT)) block = SHORT_COMMAND_COUNT;
+    result = realloc(result, sizeof(struct command) * (1 + *size));
+    result[(*size) ++] = (struct command) {.command = 0, .count = block, .value = position};
+  }
+  return result;
+}
--- /dev/null
+++ b/tools/lz/options.c
@@ -1,0 +1,141 @@
+#include "proto.h"
+
+struct options get_options (int argc, char ** argv) {
+  struct options result = {.input = NULL, .output = NULL, .mode = 0, .alignment = 0, .method = COMPRESSION_METHODS};
+  const char * program_name = *argv;
+  int compressor = -1;
+  if (argc == 1) usage(program_name);
+  for (argv ++; *argv; argv ++) {
+    if (**argv != '-') break;
+    if (!1[*argv]) break;
+    if (!strcmp(*argv, "--")) {
+      argv ++;
+      break;
+    } else if (!(strcmp(*argv, "--text") && strcmp(*argv, "-t")))
+      result.mode = 1;
+    else if (!(strcmp(*argv, "--binary") && strcmp(*argv, "-b")))
+      result.mode = 0;
+    else if (!(strcmp(*argv, "--uncompress") && strcmp(*argv, "-u")))
+      result.mode = 2;
+    else if (!(strcmp(*argv, "--dump") && strcmp(*argv, "-d")))
+      result.mode = 3;
+    else if (!(strcmp(*argv, "--align") && strncmp(*argv, "-a", 2)))
+      result.alignment = parse_numeric_option_argument(&argv, 12);
+    else if (!(strcmp(*argv, "--method") && strncmp(*argv, "-m", 2)))
+      result.method = parse_numeric_option_argument(&argv, COMPRESSION_METHODS - 1);
+    else if (!(strcmp(*argv, "--compressor") && strncmp(*argv, "-c", 2)))
+      compressor = parse_compressor_option_argument(&argv);
+    else if (!(strcmp(*argv, "--optimize") && strcmp(*argv, "-o"))) {
+      result.method = COMPRESSION_METHODS;
+      compressor = -1;
+    } else if (!(strcmp(*argv, "--help") && strcmp(*argv, "-?")))
+      usage(program_name);
+    else if (!(strcmp(*argv, "--list") && strcmp(*argv, "-l")))
+      list_compressors();
+    else
+      error_exit(3, "unknown option: %s", *argv);
+  }
+  if (compressor >= 0) {
+    if (result.method >= COMPRESSION_METHODS) result.method = 0;
+    if (result.method >= compressors[compressor].methods)
+      error_exit(3, "method for the %s compressor must be between 0 and %u", compressors[compressor].name, compressors[compressor].methods - 1);
+    while (compressor > 0) result.method += compressors[-- compressor].methods;
+  }
+  if (*argv) {
+    if (strcmp(*argv, "-")) result.input = *argv;
+    if (*(++ argv)) {
+      if (argv[1]) error_exit(3, "too many command-line arguments");
+      if (strcmp(*argv, "-")) result.output = *argv;
+    }
+  }
+  return result;
+}
+
+unsigned parse_numeric_option_argument (char *** alp, unsigned limit) {
+  const char * option;
+  const char * value = get_argument_for_option(alp, &option);
+  char * error;
+  unsigned long result = strtoul(value, &error, 10);
+  if (*error) error_exit(3, "invalid argument to option %s", option);
+  if (result > limit) error_exit(3, "argument to option %s must be between 0 and %u", option, limit);
+  return result;
+}
+
+int parse_compressor_option_argument (char *** alp) {
+  const char * name = get_argument_for_option(alp, NULL);
+  if (!strcmp(name, "*")) return -1;
+  int result = -1;
+  unsigned length = strlen(name);
+  const struct compressor * compressor;
+  for (compressor = compressors; compressor -> name; compressor ++) {
+    if (strncmp(name, compressor -> name, length)) continue;
+    if (result >= 0) error_exit(3, "ambiguous compressor prefix: %s", name);
+    result = compressor - compressors;
+  }
+  if (result < 0) error_exit(3, "unknown compressor: %s", name);
+  return result;
+}
+
+const char * get_argument_for_option (char *** alp, const char ** option_name) {
+  // alp: argument list pointer (i.e., address of the current value of argv after indexing)
+  // will point at the last consumed argument on exit (since the caller will probably increment it once more)
+  const char * option;
+  const char * result;
+  if (1[**alp] == '-') {
+    option = *((*alp) ++);
+    result = **alp;
+  } else {
+    option_name_buffer[1] = 1[**alp];
+    option = option_name_buffer;
+    result = **alp + 2;
+  }
+  if (!(result && *result)) error_exit(3, "option %s requires an argument", option);
+  if (option_name) *option_name = option;
+  return result;
+}
+
+noreturn usage (const char * program_name) {
+  fprintf(stderr, "Usage: %s [<options>] [<source file> [<output>]]\n\n", program_name);
+  fputs("Execution mode:\n", stderr);
+  fputs("    -b, --binary      Output the command stream as binary data (default).\n", stderr);
+  fputs("    -t, --text        Output the command stream as text.\n", stderr);
+  fputs("    -u, --uncompress  Process a compressed file and output the original data.\n", stderr);
+  fputs("    -d, --dump        Process a compressed file and dump the command stream as\n", stderr);
+  fputs("                      text (as if compressed with the --text option).\n", stderr);
+  fputs("    -l, --list        List compressors and their method numbers.\n", stderr);
+  fputs("    -?, --help        Print this help text and exit.\n", stderr);
+  fputs("Compression options:\n", stderr);
+  fputs("    -o, --optimize                 Use the best combination of compression\n", stderr);
+  fputs("                                   methods available (default).\n", stderr);
+  fputs("    -m<number>, --method <number>  Use only one specific compression method.\n", stderr);
+  fprintf(stderr, "                                   Valid method numbers are between 0 and %u.\n", COMPRESSION_METHODS - 1);
+  fputs("    -c<name>, --compressor <name>  Use the specified compressor: the method\n", stderr);
+  fputs("                                   number will be relative to that compressor.\n", stderr);
+  fputs("                                   Any prefix of the compressor name may be\n", stderr);
+  fputs("                                   specified. Use * to indicate any compressor.\n", stderr);
+  fputs("    -a<number>, --align <number>   Pad the compressed output with zeros until\n", stderr);
+  fputs("                                   the size has the specified number of low bits\n", stderr);
+  fputs("                                   cleared (default: 0).\n", stderr);
+  fputs("The source and output filenames can be given as - (or omitted) to use standard\n", stderr);
+  fputs("input and output. Use -- to indicate that subsequent arguments are file names.\n", stderr);
+  exit(3);
+}
+
+noreturn list_compressors (void) {
+  const struct compressor * compressor;
+  unsigned current, length = 10;
+  for (compressor = compressors; compressor -> name; compressor ++) if ((current = strlen(compressor -> name)) > length) length = current;
+  fprintf(stderr, "%-*s  Offset  Methods\n", length, "Compressor");
+  for (current = 0; current < length; current ++) putc('-', stderr);
+  fputs("  ------  -------\n", stderr);
+  current = 0;
+  for (compressor = compressors; compressor -> name; compressor ++) {
+    fprintf(stderr, "%-*s  %6u  %7u\n", length, compressor -> name, current, compressor -> methods);
+    current += compressor -> methods;
+  }
+  putc('\n', stderr);
+  fputs("Note: the offset indicates the compressor's lowest method number when the\n", stderr);
+  fputs("--compressor option is not given. When that option is used, every compressor's\n", stderr);
+  fputs("methods are numbered from zero.\n", stderr);
+  exit(3);
+}
--- /dev/null
+++ b/tools/lz/output.c
@@ -1,0 +1,138 @@
+#include "proto.h"
+
+void write_commands_to_textfile (const char * file, const struct command * commands, unsigned count, const unsigned char * input_stream,
+                                 unsigned char alignment) {
+  FILE * fp = file ? fopen(file, "w") : stdout;
+  if (!fp) error_exit(1, "could not open file %s for writing", file);
+  unsigned length = 0;
+  while (count --) {
+    write_command_to_textfile(fp, *commands, input_stream);
+    length += command_size(*(commands ++));
+  }
+  if (fputs("\tlzend\n", fp) < 0) error_exit(1, "could not write terminator to compressed output");
+  length = ~length & ((1 << alignment) - 1);
+  if (length --) {
+    int rv = fputs("\tdb 0", fp);
+    while ((rv >= 0) && length --) rv = fputs(", 0", fp);
+    if (rv >= 0) rv = -(putc('\n', fp) == EOF);
+    if (rv < 0) error_exit(1, "could not write padding to compressed output");
+  }
+  if (file) fclose(fp);
+}
+
+void write_commands_and_padding_to_textfile (const char * file, const struct command * commands, unsigned count, const unsigned char * input_stream,
+                                             unsigned padding_offset, unsigned padding_size) {
+  FILE * fp = file ? fopen(file, "w") : stdout;
+  if (!fp) error_exit(1, "could not open file %s for writing", file);
+  while (count --) write_command_to_textfile(fp, *(commands ++), input_stream);
+  if (fputs("\tlzend\n", fp) < 0) error_exit(1, "could not write terminator to compressed output");
+  if (padding_size) {
+    input_stream += padding_offset;
+    int rv = fprintf(fp, "\tdb $%02hhx", *(input_stream ++));
+    while ((rv >= 0) && (-- padding_size)) rv = fprintf(fp, ", $%02hhx", *(input_stream ++));
+    if (rv >= 0) rv = -(putc('\n', fp) == EOF);
+    if (rv < 0) error_exit(1, "could not write padding to compressed output");
+  }
+  if (file) fclose(fp);
+}
+
+void write_command_to_textfile (FILE * fp, struct command command, const unsigned char * input_stream) {
+  if ((!command.count) || (command.count > MAX_COMMAND_COUNT)) error_exit(2, "invalid command in output stream");
+  int rv, pos;
+  const char * kind;
+  switch (command.command) {
+    case 0:
+      if ((rv = fprintf(fp, "\tlzdata")) < 0) break;
+      for (pos = 0; pos < command.count; pos ++) if ((rv = fprintf(fp, "%s$%02hhx", pos ? ", " : " ", input_stream[command.value + pos])) < 0) break;
+      rv = putc('\n', fp);
+      break;
+    case 1:
+      if ((command.value < 0) || (command.value > 255)) error_exit(2, "invalid command in output stream");
+      rv = fprintf(fp, "\tlzrepeat %u, $%02hhx\n", command.count, (unsigned char) command.value);
+      break;
+    case 2:
+      if (command.value < 0) error_exit(2, "invalid command in output stream");
+      rv = fprintf(fp, "\tlzrepeat %u, $%02hhx, $%02hhx\n", command.count, (unsigned char) command.value, (unsigned char) (command.value >> 8));
+      break;
+    case 3:
+      rv = fprintf(fp, "\tlzzero %u\n", command.count);
+      break;
+    case 4:
+      kind = "normal";
+      goto copy;
+    case 5:
+      kind = "flipped";
+      goto copy;
+    case 6:
+      kind = "reversed";
+    copy:
+      if ((command.value < -LOOKBACK_LIMIT) || (command.value >= MAX_FILE_SIZE)) error_exit(2, "invalid command in output stream");
+      if (command.value < 0)
+        rv = fprintf(fp, "\tlzcopy %s, %u, %d\n", kind, command.count, command.value);
+      else
+        rv = fprintf(fp, "\tlzcopy %s, %u, $%04hx\n", kind, command.count, (unsigned short) command.value);
+      break;
+    default:
+      error_exit(2, "invalid command in output stream");
+  }
+  if (rv < 0) error_exit(1, "could not write command to compressed output");
+}
+
+void write_commands_to_file (const char * file, const struct command * commands, unsigned count, const unsigned char * input_stream, unsigned char alignment) {
+  FILE * fp = file ? fopen(file, "wb") : stdout;
+  if (!fp) error_exit(1, "could not open file %s for writing", file);
+  unsigned length = 0;
+  while (count --) {
+    write_command_to_file(fp, *commands, input_stream);
+    length += command_size(*(commands ++));
+  }
+  if (putc(-1, fp) == EOF) error_exit(1, "could not write terminator to compressed output");
+  length = ~length & ((1 << alignment) - 1);
+  while (length --) if (putc(0, fp) == EOF) error_exit(1, "could not write padding to compressed output");
+  if (file) fclose(fp);
+}
+
+void write_command_to_file (FILE * fp, struct command command, const unsigned char * input_stream) {
+  if ((!command.count) || (command.count > MAX_COMMAND_COUNT)) error_exit(2, "invalid command in output stream");
+  unsigned char buf[4];
+  unsigned char * pos = buf;
+  int n;
+  command.count --;
+  if (command.count < SHORT_COMMAND_COUNT)
+    *(pos ++) = (command.command << 5) + command.count;
+  else {
+    *(pos ++) = 224 + (command.command << 2) + (command.count >> 8);
+    *(pos ++) = command.count;
+  }
+  switch (command.command) {
+    case 1: case 2:
+      if ((command.value < 0) || (command.value >= (1 << (command.command << 3)))) error_exit(2, "invalid command in output stream");
+      for (n = 0; n < command.command; n ++) *(pos ++) = command.value >> (n << 3);
+    case 0: case 3:
+      break;
+    default:
+      if ((command.value < -LOOKBACK_LIMIT) || (command.value >= MAX_FILE_SIZE)) error_exit(2, "invalid command in output stream");
+      if (command.value < 0)
+        *(pos ++) = command.value ^ 127;
+      else {
+        *(pos ++) = command.value >> 8;
+        *(pos ++) = command.value;
+      }
+  }
+  if (fwrite(buf, 1, pos - buf, fp) != (pos - buf)) error_exit(1, "could not write command to compressed output");
+  if (command.command) return;
+  command.count ++;
+  if (fwrite(input_stream + command.value, 1, command.count, fp) != command.count) error_exit(1, "could not write data to compressed output");
+}
+
+void write_raw_data_to_file (const char * file, const void * data, unsigned length) {
+  FILE * fp = file ? fopen(file, "w") : stdout;
+  if (!fp) error_exit(1, "could not open file %s for writing", file);
+  while (length) {
+    unsigned rv = fwrite(data, 1, length, fp);
+    if (!rv) error_exit(1, "could not write raw data to output");
+    data = (const char *) data + rv;
+    length -= rv;
+  }
+  if (file) fclose(fp);
+}
--- /dev/null
+++ b/tools/lz/packing.c
@@ -1,0 +1,58 @@
+#include "proto.h"
+
+void optimize (struct command * commands, unsigned short count) {
+  while (count && (commands -> command == 7)) commands ++, count --;
+  if (count < 2) return;
+  struct command * end = commands + count;
+  struct command * next;
+  for (next = commands + 1; next < end; next ++) {
+    if (next -> command == 7) continue;
+    if (
+        !(commands -> command) &&
+        (command_size(*next) == next -> count) &&
+        ((commands -> count + next -> count) <= MAX_COMMAND_COUNT) &&
+        ((commands -> count > SHORT_COMMAND_COUNT) || ((commands -> count + next -> count) <= SHORT_COMMAND_COUNT))
+       ) {
+      commands -> count += next -> count;
+      next -> command = 7;
+      continue;
+    }
+    if (next -> command == commands -> command) {
+      switch (commands -> command) {
+        case 0:
+          if ((commands -> value + commands -> count) != next -> value) break;
+          commands -> count += next -> count;
+          next -> command = 7;
+          if (commands -> count <= MAX_COMMAND_COUNT) continue;
+          next -> command = 0;
+          next -> value = commands -> value + MAX_COMMAND_COUNT;
+          next -> count = commands -> count - MAX_COMMAND_COUNT;
+          commands -> count = MAX_COMMAND_COUNT;
+          break;
+        case 1:
+          if (commands -> value != next -> value) break;
+          // fallthrough
+        case 3:
+          if ((commands -> count + next -> count) <= MAX_COMMAND_COUNT) {
+            commands -> count += next -> count;
+            next -> command = 7;
+            continue;
+          }
+          next -> count = (commands -> count + next -> count) - MAX_COMMAND_COUNT;
+          commands -> count = MAX_COMMAND_COUNT;
+          break;
+      }
+    }
+    commands = next;
+  }
+}
+
+void repack (struct command ** commands, unsigned short * length) {
+  struct command * new_commands = malloc(sizeof(struct command) * *length);
+  struct command * current = new_commands;
+  unsigned short p;
+  for (p = 0; p < *length; p ++) if (p[*commands].command != 7) *(current ++) = p[*commands];
+  free(*commands);
+  *commands = new_commands;
+  *length = current - new_commands;
+}
--- /dev/null
+++ b/tools/lz/proto.h
@@ -1,0 +1,105 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+
+#define COMPRESSION_METHODS         96 /* sum of all values for the methods field in compressors */
+#define MAX_FILE_SIZE            32768
+#define SHORT_COMMAND_COUNT         32
+#define MAX_COMMAND_COUNT         1024
+#define LOOKBACK_LIMIT             128 /* highest negative valid count for a copy command */
+#define LOOKAHEAD_LIMIT           3072 /* maximum lookahead distance for the first pass of multi-pass compression */
+#define MULTIPASS_SKIP_THRESHOLD    64
+
+#if __STDC_VERSION__ >= 201112L
+	// <noreturn.h> forces "noreturn void", which is silly and redundant; this is simpler
+	#define noreturn _Noreturn void
+#else
+	#define noreturn void /* fallback */
+#endif
+
+struct command {
+  unsigned command: 3; // commands 0-6 as per compression spec; command 7 is used as a dummy placeholder
+  unsigned count:  12; // always equals the uncompressed data length
+  signed value:    17; // offset for commands 0 (into source) and 4-6 (into decompressed output); repeated bytes for commands 1-2
+};
+
+struct compressor {
+  unsigned methods;
+  const char * name;
+  struct command * (* function) (const unsigned char *, const unsigned char *, unsigned short *, unsigned);
+};
+
+struct options {
+  const char * input;
+  const char * output;
+  unsigned method; // method to use, or >= COMPRESSION_METHODS to try them all
+  unsigned char mode; // 0: compress, 1: compress to text, 2: uncompress, 3: dump commands as text
+  unsigned char alignment; // 1 << value
+};
+
+// global.c
+extern const struct compressor compressors[];
+extern const unsigned char bit_flipping_table[];
+extern char option_name_buffer[];
+
+// main.c
+int main(int, char **);
+struct command * compress(const unsigned char *, unsigned short *, unsigned);
+
+// merging.c
+struct command * select_command_sequence(struct command **, const unsigned short *, unsigned, unsigned short *);
+struct command * merge_command_sequences(const struct command *, unsigned short, const struct command *, unsigned short, unsigned short *);
+
+// mpcomp.c
+struct command * try_compress_multi_pass(const unsigned char *, const unsigned char *, unsigned short *, unsigned);
+struct command pick_command_for_pass(const unsigned char *, const unsigned char *, const unsigned char *, const short *, unsigned short,
+                                     unsigned short, unsigned);
+struct command pick_repetition_for_pass(const unsigned char *, unsigned short, unsigned short, unsigned);
+struct command pick_copy_for_pass(const unsigned char *, const unsigned char *, const short *, unsigned char, unsigned short, unsigned short, unsigned);
+
+// nullcomp.c
+struct command * store_uncompressed(const unsigned char *, const unsigned char *, unsigned short *, unsigned);
+
+// options.c
+struct options get_options(int, char **);
+unsigned parse_numeric_option_argument(char ***, unsigned);
+int parse_compressor_option_argument(char ***);
+const char * get_argument_for_option(char ***, const char **);
+noreturn usage(const char *);
+noreturn list_compressors(void);
+
+// output.c
+void write_commands_to_textfile(const char *, const struct command *, unsigned, const unsigned char *, unsigned char);
+void write_commands_and_padding_to_textfile(const char *, const struct command *, unsigned, const unsigned char *, unsigned, unsigned);
+void write_command_to_textfile(FILE *, struct command, const unsigned char *);
+void write_commands_to_file(const char *, const struct command *, unsigned, const unsigned char *, unsigned char);
+void write_command_to_file(FILE *, struct command, const unsigned char *);
+void write_raw_data_to_file(const char *, const void *, unsigned);
+
+// packing.c
+void optimize(struct command *, unsigned short);
+void repack(struct command **, unsigned short *);
+
+// repcomp.c
+struct command * try_compress_repetitions(const unsigned char *, const unsigned char *, unsigned short *, unsigned);
+struct command find_repetition_at_position(const unsigned char *, unsigned short, unsigned short);
+
+// spcomp.c
+struct command * try_compress_single_pass(const unsigned char *, const unsigned char *, unsigned short *, unsigned);
+struct command find_best_copy(const unsigned char *, unsigned short, unsigned short, const unsigned char *, unsigned);
+unsigned short scan_forwards(const unsigned char *, unsigned short, const unsigned char *, unsigned short, short *);
+unsigned short scan_backwards(const unsigned char *, unsigned short, unsigned short, short *);
+struct command find_best_repetition(const unsigned char *, unsigned short, unsigned short);
+
+// uncomp.c
+struct command * get_commands_from_file(const unsigned char *, unsigned short * restrict, unsigned short * restrict);
+unsigned char * get_uncompressed_data(const struct command *, const unsigned char *, unsigned short *);
+
+// util.c
+noreturn error_exit(int, const char *, ...);
+unsigned char * read_file_into_buffer(const char *, unsigned short *);
+struct command pick_best_command(unsigned, struct command, ...);
+int is_better(struct command, struct command);
+short command_size(struct command);
+unsigned short compressed_length(const struct command *, unsigned short);
--- /dev/null
+++ b/tools/lz/repcomp.c
@@ -1,0 +1,63 @@
+#include "proto.h"
+
+/*
+   Repetitions compressor: compresses the data only using a subset of the available repetition commands.
+   Methods defined: 6
+   Flags values: the value plus one is taken as a bitfield indicating which kinds of repetition commands are used
+                 (lowest bit to highest: repeat single byte (1), repeat two bytes (2), repeat zeros (3)).
+*/
+
+struct command * try_compress_repetitions (const unsigned char * data, __attribute__((unused)) const unsigned char * bitflipped, unsigned short * size, unsigned flags) {
+  unsigned short pos = 0, skipped = 0;
+  struct command * result = malloc(*size * sizeof(struct command));
+  struct command * current = result;
+  struct command candidate;
+  flags = (flags + 1) << 1;
+  while (pos < *size) {
+    candidate = find_repetition_at_position(data, pos, *size);
+    if ((candidate.command == 3) && !(flags & 8)) {
+      candidate.command = 1;
+      candidate.value = 0;
+    }
+    if ((candidate.command == 1) && !(flags & 2)) {
+      candidate.command = 2;
+      candidate.value |= candidate.value << 8;
+    }
+    if ((flags & (1 << candidate.command)) && (command_size(candidate) <= candidate.count)) {
+      if (skipped) *(current ++) = (struct command) {.command = 0, .count = skipped, .value = pos - skipped};
+      skipped = 0;
+      *(current ++) = candidate;
+      pos += candidate.count;
+    } else {
+      pos ++;
+      if ((++ skipped) == MAX_COMMAND_COUNT) {
+        *(current ++) = (struct command) {.command = 0, .count = MAX_COMMAND_COUNT, .value = pos - MAX_COMMAND_COUNT};
+        skipped = 0;
+      }
+    }
+  }
+  if (skipped) *(current ++) = (struct command) {.command = 0, .count = skipped, .value = pos - skipped};
+  *size = current - result;
+  result = realloc(result, *size * sizeof(struct command));
+  return result;
+}
+
+struct command find_repetition_at_position (const unsigned char * data, unsigned short position, unsigned short length) {
+  if ((position + 1) >= length) return data[position] ? ((struct command) {.command = 7}) : ((struct command) {.command = 3, .count = 1});
+  unsigned char value[2] = {data[position], data[position + 1]};
+  unsigned repcount, limit = length - position;
+  if (limit > MAX_COMMAND_COUNT) limit = MAX_COMMAND_COUNT;
+  for (repcount = 2; (repcount < limit) && (data[position + repcount] == value[repcount & 1]); repcount ++);
+  struct command result;
+  result.count = repcount;
+  if (*value != value[1]) {
+    if (!*value && (repcount < 3)) return (struct command) {.command = 3, .count = 1};
+    result.command = 2;
+    result.value = ((unsigned) (*value)) | (((unsigned) (value[1])) << 8);
+  } else if (*value) {
+    result.command = 1;
+    result.value = *value;
+  } else
+    result.command = 3;
+  return result;
+}
--- /dev/null
+++ b/tools/lz/spcomp.c
@@ -1,0 +1,141 @@
+#include "proto.h"
+
+/*
+   Single-pass compressor: attempts to compress the data in a single pass, selecting the best command at each
+                           position within some constraints.
+   Methods defined: 72
+   Flags values:
+     Bit fields (will trigger alternate behavior if set):
+     1: prefer repetition commands over copy commands of equal count
+     2: don't emit a copy or repetition with a count equal to its size when the previous command is a literal (0) that
+        is not at maximum size (32 or 1024)
+     4: don't emit long copy commands
+     Selector values (pick one from each group and add them to the bit fields):
+     - Scan delay: number of bytes that are forced into literal (0) commands after each non-literal command:
+       0: 0 bytes
+       8: 1 byte
+       16: 2 bytes
+     - Copy command preference (when the command counts are tied), in order from most to least:
+       0: normal (4), reversed (6), flipped (5)
+       24: reversed (6), flipped (5), normal (4)
+       48: flipped (5), reversed (6), normal (4)
+*/
+
+struct command * try_compress_single_pass (const unsigned char * data, const unsigned char * bitflipped, unsigned short * length, unsigned flags) {
+  struct command * commands = malloc(sizeof(struct command) * *length);
+  memset(commands, -1, sizeof(struct command) * *length);
+  struct command * current_command = commands;
+  unsigned short position = 0, previous_data = 0;
+  unsigned char scan_delay = 0, scan_delay_flag = (flags >> 3) % 3;
+  struct command copy, repetition;
+  while (position < *length) {
+    copy = find_best_copy(data, position, *length, bitflipped, flags);
+    repetition = find_best_repetition(data, position, *length);
+    if (flags & 1)
+      *current_command = pick_best_command(2, repetition, copy);
+    else
+      *current_command = pick_best_command(2, copy, repetition);
+    *current_command = pick_best_command(2, (struct command) {.command = 0, .count = 1, .value = position}, *current_command);
+    if ((flags & 2) && (command_size(*current_command) == current_command -> count))
+      if (previous_data && (previous_data != SHORT_COMMAND_COUNT) && (previous_data != MAX_COMMAND_COUNT))
+        *current_command = (struct command) {.command = 0, .count = 1, .value = position};
+    if (scan_delay_flag) {
+      if (scan_delay >= scan_delay_flag)
+        scan_delay = 0;
+      else if (current_command -> command) {
+        scan_delay ++;
+        *current_command = (struct command) {.command = 0, .count = 1, .value = position};
+      }
+    }
+    if (current_command -> command)
+      previous_data = 0;
+    else
+      previous_data += current_command -> count;
+    position += (current_command ++) -> count;
+  }
+  optimize(commands, current_command - commands);
+  repack(&commands, length);
+  return commands;
+}
+
+struct command find_best_copy (const unsigned char * data, unsigned short position, unsigned short length, const unsigned char * bitflipped, unsigned flags) {
+  struct command simple = {.command = 7};
+  struct command flipped = simple, backwards = simple;
+  short count, offset;
+  if ((count = scan_forwards(data + position, length - position, data, position, &offset)))
+    simple = (struct command) {.command = 4, .count = count, .value = offset};
+  if ((count = scan_forwards(data + position, length - position, bitflipped, position, &offset)))
+    flipped = (struct command) {.command = 5, .count = count, .value = offset};
+  if ((count = scan_backwards(data, length - position, position, &offset)))
+    backwards = (struct command) {.command = 6, .count = count, .value = offset};
+  struct command command;
+  switch (flags / 24) {
+    case 0: command = pick_best_command(3, simple, backwards, flipped); break;
+    case 1: command = pick_best_command(3, backwards, flipped, simple); break;
+    case 2: command = pick_best_command(3, flipped, backwards, simple);
+  }
+  if ((flags & 4) && (command.count > SHORT_COMMAND_COUNT)) command.count = SHORT_COMMAND_COUNT;
+  return command;
+}
+
+unsigned short scan_forwards (const unsigned char * target, unsigned short limit, const unsigned char * source, unsigned short real_position, short * offset) {
+  unsigned short best_match, best_length = 0;
+  unsigned short current_length;
+  unsigned short position;
+  for (position = 0; position < real_position; position ++) {
+    if (source[position] != *target) continue;
+    for (current_length = 0; (current_length < limit) && (source[position + current_length] == target[current_length]); current_length ++);
+    if (current_length > MAX_COMMAND_COUNT) current_length = MAX_COMMAND_COUNT;
+    if (current_length < best_length) continue;
+    best_match = position;
+    best_length = current_length;
+  }
+  if (!best_length) return 0;
+  if ((best_match + LOOKBACK_LIMIT) >= real_position)
+    *offset = best_match - real_position;
+  else
+    *offset = best_match;
+  return best_length;
+}
+
+unsigned short scan_backwards (const unsigned char * data, unsigned short limit, unsigned short real_position, short * offset) {
+  if (real_position < limit) limit = real_position;
+  unsigned short best_match, best_length = 0;
+  unsigned short current_length;
+  unsigned short position;
+  for (position = 0; position < real_position; position ++) {
+    if (data[position] != data[real_position]) continue;
+    for (current_length = 0; (current_length <= position) && (current_length < limit) &&
+                             (data[position - current_length] == data[real_position + current_length]); current_length ++);
+    if (current_length > MAX_COMMAND_COUNT) current_length = MAX_COMMAND_COUNT;
+    if (current_length < best_length) continue;
+    best_match = position;
+    best_length = current_length;
+  }
+  if (!best_length) return 0;
+  if ((best_match + LOOKBACK_LIMIT) >= real_position)
+    *offset = best_match - real_position;
+  else
+    *offset = best_match;
+  return best_length;
+}
+
+struct command find_best_repetition (const unsigned char * data, unsigned short position, unsigned short length) {
+  if ((position + 1) >= length) return data[position] ? ((struct command) {.command = 7}) : ((struct command) {.command = 3, .count = 1});
+  unsigned char value[2] = {data[position], data[position + 1]};
+  unsigned repcount, limit = length - position;
+  if (limit > MAX_COMMAND_COUNT) limit = MAX_COMMAND_COUNT;
+  for (repcount = 2; (repcount < limit) && (data[position + repcount] == value[repcount & 1]); repcount ++);
+  struct command result;
+  result.count = repcount;
+  if (*value != value[1]) {
+    if (!*value && (repcount < 3)) return (struct command) {.command = 3, .count = 1};
+    result.command = 2;
+    result.value = ((unsigned) (*value)) | (((unsigned) (value[1])) << 8);
+  } else if (*value) {
+    result.command = 1;
+    result.value = *value;
+  } else
+    result.command = 3;
+  return result;
+}
--- /dev/null
+++ b/tools/lz/uncomp.c
@@ -1,0 +1,92 @@
+#include "proto.h"
+
+struct command * get_commands_from_file (const unsigned char * data, unsigned short * restrict size, unsigned short * restrict slack) {
+  struct command * result = malloc(*size * sizeof(struct command));
+  unsigned short remaining = *size;
+  struct command * current = result;
+  const unsigned char * rp = data;
+  while (1) {
+    if (!(remaining --)) goto error;
+    current -> command = *rp >> 5;
+    current -> count = *(rp ++) & 31;
+    if (current -> command == 7) {
+      current -> command = current -> count >> 2;
+      current -> count = (current -> count & 3) << 8;
+      if (current -> command == 7) {
+        // long commands inside long commands are not allowed, but if the count is 0x300 here, it means that the original byte was 0xff
+        if (current -> count == 0x300) break;
+        goto error;
+      }
+      if (!(remaining --)) goto error;
+      current -> count |= *(rp ++);
+    }
+    current -> count ++;
+    switch (current -> command) {
+      case 0:
+        if (remaining <= current -> count) goto error;
+        current -> value = rp - data;
+        rp += current -> count;
+        remaining -= current -> count;
+      case 3:
+        break;
+      case 1: case 2: {
+        unsigned char p;
+        if (remaining <= current -> command) goto error;
+        current -> value = 0;
+        for (p = 0; p < current -> command; p ++) current -> value |= *(rp ++) << (p << 3);
+        remaining -= current -> command;
+      } break;
+      default:
+        if (!(remaining --)) goto error;
+        if ((current -> value = *(rp ++)) & 128)
+          current -> value = 127 - current -> value;
+        else {
+          if (!(remaining --)) goto error;
+          current -> value = (current -> value << 8) | *(rp ++);
+        }
+    }
+    current ++;
+  }
+  if (slack) *slack = *size - (rp - data);
+  *size = current - result;
+  return realloc(result, *size * sizeof(struct command));
+  error:
+  free(result);
+  return NULL;
+}
+
+unsigned char * get_uncompressed_data (const struct command * commands, const unsigned char * compressed, unsigned short * size) {
+  const struct command * limit = commands + *size;
+  unsigned char * result = malloc(MAX_FILE_SIZE + MAX_COMMAND_COUNT);
+  unsigned char * current = result;
+  unsigned short p;
+  for (; commands < limit; commands ++) {
+    switch (commands -> command) {
+      case 0:
+        memcpy(current, compressed + commands -> value, commands -> count);
+        current += commands -> count;
+        break;
+      case 1: case 2:
+        for (p = 0; p < commands -> count; p ++) *(current ++) = commands -> value >> ((p % commands -> command) << 3);
+        break;
+      case 3:
+        memset(current, 0, commands -> count);
+        current += commands -> count;
+        break;
+      default: {
+        const unsigned char * ref = ((commands -> value < 0) ? current : result) + commands -> value;
+        for (p = 0; p < commands -> count; p ++) {
+          current[p] = ref[(commands -> command == 6) ? -(int) p : p];
+          if (commands -> command == 5) current[p] = bit_flipping_table[current[p]];
+        }
+        current += commands -> count;
+      }
+    }
+    if ((current - result) > MAX_FILE_SIZE) {
+      free(result);
+      return NULL;
+    }
+  }
+  *size = current - result;
+  return result;
+}
--- /dev/null
+++ b/tools/lz/util.c
@@ -1,0 +1,54 @@
+#include "proto.h"
+
+noreturn error_exit (int error_code, const char * error, ...) {
+  va_list ap;
+  va_start(ap, error);
+  fputs("error: ", stderr);
+  vfprintf(stderr, error, ap);
+  va_end(ap);
+  fputc('\n', stderr);
+  exit(error_code);
+}
+
+unsigned char * read_file_into_buffer (const char * file, unsigned short * size) {
+  FILE * fp = file ? fopen(file, "rb") : stdin;
+  if (!fp) error_exit(1, "could not open file %s for reading", file);
+  unsigned char * buf = malloc(MAX_FILE_SIZE + 1);
+  int rv = fread(buf, 1, MAX_FILE_SIZE + 1, fp);
+  if (file) fclose(fp);
+  if (rv < 0) error_exit(1, "could not read from file %s", file);
+  if (rv > MAX_FILE_SIZE) error_exit(1, "file %s is too big", file ? file : "<standard input>");
+  *size = rv;
+  return buf;
+}
+
+struct command pick_best_command (unsigned count, struct command command, ...) {
+  struct command result = command;
+  va_list ap;
+  va_start(ap, command);
+  while (-- count) {
+    command = va_arg(ap, struct command);
+    if (is_better(command, result)) result = command;
+  }
+  va_end(ap);
+  return result;
+}
+
+int is_better (struct command new, struct command old) {
+  if (new.command == 7) return 0;
+  if (old.command == 7) return 1;
+  short new_savings = new.count - command_size(new), old_savings = old.count - command_size(old);
+  return new_savings > old_savings;
+}
+
+short command_size (struct command command) {
+  short header_size = 1 + (command.count > SHORT_COMMAND_COUNT);
+  if (command.command & 4) return header_size + 1 + (command.value >= 0);
+  return header_size + command.command[(short []) {command.count, 1, 2, 0}];
+}
+
+unsigned short compressed_length (const struct command * commands, unsigned short count) {
+  unsigned short current, total = 0;
+  for (current = 0; current < count; current ++) if (commands[current].command != 7) total += command_size(commands[current]);
+  return total;
+}
--- a/tools/lzcomp.c
+++ /dev/null
@@ -1,512 +1,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-
-#define COMPRESSION_METHODS 72
-
-struct command {
-  unsigned command: 3;
-  unsigned count:  12;
-  signed value:    17;
-};
-
-struct options {
-  const char * input;
-  const char * output;
-  unsigned char mode;
-};
-
-int main(int, char **);
-struct options get_options(char **);
-void usage(const char *);
-void error_exit(int, const char *, ...);
-void bit_flip(const unsigned char *, unsigned short, unsigned char *);
-unsigned char * read_file_into_buffer(const char *, unsigned short *);
-void write_commands_to_textfile(const char *, const struct command *, unsigned, const unsigned char *);
-void write_command_to_textfile(FILE *, struct command, const unsigned char *);
-void write_commands_to_file(const char *, const struct command *, unsigned, const unsigned char *);
-void write_command_to_file(FILE *, struct command, const unsigned char *);
-struct command * compress(const unsigned char *, unsigned short *);
-struct command * store_uncompressed(unsigned short *);
-struct command * try_compress(const unsigned char *, const unsigned char *, unsigned short *, unsigned);
-struct command find_best_copy(const unsigned char *, unsigned short, unsigned short, const unsigned char *, unsigned);
-unsigned short scan_forwards(const unsigned char *, unsigned short, const unsigned char *, unsigned short, short *);
-unsigned short scan_backwards(const unsigned char *, unsigned short, unsigned short, short *);
-struct command find_best_repetition(const unsigned char *, unsigned short, unsigned short);
-struct command pick_best_command(unsigned, struct command, ...);
-int is_better(struct command, struct command);
-short command_size(struct command);
-void optimize(struct command *, unsigned short);
-void repack(struct command **, unsigned short *);
-struct command * select_command_sequence(struct command **, const unsigned short *, unsigned, unsigned short *);
-struct command * merge_command_sequences(const struct command *, unsigned short, const struct command *, unsigned short, unsigned short *);
-unsigned short compressed_length(const struct command *, unsigned short);
-
-int main (int argc __attribute__((unused)), char ** argv) {
-  struct options options = get_options(argv);
-  unsigned short size;
-  unsigned char * file_buffer = read_file_into_buffer(options.input, &size);
-  struct command * compressed = compress(file_buffer, &size);
-  if (options.mode)
-    write_commands_to_textfile(options.output, compressed, size, file_buffer);
-  else
-    write_commands_to_file(options.output, compressed, size, file_buffer);
-  free(file_buffer);
-  free(compressed);
-  return 0;
-}
-
-struct options get_options (char ** argv) {
-  struct options result = {.input = NULL, .output = NULL, .mode = 0};
-  const char * program_name = *argv;
-  for (argv ++; *argv; argv ++) {
-    if (strncmp(*argv, "--", 2)) break;
-    if (!strcmp(*argv, "--")) {
-      argv ++;
-      break;
-    } else if (!strcmp(*argv, "--text"))
-      result.mode = 1;
-    else if (!strcmp(*argv, "--binary"))
-      result.mode = 0;
-    else
-      error_exit(3, "unknown option: %s", *argv);
-  }
-  if (!*argv) usage(program_name);
-  result.input = *argv;
-  result.output = argv[1];
-  return result;
-}
-
-void usage (const char * program_name) {
-  fprintf(stderr, "Usage: %s [<options>] <source file> [<compressed output>]\n\n", program_name);
-  fputs("Options:\n", stderr);
-  fputs("    --text    Output the command stream as text.\n", stderr);
-  fputs("    --binary  Output the command stream as binary data (default).\n", stderr);
-  fputs("    --        End of option list.\n", stderr);
-  exit(3);
-}
-
-void error_exit (int error_code, const char * error, ...) {
-  va_list ap;
-  va_start(ap, error);
-  fputs("error: ", stderr);
-  vfprintf(stderr, error, ap);
-  fputc('\n', stderr);
-  exit(error_code);
-}
-
-void bit_flip (const unsigned char * data, unsigned short length, unsigned char * result) {
-  unsigned char new_value, pos;
-  while (length --) {
-    new_value = 0;
-    for (pos = 0; pos < 8; pos ++) new_value |= ((*data >> pos) & 1) << (7 - pos);
-    *(result ++) = new_value;
-    data ++;
-  }
-}
-
-unsigned char * read_file_into_buffer (const char * file, unsigned short * size) {
-  FILE * fp = fopen(file, "rb");
-  if (!fp) error_exit(1, "could not open file %s for reading", file);
-  unsigned char * buf = malloc(32769);
-  int rv = fread(buf, 1, 32769, fp);
-  fclose(fp);
-  if (rv < 0) error_exit(1, "could not read from file %s", file);
-  if (rv > 32768) error_exit(1, "file %s is too big", file);
-  *size = rv;
-  return buf;
-}
-
-void write_commands_to_textfile (const char * file, const struct command * commands, unsigned count, const unsigned char * input_stream) {
-  FILE * fp = file ? fopen(file, "w") : stdout;
-  if (!fp) error_exit(1, "could not open file %s for writing", file);
-  while (count --) write_command_to_textfile(fp, *(commands ++), input_stream);
-  if (fputs("\tlzend\n", fp) < 0) error_exit(1, "could not write terminator to compressed output");
-  if (file) fclose(fp);
-}
-
-void write_command_to_textfile (FILE * fp, struct command command, const unsigned char * input_stream) {
-  if ((!command.count) || (command.count > 1024)) error_exit(2, "invalid command in output stream");
-  int rv = -1, pos;
-  const char * kind;
-  switch (command.command) {
-    case 0:
-      if ((rv = fprintf(fp, "\tlzdata")) < 0) break;
-      for (pos = 0; pos < command.count; pos ++) if ((rv = fprintf(fp, "%s$%02hhx", pos ? ", " : " ", input_stream[command.value + pos])) < 0) break;
-      rv = putc('\n', fp);
-      break;
-    case 1:
-      if ((command.value < 0) || (command.value > 255)) error_exit(2, "invalid command in output stream");
-      rv = fprintf(fp, "\tlzrepeat %u, $%02hhx\n", command.count, (unsigned char) command.value);
-      break;
-    case 2:
-      if (command.value < 0) error_exit(2, "invalid command in output stream");
-      rv = fprintf(fp, "\tlzrepeat %u, $%02hhx, $%02hhx\n", command.count, (unsigned char) command.value, (unsigned char) (command.value >> 8));
-      break;
-    case 3:
-      rv = fprintf(fp, "\tlzzero %u\n", command.count);
-      break;
-    case 4:
-      kind = "normal";
-      goto copy;
-    case 5:
-      kind = "flipped";
-      goto copy;
-    case 6:
-      kind = "reversed";
-    copy:
-      if ((command.value < -128) || (command.value > 32767)) error_exit(2, "invalid command in output stream");
-      if (command.value < 0)
-        rv = fprintf(fp, "\tlzcopy %s, %u, %d\n", kind, command.count, command.value);
-      else
-        rv = fprintf(fp, "\tlzcopy %s, %u, $%04hx\n", kind, command.count, (unsigned short) command.value);
-      break;
-    default:
-      error_exit(2, "invalid command in output stream");
-  }
-  if (rv < 0) error_exit(1, "could not write command to compressed output");
-}
-
-void write_commands_to_file (const char * file, const struct command * commands, unsigned count, const unsigned char * input_stream) {
-  FILE * fp = file ? fopen(file, "wb") : stdout;
-  if (!fp) error_exit(1, "could not open file %s for writing", file);
-  while (count --) write_command_to_file(fp, *(commands ++), input_stream);
-  unsigned char terminator = -1;
-  if (fwrite(&terminator, 1, 1, fp) != 1) error_exit(1, "could not write terminator to compressed output");
-  if (file) fclose(fp);
-}
-
-void write_command_to_file (FILE * fp, struct command command, const unsigned char * input_stream) {
-  if ((!command.count) || (command.count > 1024)) error_exit(2, "invalid command in output stream");
-  unsigned char buf[4];
-  unsigned char * pos = buf;
-  int n;
-  command.count --;
-  if (command.count < 32)
-    *(pos ++) = (command.command << 5) + command.count;
-  else {
-    *(pos ++) = 224 + (command.command << 2) + (command.count >> 8);
-    *(pos ++) = command.count;
-  }
-  switch (command.command) {
-    case 1: case 2:
-      if ((command.value < 0) || (command.value >= (1 << (command.command << 3)))) error_exit(2, "invalid command in output stream");
-      for (n = 0; n < command.command; n ++) *(pos ++) = command.value >> (n << 3);
-    case 0: case 3:
-      break;
-    default:
-      if ((command.value < -128) || (command.value > 32767)) error_exit(2, "invalid command in output stream");
-      if (command.value < 0)
-        *(pos ++) = command.value ^ 127;
-      else {
-        *(pos ++) = command.value >> 8;
-        *(pos ++) = command.value;
-      }
-  }
-  if (fwrite(buf, 1, pos - buf, fp) != (size_t)(pos - buf)) error_exit(1, "could not write command to compressed output");
-  if (command.command) return;
-  command.count ++;
-  if (fwrite(input_stream + command.value, 1, command.count, fp) != command.count) error_exit(1, "could not write data to compressed output");
-}
-
-struct command * compress (const unsigned char * data, unsigned short * size) {
-  unsigned char * bitflipped = malloc(*size);
-  bit_flip(data, *size, bitflipped);
-  struct command * compressed_sequences[COMPRESSION_METHODS + 1];
-  unsigned short lengths[COMPRESSION_METHODS + 1];
-  unsigned current;
-  for (current = 0; current < COMPRESSION_METHODS; current ++) {
-    lengths[current] = *size;
-    compressed_sequences[current] = try_compress(data, bitflipped, lengths + current, current);
-  }
-  free(bitflipped);
-  lengths[COMPRESSION_METHODS] = *size;
-  compressed_sequences[COMPRESSION_METHODS] = store_uncompressed(lengths + COMPRESSION_METHODS);
-  struct command * result = select_command_sequence(compressed_sequences, lengths, COMPRESSION_METHODS + 1, size);
-  for (current = 0; current <= COMPRESSION_METHODS; current ++) free(compressed_sequences[current]);
-  return result;
-}
-
-struct command * store_uncompressed (unsigned short * size) {
-  unsigned short position, block, remainder = *size;
-  struct command * result = NULL;
-  *size = 0;
-  for (position = 0; remainder; position += block, remainder -= block) {
-    block = (remainder > 1024) ? 1024 : remainder;
-    if ((block <= 64) && (block > 32)) block = 32;
-    result = realloc(result, sizeof(struct command) * (1 + *size));
-    result[(*size) ++] = (struct command) {.command = 0, .count = block, .value = position};
-  }
-  return result;
-}
-
-struct command * try_compress (const unsigned char * data, const unsigned char * bitflipped, unsigned short * length, unsigned flags) {
-  struct command * commands = malloc(sizeof(struct command) * *length);
-  memset(commands, -1, sizeof(struct command) * *length);
-  struct command * current_command = commands;
-  unsigned short position = 0, previous_data = 0;
-  unsigned char lookahead = 0, lookahead_flag = (flags >> 3) % 3;
-  struct command copy, repetition;
-  while (position < *length) {
-    copy = find_best_copy(data, position, *length, bitflipped, flags);
-    repetition = find_best_repetition(data, position, *length);
-    if (flags & 1)
-      *current_command = pick_best_command(2, repetition, copy);
-    else
-      *current_command = pick_best_command(2, copy, repetition);
-    *current_command = pick_best_command(2, (struct command) {.command = 0, .count = 1, .value = position}, *current_command);
-    if (flags & 2) {
-      if (previous_data && (previous_data != 32) && (previous_data != 1024) && (command_size(*current_command) == current_command -> count))
-        *current_command = (struct command) {.command = 0, .count = 1, .value = position};
-    }
-    if (lookahead_flag) {
-      if (lookahead >= lookahead_flag)
-        lookahead = 0;
-      else if (current_command -> command) {
-        lookahead ++;
-        *current_command = (struct command) {.command = 0, .count = 1, .value = position};
-      }
-    }
-    if (current_command -> command)
-      previous_data = 0;
-    else
-      previous_data += current_command -> count;
-    position += (current_command ++) -> count;
-  }
-  optimize(commands, current_command - commands);
-  repack(&commands, length);
-  return commands;
-}
-
-struct command find_best_copy (const unsigned char * data, unsigned short position, unsigned short length, const unsigned char * bitflipped, unsigned flags) {
-  struct command simple = {.command = 7};
-  struct command flipped = simple, backwards = simple;
-  short count, offset;
-  if ((count = scan_forwards(data + position, length - position, data, position, &offset)))
-    simple = (struct command) {.command = 4, .count = count, .value = offset};
-  if ((count = scan_forwards(data + position, length - position, bitflipped, position, &offset)))
-    flipped = (struct command) {.command = 5, .count = count, .value = offset};
-  if ((count = scan_backwards(data, length - position, position, &offset)))
-    backwards = (struct command) {.command = 6, .count = count, .value = offset};
-  struct command command;
-  switch (flags / 24) {
-    case 0: command = pick_best_command(3, simple, backwards, flipped); break;
-    case 1: command = pick_best_command(3, backwards, flipped, simple); break;
-    case 2: command = pick_best_command(3, flipped, backwards, simple);
-  }
-  if ((flags & 4) && (command.count > 32)) command.count = 32;
-  return command;
-}
-
-unsigned short scan_forwards (const unsigned char * target, unsigned short limit, const unsigned char * source, unsigned short real_position, short * offset) {
-  unsigned short best_match, best_length = 0;
-  unsigned short current_length;
-  unsigned short position;
-  for (position = 0; position < real_position; position ++) {
-    if (source[position] != *target) continue;
-    for (current_length = 0; (current_length < limit) && (source[position + current_length] == target[current_length]); current_length ++);
-    if (current_length > 1024) current_length = 1024;
-    if (current_length < best_length) continue;
-    best_match = position;
-    best_length = current_length;
-  }
-  if (!best_length) return 0;
-  if ((best_match + 128) >= real_position)
-    *offset = best_match - real_position;
-  else
-    *offset = best_match;
-  return best_length;
-}
-
-unsigned short scan_backwards (const unsigned char * data, unsigned short limit, unsigned short real_position, short * offset) {
-  if (real_position < limit) limit = real_position;
-  unsigned short best_match, best_length = 0;
-  unsigned short current_length;
-  unsigned short position;
-  for (position = 0; position < real_position; position ++) {
-    if (data[position] != data[real_position]) continue;
-    for (current_length = 0; (current_length <= position) && (current_length < limit) &&
-                             (data[position - current_length] == data[real_position + current_length]); current_length ++);
-    if (current_length > 1024) current_length = 1024;
-    if (current_length < best_length) continue;
-    best_match = position;
-    best_length = current_length;
-  }
-  if (!best_length) return 0;
-  if ((best_match + 128) >= real_position)
-    *offset = best_match - real_position;
-  else
-    *offset = best_match;
-  return best_length;
-}
-
-struct command find_best_repetition (const unsigned char * data, unsigned short position, unsigned short length) {
-  if ((position + 1) >= length) return data[position] ? ((struct command) {.command = 7}) : ((struct command) {.command = 3, .count = 1});
-  unsigned char value[2] = {data[position], data[position + 1]};
-  unsigned repcount, limit = length - position;
-  if (limit > 1024) limit = 1024;
-  for (repcount = 2; (repcount < limit) && (data[position + repcount] == value[repcount & 1]); repcount ++);
-  struct command result;
-  result.count = repcount;
-  if (*value != value[1]) {
-    if (!*value && (repcount < 3)) return (struct command) {.command = 3, .count = 1};
-    result.command = 2;
-    result.value = ((unsigned) (*value)) | (((unsigned) (value[1])) << 8);
-  } else if (*value) {
-    result.command = 1;
-    result.value = *value;
-  } else
-    result.command = 3;
-  return result;
-}
-
-struct command pick_best_command (unsigned count, struct command command, ...) {
-  struct command result = command;
-  va_list ap;
-  va_start(ap, command);
-  while (-- count) {
-    command = va_arg(ap, struct command);
-    if (is_better(command, result)) result = command;
-  }
-  va_end(ap);
-  return result;
-}
-
-int is_better (struct command new, struct command old) {
-  if (new.command == 7) return 0;
-  if (old.command == 7) return 1;
-  short new_savings = new.count - command_size(new), old_savings = old.count - command_size(old);
-  return new_savings > old_savings;
-}
-
-short command_size (struct command command) {
-  short header_size = 1 + (command.count > 32);
-  if (command.command & 4) return header_size + 1 + (command.value >= 0);
-  return header_size + command.command[(short []) {command.count, 1, 2, 0}];
-}
-
-void optimize (struct command * commands, unsigned short count) {
-  while (count && (commands -> command == 7)) commands ++, count --;
-  if (count < 2) return;
-  struct command * end = commands + count;
-  struct command * next = commands + 1;
-  while (next < end) {
-    if (next -> command == 7) goto skip;
-    if (
-        !(commands -> command) &&
-        (command_size(*next) == next -> count) &&
-        ((commands -> count + next -> count) <= 1024) &&
-        ((commands -> count > 32) || ((commands -> count + next -> count) <= 32))
-       ) {
-      commands -> count += next -> count;
-      next -> command = 7;
-      goto skip;
-    }
-    if (next -> command != commands -> command) goto accept;
-    switch (commands -> command) {
-      case 0:
-        if ((commands -> value + commands -> count) != next -> value) break;
-        commands -> count += next -> count;
-        next -> command = 7;
-        if (commands -> count <= 1024) goto skip;
-        next -> command = 0;
-        next -> value = commands -> value + 1024;
-        next -> count = commands -> count - 1024;
-        commands -> count = 1024;
-        break;
-      case 1:
-        if (commands -> value != next -> value) break;
-        // fall through
-      case 3:
-        if ((commands -> count + next -> count) <= 1024) {
-          commands -> count += next -> count;
-          next -> command = 7;
-          goto skip;
-        }
-        next -> count = (commands -> count + next -> count) - 1024;
-        commands -> count = 1024;
-        break;
-    }
-    accept:
-    commands = next;
-    skip:
-    next ++;
-  }
-}
-
-void repack (struct command ** commands, unsigned short * length) {
-  struct command * new_commands = malloc(sizeof(struct command) * *length);
-  struct command * current = new_commands;
-  unsigned short p;
-  for (p = 0; p < *length; p ++) if (p[*commands].command != 7) *(current ++) = p[*commands];
-  free(*commands);
-  *commands = new_commands;
-  *length = current - new_commands;
-}
-
-struct command * select_command_sequence (struct command ** sequences, const unsigned short * lengths, unsigned count, unsigned short * final_length) {
-  unsigned short min_sequence = 0, min_length = compressed_length(*sequences, *lengths);
-  unsigned short seq, len;
-  for (seq = 1; seq < count; seq ++) {
-    len = compressed_length(sequences[seq], lengths[seq]);
-    if (len < min_length) {
-      min_sequence = seq;
-      min_length = len;
-    }
-  }
-  *final_length = lengths[min_sequence];
-  struct command * current = malloc(*final_length * sizeof(struct command));
-  memcpy(current, sequences[min_sequence], *final_length * sizeof(struct command));
-  struct command * new;
-  for (seq = 1; seq < count; seq ++) {
-    new = merge_command_sequences(current, *final_length, sequences[(seq + min_sequence) % count], lengths[(seq + min_sequence) % count], final_length);
-    free(current);
-    current = new;
-  }
-  return current;
-}
-
-struct command * merge_command_sequences (const struct command * current, unsigned short current_length, const struct command * new, unsigned short new_length,
-                                          unsigned short * result_length) {
-  struct command * result = malloc(sizeof(struct command) * (current_length + new_length));
-  struct command * current_command = result;
-  const struct command * saved_current;
-  const struct command * saved_new;
-  unsigned short current_pos, new_pos;
-  while (current_length) {
-    if (current -> count == new -> count) {
-      *(current_command ++) = pick_best_command(2, *(current ++), *(new ++));
-      current_length --;
-      continue;
-    }
-    saved_current = current;
-    saved_new = new;
-    current_pos = (current ++) -> count;
-    new_pos = (new ++) -> count;
-    current_length --;
-    while (current_pos != new_pos)
-      if (current_pos < new_pos) {
-        current_pos += (current ++) -> count;
-        current_length --;
-      } else
-        new_pos += (new ++) -> count;
-    current_pos = compressed_length(saved_current, current - saved_current);
-    new_pos = compressed_length(saved_new, new - saved_new);
-    if (new_pos < current_pos) {
-      memcpy(current_command, saved_new, sizeof(struct command) * (new - saved_new));
-      current_command += new - saved_new;
-    } else {
-      memcpy(current_command, saved_current, sizeof(struct command) * (current - saved_current));
-      current_command += current - saved_current;
-    }
-  }
-  *result_length = current_command - result;
-  return result;
-}
-
-unsigned short compressed_length (const struct command * commands, unsigned short count) {
-  unsigned short current, total = 0;
-  for (current = 0; current < count; current ++) if (commands[current].command != 7) total += command_size(commands[current]);
-  return total;
-}