1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2025-08-09 09:25:27 +00:00

fixed debugging w/ input events

This commit is contained in:
Steven Hugg
2019-09-02 15:50:31 -04:00
parent eff53c0d92
commit 25c14ed53b
3 changed files with 14 additions and 14 deletions

View File

@@ -266,21 +266,21 @@ export abstract class BaseDebugPlatform extends BasePlatform {
this.resume();
}
preFrame() {
}
postFrame() {
if (this.debugCallback) {
if (this.debugBreakState) {
// reload debug state at end of frame after breakpoint
this.loadState(this.debugBreakState);
} else {
// save state every frame and rewind debug clocks
this.debugSavedState = this.saveState();
this.debugTargetClock -= this.debugClock;
this.debugClock = 0;
}
// save state before frame, to record any inputs that happened pre-frame
if (this.debugCallback && !this.debugBreakState) {
// save state every frame and rewind debug clocks
this.debugSavedState = this.saveState();
this.debugTargetClock -= this.debugClock;
this.debugClock = 0;
}
this.frameCount++;
}
postFrame() {
// reload debug state at end of frame after breakpoint
if (this.debugCallback && this.debugBreakState) {
this.loadState(this.debugBreakState);
}
}
pollControls() {
}
nextFrame(novideo : boolean) {

View File

@@ -248,7 +248,7 @@ export class AnimationTimer {
} catch (e) {
this.running = false;
this.pulsing = false;
throw new EmuHalt(e);
throw e; // TODO: throw EmuHalt hides stack trace
}
}
if (this.useReqAnimFrame)

View File

@@ -1693,7 +1693,7 @@ function installErrorHandler() {
var msgstr = msgevent+"";
console.log(msgevent, url, line, col, error);
// emulation threw EmuHalt
if (error instanceof EmuHalt || msgstr.indexOf("CPU STOP") >= 0) {
if (error instanceof EmuHalt || msgstr.indexOf("CPU STOP") >= 0) { // TODO
showErrorAlert([ {msg:msgstr, line:0} ]);
uiDebugCallback(platform.saveState && platform.saveState());
setDebugButtonState("pause", "stopped");