fix application directory

This commit is contained in:
qimiko committed 2022-05-27 21:20:07 -07:00
1 parent 332069bc92
commit 3cba74c4bc
8 files changed
+136 -1

No files matched your search

@@ -61,6 +61,15 @@ class GeometryDashActivity : ComponentActivity(), Cocos2dxHelper.Cocos2dxHelperL
e.printStackTrace()
}
try {
// fixes bugs specific to the new app directory, such as package name
LauncherFix.loadLibrary()
LauncherFix.setOriginalDataPath(GJConstants.GJ_DATA_DIR)
LauncherFix.setDataPath(filesDir.path)
} catch (e: UnsatisfiedLinkError) {
e.printStackTrace()
}
System.load("$gdNativeLibraryPath/lib${GJConstants.FMOD_LIB_NAME}.so")
System.load("$gdNativeLibraryPath/lib${GJConstants.COCOS_LIB_NAME}.so")
@@ -0,0 +1,13 @@
package dev.xyze.geodelauncher
import dev.xyze.geodelauncher.utils.GJConstants
object LauncherFix {
fun loadLibrary() {
System.loadLibrary(GJConstants.LAUNCHER_FIX_LIB_NAME)
}
external fun setDataPath(dataPath: String);
external fun setOriginalDataPath(dataPath: String);
}
@@ -6,4 +6,8 @@ object GJConstants {
const val COCOS_LIB_NAME = "cocos2dcpp"
const val FMOD_LIB_NAME = "fmod"
const val MOD_CORE_LIB_NAME = "geode"
const val LAUNCHER_FIX_LIB_NAME = "launcherfix"
// this value is hardcoded into GD
const val GJ_DATA_DIR = "/data/data/${PACKAGE_NAME}"
}
@@ -14,6 +14,7 @@ import java.util.*
import kotlin.math.abs
import kotlin.math.ceil
@Suppress("KotlinJniMissingFunction")
object Cocos2dxBitmap {
private lateinit var sContext: WeakReference<Context>
@@ -4,7 +4,7 @@ import android.opengl.GLSurfaceView
import javax.microedition.khronos.egl.EGLConfig
import javax.microedition.khronos.opengles.GL10
@Suppress("unused")
@Suppress("unused", "KotlinJniMissingFunction")
class Cocos2dxRenderer : GLSurfaceView.Renderer {
companion object {
@JvmStatic