forked from geode-sdk/android-launcher
remove unneeded classpath messing
This commit is contained in:
2 files changed
+2
-44
No files matched your search
@@ -3,47 +3,8 @@ package com.robtopx.geometryjump
|
|||||||
import android.content.pm.PackageInfo
|
import android.content.pm.PackageInfo
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.content.res.AssetManager
|
import android.content.res.AssetManager
|
||||||
import dalvik.system.BaseDexClassLoader
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
object LaunchUtils {
|
object LaunchUtils {
|
||||||
@Suppress("UNCHECKED_CAST")
|
|
||||||
fun addDirectoryToClassPath(directory: String, classLoader: ClassLoader) {
|
|
||||||
// uses code from zhuowei/MCPELauncher
|
|
||||||
try {
|
|
||||||
val clazz = classLoader.javaClass
|
|
||||||
val plField = clazz.superclass.getDeclaredField("pathList")
|
|
||||||
plField.isAccessible = true
|
|
||||||
|
|
||||||
val pathListInst = plField.get(classLoader)
|
|
||||||
val pathListClazz = pathListInst.javaClass
|
|
||||||
val nldField = pathListClazz.getDeclaredField("nativeLibraryDirectories")
|
|
||||||
nldField.isAccessible = true
|
|
||||||
|
|
||||||
val pathList = nldField.get(pathListInst)
|
|
||||||
|
|
||||||
println(pathList)
|
|
||||||
|
|
||||||
if (pathList is ArrayList<*>) {
|
|
||||||
// no safe way to check this type afaik, so casting is needed
|
|
||||||
(pathList as ArrayList<File>).add(
|
|
||||||
File(directory)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (classLoader is BaseDexClassLoader && classLoader.findLibrary(GJConstants.COCOS_LIB_NAME) == null) {
|
|
||||||
val anpMethod = pathListClazz.getDeclaredMethod("addNativePath", Collection::class.java)
|
|
||||||
|
|
||||||
anpMethod.invoke(
|
|
||||||
pathListInst,
|
|
||||||
listOf(directory)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun isGeometryDashInstalled(packageManager: PackageManager): Boolean {
|
fun isGeometryDashInstalled(packageManager: PackageManager): Boolean {
|
||||||
return try {
|
return try {
|
||||||
packageManager.getPackageInfo(GJConstants.PACKAGE_NAME, 0)
|
packageManager.getPackageInfo(GJConstants.PACKAGE_NAME, 0)
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import com.customRobTop.BaseRobTopActivity
|
|||||||
import com.customRobTop.JniToCpp
|
import com.customRobTop.JniToCpp
|
||||||
import com.robtopx.geometryjump.GJConstants
|
import com.robtopx.geometryjump.GJConstants
|
||||||
import com.robtopx.geometryjump.LaunchUtils
|
import com.robtopx.geometryjump.LaunchUtils
|
||||||
import dev.xyze.geodelauncher.ui.theme.GeodeLauncherTheme
|
|
||||||
import org.cocos2dx.lib.Cocos2dxEditText
|
import org.cocos2dx.lib.Cocos2dxEditText
|
||||||
import org.cocos2dx.lib.Cocos2dxGLSurfaceView
|
import org.cocos2dx.lib.Cocos2dxGLSurfaceView
|
||||||
import org.cocos2dx.lib.Cocos2dxHelper
|
import org.cocos2dx.lib.Cocos2dxHelper
|
||||||
@@ -51,10 +50,8 @@ class GeometryDashActivity : ComponentActivity(), Cocos2dxHelper.Cocos2dxHelperL
|
|||||||
|
|
||||||
LaunchUtils.addAssetsFromPackage(assets, gdPackageInfo)
|
LaunchUtils.addAssetsFromPackage(assets, gdPackageInfo)
|
||||||
|
|
||||||
LaunchUtils.addDirectoryToClassPath(gdNativeLibraryPath, classLoader)
|
System.load("$gdNativeLibraryPath/lib${GJConstants.FMOD_LIB_NAME}.so")
|
||||||
|
System.load("$gdNativeLibraryPath/lib${GJConstants.COCOS_LIB_NAME}.so")
|
||||||
System.loadLibrary(GJConstants.FMOD_LIB_NAME)
|
|
||||||
System.loadLibrary(GJConstants.COCOS_LIB_NAME)
|
|
||||||
|
|
||||||
val loadSuccess = try {
|
val loadSuccess = try {
|
||||||
System.loadLibrary(GJConstants.MOD_CORE_LIB_NAME)
|
System.loadLibrary(GJConstants.MOD_CORE_LIB_NAME)
|
||||||
|
|||||||
Reference in new issue
Block a user