def get_rom_info(self, rom_list): rom_data = [] for rom in rom_list: slot = rom[0] start = rom[1] size = rom[2] rom_header = sd_card.ncsd_header(slot) rom_info = titles.rom_info(rom_header['product_code'], rom_header['media_id']) if rom_info: title = rom_info['name'] firmware = rom_info['firmware'] else: title = "???" firmware = "???" rom_data.append( [ slot, "%d MB" % int(rom[1] / 1024 / 1024), "%d MB" % int(rom[2] / 1024 / 1024), rom_header['card_type'], rom_header['product_code'], title, rom_header['save_crypto'].rjust(12), ] ) return rom_data
disk.write_savegame(args.write_savegame) if args.write != None: disk.write_rom(args.write, use_header_bin=not args.do_not_use_header_bin, verbose=args.verbose) rom_table = [['Slot', 'Start', 'Size', 'Type', 'Code', 'Title']] if args.verbose: rom_table[0] += ['Sav-Crypt', 'Firm', 'Card ID', 'Unique ID'] if args.backup_all_savegames: for rom in disk.rom_list: slot = rom[0] rom_header = disk.ncsd_header(slot) rom_info = titles.rom_info(rom_header['product_code'], rom_header['media_id']) savegames_dir = os.path.join(data_dir, 'savegames') if not os.path.exists(savegames_dir): os.mkdir(savegames_dir) savegame_dir = os.path.join( savegames_dir, ''.join( filter( lambda x: x in '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-+& ', rom_info['name']))) if not os.path.exists(savegame_dir): os.mkdir(savegame_dir)
if args.write_savegame != None: disk.write_savegame(args.write_savegame) if args.write != None: disk.write_rom(args.write, use_header_bin=not args.do_not_use_header_bin, verbose=args.verbose) rom_table = [['Slot', 'Start', 'Size', 'Type', 'Code', 'Title']] if args.verbose: rom_table[0] += ['Sav-Crypt', 'Firm', 'Card ID', 'Unique ID'] if args.backup_all_savegames: for rom in disk.rom_list: slot = rom[0] rom_header = disk.ncsd_header(slot) rom_info = titles.rom_info(rom_header['product_code'], rom_header['media_id']) savegames_dir = os.path.join(data_dir, 'savegames') if not os.path.exists(savegames_dir): os.mkdir(savegames_dir) savegame_dir = os.path.join(savegames_dir, ''.join(filter(lambda x: x in '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-+& ', rom_info['name']))) if not os.path.exists(savegame_dir): os.mkdir(savegame_dir) savegame_file = os.path.join(savegame_dir, "%s_%s.sav" % (rom_header['product_code'], datetime.datetime.now().strftime("%Y_%m_%d__%H_%M"))) disk.dump_savegame(slot, savegame_file) for rom in disk.rom_list: