When a 'state' file is passed as a URL parameter, that's supposed to override a machine's 'resume' setting, but if a 'state' file is passed as EITHER a computer parameter (the original XML-based method) OR as a machine parameter (a newer method that allows a web page to override certain XML settings), that is NOT supposed to override the 'resume' setting. This restores the ability of the DONKEY.BAS demo to BOTH define a state file AND allow the machine to be suspended and resumed. Additionally, a new-ish Video card property (offStartAddr), which was originally added for the EGA/VGA, was not properly initialized for other cards, so when we restored the display of a suspended machine with a CGA, nothing would be displayed, due to lots of NaN buffer address calculations.

This commit is contained in:
Jeff Parsons 2017-06-22 17:45:36 -07:00 committed by Jeff Parsons
commit 0bd1be0df9
12 changed files with 1799 additions and 1779 deletions

View file

@ -261,9 +261,12 @@ class Computer extends Component {
* OVERRIDES everything; it overrides any 'state' Computer parameter AND it disables resume of any saved state in
* localStorage (in other words, it prevents fAllowResume from being true, and forcing resume off).
*/
var fAllowResume;
var sState = this.getMachineParm('state') || (fAllowResume = true) && parmsComputer['state'];
var fAllowResume = false;
var sState = Web.getURLParm('state');
if (!sState) {
fAllowResume = true;
sState = this.getMachineParm('state', parmsComputer);
}
if (sState) {
sStatePath = this.sStatePath = sState;
if (!fAllowResume) {
@ -524,13 +527,14 @@ class Computer extends Component {
*/
this.stateFailSafe = new State(this, PCX86.APPVERSION, Computer.STATE_FAILSAFE);
if (this.stateFailSafe.load()) {
this.powerReport(stateComputer);
/*
* We already know resume is something other than RESUME_NONE, so we'll go ahead and bump it
* all the way to RESUME_PROMPT, so that the user will be prompted, and if the user declines to
* restore, the state will be removed.
*/
resume = Computer.RESUME_PROMPT;
if (this.powerReport(stateComputer)) {
/*
* We already know resume is something other than RESUME_NONE, so we'll go ahead and bump it
* all the way to RESUME_PROMPT, so that the user will be prompted, and if the user declines to
* restore, the state will be removed.
*/
resume = Computer.RESUME_PROMPT;
}
/*
* To ensure that the set() below succeeds, we need to call unload(), otherwise it may fail
* with a "read only" error (eg, "TypeError: Cannot assign to read only property 'timestamp'").
@ -814,12 +818,17 @@ class Computer extends Component {
*
* @this {Computer}
* @param {State} stateComputer
* @return {boolean}
*/
powerReport(stateComputer)
{
if (Component.confirmUser("There may be a problem with your " + PCX86.APPNAME + " machine.\n\nTo help us diagnose it, click OK to send this " + PCX86.APPNAME + " machine state to http://" + SITEHOST + ".")) {
Web.sendReport(PCX86.APPNAME, PCX86.APPVERSION, this.url, this.getUserID(), ReportAPI.TYPE.BUG, stateComputer.toString());
if (!this.flags.unloading) {
if (Component.confirmUser("There may be a problem with your " + PCX86.APPNAME + " machine.\n\nTo help us diagnose it, click OK to send this " + PCX86.APPNAME + " machine state to http://" + SITEHOST + ".")) {
Web.sendReport(PCX86.APPNAME, PCX86.APPVERSION, this.url, this.getUserID(), ReportAPI.TYPE.BUG, stateComputer.toString());
}
return true;
}
return false;
}
/**

View file

@ -363,6 +363,7 @@ class Card {
this.regCRTData = data[5];
this.nCRTCRegs = Card.CRTC.TOTAL_REGS;
this.asCRTCRegs = DEBUGGER? Card.CRTC.REGS : [];
this.offStartAddr = ((this.regCRTData[Card.CRTC.START_ADDR_HI] << 8) + this.regCRTData[Card.CRTC.START_ADDR_LO])|0;
if (nCard >= Video.CARD.EGA) {
this.nCRTCRegs = Card.CRTC.EGA.TOTAL_REGS;