From 4d12ee3a0336cab303b4bdf433b2d2c00e0caf4a Mon Sep 17 00:00:00 2001 From: Ben Smith Date: Tue, 29 Aug 2023 09:37:16 -0700 Subject: [PATCH] Fix snesmouse --- docs/demo.js | 6 ++++-- docs/worker.js | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/demo.js b/docs/demo.js index 69256cb..f4cf481 100644 --- a/docs/demo.js +++ b/docs/demo.js @@ -358,14 +358,14 @@ let vm = new Vue({ this.files.show = !this.files.show; if (this.files.show) { this.input.show = false; - this.setPaused(this.paused); + this.setPaused(true); } }, toggleInputDialog: function() { this.input.show = !this.input.show; if (this.input.show) { this.files.show = false; - this.setPaused(paused); + this.setPaused(true); } }, reset: function(active) { @@ -519,6 +519,8 @@ class Emulator { this.boundGamepadConnected = null; this.boundGamepadDisconnected = null; this.boundMouseEvent = null; + this.mouseFracX = 0; + this.mouseFracY = 0; this.bindEvents(); diff --git a/docs/worker.js b/docs/worker.js index dfcfd52..512b81e 100644 --- a/docs/worker.js +++ b/docs/worker.js @@ -47,6 +47,9 @@ onmessage = async function(e) { case 'snesmouse': if (emulator) { emulator.inputSnesMouse(e.data.index, e.data.idx, e.data.idy, e.data.lmb, e.data.rmb); } break; + case 'updateControllerType': + if (emulator) { emulator.updateControllerType(e.data.inputType); } + break; } }; @@ -247,7 +250,7 @@ class Emulator { inputSnesMouse(index, idx, idy, lmb, rmb) { this.module._add_snesmouse_delta(this.e, index, idx, idy); - this.module._set_snesmouse_buttons(this.e, indedx, lmb, rmb); + this.module._set_snesmouse_buttons(this.e, index, lmb, rmb); } }