mirror of
https://github.com/db48x/emularity.git
synced 2026-07-28 04:07:11 +00:00
@@ -154,6 +154,11 @@ var Module = null;
|
||||
cfgr = PCELoader;
|
||||
get_files = get_pce_files;
|
||||
}
|
||||
else if (module && module.indexOf("vice") === 0) {
|
||||
emulator_logo = images.ia; // TODO: Use VICE or C64 logo
|
||||
cfgr = VICELoader;
|
||||
get_files = get_vice_files;
|
||||
}
|
||||
else if (module) {
|
||||
emulator_logo = images.mame;
|
||||
cfgr = MAMELoader;
|
||||
@@ -185,6 +190,12 @@ var Module = null;
|
||||
config_args.push(cfgr.startExe(metadata.getElementsByTagName("emulator_start")
|
||||
.item(0)
|
||||
.textContent));
|
||||
} else if (module && module.indexOf("vice") === 0) {
|
||||
let emulator_start_item = metadata.getElementsByTagName("emulator_start").item(0);
|
||||
if (emulator_start_item) {
|
||||
config_args.push(cfgr.autoLoad(emulator_start_item.textContent));
|
||||
}
|
||||
config_args.push(cfgr.extraArgs(modulecfg.extra_args));
|
||||
} else if (module && module.indexOf("sae-") === 0) {
|
||||
config_args.push(cfgr.model(modulecfg.driver),
|
||||
cfgr.rom(modulecfg.bios_filenames));
|
||||
@@ -213,7 +224,7 @@ var Module = null;
|
||||
updateLogo();
|
||||
resolve(cfgr.apply(null, extend(config_args, game_files)));
|
||||
},
|
||||
function () {
|
||||
function (e) {
|
||||
if (splash.failed_loading) {
|
||||
return;
|
||||
}
|
||||
@@ -262,6 +273,37 @@ var Module = null;
|
||||
});
|
||||
return files;
|
||||
}
|
||||
|
||||
function get_vice_files(cfgr, metadata, modulecfg, filelist) {
|
||||
var default_drive = "8",
|
||||
drives = {}, files = [], wanted_files = []
|
||||
meta = dict_from_xml(metadata);
|
||||
files_with_ext_from_filelist(filelist, meta.emulator_ext).forEach(function (file, i) {
|
||||
//drives[default_drive] = file.name;
|
||||
wanted_files.push(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 len = wanted_files.length;
|
||||
wanted_files.forEach(function (file, i) {
|
||||
var title = "Game File ("+ (i+1) +" of "+ len +")",
|
||||
filename = file,
|
||||
url = (filename.includes("/")) ? get_zip_url(filename)
|
||||
: get_zip_url(filename, get_item_name(game));
|
||||
console.log("Retrieving URL",url);
|
||||
if (filename.toLowerCase().endsWith(".zip")&&false) { // TODO: Enable and fix zip support.
|
||||
files.push(cfgr.mountZip("", // TODO: This is a hack, no drive actually applicable here
|
||||
cfgr.fetchFile(title, url)));
|
||||
} else {
|
||||
//TODO: ensure vice_drive_8 and vice_drive_9 actually function.
|
||||
files.push(cfgr.mountFile('/'+ filename,
|
||||
cfgr.fetchFile(title, url)));
|
||||
}
|
||||
});
|
||||
return files;
|
||||
}
|
||||
|
||||
function get_mame_files(cfgr, metadata, modulecfg, filelist) {
|
||||
var files = [],
|
||||
@@ -559,6 +601,24 @@ var Module = null;
|
||||
MAMELoader.extraArgs = function (args) {
|
||||
return { extra_mame_args: args };
|
||||
};
|
||||
|
||||
/**
|
||||
* VICELoader
|
||||
*/
|
||||
function VICELoader() {
|
||||
var config = Array.prototype.reduce.call(arguments, extend);
|
||||
config.emulator_arguments = build_vice_arguments(config.emulatorStart, config.files, config.extra_vice_args);
|
||||
config.runner = EmscriptenRunner;
|
||||
return config;
|
||||
}
|
||||
VICELoader.__proto__ = BaseLoader;
|
||||
|
||||
VICELoader.autoLoad = function (path) {
|
||||
return { emulatorStart: path };
|
||||
};
|
||||
VICELoader.extraArgs = function (args) {
|
||||
return { extra_vice_args: args };
|
||||
}
|
||||
|
||||
/**
|
||||
* SAELoader
|
||||
@@ -667,6 +727,14 @@ var Module = null;
|
||||
|
||||
return args;
|
||||
};
|
||||
|
||||
var build_vice_arguments = function (emulator_start, files, extra_args) {
|
||||
var args = emulator_start ? ["-autostart", "/emulator/" + emulator_start] : [];
|
||||
if(extra_args) {
|
||||
args = args.concat(extra_args);
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
/*
|
||||
* EmscriptenRunner
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
* Add logo
|
||||
* 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)
|
||||
* Check if "this is a stupid hack" applies to VICE
|
||||
* Useful hardcoded IA entries: https://archive.org/details/emularity_engine_v1
|
||||
Reference in New Issue
Block a user