Hacking Gamecube Adapter Support and FAQ

Bug_Checker_

Well-Known Member
Member
Joined
Jun 10, 2006
Messages
950
Trophies
0
XP
664
Country
United States
Anyone seen the unofficial GameCube adapter that popped up a few days ago, it has a PC mode for Windows and OSX, would this be too good to be true? (If I'm not allowed to post this link, tell me and I'll remove it)

http://www.play-asia.com/gamecube-controller-adapter-for-wii-u-pc-usb-paOS-13-49-en-70-8h2n.html

gbatemp should seriously consider doing away with the front/home page:
https://gbatemp.net/threads/gbatemp-contest-win-a-mayflash-gamecube-adapter-for-wii-u.378515/
 
  • Like
Reactions: 2haloes

area

Member
Newcomer
Joined
Jan 4, 2015
Messages
17
Trophies
0
XP
103
Country
The bad news is that if I play on dolphin for about 45 minutes in a row using the controller, my computer will crash and restart from a kernel panic. I get this error message:
Code:
zalloc: zone map exhausted while allocating from zone kalloc.8192, likely due to memory leak in zone kalloc.256
I can reproduce this consistently, sometimes the error report will say kalloc.128 instead of kalloc.256, also I can post the whole error report if that would be helpful.

Ah, a good old memory leak, just like mum used to make. No need for the full error report, I can reproduce this on my end and - crucially - I can tell whether the error is happening before the kernel panic appears. You can do this by running

Code:
watch ioalloccount

Load the KEXT, and watch the 'Instance allocation' line. When you plug in the controller, it will start to increase without bound. When all your memory has been used up, it will kernel panic. At least, I'm pretty sure this is the case.

Some other information, when I first plug in the adapter and check the devices list in dolphin, it shows as "Input/0/WUP-028", which is the model number of the adapter. After I load the driver from the kext file to run the adapter it changes and shows up as "Input/0/Unknown device", and it becomes functional. I don't know if this is a significant factor but I thought it was worth mentioning.

I had noticed this too. I assume that this is an easy fix, I just don't know how or where!

Also when configuring the controller on the GCPad menu in dolphin, it reads that I am always pressing very slightly on L and R according to the small red meters on the button mapping GUI. I think this is a result of the same thing that happens on Enjoyable when it thinks you are always pressing one of the triggers.


I also see this, and I agree that this is what causes the jumping in Enjoyable.

Thanks for taking the time to test the driver - I haven't had the opportunity to do so extensively. Catching the memory leak in particular is good!

Feel free to open error reports for these things on Github, too - maybe someone who finds the repository will submit a pull request fixing these! I will do this unless you beat me to it!

Incidentally, I would be extremely interested in the HID Report Descriptor of the new 4-port Mayflash GC adapter, if anyone is getting one of those. I asked over in the thread for that adapter, and have emailed MayFlash too, but no response on either front so far.
 

Mike4Real

Member
Newcomer
Joined
Jan 8, 2015
Messages
9
Trophies
0
XP
105
Country
United States
Load the KEXT, and watch the 'Instance allocation' line. When you plug in the controller, it will start to increase without bound. When all your memory has been used up, it will kernel panic. At least, I'm pretty sure this is the case.
Looks like you're right about instance allocation being the problem. I had to do the watch command like this on Mavericks:
Code:
./watch ioalloccount
At first, I get this: Instance allocation = 0x004dc59c = 4977 K. I only did this once so far, but that number grew about 400 K every 2 seconds until it got to around to around 600000 K right before my computer crashed. Is there some way to release that memory easily with a terminal command so I can keep playing, or should I wait until the we can find a fix for the kext file?

