prefer packaged loader if exists

This commit is contained in:
qimiko committed 2023-09-15 13:07:36 -07:00
1 parent 6b8c1ba698
commit 38bdecc676
3 files changed
+24 -6

No files matched your search

@@ -97,6 +97,30 @@ class GeometryDashActivity : AppCompatActivity(), Cocos2dxHelper.Cocos2dxHelperL
BaseRobTopActivity.setCurrentActivity(this)
registerReceiver()
if (!loadGeodeLibrary()) {
Log.w("GeodeLauncher", "could not load Geode object!")
}
}
@SuppressLint("UnsafeDynamicallyLoadedCode")
private fun loadGeodeLibrary(): Boolean {
// Load Geode if exists
// bundling the object with the application allows for nicer backtraces
try {
// put libgeode.so in jniLibs/armeabi-v7a to get this
System.loadLibrary("geode")
return true
} catch (e: UnsatisfiedLinkError) {
// but users may prefer it stored with data
val geodePath = File(filesDir.path, "launcher/Geode.so")
if (geodePath.exists()) {
System.load(geodePath.path)
return true
}
}
return false
}
private fun createView(): FrameLayout {
@@ -1,5 +0,0 @@
package com.geode.launcher
object Native {
var isGeodeLoaded = false
}
@@ -1,7 +1,6 @@
package org.cocos2dx.lib
import android.opengl.GLSurfaceView
import com.geode.launcher.Native
import javax.microedition.khronos.egl.EGLConfig
import javax.microedition.khronos.opengles.GL10