diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 12bd493c6..033264109 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -18,13 +18,15 @@ jobs: CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + submodules: "recursive" - - name: Set up JDK 8 + - name: Set up JDK 21 uses: actions/setup-java@v3 with: distribution: 'temurin' - java-version: '8' + java-version: '21' - name: Get LTW run: | diff --git a/app_pojavlauncher/src/main/assets/components/arc_dns_injector/version b/app_pojavlauncher/src/main/assets/components/arc_dns_injector/version index 6aa0154ad..8e2803cf7 100644 --- a/app_pojavlauncher/src/main/assets/components/arc_dns_injector/version +++ b/app_pojavlauncher/src/main/assets/components/arc_dns_injector/version @@ -1 +1 @@ -1738839797928 \ No newline at end of file +30ec1e2df80972e3eb89f61f9c0894f5926594ef \ No newline at end of file diff --git a/app_pojavlauncher/src/main/assets/components/forge_installer/version b/app_pojavlauncher/src/main/assets/components/forge_installer/version index ecf82522c..bfff5b5e1 100644 --- a/app_pojavlauncher/src/main/assets/components/forge_installer/version +++ b/app_pojavlauncher/src/main/assets/components/forge_installer/version @@ -1 +1 @@ -1738839797913 \ No newline at end of file +d5fc862f0eba62565dee5b8e511544573c281ec1 \ No newline at end of file diff --git a/app_pojavlauncher/src/main/assets/components/lwjgl3/version b/app_pojavlauncher/src/main/assets/components/lwjgl3/version index 479e449c0..62dc39e8e 100644 --- a/app_pojavlauncher/src/main/assets/components/lwjgl3/version +++ b/app_pojavlauncher/src/main/assets/components/lwjgl3/version @@ -1 +1 @@ -1738839797921 \ No newline at end of file +4903cfc8d3afd63918f59caf0a146efc2d837069 \ No newline at end of file diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java index 166ec8ac3..4d44644d6 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java @@ -223,18 +223,6 @@ public class JREUtils { envMap.put("AWTSTUB_WIDTH", Integer.toString(CallbackBridge.windowWidth > 0 ? CallbackBridge.windowWidth : CallbackBridge.physicalWidth)); envMap.put("AWTSTUB_HEIGHT", Integer.toString(CallbackBridge.windowHeight > 0 ? CallbackBridge.windowHeight : CallbackBridge.physicalHeight)); - File customEnvFile = new File(Tools.DIR_GAME_HOME, "custom_env.txt"); - if (customEnvFile.exists() && customEnvFile.isFile()) { - BufferedReader reader = new BufferedReader(new FileReader(customEnvFile)); - String line; - while ((line = reader.readLine()) != null) { - // Not use split() as only split first one - int index = line.indexOf("="); - envMap.put(line.substring(0, index), line.substring(index + 1)); - } - reader.close(); - } - GLInfoUtils.GLInfo info = GLInfoUtils.getGlInfo(); if(!envMap.containsKey("LIBGL_ES") && LOCAL_RENDERER != null) { int glesMajor = info.glesMajorVersion; @@ -256,6 +244,8 @@ public class JREUtils { envMap.put("POJAV_LOAD_TURNIP", "1"); } + readCustomEnv(envMap); // Must be last so it overrides anything the user sets for obvious reasons. + for (Map.Entry env : envMap.entrySet()) { Logger.appendToLog("Added custom env: " + env.getKey() + "=" + env.getValue()); try { @@ -274,6 +264,19 @@ public class JREUtils { // return ldLibraryPath; } + private static void readCustomEnv(Map envMap) throws IOException { + File customEnvFile = new File(Tools.DIR_GAME_HOME, "custom_env.txt"); + if (customEnvFile.exists() && customEnvFile.isFile()) { + BufferedReader reader = new BufferedReader(new FileReader(customEnvFile)); + String line; + while ((line = reader.readLine()) != null) { + // Not use split() as only split first one + int index = line.indexOf("="); + envMap.put(line.substring(0, index), line.substring(index + 1)); + } + reader.close(); + } + } public static void launchJavaVM(final AppCompatActivity activity, final Runtime runtime, File gameDirectory, final List JVMArgs, final String userArgsString) throws Throwable { String runtimeHome = MultiRTUtils.getRuntimeHome(runtime.name).getAbsolutePath(); diff --git a/app_pojavlauncher/src/main/jniLibs/arm64-v8a/libOSMesa.so b/app_pojavlauncher/src/main/jniLibs/arm64-v8a/libOSMesa.so index d12470323..1b9ae13a8 100644 Binary files a/app_pojavlauncher/src/main/jniLibs/arm64-v8a/libOSMesa.so and b/app_pojavlauncher/src/main/jniLibs/arm64-v8a/libOSMesa.so differ diff --git a/app_pojavlauncher/src/main/jniLibs/armeabi-v7a/libOSMesa.so b/app_pojavlauncher/src/main/jniLibs/armeabi-v7a/libOSMesa.so index 3e61720c3..8b31a7368 100644 Binary files a/app_pojavlauncher/src/main/jniLibs/armeabi-v7a/libOSMesa.so and b/app_pojavlauncher/src/main/jniLibs/armeabi-v7a/libOSMesa.so differ diff --git a/app_pojavlauncher/src/main/jniLibs/x86_64/libOSMesa.so b/app_pojavlauncher/src/main/jniLibs/x86_64/libOSMesa.so index e197e109b..fb77bb9ac 100644 Binary files a/app_pojavlauncher/src/main/jniLibs/x86_64/libOSMesa.so and b/app_pojavlauncher/src/main/jniLibs/x86_64/libOSMesa.so differ diff --git a/arc_dns_injector/build.gradle b/arc_dns_injector/build.gradle index efb772202..ddd30f0cc 100644 --- a/arc_dns_injector/build.gradle +++ b/arc_dns_injector/build.gradle @@ -6,12 +6,15 @@ java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } + jar { manifest { attributes("Manifest-Version": "1.0", "PreMain-Class": "git.artdeell.arcdns.ArcDNSInjectorAgent") } - File versionFile = file("../app_pojavlauncher/src/main/assets/components/arc_dns_injector/version") - versionFile.write(String.valueOf(new Date().getTime())) + if (gitUsed){ + File versionFile = file("../app_pojavlauncher/src/main/assets/components/arc_dns_injector/version") + versionFile.write(getGitHash(project.name)) + } destinationDirectory.set(file("../app_pojavlauncher/src/main/assets/components/arc_dns_injector/")) } diff --git a/build.gradle b/build.gradle index 8b1378917..1fc4037a8 100644 --- a/build.gradle +++ b/build.gradle @@ -1 +1,33 @@ +import java.io.IOException +plugins{ + id 'com.android.application' version '8.7.2' apply false + id 'com.android.library' version '8.7.2' apply false +} +String getGitHash(String project) { + def command = Runtime.getRuntime().exec("git rev-list -1 HEAD " + project) + def returnCode = command.waitFor() + if (returnCode != 0) { + throw new IOException("Command 'getGitHash()' exited with " + returnCode) + } + String gitCommitHash = command.inputStream.text.trim() + return gitCommitHash +} + +Boolean gitUsed() { + def returnCode = Runtime.getRuntime().exec("git rev-parse --is-inside-work-tree").waitFor() + switch(returnCode){ + case 127: + println("git not found"); + return false; + break; + case 128: + println("not inside a git repository"); + return false; + break; + case 0: + return true; + default: + throw new IOException("Command 'gitUsed()' exited with " + returnCode) + } +} diff --git a/forge_installer/build.gradle b/forge_installer/build.gradle index 63b38621d..67f044cdc 100644 --- a/forge_installer/build.gradle +++ b/forge_installer/build.gradle @@ -15,11 +15,13 @@ jar { from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } - File versionFile = file("../app_pojavlauncher/src/main/assets/components/forge_installer/version") - versionFile.write(String.valueOf(new Date().getTime())) + if (gitUsed){ + File versionFile = file("../app_pojavlauncher/src/main/assets/components/forge_installer/version") + versionFile.write(getGitHash(project.name)) + } manifest { attributes("Manifest-Version": "1.0", "PreMain-Class": "git.artdeell.installer_agent.Agent") } destinationDirectory.set(file("../app_pojavlauncher/src/main/assets/components/forge_installer/")) -} \ No newline at end of file +} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 84410b7f7..abec028aa 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ #Fri Dec 06 21:56:04 CET 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/jre_lwjgl3glfw/build.gradle b/jre_lwjgl3glfw/build.gradle index e5183f69d..1e4dec17b 100644 --- a/jre_lwjgl3glfw/build.gradle +++ b/jre_lwjgl3glfw/build.gradle @@ -10,9 +10,10 @@ jar { duplicatesStrategy = DuplicatesStrategy.EXCLUDE archiveBaseName = "lwjgl-glfw-classes" destinationDirectory.set(file("../app_pojavlauncher/src/main/assets/components/lwjgl3/")) - // Auto update the version with a timestamp so the project jar gets updated by Pojav - File versionFile = file("../app_pojavlauncher/src/main/assets/components/lwjgl3/version") - versionFile.write(String.valueOf(new Date().getTime())) + if (gitUsed){ + File versionFile = file("../app_pojavlauncher/src/main/assets/components/lwjgl3/version") + versionFile.write(getGitHash(project.name)) + } from { configurations.default.collect { println(it.getName())