mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-04-09 05:44:44 -07:00
Merge pull request #53 from yenatch/master
Compressed graphics and gfx.py updates.
This commit is contained in:
commit
65614f40c9
@ -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,31 +1168,33 @@ 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):
|
||||
@ -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)
|
||||
|
||||
|
||||
|
||||
|
||||
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)
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.cmd == 'de':
|
||||
# python gfx.py de [addr] [fname] [mode]
|
||||
print hex_dump(export_decompressed(int(args.addr,16), args.mode, args.fname))
|
||||
else:
|
||||
decompress_all()
|
||||
print 'decompressed known gfx to ../gfx/!'
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('cmd', nargs='?', metavar='cmd', 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] [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()
|
||||
if debug: print 'decompressed known gfx to ../gfx/!'
|
||||
|
BIN
gfx/backpics/cpr/001.cpr
Normal file
BIN
gfx/backpics/cpr/001.cpr
Normal file
Binary file not shown.
BIN
gfx/backpics/cpr/002.cpr
Normal file
BIN
gfx/backpics/cpr/002.cpr
Normal file
Binary file not shown.
BIN
gfx/backpics/cpr/003.cpr
Normal file
BIN
gfx/backpics/cpr/003.cpr
Normal file
Binary file not shown.
BIN
gfx/backpics/cpr/004.cpr
Normal file
BIN
gfx/backpics/cpr/004.cpr
Normal file
Binary file not shown.
BIN
gfx/backpics/cpr/005.cpr
Normal file
BIN
gfx/backpics/cpr/005.cpr
Normal file
Binary file not shown.
BIN
gfx/backpics/cpr/006.cpr
Normal file
BIN
gfx/backpics/cpr/006.cpr
Normal file
Binary file not shown.
BIN
gfx/backpics/cpr/007.cpr
Normal file
BIN
gfx/backpics/cpr/007.cpr
Normal file
Binary file not shown.
BIN
gfx/backpics/cpr/008.cpr
Normal file
BIN
gfx/backpics/cpr/008.cpr
Normal file
Binary file not shown.
BIN
gfx/backpics/cpr/009.cpr
Normal file
BIN
gfx/backpics/cpr/009.cpr
Normal file
Binary file not shown.
BIN
gfx/backpics/cpr/010.cpr
Normal file
BIN
gfx/backpics/cpr/010.cpr
Normal file
Binary file not shown.
BIN
gfx/backpics/cpr/011.cpr
Normal file
BIN
gfx/backpics/cpr/011.cpr
Normal file
Binary file not shown.
BIN
gfx/backpics/cpr/012.cpr
Normal file
BIN
gfx/backpics/cpr/012.cpr
Normal file
Binary file not shown.
BIN
gfx/backpics/cpr/013.cpr
Normal file
BIN
gfx/backpics/cpr/013.cpr
Normal file
Binary file not shown.
BIN
gfx/backpics/cpr/014.cpr
Normal file
BIN
gfx/backpics/cpr/014.cpr
Normal file
Binary file not shown.
BIN
gfx/backpics/cpr/015.cpr
Normal file
BIN
gfx/backpics/cpr/015.cpr
Normal file
Binary file not shown.
BIN
gfx/backpics/cpr/016.cpr
Normal file
BIN
gfx/backpics/cpr/016.cpr
Normal file
Binary file not shown.
BIN
gfx/backpics/cpr/017.cpr
Normal file
BIN
gfx/backpics/cpr/017.cpr
Normal file
Binary file not shown.
BIN
gfx/backpics/cpr/018.cpr
Normal file
BIN
gfx/backpics/cpr/018.cpr
Normal file
Binary file not shown.
BIN
gfx/backpics/cpr/019.cpr
Normal file
BIN
gfx/backpics/cpr/019.cpr
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user