PojavCore is now inside the main executable

This took so long since there was a failed attempt in unloading and
reloading JVM to support Forge 1.17.x. Next attempt would be rewrite
everything to Objective-C and move the JVM entry point to the start of
the game.
This commit is contained in:
Duy Tran Khanh committed 2021-10-01 11:14:05 +07:00
1 parent 7fb5b55d8b
commit 4f59e0ffff
18 files changed
+45 -76

No files matched your search

@@ -30,21 +30,18 @@ public class PLaunchApp {
new File(Tools.DIR_ACCOUNT_NEW).mkdirs();
if (!new File(mcDir.getAbsolutePath() + "/launcher_profiles.json").exists()) {
Tools.write(mcDir.getAbsolutePath() + "/launcher_profiles.json",
Tools.read(Tools.DIR_DATA + "/launcher_profiles.json"));
Tools.read(Tools.DIR_BUNDLE + "/launcher_profiles.json"));
}
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("We are on java now! Starting UI...");
UIKit.launchUI(args);
UIKit.launchUI();
}
// Called from SurfaceViewController
public static void launchMinecraft() {
System.out.println("Saving GLES context");
JREUtils.saveGLContext();
System.out.println("Launching Minecraft " + mVersion.id);
try {
Tools.launchMinecraft(AccountJNI.CURRENT_ACCOUNT, mVersion);
@@ -47,16 +47,16 @@ public final class Tools
{
public static final boolean ENABLE_DEV_FEATURES = true; // BuildConfig.DEBUG;
public static String APP_NAME = "null";
public static String APP_NAME = "PojavLauncher";
public static final Gson GLOBAL_GSON = new GsonBuilder().setPrettyPrinting().create();
public static final String URL_HOME = "https://pojavlauncherteam.github.io/PojavLauncher";
public static String DIR_DATA = System.getenv("BUNDLE_PATH");
public static String DIR_BUNDLE = System.getenv("BUNDLE_PATH"); // path to "PojavLauncher.app"
public static String CURRENT_ARCHITECTURE;
public static final String DIR_GAME_HOME = System.getenv("POJAV_HOME");
public static final String DIR_GAME_NEW = System.getenv("POJAV_GAME_DIR");
public static final String DIR_GAME_NEW = System.getenv("POJAV_GAME_DIR"); // path to "Library/Application Support/minecraft"
public static final String DIR_APP_DATA = System.getenv("POJAV_HOME");
public static final String DIR_ACCOUNT_NEW = DIR_APP_DATA + "/accounts";
@@ -151,12 +151,12 @@ public class UIKit {
}
static {
System.load(System.getenv("BUNDLE_PATH") + "/Frameworks/PojavCore.framework/PojavCore");
System.load(System.getenv("BUNDLE_PATH") + "/PojavLauncher");
}
public static native void refreshAWTBuffer(int[] array);
public static native int launchUI(String[] uiArgs);
public static native int launchUI();
// public static native void runOnUIThread(UIKitCallback callback);
public static native void showError(String title, String message, boolean exitIfOk);
@@ -15,9 +15,8 @@ public class JREUtils
{
private JREUtils() {}
public static native void saveGLContext();
static {
System.load(System.getenv("BUNDLE_PATH") + "/Frameworks/PojavCore.framework/PojavCore");
System.load(System.getenv("BUNDLE_PATH") + "/PojavLauncher");
}
}
@@ -43,15 +43,16 @@ public class MinecraftAccount
}
return acc;
}
/*
public static void clearTempAccount() {
File tempAccFile = new File(Tools.DIR_DATA, "cache/tempacc.json");
File tempAccFile = new File(Tools.DIR_BUNDLE, "cache/tempacc.json");
tempAccFile.delete();
}
public static void saveTempAccount(MinecraftAccount acc) throws IOException {
File tempAccFile = new File(Tools.DIR_DATA, "cache/tempacc.json");
tempAccFile.delete();
acc.save(tempAccFile.getAbsolutePath());
}
*/
}
@@ -35,7 +35,7 @@ public class CallbackBridge {
// TODO send grab state event to Android
static {
System.load(System.getenv("BUNDLE_PATH") + "/Frameworks/PojavCore.framework/PojavCore");
System.load(System.getenv("BUNDLE_PATH") + "/PojavLauncher");
INPUT_DEBUG_ENABLED = Boolean.parseBoolean(System.getProperty("glfwstub.debugInput", "false"));
}
@@ -501,7 +501,7 @@ public class GLFW
public static long mainContext = 0;
static {
try {
System.load(System.getenv("BUNDLE_PATH") + "/Frameworks/PojavCore.framework/PojavCore");
System.load(System.getenv("BUNDLE_PATH") + "/PojavLauncher");
} catch (UnsatisfiedLinkError e) {
e.printStackTrace();
}