diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/Attachment/Nunchuk.cpp b/Source/Core/Core/Src/HW/WiimoteEmu/Attachment/Nunchuk.cpp index 312b084c45..87752e8372 100644 --- a/Source/Core/Core/Src/HW/WiimoteEmu/Attachment/Nunchuk.cpp +++ b/Source/Core/Core/Src/HW/WiimoteEmu/Attachment/Nunchuk.cpp @@ -121,4 +121,28 @@ void Nunchuk::GetState(u8* const data, const bool focus) dt->z = u8(trim(accel.z * (calib->one_g.z - calib->zero_g.z) + calib->zero_g.z)); } +void Nunchuk::LoadDefaults(const ControllerInterface& ciface) +{ + // ugly macroooo + #define set_control(group, num, str) (group)->controls[num]->control_ref->expression = (str) + + // Stick + set_control(m_stick, 0, "W"); // up + set_control(m_stick, 1, "S"); // down + set_control(m_stick, 2, "A"); // left + set_control(m_stick, 3, "D"); // right + + // Buttons +#ifdef _WIN32 + set_control(m_buttons, 0, "LCONTROL"); // C + set_control(m_buttons, 1, "LSHIFT"); // Z +#elif __APPLE__ + set_control(m_buttons, 0, "Left Control"); // C + set_control(m_buttons, 1, "Left Shift"); // Z +#else + set_control(m_buttons, 0, "Control_L"); // C + set_control(m_buttons, 1, "Shift_L"); // Z +#endif +} + } diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/Attachment/Nunchuk.h b/Source/Core/Core/Src/HW/WiimoteEmu/Attachment/Nunchuk.h index 6235a0bbfd..0e1c037db4 100644 --- a/Source/Core/Core/Src/HW/WiimoteEmu/Attachment/Nunchuk.h +++ b/Source/Core/Core/Src/HW/WiimoteEmu/Attachment/Nunchuk.h @@ -21,6 +21,8 @@ public: BUTTON_Z = 0x01, }; + void LoadDefaults(const ControllerInterface& ciface); + private: Tilt* m_tilt; Force* m_swing; diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp index d7792727f0..06f43a07a0 100644 --- a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp +++ b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp @@ -856,11 +856,9 @@ void Wiimote::InterruptChannel(const u16 _channelID, const void* _pData, u32 _Si void Wiimote::LoadDefaults(const ControllerInterface& ciface) { - #define set_control(group, num, str) (group)->controls[num]->control_ref->expression = (str) - ControllerEmu::LoadDefaults(ciface); - // TODO: finish this + #define set_control(group, num, str) (group)->controls[num]->control_ref->expression = (str) // Buttons #if defined HAVE_X11 && HAVE_X11 @@ -870,14 +868,19 @@ void Wiimote::LoadDefaults(const ControllerInterface& ciface) set_control(m_buttons, 0, "Click 0"); // A set_control(m_buttons, 1, "Click 1"); // B #endif - //set_control(m_buttons, 2, ""); // 1 - //set_control(m_buttons, 3, ""); // 2 - //set_control(m_buttons, 4, ""); // - - //set_control(m_buttons, 5, ""); // + - //set_control(m_buttons, 6, ""); // Start + set_control(m_buttons, 2, "1"); // 1 + set_control(m_buttons, 3, "2"); // 2 + set_control(m_buttons, 4, "Q"); // - + set_control(m_buttons, 5, "E"); // + + +#ifdef _WIN32 + set_control(m_buttons, 6, "RETURN"); // Home +#else + set_control(m_buttons, 6, "Return"); // Home +#endif // Shake - for (unsigned int i=0; i<3; ++i) + for (size_t i = 0; i != 3; ++i) set_control(m_shake, i, "Click 2"); // IR @@ -904,6 +907,12 @@ void Wiimote::LoadDefaults(const ControllerInterface& ciface) set_control(m_dpad, 3, "Right"); // Right #endif + // ugly stuff + // enable nunchuk + m_extension->switch_extension = 1; + + // set nunchuk defaults + m_extension->attachments[1]->LoadDefaults(ciface); } }