MessageProcessor::MessageProcessor(ControllerSlotConfigPtr config, const ControllerMessageDescriptor& desc, const Options& opts) : m_config(config), m_desc(desc), m_oldmsg(), m_config_toggle_button(-1), m_rumble_gain(opts.rumble_gain), m_rumble_test(opts.rumble), m_rumble_callback() { if (opts.config_toggle_button_is_set) { m_config_toggle_button = desc.key().get(opts.config_toggle_button); } for(std::vector<ModifierPtr>::iterator i = m_config->get_config()->get_modifier().begin(); i != m_config->get_config()->get_modifier().end(); ++i) { (*i)->init(m_desc); } // BROKEN: must do this for all configs, not just the current one m_config->get_config()->get_emitter().init(m_desc); }
void Button2AxisModifier::init(ControllerMessageDescriptor& desc) { m_lhs_btn = desc.key().get(m_lhs_btn_str); m_rhs_btn = desc.key().get(m_rhs_btn_str); m_axis = desc.abs().get(m_axis_str); }
void ButtonCombination::init(const ControllerMessageDescriptor& desc) { m_buttons.clear(); for(ButtonsStr::const_iterator it = m_buttons_str.begin(); it != m_buttons_str.end(); ++it) { m_buttons.push_back(desc.key().get(*it)); } std::sort(m_buttons.begin(), m_buttons.end()); }
void CompatModifier::init(ControllerMessageDescriptor& desc) { log_tmp("CompatModifier"); #if 0 // have a dpad, but no dpad axis if (!desc.abs().has(AbsName("gamepad.dpad_x")) && !desc.abs().has(AbsName("gamepad.dpad_y")) && desc.key().has(KeyName("gamepad.dpad_up")) && desc.key().has(KeyName("gamepad.dpad_down")) && desc.key().has(KeyName("gamepad.dpad_left")) && desc.key().has(KeyName("gamepad.dpad_right"))) { log_tmp("CompatModifier: DPAD"); m_dpad_x = desc.abs().put("dpad_x"); m_dpad_y = desc.abs().put("dpad_y"); m_dpad_up = desc.key().get("du"); m_dpad_down = desc.key().get("dd"); m_dpad_left = desc.key().get("dl"); m_dpad_right = desc.key().get("dr"); m_dpad = true; } // make a rudder out of both trigger if (!desc.abs().has("trigger") && desc.abs().has("lt") && desc.abs().has("rt")) { m_abs_trigger = desc.abs().put("trigger"); m_lt = desc.abs().get("lt"); m_rt = desc.abs().get("rt"); m_trigger = true; } #endif }
Xbox360DefaultNames::Xbox360DefaultNames(ControllerMessageDescriptor& desc) : btn_a(-1), btn_b(-1), btn_x(-1), btn_y(-1), btn_start(-1), btn_guide(-1), btn_back(-1), btn_thumb_l(-1), btn_thumb_r(-1), btn_lb(-1), btn_rb(-1), btn_lt(-1), btn_rt(-1), dpad_up(-1), dpad_down(-1), dpad_left(-1), dpad_right(-1), abs_x1(-1), abs_y1(-1), abs_x2(-1), abs_y2(-1), abs_lt(-1), abs_rt(-1), abs_a(-1), abs_b(-1), abs_x(-1), abs_y(-1), abs_black(-1), abs_white(-1) { #if 0 else if (str == "trigger" || str == "z" || str == "rudder") return XBOX_AXIS_TRIGGER; #endif btn_a = desc.key().put(KeyName("xbox.a")); btn_b = desc.key().put(KeyName("xbox.b")); btn_x = desc.key().put(KeyName("xbox.x")); btn_y = desc.key().put(KeyName("xbox.y")); btn_start = desc.key().put(KeyName("xbox.start")); btn_guide = desc.key().put(KeyName("xbox.guide")); btn_back = desc.key().put(KeyName("xbox.back")); btn_lb = desc.key().put(KeyName("xbox.lb")); btn_rb = desc.key().put(KeyName("xbox.rb")); btn_lt = desc.key().put(KeyName("xbox.lt")); btn_rt = desc.key().put(KeyName("xbox.rt")); btn_thumb_l = desc.key().put(KeyName("xbox.thumb_l")); btn_thumb_r = desc.key().put(KeyName("xbox.thumb_r")); dpad_up = desc.key().put(KeyName("xbox.dpad_up")); dpad_down = desc.key().put(KeyName("xbox.dpad_down")); dpad_left = desc.key().put(KeyName("xbox.dpad_left")); dpad_right = desc.key().put(KeyName("xbox.dpad_right")); abs_x1 = desc.abs().put(AbsName("xbox.x1")); abs_y1 = desc.abs().put(AbsName("xbox.y1")); abs_x2 = desc.abs().put(AbsName("xbox.x2")); abs_y2 = desc.abs().put(AbsName("xbox.y2")); abs_lt = desc.abs().put(AbsName("xbox.lt")); abs_rt = desc.abs().put(AbsName("xbox.rt")); abs_a = desc.abs().put(AbsName("xbox.a")); abs_b = desc.abs().put(AbsName("xbox.b")); abs_x = desc.abs().put(AbsName("xbox.x")); abs_y = desc.abs().put(AbsName("xbox.y")); abs_black = desc.abs().put(AbsName("xbox.black")); abs_white = desc.abs().put(AbsName("xbox.white")); }
WiiNames::WiiNames(ControllerMessageDescriptor& desc) : plus(-1), home(-1), minus(-1), a(-1), b(-1), btn1(-1), btn2(-1), dpad_up(-1), dpad_down(-1), dpad_left(-1), dpad_right(-1), acc_x(-1), acc_y(-1), acc_z(-1), ir1_x(-1), ir1_y(-1), ir1_size(-1), ir2_x(-1), ir2_y(-1), ir2_size(-1), ir3_x(-1), ir3_y(-1), ir3_size(-1), ir4_x(-1), ir4_y(-1), ir4_size(-1), nunchuk_x(-1), nunchuk_y(-1), nunchuk_c(-1), nunchuk_z(-1), nunchuk_acc_x(-1), nunchuk_acc_y(-1), nunchuk_acc_z(-1) { minus = desc.key().put(KeyName("wiimote.minus")); home = desc.key().put(KeyName("wiimote.home")); plus = desc.key().put(KeyName("wiimote.plus")); a = desc.key().put(KeyName("wiimote.a")); b = desc.key().put(KeyName("wiimote.b")); btn1 = desc.key().put(KeyName("wiimote.1")); btn2 = desc.key().put(KeyName("wiimote.2")); dpad_up = desc.key().put(KeyName("wiimote.dpad_up")); dpad_down = desc.key().put(KeyName("wiimote.dpad_down")); dpad_left = desc.key().put(KeyName("wiimote.dpad_left")); dpad_right = desc.key().put(KeyName("wiimote.dpad_right")); acc_x = desc.abs().put(AbsName("wiimote.acc_x")); acc_y = desc.abs().put(AbsName("wiimote.acc_y")); acc_z = desc.abs().put(AbsName("wiimote.acc_z")); ir1_x = desc.abs().put(AbsName("wiimote.ir1_x")); ir1_y = desc.abs().put(AbsName("wiimote.ir1_y")); ir1_size = desc.abs().put(AbsName("wiimote.ir1_size")); ir2_x = desc.abs().put(AbsName("wiimote.ir2_x")); ir2_y = desc.abs().put(AbsName("wiimote.ir2_y")); ir2_size = desc.abs().put(AbsName("wiimote.ir2_size")); ir3_x = desc.abs().put(AbsName("wiimote.ir3_x")); ir3_y = desc.abs().put(AbsName("wiimote.ir3_y")); ir3_size = desc.abs().put(AbsName("wiimote.ir3_size")); ir4_x = desc.abs().put(AbsName("wiimote.ir4_x")); ir4_y = desc.abs().put(AbsName("wiimote.ir4_y")); ir4_size = desc.abs().put(AbsName("wiimote.ir4_size")); nunchuk_x = desc.abs().put(AbsName("nunchuk.x1")); nunchuk_y = desc.abs().put(AbsName("nunchuk.y1")); nunchuk_c = desc.key().put(KeyName("nunchuk.c")); nunchuk_z = desc.key().put(KeyName("nunchuk.z")); nunchuk_acc_x = desc.abs().put(AbsName("nunchuk.acc_x")); nunchuk_acc_y = desc.abs().put(AbsName("nunchuk.acc_x")); nunchuk_acc_z = desc.abs().put(AbsName("nunchuk.acc_y")); }
HamaCruxNames::HamaCruxNames(ControllerMessageDescriptor& desc) : crouch(desc.key().put(KeyName("hama-crux.crouch"))), run(desc.key().put(KeyName("hama-crux.run"))), talk(desc.key().put(KeyName("hama-crux.talk"))), esc(desc.key().put(KeyName("hama-crux.escape"))), pause(desc.key().put(KeyName("hama-crux.pause"))), option(desc.key().put(KeyName("hama-crux.option"))), quickload(desc.key().put(KeyName("hama-crux.quickload"))), quicksave(desc.key().put(KeyName("hama-crux.quicksave"))), print(desc.key().put(KeyName("hama-crux.print"))), n1(desc.key().put(KeyName("hama-crux.n1"))), n2(desc.key().put(KeyName("hama-crux.n2"))), n3(desc.key().put(KeyName("hama-crux.n3"))), n4(desc.key().put(KeyName("hama-crux.n4"))), n5(desc.key().put(KeyName("hama-crux.n5"))), n6(desc.key().put(KeyName("hama-crux.n6"))), n7(desc.key().put(KeyName("hama-crux.n7"))), n8(desc.key().put(KeyName("hama-crux.n8"))), n9(desc.key().put(KeyName("hama-crux.n9"))), n10(desc.key().put(KeyName("hama-crux.n10"))), n11(desc.key().put(KeyName("hama-crux.n11"))), up(desc.key().put(KeyName("hama-crux.up"))), down(desc.key().put(KeyName("hama-crux.down"))), left(desc.key().put(KeyName("hama-crux.left"))), right(desc.key().put(KeyName("hama-crux.right"))), q(desc.key().put(KeyName("hama-crux.q"))), e(desc.key().put(KeyName("hama-crux.e"))), c1(desc.key().put(KeyName("hama-crux.c1"))), tab(desc.key().put(KeyName("hama-crux.tab"))), c2(desc.key().put(KeyName("hama-crux.c2"))), c3(desc.key().put(KeyName("hama-crux.c3"))), c4(desc.key().put(KeyName("hama-crux.c4"))), reload(desc.key().put(KeyName("hama-crux.reload"))), use(desc.key().put(KeyName("hama-crux.use"))), c8(desc.key().put(KeyName("hama-crux.c8"))), p2(desc.key().put(KeyName("hama-crux.p2"))), n(desc.key().put(KeyName("hama-crux.n"))), c5(desc.key().put(KeyName("hama-crux.c5"))), c6(desc.key().put(KeyName("hama-crux.c6"))), c7(desc.key().put(KeyName("hama-crux.c7"))), p1(desc.key().put(KeyName("hama-crux.p1"))), space(desc.key().put(KeyName("hama-crux.space"))) { }
void init(ControllerMessageDescriptor& desc) { m_key = desc.key().getput(m_name); }
HamaCruxNames::HamaCruxNames(ControllerMessageDescriptor& desc) : crouch(desc.key().put("crouch")), run(desc.key().put("run")), talk(desc.key().put("talk")), esc(desc.key().put("escape")), pause(desc.key().put("pause")), option(desc.key().put("option")), quickload(desc.key().put("quickload")), quicksave(desc.key().put("quicksave")), print(desc.key().put("print")), n1(desc.key().put("n1")), n2(desc.key().put("n2")), n3(desc.key().put("n3")), n4(desc.key().put("n4")), n5(desc.key().put("n5")), n6(desc.key().put("n6")), n7(desc.key().put("n7")), n8(desc.key().put("n8")), n9(desc.key().put("n9")), n10(desc.key().put("n10")), n11(desc.key().put("n11")), up(desc.key().put("up")), down(desc.key().put("down")), left(desc.key().put("left")), right(desc.key().put("right")), q(desc.key().put("q")), e(desc.key().put("e")), c1(desc.key().put("c1")), tab(desc.key().put("tab")), c2(desc.key().put("c2")), c3(desc.key().put("c3")), c4(desc.key().put("c4")), reload(desc.key().put("reload")), use(desc.key().put("use")), c8(desc.key().put("c8")), p2(desc.key().put("p2")), n(desc.key().put("n")), c5(desc.key().put("c5")), c6(desc.key().put("c6")), c7(desc.key().put("c7")), p1(desc.key().put("p1")), space(desc.key().put("space")) { }