Updated mappings

master
Kuba Orlik 5 years ago
parent b66a521764
commit 6cdfebca23

@ -1,8 +1,12 @@
const WiiDevices = require("./wii-devices.js"); const WiiDevices = require("./wii-devices.js");
const WiiDevice = require("./wii-device.js");
const sleep = require("./sleep.js"); const sleep = require("./sleep.js");
const inquirer = require("inquirer"); const inquirer = require("inquirer");
global.listInputs = function listInputs() {
const execSync = require("sync-exec");
console.log(execSync(`ls -l /dev/input/event* | wc -l`).stdout);
};
async function wait_for_wii_devices() { async function wait_for_wii_devices() {
const wii_devices = WiiDevices.get_wii_devices(); const wii_devices = WiiDevices.get_wii_devices();
if (wii_devices.length) { if (wii_devices.length) {
@ -30,8 +34,8 @@ async function main() {
type: "list", type: "list",
name: "mode", name: "mode",
message: "which mode do you choose?", message: "which mode do you choose?",
choices: Object.keys(wii_device.configs), choices: Object.keys(wii_device.configs)
}, }
]); ]);
wii_device.setConfig(mode); wii_device.setConfig(mode);
console.log(`Started ${wii_device.name} in '${mode}' mode`); console.log(`Started ${wii_device.name} in '${mode}' mode`);

@ -19,7 +19,7 @@ class Wiimote extends WiiDevice {
RIGHT: 106, RIGHT: 106,
LEFT: 105, LEFT: 105,
UP: 103, UP: 103,
DOWN: 108, DOWN: 108
}); });
this.configs = { this.configs = {
@ -36,24 +36,24 @@ class Wiimote extends WiiDevice {
RIGHT: "BTN_DPAD_UP", RIGHT: "BTN_DPAD_UP",
PLUS: "BTN_START", PLUS: "BTN_START",
MINUS: "BTN_SELECT", MINUS: "BTN_SELECT",
HOME: "BTN_MODE", HOME: "BTN_MODE"
}, }
}), }),
"Xbox360 controller - Towerfall": new Config(XboxPadSimulator, { "Xbox360 controller - Towerfall": new Config(XboxPadSimulator, {
button_to_original_keycode: this.buttons, button_to_original_keycode: this.buttons,
button_to_simulated_event_name: { button_to_simulated_event_name: {
TWO: "BTN_B", TWO: "BTN_A",
ONE: "BTN_Y", ONE: "BTN_B",
B: "BTN_TR", B: "BTN_Y",
A: "BTN_X", A: "BTN_TR",
UP: "BTN_DPAD_LEFT", UP: "BTN_DPAD_LEFT",
DOWN: "BTN_DPAD_RIGHT", DOWN: "BTN_DPAD_RIGHT",
LEFT: "BTN_DPAD_DOWN", LEFT: "BTN_DPAD_DOWN",
RIGHT: "BTN_DPAD_UP", RIGHT: "BTN_DPAD_UP",
PLUS: "BTN_START", PLUS: "BTN_START",
MINUS: "BTN_A", MINUS: "BTN_A",
HOME: "BTN_MODE", HOME: "BTN_MODE"
}, }
}), }),
"Xbox360 controller - swap dpad X/Y (Starwhal)": new Config( "Xbox360 controller - swap dpad X/Y (Starwhal)": new Config(
XboxPadSimulator, XboxPadSimulator,
@ -70,8 +70,8 @@ class Wiimote extends WiiDevice {
RIGHT: "BTN_DPAD_LEFT", RIGHT: "BTN_DPAD_LEFT",
PLUS: "BTN_START", PLUS: "BTN_START",
MINUS: "BTN_SELECT", MINUS: "BTN_SELECT",
HOME: "BTN_MODE", HOME: "BTN_MODE"
}, }
} }
), ),
wsad: new Config(KeyboardSimulator, { wsad: new Config(KeyboardSimulator, {
@ -87,8 +87,8 @@ class Wiimote extends WiiDevice {
MINUS: "KEY_Z", MINUS: "KEY_Z",
PLUS: "KEY_X", PLUS: "KEY_X",
ONE: "KEY_C", ONE: "KEY_C",
TWO: "KEY_V", TWO: "KEY_V"
}, }
}), }),
"Keyboard - 0123..": new Config(KeyboardSimulator, { "Keyboard - 0123..": new Config(KeyboardSimulator, {
button_to_original_keycode: this.buttons, button_to_original_keycode: this.buttons,
@ -103,8 +103,8 @@ class Wiimote extends WiiDevice {
MINUS: "KEY_7", MINUS: "KEY_7",
PLUS: "KEY_8", PLUS: "KEY_8",
ONE: "KEY_9", ONE: "KEY_9",
HOME: "KEY_ESC", HOME: "KEY_ESC"
}, }
}), }),
"Keyboard - QWERTY": new Config(KeyboardSimulator, { "Keyboard - QWERTY": new Config(KeyboardSimulator, {
button_to_original_keycode: this.buttons, button_to_original_keycode: this.buttons,
@ -120,10 +120,10 @@ class Wiimote extends WiiDevice {
MINUS: "KEY_I", MINUS: "KEY_I",
PLUS: "KEY_O", PLUS: "KEY_O",
ONE: "KEY_P", ONE: "KEY_P",
HOME: "KEY_ESC", HOME: "KEY_ESC"
}, }
}), }),
logger: new LoggerConfig(), logger: new LoggerConfig()
}; };
} }
} }

@ -8,7 +8,7 @@ class XboxControllerSimulator extends Simulator {
name: "Microsoft X-Box 360 pad", name: "Microsoft X-Box 360 pad",
vendor: 0x045e, vendor: 0x045e,
product: 0x028e, product: 0x028e,
version: 1, version: 1
}, },
[ [
"A", "A",
@ -25,7 +25,7 @@ class XboxControllerSimulator extends Simulator {
"DPAD_UP", "DPAD_UP",
"DPAD_DOWN", "DPAD_DOWN",
"DPAD_LEFT", "DPAD_LEFT",
"DPAD_RIGHT", "DPAD_RIGHT"
].map(btn_name => `BTN_${btn_name}`) ].map(btn_name => `BTN_${btn_name}`)
); );
} }

Loading…
Cancel
Save