-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MacOS support #50
MacOS support #50
Conversation
First sorry for responding so late, but I have been busy with other projects and only come back to handle some stuff for a week on this one. I don't know if you still want to work on this (if not, I might have to pull your pr and coauthor), but there are couple of major issues preventing me to merge this. Mainly, I can't have the encoding features AND the mac os support in the same PR, you would need to split this pr to ONLY mac os and if needed, update your encoding pr. The other issue is the cache because I am p sure the reason I ended up HAVING to do it is due to the viewer since the view should only change what parts of the ram is shown while it's already read. I honestly don't like it, but unless I can be convinced it doesn't cause issues with the viewer I can't exactly make this go forward (there's also the fact you seemed to run rather old hardware at the time of the PR while dolphin already expects you to have p good hardware). So I would need to be more convinced that removing the cache is needed. I also see other issues like some files don't have a line at the end and for some reasons, you seemed to have changed the csproj more than it should be needed. Do you still want to work on this? As I said, if it's not possible, I could always pull your branch and coauthor the PR to a mergable state myself, but it's up to you. |
Thank you for taking a look at my PR. If I remember correctly, the CPU usage with DME open (and idle) was around 90% on macOS. Most of this time was spent on reading process memory for the cache, so it needed to be removed. The performance hit may be less pronounced on newer systems, but I think the cache probably needs to be made more performant anyways (I removed it completely, thinking that the cache was only an optimization that turned detrimental). I can look into the code again later to see if removing the cache had any unwanted side effects, and if it did, I will fix that. Also, how do you recommend me to split the PRs? I can fork master again to a separate branch and re-commit the changes to implement macOS support (minus the Unicode support). In that case, I would delete this PR. Does that work? I will also review the formatting and revert .csproj in both PRs, if that works for you. |
I know my memories are very vague, but ik I eventually had to put the cache at least for the viewer to be happy so this is why I am hesitant. If however, there's enough reasons for me to know it could be removed, sure, but I am p sure that the reason I ended up doing it is because it wasn't feasible to read the block of ram needed for the viewer everytime you would scroll. It was WAY more performant to do one big read every once in a while vs many small reads. This is also why I put the timer settings so you can make it update slowly. So yeah, I am very unsure here.
You can just force push cause you already have a PR opened about string encoding so you could just force push that one with your encoding stuff if needed. For this PR, same thing, you can just force push (and you may as well squash the commits cause it can make the history cleaner). Point is, you don't NEED to close any PRs for now.
Yeah, I would have pointed these out in a deeper reivew, but since this had organizational issues, I only glossed the changes and saw these. Btw I need to ask because I am curious: I tried years ago to make this work on a mac vm and it refused to have the perm to even read a remote process and from what I gathered, you needed to sign the thing, but to do that, the only way I found was to buy a certificate which cost an annual fee. How did you got it to work without doing this? |
e195f01
to
c8547ef
Compare
Sorry for the delay! I have measured the performance of removing the cache on Linux, Windows, and macOS and there seems to be little overall change other than the speedup on macOS (and a slight improvement on Linux). There is a small increase in CPU usage, though, when scrolling in MemViewer (on Windows mostly), but it is not critical. For the macOS permissions, the executable needs to be signed with a code signing certificate and it needs to be given debugger entitlements (found in Also, I have just separated the PRs, so this PR now only contains changes to implement macOS support. I also tried to address the formatting in both branches, along with fixing a few remaining problems in this PR. How does everything look at the moment? Let me know if there is anything else I should modify. |
So I got a build error with this PR, that happened to occur in Common/CommonUtils.h, but I added another #Elif for mac that uses linux's elif template. I had to add #import <libkern/OSByteOrder.h>, under another #elif for apple, and before the return bSwap16, etc I added #define bswap_16(x) _OSSwapInt16(x) using functions from the import. The Error I ended up getting was a segmentation fault on MacOS Catalina. If anyone wants I could add my edits in a txt to here |
Thank you for your report, @Hibyehello. Are you certain you are compiling the correct branch? I already added byte-swap macros in CommonUtils.h guarded with If you think you are doing everything correctly (as outlined in the new README) and there are still issues, let me know. |
Well from I had gotten there was not any Apple specific code in commonutils.h, but let me look, and I will keep testing |
What I had pulled didn't have the code but I see the code you have began adding |
So after building I was unable to hook it to dolphin after doing all the certificate stuff, it said it saw the process, but couldn't see that the game was running. |
Not sure where the issue is occurring, but I suspect the code may not be reliably finding the emulator memory region ( Also, what version of Dolphin are you using? It seems to work for me on 5.0-14095. |
Before emulation starts: Using Dolphin version 5.0-11653 |
Not sure then. Are you certain the executable has the proper entitlements? Try |
I get |
Could this be an issue with my version of mac os, since I am running Mac Os 10.12 (Sierra) |
I recently got a 2020 MacBook Air on macOS 11.3 and was able to test my changes. Initially, DME was unable to access Dolphin's memory because it seems macOS 11 requires processes to have a certain entitlement ( @Hibyehello, perhaps using the new |
I'll test this when I get time, and report back. |
Sorry I've been busy, but I tried this today and I got
so DME won't hook |
Seems like it's broken on newer Dolphin versions; at least for me on an M1 MBA on Monterey; this worked before but somehow stopped working. |
@LapisLazulis, what exactly doesn't work? Everything seems to be fine for me on macOS 12.4, Dolphin 5.0-16380 (most recent beta), and a 2020 M1 MBA. Also, have you run |
Hi @campital, can you please rebase if this is still something you would like in DME? |
After looking over the code, I don't think it will be a big deal to revisit and rebase after the Qt 6 merge. |
This will not be present in the final Qt 5 release. |
@campital please mark as ready for review when you are done |
I have copied over the |
Ci:
Also, the other PR broke windows (probably because removed the bash line for some reason). |
d9ca850
to
dadc418
Compare
Whoops. I believe it has been fixed. |
Can you please confirm:
|
I dont have one to test
No thats not true, Qt6 should be fine in theory.
Thats a really good question I can answer some of these |
I would also recomend modifying the CMake file to be similar to the other PR #96, so it bundled an .app bundle instead of just an exectuable |
@campital do you have Discord, would like to share some info about this PR with you. |
01e7651
to
ef4fd31
Compare
Everything works on Intel Mac as far as I can tell (tested on MBA 2018). Rosetta does not seem to be a problem (tested on all 4 configurations). I also added a build system for packaging a standalone application. However, there is currently a bug in the Homebrew package for Qt that prevents the I can provide README instructions for building the standalone package but not sure if it's appropriate since the previous build system works for most cases. |
Any update here? I'll be testing on Mac shortly and just merging if things appear to work fine. If more changes need to be done let me know or open a new PR. |
Should be ready to merge. @EndangeredNayla was experiencing a rare crash bug (https://bugreports.qt.io/browse/QTBUG-119513) but I was unable to reproduce and should be fixed in the current version of Qt. |
In that case, yolo merge time. |
These changes build off of my previous PR so it might be better to just accept this one if you like the changes.
The majority of the additions were in the MacDolphinProcess files, where the memory scanning functionality for the Mach kernel was implemented. There were some major performance issues at first, mainly because vm_read on Mac is much slower than the equivalent APIs on Windows and Linux (and because I used a 2013 MacBook Air). 500mb of data were being allocated, deallocated, and read from Dolphin each second for the cache, so I removed the cache and it sped up considerably. Not sure if this is a problem, but it also seems to perform better on Linux. It still eats up a bit of CPU, but profiling shows that no function in particular is to blame.
The README has been updated on how to build and run for MacOS.