Hacking libwupc - A WiiU Pro Controller Library for Wii Homebrew Applications

Obveron

Well-Known Member
Member
Joined
Jul 5, 2010
Messages
504
Trophies
1
XP
1,410
Country
Canada
Any way to make the Wiiu Pro Controller detect as controller 2? When I start SNESGX, the Wiimote is automatically detected as controller 1. When I start the Wii pro controller it is also detected as controller 1. Both controllers appear to work as controller 1 at the same time (in parallel). Ideally, I could make the pro controller (or wiimote) controller 2.
 

Hakaisha

Well-Known Member
Member
Joined
Sep 17, 2014
Messages
236
Trophies
0
XP
1,456
Country
United States
Any plans to update the wiiflow plugins snes9xgx and fceugx?


I'd like to know this as well! B-)

I'd love to actually be able to load the Wii-U Pro compatible emus with the Wii-U Pro modded WiiFlow. Yet, I'm still having to manually boot them through the HBC instead, because the plugins are outdated. =/

Unless, there's some step I'm missing?
 

filfat

CTO @ Nordcom Group Inc.
Member
Joined
Nov 24, 2012
Messages
1,261
Trophies
1
Location
Gothenburg, Sweden
Website
www.sweetsideofsweden.com
XP
1,749
Country
Sweden
Hey!
So I finally made a small library which you can implement into your wii homebrew application in order to use the WiiU Pro Controller, I've added a usage.txt file to it.
http://code.google.com/p/libwupc
Just check out the source to get all the data you need.
Let me know if you find any issues with it, so far I only tested it with one controller so I have no idea if it can even handle multiple controllers properly.
This library is implemented for example into wiiflow, nintendont, postloader, fceugx, snes9xgx and vbagx (get those 3 from my signature).
Have Fun!
Breathless!!!! :O
 

FreezingIceKirby

Well-Known Member
Newcomer
Joined
Jul 15, 2014
Messages
62
Trophies
0
Age
35
XP
356
Country
United States
Curious... is it possible to insert libwupc into fan-made projects like Newer Super Mario Bros. Wii or Project M (through something like Riivolution)?
 

daxtsu

Well-Known Member
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica
if possible to add these new lib's to the homebrew channel (vWii) i would need the source code and some linux knowledge right?


Not sure where Linux comes into this, but no, it's not possible to add it to the Homebrew Channel unless Marcan/Bushing/TT release its source code.

Curious... is it possible to insert libwupc into fan-made projects like Newer Super Mario Bros. Wii or Project M (through something like Riivolution)?

No, to put it simply, this library can't be used with retail/commercial games.
 

xdarkmario

Philosopher
Member
Joined
Dec 30, 2010
Messages
1,635
Trophies
1
Location
Mushroom Kingdom
XP
2,577
Country
United States
also i have a feeling you may not need to inject the libraries to a commercial game to use the pro controller, maybe just its launcher. if the native wii menu maybe inject to wii IOS or if your using a backup launcher patch the launcher...

my theory is based off of nintendont. you dont need to patch each gamecube game for the for the pro controller to work on it, just nintendont was patched and that handles the gamecube games
 

wii121

Active Member
Newcomer
Joined
Nov 13, 2013
Messages
36
Trophies
0
XP
129
Country
United States
I can't get the modified versions of Snes9xgx and vbagx working. I downloaded the files at http://www.mediafire.com/fix94 and changed the names from vbagx_wii.dol and snes9xgx-wii.dol to boot.dol and replaced them with the existing boot.dol files. I tried syncing the wii U pro controller in the system menu, pressed the wii U pro button on the back, then the sync button on the Wii and the leds blinked and then went out so I believe it synced. When I start either vbagx or snes9xgx and try to press a button on the wii u pro, the leds just keep blinking for a while and don't do anything.

The controller is fine and I think it is synced because I tried the new version of Nintendont and it works flawlessly. Am I doing anything wrong? It would be nice to finally use the Wii U Pro for something.

Edit: I was using the non-modified versions. If anyone else is wondering, the files are in the wiiuprocontroller folder and end in libwupc.7z.

Great work FIX94, thanks for this.
 

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
45
Location
Engine room, learning
XP
15,649
Country
France
I'm wanted to use L3+R3 to shutdown the controller, but these extra buttons didn't registered.
Daxtsu, your WiiSX mod doesn't have these buttons either. you will have to recompile libwupc to allow L3/R3.


To add them, you need to add this to wupc.c, line233:
Code:
		newstate = __WUPC_PadData[i].button | (__WUPC_PadData[i].extra & WUPC_EXTRA_BUTTON_RSTICK) | (__WUPC_PadData[i].extra & WUPC_EXTRA_BUTTON_LSTICK);

it now registers correctly but as I'm applying the wupc buttons to wpad (to affect the Classic controller, and read only one controller afterward), it affects wpad Wiimote button1 and 2 at the same time.
excluding the least significant bits is enough to fix the issue, and check wupc directly for extra buttons.
Code:
	Input[chan].wpad.btns_d = WUPC_ButtonsDown(chan) & ~3;

	// Read L3 and R3
	if(Input[chan].wupcdata.btns_d & WUPC_EXTRA_BUTTON_RSTICK 
	&& Input[chan].wupcdata.btns_d & WUPC_EXTRA_BUTTON_LSTICK)
		WUPC_Disconnect(chan);
It's not the best way but as long as you read WUPC directly, you have all buttons back.
Another solution would be to add a new function to read the L/R down/up/help, but that's maybe too much for only two bits.

I also added a function to read the full extra which contains values for : USB connected, USB charging,L3,R3.
Code:
u8 WUPC_extra(u8 chan)
{
	if(chan >= CHAN_MAX || __WUPC_Connected[chan] == NULL) return 0;
	return __WUPC_PadData[chan].extra;
}

r3_Mod2


Edit:
I think the library has an issue with disconnect and held.
when you use WUPC_Disconnect(chan), it still keep the held value for the current channel.
when you reconnect it, the held value is sent again. It's an issue if you check held value to shutdown the controller as it shutdown right away again.

If you use the disconnect function with button combo, don't check your buttons using Held or use combination of Held+pressed to prevent auto-disconnect.


You can verify with code like that
Code:
while(1)
{
	WUPC_UpdateButtonStats();
	if(WUPC_ButtonsHeld(0) & WPAD_CLASSIC_BUTTON_HOME)
		WUPC_Disconnect(0);
	gprintf("Data = %x\n", WUPC_ButtonsHeld(0));
}
Adding
__WUPC_PadButtons[chan].state = 0;
on disconnect is not enough to fix the issue.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    SylverReZ @ SylverReZ: But I bet that would be more for a flashcart than a consumer repro board.