From f06f7c081cfcbfa3f46b7a0c3afddc2a6d878a1b Mon Sep 17 00:00:00 2001 From: Rupert Hausberger Date: Mon, 1 Aug 2016 17:33:13 +0200 Subject: [PATCH 01/14] update 0.9.0 --- .gitignore | 10 ++++++++++ index.js | 4 +++- sae/amiga.js | 1 + sae/utils.js | 8 ++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3b57a5e --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +scriptedamigaemulator.js +scriptedamigaemulator.js.map +*.adf +db/index.htm +db/aros-amiga-m68k-ext.bin +db/aros-amiga-m68k-rom.bin +db/demos/index.htm +db/demos_aga/index.htm +db/games/index.htm +db/tools/index.htm \ No newline at end of file diff --git a/index.js b/index.js index 0fc4e27..3b4aca7 100644 --- a/index.js +++ b/index.js @@ -489,8 +489,10 @@ function saee2text(err) { case SAEE_NotRunning: return "The emulator is not running."; case SAEE_NoTimer: return "No timing-functions avail. Please upgrade your browser."; case SAEE_NoMemory: return "Out of memory."; - case SAEE_Internal: return "Internal emulator error."; + case SAEE_Assert: return "Assertiation failed."; + case SAEE_Internal: return "Internal emulator error."; case SAEE_Config_Invalid: return "Invalid configuration."; + case SAEE_Config_Compressed: return "A ZIP file was detected. Compressed files are not yet supported."; case SAEE_CPU_Internal: return "Internal CPU-error."; case SAEE_CPU_Requires68020: return "The selected kickstart-rom does require a 68020 and 32bit address-space"; case SAEE_CPU_Requires680EC20: return "The selected kickstart-rom does require a 68020."; diff --git a/sae/amiga.js b/sae/amiga.js index 972fbdb..eaee448 100644 --- a/sae/amiga.js +++ b/sae/amiga.js @@ -68,6 +68,7 @@ const SAEE_Assert = 5; const SAEE_Internal = 6; const SAEE_Config_Invalid = 10; +const SAEE_Config_Compressed = 11; const SAEE_CPU_Internal = 20; const SAEE_CPU_Requires68020 = 21; diff --git a/sae/utils.js b/sae/utils.js index f45322d..8c689ec 100644 --- a/sae/utils.js +++ b/sae/utils.js @@ -493,6 +493,14 @@ function SAEF_ZFile_fopen_file(file) { l.datasize = file.size; l.allocsize = file.size; //OWN + var magic = ((l.data[0] << 24) | (l.data[1] << 16) | (l.data[2] << 8) | (l.data[3])) >>> 0; + + SAEF_log("SAEF_ZFile_fopen_file() opening '%s', %d/%d bytes, crc32 0x%08x, magic %08x", + l.name, l.size, l.data.length, file.crc32 !== false ? file.crc32 : 0, magic); + + if (magic == 0x04034B50 || magic == 0x504B0304) + SAEF_fatal(SAEE_Config_Compressed, "A ZIP file was detected. Compressed files are not yet supported."); + //if (l.data[0] == 68 && l.data[1] == 77 && l.data[2] == 83 && l.data[3] == 33) { /* DMS! */ if (SAEF_CompareArray(l.data, SAEF_String2Array("DMS!"), 4) == 0) { var dms = new SAEO_DMS(); From 61f71da4dfa6577c3156c7d68eee12cc34b75b3e Mon Sep 17 00:00:00 2001 From: Rupert Hausberger Date: Mon, 1 Aug 2016 18:01:43 +0200 Subject: [PATCH 02/14] update --- .gitignore | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 .gitignore diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 3b57a5e..0000000 --- a/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -scriptedamigaemulator.js -scriptedamigaemulator.js.map -*.adf -db/index.htm -db/aros-amiga-m68k-ext.bin -db/aros-amiga-m68k-rom.bin -db/demos/index.htm -db/demos_aga/index.htm -db/games/index.htm -db/tools/index.htm \ No newline at end of file From 4d6e683ff66f46f3b77381551ebc5de604664d20 Mon Sep 17 00:00:00 2001 From: Rupert Hausberger Date: Mon, 1 Aug 2016 18:04:01 +0200 Subject: [PATCH 03/14] update --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c7527f2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +*.adf +db/tools/index.htm +db/index.htm +db/games/index.htm +db/demos_aga/index.htm +db/demos/index.htm +*.bin \ No newline at end of file From 99eeb532c3dedd49ff517305900de1228877e4d7 Mon Sep 17 00:00:00 2001 From: Rupert Hausberger Date: Mon, 1 Aug 2016 18:10:41 +0200 Subject: [PATCH 04/14] update --- .gitignore | 4 +++- Makefile | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index c7527f2..a3c0202 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,6 @@ db/index.htm db/games/index.htm db/demos_aga/index.htm db/demos/index.htm -*.bin \ No newline at end of file +*.bin +scriptedamigaemulator.js +scriptedamigaemulator.js.map diff --git a/Makefile b/Makefile index 32906be..13513c7 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,3 @@ scriptedamigaemulator.js: sae/prototypes.js sae/utils.js sae/dms.js sae/config.js sae/roms.js sae/memory.js sae/autoconf.js sae/expansion.js sae/events.js sae/gayle.js sae/ide.js sae/filesys.js sae/hardfile.js sae/input.js sae/serial.js sae/custom.js sae/blitter.js sae/copper.js sae/playfield.js sae/video.js sae/audio.js sae/cia.js sae/disk.js sae/rtc.js sae/m68k.js sae/cpu.js sae/amiga.js - closure-compiler --language_in=ECMASCRIPT6 --language_out ES5 $^ --js_output_file $@ + closure-compiler --language_in=ECMASCRIPT6 --language_out ES5 $^ --js_output_file $@ --create_source_map $@.map + printf "/*\n//@ sourceMappingURL=%b\n*/" $@.map >> $@ From d964c21903c1edbaf9098f32b3bb96e327542ebd Mon Sep 17 00:00:00 2001 From: Rupert Hausberger Date: Mon, 1 Aug 2016 18:52:17 +0200 Subject: [PATCH 05/14] test --- sae/m68k.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sae/m68k.js b/sae/m68k.js index ceab82a..ad6622a 100644 --- a/sae/m68k.js +++ b/sae/m68k.js @@ -198,6 +198,8 @@ function SAEO_M68K() { else setTimeout(function() { SAER.m68k.m68k_cycle(0, 0); }, 0); } + +var counter = 0; this.m68k_cycle = function(hardboot, startup) { try { @@ -268,6 +270,8 @@ function SAEO_M68K() { //if (SAEV_config.cpu.speed >= 0) prevtime = SAEF_now(); +console.log("loop", counter++); + setTimeout(function() { SAER.m68k.m68k_cycle(hardboot, startup); }, 0); } catch(e) { this.m68k_gone(); @@ -284,6 +288,8 @@ function SAEO_M68K() { var hardboot = 1; var startup = 1; +counter = 0; + //SAEF_info("m68k.m68k_go()"); SAER.events.reset_frame_rate_hack(); From 83e9dbd1e604f5fb912c1cdf3da8e4a000f41fc1 Mon Sep 17 00:00:00 2001 From: Rupert Hausberger Date: Mon, 1 Aug 2016 20:03:07 +0200 Subject: [PATCH 06/14] test --- sae/amiga.js | 3 +++ sae/m68k.js | 14 ++++++++++---- sae/utils.js | 5 ++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/sae/amiga.js b/sae/amiga.js index eaee448..e3b99cd 100644 --- a/sae/amiga.js +++ b/sae/amiga.js @@ -390,6 +390,7 @@ function ScriptedAmigaEmulator() { } this.start_program = function() { +console.warn("stage 2"); this.do_start_program(); if (typeof SAEV_config.hook.event.started === "function") @@ -447,6 +448,8 @@ function ScriptedAmigaEmulator() { } SAEF_info("sae.start() starting..."); +console.warn("stage 1"); + var err; if ((err = this.config.setup()) != SAEE_None) return err; diff --git a/sae/m68k.js b/sae/m68k.js index ad6622a..ae47b34 100644 --- a/sae/m68k.js +++ b/sae/m68k.js @@ -198,8 +198,8 @@ function SAEO_M68K() { else setTimeout(function() { SAER.m68k.m68k_cycle(0, 0); }, 0); } - -var counter = 0; + +var counter = 0; this.m68k_cycle = function(hardboot, startup) { try { @@ -207,6 +207,8 @@ var counter = 0; cpu_keyboardreset = SAEV_command == SAEC_command_KeyboardReset; cpu_hardreset = ((SAEV_command == SAEC_command_HardReset ? 1 : 0) | hardboot) != 0; +console.warn("m68k_cycle() command start...", SAEV_command, cpu_hardreset); + if (SAEV_command == SAEC_command_Quit) { this.m68k_gone(); return; @@ -243,6 +245,7 @@ var counter = 0; SAEV_config.hook.event.reseted(cpu_hardreset); cpu_hardreset = false; +console.warn("m68k_cycle() ...command done", SAEV_command, cpu_hardreset); } if (startup) { @@ -265,13 +268,13 @@ var counter = 0; if (prevtime !== false) // && SAEV_config.cpu.speed >= 0) SAEV_Events_reflowtime = SAEF_now() - prevtime; +console.log("loop", counter++); + SAER_CPU_run_func(); //if (SAEV_config.cpu.speed >= 0) prevtime = SAEF_now(); -console.log("loop", counter++); - setTimeout(function() { SAER.m68k.m68k_cycle(hardboot, startup); }, 0); } catch(e) { this.m68k_gone(); @@ -288,6 +291,7 @@ console.log("loop", counter++); var hardboot = 1; var startup = 1; +console.warn("stage 3, calling setTimeout()..."); counter = 0; //SAEF_info("m68k.m68k_go()"); @@ -296,6 +300,8 @@ counter = 0; SAER.running = true; //this.m68k_cycle(1, 1); setTimeout(function() { SAER.m68k.m68k_cycle(hardboot, startup); }, 0); + +console.warn("stage 4, ...done"); } this.m68k_gone = function() { //SAEF_info("m68k.m68k_gone()"); diff --git a/sae/utils.js b/sae/utils.js index 8c689ec..a97f67a 100644 --- a/sae/utils.js +++ b/sae/utils.js @@ -479,7 +479,7 @@ function SAEF_ZFile_fopen_file(file) { var l = SAEF_ZFile_create(null, file.name); l.name = file.name.length ? file.name : ""; - if (0) { /* ptr-mode. do not enable */ + if (0) { /* reference-mode. do not enable */ l.data = file.data; } else { l.data = new Uint8Array(file.size); @@ -495,8 +495,7 @@ function SAEF_ZFile_fopen_file(file) { var magic = ((l.data[0] << 24) | (l.data[1] << 16) | (l.data[2] << 8) | (l.data[3])) >>> 0; - SAEF_log("SAEF_ZFile_fopen_file() opening '%s', %d/%d bytes, crc32 0x%08x, magic %08x", - l.name, l.size, l.data.length, file.crc32 !== false ? file.crc32 : 0, magic); + //SAEF_log("SAEF_ZFile_fopen_file() opening '%s', %d/%d bytes, crc32 0x%08x, magic %08x", l.name, l.size, l.data.length, file.crc32 !== false ? file.crc32 : 0, magic); if (magic == 0x04034B50 || magic == 0x504B0304) SAEF_fatal(SAEE_Config_Compressed, "A ZIP file was detected. Compressed files are not yet supported."); From 8367c0d32e5e313aa01ef8308483da1f7803fa8e Mon Sep 17 00:00:00 2001 From: Rupert Hausberger Date: Mon, 1 Aug 2016 22:32:29 +0200 Subject: [PATCH 07/14] update --- sae/amiga.js | 3 --- sae/m68k.js | 12 ------------ 2 files changed, 15 deletions(-) diff --git a/sae/amiga.js b/sae/amiga.js index e3b99cd..eaee448 100644 --- a/sae/amiga.js +++ b/sae/amiga.js @@ -390,7 +390,6 @@ function ScriptedAmigaEmulator() { } this.start_program = function() { -console.warn("stage 2"); this.do_start_program(); if (typeof SAEV_config.hook.event.started === "function") @@ -448,8 +447,6 @@ console.warn("stage 2"); } SAEF_info("sae.start() starting..."); -console.warn("stage 1"); - var err; if ((err = this.config.setup()) != SAEE_None) return err; diff --git a/sae/m68k.js b/sae/m68k.js index ae47b34..ceab82a 100644 --- a/sae/m68k.js +++ b/sae/m68k.js @@ -199,16 +199,12 @@ function SAEO_M68K() { setTimeout(function() { SAER.m68k.m68k_cycle(0, 0); }, 0); } -var counter = 0; - this.m68k_cycle = function(hardboot, startup) { try { if (SAEV_command > 0) { cpu_keyboardreset = SAEV_command == SAEC_command_KeyboardReset; cpu_hardreset = ((SAEV_command == SAEC_command_HardReset ? 1 : 0) | hardboot) != 0; -console.warn("m68k_cycle() command start...", SAEV_command, cpu_hardreset); - if (SAEV_command == SAEC_command_Quit) { this.m68k_gone(); return; @@ -245,7 +241,6 @@ console.warn("m68k_cycle() command start...", SAEV_command, cpu_hardreset); SAEV_config.hook.event.reseted(cpu_hardreset); cpu_hardreset = false; -console.warn("m68k_cycle() ...command done", SAEV_command, cpu_hardreset); } if (startup) { @@ -268,8 +263,6 @@ console.warn("m68k_cycle() ...command done", SAEV_command, cpu_hardreset); if (prevtime !== false) // && SAEV_config.cpu.speed >= 0) SAEV_Events_reflowtime = SAEF_now() - prevtime; -console.log("loop", counter++); - SAER_CPU_run_func(); //if (SAEV_config.cpu.speed >= 0) @@ -291,17 +284,12 @@ console.log("loop", counter++); var hardboot = 1; var startup = 1; -console.warn("stage 3, calling setTimeout()..."); -counter = 0; - //SAEF_info("m68k.m68k_go()"); SAER.events.reset_frame_rate_hack(); SAER.running = true; //this.m68k_cycle(1, 1); setTimeout(function() { SAER.m68k.m68k_cycle(hardboot, startup); }, 0); - -console.warn("stage 4, ...done"); } this.m68k_gone = function() { //SAEF_info("m68k.m68k_gone()"); From 091eda539f22bc2920017b0c076c0822c1cbb146 Mon Sep 17 00:00:00 2001 From: Rupert Hausberger Date: Tue, 2 Aug 2016 00:03:44 +0200 Subject: [PATCH 08/14] update --- sae/video.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sae/video.js b/sae/video.js index 91491f3..936ebab 100644 --- a/sae/video.js +++ b/sae/video.js @@ -278,9 +278,11 @@ function SAEO_Video() { hWnd.div.style.width = String(currentmode.native_width)+"px"; hWnd.div.style.height = String(currentmode.native_height)+"px"; hWnd.div.appendChild(hWnd.canvas); - } else + } else { hWnd.div = null; - + hWnd.canvas.style.width = String(currentmode.native_width)+"px"; + hWnd.canvas.style.height = String(currentmode.native_height)+"px"; + } hWnd.shown = true; } else if (nCmdShow == SW_HIDE && hWnd.shown) { From 470f65cca403b0091a3c8a9fd975a9f94b3b3d74 Mon Sep 17 00:00:00 2001 From: Rupert Hausberger Date: Tue, 2 Aug 2016 22:03:47 +0200 Subject: [PATCH 09/14] update 0.9.0 --- example.htm | 7 ++++++- example.js | 34 ++++++++++++++++++++++++++++++++++ example2.htm | 7 ++++++- index.htm | 1 + index.js | 31 +++++++++++++++++++++++++++++-- sae/amiga.js | 8 +++++++- sae/audio.js | 23 ++++++++++++++++++++--- sae/cpu.js | 36 ------------------------------------ sae/utils.js | 2 +- 9 files changed, 104 insertions(+), 45 deletions(-) diff --git a/example.htm b/example.htm index 340cfb5..f2fe32d 100644 --- a/example.htm +++ b/example.htm @@ -133,6 +133,7 @@ + @@ -144,8 +145,12 @@
+ + The size of the canvas is set by SAE according your settings. + + See example2.htm --> + diff --git a/example.js b/example.js index db072a3..6a89ea4 100644 --- a/example.js +++ b/example.js @@ -23,6 +23,7 @@ var inf = null; /* Reference to the info-object */ var running = false; /* Is the emualtion currently running? */ var paused = false; /* Is the emualtion currently paused? */ +var muted = false; /* Is the audio-output currently muted? */ /*-----------------------------------------------------------------------*/ /* Helpers */ @@ -64,14 +65,27 @@ function switchPauseResume(p) { } } +function switchMutePlay(m) { + var e = document.getElementById("controls_mp"); + if (m) { + e.innerHTML = "Play"; + e.onclick = function() { mute(false); }; + } else { + e.innerHTML = "Mute"; + e.onclick = function() { mute(true); }; + } +} + function saee2text(err) { switch (err) { case SAEE_AlreadyRunning: return "The emulator is already running."; case SAEE_NotRunning: return "The emulator is not running."; case SAEE_NoTimer: return "No timing-functions avail. Please upgrade your browser."; case SAEE_NoMemory: return "Out of memory."; + case SAEE_Assert: return "Assertiation failed."; case SAEE_Internal: return "Internal emulator error."; case SAEE_Config_Invalid: return "Invalid configuration."; + case SAEE_Config_Compressed: return "A ZIP file was detected. Compressed files are not yet supported."; case SAEE_CPU_Internal: return "Internal CPU-error."; case SAEE_CPU_Requires68020: return "The selected kickstart-rom does require a 68020 and 32bit address-space"; case SAEE_CPU_Requires680EC20: return "The selected kickstart-rom does require a 68020."; @@ -327,6 +341,18 @@ function pause(p) { alert(saee2text(err)); } +function mute(m) { + /* Mute or play audio. + true == mute, false == play */ + var err = sae.mute(m); + if (err == SAEE_None) { + muted = m; + switchMutePlay(muted); + /* ... */ + } else + alert(saee2text(err)); +} + function romSelect() { var e = document.getElementById("cfg_rom_file").files[0]; if (e) { @@ -441,6 +467,10 @@ function hook_event_stopped() { paused = false; switchPauseResume(paused); } + if (muted) { + muted = false; + switchMutePlay(muted); + } resetLEDs(); } @@ -450,6 +480,10 @@ function hook_event_reseted(hard) { paused = false; switchPauseResume(paused); } + if (muted) { + muted = false; + switchMutePlay(muted); + } } /* Get call after the emulator has finished switching between pause-resume. */ diff --git a/example2.htm b/example2.htm index 4d7d8db..851aaa2 100644 --- a/example2.htm +++ b/example2.htm @@ -133,6 +133,7 @@ + @@ -141,9 +142,13 @@ Output - + + + diff --git a/index.htm b/index.htm index 781c4b2..f4d4cc7 100644 --- a/index.htm +++ b/index.htm @@ -1678,6 +1678,7 @@ + diff --git a/index.js b/index.js index 3b4aca7..197b99f 100644 --- a/index.js +++ b/index.js @@ -199,6 +199,7 @@ var amaxInfo = null; /* amax rom-info */ var floppyNum = -1; /* current floppy-unit if floppy-info is shown */ var mountConfigNum = -1; /* current mount-unit if mount-info is shown */ var paused = false; /* is the emualtion currently paused? */ +var muted = false; /* is the audio-output currently muted? */ var dskchg = false; /* disk-change requester in database-mode */ var dskchgList = []; /* list of floppies to change, created dynamicaly */ @@ -439,6 +440,17 @@ function switchPauseResume(p) { } } +function switchMutePlay(m) { + var e = document.getElementById("controls_mp"); + if (m) { + e.innerHTML = "Play"; + e.onclick = function() { mute(false); }; + } else { + e.innerHTML = "Mute"; + e.onclick = function() { mute(true); }; + } +} + function switchBaseEmul(emul) { if (emul) { document.body.style.backgroundColor = "#000000"; @@ -489,8 +501,8 @@ function saee2text(err) { case SAEE_NotRunning: return "The emulator is not running."; case SAEE_NoTimer: return "No timing-functions avail. Please upgrade your browser."; case SAEE_NoMemory: return "Out of memory."; - case SAEE_Assert: return "Assertiation failed."; - case SAEE_Internal: return "Internal emulator error."; + case SAEE_Assert: return "Assertiation failed."; + case SAEE_Internal: return "Internal emulator error."; case SAEE_Config_Invalid: return "Invalid configuration."; case SAEE_Config_Compressed: return "A ZIP file was detected. Compressed files are not yet supported."; case SAEE_CPU_Internal: return "Internal CPU-error."; @@ -1433,6 +1445,13 @@ function reset() { sae.reset(false, false); } +function mute(m) { + sae.mute(m); + + muted = m; + switchMutePlay(muted); +} + /*---------------------------------*/ function init() { @@ -2468,6 +2487,10 @@ function hook_event_stopped() { paused = false; switchPauseResume(paused); } + if (muted) { + muted = false; + switchMutePlay(muted); + } if (dskchg) dskchgClose(); @@ -2482,6 +2505,10 @@ function hook_event_reseted(hard) { paused = false; switchPauseResume(paused); } + if (muted) { + muted = false; + switchMutePlay(muted); + } if (dskchg) dskchgClose(); } diff --git a/sae/amiga.js b/sae/amiga.js index eaee448..259ec40 100644 --- a/sae/amiga.js +++ b/sae/amiga.js @@ -586,9 +586,15 @@ function ScriptedAmigaEmulator() { return SAEE_None; }; + this.mute = function(mute) { + this.audio.mute(mute); + return SAEE_None; + }; + this.keyPress = function(e, down) { this.input.keyPress(e, down); - } + return SAEE_None; + }; /*---------------------------------*/ diff --git a/sae/audio.js b/sae/audio.js index a366dee..3989f09 100644 --- a/sae/audio.js +++ b/sae/audio.js @@ -54,6 +54,7 @@ function SAEO_Audio() { const SOUND_SYNC_MULTIPLIER = 1.0; var scaled_sample_evtime_orig = 0.0; + var muted = false; var paused = false; var have_sound = false; var sound_available = false; @@ -213,6 +214,14 @@ function SAEO_Audio() { const INV32768 = 1.0 / 32768; /* mul is always fasten than div */ function scaleplay(e, buffer, frames) { + if (muted) { + for (var ch = 0; ch < SAEV_config.audio.channels; ch++) { + var data = e.outputBuffer.getChannelData(ch); + for (var i = 0; i < e.outputBuffer.length; i++) + data[i] = 0.0; + } + return; + } /*if (driver.context.sampleRate != used_freq) { } else*/ { var step = frames / e.outputBuffer.length; @@ -372,6 +381,8 @@ function SAEO_Audio() { } function reset_sound() { //reset_sound() + muted = paused = false; + cache.readoffset = 0; cache.writeoffset = 0; cache.wait = true; @@ -379,6 +390,10 @@ function SAEO_Audio() { paula.average.clr(); } + function mute_sound(mute) { //OWN + muted = mute; + } + /*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/ @@ -1457,11 +1472,9 @@ function SAEO_Audio() { } this.reset = function() { - var i; - reset_sound(); - for (i = 0; i < sound_filter_state.length; i++) + for (var i = 0; i < sound_filter_state.length; i++) sound_filter_state[i].clr(); for (i = 0; i < AUDIO_CHANNELS_MAX; i++) { @@ -1487,6 +1500,10 @@ function SAEO_Audio() { resume_sound(); } + this.mute = function(mute) { + mute_sound(mute) + } + /*-----------------------------------------------------------------------*/ var prevcon = -1; diff --git a/sae/cpu.js b/sae/cpu.js index 7073dbf..1129c09 100644 --- a/sae/cpu.js +++ b/sae/cpu.js @@ -10229,39 +10229,3 @@ function SAEO_CPU() { return true; } } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sae/utils.js b/sae/utils.js index a97f67a..ce6613d 100644 --- a/sae/utils.js +++ b/sae/utils.js @@ -497,7 +497,7 @@ function SAEF_ZFile_fopen_file(file) { //SAEF_log("SAEF_ZFile_fopen_file() opening '%s', %d/%d bytes, crc32 0x%08x, magic %08x", l.name, l.size, l.data.length, file.crc32 !== false ? file.crc32 : 0, magic); - if (magic == 0x04034B50 || magic == 0x504B0304) + if (magic == 0x504B0304 || magic == 0x04034B50) SAEF_fatal(SAEE_Config_Compressed, "A ZIP file was detected. Compressed files are not yet supported."); //if (l.data[0] == 68 && l.data[1] == 77 && l.data[2] == 83 && l.data[3] == 33) { /* DMS! */ From f1f8a1e84643148a9a5dae8cfa2a0a3a70a385ae Mon Sep 17 00:00:00 2001 From: Rupert Hausberger Date: Sat, 6 Aug 2016 02:19:59 +0200 Subject: [PATCH 10/14] update 0.9.0 --- sae/amiga.js | 13 +++++++++++-- sae/config.js | 2 ++ sae/input.js | 8 ++++++-- sae/video.js | 5 +++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/sae/amiga.js b/sae/amiga.js index 259ec40..cb6935e 100644 --- a/sae/amiga.js +++ b/sae/amiga.js @@ -587,8 +587,17 @@ function ScriptedAmigaEmulator() { }; this.mute = function(mute) { - this.audio.mute(mute); - return SAEE_None; + if (this.running) { + this.audio.mute(mute); + if (mute) + SAEF_log("sae.mute() audio muted"); + else + SAEF_log("sae.mute() playing audio"); + return SAEE_None; + } else { + SAEF_warn("sae.mute() emulation not running"); + return SAEE_NotRunning; + } }; this.keyPress = function(e, down) { diff --git a/sae/config.js b/sae/config.js index add5ab5..a403252 100644 --- a/sae/config.js +++ b/sae/config.js @@ -575,6 +575,7 @@ function SAEO_Config() { id: "", enabled: false, //driver: 0, + hideCursor: false, scandoubler: false, //gfx_scandoubler framerate: 0, //gfx_framerate @@ -1075,6 +1076,7 @@ function SAEO_Configuration() { p.video.id = "video"; p.video.enabled = true; + p.video.hideCursor = true; p.video.scandoubler = false; p.video.framerate = 1; p.video.hresolution = SAEC_Config_Video_HResolution_HiRes; diff --git a/sae/input.js b/sae/input.js index 8574ec9..5bdcafa 100644 --- a/sae/input.js +++ b/sae/input.js @@ -47,15 +47,19 @@ function SAEO_Mouse() { }; this.mouseover = function(e) { - //SAER.video.hideCursor(1); + if (SAEV_config.video.hideCursor) + SAER.video.hideCursor(true); + this.mousemove(e); lx = cx; ly = cy; }; this.mouseout = function(e) { - //SAER.video.hideCursor(0); this.mouseup(e); + + if (SAEV_config.video.hideCursor) + SAER.video.hideCursor(false); }; this.mousemove = function(e) { diff --git a/sae/video.js b/sae/video.js index 936ebab..87601b1 100644 --- a/sae/video.js +++ b/sae/video.js @@ -2017,6 +2017,11 @@ function SAEO_Video() { DirectDraw_ReleaseDC(hdc); }*/ + this.hideCursor = function(hide) { + if (hAmigaWnd !== null && hAmigaWnd.shown) + hAmigaWnd.canvas.style.cursor = hide ? "none" : "auto"; + } + /*-----------------------------------------------------------------------*/ //var flushymin = 0, flushymax = 0; From 7b71a91721111fc7b8c6745cf7f7d23a494a2207 Mon Sep 17 00:00:00 2001 From: Daniel Brooks Date: Sun, 7 Aug 2016 18:31:48 -0700 Subject: [PATCH 11/14] make sure we're unmuted during setup, but don't unmute during reset --- sae/audio.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sae/audio.js b/sae/audio.js index 3989f09..adb5b6e 100644 --- a/sae/audio.js +++ b/sae/audio.js @@ -368,6 +368,7 @@ function SAEO_Audio() { } function setup_sound() { //init_sound() + muted = paused = false; //SAER.gui.data.sndbuf_status = 3; //SAER.gui.data.sndbuf = 0; if (!have_sound) @@ -381,8 +382,6 @@ function SAEO_Audio() { } function reset_sound() { //reset_sound() - muted = paused = false; - cache.readoffset = 0; cache.writeoffset = 0; cache.wait = true; From cffb6c892030253eb1bafcb74ac3cf010fd9e589 Mon Sep 17 00:00:00 2001 From: Intexk Date: Wed, 5 Apr 2017 11:08:07 +0100 Subject: [PATCH 12/14] Update audio.js Improves the perfomance of that function by caching some values that doesn't change during loop. --- sae/audio.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/sae/audio.js b/sae/audio.js index adb5b6e..e256150 100644 --- a/sae/audio.js +++ b/sae/audio.js @@ -214,22 +214,25 @@ function SAEO_Audio() { const INV32768 = 1.0 / 32768; /* mul is always fasten than div */ function scaleplay(e, buffer, frames) { + var chn=SAEV_config.audio.channels; + var z=e.outputBuffer.length; if (muted) { - for (var ch = 0; ch < SAEV_config.audio.channels; ch++) { + for (var ch = 0; ch < chn; ch++) { var data = e.outputBuffer.getChannelData(ch); - for (var i = 0; i < e.outputBuffer.length; i++) + for (var i = 0; i < z; i++) data[i] = 0.0; } return; } /*if (driver.context.sampleRate != used_freq) { } else*/ { - var step = frames / e.outputBuffer.length; + var step = frames / z; - for (var ch = 0; ch < SAEV_config.audio.channels; ch++) { + for (var ch = 0; ch < chn; ch++) { var data = e.outputBuffer.getChannelData(ch); - for (var i = 0, j = 0.0; i < e.outputBuffer.length; i++, j += step) - data[i] = buffer[ch][j >>> 0] * INV32768; + var tbuf=buffer[ch]; + for (var i = 0, j = 0.0; i < z; i++, j += step) + data[i] = tbuf[j >>> 0] * INV32768; } } } From e401b93e22ece5db09a3ced0ac9d131695ac4679 Mon Sep 17 00:00:00 2001 From: Rupert Hausberger Date: Tue, 15 Aug 2017 00:49:19 +0200 Subject: [PATCH 13/14] update 0.9.0 goodies --- disass.htm | 2 +- index.htm | 44 ++++++++++-- index.js | 156 +++++++++++++++++++++++++++++++++++++----- readme.htm | 65 +++++++++++++++++- sae/amiga.js | 21 ++++-- sae/audio.js | 12 ++-- sae/cia.js | 13 ++-- sae/config.js | 37 +++++++--- sae/input.js | 168 +++++++++++++++++++++++++++++++++++++--------- sae/prototypes.js | 24 +++++++ sae/video.js | 73 +++++++++++++++----- 11 files changed, 518 insertions(+), 97 deletions(-) diff --git a/disass.htm b/disass.htm index b12b0cf..f0b1399 100644 --- a/disass.htm +++ b/disass.htm @@ -80,7 +80,7 @@