Skip to content

Commit

Permalink
get_vice_files and related code. No guarantee that this is coherent.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sgeo committed Aug 28, 2018
1 parent 5ecbeb7 commit 7b0afc8
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
38 changes: 38 additions & 0 deletions loader.js
Expand Up @@ -190,6 +190,11 @@ var Module = null;
config_args.push(cfgr.startExe(metadata.getElementsByTagName("emulator_start")
.item(0)
.textContent));
} else if (module && module.indexOf("vice-") === 0) {
config_args.push(cfgr.autoLoad(metadata.getElementsByTagName("emulator_start")
.item(0)
.textContent));
}
} else if (module && module.indexOf("sae-") === 0) {
config_args.push(cfgr.model(modulecfg.driver),
cfgr.rom(modulecfg.bios_filenames));
Expand Down Expand Up @@ -267,6 +272,35 @@ var Module = null;
});
return files;
}

function get_vice_files(cfgr, metadata, modulecfg, filelist) {
var default_drive = "8",
drives = {}, files = [],
meta = dict_from_xml(metadata);
files_with_ext_from_filelist(filelist, meta.emulator_ext).forEach(function (file, i) {
drives[default_drive] = file.name;
});
meta_props_matching(meta, /^vice_drive_([89])$/).forEach(function (result) {
let key = result[0], match = result[1];
drives[match[1]] = meta[key];
});
var mounts = Object.keys(drives),
len = mounts.length;
mounts.forEach(function (drive, i) {
var title = "Game File ("+ (i+1) +" of "+ len +")",
filename = drives[drive],
url = (filename.includes("/")) ? get_zip_url(filename)
: get_zip_url(filename, get_item_name(game));
if (filename.toLowerCase().endsWith(".zip")) {
files.push(cfgr.mountZip(drive,
cfgr.fetchFile(title, url)));
} else {
files.push(cfgr.mountFile('/'+ filename,
cfgr.fetchFile(title, url)));
}
});
return files;
}

function get_mame_files(cfgr, metadata, modulecfg, filelist) {
var files = [],
Expand Down Expand Up @@ -573,6 +607,10 @@ var Module = null;
config.runner = VICERunner;
}
VICELoader.__proto__ = BaseLoader;

VICELoader.autoLoad = function (path) {
return { emulatorStart: path };
};

/**
* SAELoader
Expand Down
2 changes: 1 addition & 1 deletion vice_todo.txt
@@ -1,5 +1,5 @@
* Add logo
* Define get_vice_files: This is where to add support for metadata entries (ala dosbox_drive_d)
* Define get_vice_files: This is where to add support for metadata entries (ala dosbox_drive_d) [done, imperfectly]
* Define VICELoader
* Define VICERunner
* Add entry in config_args push area (don't fall through to MAME)
Expand Down

0 comments on commit 7b0afc8

Please sign in to comment.