diff --git a/devices/pc/video/ibm-ega.json b/devices/pc/video/ibm-ega.json index 16e397981..281f60cb5 100644 --- a/devices/pc/video/ibm-ega.json +++ b/devices/pc/video/ibm-ega.json @@ -1023,4 +1023,4 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,70] -,"symbols":{"VIDEO_SETUP":{"o":3},"POR_1":{"o":146},"RD_SWS":{"o":155},"F_BTS":{"o":206},"MK_ENV":{"o":243},"ENV_X":{"o":328,"c":"SET 40x25 COLOR ALPHA"}}} +,"symbols":{"VIDEO_SETUP":{"o":3},"POR_1":{"o":146},"RD_SWS":{"o":155},"F_BTS":{"o":206},"MK_ENV":{"o":243},"ENV_X":{"o":328,"c":"SET 40x25 COLOR ALPHA"}}} \ No newline at end of file diff --git a/modules/c1pjs/lib/rom.js b/modules/c1pjs/lib/rom.js index 0b64da37d..dc9fa01e0 100644 --- a/modules/c1pjs/lib/rom.js +++ b/modules/c1pjs/lib/rom.js @@ -63,15 +63,8 @@ function C1PROM(parmsROM) * in compact form (ie, minimal whitespace, no ASCII data comments, etc). */ var sFileExt = str.getExtension(this.sImage); - if (sFileExt != "json" && sFileExt != "hex") { - /** - * TODO: This code was using a deprecated parameter (compact=1); make sure things still work. - * - * TODO: Convert this code to use the new shared File API definitions and weblib functions; eg: - * - * sFileURL = web.getHost() + DumpAPI.ENDPOINT + "?" + DumpAPI.QUERY.FILE + "=" + this.sImage; - */ - sFileURL = "http://" + window.location.host + "/api/v1/dump?file=" + this.sImage; + if (sFileExt != DumpAPI.FORMAT.JSON && sFileExt != DumpAPI.FORMAT.HEX) { + sFileURL = web.getHost() + DumpAPI.ENDPOINT + '?' + DumpAPI.QUERY.FILE + '=' + this.sImage + '&' + DumpAPI.QUERY.FORMAT + '=' + DumpAPI.FORMAT.BYTES; } web.loadResource(sFileURL, true, null, this, this.convertImage); } @@ -156,13 +149,18 @@ C1PROM.prototype.convertImage = function(sImageName, sImageData, nErrorCode) this.println("Error loading ROM \"" + sImageName + "\" (" + nErrorCode + ")"); return; } - if (sImageData[0] == "[") { + if (sImageData.charAt(0) == "[" || sImageData.charAt(0) == "{") { try { /* - * The most likely source of any exception will be right here, where we're parsing - * the JSON-encoded ROM data. + * The most likely source of any exception will be here: parsing the JSON-encoded ROM data. */ - this.abImage = eval("(" + sImageData + ")"); + var rom = eval("(" + sImageData + ")"); + var ab = rom['bytes']; + if (ab) { + this.abImage = ab; + } else { + this.abImage = rom; + } } catch (e) { this.println("Error processing ROM \"" + sImageName + "\": " + e.message); return; diff --git a/modules/filedump/lib/filedump.js b/modules/filedump/lib/filedump.js index fd3050dfb..1210fb453 100644 --- a/modules/filedump/lib/filedump.js +++ b/modules/filedump/lib/filedump.js @@ -399,12 +399,14 @@ FileDump.prototype.dumpBuffer = function(sKey, buf, len, cbItem, offData) FileDump.prototype.loadMap = function(sFilePath, done) { /* - * The BYTES and HEX formats don't support MAP files, because the clients expect those format requests - * to return an Array of bytes, not an Object. For all other (JSON) formats, we assume that the JSON - * is "unwrapped" at this point, and that even if loadMap() doesn't find a map file, it will still wrap - * the resulting JSON with braces. + * The HEX format doesn't support MAP files, because old HEX clients expect an Array of bytes, + * not an Object. For all other (JSON) formats, we assume that the JSON is "unwrapped" at this point, + * and so even if loadMap() doesn't find a map file, it will still wrap the resulting JSON with braces. */ - if (this.sFormat != DumpAPI.FORMAT.BYTES && this.sFormat != DumpAPI.FORMAT.HEX) { + if (this.sFormat != DumpAPI.FORMAT.HEX) { + if (!this.sKey) { + this.json = '"bytes":' + this.json; + } var obj = this; var sMapPath = sFilePath.replace(/\.(rom|json)$/, ".map"); if (str.endsWith(sMapPath, ".map")) { @@ -551,9 +553,6 @@ FileDump.prototype.loadMap = function(sFilePath, done) } sMapData = JSON.stringify(aSymbols); if (sMapData) { - if (!obj.sKey) { - obj.json = '"bytes":' + obj.json; - } obj.json = '{' + obj.json + ',"symbols":' + sMapData + '}'; } }