My hypothesis about the triggers always being pressed has to do with that the driver is based off the the Xbox One controller. Maybe the unpressed position for the Xbox triggers is "further up" in a sense than the unpressed position for GameCube triggers? That's my theory for now but I don't know how to fix that code-wise.
Thanks for taking the time to test the driver - I haven't had the opportunity to do so extensively. Catching the memory leak in particular is good!
Feel free to open error reports for these things on Github, too - maybe someone who finds the repository will submit a pull request fixing these! I will do this unless you beat me to it!
You're welcome! I'm just so happy that you made the driver so I can play Melee Netplay with my friends with an actual GameCube controller. :)
As for the github, I'll leave that up to you, I don't have an account on there and I'm not too familiar coding anything, I do have a lot of time to test things and follow instructions/investigate though.
Incidentally, I would be extremely interested in the HID Report Descriptor of the new 4-port Mayflash GC adapter, if anyone is getting one of those. I asked over in the thread for that adapter, and have emailed MayFlash too, but no response on either front so far.
I'll keep an eye out if anyone I know gets one of those.
 

area

Member
Newcomer
Joined
Jan 4, 2015
Messages
17
Trophies
0
XP
103
Country
Is there some way to release that memory easily with a terminal command so I can keep playing, or should I wait until the we can find a fix for the kext file?

Sadly, I don't know of a terminal command to do this. Not even unloading the kext does it - you have to restart.

My hypothesis about the triggers always being pressed has to do with that the driver is based off the the Xbox One controller. Maybe the unpressed position for the Xbox triggers is "further up" in a sense than the unpressed position for GameCube triggers? That's my theory for now but I don't know how to fix that code-wise.

The controllers are simply reporting a nonzero value even when the triggers aren't being pushed - this isn't anything to do with being based on the Xbox controller, as far as I know - those are just the numbers reported by the USB device. Introducing an offset would fix this, but I don't know if that's the proper way.
 

BobbyJackT

New Member
Newbie
Joined
Jan 19, 2015
Messages
1
Trophies
0
Age
54
XP
41
Country
Afghanistan
It won't work, I enabled the dev kext and tried loading it but it said could not find directory, i had downloaded the files though.

Last login: Sun Jan 18 21:23:42 on ttys000
Taegans-MacBook-Pro-2:~ Taegan$ sudo nvram boot-args="-v kext-dev-mode=1"
Taegans-MacBook-Pro-2:~ Taegan$ sudo cp -R GC.kext /tmp
cp: GC.kext: No such file or directory
Taegans-MacBook-Pro-2:~ Taegan$
 

bootsector

Well-Known Member
Member
Joined
Oct 2, 2008
Messages
198
Trophies
0
XP
275
Country
Brazil
The controllers are simply reporting a nonzero value even when the triggers aren't being pushed - this isn't anything to do with being based on the Xbox controller, as far as I know - those are just the numbers reported by the USB device. Introducing an offset would fix this, but I don't know if that's the proper way.

L and R have separate reporting bytes for analog and digital data. On original GC controllers, analog range goes from 0 + ~32 to 255 - ~32, so you'll never get a full 0x00 or 0xFF analog value. Digital triggers get activated after full analog button is pressed (it's when you hear a "click" coming out from the button).
 

Mike4Real

Member
Newcomer
Joined
Jan 8, 2015
Messages
9
Trophies
0
XP
105
Country
United States
It won't work, I enabled the dev kext and tried loading it but it said could not find directory, i had downloaded the files though.

Last login: Sun Jan 18 21:23:42 on ttys000
Taegans-MacBook-Pro-2:~ Taegan$ sudo nvram boot-args="-v kext-dev-mode=1"
Taegans-MacBook-Pro-2:~ Taegan$ sudo cp -R GC.kext /tmp
cp: GC.kext: No such file or directory
Taegans-MacBook-Pro-2:~ Taegan$

I think this is why you're having that issue, when you download the files from Area's github, the driver isn't actually functional right away. For reasons that I don't really know about, no one I've seen really puts up drivers in the form of .kext files on the internet to download. I have one other driver on my Mac for 360 controllers, and that was a .pkg with an installation process. I'm not 100% sure but I'll guess that OS X has some protection measures to prevent people from simply dragging and dropping .kexts from the internet into the kext folder and using them right away. Because of this, we each have to make the .kext on our own machine. To do that, you'll need to have Xcode on your Mac, which you can get for free on the App store if you don't already have it (I had to upgrade my OS from 10.9.3 to 10.9.5 to get it but you should be fine). Once you have that go into the folder you downloaded, and find the file named GC.xcodeproj and open it with Xcode.

