Skip to content

Commit f1fa850

Browse files
committed
skip loadROM when binary output unchanged
1 parent ef2d8e9 commit f1fa850

1 file changed

Lines changed: 19 additions & 15 deletions

File tree

src/ide/ui.ts

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { DebugEvalCondition, DebugSymbols, EmuState, isDebuggable, Platform, Pre
66
import { EmuHalt, PLATFORMS } from "../common/emu";
77
import { StateRecorderImpl } from "../common/recorder";
88
import {
9-
byteArrayToUTF8, decodeQueryString, getBasePlatform, getCookie, getFilenameForPath, getFilenamePrefix,
9+
arrayCompare, byteArrayToUTF8, decodeQueryString, getBasePlatform, getCookie, getFilenameForPath, getFilenamePrefix,
1010
getRootBasePlatform, getWithBinary, hex, highlightDifferences, isProbablyBinary, loadScript, parseBool, stringToByteArray
1111
} from "../common/util";
1212
import { FileData, WorkerError, WorkerResult } from "../common/workertypes";
@@ -932,20 +932,24 @@ async function setCompileOutput(data: WorkerResult) {
932932
// load ROM
933933
var rom = data.output;
934934
if (rom != null) {
935-
try {
936-
clearBreakpoint(); // so we can replace memory (TODO: change toolbar btn)
937-
_resetRecording();
938-
await platform.loadROM(getCurrentPresetTitle(), rom, data.origin);
939-
current_output = rom;
940-
if (!userPaused) _resume();
941-
writeOutputROMFile();
942-
} catch (e) {
943-
console.log(e);
944-
toolbar.addClass("has-errors");
945-
showExceptionAsError(e, e + "");
946-
current_output = null;
947-
refreshWindowList();
948-
return;
935+
if (current_output && arrayCompare(rom, current_output)) {
936+
console.log("unchanged, skipping loadROM");
937+
} else {
938+
try {
939+
clearBreakpoint(); // so we can replace memory (TODO: change toolbar btn)
940+
_resetRecording();
941+
await platform.loadROM(getCurrentPresetTitle(), rom, data.origin);
942+
current_output = rom;
943+
if (!userPaused) _resume();
944+
writeOutputROMFile();
945+
} catch (e) {
946+
console.log(e);
947+
toolbar.addClass("has-errors");
948+
showExceptionAsError(e, e + "");
949+
current_output = null;
950+
refreshWindowList();
951+
return;
952+
}
949953
}
950954
}
951955
// update all windows (listings)

0 commit comments

Comments
 (0)