1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-12-23 18:31:08 +00:00

nes: changed to typed arrays, still problems with replay

This commit is contained in:
Steven Hugg 2020-07-08 16:21:41 -05:00
parent 71fa79cec5
commit a053be8e14
2 changed files with 18 additions and 6 deletions

2
jsnes

@ -1 +1 @@
Subproject commit 94d4a03bc4ac0fb12824d90327b01cf23d91af2e
Subproject commit 03614b82158dabc4fc78c728be0b6a847538b957

View File

@ -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<oldobj.length; ofs+=slicelen) {
newobj["$"+hex(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) => {