diff --git a/JavaApp/libs/compat-1.0.0.jar b/JavaApp/libs/compat-1.0.0.jar deleted file mode 100644 index 45b3a859..00000000 Binary files a/JavaApp/libs/compat-1.0.0.jar and /dev/null differ diff --git a/JavaApp/libs/javafx-mx.jar b/JavaApp/libs/javafx-mx.jar deleted file mode 100644 index a5f42496..00000000 Binary files a/JavaApp/libs/javafx-mx.jar and /dev/null differ diff --git a/JavaApp/libs/jfxrt.jar b/JavaApp/libs/jfxrt.jar deleted file mode 100644 index 255a7974..00000000 Binary files a/JavaApp/libs/jfxrt.jar and /dev/null differ diff --git a/JavaApp/libs/jfxswt.jar b/JavaApp/libs/jfxswt.jar deleted file mode 100644 index 12c65dea..00000000 Binary files a/JavaApp/libs/jfxswt.jar and /dev/null differ diff --git a/JavaApp/libs/jsr305.jar b/JavaApp/libs/jsr305.jar deleted file mode 100644 index cf5f5616..00000000 Binary files a/JavaApp/libs/jsr305.jar and /dev/null differ diff --git a/JavaApp/libs/sfntly-1.0.0.jar b/JavaApp/libs/sfntly-1.0.0.jar deleted file mode 100644 index 656b6644..00000000 Binary files a/JavaApp/libs/sfntly-1.0.0.jar and /dev/null differ diff --git a/JavaApp/src/main/java/net/kdt/pojavlaunch/PLaunchApp.java b/JavaApp/src/main/java/net/kdt/pojavlaunch/PLaunchApp.java index 650224ee..bf25c67b 100644 --- a/JavaApp/src/main/java/net/kdt/pojavlaunch/PLaunchApp.java +++ b/JavaApp/src/main/java/net/kdt/pojavlaunch/PLaunchApp.java @@ -46,9 +46,10 @@ public class PLaunchApp { public static void installMinecraft() { new Thread(() -> { - int currProgress, totalProgress; + int currProgress = 0; + float totalProgress = 0; - UIKit.updateProgressSafe(currProgress, "Finding a version"); + UIKit.updateProgressSafe(0, "Finding a version"); String mcver = "1.16.5"; try { @@ -57,7 +58,7 @@ public class PLaunchApp { UIKit.updateProgressSafe(currProgress, "config_ver.txt not found, defaulting to Minecraft 1.16.5"); } - UIKit.updateProgressSafe(currProgress, "Selected Minecraft version: " + mcver); + UIKit.updateProgressSafe(0, "Selected Minecraft version: " + mcver); Thread.sleep(1000); @@ -74,12 +75,12 @@ public class PLaunchApp { String minecraftMainJar = Tools.DIR_HOME_VERSION + downVName + ".jar"; String verJsonDir = Tools.DIR_HOME_VERSION + downVName + ".json"; - UIKit.updateProgressSafe(currProgress, "Downloading version list"); + UIKit.updateProgressSafe(0, "Downloading version list"); mVersionList = Tools.GLOBAL_GSON.fromJson(DownloadUtils.downloadString("https://launchermeta.mojang.com/mc/game/version_manifest.json"), JMinecraftVersionList.class); verInfo = findVersion(mcver); if (verInfo.url != null && !new File(verJsonDir).exists()) { - UIKit.updateProgressSafe(currProgress, "Downloading " + mcver + ".json"); + UIKit.updateProgressSafe(0, "Downloading " + mcver + ".json"); Tools.downloadFile(verInfo.url, verJsonDir); } @@ -94,7 +95,8 @@ public class PLaunchApp { libItem.name.startsWith("net.java.jinput") || libItem.name.startsWith("org.lwjgl") ) { // Black list - UIKit.updateProgressSafe(currProgress++, "Ignored " + libItem.name); + currProgress++; + UIKit.updateProgressSafe(currProgress / maxProgress, "Ignored " + libItem.name); // Thread.sleep(100); } else { String[] libInfo = libItem.name.split(":"); @@ -103,7 +105,8 @@ public class PLaunchApp { outLib.getParentFile().mkdirs(); if (!outLib.exists()) { - UIKit.updateProgressSafe(currProgress++, "Downloading " + libItem.name); + currProgress++; + UIKit.updateProgressSafe(currProgress / maxProgress, "Downloading " + libItem.name); boolean skipIfFailed = false; @@ -119,13 +122,14 @@ public class PLaunchApp { Tools.downloadFile(libPathURL, outLib.getAbsolutePath()); } catch (Throwable th) { th.printStackTrace(); - UIKit.updateProgressSafe(0, "Download failed"); + UIKit.updateProgressSafe(currProgress / maxProgress, "Download failed"); } } } } - UIKit.updateProgressSafe(currProgress++, "Downloading " + mcver + ".jar"); + currProgress++; + UIKit.updateProgressSafe(currProgress / maxProgress, "Downloading " + mcver + ".jar"); File minecraftMainFile = new File(minecraftMainJar); if (!minecraftMainFile.exists() || minecraftMainFile.length() == 0l) { Tools.downloadFile(verInfo.downloads.values().toArray(new MinecraftClientInfo[0])[0].url, minecraftMainJar); @@ -134,7 +138,7 @@ public class PLaunchApp { // TODO download assets } catch (IOException e) { - UIKit.updateProgressSafe(currProgress, "Download error, skipping"); + UIKit.updateProgressSafe(currProgress / maxProgress, "Download error, skipping"); e.printStackTrace(); } diff --git a/JavaApp/src/main/java/net/kdt/pojavlaunch/PLaunchJFXApp.java b/JavaApp/src/main/java/net/kdt/pojavlaunch/PLaunchJFXApp.java.z similarity index 100% rename from JavaApp/src/main/java/net/kdt/pojavlaunch/PLaunchJFXApp.java rename to JavaApp/src/main/java/net/kdt/pojavlaunch/PLaunchJFXApp.java.z diff --git a/JavaApp/src/main/java/net/kdt/pojavlaunch/uikit/UIKit.java b/JavaApp/src/main/java/net/kdt/pojavlaunch/uikit/UIKit.java index a5367c0c..16ec4aae 100644 --- a/JavaApp/src/main/java/net/kdt/pojavlaunch/uikit/UIKit.java +++ b/JavaApp/src/main/java/net/kdt/pojavlaunch/uikit/UIKit.java @@ -45,10 +45,10 @@ public class UIKit { CallbackBridge.sendCursorPos(CallbackBridge.mouseX, CallbackBridge.mouseY); } - public static void updateProgressSafe(final int percent, final String message) { + public static void updateProgressSafe(final float progress, final String message) { System.out.println(message); runOnUIThread(() -> { - updateProgress(percent, message); + updateProgress(progress, ((int) progress)*100 + "% - " + message); }); } @@ -60,7 +60,7 @@ public class UIKit { public static native void runOnUIThread(UIKitCallback callback); // Update progress - public static native void updateProgress(int percent, String message); + public static native void updateProgress(float progress, String message); // Start SurfaceViewController public static native void launchMinecraftSurface(); diff --git a/Natives/input_bridge_v3.c b/Natives/input_bridge_v3.c index 3e5f68c1..ca5327ba 100644 --- a/Natives/input_bridge_v3.c +++ b/Natives/input_bridge_v3.c @@ -219,9 +219,9 @@ void callback_SurfaceViewController_onTouch(int event, int x, int y) { ); } -JNIEXPORT void JNICALL Java_net_kdt_pojavlaunch_uikit_UIKit_updateProgress(JNIEnv* env, jclass clazz, jint percent, jstring message) { +JNIEXPORT void JNICALL Java_net_kdt_pojavlaunch_uikit_UIKit_updateProgress(JNIEnv* env, jclass clazz, jfloat progress, jstring message) { const char *message_c = (*env)->GetStringUTFChars(env, message, 0); - UIKit_updateProgress((float) percent / 100.0, message_c); + UIKit_updateProgress(progress, message_c); (*env)->ReleaseStringUTFChars(env, message, message_c); }