Once you're in Xcode the process splits depending on what operating system you have, if you have 10.10 Yosemite, you should be able to continue by hitting the build button in the top left corner of the window, it looks like a play button.

Click here for Mavericks instructions:
If you have 10.9 Mavericks however, the process is slightly different, before you hit build (play) you need to change 3 numbers. From the file list on the left of Xcode, find the folder named Supporting Files, and select Info.plist from inside it. In this file there should be a line that says OSBundleLibraries. It might have a drop down arrow next to it, click that because we need to change things in this part of the file. You need to change the version of 3 files, do this by double clicking on the part of the line you need to change.
Change com.apple.kpi.iokit from version 14.0 to 13.4
Change com.apple.kpi.libkern from version 14.0 to 13.4
Change com.apple.kpi.mach from version 14.0 to 13.4

If you have a different OS like Lion, Mountain Lion, or my personal favorite Snow Leopard go into Terminal and type this command:
kextlibs /tmp/GC.kext
That will give you the version numbers you need to use on your system.

Once Xcode tells you that the build was successful (it might say it had 1 issue like mine did, but I didn't worry about that) you need to find the file it made which is called GC.kext. On Xcode in the file view it might appear in a folder on the left from the file view in a folder called products. If its there, right click on GC.kext and do Show in Finder. If its not there on the left of Xcode, go to Xcode, and then preferences from your menubar. Go to the tab that says locations and under Derived Data there should be a tiny arrow that will take you to where Xcode puts products. From there it puts it in a silly directory /Users/~/Library/Developer/Xcode/DerivedData/GC-djnwkcdxnakiuldgpiycalqiiluq/Build/Products/Debug

In the debug folder there should be a file called GC.kext, you're most likely going to wanna move that to an easier to access place like your Downloads folder or your Desktop.

Once you've done all that and gotten GC.kext to a manageable location now its time to go back to Terminal. Change your directory to where you put the GC.kext file, you can do this easily by typing cd, hitting space, and then dragging GC.kext onto the Terminal window. Now you will be able to do the -cp command without Terminal telling you that it can't find what what you're looking for.

Sorry if this is too long or confusing, I can maybe write a better guide, if you're still having problems just post again and I will try to help :) .
 
  • Like
Reactions: area

area

Member
Newcomer
Joined
Jan 4, 2015
Messages
17
Trophies
0
XP
103
Country
L and R have separate reporting bytes for analog and digital data. On original GC controllers, analog range goes from 0 + ~32 to 255 - ~32, so you'll never get a full 0x00 or 0xFF analog value. Digital triggers get activated after full analog button is pressed (it's when you hear a "click" coming out from the button).


Weird that they don't have the full range. Do games expect to receive this nonzero analog value for an unpushed trigger? Left unchecked, it seems like this would prevent the controller working in anything other than Gamecube games.

