diff options
| author | Pierre Bourdon <delroth@gmail.com> | 2014-07-28 20:34:00 -0700 |
|---|---|---|
| committer | Pierre Bourdon <delroth@gmail.com> | 2014-07-28 20:34:00 -0700 |
| commit | 062bce8b7ed138b0ef470747cc215d1a9c80067e (patch) | |
| tree | fe326b245921ada176f3d3484f9d8e923da8222c /Source/Core | |
| parent | 9f86d3efcf1f687f5cfbe69b081aeeedb0cb9bb9 (diff) | |
| parent | cee07ff16e5a0bf62364fea0f232727a28acaf5a (diff) | |
Merge pull request #659 from Parlane/classic_controller_fix2
Classic controller fix
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/HW/WiimoteEmu/Attachment/Classic.cpp | 12 | ||||
| -rw-r--r-- | Source/Core/Core/HW/WiimoteEmu/Attachment/Classic.h | 11 |
2 files changed, 17 insertions, 6 deletions
diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Classic.cpp b/Source/Core/Core/HW/WiimoteEmu/Attachment/Classic.cpp index 80673c8f6a..a996cf44a7 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Classic.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Classic.cpp @@ -92,8 +92,8 @@ void Classic::GetState(u8* const data) double x, y; m_left_stick->GetState(&x, &y); - ccdata->lx = (x * 0x1F) + 0x20; - ccdata->ly = (y * 0x1F) + 0x20; + ccdata->lx = Classic::LEFT_STICK_CENTER_X + (x * Classic::LEFT_STICK_RADIUS); + ccdata->ly = Classic::LEFT_STICK_CENTER_Y + (y * Classic::LEFT_STICK_RADIUS); } // right stick @@ -102,8 +102,8 @@ void Classic::GetState(u8* const data) u8 x_, y_; m_right_stick->GetState(&x, &y); - x_ = (x * 0x1F) + 0x20; - y_ = (y * 0x1F) + 0x20; + x_ = Classic::RIGHT_STICK_CENTER_X + (x * Classic::RIGHT_STICK_RADIUS); + y_ = Classic::RIGHT_STICK_CENTER_Y + (y * Classic::RIGHT_STICK_RADIUS); ccdata->rx1 = x_; ccdata->rx2 = x_ >> 1; @@ -117,8 +117,8 @@ void Classic::GetState(u8* const data) u8 lt, rt; m_triggers->GetState(&ccdata->bt, classic_trigger_bitmasks, trigs); - lt = trigs[0] * 0x1F; - rt = trigs[1] * 0x1F; + lt = trigs[0] * Classic::LEFT_TRIGGER_RANGE; + rt = trigs[1] * Classic::RIGHT_TRIGGER_RANGE; ccdata->lt1 = lt; ccdata->lt2 = lt >> 3; diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Classic.h b/Source/Core/Core/HW/WiimoteEmu/Attachment/Classic.h index 6b4701d9bb..8076d2b15b 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Classic.h +++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Classic.h @@ -35,6 +35,17 @@ public: PAD_UP = 0x0100, }; + static const u8 LEFT_STICK_CENTER_X = 0x20; + static const u8 LEFT_STICK_CENTER_Y = 0x20; + static const u8 LEFT_STICK_RADIUS = 0x1F; + + static const u8 RIGHT_STICK_CENTER_X = 0x10; + static const u8 RIGHT_STICK_CENTER_Y = 0x10; + static const u8 RIGHT_STICK_RADIUS = 0x0F; + + static const u8 LEFT_TRIGGER_RANGE = 0x1F; + static const u8 RIGHT_TRIGGER_RANGE = 0x1F; + private: Buttons* m_buttons; MixedTriggers* m_triggers; |
