diff --git a/jsnes b/jsnes index 94d4a03b..03614b82 160000 --- a/jsnes +++ b/jsnes @@ -1 +1 @@ -Subproject commit 94d4a03bc4ac0fb12824d90327b01cf23d91af2e +Subproject commit 03614b82158dabc4fc78c728be0b6a847538b957 diff --git a/src/ide/views.ts b/src/ide/views.ts index 019aeb67..3be27e22 100644 --- a/src/ide/views.ts +++ b/src/ide/views.ts @@ -1322,9 +1322,8 @@ export class ProbeSymbolView extends ProbeViewBaseBase { /// -const MAX_CHILDREN = 200; +const MAX_CHILDREN = 256; const MAX_STRING_LEN = 100; -const MAX_DUMP_BYTES = 256; class TreeNode { parent : TreeNode; @@ -1403,13 +1402,26 @@ class TreeNode { else text = obj.substring(0, MAX_STRING_LEN) + "..."; // byte array (TODO: other kinds) - } else if (obj instanceof Uint8Array && obj.length <= MAX_DUMP_BYTES) { + } else if (obj instanceof Uint8Array && obj.length <= MAX_CHILDREN) { text = dumpRAM(obj, 0, obj.length); // recurse into object? (or function) } else if (typeof obj == 'object' || typeof obj == 'function') { + // only if expanded if (this._content != null) { - let names = Object.getOwnPropertyNames(obj); - if (names.length < MAX_CHILDREN) { // max # of child objects + // split big arrays + if (obj.slice && obj.length > MAX_CHILDREN) { + let newobj = {}; + let oldobj = obj; + var slicelen = MAX_CHILDREN; + while (obj.length / slicelen > MAX_CHILDREN) slicelen *= 2; + for (let ofs=0; ofs { return oldobj.slice(ofs, ofs+slicelen); } + } + obj = newobj; + } + // get object keys + let names = obj instanceof Array ? Array.from(obj.keys()) : Object.getOwnPropertyNames(obj); + if (names.length <= MAX_CHILDREN) { // max # of child objects let orphans = new Set(this.children.keys()); // visit all children names.forEach((name) => {