Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""AD&D プールオブレイディアンス (FC) マップデータ切り出し
import argparse
DATA_SIZE = 0x400
def offset(bank, addr_hi):
return 8192*bank + (addr_hi<<8) - 0xA000 if addr_hi else None
def get_offsets(in_):*8192 + 0x10AB)
banks =
addrs =
return tuple(offset(b,a) for b,a in zip(banks, addrs))
def extract(args):
in_ = args.in_
offs = get_offsets(in_)
for i, off in enumerate(offs):
if off is None: continue
print("{}:0x{:05X}".format(i, off))
data =
path = "map-{:02d}.bin".format(i)
with open(path, "wb") as out:
def parse_args():
ap = argparse.ArgumentParser()
ap.add_argument("in_", type=argparse.FileType("rb"))
return ap.parse_args()
def main():
args = parse_args()
if __name__ == "__main__": main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment