From ab250fe53d05ccb8e9992a40cbaf0a1bb638b418 Mon Sep 17 00:00:00 2001 From: Christopher Roy Bratusek Date: Mon, 15 Aug 2016 14:00:54 +0200 Subject: [PATCH] initial work for Wii U Pro Controller support [not yet working] --- installer/Makefile | 4 +- installer/source/main.cpp | 4 +- installer/source/menu.cpp | 8 +++ installer/wad.vwii/0001000154484246.tmd | Bin 592 -> 592 bytes main/Makefile | 4 +- main/source/input.cpp | 30 ++++++-- main/source/input.h | 3 +- main/source/libwiigui/gui.h | 12 ++++ main/source/libwiigui/gui_button.cpp | 67 +++++++++-------- main/source/libwiigui/gui_trigger.cpp | 92 ++++++++++++------------ main/source/main.h | 1 + main/source/wpad.c | 6 ++ main/source/wpad.h | 1 + web/updates | 1 + 14 files changed, 145 insertions(+), 88 deletions(-) diff --git a/installer/Makefile b/installer/Makefile index 4c3548d..c8f3770 100644 --- a/installer/Makefile +++ b/installer/Makefile @@ -29,12 +29,12 @@ INCLUDES := CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) CXXFLAGS = $(CFLAGS) -LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map,-wrap,wiiuse_register #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := -lwiiuse -lbte -logc -lm -lruntimeiospatch +LIBS := -lwiiuse -lwupc -lbte -logc -lm -lruntimeiospatch #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing diff --git a/installer/source/main.cpp b/installer/source/main.cpp index 0a58428..067d93e 100644 --- a/installer/source/main.cpp +++ b/installer/source/main.cpp @@ -1,6 +1,7 @@ #include #include +#include #include #include "menu.h" @@ -16,8 +17,9 @@ int main(int argc, char **argv) { VIDEO_Init(); Video_SetMode(); - WPAD_Init(); PAD_Init(); + WUPC_Init(); + WPAD_Init(); if(AHBPROT_DISABLED) IosPatch_RUNTIME(true, false, false, true); diff --git a/installer/source/menu.cpp b/installer/source/menu.cpp index 3b5f5c0..105710f 100644 --- a/installer/source/menu.cpp +++ b/installer/source/menu.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "getios.h" #include "menu.h" @@ -23,6 +24,7 @@ void Pad_unpressed( void ) { while(1) { + WUPC_UpdateButtonStats(); PAD_ScanPads(); u32 PAD_Unpressed = PAD_ButtonsUp(0); if ( PAD_Unpressed ) @@ -164,6 +166,7 @@ int menu_main(int scrollpos) bool scroll = true; while(1) { + WUPC_UpdateButtonStats(); WPAD_ScanPads(); PAD_ScanPads(); @@ -254,6 +257,7 @@ int menu_install_uninstall(int install) bool scroll = true; while(1) { + WUPC_UpdateButtonStats(); WPAD_ScanPads(); PAD_ScanPads(); @@ -363,6 +367,7 @@ int menu_install() while(1) { + WUPC_UpdateButtonStats(); WPAD_ScanPads(); PAD_ScanPads(); @@ -430,6 +435,7 @@ int menu_reinstall() while(1) { + WUPC_UpdateButtonStats(); WPAD_ScanPads(); PAD_ScanPads(); if( WPAD_ButtonsDown(0) & (WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A) || PAD_ButtonsDown(0) & PAD_BUTTON_A ) @@ -455,6 +461,7 @@ int menu_uninstall() while(1) { + WUPC_UpdateButtonStats(); WPAD_ScanPads(); PAD_ScanPads(); if( WPAD_ButtonsDown(0) & (WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A) || PAD_ButtonsDown(0) & PAD_BUTTON_A ) @@ -480,6 +487,7 @@ int menu_copyright() while(1) { + WUPC_UpdateButtonStats(); WPAD_ScanPads(); PAD_ScanPads(); diff --git a/installer/wad.vwii/0001000154484246.tmd b/installer/wad.vwii/0001000154484246.tmd index 2bb561d935347cb8a9b722fcfd6987e9f3fde9f0..cd2042c9001385a22086f4530aa3c5fa6f041a67 100644 GIT binary patch delta 30 mcmcb>a)D)o6_Z%v1O1xU{)w?-mak>v9q)XZbs#Y!&K>~4Zw&a)D)o6_Z#*0!zKa+Gn4ZDONnTPY(Z}uu0EBhaUjG{tPhy diff --git a/main/Makefile b/main/Makefile index 9089916..3288e2d 100644 --- a/main/Makefile +++ b/main/Makefile @@ -42,13 +42,13 @@ DATA := data/fonts \ CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) $(XFLAGS) CXXFLAGS = -save-temps -Xassembler -aln=$@.lst $(CFLAGS) $(XFLAGS) -LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--section-start,.init=0x81330000 +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--section-start,.init=0x81330000,-wrap,wiiuse_register #LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := -ldi -lpng -lz -lfat -lntfs -lwiiuse -lbte -lasnd -logc -lfreetype -lmxml -lext2fs -lruntimeiospatch +LIBS := -ldi -lpng -lz -lfat -lntfs -lwiiuse -lwupc -lbte -lasnd -logc -lfreetype -lmxml -lext2fs -lruntimeiospatch #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing # include and lib diff --git a/main/source/input.cpp b/main/source/input.cpp index 7631235..6ea20c1 100644 --- a/main/source/input.cpp +++ b/main/source/input.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include "menu.h" #include "video.h" @@ -31,11 +32,14 @@ static int rumbleCount[4] = {0,0,0,0}; ***************************************************************************/ void UpdatePads() { + WUPC_UpdateButtonStats(); WPAD_ScanPads(); PAD_ScanPads(); - for(int i=/*3*/ 0; i >= 0; i--) + for(int i=3; i >= 0; i--) { + userInput[i].wpad = WPAD_Data(i); + 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); @@ -45,6 +49,19 @@ void UpdatePads() userInput[i].pad.substickY = PAD_SubStickY(i); userInput[i].pad.triggerL = PAD_TriggerL(i); userInput[i].pad.triggerR = PAD_TriggerR(i); + + // WiiU Pro Controller + userInput[i].wupcdata.btns_d = WUPC_ButtonsDown(i); + userInput[i].wupcdata.btns_u = WUPC_ButtonsUp(i); + userInput[i].wupcdata.btns_h = WUPC_ButtonsHeld(i); + userInput[i].wupcdata.stickX = WUPC_lStickX(i); + userInput[i].wupcdata.stickY = WUPC_lStickY(i); + userInput[i].wupcdata.substickX = WUPC_rStickX(i); + userInput[i].wupcdata.substickY = WUPC_rStickY(i); + // Don't use only held to disconnect, on reconnect the pad sends last held state for a short time. + if((WUPC_ButtonsHeld(i) & WUPC_EXTRA_BUTTON_RSTICK && WUPC_ButtonsDown(i) & WUPC_EXTRA_BUTTON_LSTICK) // R3+L3 + ||(WUPC_ButtonsHeld(i) & WUPC_EXTRA_BUTTON_LSTICK && WUPC_ButtonsDown(i) & WUPC_EXTRA_BUTTON_RSTICK)) + WUPC_Disconnect(i); } } @@ -56,16 +73,16 @@ void UpdatePads() void SetupPads() { PAD_Init(); + WUPC_Init(); 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); - for(int i=0; i < /*4*/ 1; i++) + for(int i=0; i < 4; i++) { userInput[i].chan = i; - userInput[i].wpad = WPAD_Data(i); } } @@ -75,8 +92,9 @@ void SetupPads() void ShutoffRumble() { - for(int i=0;i #include -#define PI 3.14159265f +#define PI 3.14159265f #define PADCAL 50 +#define WUPCCAL 400 extern int rumbleRequest[4]; diff --git a/main/source/libwiigui/gui.h b/main/source/libwiigui/gui.h index 9c3b9cf..0f1ad30 100644 --- a/main/source/libwiigui/gui.h +++ b/main/source/libwiigui/gui.h @@ -117,6 +117,16 @@ typedef struct _paddata { u8 triggerR; } PADData; +typedef struct _wupcfulldata { + u32 btns_d; + u32 btns_u; + u32 btns_h; + s16 stickX; + s16 stickY; + s16 substickX; + s16 substickY; +} WUPCFullData; + typedef struct _POINT { s32 x; s32 y; @@ -183,6 +193,8 @@ class GuiTrigger s32 chan; //!< Trigger controller channel (0-3, -1 for all) WPADData * wpad; //!< Wii controller trigger WPADData wpaddata; //!< Wii controller trigger data + WUPCFullData * wupad; //!< WiiU Pro controller trigger + WUPCFullData wupcdata; //!< WiiU Pro controller trigger data PADData pad; //!< GameCube controller trigger data }; diff --git a/main/source/libwiigui/gui_button.cpp b/main/source/libwiigui/gui_button.cpp index 6a56160..ca0c418 100644 --- a/main/source/libwiigui/gui_button.cpp +++ b/main/source/libwiigui/gui_button.cpp @@ -185,13 +185,13 @@ void GuiButton::Update(GuiTrigger * t) } #endif - // button triggers - if(this->IsClickable()) +// button triggers + if (this->IsClickable()) { - s32 wm_btns, wm_btns_trig, cc_btns, cc_btns_trig; + s32 wm_btns, wm_btns_trig, cc_btns, cc_btns_trig, wupc_btns, wupc_btns_trig; for(int i=0; i<2; i++) { - if(trigger[i] && (trigger[i]->chan == -1 || trigger[i]->chan == t->chan)) + if (trigger[i] && (trigger[i]->chan == -1 || trigger[i]->chan == t->chan)) { // higher 16 bits only (wiimote) wm_btns = t->wpad->btns_d << 16; @@ -201,20 +201,22 @@ void GuiButton::Update(GuiTrigger * t) cc_btns = t->wpad->btns_d >> 16; cc_btns_trig = trigger[i]->wpad->btns_d >> 16; - if( - (t->wpad->btns_d > 0 && - (wm_btns == wm_btns_trig || - (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)) + // lower 16 bits only (WiiU Pro controller) + wupc_btns = t->wupad->btns_d >> 16; + wupc_btns_trig = trigger[i]->wupad->btns_d >> 16; + + if( ((t->wpad->btns_d > 0 && wm_btns == wm_btns_trig) + || (t->wpad->exp.type == WPAD_EXP_CLASSIC && cc_btns == cc_btns_trig)) + || (t->pad.btns_d > 0 && t->pad.btns_d == trigger[i]->pad.btns_d) + || (t->wupad->btns_d > 0 && wupc_btns == wupc_btns_trig)) { - if(t->chan == stateChan || stateChan == -1) + 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); - } } else if(trigger[i]->type == TRIGGER_BUTTON_ONLY) @@ -222,7 +224,7 @@ void GuiButton::Update(GuiTrigger * t) this->SetState(STATE_CLICKED, t->chan); } else if(trigger[i]->type == TRIGGER_BUTTON_ONLY_IN_FOCUS && - parentElement->IsFocused()) + parentElement->IsFocused()) { this->SetState(STATE_CLICKED, t->chan); } @@ -232,14 +234,14 @@ void GuiButton::Update(GuiTrigger * t) } } - if(this->IsHoldable()) + if (this->IsHoldable()) { bool held = false; - s32 wm_btns, wm_btns_h, wm_btns_trig, cc_btns, cc_btns_h, cc_btns_trig; + s32 wm_btns, wm_btns_h, wm_btns_trig, cc_btns, cc_btns_h, cc_btns_trig, wupc_btns, wupc_btns_h, wupc_btns_trig; for(int i=0; i<2; i++) { - if(trigger[i] && (trigger[i]->chan == -1 || trigger[i]->chan == t->chan)) + if (trigger[i] && (trigger[i]->chan == -1 || trigger[i]->chan == t->chan)) { // higher 16 bits only (wiimote) wm_btns = t->wpad->btns_d << 16; @@ -251,35 +253,40 @@ void GuiButton::Update(GuiTrigger * t) cc_btns_h = t->wpad->btns_h >> 16; cc_btns_trig = trigger[i]->wpad->btns_h >> 16; - if( - (t->wpad->btns_d > 0 && - (wm_btns == wm_btns_trig || - (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)) + // lower 16 bits only (WiiU Pro controller) + wupc_btns = t->wupad->btns_d >> 16; + wupc_btns_h = t->wupad->btns_h >> 16; + wupc_btns_trig = trigger[i]->wupad->btns_h >> 16; + + if( (t->wpad->btns_d > 0 && wm_btns == wm_btns_trig) + || (t->wpad->exp.type == WPAD_EXP_CLASSIC && cc_btns == cc_btns_trig) + || (t->pad.btns_d > 0 && t->pad.btns_d == trigger[i]->pad.btns_d) + || (t->wupad->btns_d > 0 && wupc_btns == wupc_btns_trig)) { - if(trigger[i]->type == TRIGGER_HELD && state == STATE_SELECTED && + if (trigger[i]->type == TRIGGER_HELD && state == STATE_SELECTED && (t->chan == stateChan || stateChan == -1)) this->SetState(STATE_CLICKED, t->chan); } - if( - (t->wpad->btns_h > 0 && - (wm_btns_h == wm_btns_trig || - (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( (t->wpad->btns_h > 0 && wm_btns_h == wm_btns_trig) + || (t->wpad->exp.type == WPAD_EXP_CLASSIC && cc_btns_h == cc_btns_trig) + || (t->pad.btns_h > 0 && t->pad.btns_h == trigger[i]->pad.btns_h) + || (t->wupad->btns_h > 0 && wupc_btns_h == wupc_btns_trig) + ) { - if(trigger[i]->type == TRIGGER_HELD) + if (trigger[i]->type == TRIGGER_HELD) held = true; } - if(!held && state == STATE_HELD && stateChan == t->chan) + if (!held && state == STATE_HELD && stateChan == t->chan) { this->ResetState(); } - else if(held && state == STATE_CLICKED && stateChan == t->chan) + else if (held && state == STATE_CLICKED && stateChan == t->chan) { this->SetState(STATE_HELD, t->chan); } + } } } diff --git a/main/source/libwiigui/gui_trigger.cpp b/main/source/libwiigui/gui_trigger.cpp index 96b48ac..a3c9d95 100644 --- a/main/source/libwiigui/gui_trigger.cpp +++ b/main/source/libwiigui/gui_trigger.cpp @@ -18,9 +18,11 @@ static int scrollDelay = 0; GuiTrigger::GuiTrigger() { chan = -1; + memset(&wupcdata, 0, sizeof(WUPCFullData)); memset(&wpaddata, 0, sizeof(WPADData)); memset(&pad, 0, sizeof(PADData)); wpad = &wpaddata; + wupad = &wupcdata; } /** @@ -39,6 +41,7 @@ void GuiTrigger::SetSimpleTrigger(s32 ch, u32 wiibtns, u16 gcbtns) { type = TRIGGER_SIMPLE; chan = ch; + wupad->btns_d = wiibtns; wpaddata.btns_d = wiibtns; pad.btns_d = gcbtns; } @@ -52,6 +55,7 @@ void GuiTrigger::SetHeldTrigger(s32 ch, u32 wiibtns, u16 gcbtns) { type = TRIGGER_HELD; chan = ch; + wupad->btns_h = wiibtns; wpaddata.btns_h = wiibtns; pad.btns_h = gcbtns; } @@ -63,6 +67,8 @@ void GuiTrigger::SetButtonOnlyHeldTrigger(s32 ch, u32 wiibtns, u16 gcbtns) { type = TRIGGER_BUTTON_ONLY_HELD; chan = ch; + wupad->btns_d = wiibtns; + wupad->btns_h = wiibtns; wpaddata.btns_d = wiibtns; wpaddata.btns_h = wiibtns; pad.btns_d = gcbtns; @@ -77,6 +83,7 @@ void GuiTrigger::SetButtonOnlyTrigger(s32 ch, u32 wiibtns, u16 gcbtns) { type = TRIGGER_BUTTON_ONLY; chan = ch; + wupad->btns_d = wiibtns; wpaddata.btns_d = wiibtns; pad.btns_d = gcbtns; } @@ -90,6 +97,7 @@ void GuiTrigger::SetButtonOnlyInFocusTrigger(s32 ch, u32 wiibtns, u16 gcbtns) { type = TRIGGER_BUTTON_ONLY_IN_FOCUS; chan = ch; + wupad->btns_d = wiibtns; wpaddata.btns_d = wiibtns; pad.btns_d = gcbtns; } @@ -149,28 +157,25 @@ s8 GuiTrigger::WPAD_Stick(u8 right, int axis) bool GuiTrigger::Left() { u32 wiibtn = WPAD_BUTTON_LEFT; + if(wpad->exp.type == WPAD_EXP_CLASSIC || (wupad->btns_d | wupad->btns_h) > 0) + 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 | wpad->btns_h) & wiibtn) + || ((wupad->btns_d | wupad->btns_h) & wiibtn) + || ((pad.btns_d | pad.btns_h) & PAD_BUTTON_LEFT)) { - if(wpad->btns_d & (wiibtn | WPAD_CLASSIC_BUTTON_LEFT) - || pad.btns_d & PAD_BUTTON_LEFT) + if( (wpad->btns_d & wiibtn) + || (wupad->btns_d & wiibtn) + || (pad.btns_d & PAD_BUTTON_LEFT)) { scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay. return true; } - else if(scrollDelay == 0) + else if (--scrollDelay <= 0) { scrollDelay = SCROLL_LOOP_DELAY; return true; } - else - { - if(scrollDelay > 0) - scrollDelay--; - } } return false; } @@ -178,28 +183,25 @@ bool GuiTrigger::Left() bool GuiTrigger::Right() { u32 wiibtn = WPAD_BUTTON_RIGHT; + if(wpad->exp.type == WPAD_EXP_CLASSIC || (wupad->btns_d | wupad->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 | wpad->btns_h) & wiibtn) + || ((pad.btns_d | pad.btns_h) & PAD_BUTTON_RIGHT) + || ((wupad->btns_d | wupad->btns_h) & wiibtn)) { - if(wpad->btns_d & (wiibtn | WPAD_CLASSIC_BUTTON_RIGHT) - || pad.btns_d & PAD_BUTTON_RIGHT) + if( (wpad->btns_d & wiibtn) + || (pad.btns_d & PAD_BUTTON_RIGHT) + || (wupad->btns_d & wiibtn)) { scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay. return true; } - else if(scrollDelay == 0) + else if (--scrollDelay <= 0) { scrollDelay = SCROLL_LOOP_DELAY; return true; } - else - { - if(scrollDelay > 0) - scrollDelay--; - } } return false; } @@ -207,28 +209,25 @@ bool GuiTrigger::Right() bool GuiTrigger::Up() { u32 wiibtn = WPAD_BUTTON_UP; + if(wpad->exp.type == WPAD_EXP_CLASSIC || (wupad->btns_d | wupad->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 | wpad->btns_h) & wiibtn) + || ((pad.btns_d | pad.btns_h) & PAD_BUTTON_UP) + || ((wupad->btns_d | wupad->btns_h) & wiibtn)) { - if(wpad->btns_d & (wiibtn | WPAD_CLASSIC_BUTTON_UP) - || pad.btns_d & PAD_BUTTON_UP) + if( (wpad->btns_d & wiibtn) + || (wupad->btns_d & wiibtn) + || (pad.btns_d & PAD_BUTTON_UP)) { scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay. return true; } - else if(scrollDelay == 0) + else if (--scrollDelay <= 0) { scrollDelay = SCROLL_LOOP_DELAY; return true; } - else - { - if(scrollDelay > 0) - scrollDelay--; - } } return false; } @@ -236,28 +235,25 @@ bool GuiTrigger::Up() bool GuiTrigger::Down() { u32 wiibtn = WPAD_BUTTON_DOWN; + if(wpad->exp.type == WPAD_EXP_CLASSIC || (wupad->btns_d | wupad->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 | wpad->btns_h) & wiibtn) + || ((pad.btns_d | pad.btns_h) & PAD_BUTTON_DOWN) + || ((wupad->btns_d | wupad->btns_h) & wiibtn)) { - if(wpad->btns_d & (wiibtn | WPAD_CLASSIC_BUTTON_DOWN) - || pad.btns_d & PAD_BUTTON_DOWN) + if( (wpad->btns_d & wiibtn) + || (pad.btns_d & PAD_BUTTON_DOWN) + || (wupad->btns_d & wiibtn)) { scrollDelay = SCROLL_INITIAL_DELAY; // reset scroll delay. return true; } - else if(scrollDelay == 0) + else if (--scrollDelay <= 0) { scrollDelay = SCROLL_LOOP_DELAY; return true; } - else - { - if(scrollDelay > 0) - scrollDelay--; - } } return false; } diff --git a/main/source/main.h b/main/source/main.h index 137dfa6..653081e 100644 --- a/main/source/main.h +++ b/main/source/main.h @@ -22,6 +22,7 @@ #define HW_REG_BASE 0xcd800000 #define HW_ARMIRQMASK (HW_REG_BASE + 0x03c) #define HW_ARMIRQFLAG (HW_REG_BASE + 0x038) +#define IsWiiU ( (*(u32*)0x0d8005A0 >> 16 ) == 0xCAFE ) using namespace std; diff --git a/main/source/wpad.c b/main/source/wpad.c index 3b101e5..21edd21 100644 --- a/main/source/wpad.c +++ b/main/source/wpad.c @@ -18,6 +18,7 @@ void __Wpad_PowerCallback(s32 chan) s32 Wpad_Init(void) { + WUPC_Init(); s32 ret; /* Initialize Wiimote subsystem */ @@ -39,6 +40,7 @@ void Wpad_Disconnect(void) WPAD_Disconnect(cnt); /* Shutdown Wiimote subsystem */ + WUPC_Shutdown(); WPAD_Shutdown(); } @@ -65,11 +67,13 @@ u32 ButtonsHold(void) int i; u32 buttons = 0; + WUPC_UpdateButtonStats(); WPAD_ScanPads(); PAD_ScanPads(); for (i = 3; i >= 0; i--) { + buttons |= WUPC_ButtonsHeld(i); buttons |= PAD_ButtonsHeld(i); buttons |= WPAD_ButtonsHeld(i); } @@ -81,11 +85,13 @@ u32 ButtonsPressed(void) int i; u32 buttons = 0; + WUPC_UpdateButtonStats(); WPAD_ScanPads(); PAD_ScanPads(); for (i = 3; i >= 0; i--) { + buttons |= WUPC_ButtonsDown(i); buttons |= PAD_ButtonsDown(i); buttons |= WPAD_ButtonsDown(i); } diff --git a/main/source/wpad.h b/main/source/wpad.h index d92fe30..1390722 100644 --- a/main/source/wpad.h +++ b/main/source/wpad.h @@ -2,6 +2,7 @@ #define _WPAD_H_ #include +#include #ifdef __cplusplus extern "C" diff --git a/web/updates b/web/updates index ff7aed9..b404d8e 100644 --- a/web/updates +++ b/web/updates @@ -2,6 +2,7 @@ - fix size and layout of device prompt in vWii builds - remove 'All' button from device prompt in vWii builds - re-enable 'SD Gecko' setting in vWii builds +- support for Wii U Pro Controller trough FIX94's libwupc - update german translation //rev45: