From 090b44e56140dbd497c41c5034391e1edd478072 Mon Sep 17 00:00:00 2001 From: Ethan O'Brien <77750390+ethanaobrien@users.noreply.github.com> Date: Fri, 14 Jul 2023 11:43:13 -0500 Subject: [PATCH] Update cores --- data/GameManager.js | 3 ++- data/emulator.js | 33 +-------------------------------- 2 files changed, 3 insertions(+), 33 deletions(-) diff --git a/data/GameManager.js b/data/GameManager.js index 19f3d77..264d1ef 100644 --- a/data/GameManager.js +++ b/data/GameManager.js @@ -22,7 +22,8 @@ class EJS_GameManager { getSaveFilePath: this.Module.cwrap('save_file_path', 'string', []), saveSaveFiles: this.Module.cwrap('cmd_savefiles', '', []), supportsStates: this.Module.cwrap('supports_states', 'number', []), - loadSaveFiles: this.Module.cwrap('refresh_save_files', 'null', []) + loadSaveFiles: this.Module.cwrap('refresh_save_files', 'null', []), + setVolume: this.Module.cwrap('set_volume', 'null', ['number']) } this.mkdir("/home"); this.mkdir("/home/web_user"); diff --git a/data/emulator.js b/data/emulator.js index 1d174f4..bbe89e4 100644 --- a/data/emulator.js +++ b/data/emulator.js @@ -815,7 +815,6 @@ class EmulatorJS { } initModule(wasmData) { window.Module = { - 'TOTAL_MEMORY': 0x10000000, 'noInitialRun': true, 'onRuntimeInitialized': this.downloadFiles.bind(this), 'arguments': [], @@ -845,8 +844,6 @@ class EmulatorJS { } startGame() { try { - this.initAudio(); - const args = []; if (this.debug) args.push('-v'); args.push('/'+this.fileName); @@ -1339,39 +1336,11 @@ class EmulatorJS { volumeSlider.setAttribute("aria-valuetext", (volume*100).toFixed(1) + "%"); volumeSlider.setAttribute("style", "--value: "+volume*100+"%;margin-left: 5px;position: relative;z-index: 2;"); if (this.gameManager) { - //this.gameManager.setVolume(volume); + //this.gameManager.setVolume(volume);//broken } unmuteButton.style.display = (volume === 0) ? "" : "none"; muteButton.style.display = (volume === 0) ? "none" : ""; } - this.initAudio = () => { - RA.queueAudio = () => { - var index = RA.bufIndex; - let volume = this.volume; - - var startTime; - if (RA.bufIndex) startTime = RA.buffers[RA.bufIndex - 1].endTime; - else startTime = RA.context.currentTime; - RA.buffers[index].endTime = startTime + RA.buffers[index].duration; - - const bufferSource = RA.context.createBufferSource(); - bufferSource.buffer = RA.buffers[index]; - if (this.muted) volume = 0; - if (volume === 1) { - bufferSource.connect(RA.context.destination); - } else { - var gain = RA.context.createGain(); - bufferSource.connect(gain); - gain.connect(RA.context.destination); - gain.gain.setValueAtTime(volume, RA.context.currentTime, 0); - } - - bufferSource.start(startTime); - - RA.bufIndex++; - RA.bufOffset = 0; - } - } this.setVolume(this.volume); this.addEventListener(volumeSlider, "change mousemove touchmove mousedown touchstart mouseup", (e) => {