diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index ee5aff70..dcf5d331 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -35,6 +35,12 @@ jobs: cd ../.. cp Natives/build/Release-iphoneos/libpojavexec.dylib PojavLauncher.app/Frameworks/ + - name: Upload built natives + uses: actions/upload-artifact@v2 + with: + name: app + path: Natives/build/Release-iphoneos + - name: Java Build run: | cd JavaApp diff --git a/JavaApp/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java b/JavaApp/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java index ce1bf916..9b87525c 100644 --- a/JavaApp/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java +++ b/JavaApp/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java @@ -7,7 +7,7 @@ import com.oracle.dalvik.*; import java.io.*; import java.util.*; -import libcore.io.*; +// import libcore.io.*; import net.kdt.pojavlaunch.*; import net.kdt.pojavlaunch.prefs.*; @@ -22,7 +22,7 @@ public class JREUtils private static String nativeLibDir; public static String findInLdLibPath(String libName) { - for (String libPath : Libcore.os.getenv("LD_LIBRARY_PATH").split(":")) { + for (String libPath : System.getenv("LD_LIBRARY_PATH").split(":")) { File f = new File(libPath, libName); if (f.exists() && f.isFile()) { return f.getAbsolutePath(); @@ -32,6 +32,7 @@ public class JREUtils } public static void initJavaRuntime() { +/* dlopen(findInLdLibPath("libjli.dylib")); dlopen(findInLdLibPath("libjvm.dylib")); dlopen(findInLdLibPath("libverify.dylib")); @@ -43,6 +44,7 @@ public class JREUtils dlopen(findInLdLibPath("libawt_headless.dylib")); dlopen(findInLdLibPath("libfreetype.dylib")); dlopen(findInLdLibPath("libfontmanager.dylib")); +*/ dlopen(nativeLibDir + "/libopenal.dylib"); /* @@ -118,7 +120,7 @@ public class JREUtils } for (Map.Entry env : envMap.entrySet()) { - Libcore.os.setenv(env.getKey(), env.getValue(), true); + setenv(env.getKey(), env.getValue(), true); } setLdLibraryPath(LD_LIBRARY_PATH); @@ -181,6 +183,7 @@ public class JREUtils public static native void redirectLogcat(String path); public static native void setLdLibraryPath(String ldLibraryPath); public static native void saveGLContext(); + public static native void setenv(String key, String value, boolean overwrite); // Obtain AWT screen pixels to render on Android SurfaceView public static native int[] renderAWTScreenFrame(/* Object canvas, int width, int height */); diff --git a/Natives/egl_bridge.c b/Natives/egl_bridge.c index 30dddf2f..340fee16 100644 --- a/Natives/egl_bridge.c +++ b/Natives/egl_bridge.c @@ -29,6 +29,16 @@ void terminateEgl() { // clearCurrentContext(CURR_GL_CONTEXT); } +JNIEXPORT void JNICALL Java_net_kdt_pojavlaunch_utils_JREUtils_setenv(JNIEnv *env, jclass clazz, jstring name, jstring value, jboolean overwrite) { + char const *name_c = (*env)->GetStringUTFChars(env, name, NULL); + char const *value_c = (*env)->GetStringUTFChars(env, value, NULL); + + setenv(name_c, value_c, overwrite); + + (*env)->ReleaseStringUTFChars(env, name, name_c); + (*env)->ReleaseStringUTFChars(env, value, value_c); +} + JNIEXPORT void JNICALL Java_net_kdt_pojavlaunch_utils_JREUtils_saveGLContext(JNIEnv* env, jclass clazz) { CURR_GL_CONTEXT = createContext(); // getCurrentContext();