[PATCH uxn5] Fix Controller vector behaviour for keyboard keys
Export this patch
Ignores key-up events for regular (non-button) keys.
Clears Controller/key byte after eval-ing the vector.
---
src/devices/controller.js | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/devices/controller.js b/src/devices/controller.js
index 4b01d77..cd2d733 100644
--- a/src/devices/controller.js
+++ b/src/devices/controller.js
@@ -53,6 +53,11 @@ function Controller(emu)
event.preventDefault();
}
emu.uxn.dev[0x82] = this.state;
- emu.uxn.eval(peek16(emu.uxn.dev, 0x80))
+ if(mask || event.type == "keydown") {
+ emu.uxn.eval(peek16(emu.uxn.dev, 0x80))
+ }
+ if(event.type == "keydown") {
+ emu.uxn.dev[0x83] = 0;
+ }
}
}
--
2.39.5 (Apple Git-154)