Skip to content
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

Bare apple client #1420

Merged
merged 31 commits into from
Aug 15, 2023
Merged

Bare apple client #1420

merged 31 commits into from
Aug 15, 2023

Conversation

colincornaby
Copy link
Contributor

This is a bare Mac client - stripping out the Metal renderer to try to Mac review more piecemeal. It does not implement GL - if you login the game will work, just without display.

Few notes:

  • The amount of code in Main.m is very un-Cocoa-like. This should probably be split into different classes - but the initial Mac GL client was used as the starting point. I've attempted to move new code into proper Obj-C classes.
  • Obj-C classes were created for Mac specific behavior, or when the engine needed to bound to Obj-C code that relies on Obj-C code concepts.
  • I've removed Metal code everywhere except for PLSView - where it is guarded by a preprocessor flag. I thought this would be helpful for showing how GL needs to be integrated. Going forward - GL probably needs to add a proper GL layer, and GL needs to draw based on the system callback for timing.
  • The Mac executable still does not self patch and is hard coded with some behaviors to support the Windows manifest.

@Hoikas
Copy link
Member

Hoikas commented Jul 12, 2023

I do see the request for me to review this. The challenge for me is that I'm really out of my depth here in mac land, but I will do my best to look at this soon-ish.

Copy link
Contributor

@dgelessus dgelessus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some low-hanging fruit I noticed on a semi-quick read...

Scripts/Ports/python3/portfile.cmake Outdated Show resolved Hide resolved
Scripts/Triplets/arm64-osx.cmake Outdated Show resolved Hide resolved
Scripts/Triplets/arm64-osx.cmake Outdated Show resolved Hide resolved
Sources/Plasma/Apps/plClient/Mac-Cocoa/Info.plist.in Outdated Show resolved Hide resolved
Sources/Plasma/Apps/plClient/Mac-Cocoa/main.mm Outdated Show resolved Hide resolved
Sources/Plasma/Apps/plClient/Mac-Cocoa/main.mm Outdated Show resolved Hide resolved
Sources/Plasma/Apps/plClient/Mac-Cocoa/main.mm Outdated Show resolved Hide resolved
Sources/Plasma/CoreLib/HeadSpin.cpp Show resolved Hide resolved
@colincornaby
Copy link
Contributor Author

I do see the request for me to review this. The challenge for me is that I'm really out of my depth here in mac land, but I will do my best to look at this soon-ish.

Following back up on this - The Obj-C is going to be difficult to get peer review on. But I'm hoping to get some feedback on C++ and CMake bits. My experience with CMake (or vcpkg) is not as deep as yours. So I think even if the Obj-C itself isn't being reviewed by everyone, there are parts of this where I'd like to get feedback from the perspective of the Windows and Linux maintainers.

Copy link
Member

@Hoikas Hoikas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering the terrible implications of things like microsoft/vcpkg#32432, I am wondering if we need to split these ports and our python-cairosvg port out into another repository that acts as a vcpkg registry. That way, we aren't cluttering up our repo with a multitude of supporting vcpkg port tweaks.

Sources/Plasma/Apps/plClient/CMakeLists.txt Outdated Show resolved Hide resolved
Sources/Plasma/Apps/plClient/CMakeLists.txt Show resolved Hide resolved
Sources/Plasma/Apps/plClient/CMakeLists.txt Outdated Show resolved Hide resolved
Sources/Plasma/Apps/plClient/Mac-Cocoa/PLSPatcher.mm Outdated Show resolved Hide resolved
Sources/Plasma/Apps/plClient/Mac-Cocoa/PLSServerStatus.mm Outdated Show resolved Hide resolved
Sources/Plasma/CoreLib/CMakeLists.txt Outdated Show resolved Hide resolved
cmake/PlasmaTargets.cmake Show resolved Hide resolved
@colincornaby
Copy link
Contributor Author

I think we're getting towards the end of the current feedback on this review. Things that still need to be dealt with (and apologies if I forgot feedback on this list, please follow up with things I forgot!):

  • There are still some comments leftover in the Mac Main from the Windows version when stuff was being copied over. These comments no longer apply and should be deleted.
  • Anything VCPKG. Builds feel much longer right now. It looks like cpython is being rebuilt every build now.
  • Something I'm tracking but may not resolve here - the Python/Cairo vcpkg stuff is still sometimes failing on Apple Silicon builds. I believe Cairo is only being used by asset generation bits and not the client. Python still doesn't look in the Homebrew folder location on Apple Silicon for Cairo - so it fails the Cairo test on build. I've been manually patching the correct rpath into Python. But if we're applying diffs to Python anyway, maybe the Homebrew rpath could be added in another diff.

Copy link
Contributor

@patmauro patmauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's not too much to ask - would you mind co-authoring me in the commit(s) for the icons? Put a lot of work into em and I'm really proud of the results, so I just wanna make sure I have proper attribution there. :) Thanks!

@colincornaby
Copy link
Contributor Author

If it's not too much to ask - would you mind co-authoring me in the commit(s) for the icons? Put a lot of work into em and I'm really proud of the results, so I just wanna make sure I have proper attribution there. :) Thanks!

Sure! I'll make the change to the Git history.

@colincornaby colincornaby force-pushed the bare-apple-client branch 3 times, most recently from 0ceca45 to ee85339 Compare July 21, 2023 05:08
@colincornaby
Copy link
Contributor Author

If it's not too much to ask - would you mind co-authoring me in the commit(s) for the icons? Put a lot of work into em and I'm really proud of the results, so I just wanna make sure I have proper attribution there. :) Thanks!

