WiiController icon indicating copy to clipboard operation
WiiController copied to clipboard

Support macOS 12

Open ThatsJustCheesy opened this issue 3 years ago • 16 comments

Closes #16

This does not work yet. So far, I've only swapped out usage of deprecated API that was removed, and enabled some additional logging.

ThatsJustCheesy avatar Jan 23 '22 17:01 ThatsJustCheesy

This now pairs with Wiimotes on macOS 12+. It seems to take a couple of attempts sometimes. On the plus side: once a Wiimote is paired, the app can reconnect to it later by pressing any button (re-pairing not required; in other words, it's paired for real, not temporarily paired).

My Wii U Pro controller is having issues pairing, even with Dolphin's version of WiimotePair; it seems to reject the sent PIN code for some reason. But at least everything else works.

ThatsJustCheesy avatar Feb 24 '24 03:02 ThatsJustCheesy

Here's a build of this branch as of commit 01c0326.

WiiController.dmg.zip

ThatsJustCheesy avatar Feb 24 '24 04:02 ThatsJustCheesy

So far, no such luck getting it to run on my macOS 12.5. After codesigning, I get no response from the app. When I try to delete it, it says it's "hosting system extensions" and that it'll delete them when I delete the app. Super-excited about these prospects, thank you so much for all of your hard work!

HomeStarRunnerTron avatar Feb 24 '24 04:02 HomeStarRunnerTron

I also tried it, had to do a deep code sign to get it to launch, and then was asked to allow keystrokes and notifications. But then I don't actually see any the app. Should i?

Ah, it just installs a system extension enabling the pairing. Then I go to Bluetooth settings, hold 1+2 (or press red button) on Wii remote and it shows up in Bluetooth "nearby devices", click connect should work but doesn't for me. Something seems to be timing out too quickly.

So close!

macOS 14.3.1 Sonoma

gingerbeardman avatar Feb 24 '24 13:02 gingerbeardman

how do i deep code sign this?

Segadude23 avatar Feb 29 '24 03:02 Segadude23

how do i deep code sign this?

In Terminal, do:

codesign --force --deep -s - /Applications/WiiController.app

see; https://eclecticlight.co/2019/01/17/code-signing-for-the-concerned-3-signing-an-app/

if you get an error you probably need Xcode & tools installed

gingerbeardman avatar Feb 29 '24 13:02 gingerbeardman

thank very much. i don't know how this application works, i have the WiiMote Pair application too but nothing happens, and my og wiimote and wiimote motion plus aren't pairing at all. Do i have to get the sensor bar for dolphin if none of this works?

Segadude23 avatar Feb 29 '24 18:02 Segadude23

@Segadude23 I can't explain why the two apps aren't working. WiimotePair works for me.

WiimotePair will produce an error (fail) or a paired (success) message.

As for your other options, I talk about some on my blog: https://blog.gingerbeardman.com/2023/03/21/automatically-pairing-a-wii-remote-on-macos/

gingerbeardman avatar Feb 29 '24 18:02 gingerbeardman

hello, thank you everyone! Using both WiimotePair and did the deep code sign for WiiController (mentioned by @gingerbeardman, thx). Works for me!

Oddly (and I do not know where to send this), but my mac sees the wiimote as a magic trackpad 😅

Screenshot 2024-03-01 at 23 31 52 1

macOS Sonoma 14.2.1 (23C71) m1 mbair

thank you everyone again!

LessVegetables avatar Mar 01 '24 16:03 LessVegetables

Oddly (and I do not know where to send this), but my mac sees the wiimote as a magic trackpad 😅

I also noticed that!

gingerbeardman avatar Mar 01 '24 17:03 gingerbeardman

Okay, so-- using your build from here, I was finally able to get it to run. I'm not ENTIRELY sure what I did right this time-- but I didn't codesign at first.

First, I tried my best to uninstall my previous WiiController copy using AppCleaner.

Things I did before re-installing: • Made sure I had SIP disabled-- and I do. • Reset all my System Extensions-- because a lot of garbage had piled up in there to the point where it actually displayed an error when I tried to list what was in there in the Terminal. So, in the Terminal, I wrote systemextensionsctl reset. This is going to remove all System Extensions, so any apps that you might have that use System Extensions (USB Overdrive, for example) will re-populate the next time you open it up. • Other things, uh... I also have Library Validation currently turned off? The Terminal code for that is sudo defaults write /Library/Preferences/com.apple.security.libraryvalidation.plist DisableLibraryValidation -bool true. Don't know if that matters or not.

Then, instead of codesigning first, I just right-clicked and opened the app. It opened up, and then I tried to pair once, and nothing happened. Then, I tried again, and I noticed that, even though in the WiiController app itself, nothing had happened, in the Bluetooth preferences, it had connected the Wiimote. But the Wiimote was still flashing, much like it does in WiimotePair. So I went into Dolphin, and the Wiimote paired successfully! Woohoo! Then I tried to quit out of WiiController and codesign afterward, and it still opened up afterwards. So, kind of confused, since that was always the sticking point before.

I specifically wrote...

codesign --force --deep --sign - /Applications/WiiController.app/

I think other times, I hadn't put the / at the end. Maybe it really needed that for me.

Okay-- SO-- now WiiController works at least as well as WiimotePair at pairing Wiimotes to Dolphin. However, it doesn't even recognize it's paired anything in the actual WiiController program itself! And it doesn't do what WiiController did before, which is turn the Wiimote into an SDL2-style controller that could be used in other kind of programs. It's only being recognized in Dolphin for me. It looks like this right now, to be exact...

Screen Shot 2024-04-21 at 5 39 03 PM

... and the Wiimote is paired and functional w/ Dolphin at this very moment, too.

Screen Shot 2024-04-21 at 5 39 55 PM

So it DID connect a device. Is this just how it works at the moment? To show that the app can be built and at least do what WiimotePair does? Because that's an incredible step in the right direction. I just want to know if I'm missing something-- if it's technically supposed to be able to take the Wiimote it's paired, recognize and list them in the WiiController menu, and turn them into SDL2-style controllers.

Here's the Terminal readout when I run WiiController through the Terminal and go through several failed pairings + a successful pair...

2024-04-21 17:28:46.878 WiiController[1117:18578] -[IOBluetoothDeviceInquiry initWithDelegate:] -  0x6000023d1800
2024-04-21 17:28:59.979 WiiController[1117:18578] ERROR: /Users/ian/GitHub/wjoy/Wiimote/WiimoteInquiry.m (276) -[WiimoteInquiry deviceInquiryComplete:error:aborted:]: inquiry failed: (os/kern) invalid address
2024-04-21 17:28:59.980 WiiController[1117:18578] ERROR: /Users/ian/GitHub/wjoy/Wiimote/WiimoteInquiry.m (276) -[WiimoteInquiry deviceInquiryComplete:error:aborted:]: inquiry failed: (os/kern) invalid address
2024-04-21 17:28:59.980 WiiController[1117:18578] -[IOBluetoothDeviceInquiry dealloc] -  0x6000023d1800
2024-04-21 17:29:16.682 WiiController[1117:18578] -[IOBluetoothDeviceInquiry initWithDelegate:] -  0x6000023d1800
2024-04-21 17:29:26.111 WiiController[1117:18578] ERROR: /Users/ian/GitHub/wjoy/Wiimote/WiimoteInquiry.m (276) -[WiimoteInquiry deviceInquiryComplete:error:aborted:]: inquiry failed: (os/kern) invalid address
2024-04-21 17:29:26.111 WiiController[1117:18578] ERROR: /Users/ian/GitHub/wjoy/Wiimote/WiimoteInquiry.m (276) -[WiimoteInquiry deviceInquiryComplete:error:aborted:]: inquiry failed: (os/kern) invalid address
2024-04-21 17:29:26.111 WiiController[1117:18578] -[IOBluetoothDeviceInquiry dealloc] -  0x6000023d1800
2024-04-21 17:29:39.196 WiiController[1117:18578] -[IOBluetoothDeviceInquiry initWithDelegate:] -  0x6000023d1800
2024-04-21 17:30:05.303 WiiController[1117:18578] ERROR: /Users/ian/GitHub/wjoy/Wiimote/WiimoteInquiry.m (276) -[WiimoteInquiry deviceInquiryComplete:error:aborted:]: inquiry failed: (os/kern) invalid address
2024-04-21 17:30:05.303 WiiController[1117:18578] ERROR: /Users/ian/GitHub/wjoy/Wiimote/WiimoteInquiry.m (276) -[WiimoteInquiry deviceInquiryComplete:error:aborted:]: inquiry failed: (os/kern) invalid address
2024-04-21 17:30:05.303 WiiController[1117:18578] -[IOBluetoothDeviceInquiry dealloc] -  0x6000023d1800
2024-04-21 17:30:25.990 WiiController[1117:18578] -[IOBluetoothDeviceInquiry initWithDelegate:] -  0x6000023d1800
2024-04-21 17:30:45.266 WiiController[1117:18578] ERROR: /Users/ian/GitHub/wjoy/Wiimote/WiimoteInquiry.m (276) -[WiimoteInquiry deviceInquiryComplete:error:aborted:]: inquiry failed: (os/kern) invalid address
2024-04-21 17:30:45.266 WiiController[1117:18578] -[IOBluetoothDeviceInquiry dealloc] -  0x6000023d1800
2024-04-21 17:30:48.139 WiiController[1117:19262] -[IOBluetoothDevicePair peerPairingCompleted:withError:]: Calling connectionComplete on IOBluetoothDevicePair.

Er... keep in mind my User folder is NOT named ian. It's named skye. And I don't have any of those files it's erroring about. So I dunno if that's a sign something's wrong.

HomeStarRunnerTron avatar Apr 22 '24 03:04 HomeStarRunnerTron

The hack that makes pairing work (or, perhaps my flawed implementation of it) is a bit flaky.

I think if Dolphin is using the device, WiiController won't be able to. Regardless, in my testing, it sometimes took a couple pairing attempts to make it actually work. Investigating why is a project for someday…

And /Users/ian/… is the path to the source code on my machine – it's a debug build :)

ThatsJustCheesy avatar Apr 22 '24 03:04 ThatsJustCheesy

The hack that makes pairing work (or, perhaps my flawed implementation of it) is a bit flaky.

I think if Dolphin is using the device, WiiController won't be able to. Regardless, in my testing, it sometimes took a couple pairing attempts to make it actually work. Investigating why is a project for someday…

And /Users/ian/… is the path to the source code on my machine – it's a debug build :)

Thank you so much for the quick reply! So you're saying you can sometimes get a Wiimote to be listed where it says "No Devices Connected", and then use it as an SDL2 controller outside of Dolphin? Just making sure I understand, because that's incredible, even if it works just SOMEtimes.

HomeStarRunnerTron avatar Apr 22 '24 03:04 HomeStarRunnerTron

Yeah, in my testing, I got Wiimotes to connect and be usable as HID (SDL-compatible) controllers :). But I didn't do much testing beyond that – the pairing hack didn't work for my U Pro for some reason, which was my personal main use case for this app :(

ThatsJustCheesy avatar Apr 22 '24 03:04 ThatsJustCheesy

Yeah, in my testing, I got Wiimotes to connect and be usable as HID (SDL-compatible) controllers :). But I didn't do much testing beyond that – the pairing hack didn't work for my U Pro for some reason, which was my personal main use case for this app :(

Excellent-- s'all I want to know. Here's hoping I can figure out what isn't working for me here...

HomeStarRunnerTron avatar Apr 22 '24 04:04 HomeStarRunnerTron

Okay-- sorry to double-post so quickly, but it's, uh... it's getting CLOSE for me. I tried both a Wiimote with a MotionPlus as well as a standard Wiimote, and I'd try to pair, like, 5 times, and around the fifth time, it'd recognize it, rumble the Wiimote (just one really long BZZZRRRRRT rumble-- longer than usual), then... drop the connection immediately.

Here's all the printout for my attempts at pairing the MotionPlus, up until the connection and immediate drop...

2024-04-21 18:02:41.527 WiiController[1619:34956] -[IOBluetoothDeviceInquiry initWithDelegate:] -  0x600000ef4420
2024-04-21 18:04:04.288 WiiController[1619:34956] ERROR: /Users/ian/GitHub/wjoy/Wiimote/WiimoteInquiry.m (276) -[WiimoteInquiry deviceInquiryComplete:error:aborted:]: inquiry failed: (os/kern) invalid address
2024-04-21 18:04:04.288 WiiController[1619:34956] -[IOBluetoothDeviceInquiry dealloc] -  0x600000ef4420
2024-04-21 18:04:13.638 WiiController[1619:34956] -[IOBluetoothDeviceInquiry initWithDelegate:] -  0x600000ef4420
2024-04-21 18:04:28.786 WiiController[1619:34956] ERROR: /Users/ian/GitHub/wjoy/Wiimote/WiimoteInquiry.m (276) -[WiimoteInquiry deviceInquiryComplete:error:aborted:]: inquiry failed: (os/kern) invalid address
2024-04-21 18:04:28.786 WiiController[1619:34956] -[IOBluetoothDeviceInquiry dealloc] -  0x600000ef4420
2024-04-21 18:04:30.752 WiiController[1619:35572] -[IOBluetoothDevicePair peerPairingCompleted:withError:]: Calling connectionComplete on IOBluetoothDevicePair. Status: 0
2024-04-21 18:04:30.885 WiiController[1619:34956] Wii Remote Plus connected, address b8-ae-6e-9a-80-96
2024-04-21 18:04:31.414 WiiController[1619:34956] Wii Remote Plus disconnected, address b8-ae-6e-9a-80-96

Then, subsequently, the normal Wiimote...

2024-04-21 18:04:56.921 WiiController[1619:34956] -[IOBluetoothDeviceInquiry initWithDelegate:] -  0x600000ef4420
2024-04-21 18:04:57.045 WiiController[1619:34956] ERROR: /Users/ian/GitHub/wjoy/Wiimote/WiimoteInquiry.m (276) -[WiimoteInquiry deviceInquiryComplete:error:aborted:]: inquiry failed: (os/kern) invalid address
2024-04-21 18:04:57.045 WiiController[1619:34956] ERROR: /Users/ian/GitHub/wjoy/Wiimote/WiimoteInquiry.m (276) -[WiimoteInquiry deviceInquiryComplete:error:aborted:]: inquiry failed: (os/kern) invalid address
2024-04-21 18:04:57.045 WiiController[1619:34956] -[IOBluetoothDeviceInquiry dealloc] -  0x600000ef4420
2024-04-21 18:05:02.615 WiiController[1619:34956] -[IOBluetoothDeviceInquiry initWithDelegate:] -  0x600000ef4420
2024-04-21 18:05:10.281 WiiController[1619:34956] ERROR: /Users/ian/GitHub/wjoy/Wiimote/WiimoteInquiry.m (276) -[WiimoteInquiry deviceInquiryComplete:error:aborted:]: inquiry failed: (os/kern) invalid address
2024-04-21 18:05:10.281 WiiController[1619:34956] ERROR: /Users/ian/GitHub/wjoy/Wiimote/WiimoteInquiry.m (276) -[WiimoteInquiry deviceInquiryComplete:error:aborted:]: inquiry failed: (os/kern) invalid address
2024-04-21 18:05:10.281 WiiController[1619:34956] -[IOBluetoothDeviceInquiry dealloc] -  0x600000ef4420
2024-04-21 18:05:13.096 WiiController[1619:35807] -[IOBluetoothDevicePair peerPairingCompleted:withError:]: Calling connectionComplete on IOBluetoothDevicePair. Status: 0
2024-04-21 18:05:23.339 WiiController[1619:34956] -[IOBluetoothDeviceInquiry initWithDelegate:] -  0x600000ef4420
2024-04-21 18:05:24.149 WiiController[1619:34956] ERROR: /Users/ian/GitHub/wjoy/Wiimote/WiimoteInquiry.m (276) -[WiimoteInquiry deviceInquiryComplete:error:aborted:]: inquiry failed: (os/kern) invalid address
2024-04-21 18:05:24.149 WiiController[1619:34956] -[IOBluetoothDeviceInquiry dealloc] -  0x600000ef4420
2024-04-21 18:05:29.464 WiiController[1619:34956] -[IOBluetoothDeviceInquiry initWithDelegate:] -  0x600000ef4420
2024-04-21 18:05:47.236 WiiController[1619:36043] -[IOBluetoothDevicePair peerPairingCompleted:withError:]: Calling connectionComplete on IOBluetoothDevicePair. Status: 31
2024-04-21 18:05:47.545 WiiController[1619:34956] ERROR: /Users/ian/GitHub/wjoy/Wiimote/WiimoteInquiry.m (276) -[WiimoteInquiry deviceInquiryComplete:error:aborted:]: inquiry failed: (os/kern) invalid address
2024-04-21 18:05:47.546 WiiController[1619:34956] -[IOBluetoothDeviceInquiry dealloc] -  0x600000ef4420
2024-04-21 18:05:50.391 WiiController[1619:36241] -[IOBluetoothDevicePair peerPairingCompleted:withError:]: Calling connectionComplete on IOBluetoothDevicePair. Status: 0
2024-04-21 18:05:50.544 WiiController[1619:34956] Wii Remote connected, address 00-1b-7a-56-f8-8e
2024-04-21 18:05:51.080 WiiController[1619:34956] Wii Remote disconnected, address 00-1b-7a-56-f8-8e

Don't know if any of that information is at all helpful. I'm on Monterey 12.5, if that makes a difference. Much like others, the normal Wiimote showed up as a Magic Trackpad. My MotionPlus one showed up as a normal controller.

Screen Shot 2024-04-21 at 6 09 40 PM

HomeStarRunnerTron avatar Apr 22 '24 04:04 HomeStarRunnerTron