diff --git a/src/platform/nes.ts b/src/platform/nes.ts index e03cda1d..a8f8409c 100644 --- a/src/platform/nes.ts +++ b/src/platform/nes.ts @@ -1,7 +1,7 @@ import { Platform, Base6502Platform, getOpcodeMetadata_6502, getToolForFilename_6502, Preset } from "../common/baseplatform"; import { PLATFORMS, setKeyboardFromMap, AnimationTimer, RasterVideo, Keys, makeKeycodeMap, KeyFlags, EmuHalt, ControllerPoller } from "../common/emu"; -import { hex, byteArrayToString } from "../common/util"; +import { hex, byteArrayToString, replaceAll } from "../common/util"; import { CodeAnalyzer_nes } from "../common/analysis"; import { SampleAudio } from "../common/audio"; import { ProbeRecorder } from "../common/probe"; @@ -71,16 +71,17 @@ const JSNES_KEYCODE_MAP = makeKeycodeMap([ class JSNESPlatform extends Base6502Platform implements Platform, Probeable { - mainElement; + mainElement : HTMLElement; nes; - video; + video: RasterVideo; audio; - timer; + timer: AnimationTimer; poller : ControllerPoller; audioFrequency = 44030; //44100 frameindex = 0; - ntvideo; - ntlastbuf; + ntvideo: RasterVideo; + ntlastbuf: Uint32Array; + showDebugView = false; machine = { cpuCyclesPerLine: 114 }; // TODO: hack for width of probe scope @@ -93,21 +94,22 @@ class JSNESPlatform extends Base6502Platform implements Platform, Probeable { start() { this.debugPCDelta = 1; - var debugbar = $("
").appendTo(this.mainElement); this.audio = new SampleAudio(this.audioFrequency); this.video = new RasterVideo(this.mainElement,256,224,{overscan:true}); this.video.create(); // debugging view this.ntvideo = new RasterVideo(this.mainElement,512,480,{overscan:false}); this.ntvideo.create(); - $(this.ntvideo.canvas).hide(); + this.ntvideo.canvas.style.display = 'none'; this.ntlastbuf = new Uint32Array(0x1000); if (Mousetrap.bind) Mousetrap.bind('ctrl+shift+alt+n', () => { - $(this.video.canvas).toggle() - $(this.ntvideo.canvas).toggle() + this.showDebugView = !this.showDebugView; + this.video.canvas.style.display = !this.showDebugView ? '' : 'none'; + this.ntvideo.canvas.style.display = this.showDebugView ? '' : 'none'; }); // toggle buttons (TODO) /* + var debugbar = $("
").appendTo(this.mainElement); $('