Skip to content

Commit

Permalink
fix: register the exit process when cancelling after a real launch
Browse files Browse the repository at this point in the history
  • Loading branch information
arianrhodsandlot committed Mar 5, 2024
1 parent 1332a03 commit bd3db6f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/emulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export class Emulator {
document.body.append(element)
signal?.addEventListener('abort', () => {
element?.remove()
this.exit()
})
}
this.canvasInitialSize = this.getElementSize()
Expand Down Expand Up @@ -412,15 +411,16 @@ export class Emulator {
this.checkIsAborted()
const { Module } = this.getEmscripten()
const { arguments: raArgs = [] } = Module
if (!Module.arguments) {
const { rom } = this.options
if (rom.length > 0) {
const [{ fileName }] = rom
raArgs.push(join(raContentDir, fileName))
}
const { rom, signal } = this.options
if (!Module.arguments && rom.length > 0) {
const [{ fileName }] = rom
raArgs.push(join(raContentDir, fileName))
}

Module.callMain(raArgs)
signal?.addEventListener('abort', () => {
this.exit()
})
this.gameStatus = 'running'
this.postRun()
}
Expand Down

0 comments on commit bd3db6f

Please sign in to comment.