mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-01-23 09:16:20 -08:00
implement rgb macro for palettes
This commit is contained in:
parent
61a3d14593
commit
238f406024
@ -31,6 +31,10 @@ TX_FAR: MACRO
|
|||||||
db BANK(\1)
|
db BANK(\1)
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
RGB: MACRO
|
||||||
|
dw ((\3 << 10) | (\2 << 5) | (\1))
|
||||||
|
ENDM
|
||||||
|
|
||||||
; eventually replace with python macro
|
; eventually replace with python macro
|
||||||
note: MACRO
|
note: MACRO
|
||||||
db \1
|
db \1
|
||||||
|
@ -1283,6 +1283,28 @@ def get_uncompressed_gfx(start, num_tiles, filename):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def hex_to_rgb(word):
|
||||||
|
red = word & 0b11111
|
||||||
|
word >>= 5
|
||||||
|
green = word & 0b11111
|
||||||
|
word >>= 5
|
||||||
|
blue = word & 0b11111
|
||||||
|
return (red, green, blue)
|
||||||
|
|
||||||
|
def grab_palettes(address, length = 0x80):
|
||||||
|
output = ''
|
||||||
|
for word in range(length/2):
|
||||||
|
color = ord(rom[address+1])*0x100 + ord(rom[address])
|
||||||
|
address += 2
|
||||||
|
color = hex_to_rgb(color)
|
||||||
|
red = str(color[0]).zfill(2)
|
||||||
|
green = str(color[1]).zfill(2)
|
||||||
|
blue = str(color[2]).zfill(2)
|
||||||
|
output += '\tRGB '+red+', '+green+', '+blue
|
||||||
|
output += '\n'
|
||||||
|
return output
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('cmd', nargs='?', metavar='cmd', type=str)
|
parser.add_argument('cmd', nargs='?', metavar='cmd', type=str)
|
||||||
@ -1317,6 +1339,10 @@ if __name__ == "__main__":
|
|||||||
# python gfx.py un [address] [num_tiles] [filename]
|
# python gfx.py un [address] [num_tiles] [filename]
|
||||||
get_uncompressed_gfx(int(args.arg1,16), int(args.arg2), args.arg3)
|
get_uncompressed_gfx(int(args.arg1,16), int(args.arg2), args.arg3)
|
||||||
|
|
||||||
|
elif args.cmd == 'pal':
|
||||||
|
# python gfx.py pal [address] [length]
|
||||||
|
print grab_palettes(int(args.arg1,16), int(args.arg2))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# python gfx.py
|
# python gfx.py
|
||||||
decompress_all()
|
decompress_all()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user