Updated mappings

master
Kuba Orlik 5 years ago
parent b66a521764
commit 6cdfebca23

@ -1,8 +1,12 @@
const WiiDevices = require("./wii-devices.js");
const WiiDevice = require("./wii-device.js");
const sleep = require("./sleep.js");
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() {
const wii_devices = WiiDevices.get_wii_devices();
if (wii_devices.length) {
@ -30,8 +34,8 @@ async function main() {
type: "list",
name: "mode",
message: "which mode do you choose?",
choices: Object.keys(wii_device.configs),
},
choices: Object.keys(wii_device.configs)
}
]);
wii_device.setConfig(mode);
console.log(`Started ${wii_device.name} in '${mode}' mode`);

@ -19,7 +19,7 @@ class Wiimote extends WiiDevice {
RIGHT: 106,
LEFT: 105,
UP: 103,
DOWN: 108,
DOWN: 108
});
this.configs = {
@ -36,24 +36,24 @@ class Wiimote extends WiiDevice {
RIGHT: "BTN_DPAD_UP",
PLUS: "BTN_START",
MINUS: "BTN_SELECT",
HOME: "BTN_MODE",
},
HOME: "BTN_MODE"
}
}),
"Xbox360 controller - Towerfall": new Config(XboxPadSimulator, {
button_to_original_keycode: this.buttons,
button_to_simulated_event_name: {
TWO: "BTN_B",
ONE: "BTN_Y",
B: "BTN_TR",
A: "BTN_X",
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",
HOME: "BTN_MODE",
},
HOME: "BTN_MODE"
}
}),
"Xbox360 controller - swap dpad X/Y (Starwhal)": new Config(
XboxPadSimulator,
@ -70,8 +70,8 @@ class Wiimote extends WiiDevice {
RIGHT: "BTN_DPAD_LEFT",
PLUS: "BTN_START",
MINUS: "BTN_SELECT",
HOME: "BTN_MODE",
},
HOME: "BTN_MODE"
}
}
),
wsad: new Config(KeyboardSimulator, {
@ -87,8 +87,8 @@ class Wiimote extends WiiDevice {
MINUS: "KEY_Z",
PLUS: "KEY_X",
ONE: "KEY_C",
TWO: "KEY_V",
},
TWO: "KEY_V"
}
}),
"Keyboard - 0123..": new Config(KeyboardSimulator, {
button_to_original_keycode: this.buttons,
@ -103,8 +103,8 @@ class Wiimote extends WiiDevice {
MINUS: "KEY_7",
PLUS: "KEY_8",
ONE: "KEY_9",
HOME: "KEY_ESC",
},
HOME: "KEY_ESC"
}
}),
"Keyboard - QWERTY": new Config(KeyboardSimulator, {
button_to_original_keycode: this.buttons,
@ -120,10 +120,10 @@ class Wiimote extends WiiDevice {
MINUS: "KEY_I",
PLUS: "KEY_O",
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",
vendor: 0x045e,
product: 0x028e,
version: 1,
version: 1
},
[
"A",
@ -25,7 +25,7 @@ class XboxControllerSimulator extends Simulator {
"DPAD_UP",
"DPAD_DOWN",
"DPAD_LEFT",
"DPAD_RIGHT",
"DPAD_RIGHT"
].map(btn_name => `BTN_${btn_name}`)
);
}

Loading…
Cancel
Save