def create_extended_adf(self, f): # Workbench 3.1 does not like the adf_extended file, created by # WinUAE (must check why) s = Resources("fsgs").stream("res/amiga/adf_save_disk.dat") data = s.read() data = zlib.decompress(data) f.write(data)
def get_config_files(): print("get_config_files") configs = {} input_stream = Resources("fsgs").stream("res/input/manifest.txt") print("opened input manifest") for line in input_stream.read().split(b"\n"): line = line.decode("UTF-8") path = line.strip() if not path: continue _, ext = os.path.splitext(path) if ext in [".ini", ".conf"]: parts = path.split("/") file_name = parts[-1] name, _ = os.path.splitext(file_name) if len(parts) > 1: configs[parts[-2] + '_' + name] = "fsgs:res/input/" + path # print(" -", path) configs[name] = "fsgs:res/input/" + path # FIXME: fix dependency controllers_dir = fsgs.amiga.get_controllers_dir() print("read configs from controllers_dir at", controllers_dir) if os.path.exists(controllers_dir): for file_name in os.listdir(controllers_dir): if file_name.endswith(".conf"): name, ext = os.path.splitext(file_name) path = os.path.join(controllers_dir, file_name) print(" -", path) configs[name] = path # print("input config files:", configs) return configs
def __init__(self, name="", object=None): if object: self.qimage = object else: self.qimage = QImage() if hasattr(name, "read"): self.qimage.loadFromData(name.read()) elif name.startswith("pkg://"): parts = name.split("/", 3) stream = Resources(parts[2]).stream(parts[3]) self.qimage.loadFromData(stream.read()) else: index = name.find(":") if index > 1: package, file_ = name.split(":", 1) stream = Resources(package).stream(file_) self.qimage.loadFromData(stream.read()) else: print("loading image from", name) self.qimage.load(name)
def get_config_files(): print("get_config_files") configs = {} input_stream = Resources("fsgs").stream("res/input/manifest.txt") print("opened input manifest") for line in input_stream.read().split(b"\n"): line = line.decode("UTF-8") path = line.strip() if not path: continue _, ext = os.path.splitext(path) if ext in [".ini", ".conf"]: parts = path.split("/") file_name = parts[-1] name, _ = os.path.splitext(file_name) if len(parts) > 1: configs[parts[-2] + "_" + name] = "fsgs:res/input/" + path # print(" -", path) configs[name] = "fsgs:res/input/" + path # FIXME: fix dependency controllers_dir = fsgs.amiga.get_controllers_dir() print("read configs from controllers_dir at", controllers_dir) if os.path.exists(controllers_dir): for file_name in os.listdir(controllers_dir): if file_name.endswith(".conf"): name, ext = os.path.splitext(file_name) path = os.path.join(controllers_dir, file_name) print(" -", path) configs[name] = path keyboards_dir = os.path.join(FSGSDirectories.get_data_dir(), "Devs", "Keyboards") print("read configs from controllers_dir at", keyboards_dir) if os.path.exists(keyboards_dir): for file_name in os.listdir(keyboards_dir): if file_name.endswith(".ini"): name, ext = os.path.splitext(file_name) path = os.path.join(keyboards_dir, file_name) print(" -", path) configs[name] = path # print("input config files:", configs) return configs
def prepare_floppies(self): print("LaunchHandler.copy_floppies") current_task.set_progress(gettext("Preparing floppy images...")) # self.on_progress(gettext("Preparing floppy images...")) floppies = [] for i in range(Amiga.MAX_FLOPPY_DRIVES): key = "floppy_drive_{0}".format(i) if self.config.get(key, ""): floppies.append(self.config[key]) self.prepare_floppy(key) for i in range(Amiga.MAX_FLOPPY_IMAGES): key = "floppy_image_{0}".format(i) if self.config.get(key, ""): break else: print("floppy image list is empty") for j, floppy in enumerate(floppies): self.config["floppy_image_{0}".format(j)] = floppy max_image = -1 for i in range(Amiga.MAX_FLOPPY_IMAGES): key = "floppy_image_{0}".format(i) self.prepare_floppy(key) if self.config.get(key, ""): max_image = i save_image = max_image + 1 if self.config.get("save_disk", "") != "0": s = Resources("fsgs", "res").stream("amiga/adf_save_disk.dat") data = s.read() data = zlib.decompress(data) save_disk = os.path.join(self.temp_dir, "Save Disk.adf") with open(save_disk, "wb") as f: f.write(data) key = "floppy_image_{0}".format(save_image) self.config[key] = "Save Disk.adf"
def create_adf(self, f): s = Resources("fsgs").stream("res/amiga/adf.dat") data = s.read() data = zlib.decompress(data) f.write(data)