diff --git a/IodineGBA/core/graphics/RendererShim.js b/IodineGBA/core/graphics/RendererShim.js index 4973a5c..255f312 100644 --- a/IodineGBA/core/graphics/RendererShim.js +++ b/IodineGBA/core/graphics/RendererShim.js @@ -144,7 +144,7 @@ GameBoyAdvanceGraphicsRendererShim.prototype.shareDynamicBuffers = function () { }); } //Wake up the producer "GPU" thread: - Atomics.wake(gfxCounters, 2, 1); + Atomics.notify(gfxCounters, 2, 1); } GameBoyAdvanceGraphicsRendererShim.prototype.pushCommand = function (command, data) { command = command | 0; diff --git a/IodineGBA/includes/TypedArrayShim.js b/IodineGBA/includes/TypedArrayShim.js index 5926584..23c15dc 100644 --- a/IodineGBA/includes/TypedArrayShim.js +++ b/IodineGBA/includes/TypedArrayShim.js @@ -177,6 +177,10 @@ if (typeof Atomics == "object") { if (typeof Atomics.futexWait == "function" && typeof Atomics.wait == "undefined") { //Polyfill in deprecated call names: Atomics.wait = Atomics.futexWait; - Atomics.wake = Atomics.futexWake; + Atomics.notify = Atomics.futexWake; + } + else if (typeof Atomics.wake == "function" && typeof Atomics.notify == "undefined") { + //Polyfill in deprecated call names: + Atomics.notify = Atomics.wake; } } diff --git a/user_scripts/CoreGlueCode.js b/user_scripts/CoreGlueCode.js index b4e12f7..316dc56 100644 --- a/user_scripts/CoreGlueCode.js +++ b/user_scripts/CoreGlueCode.js @@ -131,11 +131,9 @@ function initTimer() { IodineGUI.coreTimerID = setInterval(function () { IodineGUI.Iodine.timerCallback(((+(new Date()).getTime()) - (+IodineGUI.startTime)) >>> 0); }, IodineGUI.defaults.timerRate | 0); - findRealClock(); } function calculateTiming() { IodineGUI.Iodine.setIntervalRate(+IodineGUI.defaults.timerRate); - findRealClock(); } function startTimer() { IodineGUI.coreTimerID = setInterval(function () { @@ -155,81 +153,6 @@ function updateTimer(newRate) { } } } -function findRealClock() { - var count = 0; - var startTime = +(new Date()).getTime(); - var realTimer = setInterval(function () { - if (!IodineGUI.suspended) { - count = ((count | 0) + 1) | 0; - if (count == 20) { - var timeDiff = ((+(new Date()).getTime()) - (+startTime)) >>> 0; - var trueRate = timeDiff / 20; - if ((+trueRate) > 17) { - count = 0; - } - else { - var delta = +((+trueRate) - (IodineGUI.defaults.timerRate | 0)); - if ((IodineGUI.defaults.timerRate | 0) == 16) { - if (delta > -0.1 && delta < 0.1) { - clearInterval(realTimer); - } - else if ((trueRate - 1000/64) > -0.1 && (trueRate - 1000/64) < 0.1) { - IodineGUI.Iodine.setIntervalRate(1000/64); - clearInterval(realTimer); - } - else if ((trueRate - 50/3) > -0.1 && (trueRate - 50/3) < 0.1) { - IodineGUI.Iodine.setIntervalRate(50/3); - clearInterval(realTimer); - } - else { - count = 0; - } - } - else if ((IodineGUI.defaults.timerRate | 0) == 4) { - if (delta > -0.1 && delta < 0.1) { - clearInterval(realTimer); - } - else if ((trueRate - 25/6) > -0.1 && (trueRate - 25/6) < 0.1) { - IodineGUI.Iodine.setIntervalRate(25/6); - clearInterval(realTimer); - } - else { - count = 0; - } - } - else if ((IodineGUI.defaults.timerRate | 0) == 8) { - if (delta > -0.1 && delta < 0.1) { - clearInterval(realTimer); - } - else if ((trueRate - 25/3) > -0.1 && (trueRate - 25/3) < 0.1) { - IodineGUI.Iodine.setIntervalRate(25/3); - clearInterval(realTimer); - } - else { - count = 0; - } - } - else { - if (delta > -0.1 && delta < 0.1) { - clearInterval(realTimer); - } - else if (trueRate < 16) { - IodineGUI.Iodine.setIntervalRate(+trueRate); - clearInterval(realTimer); - } - else { - count = 0; - } - } - - } - } - } - else { - count = 0; - } - }, IodineGUI.defaults.timerRate | 0); -} function registerBlitterHandler() { IodineGUI.Blitter = new GfxGlueCode(240, 160); IodineGUI.Blitter.attachCanvas(document.getElementById("emulator_target")); diff --git a/user_scripts/WorkerGfxGlueCode.js b/user_scripts/WorkerGfxGlueCode.js index f74330e..cfa08f5 100644 --- a/user_scripts/WorkerGfxGlueCode.js +++ b/user_scripts/WorkerGfxGlueCode.js @@ -106,7 +106,7 @@ IodineGBAWorkerGfxShim.prototype.graphicsHeartBeat = function () { //Copy the buffer out to local: this.consumeGraphicsBuffer(); //Wake up the producer thread: - Atomics.wake(gfxCounters, 2, 1); + Atomics.notify(gfxCounters, 2, 1); } } IodineGBAWorkerGfxShim.prototype.consumeGraphicsBuffer = function () { diff --git a/user_scripts/WorkerGlueCode.js b/user_scripts/WorkerGlueCode.js index 573645f..2a697ed 100644 --- a/user_scripts/WorkerGlueCode.js +++ b/user_scripts/WorkerGlueCode.js @@ -257,7 +257,7 @@ IodineGBAWorkerShim.prototype.graphicsHeartBeat = function () { //Copy the buffer out to local: this.consumeGraphicsBuffer(); //Wake up the producer thread: - Atomics.wake(this.gfxCounters, 2, 1); + Atomics.notify(this.gfxCounters, 2, 1); } } IodineGBAWorkerShim.prototype.consumeGraphicsBuffer = function () {