Updated C1Pjs to use the FileDump API properly

This commit is contained in:
Jeff Parsons 2014-11-16 14:17:01 -08:00 committed by jeffpar
commit 0ea5520444
3 changed files with 19 additions and 22 deletions

View file

@ -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 + '}';
}
}