seraxis / lr2oraja-endlessdream

A featureful fork of beatoraja
https://github.com/seraxis/lr2oraja-endlessdream/releases
GNU General Public License v3.0
50 stars 12 forks source link

Support for macos? #41

Open Catizard opened 1 month ago

Catizard commented 1 month ago

Tried building project from source but get link library error: Failed to load library: liblwjgl.dylib Seems like the gradle should import something likelwjgl:native-macos, but I don't quite understand how dependency is managed

seraxis commented 1 month ago

in the move to gradle an early decision was made to still create an "uber jar" to retain the portability that upstream beatoraja achieves and allow for the drop-in replacement of Endless Dream jars. When creating an uberjar like this gradle will download all platform natives and package them, I wrote a build plugin that filters those down to a few supported architectures in a slightly hacky way.

Modifying the build scripts to support MacOS should be relatively simple but I don't have a MacOS machine to validate any build I would produce, but PRs to assist are more than welcome!

Catizard commented 1 month ago

↑mistake :( I have platform=macos in my gradle.properties but it didn't give me correct dependency. I will do some research in my spare time, thanks :D

seraxis commented 1 month ago

As stated above platform=macos does not currently work, if you'd like to contribute I would definitely appreciate it and you can use this issue to track your progress

Catizard commented 1 month ago

I managed to run MainLoader :D

Following your comment I found that PlatformFilter has filtered lwjgl:natives-macos-arm64.jar and kept lwjgl:natives-macos.jar, which leads to the initial "Failed to load library" problem. It seems also influence arm linux users by providing the similar 2 packages lwjgl:natives-linux-arm64.jar and lwjgl:natives-linux.jar.

It's a little bit strange that lwjgl:natives-macos.jar is abbreviating the x86-64 suffix. Maybe we need to do some workaround to fix this (like giving the arm64 suffix when the arch is specified as aarch64).

However, when I pressed the Play button, the game crashed. And it says cannot find sqlite and imgui-java64 library :(

Raw exception messages:

Caused by: java.lang.Exception: No native library is found for os.name=Mac and os.arch=aarch64. path=/org/sqlite/native/Mac/aarch64
Caused by: java.lang.UnsatisfiedLinkError: no imgui-java64 in java.library.path: /Users/suzume/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.

Seems like still architecture problem. I think I can figure it out soon :D

UPD: imgui-java64 needs to upgrade to 1.87.0 to support macos-arm64 and yes, it brings some api changes :( UPD2: Sqlite connector version is too low that doesn't give support for macos-arm64. After upgrading its version to 3.42.0.0 I finally launched Endless Dream in success :D

seraxis commented 1 month ago

Ahh yes now I remember, the sqlite package gets mangled by the platform filter unintentionally as it uses different prefixes I believe? It might need it's own separate dependency pass to reduce file size (I intentionally try and get it lower than upstream).

Glad to hear you got it working! If you want to open a PR that would be much appreciated