mirror of
https://gitlab.com/Nanolx/homebrewfilter.git
synced 2024-12-25 00:51:48 +01:00
initial work for Wii U Pro Controller support [not yet working]
This commit is contained in:
parent
4d2e237a74
commit
ab250fe53d
@ -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
|
||||
|
@ -1,6 +1,7 @@
|
||||
|
||||
#include <malloc.h>
|
||||
#include <wiiuse/wpad.h>
|
||||
#include <wupc/wupc.h>
|
||||
#include <runtimeiospatch.h>
|
||||
|
||||
#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);
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <wiiuse/wpad.h>
|
||||
#include <wupc/wupc.h>
|
||||
|
||||
#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();
|
||||
|
||||
|
Binary file not shown.
@ -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
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <ogcsys.h>
|
||||
#include <unistd.h>
|
||||
#include <wiiuse/wpad.h>
|
||||
#include <wupc/wupc.h>
|
||||
|
||||
#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</*4*/ 1;i++)
|
||||
for(int i=0;i< 4;i++)
|
||||
{
|
||||
WUPC_Rumble(i, 0);
|
||||
WPAD_Rumble(i, 0);
|
||||
rumbleCount[i] = 0;
|
||||
}
|
||||
@ -90,6 +108,8 @@ void ShutdownPads()
|
||||
{
|
||||
ShutoffRumble();
|
||||
WPAD_Flush(0);
|
||||
WUPC_Disconnect(0);
|
||||
WUPC_Shutdown();
|
||||
WPAD_Disconnect(0);
|
||||
WPAD_Shutdown();
|
||||
}
|
||||
@ -102,6 +122,7 @@ void DoRumble(int i)
|
||||
{
|
||||
if(rumbleRequest[i] && rumbleCount[i] < 3)
|
||||
{
|
||||
WUPC_Rumble(i, 1);
|
||||
WPAD_Rumble(i, 1); // rumble on
|
||||
rumbleCount[i]++;
|
||||
}
|
||||
@ -115,6 +136,7 @@ void DoRumble(int i)
|
||||
if(rumbleCount[i])
|
||||
rumbleCount[i]--;
|
||||
WPAD_Rumble(i, 0); // rumble off
|
||||
WUPC_Rumble(i, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,9 @@
|
||||
#include <gccore.h>
|
||||
#include <wiiuse/wpad.h>
|
||||
|
||||
#define PI 3.14159265f
|
||||
#define PI 3.14159265f
|
||||
#define PADCAL 50
|
||||
#define WUPCCAL 400
|
||||
|
||||
extern int rumbleRequest[4];
|
||||
|
||||
|
@ -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
|
||||
};
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define _WPAD_H_
|
||||
|
||||
#include <wiiuse/wpad.h>
|
||||
#include <wupc/wupc.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user