try using endianness conversion functions instead of icky macros

This commit is contained in:
Ryan Pavlik
2011-09-02 16:14:27 -05:00
parent 8216db96f6
commit 44612529a7
7 changed files with 73 additions and 39 deletions

View File

@@ -135,7 +135,7 @@ void guitar_hero_3_event(struct guitar_hero_3_t* gh3, byte* msg) {
for (i = 0; i < 6; ++i)
msg[i] = (msg[i] ^ 0x17) + 0x17;
guitar_hero_3_pressed_buttons(gh3, BIG_ENDIAN_SHORT(*(short*)(msg + 4)));
guitar_hero_3_pressed_buttons(gh3, from_big_endian_uint16_t(msg + 4));
/* whammy bar */
gh3->whammy_bar = (msg[3] - GUITAR_HERO_3_WHAMMY_BAR_MIN) / (float)(GUITAR_HERO_3_WHAMMY_BAR_MAX - GUITAR_HERO_3_WHAMMY_BAR_MIN);