fix: don't double-load files for MAME items

This prevents us from loading a file as both a driver and a game file,
preventing double-loading .chd files when `meta.emulator_ext` is `chd`.

In these cases, it appears that the files aren't needed as driver files,
so we can safely just load them as game files and ignore the duplicates
we'd get by loading all .chd files as drivers.
This commit is contained in:
aschmitz
2023-10-01 01:05:19 -05:00
parent 6b318f03a8
commit 4739da618d
+7 -3
View File
@@ -388,7 +388,8 @@ var Module = null;
function get_mame_files(cfgr, metadata, modulecfg, filelist) {
var files = [],
bios_files = modulecfg['bios_filenames'];
bios_files = modulecfg['bios_filenames'],
already_fetched_urls = [];
bios_files.forEach(function (fname, i) {
if (fname) {
var title = "Bios File ("+ (i+1) +" of "+ bios_files.length +")";
@@ -421,6 +422,7 @@ var Module = null;
: get_zip_url(filename, get_item_name(game));
files.push(cfgr.mountFile('/'+ filename,
cfgr.fetchFile(title, url)));
already_fetched_urls.push(url);
});
// add on game drive (.chd) files, if any
@@ -431,8 +433,10 @@ var Module = null;
var title = "Game Drive ("+ (i+1) +" of "+ len +")";
var url = (file.name.includes("/")) ? get_zip_url(file.name)
: get_zip_url(file.name, get_item_name(game));
files.push(cfgr.mountFile(modulecfg.driver + '/' + file.name,
cfgr.fetchFile(title, url)));
if (!already_fetched_urls.includes(url)) {
files.push(cfgr.mountFile(modulecfg.driver + '/' + file.name,
cfgr.fetchFile(title, url)));
}
});
Object.keys(peripherals).forEach(function (periph) {