PeytonPlayz595 / Shadow-4.0

Optifine client for Eaglercraft u34 with support for EaglerForge v1.3 mods
https://peytonplayz595.github.io/Shadow-4.0/javascript/
MIT License
17 stars 32 forks source link

Desktop Runtime not working on MacOS #3

Closed appcellphone closed 4 months ago

appcellphone commented 4 months ago

@PeytonPlayz595

Hello hello, please help me, I downloaded a zip file on my macOS silicon chip, then I did chmod +x for gradlew and ran ./gradlew runclient but I still got the 2 errors below. Thank you for sharing this amazing project!

user_name@Name-MacBook-Pro Shadow-4.0-main % ./gradlew runclient

> Task :compileEaglerJava
/Users/user_name/Downloads/Shadow-4.0-main/src/main/java/net/PeytonPlayz585/shadow/TextureUtils.java:6: error: package org.teavm.jso.typedarrays does not exist
import org.teavm.jso.typedarrays.ArrayBuffer;
                                ^
/Users/user_name/Downloads/Shadow-4.0-main/src/main/java/net/PeytonPlayz585/shadow/TextureUtils.java:7: error: package org.teavm.jso.typedarrays does not exist
import org.teavm.jso.typedarrays.DataView;
PeytonPlayz595 commented 4 months ago

@PeytonPlayz595

Hello hello, please help me, I downloaded a zip file on my macOS silicon chip, then I did chmod +x for gradlew and ran ./gradlew runclient but I still got the 2 errors below. Thank you for sharing this amazing project!

user_name@Name-MacBook-Pro Shadow-4.0-main % ./gradlew runclient

> Task :compileEaglerJava
/Users/user_name/Downloads/Shadow-4.0-main/src/main/java/net/PeytonPlayz585/shadow/TextureUtils.java:6: error: package org.teavm.jso.typedarrays does not exist
import org.teavm.jso.typedarrays.ArrayBuffer;
                                ^
/Users/user_name/Downloads/Shadow-4.0-main/src/main/java/net/PeytonPlayz585/shadow/TextureUtils.java:7: error: package org.teavm.jso.typedarrays does not exist
import org.teavm.jso.typedarrays.DataView;

You're gonna have to update your repo with the latest commits, I accidentally left some imports in the code for the browser runtime, and those API's are not supported in the desktop runtime. I fixed it in this commit so you must be using a slightly outdated version.

appcellphone commented 4 months ago

@PeytonPlayz595 Yay Thank you so much! The Task :compileEaglerJava now done but the client do not show the window, here the latest log i see in the console:

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
5 warnings
<=========----> 75% EXECUTING [1m 46s]
> :runclient
PeytonPlayz595 commented 4 months ago

@PeytonPlayz595 Yay Thank you so much! The Task :compileEaglerJava now done but the client do not show the window, here the latest log i see in the console:

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
5 warnings
<=========----> 75% EXECUTING [1m 46s]
> :runclient

When I run it a pop up appears that says launch renderdoc and continue (optional) and you just have to click ok

appcellphone commented 4 months ago

@PeytonPlayz595 How can we active or accept the renderdoc because I try "Show all windows" in the terminal but nothing happen or showing:

image
PeytonPlayz595 commented 4 months ago

@appcellphone I've never used MacOS, are you able to provide a screen recording showing how you run it?

PeytonPlayz595 commented 4 months ago

Ik in the build.gradle there is this code, I'm not sure what it does, I'll have to ask radman since he made it but it has something to do with Mac:

if (System.getProperty("os.name").toLowerCase().contains("mac")) {
    jvmArgs '-XstartOnFirstThread'
}

What happens when you remove that code?

radmanplays commented 4 months ago

Ik in the build.gradle there is this code, I'm not sure what it does, I'll have to ask radman since he made it but it has something to do with Mac:

if (System.getProperty("os.name").toLowerCase().contains("mac")) {
    jvmArgs '-XstartOnFirstThread'
}

What happens when you remove that code?

-XstartOnFirstThread is a vm arg required for mac users to run the client as mentioned here: https://stackoverflow.com/questions/28149634/what-does-the-xstartonfirstthread-vm-argument-do-mean and here: https://www.lwjgl.org/guide

that code in build.gradle detects if the user is using macOS and if yes it adds the vm arg "-XstartOnFirstThread"

its used in mcpReborn's build.gradle too: https://github.com/Hexeption/MCP-Reborn/blob/1.20/build.gradle

PeytonPlayz595 commented 4 months ago

Oh, when I googled it I couldn't find anything about it.

appcellphone commented 4 months ago

@PeytonPlayz595 I can setup the debug in clion and i see that it stop at: double r = win.getDevicePixelRatio();

image image
appcellphone commented 4 months ago

And from the code, we can hide the renderdoc confirm by adding args 'hide-renderdoc'

