From 36af27e26031b003b0c733641650982c9adcdc2f Mon Sep 17 00:00:00 2001 From: Kuba Orlik Date: Tue, 30 Jun 2020 14:41:25 +0200 Subject: [PATCH] Checkpoint --- .gitignore | 4 +++- README.md | 0 classic-controller.js | 18 +++++++++--------- config.js | 0 index.js | 0 io.js | 0 keyboard-simulator.js | 0 logger-config.js | 0 package-lock.json | 0 package.json | 0 simulator.js | 0 sleep.js | 0 uinput.js | 0 wii-device.js | 10 ++++++---- wii-devices.js | 0 wiimote.js | 20 ++++++++++---------- xbox-pad-simulator.js | 0 17 files changed, 28 insertions(+), 24 deletions(-) mode change 100644 => 100755 .gitignore mode change 100644 => 100755 README.md mode change 100644 => 100755 classic-controller.js mode change 100644 => 100755 config.js mode change 100644 => 100755 index.js mode change 100644 => 100755 io.js mode change 100644 => 100755 keyboard-simulator.js mode change 100644 => 100755 logger-config.js mode change 100644 => 100755 package-lock.json mode change 100644 => 100755 package.json mode change 100644 => 100755 simulator.js mode change 100644 => 100755 sleep.js mode change 100644 => 100755 uinput.js mode change 100644 => 100755 wii-device.js mode change 100644 => 100755 wii-devices.js mode change 100644 => 100755 wiimote.js mode change 100644 => 100755 xbox-pad-simulator.js diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 index b512c09..b07186d --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -node_modules \ No newline at end of file +node_modules +find-ffmax-bit + diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/classic-controller.js b/classic-controller.js old mode 100644 new mode 100755 index 8457351..8084bdd --- a/classic-controller.js +++ b/classic-controller.js @@ -23,11 +23,11 @@ class ClassicController extends WiiDevice { ZR: 57, R: 55, ZL: 56, - L: 54, + L: 54 }); this.configs = { - "Xbox360 controller": new Config(XboxPadSimulator, { + "Xbox360 controller - literal": new Config(XboxPadSimulator, { button_to_original_keycode: this.buttons, button_to_simulated_event_name: { A: "BTN_A", @@ -44,8 +44,8 @@ class ClassicController extends WiiDevice { R: "BTN_TR", L: "BTN_TL", ZL: "BTN_TL2", - ZR: "BTN_TR2", - }, + ZR: "BTN_TR2" + } }), "Xbox360 controller - swap DPAD X/Y (starwhal)": new Config( XboxPadSimulator, @@ -66,8 +66,8 @@ class ClassicController extends WiiDevice { R: "BTN_TR", L: "BTN_TL", ZL: "BTN_TL2", - ZR: "BTN_TR2", - }, + ZR: "BTN_TR2" + } } ), logger: new LoggerConfig(), @@ -88,9 +88,9 @@ class ClassicController extends WiiDevice { ZR: "KEY_Z", R: "KEY_R", ZL: "KEY_Q", - L: "KEY_L", - }, - }), + L: "KEY_L" + } + }) }; } } diff --git a/config.js b/config.js old mode 100644 new mode 100755 diff --git a/index.js b/index.js old mode 100644 new mode 100755 diff --git a/io.js b/io.js old mode 100644 new mode 100755 diff --git a/keyboard-simulator.js b/keyboard-simulator.js old mode 100644 new mode 100755 diff --git a/logger-config.js b/logger-config.js old mode 100644 new mode 100755 diff --git a/package-lock.json b/package-lock.json old mode 100644 new mode 100755 diff --git a/package.json b/package.json old mode 100644 new mode 100755 diff --git a/simulator.js b/simulator.js old mode 100644 new mode 100755 diff --git a/sleep.js b/sleep.js old mode 100644 new mode 100755 diff --git a/uinput.js b/uinput.js old mode 100644 new mode 100755 diff --git a/wii-device.js b/wii-device.js old mode 100644 new mode 100755 index d15977d..f2456c8 --- a/wii-device.js +++ b/wii-device.js @@ -58,7 +58,7 @@ class WiiDevice extends EventEmitter { this.cat = spawn("cat", [this.handler_file]); this.stream = this.cat.stdout; this.pressed_buttons_count = 0; - this.stream.on("data", buf => { + this.stream.on("data", (buf) => { while (buf.length) { let slice = buf.slice(0, WIIMOTE_EVENT_BYTESIZE); this.emit("input", new WiiDeviceEvent(slice, this)); @@ -82,7 +82,7 @@ class WiiDevice extends EventEmitter { process.exit(13); } const stream = fs.createReadStream("any", { fd: handler_file_fd }); - stream.on("data", buf => { + stream.on("data", (buf) => { while (buf.length) { let slice = buf.slice(0, WIIMOTE_EVENT_BYTESIZE); this.emit("input", new WiiDeviceEvent(slice, this)); @@ -96,9 +96,11 @@ class WiiDevice extends EventEmitter { } get_handler_file(handlers) { - return `/dev/input/${ - handlers.filter(handler => handler.startsWith("event"))[0] + const ret = `/dev/input/${ + handlers.filter((handler) => handler.startsWith("event"))[0] }`; + console.log(ret); + return ret; } setConfig(config_key) { diff --git a/wii-devices.js b/wii-devices.js old mode 100644 new mode 100755 diff --git a/wiimote.js b/wiimote.js old mode 100644 new mode 100755 index eb3ab6a..ea6229c --- a/wiimote.js +++ b/wiimote.js @@ -42,16 +42,16 @@ class Wiimote extends WiiDevice { "Xbox360 controller - Towerfall": new Config(XboxPadSimulator, { button_to_original_keycode: this.buttons, button_to_simulated_event_name: { - TWO: "BTN_A", - ONE: "BTN_B", - B: "BTN_Y", - A: "BTN_TR", - UP: "BTN_DPAD_LEFT", - DOWN: "BTN_DPAD_RIGHT", - LEFT: "BTN_DPAD_DOWN", - RIGHT: "BTN_DPAD_UP", - PLUS: "BTN_START", - MINUS: "BTN_A", + TWO: "BTN_A", //jest dobrze - skok + ONE: "BTN_B", // jest dobrze - strzał + B: "BTN_Y", // jest dobrze - dash + A: "BTN_TR", // jest dobrze - zmiana kolejności strzał + UP: "BTN_DPAD_LEFT", // jest dobrze + DOWN: "BTN_DPAD_RIGHT", // jest dobrze + LEFT: "BTN_DPAD_DOWN", // jest dobrze + RIGHT: "BTN_DPAD_UP", // jest dobrze + PLUS: "BTN_START", // jest dobrze + MINUS: "BTN_SELECT", // jest dobrze - eksplodowanie zdalnych strzał HOME: "BTN_MODE" } }), diff --git a/xbox-pad-simulator.js b/xbox-pad-simulator.js old mode 100644 new mode 100755