Fix tape loading.

This commit is contained in:
Will Scullin 2019-04-06 12:20:35 -07:00
parent b688ccf10f
commit 83d9fd8730
No known key found for this signature in database
GPG Key ID: 9092A5C0A673416B
2 changed files with 16 additions and 24 deletions

View File

@ -178,7 +178,6 @@ export function doLoad() {
doLoadLocal(_currentDrive, files[0]); doLoadLocal(_currentDrive, files[0]);
} else if (url) { } else if (url) {
var filename; var filename;
MicroModal.close('load-modal');
if (url.substr(0,6) == 'local:') { if (url.substr(0,6) == 'local:') {
filename = url.substr(6); filename = url.substr(6);
if (filename == '__manage') { if (filename == '__manage') {
@ -217,13 +216,10 @@ function doLoadLocal(drive, file) {
var ext = parts[parts.length - 1].toLowerCase(); var ext = parts[parts.length - 1].toLowerCase();
if (DISK_TYPES.includes(ext)) { if (DISK_TYPES.includes(ext)) {
doLoadLocalDisk(drive, file); doLoadLocalDisk(drive, file);
} else if ($.inArray(ext, TAPE_TYPES) >= 0) { } else if (TAPE_TYPES.includes(ext)) {
tape.doLoadLocalTape(file, function() { tape.doLoadLocalTape(file);
MicroModal.close('load-modal');
});
} else { } else {
window.alert('Unknown file type: ' + ext); window.alert('Unknown file type: ' + ext);
MicroModal.close('load-modal');
} }
} }
@ -235,7 +231,6 @@ function doLoadLocalDisk(drive, file) {
var name = parts.join('.'); var name = parts.join('.');
if (disk2.setBinary(drive, name, ext, this.result)) { if (disk2.setBinary(drive, name, ext, this.result)) {
drivelights.label(drive, name); drivelights.label(drive, name);
MicroModal.close('load-modal');
initGamepad(); initGamepad();
} }
}; };
@ -412,7 +407,7 @@ export function updateSound() {
label.classList.remove('fa-volume-up'); label.classList.remove('fa-volume-up');
label.classList.add('fa-volume-off'); label.classList.add('fa-volume-off');
} }
}; }
function dumpDisk(drive) { function dumpDisk(drive) {
var wind = window.open('', '_blank'); var wind = window.open('', '_blank');
@ -455,7 +450,7 @@ export function updateCPU()
if (runTimer) { if (runTimer) {
run(); run();
} }
}; }
var _requestAnimationFrame = var _requestAnimationFrame =
window.requestAnimationFrame || window.requestAnimationFrame ||
@ -816,7 +811,7 @@ export function updateScreen() {
vm.green(green); vm.green(green);
vm.scanlines(scanlines); vm.scanlines(scanlines);
}; }
var disableMouseJoystick = false; var disableMouseJoystick = false;
var flipX = false; var flipX = false;
@ -879,11 +874,11 @@ export function toggleSound() {
export function openOptions() { export function openOptions() {
MicroModal.show('options-modal'); MicroModal.show('options-modal');
}; }
export function openPrinterModal() { export function openPrinterModal() {
MicroModal.show('printer-modal'); MicroModal.show('printer-modal');
}; }
MicroModal.init(); MicroModal.init();

View File

@ -193,13 +193,13 @@ export function doLoad() {
document.location.hash = parts.join('|'); document.location.hash = parts.join('|');
} }
} }
}; }
export function doSave() { export function doSave() {
var name = document.querySelector('#save_name').value; var name = document.querySelector('#save_name').value;
saveLocalStorage(_currentDrive, name); saveLocalStorage(_currentDrive, name);
MicroModal.close('save-modal'); MicroModal.close('save-modal');
}; }
export function doDelete(name) { export function doDelete(name) {
if (window.confirm('Delete ' + name + '?')) { if (window.confirm('Delete ' + name + '?')) {
@ -212,13 +212,10 @@ function doLoadLocal(drive, file) {
var ext = parts[parts.length - 1].toLowerCase(); var ext = parts[parts.length - 1].toLowerCase();
if (DISK_TYPES.includes(ext)) { if (DISK_TYPES.includes(ext)) {
doLoadLocalDisk(drive, file); doLoadLocalDisk(drive, file);
} else if ($.inArray(ext, TAPE_TYPES) >= 0) { } else if (TAPE_TYPES.includes(ext)) {
tape.doLoadLocalTape(file, function() { tape.doLoadLocalTape(file);
MicroModal.close('load-modal');
});
} else { } else {
window.alert('Unknown file type: ' + ext); window.alert('Unknown file type: ' + ext);
MicroModal.close('load-modal');
} }
} }
@ -386,7 +383,7 @@ export function updateSound() {
label.classList.remove('fa-volume-up'); label.classList.remove('fa-volume-up');
label.classList.add('fa-volume-off'); label.classList.add('fa-volume-off');
} }
}; }
function dumpDisk(drive) { function dumpDisk(drive) {
var wind = window.open('', '_blank'); var wind = window.open('', '_blank');
@ -429,7 +426,7 @@ export function updateCPU()
if (runTimer) { if (runTimer) {
run(); run();
} }
}; }
var _requestAnimationFrame = var _requestAnimationFrame =
window.requestAnimationFrame || window.requestAnimationFrame ||
@ -798,7 +795,7 @@ export function updateScreen() {
vm.green(green); vm.green(green);
vm.scanlines(scanlines); vm.scanlines(scanlines);
}; }
var disableMouseJoystick = false; var disableMouseJoystick = false;
var flipX = false; var flipX = false;
@ -861,11 +858,11 @@ export function toggleSound() {
export function openOptions() { export function openOptions() {
MicroModal.show('options-modal'); MicroModal.show('options-modal');
}; }
export function openPrinterModal() { export function openPrinterModal() {
MicroModal.show('printer-modal'); MicroModal.show('printer-modal');
}; }
MicroModal.init(); MicroModal.init();