tasks.register('runclient', JavaExec) {
    classpath = sourceSets.eagler.compileClasspath
    group = "ShadowClient"
    description = "Runs the client"
    classpath sourceSets.eagler.runtimeClasspath
    if (System.getProperty("os.name").toLowerCase().contains("mac")) {
        jvmArgs '-XstartOnFirstThread','-Dorg.lwjgl.util.Debug=true', '-Dorg.lwjgl.util.DebugLoader=true'
    }
    if (project.hasProperty("appArgs")) {
        args Eval.me(project.appArgs)
    }
    args 'hide-renderdoc'
    workingDir "./desktopRuntime"
    main 'net.lax1dude.eaglercraft.v1_8.internal.lwjgl.MainClass'
}
PeytonPlayz595 commented 4 months ago

@PeytonPlayz595 I can setup the debug in clion and i see that it stop at: double r = win.getDevicePixelRatio();

image image

That's the code for the browser runtime, for the desktop runtime the classpath needs to be set to src/lwjgl/java instead of src/teavm/java

appcellphone commented 4 months ago

@PeytonPlayz595 Yay, thank you for patiently supporting me, I really appreciate it! I have deleted the teavm code so that PlatformRuntime is selected from src/lwjgl/java. And when debugging, the program stops at: windowHandle = glfwCreateWindow(windowWidth, windowHeight, "Eaglercraft Desktop Runtime", 0l, 0l);

image
radmanplays commented 4 months ago

@PeytonPlayz595 Yay, thank you for patiently supporting me, I really appreciate it! I have deleted the teavm code so that PlatformRuntime is selected from src/lwjgl/java. And when debugging, the program stops at: windowHandle = glfwCreateWindow(windowWidth, windowHeight, "Eaglercraft Desktop Runtime", 0l, 0l); image

bro, just download the repo again, go to the src folder and ONLY DELETE THE FOLDER CALLED "teavm" and DO NOT DELETE "lwjgl"

appcellphone commented 4 months ago

@radmanplays Thank you so much, after attempting to delete the folder in src, I still encountered the program halting. I tried to find ways to display a window if any, but no window or dialog appeared.

user_name@User-MacBook-Pro Shadow-4.0 % ./gradlew runclient

> Task :runclient
[09:24:40+743][main/INFO][EagRuntime]: Version: EagRuntimeX 1.0
[09:24:40+746][main/INFO][RuntimeLWJGL3]: Starting Desktop Runtime...
[LWJGL] Version: 3.3.3+5
         OS: Mac OS X v14.4.1
        JRE: macOS aarch64 21.0.1
        JVM: OpenJDK 64-Bit Server VM v21.0.1 by Homebrew
[LWJGL] Loading JNI library: lwjgl
        Module: org.lwjgl
        macos/arm64/org/lwjgl/liblwjgl.dylib not found in java.library.path=/Users/user_name/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
        Loaded from java.library.path: ./liblwjgl.dylib
[LWJGL] Loading library: glfw
        Module: org.lwjgl.glfw
        Loaded from java.library.path: ./libglfw.dylib
[LWJGL] Loading library: objc
        Module: org.lwjgl
[LWJGL] Loading library: jemalloc
        Module: org.lwjgl.jemalloc
        Loaded from java.library.path: ./libjemalloc.dylib
[LWJGL] MemoryUtil allocator: JEmallocAllocator
[LWJGL] Java 9 text decoding enabled
        Loaded from system paths: /usr/lib/libobjc.A.dylib
[LWJGL] Java 10 multiplyHigh enabled
[09:24:40+828][main/INFO][RuntimeLWJGL3]: GLFW Version: 3.4.0 Cocoa NSGL Null EGL OSMesa monotonic dynamic
[LWJGL] Java 9 check intrinsics enabled
<=========----> 75% EXECUTING [20s]
> :runclient

my java version

java --version
openjdk 21.0.1 2023-10-17
OpenJDK Runtime Environment Homebrew (build 21.0.1)
OpenJDK 64-Bit Server VM Homebrew (build 21.0.1, mixed mode, sharing)
zumbiepig commented 4 months ago

I don't get any errors while launching. However, I cannot start the client. It will get stuck at 75% :runclient. This is what it looks like for me.

image
PeytonPlayz595 commented 4 months ago

Try setting up the project in eclipse and running the eaglercraftDebugRuntime.launch configuration and see if it'll run like that,

PeytonPlayz595 commented 4 months ago

@orionzleon @appcellphone You will have to use the browser version, it doesn't have any natives for MacOS

Screenshot (470)

appcellphone commented 4 months ago

@PeytonPlayz595 Thank you for the incredibly useful information! What operating system do you normally use to code and debug in Eclipse? If I use the browser version, does that mean I will code in Java and then build it into JavaScript and test it on the web?

PeytonPlayz595 commented 4 months ago

@PeytonPlayz595 Thank you for the incredibly useful information! What operating system do you normally use to code and debug in Eclipse? If I use the browser version, does that mean I will code in Java and then build it into JavaScript and test it on the web?

I use Windows 10, and yes, you program in java and run gradlew generatejavascript to build the JavaScript client, the directory for the web client is /javascript

appcellphone commented 4 months ago

Yay! Thank you so much! I will trying that way!