Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't double-load chd files for chd-based items #109

Merged
merged 2 commits into from
Oct 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,13 +388,15 @@ 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 +")";
db48x marked this conversation as resolved.
Show resolved Hide resolved
var url = get_bios_url(fname);
files.push(cfgr.mountFile('/'+ fname,
cfgr.fetchFile(title,
get_bios_url(fname))));
cfgr.fetchFile(title, url)));
already_fetched_urls.push(url);
}
});

Expand All @@ -421,6 +423,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
Expand All @@ -431,8 +434,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) {
Expand Down