Just following up - I made this change a few days ago. Go ahead and review! Wanted to make sure you were aware.

@colincornaby
Copy link
Contributor Author

I'm considering disabling breaking up long lines in Obj-C files. There was the earlier discussion about long argument sets in Obj-C. But what I'm seeing is that Clang-Format is breaking up some Obj-C lines that only have one or several arguments.

I think it's a consequence of Obj-C function calls just being longer than C++ calls.

@colincornaby
Copy link
Contributor Author

I went ahead and turned off line length enforcement entirely in Obj-C files. That means it's up to the developer to use their best judgement in breaking up Obj-C lines or letting them wrap.

Again - my concern was that a strict line limit was leading to some really poor choices in breaking up Obj-C function calls. It would be great if Clang format could be smarter and set a minimum argument count until it started breaking up function calls. But I haven't seen that option.

@patmauro
Copy link
Contributor

If it's not too much to ask - would you mind co-authoring me in the commit(s) for the icons? Put a lot of work into em and I'm really proud of the results, so I just wanna make sure I have proper attribution there. :) Thanks!

Just following up - I made this change a few days ago. Go ahead and review! Wanted to make sure you were aware.

Perfect, thanks. :) Appreciate it!

@colincornaby
Copy link
Contributor Author

Still a few things left here, but I thought I'd mention a few issues that I'm reserving for future pull requests:

  • Python not having the right rpath to find Cairo from Homebrew on Apple Silicon. In since we're already patching Python anyway this patch could be added.
  • Something is weird with the post build script and the pngcrush path and I'm seeing it fail out of the box. Don't know if it's just my machine, the Github Actions seem fine. If there is a configuration change required, that will be a separate PR.

@colincornaby
Copy link
Contributor Author

I believe we're all resolved up. So this is either ready to move ahead or ready for more feedback.

vcpkg-configuration.json Outdated Show resolved Hide resolved
Sources/Plasma/CoreLib/HeadSpin_Mac.mm Show resolved Hide resolved
Sources/Plasma/CoreLib/HeadSpin.cpp Outdated Show resolved Hide resolved
Sources/Plasma/Apps/plClient/Mac-Cocoa/PLSPatcher.mm Outdated Show resolved Hide resolved
Sources/Plasma/Apps/plClient/Mac-Cocoa/.clang-format Outdated Show resolved Hide resolved
Sources/Plasma/Apps/plClient/Mac-Cocoa/.clang-format Outdated Show resolved Hide resolved
Sources/Plasma/Apps/plClient/CMakeLists.txt Outdated Show resolved Hide resolved
Sources/Plasma/Apps/plClient/CMakeLists.txt Outdated Show resolved Hide resolved
Sources/Plasma/Apps/plClient/CMakeLists.txt Outdated Show resolved Hide resolved
@colincornaby
Copy link
Contributor Author

@Hoikas - In since we've been through a round of the Obj-C indentation discussion with @dgelessus - I'm going to go ahead and resolve those conversations. The short version I think we got down to: Obj-C style is really long function names, they can wrap super funny because the : needs to be aligned, we're not sure what the best solution is, but Obj-C won't be forced to indent.

cmake/VcpkgToolchain.cmake Outdated Show resolved Hide resolved
colincornaby and others added 19 commits August 12, 2023 20:57
Also leaving notes for future explorers.
There be dragons here. We originally kept Github Actions from performing the zip because our archive had symlinks in it, which it turns into hard copes of files. Xcode's archive and code signing tooling expects those symlinks, so we weren't able to sign.

As of right now - there are no symlinks in the archive. So things should be ok. If any frameworks are added this will break again. Hopefully by that point Github has resolved their issues.
Copy link
Member

@dpogue dpogue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from this minor nitpick, I think we are at a point where it makes sense to merge this

Sources/Plasma/NucleusLib/pnInputCore/plInputMap.cpp Outdated Show resolved Hide resolved
Copy link
Member

@Hoikas Hoikas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just code style and typo nits, I think.

Sources/Plasma/Apps/plClient/Mac-Cocoa/PLSPatcher.mm Outdated Show resolved Hide resolved
Sources/Plasma/Apps/plClient/Mac-Cocoa/PLSPatcher.mm Outdated Show resolved Hide resolved
Sources/Plasma/Apps/plClient/Mac-Cocoa/PLSPatcher.mm Outdated Show resolved Hide resolved
Sources/Plasma/Apps/plClient/Mac-Cocoa/PLSView.mm Outdated Show resolved Hide resolved
Sources/Plasma/CoreLib/HeadSpin.cpp Outdated Show resolved Hide resolved
Copy link
Member

@Hoikas Hoikas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I'd like to hear from @dpogue before merging, however.

Copy link
Member

@dpogue dpogue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's merge it, and then I'll rebase the Linux client stuff on top.

Worth noting (again, for the record) that this macOS client currently has no renderer, so it will not build a client that "works" for any playable definition of "working".

@colincornaby
Copy link
Contributor Author

Let's merge it, and then I'll rebase the Linux client stuff on top.

Worth noting (again, for the record) that this macOS client currently has no renderer, so it will not build a client that "works" for any playable definition of "working".

I expect I'll have a rebased version of the Metal renderer on top of this shortly after merge.

@colincornaby colincornaby merged commit e9b5125 into H-uru:master Aug 15, 2023
14 checks passed
@colincornaby colincornaby deleted the bare-apple-client branch August 15, 2023 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants