diff --git a/machines/dec/pdp10/releases/2.21/pdp10-uncompiled.js b/machines/dec/pdp10/releases/2.21/pdp10-uncompiled.js index a14e1c3cd..947f7c2e7 100644 --- a/machines/dec/pdp10/releases/2.21/pdp10-uncompiled.js +++ b/machines/dec/pdp10/releases/2.21/pdp10-uncompiled.js @@ -2518,13 +2518,14 @@ class WebLib { sURL = sURL.replace(/^\/(disks\/|)(diskettes|gamedisks|miscdisks|harddisks|decdisks|pcsigdisks|pcsig[0-9a-z]*-disks|private)\//, "https://$2.pcjs.org/").replace(/^\/(disks\/cdroms|discs)\/([^/]*)\//, "https://$2.pcjs.org/"); } + Component.printf(MESSAGE.DEBUG, "getResource(%s)\n", sURL); + /* * globals.node.readFileSync exists only when another module has import filelib.js, which means we're * running under Node.js, and we can use Node's file system to read local files. Note that filelib.js only * offers readFileSync() at the moment. */ if (globals.node.readFileSync && sURL.indexOf("http") != 0) { - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "reading: %s\n", sURL); try { let encoding = (type == "arraybuffer"? null : "utf8"); resource = globals.node.readFileSync(sURL, encoding); @@ -2571,7 +2572,7 @@ class WebLib { } else if (globals.window.ActiveXObject) { request = new globals.window.ActiveXObject("Microsoft.XMLHTTP"); } else if (globals.window.fetch) { - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "fetching: %s\n", sURL); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.fetch(%s)\n", sURL); fetch(sURL) .then(response => { switch(type) { @@ -2585,11 +2586,11 @@ class WebLib { } }) .then(resource => { - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "fetch %s complete: %d bytes\n", sURL, resource.length); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.fetch(%s): %d bytes\n", sURL, resource.length); if (done) done(sURL, resource, nErrorCode); }) .catch(error => { - Component.printf(MESSAGE.LOG, "fetch %s error: %d\n", sURL, nErrorCode); + Component.printf(MESSAGE.LOG, "getResource.fetch(%s) error: %d\n", sURL, nErrorCode); if (done) done(sURL, resource, nErrorCode); }); return response; @@ -2597,7 +2598,7 @@ class WebLib { let fArrayBuffer = false, fXHR2 = (typeof request.responseType === 'string'); - let callback = function() { + let callback = function getResourceDone() { if (request.readyState !== 4) { if (progress) progress(1); return null; @@ -2628,18 +2629,18 @@ class WebLib { try { resource = fArrayBuffer? request.response : request.responseText; } catch(err) { - Component.printf(MESSAGE.LOG, "xmlHTTPRequest(%s) exception: %s\n", sURL, err.message); + Component.printf(MESSAGE.LOG, "getResource.done(%s) exception: %s\n", sURL, err.message); } /* * The normal "success" case is a non-null resource and an HTTP status code of 200, but when loading files from the * local file system (ie, when using the "file:" protocol), we have to be a bit more flexible. */ if (resource != null && (request.status == 200 || !request.status && resource.length && WebLib.getHostProtocol() == "file:")) { - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "xmlHTTPRequest(%s): returned %d bytes\n", sURL, resource.length); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.done(%s): %d bytes\n", sURL, resource.length); } else { nErrorCode = request.status || -1; - Component.printf(MESSAGE.LOG, "xmlHTTPRequest(%s) returned error %d\n", sURL, nErrorCode); + Component.printf(MESSAGE.DEBUG, "getResource.done(%s) error: %d\n", sURL, nErrorCode); if (!request.status && !WebLib.fAdBlockerWarning) { let match = sURL.match(/(^https?:\/\/[^/]+)(.*)/); if (match) { @@ -2667,12 +2668,12 @@ class WebLib { sPost += p + '=' + encodeURIComponent(type[p]); } sPost = sPost.replace(/%20/g, '+'); - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "posting: %s (%d bytes)\n", sURL, sPost.length); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.post(%s): %d bytes\n", sURL, sPost.length); request.open("POST", sURL, fAsync); request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); request.send(sPost); } else { - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "requesting: %s\n", sURL); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.get(%s)\n", sURL); request.open("GET", sURL, fAsync); if (type == "arraybuffer") { if (fXHR2) { diff --git a/machines/dec/pdp10/releases/2.21/pdp10.js b/machines/dec/pdp10/releases/2.21/pdp10.js index c481fc4ef..ade39943e 100644 --- a/machines/dec/pdp10/releases/2.21/pdp10.js +++ b/machines/dec/pdp10/releases/2.21/pdp10.js @@ -57,12 +57,12 @@ function Va(a,b,c,d,e){e=void 0===e?0:e;var f="";isNaN(a)||"number"!=typeof a?a= function $a(a,b){b?11=Math.abs(a)?5:11;return Va(a,10,b)}function ab(a,b,c){b?9=b?4:4294967295>=b?8:9);return Va(a,16,b,c?"0x":"")}function bb(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0"'$]/g,function(b){return fb[b]})}function gb(a,b){return(a+" ").slice(0,b)}function hb(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var fb={"&":"&","<":"<",">":">",'"':""","'":"'",$:"$"},ib=new Ha,jb=ib.B.bind(ib); function kb(a,b,c){var d=0,e=a.length,f=0;for(void 0===c&&(c=function(k,l){return k>l?1:k>1,h=void 0;h=c(b,a[g]);0a.indexOf("?")&&(a=encodeURI(a));if(q.XMLHttpRequest)var l=new q.XMLHttpRequest;else if(q.ActiveXObject)l=new q.ActiveXObject("Microsoft.XMLHTTP");else if(q.fetch)return w(2267742732288,"fetching: %s\n",a),fetch(a).then(function(p){switch(b){case "json":case "text":return p.text();case "arraybuffer":return p.arrayBuffer();default:throw Error("unsupported response type: "+b);}}).then(function(p){w(2267742732288,"fetch %s complete: %d bytes\n", -a,p.length);d&&d(a,p,f)}).catch(function(){w(68719476736,"fetch %s error: %d\n",a,f);d&&d(a,g,f)}),h;var m=!1;k="string"===typeof l.responseType;c&&(l.onreadystatechange=e);if(b&&"object"==typeof b){k="";for(var r in b)b.hasOwnProperty(r)&&(k&&(k+="&"),k+=r+"="+encodeURIComponent(b[r]));k=k.replace(/%20/g,"+");w(2267742732288,"posting: %s (%d bytes)\n",a,k.length);l.open("POST",a,c);l.setRequestHeader("Content-type","application/x-www-form-urlencoded");l.send(k)}else w(2267742732288,"requesting: %s\n", -a),l.open("GET",a,c),"arraybuffer"==b&&(k?(m=!0,l.responseType=b):l.overrideMimeType("text/plain; charset=x-user-defined")),l.send();c||(l.readyState=4,h=e());return h} +"/disks/$1/").replace(/^\/discs\/([^/]*)\//,"/disks/cdroms/$1/"):a.replace(/^\/(disks\/|)(diskettes|gamedisks|miscdisks|harddisks|decdisks|pcsigdisks|pcsig[0-9a-z]*-disks|private)\//,"https://$2.pcjs.org/").replace(/^\/(disks\/cdroms|discs)\/([^/]*)\//,"https://$2.pcjs.org/");w(2199023255552,"getResource(%s)\n",a);if(Fa.dc&&0!=a.indexOf("http")){try{k="arraybuffer"==b?null:"utf8",g=Fa.dc(a,k),k||(g=g.buffer,g.buffer&&(g=g.buffer))}catch(p){f=p.errno}if(void 0!==g)return d&&d(a,g,f),[g,f]}if(0==a.indexOf(Sa)&& +(k=Ra(a)))return g=k.data,d&&d(a,g,f),[g,f];!a.match(/^[A-Z]:/i)&&0>a.indexOf("?")&&(a=encodeURI(a));if(q.XMLHttpRequest)var l=new q.XMLHttpRequest;else if(q.ActiveXObject)l=new q.ActiveXObject("Microsoft.XMLHTTP");else if(q.fetch)return w(2267742732288,"getResource.fetch(%s)\n",a),fetch(a).then(function(p){switch(b){case "json":case "text":return p.text();case "arraybuffer":return p.arrayBuffer();default:throw Error("unsupported response type: "+b);}}).then(function(p){w(2267742732288,"getResource.fetch(%s): %d bytes\n", +a,p.length);d&&d(a,p,f)}).catch(function(){w(68719476736,"getResource.fetch(%s) error: %d\n",a,f);d&&d(a,g,f)}),h;var m=!1;k="string"===typeof l.responseType;c&&(l.onreadystatechange=e);if(b&&"object"==typeof b){k="";for(var r in b)b.hasOwnProperty(r)&&(k&&(k+="&"),k+=r+"="+encodeURIComponent(b[r]));k=k.replace(/%20/g,"+");w(2267742732288,"getResource.post(%s): %d bytes\n",a,k.length);l.open("POST",a,c);l.setRequestHeader("Content-type","application/x-www-form-urlencoded");l.send(k)}else w(2267742732288, +"getResource.get(%s)\n",a),l.open("GET",a,c),"arraybuffer"==b&&(k?(m=!0,l.responseType=b):l.overrideMimeType("text/plain; charset=x-user-defined")),l.send();c||(l.readyState=4,h=e());return h} function pb(a,b){var c,d={fa:null,aa:null,ma:null,ya:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f;if("<"==b.charAt(0))throw Error(b);if(0>b.indexOf("0x")&&0>b.indexOf("0o")&&'["'!=b.substr(0,2)){0>b.indexOf('"values"')&&(b=b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,""));var g=JSON.parse(b)}else g=eval("("+b+")");d.ma=g.load;d.ya=g.exec;var h=g.width,k=g.values;h&&k&&(8==h?g.bytes=k:16==h?g.words=k:32==h?g.longs=k:g.data=k);if(e=g.bytes)d.fa=e;else if(e=g.words)for(d.fa=Array(2* e.length),f=c=0;c>8&255;else if(e=g.longs)for(d.fa=Array(4*e.length),f=c=0;c>8&255,d.fa[f++]=e[c]>>16&255,d.fa[f++]=e[c]>>24&255;else(e=g.data)?d.Oa=e:d.fa=g;d.fa&&(d.fa.length?1==d.fa.length&&(qb(d.fa[0]),d=null):(qb("Empty resource: "+a),d=null));d.aa=g.symbols}catch(l){qb("Resource data error ("+a+"): "+l.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;c { switch(type) { @@ -2824,11 +2825,11 @@ class WebLib { } }) .then(resource => { - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "fetch %s complete: %d bytes\n", sURL, resource.length); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.fetch(%s): %d bytes\n", sURL, resource.length); if (done) done(sURL, resource, nErrorCode); }) .catch(error => { - Component.printf(MESSAGE.LOG, "fetch %s error: %d\n", sURL, nErrorCode); + Component.printf(MESSAGE.LOG, "getResource.fetch(%s) error: %d\n", sURL, nErrorCode); if (done) done(sURL, resource, nErrorCode); }); return response; @@ -2836,7 +2837,7 @@ class WebLib { let fArrayBuffer = false, fXHR2 = (typeof request.responseType === 'string'); - let callback = function() { + let callback = function getResourceDone() { if (request.readyState !== 4) { if (progress) progress(1); return null; @@ -2867,18 +2868,18 @@ class WebLib { try { resource = fArrayBuffer? request.response : request.responseText; } catch(err) { - Component.printf(MESSAGE.LOG, "xmlHTTPRequest(%s) exception: %s\n", sURL, err.message); + Component.printf(MESSAGE.LOG, "getResource.done(%s) exception: %s\n", sURL, err.message); } /* * The normal "success" case is a non-null resource and an HTTP status code of 200, but when loading files from the * local file system (ie, when using the "file:" protocol), we have to be a bit more flexible. */ if (resource != null && (request.status == 200 || !request.status && resource.length && WebLib.getHostProtocol() == "file:")) { - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "xmlHTTPRequest(%s): returned %d bytes\n", sURL, resource.length); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.done(%s): %d bytes\n", sURL, resource.length); } else { nErrorCode = request.status || -1; - Component.printf(MESSAGE.LOG, "xmlHTTPRequest(%s) returned error %d\n", sURL, nErrorCode); + Component.printf(MESSAGE.DEBUG, "getResource.done(%s) error: %d\n", sURL, nErrorCode); if (!request.status && !WebLib.fAdBlockerWarning) { let match = sURL.match(/(^https?:\/\/[^/]+)(.*)/); if (match) { @@ -2906,12 +2907,12 @@ class WebLib { sPost += p + '=' + encodeURIComponent(type[p]); } sPost = sPost.replace(/%20/g, '+'); - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "posting: %s (%d bytes)\n", sURL, sPost.length); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.post(%s): %d bytes\n", sURL, sPost.length); request.open("POST", sURL, fAsync); request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); request.send(sPost); } else { - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "requesting: %s\n", sURL); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.get(%s)\n", sURL); request.open("GET", sURL, fAsync); if (type == "arraybuffer") { if (fXHR2) { diff --git a/machines/dec/pdp11/releases/2.21/pdp11.js b/machines/dec/pdp11/releases/2.21/pdp11.js index 2f8ad475c..7ccc1fa29 100644 --- a/machines/dec/pdp11/releases/2.21/pdp11.js +++ b/machines/dec/pdp11/releases/2.21/pdp11.js @@ -67,12 +67,12 @@ function Na(a,b,c){b?12=b?6:16777215>=b?8:12) function Ta(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase(),"json5"==b&&(b="json"));return b}function Ua(a,b){return-1!==a.indexOf(b,a.length-b.length)}function Va(a){return a.replace(/[&<>"'$]/g,function(b){return Wa[b]})}function Xa(a,b){return(a+" ").slice(0,b)}function Ya(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")} var Wa={"&":"&","<":"<",">":">",'"':""","'":"'",$:"$"},Za={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",10:"LF",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US",127:"DEL"},$a=new ya,ab=$a.g.bind($a); function eb(a,b,c){var d=0,e=a.length,f=0;for(void 0===c&&(c=function(l,m){return l>m?1:l>1,h=void 0;h=c(b,a[g]);0a.indexOf("?")&&(a=encodeURI(a));if(v.XMLHttpRequest)var m=new v.XMLHttpRequest;else if(v.ActiveXObject)m=new v.ActiveXObject("Microsoft.XMLHTTP");else if(v.fetch)return B(2267742732288,"fetching: %s\n",a),fetch(a).then(function(p){switch(b){case "json":case "text":return p.text();case "arraybuffer":return p.arrayBuffer();default:throw Error("unsupported response type: "+b);}}).then(function(p){B(2267742732288,"fetch %s complete: %d bytes\n", -a,p.length);d&&d(a,p,f)}).catch(function(){B(68719476736,"fetch %s error: %d\n",a,f);d&&d(a,g,f)}),h;var n=!1;l="string"===typeof m.responseType;c&&(m.onreadystatechange=e);if(b&&"object"==typeof b){l="";for(var r in b)b.hasOwnProperty(r)&&(l&&(l+="&"),l+=r+"="+encodeURIComponent(b[r]));l=l.replace(/%20/g,"+");B(2267742732288,"posting: %s (%d bytes)\n",a,l.length);m.open("POST",a,c);m.setRequestHeader("Content-type","application/x-www-form-urlencoded");m.send(l)}else B(2267742732288,"requesting: %s\n", -a),m.open("GET",a,c),"arraybuffer"==b&&(l?(n=!0,m.responseType=b):m.overrideMimeType("text/plain; charset=x-user-defined")),m.send();c||(m.readyState=4,h=e());return h} +"/disks/$1/").replace(/^\/discs\/([^/]*)\//,"/disks/cdroms/$1/"):a.replace(/^\/(disks\/|)(diskettes|gamedisks|miscdisks|harddisks|decdisks|pcsigdisks|pcsig[0-9a-z]*-disks|private)\//,"https://$2.pcjs.org/").replace(/^\/(disks\/cdroms|discs)\/([^/]*)\//,"https://$2.pcjs.org/");B(2199023255552,"getResource(%s)\n",a);if(ta.Vf&&0!=a.indexOf("http")){try{l="arraybuffer"==b?null:"utf8",g=ta.Vf(a,l),l||(g=g.buffer,g.buffer&&(g=g.buffer))}catch(p){f=p.errno}if(void 0!==g)return d&&d(a,g,f),[g,f]}if(0==a.indexOf(Ha)&& +(l=Ga(a)))return g=l.data,d&&d(a,g,f),[g,f];!a.match(/^[A-Z]:/i)&&0>a.indexOf("?")&&(a=encodeURI(a));if(v.XMLHttpRequest)var m=new v.XMLHttpRequest;else if(v.ActiveXObject)m=new v.ActiveXObject("Microsoft.XMLHTTP");else if(v.fetch)return B(2267742732288,"getResource.fetch(%s)\n",a),fetch(a).then(function(p){switch(b){case "json":case "text":return p.text();case "arraybuffer":return p.arrayBuffer();default:throw Error("unsupported response type: "+b);}}).then(function(p){B(2267742732288,"getResource.fetch(%s): %d bytes\n", +a,p.length);d&&d(a,p,f)}).catch(function(){B(68719476736,"getResource.fetch(%s) error: %d\n",a,f);d&&d(a,g,f)}),h;var n=!1;l="string"===typeof m.responseType;c&&(m.onreadystatechange=e);if(b&&"object"==typeof b){l="";for(var r in b)b.hasOwnProperty(r)&&(l&&(l+="&"),l+=r+"="+encodeURIComponent(b[r]));l=l.replace(/%20/g,"+");B(2267742732288,"getResource.post(%s): %d bytes\n",a,l.length);m.open("POST",a,c);m.setRequestHeader("Content-type","application/x-www-form-urlencoded");m.send(l)}else B(2267742732288, +"getResource.get(%s)\n",a),m.open("GET",a,c),"arraybuffer"==b&&(l?(n=!0,m.responseType=b):m.overrideMimeType("text/plain; charset=x-user-defined")),m.send();c||(m.readyState=4,h=e());return h} function jb(a,b){var c,d={ba:null,ga:null,ya:null,xa:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f;if("<"==b.charAt(0))throw Error(b);if(0>b.indexOf("0x")&&0>b.indexOf("0o")&&'["'!=b.substr(0,2)){0>b.indexOf('"values"')&&(b=b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,""));var g=JSON.parse(b)}else g=eval("("+b+")");d.ya=g.load;d.xa=g.exec;var h=g.width,l=g.values;h&&l&&(8==h?g.bytes=l:16==h?g.words=l:32==h?g.longs=l:g.data=l);if(e=g.bytes)d.ba=e;else if(e=g.words)for(d.ba=Array(2* e.length),f=c=0;c>8&255;else if(e=g.longs)for(d.ba=Array(4*e.length),f=c=0;c>8&255,d.ba[f++]=e[c]>>16&255,d.ba[f++]=e[c]>>24&255;else(e=g.data)?d.lk=e:d.ba=g;d.ba&&(d.ba.length?1==d.ba.length&&(D(d.ba[0]),d=null):(D("Empty resource: "+a),d=null));d.ga=g.symbols}catch(m){D("Resource data error ("+a+"): "+m.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;c { switch(type) { @@ -219,11 +220,11 @@ export default class WebLib { } }) .then(resource => { - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "fetch %s complete: %d bytes\n", sURL, resource.length); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.fetch(%s): %d bytes\n", sURL, resource.length); if (done) done(sURL, resource, nErrorCode); }) .catch(error => { - Component.printf(MESSAGE.LOG, "fetch %s error: %d\n", sURL, nErrorCode); + Component.printf(MESSAGE.LOG, "getResource.fetch(%s) error: %d\n", sURL, nErrorCode); if (done) done(sURL, resource, nErrorCode); }); return response; @@ -231,7 +232,7 @@ export default class WebLib { let fArrayBuffer = false, fXHR2 = (typeof request.responseType === 'string'); - let callback = function() { + let callback = function getResourceDone() { if (request.readyState !== 4) { if (progress) progress(1); return null; @@ -262,18 +263,18 @@ export default class WebLib { try { resource = fArrayBuffer? request.response : request.responseText; } catch(err) { - Component.printf(MESSAGE.LOG, "xmlHTTPRequest(%s) exception: %s\n", sURL, err.message); + Component.printf(MESSAGE.LOG, "getResource.done(%s) exception: %s\n", sURL, err.message); } /* * The normal "success" case is a non-null resource and an HTTP status code of 200, but when loading files from the * local file system (ie, when using the "file:" protocol), we have to be a bit more flexible. */ if (resource != null && (request.status == 200 || !request.status && resource.length && WebLib.getHostProtocol() == "file:")) { - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "xmlHTTPRequest(%s): returned %d bytes\n", sURL, resource.length); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.done(%s): %d bytes\n", sURL, resource.length); } else { nErrorCode = request.status || -1; - Component.printf(MESSAGE.LOG, "xmlHTTPRequest(%s) returned error %d\n", sURL, nErrorCode); + Component.printf(MESSAGE.DEBUG, "getResource.done(%s) error: %d\n", sURL, nErrorCode); if (!request.status && !WebLib.fAdBlockerWarning) { let match = sURL.match(/(^https?:\/\/[^/]+)(.*)/); if (match) { @@ -301,12 +302,12 @@ export default class WebLib { sPost += p + '=' + encodeURIComponent(type[p]); } sPost = sPost.replace(/%20/g, '+'); - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "posting: %s (%d bytes)\n", sURL, sPost.length); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.post(%s): %d bytes\n", sURL, sPost.length); request.open("POST", sURL, fAsync); request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); request.send(sPost); } else { - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "requesting: %s\n", sURL); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.get(%s)\n", sURL); request.open("GET", sURL, fAsync); if (type == "arraybuffer") { if (fXHR2) { diff --git a/machines/osi/c1p/releases/2.21/c1p-uncompiled.js b/machines/osi/c1p/releases/2.21/c1p-uncompiled.js index d93b9b207..d0bdb0a63 100644 --- a/machines/osi/c1p/releases/2.21/c1p-uncompiled.js +++ b/machines/osi/c1p/releases/2.21/c1p-uncompiled.js @@ -2159,13 +2159,14 @@ class WebLib { sURL = sURL.replace(/^\/(disks\/|)(diskettes|gamedisks|miscdisks|harddisks|decdisks|pcsigdisks|pcsig[0-9a-z]*-disks|private)\//, "https://$2.pcjs.org/").replace(/^\/(disks\/cdroms|discs)\/([^/]*)\//, "https://$2.pcjs.org/"); } + Component.printf(MESSAGE.DEBUG, "getResource(%s)\n", sURL); + /* * globals.node.readFileSync exists only when another module has import filelib.js, which means we're * running under Node.js, and we can use Node's file system to read local files. Note that filelib.js only * offers readFileSync() at the moment. */ if (globals.node.readFileSync && sURL.indexOf("http") != 0) { - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "reading: %s\n", sURL); try { let encoding = (type == "arraybuffer"? null : "utf8"); resource = globals.node.readFileSync(sURL, encoding); @@ -2212,7 +2213,7 @@ class WebLib { } else if (globals.window.ActiveXObject) { request = new globals.window.ActiveXObject("Microsoft.XMLHTTP"); } else if (globals.window.fetch) { - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "fetching: %s\n", sURL); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.fetch(%s)\n", sURL); fetch(sURL) .then(response => { switch(type) { @@ -2226,11 +2227,11 @@ class WebLib { } }) .then(resource => { - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "fetch %s complete: %d bytes\n", sURL, resource.length); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.fetch(%s): %d bytes\n", sURL, resource.length); if (done) done(sURL, resource, nErrorCode); }) .catch(error => { - Component.printf(MESSAGE.LOG, "fetch %s error: %d\n", sURL, nErrorCode); + Component.printf(MESSAGE.LOG, "getResource.fetch(%s) error: %d\n", sURL, nErrorCode); if (done) done(sURL, resource, nErrorCode); }); return response; @@ -2238,7 +2239,7 @@ class WebLib { let fArrayBuffer = false, fXHR2 = (typeof request.responseType === 'string'); - let callback = function() { + let callback = function getResourceDone() { if (request.readyState !== 4) { if (progress) progress(1); return null; @@ -2269,18 +2270,18 @@ class WebLib { try { resource = fArrayBuffer? request.response : request.responseText; } catch(err) { - Component.printf(MESSAGE.LOG, "xmlHTTPRequest(%s) exception: %s\n", sURL, err.message); + Component.printf(MESSAGE.LOG, "getResource.done(%s) exception: %s\n", sURL, err.message); } /* * The normal "success" case is a non-null resource and an HTTP status code of 200, but when loading files from the * local file system (ie, when using the "file:" protocol), we have to be a bit more flexible. */ if (resource != null && (request.status == 200 || !request.status && resource.length && WebLib.getHostProtocol() == "file:")) { - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "xmlHTTPRequest(%s): returned %d bytes\n", sURL, resource.length); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.done(%s): %d bytes\n", sURL, resource.length); } else { nErrorCode = request.status || -1; - Component.printf(MESSAGE.LOG, "xmlHTTPRequest(%s) returned error %d\n", sURL, nErrorCode); + Component.printf(MESSAGE.DEBUG, "getResource.done(%s) error: %d\n", sURL, nErrorCode); if (!request.status && !WebLib.fAdBlockerWarning) { let match = sURL.match(/(^https?:\/\/[^/]+)(.*)/); if (match) { @@ -2308,12 +2309,12 @@ class WebLib { sPost += p + '=' + encodeURIComponent(type[p]); } sPost = sPost.replace(/%20/g, '+'); - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "posting: %s (%d bytes)\n", sURL, sPost.length); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.post(%s): %d bytes\n", sURL, sPost.length); request.open("POST", sURL, fAsync); request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); request.send(sPost); } else { - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "requesting: %s\n", sURL); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.get(%s)\n", sURL); request.open("GET", sURL, fAsync); if (type == "arraybuffer") { if (fXHR2) { diff --git a/machines/osi/c1p/releases/2.21/c1p.js b/machines/osi/c1p/releases/2.21/c1p.js index 800d4d1e4..d89933edf 100644 --- a/machines/osi/c1p/releases/2.21/c1p.js +++ b/machines/osi/c1p/releases/2.21/c1p.js @@ -44,11 +44,11 @@ function Ba(a){var b=null,c=0==a.indexOf(Ca)?y.files:null;if(c){a=a.slice(Ca.len function z(a,b,c){b?9=b?4:4294967295>=b?8:9);c=c?"0x":"";var d=void 0===d?0:d;var e="";isNaN(a)||"number"!=typeof a?a=null:(0>a&&-1a&&(a+=Math.pow(16,b)),a>=Math.pow(16,b)&&(b=Math.ceil(Math.log(a)/Math.log(16))));for(var f=d||-1;0=h?48:55;e=String.fromCharCode(h)+e;a=Math.trunc(a/16)}f--}return(void 0===c?"":c)+e} function Ea(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0"'$]/g,function(b){return Ha[b]})}var Ha={"&":"&","<":"<",">":">",'"':""","'":"'",$:"$"},Ia=new ua,Ja=Ia.h.bind(Ia); function B(a,b){var c=null,d=!0;c=void 0===c?"text":c;d=void 0===d?!1:d;var e=0,f=null,h=w.resources;if("object"==typeof h&&(f=h[a]))b&&b(a,f,e);else if(d&&"function"==typeof h)h(a,function(q,n){b&&b(a,q,n)});else{a=w.LOCALDISKS&&(w.location?w.location.hostname:"localhost").match(/^(.+\.local|localhost|0\.0\.0\.0|pcjs)$/)?a.replace(/^\/(diskettes|gamedisks|miscdisks|harddisks|decdisks|pcsigdisks|pcsig[0-9a-z]*-disks|private)\//,"/disks/$1/").replace(/^\/discs\/([^/]*)\//,"/disks/cdroms/$1/"):a.replace(/^\/(disks\/|)(diskettes|gamedisks|miscdisks|harddisks|decdisks|pcsigdisks|pcsig[0-9a-z]*-disks|private)\//, -"https://$2.pcjs.org/").replace(/^\/(disks\/cdroms|discs)\/([^/]*)\//,"https://$2.pcjs.org/");if(sa.Ae&&0!=a.indexOf("http")){C(2267742732288,"reading: %s\n",a);try{h="arraybuffer"==c?null:"utf8",f=sa.Ae(a,h),h||(f=f.buffer,f.buffer&&(f=f.buffer))}catch(q){e=q.errno}if(void 0!==f){b&&b(a,f,e);return}}if(0==a.indexOf(Ca)&&(h=Ba(a))){f=h.data;b&&b(a,f,e);return}!a.match(/^[A-Z]:/i)&&0>a.indexOf("?")&&(a=encodeURI(a));if(w.XMLHttpRequest)var k=new w.XMLHttpRequest;else if(w.ActiveXObject)k=new w.ActiveXObject("Microsoft.XMLHTTP"); -else if(w.fetch){C(2267742732288,"fetching: %s\n",a);fetch(a).then(function(q){switch(c){case "json":case "text":return q.text();case "arraybuffer":return q.arrayBuffer();default:throw Error("unsupported response type: "+c);}}).then(function(q){C(2267742732288,"fetch %s complete: %d bytes\n",a,q.length);b&&b(a,q,e)}).catch(function(){C(68719476736,"fetch %s error: %d\n",a,e);b&&b(a,f,e)});return}var l=!1,p="string"===typeof k.responseType;h=function(){if(4!==k.readyState)return null;try{f=l?k.response: -k.responseText}catch(n){C(68719476736,"xmlHTTPRequest(%s) exception: %s\n",a,n.message)}if(null!=f&&(200==k.status||!k.status&&f.length&&"file:"==(w.location?w.location.protocol:"file:")))C(2267742732288,"xmlHTTPRequest(%s): returned %d bytes\n",a,f.length);else if(e=k.status||-1,C(68719476736,"xmlHTTPRequest(%s) returned error %d\n",a,e),!k.status&&!Ka){var q=a.match(/(^https?:\/\/[^/]+)(.*)/);q&&(Ka=!0,La("PCjs was unable to perform a cross-origin resource request to '"+q[1]+"'.\n\nIf you're running an ad blocker, try adding '"+ -Ma()+"' to your whitelist (or find a smarter ad blocker)."))}b&&b(a,f,e);return[f,e]};d&&(k.onreadystatechange=h);if(c&&"object"==typeof c){p="";for(var m in c)c.hasOwnProperty(m)&&(p&&(p+="&"),p+=m+"="+encodeURIComponent(c[m]));p=p.replace(/%20/g,"+");C(2267742732288,"posting: %s (%d bytes)\n",a,p.length);k.open("POST",a,d);k.setRequestHeader("Content-type","application/x-www-form-urlencoded");k.send(p)}else C(2267742732288,"requesting: %s\n",a),k.open("GET",a,d),"arraybuffer"==c&&(p?(l=!0,k.responseType= -c):k.overrideMimeType("text/plain; charset=x-user-defined")),k.send();d||(k.readyState=4,h())}}function Ma(){return w.location?w.location.protocol+"//"+w.location.host:"https://www.pcjs.org"}function D(a){if(w.navigator){var b=w.navigator?w.navigator.userAgent:"";return"iOS"==a&&(!!b.match(/(iPod|iPhone|iPad)/)||"MacIntel"===w.navigator.platform&&1a.indexOf("?")&&(a=encodeURI(a));if(w.XMLHttpRequest)var k=new w.XMLHttpRequest;else if(w.ActiveXObject)k=new w.ActiveXObject("Microsoft.XMLHTTP"); +else if(w.fetch){C(2267742732288,"getResource.fetch(%s)\n",a);fetch(a).then(function(q){switch(c){case "json":case "text":return q.text();case "arraybuffer":return q.arrayBuffer();default:throw Error("unsupported response type: "+c);}}).then(function(q){C(2267742732288,"getResource.fetch(%s): %d bytes\n",a,q.length);b&&b(a,q,e)}).catch(function(){C(68719476736,"getResource.fetch(%s) error: %d\n",a,e);b&&b(a,f,e)});return}var l=!1,p="string"===typeof k.responseType;h=function(){if(4!==k.readyState)return null; +try{f=l?k.response:k.responseText}catch(n){C(68719476736,"getResource.done(%s) exception: %s\n",a,n.message)}if(null!=f&&(200==k.status||!k.status&&f.length&&"file:"==(w.location?w.location.protocol:"file:")))C(2267742732288,"getResource.done(%s): %d bytes\n",a,f.length);else if(e=k.status||-1,C(2199023255552,"getResource.done(%s) error: %d\n",a,e),!k.status&&!Ka){var q=a.match(/(^https?:\/\/[^/]+)(.*)/);q&&(Ka=!0,La("PCjs was unable to perform a cross-origin resource request to '"+q[1]+"'.\n\nIf you're running an ad blocker, try adding '"+ +Ma()+"' to your whitelist (or find a smarter ad blocker)."))}b&&b(a,f,e);return[f,e]};d&&(k.onreadystatechange=h);if(c&&"object"==typeof c){p="";for(var m in c)c.hasOwnProperty(m)&&(p&&(p+="&"),p+=m+"="+encodeURIComponent(c[m]));p=p.replace(/%20/g,"+");C(2267742732288,"getResource.post(%s): %d bytes\n",a,p.length);k.open("POST",a,d);k.setRequestHeader("Content-type","application/x-www-form-urlencoded");k.send(p)}else C(2267742732288,"getResource.get(%s)\n",a),k.open("GET",a,d),"arraybuffer"==c&&(p? +(l=!0,k.responseType=c):k.overrideMimeType("text/plain; charset=x-user-defined")),k.send();d||(k.readyState=4,h())}}function Ma(){return w.location?w.location.protocol+"//"+w.location.host:"https://www.pcjs.org"}function D(a){if(w.navigator){var b=w.navigator?w.navigator.userAgent:"";return"iOS"==a&&(!!b.match(/(iPod|iPhone|iPad)/)||"MacIntel"===w.navigator.platform&&1 { switch(type) { @@ -2585,11 +2586,11 @@ class WebLib { } }) .then(resource => { - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "fetch %s complete: %d bytes\n", sURL, resource.length); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.fetch(%s): %d bytes\n", sURL, resource.length); if (done) done(sURL, resource, nErrorCode); }) .catch(error => { - Component.printf(MESSAGE.LOG, "fetch %s error: %d\n", sURL, nErrorCode); + Component.printf(MESSAGE.LOG, "getResource.fetch(%s) error: %d\n", sURL, nErrorCode); if (done) done(sURL, resource, nErrorCode); }); return response; @@ -2597,7 +2598,7 @@ class WebLib { let fArrayBuffer = false, fXHR2 = (typeof request.responseType === 'string'); - let callback = function() { + let callback = function getResourceDone() { if (request.readyState !== 4) { if (progress) progress(1); return null; @@ -2628,18 +2629,18 @@ class WebLib { try { resource = fArrayBuffer? request.response : request.responseText; } catch(err) { - Component.printf(MESSAGE.LOG, "xmlHTTPRequest(%s) exception: %s\n", sURL, err.message); + Component.printf(MESSAGE.LOG, "getResource.done(%s) exception: %s\n", sURL, err.message); } /* * The normal "success" case is a non-null resource and an HTTP status code of 200, but when loading files from the * local file system (ie, when using the "file:" protocol), we have to be a bit more flexible. */ if (resource != null && (request.status == 200 || !request.status && resource.length && WebLib.getHostProtocol() == "file:")) { - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "xmlHTTPRequest(%s): returned %d bytes\n", sURL, resource.length); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.done(%s): %d bytes\n", sURL, resource.length); } else { nErrorCode = request.status || -1; - Component.printf(MESSAGE.LOG, "xmlHTTPRequest(%s) returned error %d\n", sURL, nErrorCode); + Component.printf(MESSAGE.DEBUG, "getResource.done(%s) error: %d\n", sURL, nErrorCode); if (!request.status && !WebLib.fAdBlockerWarning) { let match = sURL.match(/(^https?:\/\/[^/]+)(.*)/); if (match) { @@ -2667,12 +2668,12 @@ class WebLib { sPost += p + '=' + encodeURIComponent(type[p]); } sPost = sPost.replace(/%20/g, '+'); - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "posting: %s (%d bytes)\n", sURL, sPost.length); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.post(%s): %d bytes\n", sURL, sPost.length); request.open("POST", sURL, fAsync); request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); request.send(sPost); } else { - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "requesting: %s\n", sURL); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.get(%s)\n", sURL); request.open("GET", sURL, fAsync); if (type == "arraybuffer") { if (fXHR2) { diff --git a/machines/pcx80/releases/2.21/pcx80.js b/machines/pcx80/releases/2.21/pcx80.js index 950eee2a5..99ea00395 100644 --- a/machines/pcx80/releases/2.21/pcx80.js +++ b/machines/pcx80/releases/2.21/pcx80.js @@ -59,12 +59,12 @@ function Oa(a,b,c,d,e){e=void 0===e?0:e;var f="";isNaN(a)||"number"!=typeof a?a= function Pa(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0"'$]/g,function(b){return Va[b]})}function Wa(a,b){return(a+" ").slice(0,b)} function Xa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var Va={"&":"&","<":"<",">":">",'"':""","'":"'",$:"$"},Ya={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",10:"LF",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US",127:"DEL"},Za=new Aa,$a=Za.i.bind(Za); function ab(a,b,c){var d=0,e=a.length,f=0;for(void 0===c&&(c=function(k,l){return k>l?1:k>1,h=void 0;h=c(b,a[g]);0c&&(c+=a.length);0>c&&(c=0);for(var d=a.length;ca.indexOf("?")&&(a=encodeURI(a));if(n.XMLHttpRequest)var l=new n.XMLHttpRequest;else if(n.ActiveXObject)l=new n.ActiveXObject("Microsoft.XMLHTTP");else if(n.fetch)return x(2267742732288,"fetching: %s\n",a),fetch(a).then(function(q){switch(b){case "json":case "text":return q.text();case "arraybuffer":return q.arrayBuffer();default:throw Error("unsupported response type: "+b);}}).then(function(q){x(2267742732288,"fetch %s complete: %d bytes\n", -a,q.length);d&&d(a,q,f)}).catch(function(){x(68719476736,"fetch %s error: %d\n",a,f);d&&d(a,g,f)}),h;var r=!1;k="string"===typeof l.responseType;c&&(l.onreadystatechange=e);if(b&&"object"==typeof b){k="";for(var u in b)b.hasOwnProperty(u)&&(k&&(k+="&"),k+=u+"="+encodeURIComponent(b[u]));k=k.replace(/%20/g,"+");x(2267742732288,"posting: %s (%d bytes)\n",a,k.length);l.open("POST",a,c);l.setRequestHeader("Content-type","application/x-www-form-urlencoded");l.send(k)}else x(2267742732288,"requesting: %s\n", -a),l.open("GET",a,c),"arraybuffer"==b&&(k?(r=!0,l.responseType=b):l.overrideMimeType("text/plain; charset=x-user-defined")),l.send();c||(l.readyState=4,h=e());return h} +"/disks/$1/").replace(/^\/discs\/([^/]*)\//,"/disks/cdroms/$1/"):a.replace(/^\/(disks\/|)(diskettes|gamedisks|miscdisks|harddisks|decdisks|pcsigdisks|pcsig[0-9a-z]*-disks|private)\//,"https://$2.pcjs.org/").replace(/^\/(disks\/cdroms|discs)\/([^/]*)\//,"https://$2.pcjs.org/");x(2199023255552,"getResource(%s)\n",a);if(xa.ie&&0!=a.indexOf("http")){try{k="arraybuffer"==b?null:"utf8",g=xa.ie(a,k),k||(g=g.buffer,g.buffer&&(g=g.buffer))}catch(q){f=q.errno}if(void 0!==g)return d&&d(a,g,f),[g,f]}if(0==a.indexOf(La)&& +(k=Ka(a)))return g=k.data,d&&d(a,g,f),[g,f];!a.match(/^[A-Z]:/i)&&0>a.indexOf("?")&&(a=encodeURI(a));if(n.XMLHttpRequest)var l=new n.XMLHttpRequest;else if(n.ActiveXObject)l=new n.ActiveXObject("Microsoft.XMLHTTP");else if(n.fetch)return x(2267742732288,"getResource.fetch(%s)\n",a),fetch(a).then(function(q){switch(b){case "json":case "text":return q.text();case "arraybuffer":return q.arrayBuffer();default:throw Error("unsupported response type: "+b);}}).then(function(q){x(2267742732288,"getResource.fetch(%s): %d bytes\n", +a,q.length);d&&d(a,q,f)}).catch(function(){x(68719476736,"getResource.fetch(%s) error: %d\n",a,f);d&&d(a,g,f)}),h;var r=!1;k="string"===typeof l.responseType;c&&(l.onreadystatechange=e);if(b&&"object"==typeof b){k="";for(var u in b)b.hasOwnProperty(u)&&(k&&(k+="&"),k+=u+"="+encodeURIComponent(b[u]));k=k.replace(/%20/g,"+");x(2267742732288,"getResource.post(%s): %d bytes\n",a,k.length);l.open("POST",a,c);l.setRequestHeader("Content-type","application/x-www-form-urlencoded");l.send(k)}else x(2267742732288, +"getResource.get(%s)\n",a),l.open("GET",a,c),"arraybuffer"==b&&(k?(r=!0,l.responseType=b):l.overrideMimeType("text/plain; charset=x-user-defined")),l.send();c||(l.readyState=4,h=e());return h} function jb(a,b){var c,d={oa:null,sa:null,Na:null,Fa:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f;if("<"==b.charAt(0))throw Error(b);if(0>b.indexOf("0x")&&0>b.indexOf("0o")&&'["'!=b.substr(0,2)){0>b.indexOf('"values"')&&(b=b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,""));var g=JSON.parse(b)}else g=eval("("+b+")");d.Na=g.load;d.Fa=g.exec;var h=g.width,k=g.values;h&&k&&(8==h?g.bytes=k:16==h?g.words=k:32==h?g.longs=k:g.data=k);if(e=g.bytes)d.oa=e;else if(e=g.words)for(d.oa=Array(2* e.length),f=c=0;c>8&255;else if(e=g.longs)for(d.oa=Array(4*e.length),f=c=0;c>8&255,d.oa[f++]=e[c]>>16&255,d.oa[f++]=e[c]>>24&255;else(e=g.data)?d.Sf=e:d.oa=g;d.oa&&(d.oa.length?1==d.oa.length&&(kb(d.oa[0]),d=null):(kb("Empty resource: "+a),d=null));d.sa=g.symbols}catch(l){kb("Resource data error ("+a+"): "+l.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;c { switch(type) { @@ -3185,11 +3186,11 @@ class WebLib { } }) .then(resource => { - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "fetch %s complete: %d bytes\n", sURL, resource.length); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.fetch(%s): %d bytes\n", sURL, resource.length); if (done) done(sURL, resource, nErrorCode); }) .catch(error => { - Component.printf(MESSAGE.LOG, "fetch %s error: %d\n", sURL, nErrorCode); + Component.printf(MESSAGE.LOG, "getResource.fetch(%s) error: %d\n", sURL, nErrorCode); if (done) done(sURL, resource, nErrorCode); }); return response; @@ -3197,7 +3198,7 @@ class WebLib { let fArrayBuffer = false, fXHR2 = (typeof request.responseType === 'string'); - let callback = function() { + let callback = function getResourceDone() { if (request.readyState !== 4) { if (progress) progress(1); return null; @@ -3228,18 +3229,18 @@ class WebLib { try { resource = fArrayBuffer? request.response : request.responseText; } catch(err) { - Component.printf(MESSAGE.LOG, "xmlHTTPRequest(%s) exception: %s\n", sURL, err.message); + Component.printf(MESSAGE.LOG, "getResource.done(%s) exception: %s\n", sURL, err.message); } /* * The normal "success" case is a non-null resource and an HTTP status code of 200, but when loading files from the * local file system (ie, when using the "file:" protocol), we have to be a bit more flexible. */ if (resource != null && (request.status == 200 || !request.status && resource.length && WebLib.getHostProtocol() == "file:")) { - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "xmlHTTPRequest(%s): returned %d bytes\n", sURL, resource.length); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.done(%s): %d bytes\n", sURL, resource.length); } else { nErrorCode = request.status || -1; - Component.printf(MESSAGE.LOG, "xmlHTTPRequest(%s) returned error %d\n", sURL, nErrorCode); + Component.printf(MESSAGE.DEBUG, "getResource.done(%s) error: %d\n", sURL, nErrorCode); if (!request.status && !WebLib.fAdBlockerWarning) { let match = sURL.match(/(^https?:\/\/[^/]+)(.*)/); if (match) { @@ -3267,12 +3268,12 @@ class WebLib { sPost += p + '=' + encodeURIComponent(type[p]); } sPost = sPost.replace(/%20/g, '+'); - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "posting: %s (%d bytes)\n", sURL, sPost.length); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.post(%s): %d bytes\n", sURL, sPost.length); request.open("POST", sURL, fAsync); request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); request.send(sPost); } else { - Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "requesting: %s\n", sURL); + Component.printf(MESSAGE.DEBUG + MESSAGE.LOG, "getResource.get(%s)\n", sURL); request.open("GET", sURL, fAsync); if (type == "arraybuffer") { if (fXHR2) { @@ -60329,7 +60330,7 @@ class SerialPort extends Component { } /** - * receiveData(data) + * receiveData(data, flush) * * This replaces the old sendRBR() function, which expected an Array of bytes. We still support that, * but in order to support connections with other SerialPort components (ie, the PCx80 SerialPort), we @@ -60338,10 +60339,24 @@ class SerialPort extends Component { * * @this {SerialPort} * @param {number|string|Array} [data] + * @param {boolean} [flush] * @returns {boolean} true if received, false if not */ - receiveData(data) + receiveData(data, flush) { + if (flush) { + /* + * Technically, this component is only emulating an 8250 (not a 16550), so the hardware + * only has a 1-byte buffer (not a 16-byte buffer), but for debugging/development purposes, + * I have historically buffered ALL received data. Unfortunately, that internal buffer can + * screw up serial mouse hardware detection, so I've added a flush parameter just for the + * mouse component. + * + * Ultimately, we should decide which chip we want to emulate and faithfully implement its + * buffer, FIFO control register (if any), etc, and get rid of this "infinite" internal buffer. + */ + this.abReceive = []; + } if (data != null) { if (typeof data == "number") { this.abReceive.push(data); @@ -62474,7 +62489,7 @@ class Mouse extends Component { * bytes on a reset. This doesn't seem to adversely affect serial mouse emulation for Windows 1.01, so * I'm calling this good enough for now. */ - this.componentDevice.receiveData([Mouse.SERIAL.ID, Mouse.SERIAL.ID]); + this.componentDevice.receiveData([Mouse.SERIAL.ID, Mouse.SERIAL.ID], true); this.printf("serial mouse ID sent\n"); } this.captureAll(); @@ -63022,7 +63037,7 @@ class Disk extends Component { */ if (this.mode != DiskAPI.MODE.PRELOAD) { - this.printf(MESSAGE.DEBUG, "blank disk for \"%s\": %d cylinders, %d head(s)\n", this.sDiskName, this.nCylinders, this.nHeads); + this.printf(MESSAGE.DISK, "blank disk for \"%s\": %d cylinders, %d head(s)\n", this.sDiskName, this.nCylinders, this.nHeads); let aCylinders = new Array(this.nCylinders); for (let iCylinder = 0; iCylinder < aCylinders.length; iCylinder++) { @@ -63078,10 +63093,10 @@ class Disk extends Component { { let sDiskURL = sDiskPath; - this.printf(MESSAGE.DEBUG, 'load("%s","%s")\n', sDiskName, sDiskPath); + this.printf(MESSAGE.DISK, 'load("%s","%s")\n', sDiskName, sDiskPath); if (this.fnNotify) { - this.printf(MESSAGE.DEBUG, 'too many load requests for "%s" (%s)\n', sDiskName, sDiskPath); + this.printf(MESSAGE.DISK, 'too many load requests for "%s" (%s)\n', sDiskName, sDiskPath); return true; } @@ -63252,7 +63267,7 @@ class Disk extends Component { if (this.fOnDemand) { if (!nErrorCode) { disk = this; - this.printf(MESSAGE.DEBUG, "doneLoad(\"%s\")\n", this.sDiskPath); + this.printf(MESSAGE.DISK, "doneLoad(\"%s\")\n", this.sDiskPath); this.fRemote = true; } else { this.printf(idMessage, "Unable to connect to disk \"%s\" (error %d: %s)\n", this.sDiskPath, nErrorCode, imageData); @@ -63268,7 +63283,7 @@ class Disk extends Component { */ this.printf(idMessage, "Unable to load disk \"%s\" (error %d: %s)\n", this.sDiskName, nErrorCode, sURL); } else { - this.printf(MESSAGE.DEBUG, "doneLoad(\"%s\")\n", this.sDiskPath); + this.printf(MESSAGE.DISK, "doneLoad(\"%s\")\n", this.sDiskPath); /* * If we received binary data instead of JSON, we can use the same buildDisk() function that diff --git a/machines/pcx86/releases/2.22/pcx86.js b/machines/pcx86/releases/2.22/pcx86.js index 5f53229d7..7e4483493 100644 --- a/machines/pcx86/releases/2.22/pcx86.js +++ b/machines/pcx86/releases/2.22/pcx86.js @@ -89,12 +89,12 @@ function gb(a,b,c){return c?(" "+a).slice var fb={"&":"&","<":"<",">":">",'"':""","'":"'",$:"$"},mb={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",10:"LF",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US",127:"DEL"},lb=10,jb=13,nb=new Da,ob=nb.B.bind(nb); function pb(a,b,c){var d=0,e=a.length,f=0;for(void 0===c&&(c=function(k,l){return k>l?1:k>1,h=void 0;h=c(b,a[g]);0=arguments.length)break;var f=a[e],g=arguments[d++];c=c&~f.Ch|g<>a.shift} function sb(a,b){if(Array.prototype.indexOf)return a.indexOf(b,c);var c=c||0;0>c&&(c+=a.length);0>c&&(c=0);for(var d=a.length;ca.indexOf("?")&&(a=encodeURI(a));if(r.XMLHttpRequest)var p=new r.XMLHttpRequest;else if(r.ActiveXObject)p=new r.ActiveXObject("Microsoft.XMLHTTP");else if(r.fetch)return wb(2267742732288,"fetching: %s\n",a),fetch(a).then(function(t){switch(b){case "json":case "text":return t.text();case "arraybuffer":return t.arrayBuffer();default:throw Error("unsupported response type: "+b);}}).then(function(t){wb(2267742732288,"fetch %s complete: %d bytes\n", -a,t.length);d&&d(a,t,g)}).catch(function(){wb(68719476736,"fetch %s error: %d\n",a,g);d&&d(a,h,g)}),k;var n=!1;l="string"===typeof p.responseType;c&&(p.onreadystatechange=f);e&&e(0);if(b&&"object"==typeof b){l="";for(var q in b)b.hasOwnProperty(q)&&(l&&(l+="&"),l+=q+"="+encodeURIComponent(b[q]));l=l.replace(/%20/g,"+");wb(2267742732288,"posting: %s (%d bytes)\n",a,l.length);p.open("POST",a,c);p.setRequestHeader("Content-type","application/x-www-form-urlencoded");p.send(l)}else wb(2267742732288,"requesting: %s\n", -a),p.open("GET",a,c),"arraybuffer"==b&&(l?(n=!0,p.responseType=b):p.overrideMimeType("text/plain; charset=x-user-defined")),p.send();c||(p.readyState=4,k=f());return k} +function vb(a,b,c,d,e){function f(){if(4!==p.readyState)return e&&e(1),null;try{h=n?p.response:p.responseText}catch(x){wb(68719476736,"getResource.done(%s) exception: %s\n",a,x.message)}if(null!=h&&(200==p.status||!p.status&&h.length&&"file:"==(r.location?r.location.protocol:"file:")))wb(2267742732288,"getResource.done(%s): %d bytes\n",a,h.length);else if(g=p.status||-1,wb(2199023255552,"getResource.done(%s) error: %d\n",a,g),!p.status&&!xb){var t=a.match(/(^https?:\/\/[^/]+)(.*)/);t&&(xb=!0,yb("PCjs was unable to perform a cross-origin resource request to '"+ +t[1]+"'.\n\nIf you're running an ad blocker, try adding '"+zb()+"' to your whitelist (or find a smarter ad blocker)."))}e&&e(2);d&&d(a,h,g);return[h,g]}b=void 0===b?"text":b;c=void 0===c?!1:c;var g=0,h=null,k=null,l=r.resources;if("object"==typeof l&&(h=l[a]))return d&&d(a,h,g),[h,g];if(c&&"function"==typeof l)return l(a,function(t,x){d&&d(a,t,x)}),k;a=r.LOCALDISKS&&Ab().match(/^(.+\.local|localhost|0\.0\.0\.0|pcjs)$/)?a.replace(/^\/(diskettes|gamedisks|miscdisks|harddisks|decdisks|pcsigdisks|pcsig[0-9a-z]*-disks|private)\//, +"/disks/$1/").replace(/^\/discs\/([^/]*)\//,"/disks/cdroms/$1/"):a.replace(/^\/(disks\/|)(diskettes|gamedisks|miscdisks|harddisks|decdisks|pcsigdisks|pcsig[0-9a-z]*-disks|private)\//,"https://$2.pcjs.org/").replace(/^\/(disks\/cdroms|discs)\/([^/]*)\//,"https://$2.pcjs.org/");wb(2199023255552,"getResource(%s)\n",a);if(za.Yo&&0!=a.indexOf("http")){try{l="arraybuffer"==b?null:"utf8",h=za.Yo(a,l),l||(h=h.buffer,h.buffer&&(h=h.buffer))}catch(t){g=t.errno}if(void 0!==h)return d&&d(a,h,g),[h,g]}if(0==a.indexOf(Ra)&& +(l=Qa(a)))return h=l.data,d&&d(a,h,g),[h,g];!a.match(/^[A-Z]:/i)&&0>a.indexOf("?")&&(a=encodeURI(a));if(r.XMLHttpRequest)var p=new r.XMLHttpRequest;else if(r.ActiveXObject)p=new r.ActiveXObject("Microsoft.XMLHTTP");else if(r.fetch)return wb(2267742732288,"getResource.fetch(%s)\n",a),fetch(a).then(function(t){switch(b){case "json":case "text":return t.text();case "arraybuffer":return t.arrayBuffer();default:throw Error("unsupported response type: "+b);}}).then(function(t){wb(2267742732288,"getResource.fetch(%s): %d bytes\n", +a,t.length);d&&d(a,t,g)}).catch(function(){wb(68719476736,"getResource.fetch(%s) error: %d\n",a,g);d&&d(a,h,g)}),k;var n=!1;l="string"===typeof p.responseType;c&&(p.onreadystatechange=f);e&&e(0);if(b&&"object"==typeof b){l="";for(var q in b)b.hasOwnProperty(q)&&(l&&(l+="&"),l+=q+"="+encodeURIComponent(b[q]));l=l.replace(/%20/g,"+");wb(2267742732288,"getResource.post(%s): %d bytes\n",a,l.length);p.open("POST",a,c);p.setRequestHeader("Content-type","application/x-www-form-urlencoded");p.send(l)}else wb(2267742732288, +"getResource.get(%s)\n",a),p.open("GET",a,c),"arraybuffer"==b&&(l?(n=!0,p.responseType=b):p.overrideMimeType("text/plain; charset=x-user-defined")),p.send();c||(p.readyState=4,k=f());return k} function Bb(a){a=a.replace("/disks/pc/","/disks/pcx86/");a=a.replace("/disks/pcx86/private/","/disks-private/pcx86/");0>a.indexOf("archive.pcjs.org")&&(a=a.replace("/disks/pcx86/","/disks-demo/pcx86/"));a=a.replace("/pcjs-disks/","/disks-demo/");a=a.replace("/pcjs-games/","/disks-game/");a=a.replace("/disks-demo/pcx86/games/","/disks-game/pcx86/");a=a.replace("/private-disks/","/disks-private/");return a=a.replace("/fixed/","/drives/")} function Ab(){return r.location?r.location.hostname:"localhost"}function zb(){return r.location?r.location.protocol+"//"+r.location.host:"https://www.pcjs.org"}function Cb(){return r.navigator?r.navigator.userAgent:""}function Db(){if(null==Eb){var a=!1;if(r.localStorage)try{r.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==r.localStorage.getItem("PCjs.localStorage"),r.localStorage.removeItem("PCjs.localStorage")}catch(b){Fb(b),a=!1}Eb=a}return Eb} function Fb(a){wb(1099511627776,"Local storage error: %s\n",a.message)}function Gb(a){if(Db())try{var b=r.localStorage.getItem(a)}catch(c){Fb(c)}return b}function Hb(a,b){if(Db())try{return r.localStorage.setItem(a,b),!0}catch(c){Fb(c)}return!1}function Ib(a){if(r.navigator){var b=Cb();return"iOS"==a&&(!!b.match(/(iPod|iPhone|iPad)/)||"MacIntel"===r.navigator.platform&&1=f)e.preventDefault&&e.preventDefault(),64");if(2==c.length){var d=hb(c[0]);if(d!=this.Ab)return;c=hb(c[1]);if(this.D=qc(c,!1)){var e=this.D.exports;if(e){var f=e.connect;f&&f.call(this.D,this.V);if(this.C=e.receiveData){this.V=a;this.Y=e.receiveStatus;this.K(137438953472,"Connected %s.%s to %s\n",this.Gc,d,c);return}}}}this.K(137438953472,"Unable to establish connection: %s\n",b)}}}; -m.fc=function(a,b){if(!b)if(this.Dj(this.V),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};m.ec=function(a){return a?this.save():!0};m.reset=function(){Mx(this)};m.save=function(){var a=new hh(this),b=0,c=[];c[b++]=this.ea;c[b++]=this.fa;c[b++]=this.I;c[b++]=this.O;c[b++]=this.L;c[b++]=this.H;c[b++]=this.T;c[b++]=this.A;c[b++]=this.B;c[b]=this.J;a.set(0,c);return a.data()};m.restore=function(a){return Mx(this,a[0])}; -function Mx(a,b){var c=0;void 0===b&&(b=[0,0,Nx,0,Ox,0,0,Hx|Ix,a.pa,[]]);a.ea=b[c++];a.fa=b[c++];a.I=b[c++];a.O=b[c++];a.L=b[c++];a.H=b[c++];a.T=b[c++];a.A=b[c++];a.B=b[c++];a.J=b[c];return!0}m.Qd=function(a){if(null!=a)if("number"==typeof a)this.J.push(a);else if("string"==typeof a)for(var b=0;b>8:this.O;y(this,a,void 0,b,this.H&Ux?"DLM":"IER",c);return c}; +m.fc=function(a,b){if(!b)if(this.Dj(this.V),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};m.ec=function(a){return a?this.save():!0};m.reset=function(){Mx(this)};m.save=function(){var a=new hh(this),b=0,c=[];c[b++]=this.ea;c[b++]=this.fa;c[b++]=this.J;c[b++]=this.O;c[b++]=this.L;c[b++]=this.H;c[b++]=this.T;c[b++]=this.A;c[b++]=this.B;c[b]=this.I;a.set(0,c);return a.data()};m.restore=function(a){return Mx(this,a[0])}; +function Mx(a,b){var c=0;void 0===b&&(b=[0,0,Nx,0,Ox,0,0,Hx|Ix,a.pa,[]]);a.ea=b[c++];a.fa=b[c++];a.J=b[c++];a.O=b[c++];a.L=b[c++];a.H=b[c++];a.T=b[c++];a.A=b[c++];a.B=b[c++];a.I=b[c];return!0}m.Qd=function(a,b){b&&(this.I=[]);if(null!=a)if("number"==typeof a)this.I.push(a);else if("string"==typeof a)for(b=0;b>8:this.O;y(this,a,void 0,b,this.H&Ux?"DLM":"IER",c);return c}; m.yn=function(a,b){var c=this.L;c==Vx&&(this.L=Ox);y(this,a,void 0,b,"IIR",c);return c};m.zn=function(a,b){var c=this.H;y(this,a,void 0,b,"LCR",c);return c};m.Bn=function(a,b){var c=this.T;y(this,a,void 0,b,"MCR",c);return c};m.An=function(a,b){var c=this.A;y(this,a,void 0,b,"LSR",c);return c};m.En=function(a,b){var c=this.B;this.B&=~(Qx|Rx);y(this,a,void 0,b,"MSR",c);return c}; -m.No=function(a,b,c){var d=this;y(this,a,b,c,this.H&Ux?"DLL":"THR");this.H&Ux?this.I=this.I&-256|b:(this.fa=b,this.A&=~(Hx|Ix),vf(this.G,function(){var e=!1;d.K("transmitByte(%#04x)\n",b);d.C&&d.C.call(d.D,b)&&(e=!0);if(d.F){if(13==b)d.N=0;else if(8==b)d.F.value=d.F.value.slice(0,-1),0b&&1==f&&(f=0);9==b&&(f=d.oa||8,f-=d.N%f,d.oa&&(e=gb("",f)));!d.N&&f&&(10!=d.la&&(e="\n"+e),d.ga&&(e=String.fromCharCode(d.ga)+e));d.F.value+=e;d.F.scrollTop=d.F.scrollHeight; -d.N+=f}d.la=b;e=!0}else if(null!=d.M){if(10==b||1024<=d.M.length)d.print(d.M),d.M="";10!=b&&(d.M+=String.fromCharCode(b));e=!0}return e}),ff(this.G,this.sa,1E3/(1843200/((this.I||1)<<7))|0),Jx(this))};m.Fo=function(a,b,c){y(this,a,b,c,this.H&Ux?"DLM":"IER");this.H&Ux?this.I=this.I&255|b<<8:this.O=b};m.Go=function(a,b,c){y(this,a,b,c,"LCR");this.H=b}; +m.No=function(a,b,c){var d=this;y(this,a,b,c,this.H&Ux?"DLL":"THR");this.H&Ux?this.J=this.J&-256|b:(this.fa=b,this.A&=~(Hx|Ix),vf(this.G,function(){var e=!1;d.K("transmitByte(%#04x)\n",b);d.C&&d.C.call(d.D,b)&&(e=!0);if(d.F){if(13==b)d.N=0;else if(8==b)d.F.value=d.F.value.slice(0,-1),0b&&1==f&&(f=0);9==b&&(f=d.oa||8,f-=d.N%f,d.oa&&(e=gb("",f)));!d.N&&f&&(10!=d.la&&(e="\n"+e),d.ga&&(e=String.fromCharCode(d.ga)+e));d.F.value+=e;d.F.scrollTop=d.F.scrollHeight; +d.N+=f}d.la=b;e=!0}else if(null!=d.M){if(10==b||1024<=d.M.length)d.print(d.M),d.M="";10!=b&&(d.M+=String.fromCharCode(b));e=!0}return e}),ff(this.G,this.sa,1E3/(1843200/((this.J||1)<<7))|0),Jx(this))};m.Fo=function(a,b,c){y(this,a,b,c,this.H&Ux?"DLM":"IER");this.H&Ux?this.J=this.J&255|b<<8:this.O=b};m.Go=function(a,b,c){y(this,a,b,c,"LCR");this.H=b}; m.Ho=function(a,b,c){var d=b^this.T;y(this,a,b,c,"MCR");this.T=b;d&(Wx|Tx)&&(this.Y&&(a=0,this.V?(a|=b&Tx?32:0,a|=b&Wx?320:0):(a|=b&Tx?16:0,a|=b&Wx?1048576:0),this.Y.call(this.D,a)),Px(this))};function Jx(a){var b=-1;a.A&Sx&&a.O&Xx?b=Yx:a.A&Hx&&a.O&Zx?b=Vx:a.B&(Qx|Rx)&&a.O&$x&&(b=ay);0<=b?(a.L&=~(Ox|by),a.L|=b,a.U&&a.P&&Fi(a.U,a.P,100)):(a.L=Ox,a.U&&a.P&&Di(a.U,a.P))} var Nx=384,Xx=1,Zx=2,$x=8,Ox=1,Yx=4,Vx=2,ay=0,by=6,Ux=128,Wx=1,Tx=2,Sx=1,Hx=32,Ix=64,Qx=1,Rx=2,Fx=16,Gx=32,Kx={0:Ex.prototype.Gn,1:Ex.prototype.xn,2:Ex.prototype.yn,3:Ex.prototype.zn,4:Ex.prototype.Bn,5:Ex.prototype.An,6:Ex.prototype.En},Lx={0:Ex.prototype.No,1:Ex.prototype.Fo,3:Ex.prototype.Go,4:Ex.prototype.Ho};Tb(function(){for(var a=nc("pcx86","serial"),b=0;ba.I||0>a.J)a.I=b.screenX,a.J=b.screenY;a.O?(c=b.movementX||b.mozMovementX||b.webkitMovementX||0,d=b.movementY||b.mozMovementY||b.webkitMovementY||0):(c=b.screenX-a.I,d=b.screenY-a.J);a.I=b.screenX;a.J=b.screenY;a.pf(c,d,a.I,a.J)}} m.Md=function(a,b){if(this.isActive()){var c="mouse button"+a+" "+(b?"dn":"up");switch(a){case Fv:if(this.M!=b){this.M=b;Dy(this,c);return}break;case Ey:if(this.N!=b){this.N=b;Dy(this,c);return}}this.K("%s: ignored\n",c)}};m.pf=function(a,b,c,d){this.isActive()&&(a=Math.round(Math.abs(a)*this.L)*Math.sign(a)||Math.sign(a),b=Math.round(Math.abs(b)*this.L)*Math.sign(b)||Math.sign(b),a||b)&&(this.K(67108864,"moveMouse(%s,%s)\n",a,b),this.F=a,this.H=b,Dy(this,null,c,d))}; function Dy(a,b,c,d){var e=64|(a.M?32:0)|(a.N?16:0)|(a.H&192)>>4|(a.F&192)>>6,f=a.F&63,g=a.H&63;a.K(33554433,"%s%sserial packet [%#04x,%#04x,%#04x]\n",b?b+": ":"",void 0!==d?"mouse ("+c+","+d+"): ":"",e,f,g);a.C.Qd([e,f,g]);a.F=a.H=0} -m.mm=function(a){var b=1048592==(a&1048592);if(b){if(!this.Hc){var c=!1;this.A&16||(this.reset(),this.K("serial mouse reset\n"),c=!0);this.A&1048576||(this.K("serial mouse ID requested\n"),c=!0);c&&(this.C.Qd([Fy,Fy]),this.K("serial mouse ID sent\n"));yy(this);this.Hc=b}}else this.Hc&&(this.K("serial mouse inactive\n"),zy(this),this.Hc=b);this.A=a};m.bn=function(a,b){y(this,a,void 0,b,"DATA",0);return 0};m.cn=function(a,b){y(this,a,void 0,b,"TPPI",0);return 0}; +m.mm=function(a){var b=1048592==(a&1048592);if(b){if(!this.Hc){var c=!1;this.A&16||(this.reset(),this.K("serial mouse reset\n"),c=!0);this.A&1048576||(this.K("serial mouse ID requested\n"),c=!0);c&&(this.C.Qd([Fy,Fy],!0),this.K("serial mouse ID sent\n"));yy(this);this.Hc=b}}else this.Hc&&(this.K("serial mouse inactive\n"),zy(this),this.Hc=b);this.A=a};m.bn=function(a,b){y(this,a,void 0,b,"DATA",0);return 0};m.cn=function(a,b){y(this,a,void 0,b,"TPPI",0);return 0}; m.an=function(a,b){y(this,a,void 0,b,"CTRL",0);return 0};m.$m=function(a,b){y(this,a,void 0,b,"CPPI",0);return 0};m.io=function(a,b,c){y(this,a,b,c,"DATA")};m.jo=function(a,b,c){y(this,a,b,c,"TPPI")};m.ho=function(a,b,c){y(this,a,b,c,"CTRL")};m.fo=function(a,b,c){y(this,a,b,c,"CPPI")};var uy="bus",ty="serial",Fv=0,Ey=2,wy=572,Fy=77,vy={0:sy.prototype.bn,1:sy.prototype.cn,2:sy.prototype.an,3:sy.prototype.$m},xy={0:sy.prototype.io,1:sy.prototype.jo,2:sy.prototype.ho,3:sy.prototype.fo}; Tb(function(){for(var a=nc("pcx86","mouse"),b=0;bb.indexOf("/api/v1/dump")&&(a=bb(b),"json"!=a&&"gz"!=a&&("demandrw"==this.mode||"demandro"==this.mode?(f=Oy(this,b),this.tg=!0):this.N="arraybuffer"));var k="Loading "+f+"...";return!!vb(f,this.N,!0,function(l,p,n){My(g,l,p,n)},function(){g.K(4398046511104,"%s\n",k)})}; function Ny(a,b,c,d){var e=0,f=null;b&&(e=b.byteLength,f=new DataView(b,0,e));b=0;f&&1397375824==f.getUint32(409,!0)&&(b=f.getUint16(414,!0));if(b)a.Ta=b,a.Ra=f.getUint8(416),a.Sa=f.getUint8(428),a.Cb=512;else if(b=La[e])b[0]<=a.Ta&&b[1]<=a.Ra?(a.Ta=b[0],a.Ra=b[1],a.Sa=b[2],a.Cb=b[3]||512):a.Ta=0;if(f&&a.Ta){d=0;e=a.Cb>>2;var g=0;a.eb=Array(a.Ta);for(b=0;bd&&a.ua&&!a.ua.flags.hc?137438953472:274877906944;if(a.tg)d?a.K(f,'Unable to connect to disk "%s" (error %d: %s)\n',a.Fb,d,c):(e=a,a.K(2199023255552,'doneLoad("%s")\n',a.Fb),a.A=!0);else if(d)a.K(f,'Unable to load disk "%s" (error %d: %s)\n',a.tc,d,b);else{a.K(2199023255552,'doneLoad("%s")\n',a.Fb);if("string"!=typeof c){Ny(a,c);return}try{if(0g&&0c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+c+")");if(h.length)if(1==h.length)fc(h[0]);else{a.Ta=h.length;a.Ra=h[0].length;a.Sa=h[0][0].length;var n=h[0][0][0];a.Cb=n&&(n[Qy]||n.length)||512;for(g=f=0;g>2&&(I=K[K.length-1],K.length&&K.length--);Ly(n,g,k,t,a.Cb,I);for(var B= -0;Bd&&a.ua&&!a.ua.flags.hc?137438953472:274877906944;if(a.tg)d?a.K(f,'Unable to connect to disk "%s" (error %d: %s)\n',a.Fb,d,c):(e=a,a.K(131072,'doneLoad("%s")\n',a.Fb),a.A=!0);else if(d)a.K(f,'Unable to load disk "%s" (error %d: %s)\n',a.tc,d,b);else{a.K(131072,'doneLoad("%s")\n',a.Fb);if("string"!=typeof c){Ny(a,c);return}try{if(0g&&0c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+c+")");if(h.length)if(1==h.length)fc(h[0]);else{a.Ta=h.length;a.Ra=h[0].length;a.Sa=h[0][0].length;var n=h[0][0][0];a.Cb=n&&(n[Qy]||n.length)||512;for(g=f=0;g>2&&(I=K[K.length-1],K.length&&K.length--);Ly(n,g,k,t,a.Cb,I);for(var B=0;B