diff options
| author | Jasper St. Pierre <jstpierre@mecheye.net> | 2014-09-04 19:22:31 -0700 |
|---|---|---|
| committer | Jasper St. Pierre <jstpierre@mecheye.net> | 2014-11-28 10:51:30 -0800 |
| commit | 64014d1dcd36b2b1a011ace7dd69ec6bf1203a0d (patch) | |
| tree | 52ae94028fcf75b531d3df14d805c18f5773e8d6 /Source/Core | |
| parent | cd950023569562ffe2b814139095963faa742a6b (diff) | |
Nunchuk: Use the accel_cal struct directly in nu_cal
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/Core/HW/WiimoteEmu/WiimoteHid.h | 7 |
2 files changed, 4 insertions, 5 deletions
diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.cpp b/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.cpp index 7bf603b47d..a400e10f27 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.cpp @@ -112,7 +112,7 @@ void Nunchuk::GetState(u8* const data) // flip the button bits :/ ncdata->bt.hex ^= 0x03; - accel_cal& calib = *(accel_cal*)®.calibration; + accel_cal& calib = cal.cal; u16 x = (u16)(accel.x * (calib.one_g.x - calib.zero_g.x) + calib.zero_g.x); u16 y = (u16)(accel.y * (calib.one_g.y - calib.zero_g.y) + calib.zero_g.y); diff --git a/Source/Core/Core/HW/WiimoteEmu/WiimoteHid.h b/Source/Core/Core/HW/WiimoteEmu/WiimoteHid.h index 78d430b8bb..dc8d268d6b 100644 --- a/Source/Core/Core/HW/WiimoteEmu/WiimoteHid.h +++ b/Source/Core/Core/HW/WiimoteEmu/WiimoteHid.h @@ -518,6 +518,8 @@ struct accel_cal } one_g; }; +static_assert(sizeof(accel_cal) == 8, "acceleration data needs needs to be 8 bytes"); + struct nu_js { u8 max, min, center; @@ -525,10 +527,7 @@ struct nu_js struct nu_cal { - wm_accel cal_zero; // zero calibration - u8 pad1; - wm_accel cal_g; // g size - u8 pad2; + accel_cal cal; nu_js jx; nu_js jy; u8 sum[2]; |
