Wiiuse:Backport some changes from the libogc version of wiiuse.
Still got a lot to back port :(. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4307 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
+37
@@ -69,7 +69,10 @@ int guitar_hero_3_handshake(struct wiimote_t* wm, struct guitar_hero_3_t* gh3, b
|
||||
gh3->btns = 0;
|
||||
gh3->btns_held = 0;
|
||||
gh3->btns_released = 0;
|
||||
gh3->wb_raw = 0;
|
||||
gh3->whammy_bar = 0.0f;
|
||||
gh3->tb_raw = 0;
|
||||
gh3->touch_bar = -1;
|
||||
|
||||
/* decrypt data */
|
||||
for (i = 0; i < len; ++i)
|
||||
@@ -107,6 +110,7 @@ int guitar_hero_3_handshake(struct wiimote_t* wm, struct guitar_hero_3_t* gh3, b
|
||||
gh3->js.center.y = GUITAR_HERO_3_JS_CENTER_Y;
|
||||
|
||||
/* handshake done */
|
||||
wm->event = WIIUSE_GUITAR_HERO_3_CTRL_INSERTED;
|
||||
wm->exp.type = EXP_GUITAR_HERO_3;
|
||||
|
||||
#ifdef WIN32
|
||||
@@ -143,11 +147,40 @@ void guitar_hero_3_event(struct guitar_hero_3_t* gh3, byte* msg) {
|
||||
|
||||
guitar_hero_3_pressed_buttons(gh3, BIG_ENDIAN_SHORT(*(short*)(msg + 4)));
|
||||
|
||||
gh3->js.pos.x = (msg[0] & GUITAR_HERO_3_JS_MASK);
|
||||
gh3->js.pos.y = (msg[1] & GUITAR_HERO_3_JS_MASK);
|
||||
gh3->tb_raw = (msg[2] & GUITAR_HERO_3_TOUCH_MASK);
|
||||
gh3->wb_raw = (msg[3] & GUITAR_HERO_3_WHAMMY_MASK);
|
||||
|
||||
/* touch bar */
|
||||
gh3->touch_bar = 0;
|
||||
if (gh3->tb_raw > 0x1B)
|
||||
gh3->touch_bar = GUITAR_HERO_3_TOUCH_ORANGE;
|
||||
else if (gh3->tb_raw > 0x18)
|
||||
gh3->touch_bar = GUITAR_HERO_3_TOUCH_ORANGE | GUITAR_HERO_3_TOUCH_BLUE;
|
||||
else if (gh3->tb_raw > 0x15)
|
||||
gh3->touch_bar = GUITAR_HERO_3_TOUCH_BLUE;
|
||||
else if (gh3->tb_raw > 0x13)
|
||||
gh3->touch_bar = GUITAR_HERO_3_TOUCH_BLUE | GUITAR_HERO_3_TOUCH_YELLOW;
|
||||
else if (gh3->tb_raw > 0x10)
|
||||
gh3->touch_bar = GUITAR_HERO_3_TOUCH_YELLOW;
|
||||
else if (gh3->tb_raw > 0x0D)
|
||||
gh3->touch_bar = GUITAR_HERO_3_TOUCH_AVAILABLE;
|
||||
else if (gh3->tb_raw > 0x0B)
|
||||
gh3->touch_bar = GUITAR_HERO_3_TOUCH_YELLOW | GUITAR_HERO_3_TOUCH_RED;
|
||||
else if (gh3->tb_raw > 0x08)
|
||||
gh3->touch_bar = GUITAR_HERO_3_TOUCH_RED;
|
||||
else if (gh3->tb_raw > 0x05)
|
||||
gh3->touch_bar = GUITAR_HERO_3_TOUCH_RED | GUITAR_HERO_3_TOUCH_GREEN;
|
||||
else if (gh3->tb_raw > 0x02)
|
||||
gh3->touch_bar = GUITAR_HERO_3_TOUCH_GREEN;
|
||||
|
||||
/* 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);
|
||||
|
||||
/* joy stick */
|
||||
calc_joystick_state(&gh3->js, msg[0], msg[1]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -158,9 +191,13 @@ void guitar_hero_3_event(struct guitar_hero_3_t* gh3, byte* msg) {
|
||||
* @param msg The message byte specified in the event packet.
|
||||
*/
|
||||
static void guitar_hero_3_pressed_buttons(struct guitar_hero_3_t* gh3, short now) {
|
||||
|
||||
/* message is inverted (0 is active, 1 is inactive) */
|
||||
now = ~now & GUITAR_HERO_3_BUTTON_ALL;
|
||||
|
||||
/* preserve old btns pressed */
|
||||
gh3->btns_last = gh3->btns;
|
||||
|
||||
/* pressed now & were pressed, then held */
|
||||
gh3->btns_held = (now & gh3->btns);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user