mirror of
https://github.com/weiju/amiga-stuff
synced 2026-10-15 03:47:52 +00:00
cleaned up ks decoder
This commit is contained in:
@@ -9,7 +9,8 @@ SIZE_CLASSIC = 0x40000
|
|||||||
SIZE_MODERN = 0x80000
|
SIZE_MODERN = 0x80000
|
||||||
MAX_ROM_SIZE = SIZE_MODERN
|
MAX_ROM_SIZE = SIZE_MODERN
|
||||||
|
|
||||||
def decode_cloanto(rom, key, real_size):
|
def decode_cloanto(rom, key):
|
||||||
|
"""Decodes an encoded Kickstart ROM and returns a decoded ROM"""
|
||||||
rom = bytearray(rom)
|
rom = bytearray(rom)
|
||||||
key = bytearray(key)
|
key = bytearray(key)
|
||||||
result = bytearray(len(rom))
|
result = bytearray(len(rom))
|
||||||
@@ -39,7 +40,7 @@ if __name__ == '__main__':
|
|||||||
size = len(data)
|
size = len(data)
|
||||||
if size != SIZE_CLASSIC and size != SIZE_MODERN:
|
if size != SIZE_CLASSIC and size != SIZE_MODERN:
|
||||||
raise Exception("invalid rom size")
|
raise Exception("invalid rom size")
|
||||||
decoded = decode_cloanto(data, key_data, len(data))
|
decoded = decode_cloanto(data, key_data)
|
||||||
with open(args.target, 'wb') as outfile:
|
with open(args.target, 'wb') as outfile:
|
||||||
outfile.write(bytes(decoded))
|
outfile.write(bytes(decoded))
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user