The memory leak is fixed in my repository now (this was true a couple of days ago, but didn't want to double-post in the thread).

Thanks for writing that up, Mike4Real! It all look right from my perspective. I would make it clear that to run kextlibs, you have to have built the kext, even though it won't load.
 
D

Deleted-353083

Guest
Forgive me if this has already been asked but i couldn't be bothered reading 4 pages of writing. By any chance has a way been found to make the official GameCube adapter compatible for Wiiflow on the vWii for Wii games that were compatible with the GC controller?
 

NWPlayer123

Well-Known Member
OP
Member
Joined
Feb 17, 2012
Messages
2,642
Trophies
0
Location
The Everfree Forest
XP
6,693
Country
United States
Forgive me if this has already been asked but i couldn't be bothered reading 4 pages of writing. By any chance has a way been found to make the official GameCube adapter compatible for Wiiflow on the vWii for Wii games that were compatible with the GC controller?
Using stuff like DIOS MIOS or whatever? Not as far as I know. It works with vWii just as much as Wii, it's just a matter of patching the software to work with it correctly.
 

MindForged

Member
Newcomer
Joined
Jan 18, 2015
Messages
6
Trophies
0
Age
31
XP
52
Country
United States
Using stuff like DIOS MIOS or whatever? Not as far as I know. It works with vWii just as much as Wii, it's just a matter of patching the software to work with it correctly.

A patch for each individual game or for WiiFlow and the like? If the former, yikes, we'll be lucky if we get Brawl support for the adapter, much less any other game. :( *Hopes for the latter*
 

area

Member
Newcomer
Joined
Jan 4, 2015
Messages
17
Trophies
0
XP
103
Country
So I splashed out all of 80p for 'Joystick Show', which is only used for testing joysticks, and doesn't suffer the jumping around issues that Enjoyable does, as it's just displaying buttons and gauges. With my driver, it sees a single joystick with 24 axes and 48 buttons. All four ports are correctly identified separately (so 'A' on one controller means button 0, but on another controller means button 3). I am therefore wondering whether the problem actually lies in Dolphin not respecting the Report IDs.

A user at the Dolphin forums has one of the new Mayflash adapters, and sees exactly the same behaviour with the Mayflash adapter in PC mode as I do with the official adapter and my driver (i.e. it doesn't work properly). The HID report from the Mayflash adapter was a little different compared to mine, but was broadly speaking the same, lending credence to a theory that my HID report and driver are both correct, and the problem here actually lies in Dolphin.

I will continue to investigate as I have time!

EDIT: OpenEMU correctly sees four separate controllers... I'm inclined to think that, at this point, the issue is that various different programs are not respecting the HID standard correctly, which wouldn't be the first time I've seen people play fast and loose with standards.

EDIT 2: Although nothing maps correctly in OpenEMU, though I am far from the first to see that issue.
 

Mike4Real

Member
Newcomer
Joined
Jan 8, 2015
Messages
9
Trophies
0
XP
105
Country
United States
Hey area, someone else made a Mac driver:
https://github.com/mitchdzugan/osx-wiiu-gcc-adapter

I am not sure how it compares or if there's anything to learn from it, but I will be continuing to use your kext file since I've already got it set up. He also made a post about it on the Smash subreddit:
http://www.reddit.com/r/smashbros/comments/2v4ki6/mac_osx_driver_for_nintendos_wiiu_gcc_adapter/

I wanted to post your driver on reddit (after asking you), but I also wanted to wait until the installation got to a point where it was more user friendly before we did that. Thought I'd inform you anyway though :)
 

area

Member
Newcomer
Joined
Jan 4, 2015
Messages
17
Trophies
0
XP
103
Country
Hey area, someone else made a Mac driver:
https://github.com/mitchdzugan/osx-wiiu-gcc-adapter

I am not sure how it compares or if there's anything to learn from it, but I will be continuing to use your kext file since I've already got it set up. He also made a post about it on the Smash subreddit:
http://www.reddit.com/r/smashbros/comments/2v4ki6/mac_osx_driver_for_nintendos_wiiu_gcc_adapter/

I wanted to post your driver on reddit (after asking you), but I also wanted to wait until the installation got to a point where it was more user friendly before we did that. Thought I'd inform you anyway though :)


Cool, I'll check this out when I get home. Skimming the source, it looks like the way he's getting around the problems I encountered is by setting each port up as its own HID controller, which makes sense. If his version works for all ports though, I may well just stop developing mine. I think you should be able to install mine permanently following the same instructions as his (i.e. the sudo chown commands).

The one possible advantage to mine is that my driver may have less lag than his, as he is sleeping for 5ms between polls (which will randomly introduce one frame of lag sometimes), whereas my driver updates whenever the data from the controller updates. I don't have a setup to confirm that, however, and the understanding I have of the code I've adapted isn't solid enough to whole-heartedly believe it either. I assume this other developer actually knows what they're doing!
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    S @ salazarcosplay: @BakerMan can one play cod from hen ps3?