bkacjios / m-overlay

A controller input display/overlay for Dolphin
MIT License
165 stars 44 forks source link

MacOS via Love running, but not functioning #97

Closed divuyes closed 3 years ago

divuyes commented 3 years ago

Describe the bug Unlike the only other bug report about running on Mac, my M'Overlay actually runs. It shows the "Waiting for dolphin..." animation and dialogue, as well as the "Waiting for melee..." animation and dialogue when Dolphin is run. However, when Melee is opened, it still says "Waiting for melee..." and it doesn't detect it no matter what I do. I have a hunch that this might be a permissions issue within Big Sur, however I am not entirely sure that is the case, and I do not know how to solve this.

Desktop (please complete the following information):

To Reproduce Steps to reproduce the behavior:

  1. Open the m-overlay.love file
  2. Open Dolphin
  3. Load Melee
  4. See error

Expected behavior I expected it to detect Melee since it detected Dolphin, however it didn't do anything and kept waiting for Melee.

Screenshots Initial run:

Screen Shot 2021-07-28 at 7 05 50 PM

Opening Slippi through Slippi Launcher:

Screen Shot 2021-07-28 at 7 06 50 PM

As shown, Melee is running however not being detected, despite Dolphin being hooked.

Settings (in case it's useful):

Screen Shot 2021-07-28 at 7 09 24 PM

Debug console output

[INFO  - 19:05:43] [DOLPHIN] Unhooked
[DEBUG - 19:06:02] Found dolphin-emu process: /proc/32757
[INFO  - 19:06:02] [DOLPHIN] Hooked
[INFO  - 19:06:04] [DOLPHIN] Unhooked
[DEBUG - 19:06:07] Found dolphin-emu process: /proc/32764
[INFO  - 19:06:07] [DOLPHIN] Hooked
bkacjios commented 3 years ago

Yeah, MacOS functionality is currently incomplete, it's why I don't have an official dmg release of it yet. I actually built a hackintosh using my old PC parts to try and work on development for it. The most I managed to do was find the dolphin process, which is the behavior you are currently seeing.

https://github.com/bkacjios/m-overlay/blob/master/source/modules/memory/osx.lua

I hit a roadblock when I found that applications on mac need a special permission called Debugging Tool Entitlement in order to attach to it and read from the processes memory.

If you or anyone else knows more about macs and could help with this, I'd really appreciate it.

divuyes commented 3 years ago

Hmm. I don't know a whole lot about developing for Lua/MacOS directly, however it seems like this is a part of Hardened Runtime. Is it possible to go in Xcode and grant this entitlement?

bkacjios commented 3 years ago

I have no idea. I basically know nothing about mac. Even if you did grant the permissions somehow, the osx bit of code is incomplete. It would allow me to work on it again though.

divuyes commented 3 years ago

When I can, I'll see if I can use Xcode to modify the entitlement permissions of it. I'm not quite sure if I can because I don't know if Xcode works with programs other than .apps, but we will see. If not, then the .love file may be able to work if converted into a .app. We shall see.

bkacjios commented 3 years ago

m-overlay-x64 (master-305).zip

I made a build with extra prints to output in the terminal if it managed to get the correct permissions or not. Rename it from .zip to .love

But just so you know, M'Overlay still won't work no matter what you do, but this information would help knowing I can actually properly hook and read from memory.

divuyes commented 3 years ago

As expected, the new patch printed failed permissions. However, I may have found what you need to do. First, it needs to be a .app file, so I cannot do anything with the current .love file. However, once you get that, you can follow this article to enable the Hardened Runtime and grant Debugging Tool Entitlement. Obviously, any time it says in the article the camera permission, substitute it with com.apple.security.cs.debugger.

bkacjios commented 3 years ago

I wonder if this would work on the love.app, since basically, it's the engine in which m-overlay runs? I'll have to get my hackintosh working again to try and start work on this again.

bkacjios commented 3 years ago

Okay so after some more research, I found that the application you want to read memory from ALSO needs a seperate permissions set.

com.apple.security.get-task-allow

So this would also have to be set on dolphin as well..

bkacjios commented 3 years ago

Well, from what I'm reading, this would require me to have a development ID, which I don't have, in order to sign my own application. This would be a huge roadblock, since I don't think they accept apps with these debug permissions set.

As much as I would love to have support for mac, it just seems like it's impossible to do so.

It also doesn't help that dolphin would have to ship with the proper permissions as well.

divuyes commented 3 years ago

Oh alright. If anything changes, I'll make a new thread. However, since the future is grim, I'm gonna close this thread. Thanks for trying, at least.

isaac-ssbm commented 2 years ago

Would it help to set up a donation goal? I think developer IDs cost like $99/year. There are a lot of macOS users and im sure we’d hit that goal in a few days if not even in a few hours.

bkacjios commented 2 years ago

It's a lot more complicated than just getting an developer ID.

https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_cs_debugger

Could maybe have it use Dolphins MemoryWatcher instead, but I don't know if the builds of slippi dolphin have it enabled.