From 24a785af5936afd9e8939073763bcddc4407be2a Mon Sep 17 00:00:00 2001 From: ayuanx Date: Fri, 4 Dec 2009 21:13:27 +0000 Subject: [PATCH] With Roll & Pitch binding to "Keyboard" and both degrees setting to "Free Swing", the "Pitch Left" and "Pitch Right" keys on keyboard now work like "Swing to left" and "Swing to right". This enables you to use knife on a keyboard instead of an analog stick in games of "Resident Evil: Umbrella Chronicles" and "Resident Evil: Darkside Chronicles". git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4642 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Plugins/Plugin_Wiimote/Src/FillReport.cpp | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp b/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp index 167f919e6a..1a5d63f34f 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp @@ -444,32 +444,20 @@ void SingleShake(u8 &_x, u8 &_y, u8 &_z, int wm) switch(Shake[wm]) { case 1: - case 3: _x = g_wm.cal_zero.x / 2; _y = g_wm.cal_zero.y / 2; _z = g_wm.cal_zero.z / 2; break; - case 5: - case 7: - _x = (0xFF - g_wm.cal_zero.x ) / 2; - _y = (0xFF - g_wm.cal_zero.y ) / 2; - _z = (0xFF - g_wm.cal_zero.z ) / 2; - break; case 2: - _x = 0x00; - _y = 0x00; - _z = 0x00; - break; - case 6: - _x = 0xFF; - _y = 0xFF; - _z = 0xFF; - break; - case 4: _x = 0x80; _y = 0x80; _z = 0x80; break; + case 3: + _x = (0xFF - g_wm.cal_zero.x ) / 2; + _y = (0xFF - g_wm.cal_zero.y ) / 2; + _z = (0xFF - g_wm.cal_zero.z ) / 2; + break; default: Shake[wm] = -1; _x = g_wm.cal_zero.x; @@ -501,7 +489,7 @@ void TiltWiimoteGamepad(int &Roll, int &Pitch) adjustment. And instead for example upsize the XInput trigger from 0x80 to 0x8000. */ int Lx, Ly, Rx, Ry, Tl, Tr; - PadStateAdjustments(Lx, Ly, Rx, Ry, Tl, Tr);; + PadStateAdjustments(Lx, Ly, Rx, Ry, Tl, Tr); // Save the Range in degrees, 45 and 90 are good values in some games int RollRange = g_Config.Trigger.Range.Roll; @@ -555,16 +543,27 @@ void TiltWiimoteGamepad(int &Roll, int &Pitch) void TiltWiimoteKeyboard(int &Roll, int &Pitch) { #ifdef _WIN32 - if(IsKey(g_Wiimote_kbd.PITCH_L)) + // Direct map keyboard pitch to roll + if (g_Config.Trigger.Range.Roll == 0 && g_Config.Trigger.Range.Pitch == 0) + { + if (IsKey(g_Wiimote_kbd.PITCH_L)) + Roll = -128 / 2; + else if (IsKey(g_Wiimote_kbd.PITCH_R)) + Roll = 128 / 2; + + return; + } + + if (IsKey(g_Wiimote_kbd.PITCH_L)) { // Stop at the upper end of the range - if(KbDegree < g_Config.Trigger.Range.Pitch) + if (KbDegree < g_Config.Trigger.Range.Pitch) KbDegree += 3; // aim left } - else if(IsKey(g_Wiimote_kbd.PITCH_R)) + else if (IsKey(g_Wiimote_kbd.PITCH_R)) { // Stop at the lower end of the range - if(KbDegree > -g_Config.Trigger.Range.Pitch) + if (KbDegree > -g_Config.Trigger.Range.Pitch) KbDegree -= 3; // aim right } @@ -611,7 +610,8 @@ void Tilt(u8 &_x, u8 &_y, u8 &_z) TiltWiimoteGamepad(Roll, Pitch); // Adjust angles, it's only needed if both roll and pitch is used together - if (g_Config.Trigger.Range.Roll != 0 && g_Config.Trigger.Range.Pitch != 0) AdjustAngles(Roll, Pitch); + if (g_Config.Trigger.Range.Roll != 0 && g_Config.Trigger.Range.Pitch != 0) + AdjustAngles(Roll, Pitch); // Calculate the accelerometer value from this tilt angle //PitchDegreeToAccelerometer(Roll, Pitch, _x, _y, _z, g_Config.Trigger.Roll, g_Config.Trigger.Pitch);