for i, key in enumerate(tileset_metadata[default_version]): bank = tileset_metadata[default_version][key][0] ptr = tileset_metadata[default_version][key][1] vram = tileset_metadata[default_version][key][2] vbank = tileset_metadata[default_version][key][3] realptr = utils.rom2realaddr((bank, ptr)) name = nametable[key] if key in nametable else nametable[ realptr_key_map[default_version][realptr]] output.write( f' dbwb BANK({name}), ${vram:04X}, ${vbank:X} ; {i:03X}\n') output.write('TilesetInfoTableEnd::\n\n') # Common tilesets to both versions output.write('; TilesetDataCommon\n') for key in common_tilesets: p = utils.real2romaddr(tileset_data[key][default_version][0]) f = tileset_data[key][default_version][1] name = nametable[key] with open(f"game/tilesets/{name}.malias","wb") as compressed, \ open(f"gfx/tilesets/{name}.png","wb") as uncompressed: width, height, palette, greyscale, bitdepth, px_map = gfx.convert_2bpp_to_png( f[0]) w = png.Writer(width, height, palette=palette, compression=9, greyscale=greyscale, bitdepth=bitdepth) w.write(uncompressed, px_map) compressed.write(bytearray(f[1]))
]) kanji = tilesets.get_tileset("Kanji", override_offset=0x0) with open("./game/src/version/ptrlist_data.asm", "w") as datafile: datafile.write( f'INCLUDE "build/ptrlists/ptrlist_data_constants_{{GAMEVERSION}}.asm"\n\n' ) for l in list_map: addr, spp, term, fix_len, print_hex, null_indicator, data_prefix = list_map[ l] if isinstance(addr, tuple): bank = addr[0] addr = utils.rom2realaddr(addr) else: bank = utils.real2romaddr(addr)[0] datafile.write( f'SECTION "Pointer List - {l}", ROMX[${utils.real2romaddr(addr)[1]:04x}], BANK[${bank:02x}]\n' ) datafile.write(f'PtrList{l}::\n') datafile.write(f' INCBIN c{l}\n\n') entries = OrderedDict() with open(f"./text/ptrlists/{l}.txt", "w", encoding="utf-8") as output: output.write(str(list_map[l][1:]) + "\n") count_written = False for version_suffix in roms: with open( f'./game/src/version/{version_suffix}/ptrlist_data.asm', 'w') as datafile_version:
sys.path.append(os.path.join(os.path.dirname(__file__), 'common')) from common import utils, tilesets rom_info = ("baserom_parts_collection.gb", "parts_collection", (0x16, 0x539b), 63) # [ROM File, Version Suffix, Credits Ptr, Entry Count] table = utils.merge_dicts([ tilesets.get_tileset("MainSpecial"), tilesets.get_tileset("MainDialog"), tilesets.get_tileset("dakuten", override_offset=0x0) ]) filename = rom_info[0] suffix = rom_info[1] text_ptr_table = rom_info[2] if isinstance( rom_info[2], int) else utils.rom2realaddr(rom_info[2]) bank = utils.real2romaddr(text_ptr_table)[0] entry_count = rom_info[3] with open(filename, 'rb') as rom, open(f"./text/credits/Credits.csv", "w", encoding="utf-8") as fp: writer = csv.writer(fp, lineterminator='\n', delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) writer.writerow(["Pointer", "VRAMOffset", "Original", "Translated"]) rom.seek(text_ptr_table) pointers = [(rom.tell(), utils.read_short(rom)) for i in range(0, entry_count)]