betacraftuk / betacraft-launcher

A launcher for Minecraft focused on legacy versions of the game
https://betacraft.uk
GNU General Public License v3.0
323 stars 41 forks source link

[FEATURE] Add support for arm64 libraries for macos #206

Open parkman29 opened 1 year ago

parkman29 commented 1 year ago

Using x86_64 java on M1 Macs is inefficient but it seems like arm64 versions of java are unsupported

parkman29 commented 1 year ago

Log: (20:59:36) Java version: Azul Systems, Inc., OpenJDK Runtime Environment, 1.8.0_362-b09 (20:59:36) System: mac os x, 13.1, aarch64 (20:59:36) Loaded in: 345588708 ns (20:59:36) java.lang.UnsatisfiedLinkError: /private/var/folders/56/x37d_ffx2gd5mrcp8n5fy_wc0000gn/T/jna--2054341769/jna4345429807442412139.tmp: dlopen(/private/var/folders/56/x37d_ffx2gd5mrcp8n5fy_wc0000gn/T/jna--2054341769/jna4345429807442412139.tmp, 0x0001): tried: '/private/var/folders/56/x37d_ffx2gd5mrcp8n5fy_wc0000gn/T/jna--2054341769/jna4345429807442412139.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/56/x37d_ffx2gd5mrcp8n5fy_wc0000gn/T/jna--2054341769/jna4345429807442412139.tmp' (no such file), '/private/var/folders/56/x37d_ffx2gd5mrcp8n5fy_wc0000gn/T/jna--2054341769/jna4345429807442412139.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64')) (20:59:36) at java.lang.ClassLoader$NativeLibrary.load(Native Method) (20:59:36) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1950) (20:59:36) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1832) (20:59:36) at java.lang.Runtime.load0(Runtime.java:783) (20:59:36) at java.lang.System.load(System.java:1100) (20:59:36) at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:946) (20:59:36) at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:921) (20:59:36) at com.sun.jna.Native.(Native.java:189) (20:59:36) at com.sun.jna.Pointer.(Pointer.java:54) (20:59:36) at com.sun.jna.Structure.(Structure.java:2130) (20:59:36) at org.betacraft.Wrapper.(Wrapper.java:170) (20:59:36) at org.betacraft.launcher.Launcher.main(Launcher.java:209) (20:59:41) Client closed.

rguca commented 7 months ago

I ran into this. Performance is really bad without the native arm libraries. It's really sad to get over 100fps in the current Minecraft release and around 30fps in 1.7.3 beta. There are version of LWJGL 2 for apple silicon around. E.g. https://github.com/r58Playz/lwjgl2-m1 We somehow need to integrate this into the launcher.

rguca commented 7 months ago

I replaced the native libraries with the ones from the link above and now it gets a little further:

patchmacmouse - true
fix15a - false
deAWT - true
found mcclas: net.minecraft.client.Minecraft
found appletMode field: n
found canvas class name: r
found match for guiscreen: da
found resolution: d
found resolution: e
found match for mousehelper: net.minecraft.client.Minecraft
found match for mousehelper: vy
MOUSE Y INVERT: false
Accepted username: x
Client asked for parameter: fullscreen
16 achievements
151 recipes
Client asked for parameter: username
Client asked for parameter: sessionid
Client asked for parameter: server
Applying fixes...
Applying fixes...
zsh: trace trap  /Library/Java/JavaVirtualMachines/zulu-8.jre/Contents/Home/bin/java  -Xmx1G  

Error in the report:

Crashed Thread:        31  Java: Minecraft main thread

Exception Type:        EXC_BREAKPOINT (SIGTRAP)
Exception Codes:       0x0000000000000001, 0x000000018e76bdbc

Termination Reason:    Namespace SIGNAL, Code 5 Trace/BPT trap: 5
Terminating Process:   exc handler [1885]

Application Specific Information:
-[NSOpenGLContext setView:] must be called from the main thread.
rguca commented 7 months ago

I found a workaround to play beta 1.7.3 on apple silicon: Use Prism Launcher + beta_OptiFine_1.7.3_HD_MT_G2 for fps boost

Play in fullscreen (ctrl + f11) or else the colours will be messed up. I get stable 100 fps with vsync.

Moresteck commented 7 months ago

I replaced the native libraries with the ones from the link above and now it gets a little further:

patchmacmouse - true
fix15a - false
deAWT - true
found mcclas: net.minecraft.client.Minecraft
found appletMode field: n
found canvas class name: r
found match for guiscreen: da
found resolution: d
found resolution: e
found match for mousehelper: net.minecraft.client.Minecraft
found match for mousehelper: vy
MOUSE Y INVERT: false
Accepted username: x
Client asked for parameter: fullscreen
16 achievements
151 recipes
Client asked for parameter: username
Client asked for parameter: sessionid
Client asked for parameter: server
Applying fixes...
Applying fixes...
zsh: trace trap  /Library/Java/JavaVirtualMachines/zulu-8.jre/Contents/Home/bin/java  -Xmx1G  

Error in the report:

Crashed Thread:        31  Java: Minecraft main thread

Exception Type:        EXC_BREAKPOINT (SIGTRAP)
Exception Codes:       0x0000000000000001, 0x000000018e76bdbc

Termination Reason:    Namespace SIGNAL, Code 5 Trace/BPT trap: 5
Terminating Process:   exc handler [1885]

Application Specific Information:
-[NSOpenGLContext setView:] must be called from the main thread.

LWJGL from the link above doesn't work either on my machine. I have the natives for Silicon, and I'm going to make the v1 launcher use them.