Set up some more emulated wiimote default keys. Enabled the nunchuk extension by default, with some key mappings. Fixes Issue 4266.(mostly)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7424 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak 2011-03-30 23:32:19 +00:00
parent 3ef8a57da6
commit 28c32fcbc7
3 changed files with 44 additions and 9 deletions

View File

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

View File

@ -21,6 +21,8 @@ public:
BUTTON_Z = 0x01, BUTTON_Z = 0x01,
}; };
void LoadDefaults(const ControllerInterface& ciface);
private: private:
Tilt* m_tilt; Tilt* m_tilt;
Force* m_swing; Force* m_swing;

View File

@ -856,11 +856,9 @@ void Wiimote::InterruptChannel(const u16 _channelID, const void* _pData, u32 _Si
void Wiimote::LoadDefaults(const ControllerInterface& ciface) void Wiimote::LoadDefaults(const ControllerInterface& ciface)
{ {
#define set_control(group, num, str) (group)->controls[num]->control_ref->expression = (str)
ControllerEmu::LoadDefaults(ciface); ControllerEmu::LoadDefaults(ciface);
// TODO: finish this #define set_control(group, num, str) (group)->controls[num]->control_ref->expression = (str)
// Buttons // Buttons
#if defined HAVE_X11 && HAVE_X11 #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, 0, "Click 0"); // A
set_control(m_buttons, 1, "Click 1"); // B set_control(m_buttons, 1, "Click 1"); // B
#endif #endif
//set_control(m_buttons, 2, ""); // 1 set_control(m_buttons, 2, "1"); // 1
//set_control(m_buttons, 3, ""); // 2 set_control(m_buttons, 3, "2"); // 2
//set_control(m_buttons, 4, ""); // - set_control(m_buttons, 4, "Q"); // -
//set_control(m_buttons, 5, ""); // + set_control(m_buttons, 5, "E"); // +
//set_control(m_buttons, 6, ""); // Start
#ifdef _WIN32
set_control(m_buttons, 6, "RETURN"); // Home
#else
set_control(m_buttons, 6, "Return"); // Home
#endif
// Shake // Shake
for (unsigned int i=0; i<3; ++i) for (size_t i = 0; i != 3; ++i)
set_control(m_shake, i, "Click 2"); set_control(m_shake, i, "Click 2");
// IR // IR
@ -904,6 +907,12 @@ void Wiimote::LoadDefaults(const ControllerInterface& ciface)
set_control(m_dpad, 3, "Right"); // Right set_control(m_dpad, 3, "Right"); // Right
#endif #endif
// ugly stuff
// enable nunchuk
m_extension->switch_extension = 1;
// set nunchuk defaults
m_extension->attachments[1]->LoadDefaults(ciface);
} }
} }