Save machine finally works

This commit is contained in:
Jeff Parsons 2016-02-17 13:40:55 -08:00
commit 0e3de68273
11 changed files with 1573 additions and 1505 deletions

View file

@ -366,7 +366,9 @@ Computer.prototype.setMachineParms = function(parmsMachine)
* If the machine parameter doesn't exist, we check for a matching component parameter (if parmsComponent is provided),
* and failing that, we check the bundled resources (if any).
*
* At the moment, the only bundled resource match we expect to encounter is 'state'.
* At the moment, the only bundled resource request we expect to encounter is 'state'; if it exists, then we return
* 'state' back to the caller (ie, the name of the resource), so that the caller will then attempt to load the 'state'
* resource to obtain the actual state.
*
* @param {string} sParm
* @param {Object} [parmsComponent]
@ -381,8 +383,8 @@ Computer.prototype.getMachineParm = function(sParm, parmsComponent)
if (value == null && parmsComponent) {
value = parmsComponent[sParm];
}
if (value == null && typeof resources == 'object') {
value = resources[sParm];
if (value == null && typeof resources == 'object' && resources[sParm]) {
value = sParm;
}
return value;
};

View file

@ -1011,6 +1011,7 @@ Disk.prototype.create = function(mode, nCylinders, nHeads, nSectors, cbSector)
* @param {File} [file] is set if there's an associated File object
* @param {function(...)} [fnNotify]
* @param {Component} [controller]
* @return {boolean} true if load completed (successfully or not), false if queued
*/
Disk.prototype.load = function(sDiskName, sDiskPath, file, fnNotify, controller)
{
@ -1027,7 +1028,7 @@ Disk.prototype.load = function(sDiskName, sDiskPath, file, fnNotify, controller)
if (this.fnNotify) {
if (DEBUG) this.controller.log('too many load requests for "' + sDiskName + '" (' + sDiskPath + ')');
return;
return true;
}
this.sDiskName = sDiskName;
@ -1044,7 +1045,7 @@ Disk.prototype.load = function(sDiskName, sDiskPath, file, fnNotify, controller)
disk.build(reader.result, true);
};
reader.readAsArrayBuffer(file);
return;
return true;
}
/*
@ -1098,7 +1099,8 @@ Disk.prototype.load = function(sDiskName, sDiskPath, file, fnNotify, controller)
}
}
}
web.loadResource(sDiskURL, true, null, this, this.doneLoad);
var result = web.loadResource(sDiskURL, true, null, this, this.doneLoad);
return result.length > 0;
};
/**

View file

@ -1332,8 +1332,9 @@ FDC.prototype.loadDiskette = function(iDrive, sDisketteName, sDiskettePath, fAut
}
drive.fLocal = !!file;
var disk = new Disk(this, drive, DiskAPI.MODE.PRELOAD);
disk.load(sDisketteName, sDiskettePath, file, this.doneLoadDiskette);
return false;
if (!disk.load(sDisketteName, sDiskettePath, file, this.doneLoadDiskette)) {
return false;
}
}
return true;
};