Checkpoint

master
Kuba Orlik 4 years ago
parent 6cdfebca23
commit 36af27e260

4
.gitignore vendored

@ -1 +1,3 @@
node_modules
node_modules
find-ffmax-bit

@ -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"
}
})
};
}
}

@ -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) {

@ -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"
}
}),

Loading…
Cancel
Save