Merge pull request #53 from yenatch/master

Compressed graphics and gfx.py updates.
This commit is contained in:
Bryan Bishop 2013-01-02 09:39:10 -08:00
commit 65614f40c9
692 changed files with 183 additions and 764 deletions

View File

@ -593,6 +593,10 @@ class Decompressed:
self.decompress()
debug = False
# print tuple containing start and end address
if debug: print '(' + hex(self.start) + ', ' + hex(self.start + self.address+1) + '),'
# only transpose pic
self.pic = []
self.animtiles = []
@ -1152,7 +1156,7 @@ def decompress_title():
to_file(filename, gfx.output)
def decompress_all():
def decompress_all(debug = False):
"""decompress all known compressed data in baserom"""
#mkdir_p('../gfx/')
#mkdir_p('../gfx/frontpics/')
@ -1164,32 +1168,34 @@ def decompress_all():
#mkdir_p('../gfx/intro/')
#mkdir_p('../gfx/title/')
if debug: print 'fronts'
decompress_monsters(front)
if debug: print 'backs'
decompress_monsters(back)
if debug: print 'unown fronts'
decompress_unowns(front)
if debug: print 'unown backs'
decompress_unowns(back)
if debug: print 'trainers'
decompress_trainers()
if debug: print 'fx'
decompress_fx()
if debug: print 'intro'
decompress_intro()
if debug: print 'title'
decompress_title()
return
def export_decompressed(address, mode='horiz', filename = 'de.2bpp', size = None, debug = True):
def decompress_from_address(address, mode='horiz', filename = 'de.2bpp', size = None):
"""write decompressed data from an address to a 2bpp file"""
if debug: print 'decompressing ' + hex(address)
image = Decompressed(rom, mode, size, address)
if debug: print 'export to ' + filename + '\n'
to_file(filename, image.pic)
return image.pic
def decompress_file(filein, fileout, mode = 'horiz', size = None):
f = open(filein, 'rb')
@ -1225,21 +1231,38 @@ def compress_monster_frontpic(id, fileout):
cpr = Compressed(image, mode, 5)
to_file('old.2bpp', cpr.output)
out = '../gfx/frontpics/cpr/' + str(id).zfill(3) + '.cpr'
to_file(out, cpr.output)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('cmd', nargs='?', metavar='cmd', type=str)
parser.add_argument('addr', nargs='?', metavar='addr', type=str)
parser.add_argument('mode', nargs='?', metavar='mode', type=str)
parser.add_argument('fname', nargs='?', metavar='fname', type=str)
parser.add_argument('arg1', nargs='?', metavar='arg1', type=str)
parser.add_argument('arg2', nargs='?', metavar='arg2', type=str)
parser.add_argument('arg3', nargs='?', metavar='arg3', type=str)
args = parser.parse_args()
debug = True
if args.cmd == 'de':
# python gfx.py de [addr] [fname] [mode]
print hex_dump(export_decompressed(int(args.addr,16), args.mode, args.fname))
# python gfx.py de [addr] [fileout] [mode]
addr = int(args.arg1,16)
fileout = args.arg2
mode = args.arg3
decompress_from_address(addr, fileout, mode)
if debug: print 'decompressed to ' + args.arg2 + ' from ' + hex(int(args.arg1,16)) + '!'
elif args.cmd == 'cpr':
# python gfx.py cpr [filein] [fileout] [mode]
filein = args.arg1
fileout = args.arg2
mode = args.arg3
compress_file(filein, fileout, mode)
if debug: print 'compressed ' + filein + ' to ' + fileout + '!'
else:
decompress_all()
print 'decompressed known gfx to ../gfx/!'
if debug: print 'decompressed known gfx to ../gfx/!'

BIN
gfx/backpics/cpr/001.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/002.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/003.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/004.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/005.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/006.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/007.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/008.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/009.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/010.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/011.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/012.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/013.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/014.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/015.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/016.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/017.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/018.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/019.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/020.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/021.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/022.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/023.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/024.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/025.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/026.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/027.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/028.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/029.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/030.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/031.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/032.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/033.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/034.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/035.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/036.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/037.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/038.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/039.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/040.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/041.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/042.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/043.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/044.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/045.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/046.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/047.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/048.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/049.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/050.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/051.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/052.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/053.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/054.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/055.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/056.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/057.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/058.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/059.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/060.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/061.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/062.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/063.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/064.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/065.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/066.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/067.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/068.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/069.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/070.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/071.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/072.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/073.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/074.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/075.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/076.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/077.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/078.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/079.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/080.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/081.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/082.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/083.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/084.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/085.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/086.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/087.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/088.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/089.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/090.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/091.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/092.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/093.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/094.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/095.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/096.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/097.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/098.cpr Normal file

Binary file not shown.

BIN
gfx/backpics/cpr/099.cpr Normal file

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More