This commit is contained in:
qimiko committed 2024-01-18 13:52:00 -07:00
1 parent 53d19aaf16
commit e469948c4d
4 files changed
+10 -14

No files matched your search

@@ -129,7 +129,7 @@ class GeometryDashActivity : AppCompatActivity(), Cocos2dxHelper.Cocos2dxHelperL
// might be split apks, select the best path for the library // might be split apks, select the best path for the library
val sourceDirs = applicationInfo.splitSourceDirs val sourceDirs = applicationInfo.splitSourceDirs
val architecture = LaunchUtils.getApplicationArchitecture() val architecture = LaunchUtils.applicationArchitecture
if (!sourceDirs.isNullOrEmpty()) { if (!sourceDirs.isNullOrEmpty()) {
val configAbi = architecture.replace("-", "_") val configAbi = architecture.replace("-", "_")
@@ -156,7 +156,7 @@ class GeometryDashActivity : AppCompatActivity(), Cocos2dxHelper.Cocos2dxHelperL
return true return true
} catch (e: UnsatisfiedLinkError) { } catch (e: UnsatisfiedLinkError) {
// but users may prefer it stored with data // but users may prefer it stored with data
val geodeFilename = LaunchUtils.getGeodeFilename() val geodeFilename = LaunchUtils.geodeFilename
val geodePath = File(filesDir.path, "launcher/$geodeFilename") val geodePath = File(filesDir.path, "launcher/$geodeFilename")
if (geodePath.exists()) { if (geodePath.exists()) {
System.load(geodePath.path) System.load(geodePath.path)
@@ -44,9 +44,7 @@ class Release(
fun getAndroidDownload(): Asset? { fun getAndroidDownload(): Asset? {
// try to find an asset that matches the architecture first // try to find an asset that matches the architecture first
val architecture = LaunchUtils.getApplicationArchitecture() val platform = LaunchUtils.platformName
val platform = if (architecture == "arm64-v8a")
"android64" else "android32"
val releaseSuffix = "$platform.zip" val releaseSuffix = "$platform.zip"
return assets.find { return assets.find {
@@ -33,20 +33,18 @@ object LaunchUtils {
return game.versionName return game.versionName
} }
fun getApplicationArchitecture(): String {
// supposedly CPU_ABI returns the current arch for the running application // supposedly CPU_ABI returns the current arch for the running application
// despite being deprecated, this is also one of the few ways to get this information // despite being deprecated, this is also one of the few ways to get this information
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
return Build.CPU_ABI val applicationArchitecture: String = Build.CPU_ABI
}
fun getGeodeFilename(): String { val platformName: String = if (applicationArchitecture == "arm64-v8a")
val abi = getApplicationArchitecture() "android64" else "android32"
return "Geode.$abi.so"
} val geodeFilename: String = "Geode.$platformName.so"
fun getInstalledGeodePath(context: Context): File? { fun getInstalledGeodePath(context: Context): File? {
val geodeName = getGeodeFilename() val geodeName = geodeFilename
val internalGeodePath = File(context.filesDir, "launcher/$geodeName") val internalGeodePath = File(context.filesDir, "launcher/$geodeName")
if (internalGeodePath.exists()) { if (internalGeodePath.exists()) {
@@ -211,7 +211,7 @@ class ReleaseManager private constructor(
} }
private fun getGeodeOutputPath(): File { private fun getGeodeOutputPath(): File {
val geodeName = LaunchUtils.getGeodeFilename() val geodeName = LaunchUtils.geodeFilename
val geodeDirectory = LaunchUtils.getBaseDirectory(applicationContext) val geodeDirectory = LaunchUtils.getBaseDirectory(applicationContext)
return File(geodeDirectory, geodeName) return File(geodeDirectory, geodeName)