Update cores

This commit is contained in:
Ethan O'Brien 2023-07-14 11:43:13 -05:00
parent 3d76c3f2f7
commit 090b44e561
2 changed files with 3 additions and 33 deletions

View file

@ -22,7 +22,8 @@ class EJS_GameManager {
getSaveFilePath: this.Module.cwrap('save_file_path', 'string', []), getSaveFilePath: this.Module.cwrap('save_file_path', 'string', []),
saveSaveFiles: this.Module.cwrap('cmd_savefiles', '', []), saveSaveFiles: this.Module.cwrap('cmd_savefiles', '', []),
supportsStates: this.Module.cwrap('supports_states', 'number', []), 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");
this.mkdir("/home/web_user"); this.mkdir("/home/web_user");

View file

@ -815,7 +815,6 @@ class EmulatorJS {
} }
initModule(wasmData) { initModule(wasmData) {
window.Module = { window.Module = {
'TOTAL_MEMORY': 0x10000000,
'noInitialRun': true, 'noInitialRun': true,
'onRuntimeInitialized': this.downloadFiles.bind(this), 'onRuntimeInitialized': this.downloadFiles.bind(this),
'arguments': [], 'arguments': [],
@ -845,8 +844,6 @@ class EmulatorJS {
} }
startGame() { startGame() {
try { try {
this.initAudio();
const args = []; const args = [];
if (this.debug) args.push('-v'); if (this.debug) args.push('-v');
args.push('/'+this.fileName); args.push('/'+this.fileName);
@ -1339,39 +1336,11 @@ class EmulatorJS {
volumeSlider.setAttribute("aria-valuetext", (volume*100).toFixed(1) + "%"); volumeSlider.setAttribute("aria-valuetext", (volume*100).toFixed(1) + "%");
volumeSlider.setAttribute("style", "--value: "+volume*100+"%;margin-left: 5px;position: relative;z-index: 2;"); volumeSlider.setAttribute("style", "--value: "+volume*100+"%;margin-left: 5px;position: relative;z-index: 2;");
if (this.gameManager) { if (this.gameManager) {
//this.gameManager.setVolume(volume); //this.gameManager.setVolume(volume);//broken
} }
unmuteButton.style.display = (volume === 0) ? "" : "none"; unmuteButton.style.display = (volume === 0) ? "" : "none";
muteButton.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.setVolume(this.volume);
this.addEventListener(volumeSlider, "change mousemove touchmove mousedown touchstart mouseup", (e) => { this.addEventListener(volumeSlider, "change mousemove touchmove mousedown touchstart mouseup", (e) => {