diff --git a/source/ngc/gui/gui.h b/source/ngc/gui/gui.h index 4bde56a..d927484 100644 --- a/source/ngc/gui/gui.h +++ b/source/ngc/gui/gui.h @@ -216,7 +216,8 @@ class GuiTrigger u8 type; //!< trigger type (TRIGGER_SIMPLE, TRIGGER_HELD, TRIGGER_BUTTON_ONLY, TRIGGER_BUTTON_ONLY_IN_FOCUS) s32 chan; //!< Trigger controller channel (0-3, -1 for all) - WPADData wpad; //!< Wii controller trigger data + WPADData * wpad; //!< Wii controller trigger + WPADData wpaddata; //!< Wii controller trigger data PADData pad; //!< GameCube controller trigger data }; diff --git a/source/ngc/gui/gui_button.cpp b/source/ngc/gui/gui_button.cpp index 0b5a9a7..93890ce 100644 --- a/source/ngc/gui/gui_button.cpp +++ b/source/ngc/gui/gui_button.cpp @@ -161,9 +161,9 @@ void GuiButton::Update(GuiTrigger * t) #ifdef HW_RVL // cursor - if(t->wpad.ir.valid && t->chan >= 0) + if(t->wpad->ir.valid && t->chan >= 0) { - if(this->IsInside(t->wpad.ir.x, t->wpad.ir.y)) + if(this->IsInside(t->wpad->ir.x, t->wpad->ir.y)) { if(state == STATE_DEFAULT) // we weren't on the button before! { @@ -209,24 +209,24 @@ void GuiButton::Update(GuiTrigger * t) if(trigger[i] && (trigger[i]->chan == -1 || trigger[i]->chan == t->chan)) { // higher 16 bits only (wiimote) - wm_btns = t->wpad.btns_d << 16; - wm_btns_trig = trigger[i]->wpad.btns_d << 16; + wm_btns = t->wpad->btns_d << 16; + wm_btns_trig = trigger[i]->wpad->btns_d << 16; // lower 16 bits only (classic controller) - cc_btns = t->wpad.btns_d >> 16; - cc_btns_trig = trigger[i]->wpad.btns_d >> 16; + cc_btns = t->wpad->btns_d >> 16; + cc_btns_trig = trigger[i]->wpad->btns_d >> 16; if( - (t->wpad.btns_d > 0 && + (t->wpad->btns_d > 0 && (wm_btns == wm_btns_trig || - (cc_btns == cc_btns_trig && t->wpad.exp.type == EXP_CLASSIC))) || + (cc_btns == cc_btns_trig && t->wpad->exp.type == EXP_CLASSIC))) || (t->pad.btns_d == trigger[i]->pad.btns_d && t->pad.btns_d > 0)) { if(t->chan == stateChan || stateChan == -1) { if(state == STATE_SELECTED) { - if(!t->wpad.ir.valid || this->IsInside(t->wpad.ir.x, t->wpad.ir.y)) + if(!t->wpad->ir.valid || this->IsInside(t->wpad->ir.x, t->wpad->ir.y)) { this->SetState(STATE_CLICKED, t->chan); @@ -259,19 +259,19 @@ void GuiButton::Update(GuiTrigger * t) if(trigger[i] && (trigger[i]->chan == -1 || trigger[i]->chan == t->chan)) { // higher 16 bits only (wiimote) - wm_btns = t->wpad.btns_d << 16; - wm_btns_h = t->wpad.btns_h << 16; - wm_btns_trig = trigger[i]->wpad.btns_h << 16; + wm_btns = t->wpad->btns_d << 16; + wm_btns_h = t->wpad->btns_h << 16; + wm_btns_trig = trigger[i]->wpad->btns_h << 16; // lower 16 bits only (classic controller) - cc_btns = t->wpad.btns_d >> 16; - cc_btns_h = t->wpad.btns_h >> 16; - cc_btns_trig = trigger[i]->wpad.btns_h >> 16; + cc_btns = t->wpad->btns_d >> 16; + cc_btns_h = t->wpad->btns_h >> 16; + cc_btns_trig = trigger[i]->wpad->btns_h >> 16; if( - (t->wpad.btns_d > 0 && + (t->wpad->btns_d > 0 && (wm_btns == wm_btns_trig || - (cc_btns == cc_btns_trig && t->wpad.exp.type == EXP_CLASSIC))) || + (cc_btns == cc_btns_trig && t->wpad->exp.type == EXP_CLASSIC))) || (t->pad.btns_d == trigger[i]->pad.btns_h && t->pad.btns_d > 0)) { if(trigger[i]->type == TRIGGER_HELD && state == STATE_SELECTED && @@ -280,9 +280,9 @@ void GuiButton::Update(GuiTrigger * t) } if( - (t->wpad.btns_h > 0 && + (t->wpad->btns_h > 0 && (wm_btns_h == wm_btns_trig || - (cc_btns_h == cc_btns_trig && t->wpad.exp.type == EXP_CLASSIC))) || + (cc_btns_h == cc_btns_trig && t->wpad->exp.type == EXP_CLASSIC))) || (t->pad.btns_h == trigger[i]->pad.btns_h && t->pad.btns_h > 0)) { if(trigger[i]->type == TRIGGER_HELD) diff --git a/source/ngc/gui/gui_filebrowser.cpp b/source/ngc/gui/gui_filebrowser.cpp index 3025ddc..f543b4f 100644 --- a/source/ngc/gui/gui_filebrowser.cpp +++ b/source/ngc/gui/gui_filebrowser.cpp @@ -239,12 +239,12 @@ void GuiFileBrowser::Update(GuiTrigger * t) // move the file listing to respond to wiimote cursor movement if(scrollbarBoxBtn->GetState() == STATE_HELD && scrollbarBoxBtn->GetStateChan() == t->chan && - t->wpad.ir.valid && + t->wpad->ir.valid && browser.numEntries > FILE_PAGESIZE ) { scrollbarBoxBtn->SetPosition(0,0); - positionWiimote = t->wpad.ir.y - 60 - scrollbarBoxBtn->GetTop(); + positionWiimote = t->wpad->ir.y - 60 - scrollbarBoxBtn->GetTop(); if(positionWiimote < scrollbarBoxBtn->GetMinY()) positionWiimote = scrollbarBoxBtn->GetMinY(); @@ -267,13 +267,13 @@ void GuiFileBrowser::Update(GuiTrigger * t) if(arrowDownBtn->GetState() == STATE_HELD && arrowDownBtn->GetStateChan() == t->chan) { - t->wpad.btns_h |= WPAD_BUTTON_DOWN; + t->wpad->btns_h |= WPAD_BUTTON_DOWN; if(!this->IsFocused()) ((GuiWindow *)this->GetParent())->ChangeFocus(this); } else if(arrowUpBtn->GetState() == STATE_HELD && arrowUpBtn->GetStateChan() == t->chan) { - t->wpad.btns_h |= WPAD_BUTTON_UP; + t->wpad->btns_h |= WPAD_BUTTON_UP; if(!this->IsFocused()) ((GuiWindow *)this->GetParent())->ChangeFocus(this); } @@ -395,7 +395,7 @@ void GuiFileBrowser::Update(GuiTrigger * t) int currChan = t->chan; - if(t->wpad.ir.valid && !fileList[i]->IsInside(t->wpad.ir.x, t->wpad.ir.y)) + if(t->wpad->ir.valid && !fileList[i]->IsInside(t->wpad->ir.x, t->wpad->ir.y)) t->chan = -1; fileList[i]->Update(t); diff --git a/source/ngc/gui/gui_optionbrowser.cpp b/source/ngc/gui/gui_optionbrowser.cpp index 3a3e100..cd1b820 100644 --- a/source/ngc/gui/gui_optionbrowser.cpp +++ b/source/ngc/gui/gui_optionbrowser.cpp @@ -281,7 +281,7 @@ void GuiOptionBrowser::Update(GuiTrigger * t) int currChan = t->chan; - if(t->wpad.ir.valid && !optionBtn[i]->IsInside(t->wpad.ir.x, t->wpad.ir.y)) + if(t->wpad->ir.valid && !optionBtn[i]->IsInside(t->wpad->ir.x, t->wpad->ir.y)) t->chan = -1; optionBtn[i]->Update(t); diff --git a/source/ngc/gui/gui_savebrowser.cpp b/source/ngc/gui/gui_savebrowser.cpp index e78cd37..57b4dec 100644 --- a/source/ngc/gui/gui_savebrowser.cpp +++ b/source/ngc/gui/gui_savebrowser.cpp @@ -389,11 +389,11 @@ void GuiSaveBrowser::Update(GuiTrigger * t) else if(focus && i == selectedItem && saveBtn[i]->GetState() == STATE_DEFAULT) saveBtn[selectedItem]->SetState(STATE_SELECTED, t->chan); - if(t->wpad.ir.valid) + if(t->wpad->ir.valid) { - if(!saveBtnLastOver[i] && saveBtn[i]->IsInside(t->wpad.ir.x, t->wpad.ir.y)) + if(!saveBtnLastOver[i] && saveBtn[i]->IsInside(t->wpad->ir.x, t->wpad->ir.y)) saveBtn[i]->ResetState(); - saveBtnLastOver[i] = saveBtn[i]->IsInside(t->wpad.ir.x, t->wpad.ir.y); + saveBtnLastOver[i] = saveBtn[i]->IsInside(t->wpad->ir.x, t->wpad->ir.y); } saveBtn[i]->Update(t); diff --git a/source/ngc/gui/gui_trigger.cpp b/source/ngc/gui/gui_trigger.cpp index e0a2020..3ee7128 100644 --- a/source/ngc/gui/gui_trigger.cpp +++ b/source/ngc/gui/gui_trigger.cpp @@ -18,8 +18,9 @@ static int scrollDelay = 0; GuiTrigger::GuiTrigger() { chan = -1; - memset(&wpad, 0, sizeof(WPADData)); + memset(&wpaddata, 0, sizeof(WPADData)); memset(&pad, 0, sizeof(PADData)); + wpad = &wpaddata; } /** @@ -38,7 +39,7 @@ void GuiTrigger::SetSimpleTrigger(s32 ch, u32 wiibtns, u16 gcbtns) { type = TRIGGER_SIMPLE; chan = ch; - wpad.btns_d = wiibtns; + wpaddata.btns_d = wiibtns; pad.btns_d = gcbtns; } @@ -51,7 +52,7 @@ void GuiTrigger::SetHeldTrigger(s32 ch, u32 wiibtns, u16 gcbtns) { type = TRIGGER_HELD; chan = ch; - wpad.btns_h = wiibtns; + wpaddata.btns_h = wiibtns; pad.btns_h = gcbtns; } @@ -63,7 +64,7 @@ void GuiTrigger::SetButtonOnlyTrigger(s32 ch, u32 wiibtns, u16 gcbtns) { type = TRIGGER_BUTTON_ONLY; chan = ch; - wpad.btns_d = wiibtns; + wpaddata.btns_d = wiibtns; pad.btns_d = gcbtns; } @@ -76,7 +77,7 @@ void GuiTrigger::SetButtonOnlyInFocusTrigger(s32 ch, u32 wiibtns, u16 gcbtns) { type = TRIGGER_BUTTON_ONLY_IN_FOCUS; chan = ch; - wpad.btns_d = wiibtns; + wpaddata.btns_d = wiibtns; pad.btns_d = gcbtns; } @@ -93,27 +94,27 @@ s8 GuiTrigger::WPAD_Stick(u8 right, int axis) float mag = 0.0; float ang = 0.0; - switch (wpad.exp.type) + switch (wpad->exp.type) { case WPAD_EXP_NUNCHUK: case WPAD_EXP_GUITARHERO3: if (right == 0) { - mag = wpad.exp.nunchuk.js.mag; - ang = wpad.exp.nunchuk.js.ang; + mag = wpad->exp.nunchuk.js.mag; + ang = wpad->exp.nunchuk.js.ang; } break; case WPAD_EXP_CLASSIC: if (right == 0) { - mag = wpad.exp.classic.ljs.mag; - ang = wpad.exp.classic.ljs.ang; + mag = wpad->exp.classic.ljs.mag; + ang = wpad->exp.classic.ljs.ang; } else { - mag = wpad.exp.classic.rjs.mag; - ang = wpad.exp.classic.rjs.ang; + mag = wpad->exp.classic.rjs.mag; + ang = wpad->exp.classic.rjs.ang; } break; @@ -142,12 +143,12 @@ bool GuiTrigger::Left() { u32 wiibtn = GCSettings.WiimoteOrientation ? WPAD_BUTTON_UP : WPAD_BUTTON_LEFT; - if((wpad.btns_d | wpad.btns_h) & (wiibtn | WPAD_CLASSIC_BUTTON_LEFT) + if((wpad->btns_d | wpad->btns_h) & (wiibtn | WPAD_CLASSIC_BUTTON_LEFT) || (pad.btns_d | pad.btns_h) & PAD_BUTTON_LEFT || pad.stickX < -PADCAL || WPAD_Stick(0,0) < -PADCAL) { - if(wpad.btns_d & (wiibtn | WPAD_CLASSIC_BUTTON_LEFT) + if(wpad->btns_d & (wiibtn | WPAD_CLASSIC_BUTTON_LEFT) || pad.btns_d & PAD_BUTTON_LEFT) { scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay. @@ -171,12 +172,12 @@ bool GuiTrigger::Right() { u32 wiibtn = GCSettings.WiimoteOrientation ? WPAD_BUTTON_DOWN : WPAD_BUTTON_RIGHT; - if((wpad.btns_d | wpad.btns_h) & (wiibtn | WPAD_CLASSIC_BUTTON_RIGHT) + if((wpad->btns_d | wpad->btns_h) & (wiibtn | WPAD_CLASSIC_BUTTON_RIGHT) || (pad.btns_d | pad.btns_h) & PAD_BUTTON_RIGHT || pad.stickX > PADCAL || WPAD_Stick(0,0) > PADCAL) { - if(wpad.btns_d & (wiibtn | WPAD_CLASSIC_BUTTON_RIGHT) + if(wpad->btns_d & (wiibtn | WPAD_CLASSIC_BUTTON_RIGHT) || pad.btns_d & PAD_BUTTON_RIGHT) { scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay. @@ -200,12 +201,12 @@ bool GuiTrigger::Up() { u32 wiibtn = GCSettings.WiimoteOrientation ? WPAD_BUTTON_RIGHT : WPAD_BUTTON_UP; - if((wpad.btns_d | wpad.btns_h) & (wiibtn | WPAD_CLASSIC_BUTTON_UP) + if((wpad->btns_d | wpad->btns_h) & (wiibtn | WPAD_CLASSIC_BUTTON_UP) || (pad.btns_d | pad.btns_h) & PAD_BUTTON_UP || pad.stickY > PADCAL || WPAD_Stick(0,1) > PADCAL) { - if(wpad.btns_d & (wiibtn | WPAD_CLASSIC_BUTTON_UP) + if(wpad->btns_d & (wiibtn | WPAD_CLASSIC_BUTTON_UP) || pad.btns_d & PAD_BUTTON_UP) { scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay. @@ -229,12 +230,12 @@ bool GuiTrigger::Down() { u32 wiibtn = GCSettings.WiimoteOrientation ? WPAD_BUTTON_LEFT : WPAD_BUTTON_DOWN; - if((wpad.btns_d | wpad.btns_h) & (wiibtn | WPAD_CLASSIC_BUTTON_DOWN) + if((wpad->btns_d | wpad->btns_h) & (wiibtn | WPAD_CLASSIC_BUTTON_DOWN) || (pad.btns_d | pad.btns_h) & PAD_BUTTON_DOWN || pad.stickY < -PADCAL || WPAD_Stick(0,1) < -PADCAL) { - if(wpad.btns_d & (wiibtn | WPAD_CLASSIC_BUTTON_DOWN) + if(wpad->btns_d & (wiibtn | WPAD_CLASSIC_BUTTON_DOWN) || pad.btns_d & PAD_BUTTON_DOWN) { scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay. diff --git a/source/ngc/gui/gui_window.cpp b/source/ngc/gui/gui_window.cpp index 6da58fd..d4d5e4b 100644 --- a/source/ngc/gui/gui_window.cpp +++ b/source/ngc/gui/gui_window.cpp @@ -195,7 +195,7 @@ void GuiWindow::ToggleFocus(GuiTrigger * t) } } // change focus - else if(t->wpad.btns_d & (WPAD_BUTTON_1 | WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B) + else if(t->wpad->btns_d & (WPAD_BUTTON_1 | WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B) || t->pad.btns_d & PAD_BUTTON_B) { for (i = found; i < _elements.size(); i++) diff --git a/source/ngc/input.cpp b/source/ngc/input.cpp index 0bd2724..cd26b49 100644 --- a/source/ngc/input.cpp +++ b/source/ngc/input.cpp @@ -145,7 +145,7 @@ void ResetControls(int wiiCtrl) /**************************************************************************** * UpdatePads * - * called by PostRetraceCallback in InitGCVideo - scans pad and wpad + * Scans pad and wpad ***************************************************************************/ void UpdatePads() @@ -157,11 +157,6 @@ UpdatePads() for(int i=3; i >= 0; i--) { - #ifdef HW_RVL - memcpy(&userInput[i].wpad, WPAD_Data(i), sizeof(WPADData)); - #endif - - userInput[i].chan = i; userInput[i].pad.btns_d = PAD_ButtonsDown(i); userInput[i].pad.btns_u = PAD_ButtonsUp(i); userInput[i].pad.btns_h = PAD_ButtonsHeld(i); @@ -174,6 +169,33 @@ UpdatePads() } } +/**************************************************************************** + * SetupPads + * + * Sets up userInput triggers for use + ***************************************************************************/ +void +SetupPads() +{ + PAD_Init(); + + #ifdef HW_RVL + WPAD_Init(); + + // read wiimote accelerometer and IR data + WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR); + WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight); + #endif + + for(int i=0; i < 4; i++) + { + userInput[i].chan = i; + #ifdef HW_RVL + userInput[i].wpad = WPAD_Data(i); + #endif + } +} + #ifdef HW_RVL /**************************************************************************** @@ -770,9 +792,9 @@ static u32 DecodeJoy(unsigned short pad) CursorVisible = false; #ifdef HW_RVL - CursorX = userInput[pad].wpad.ir.x; - CursorY = userInput[pad].wpad.ir.y; - CursorValid = userInput[pad].wpad.ir.valid; + CursorX = userInput[pad].wpad->ir.x; + CursorY = userInput[pad].wpad->ir.y; + CursorValid = userInput[pad].wpad->ir.valid; #else CursorX = CursorY = CursorValid = 0; #endif @@ -973,9 +995,9 @@ static u32 DecodeJoy(unsigned short pad) { if ((userInput[pad].pad.btns_h & btnmap[CTRLR_GCPAD][i]) // gamecube controller #ifdef HW_RVL - || ( (userInput[pad].wpad.exp.type == WPAD_EXP_NONE) && (userInput[pad].wpad.btns_h & btnmap[CTRLR_WIIMOTE][i]) ) // wiimote - || ( (userInput[pad].wpad.exp.type == WPAD_EXP_CLASSIC) && (userInput[pad].wpad.btns_h & btnmap[CTRLR_CLASSIC][i]) ) // classic controller - || ( (userInput[pad].wpad.exp.type == WPAD_EXP_NUNCHUK) && (userInput[pad].wpad.btns_h & btnmap[CTRLR_NUNCHUK][i]) ) // nunchuk + wiimote + || ( (userInput[pad].wpad->exp.type == WPAD_EXP_NONE) && (userInput[pad].wpad->btns_h & btnmap[CTRLR_WIIMOTE][i]) ) // wiimote + || ( (userInput[pad].wpad->exp.type == WPAD_EXP_CLASSIC) && (userInput[pad].wpad->btns_h & btnmap[CTRLR_CLASSIC][i]) ) // classic controller + || ( (userInput[pad].wpad->exp.type == WPAD_EXP_NUNCHUK) && (userInput[pad].wpad->btns_h & btnmap[CTRLR_NUNCHUK][i]) ) // nunchuk + wiimote || ( (DownUsbKeys[btnmap[CTRLR_KEYBOARD][i]]) ) // keyboard #endif ) @@ -991,8 +1013,8 @@ bool MenuRequested() { if ( (userInput[i].pad.substickX < -70) || - (userInput[i].wpad.btns_h & WPAD_BUTTON_HOME) || - (userInput[i].wpad.btns_h & WPAD_CLASSIC_BUTTON_HOME) || + (userInput[i].wpad->btns_h & WPAD_BUTTON_HOME) || + (userInput[i].wpad->btns_h & WPAD_CLASSIC_BUTTON_HOME) || (DownUsbKeys[KS_Escape]) ) { diff --git a/source/ngc/input.h b/source/ngc/input.h index c1fb5f4..ed3c43d 100644 --- a/source/ngc/input.h +++ b/source/ngc/input.h @@ -43,6 +43,7 @@ void updateRumbleFrame(); s8 WPAD_Stick(u8 chan,u8 right, int axis); u32 GetJoy(int which); bool MenuRequested(); +void SetupPads(); void UpdatePads(); #endif diff --git a/source/ngc/menu.cpp b/source/ngc/menu.cpp index 93c7e04..65c1116 100644 --- a/source/ngc/menu.cpp +++ b/source/ngc/menu.cpp @@ -258,9 +258,9 @@ UpdateGUI (void *arg) #ifdef HW_RVL for(i=3; i >= 0; i--) // so that player 1's cursor appears on top! { - if(userInput[i].wpad.ir.valid) - Menu_DrawImg(userInput[i].wpad.ir.x-48, userInput[i].wpad.ir.y-48, - 96, 96, pointer[i]->GetImage(), userInput[i].wpad.ir.angle, 1, 1, 255); + if(userInput[i].wpad->ir.valid) + Menu_DrawImg(userInput[i].wpad->ir.x-48, userInput[i].wpad->ir.y-48, + 96, 96, pointer[i]->GetImage(), userInput[i].wpad->ir.angle, 1, 1, 255); DoRumble(i); } #endif @@ -813,9 +813,9 @@ static void WindowCredits(void * ptr) for(i=3; i >= 0; i--) { #ifdef HW_RVL - if(userInput[i].wpad.ir.valid) - Menu_DrawImg(userInput[i].wpad.ir.x-48, userInput[i].wpad.ir.y-48, - 96, 96, pointer[i]->GetImage(), userInput[i].wpad.ir.angle, 1, 1, 255); + if(userInput[i].wpad->ir.valid) + Menu_DrawImg(userInput[i].wpad->ir.x-48, userInput[i].wpad->ir.y-48, + 96, 96, pointer[i]->GetImage(), userInput[i].wpad->ir.angle, 1, 1, 255); DoRumble(i); #endif } @@ -824,7 +824,7 @@ static void WindowCredits(void * ptr) for(i=0; i < 4; i++) { - if(userInput[i].wpad.btns_d || userInput[i].pad.btns_d) + if(userInput[i].wpad->btns_d || userInput[i].pad.btns_d) exit = true; } usleep(THREAD_SLEEP); @@ -833,7 +833,7 @@ static void WindowCredits(void * ptr) // clear buttons pressed for(i=0; i < 4; i++) { - userInput[i].wpad.btns_d = 0; + userInput[i].wpad->btns_d = 0; userInput[i].pad.btns_d = 0; } @@ -1289,7 +1289,7 @@ static int MenuGame() if(WPAD_Probe(i, NULL) == WPAD_ERR_NONE) { newStatus = true; - newLevel = (userInput[i].wpad.battery_level / 100.0) * 4; + newLevel = (userInput[i].wpad->battery_level / 100.0) * 4; if(newLevel > 4) newLevel = 4; } else @@ -2224,7 +2224,7 @@ ButtonMappingWindow() userInput[0].pad.substickY > 70) pressed = WPAD_BUTTON_HOME; - if(userInput[0].wpad.btns_d == WPAD_BUTTON_HOME) + if(userInput[0].wpad->btns_d == WPAD_BUTTON_HOME) pressed = WPAD_BUTTON_HOME; } else if(mapMenuCtrl == CTRLR_KEYBOARD) @@ -2236,12 +2236,12 @@ ButtonMappingWindow() break; } } - if(userInput[0].wpad.btns_d == WPAD_BUTTON_HOME) + if(userInput[0].wpad->btns_d == WPAD_BUTTON_HOME) pressed = KS_Escape; } else { - pressed = userInput[0].wpad.btns_d; + pressed = userInput[0].wpad->btns_d; // always allow Home button to be pressed to cancel if(pressed != WPAD_BUTTON_HOME) @@ -2254,14 +2254,14 @@ ButtonMappingWindow() break; case CTRLR_CLASSIC: - if(userInput[0].wpad.exp.type != WPAD_EXP_CLASSIC) + if(userInput[0].wpad->exp.type != WPAD_EXP_CLASSIC) pressed = 0; // not a valid input else if(pressed <= 0x1000) pressed = 0; break; case CTRLR_NUNCHUK: - if(userInput[0].wpad.exp.type != WPAD_EXP_NUNCHUK) + if(userInput[0].wpad->exp.type != WPAD_EXP_NUNCHUK) pressed = 0; // not a valid input break; } diff --git a/source/ngc/vba.cpp b/source/ngc/vba.cpp index 6809453..3d6e1e1 100644 --- a/source/ngc/vba.cpp +++ b/source/ngc/vba.cpp @@ -250,20 +250,12 @@ int main(int argc, char *argv[]) InitDeviceThread(); VIDEO_Init(); - PAD_Init(); - - #ifdef HW_RVL - WPAD_Init(); - #endif + SetupPads(); InitializeVideo(); ResetVideo_Menu (); // change to menu video mode #ifdef HW_RVL - // read wiimote accelerometer and IR data - WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR); - WPAD_SetVRes(WPAD_CHAN_ALL,screenwidth,screenheight); - // Wii Power/Reset buttons WPAD_SetPowerButtonCallback((WPADShutdownCallback)ShutdownCB); SYS_SetPowerCallback(ShutdownCB);