From e469948c4d474b252c8e9099cac6dcacffc516e8 Mon Sep 17 00:00:00 2001 From: qimiko <25387744+qimiko@users.noreply.github.com> Date: Thu, 18 Jan 2024 13:52:00 -0700 Subject: [PATCH] hi mat --- .../geode/launcher/GeometryDashActivity.kt | 4 ++-- .../java/com/geode/launcher/api/Release.kt | 4 +--- .../com/geode/launcher/utils/LaunchUtils.kt | 20 +++++++++---------- .../geode/launcher/utils/ReleaseManager.kt | 2 +- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/com/geode/launcher/GeometryDashActivity.kt b/app/src/main/java/com/geode/launcher/GeometryDashActivity.kt index 4caf27ab..f75faed9 100644 --- a/app/src/main/java/com/geode/launcher/GeometryDashActivity.kt +++ b/app/src/main/java/com/geode/launcher/GeometryDashActivity.kt @@ -129,7 +129,7 @@ class GeometryDashActivity : AppCompatActivity(), Cocos2dxHelper.Cocos2dxHelperL // might be split apks, select the best path for the library val sourceDirs = applicationInfo.splitSourceDirs - val architecture = LaunchUtils.getApplicationArchitecture() + val architecture = LaunchUtils.applicationArchitecture if (!sourceDirs.isNullOrEmpty()) { val configAbi = architecture.replace("-", "_") @@ -156,7 +156,7 @@ class GeometryDashActivity : AppCompatActivity(), Cocos2dxHelper.Cocos2dxHelperL return true } catch (e: UnsatisfiedLinkError) { // but users may prefer it stored with data - val geodeFilename = LaunchUtils.getGeodeFilename() + val geodeFilename = LaunchUtils.geodeFilename val geodePath = File(filesDir.path, "launcher/$geodeFilename") if (geodePath.exists()) { System.load(geodePath.path) diff --git a/app/src/main/java/com/geode/launcher/api/Release.kt b/app/src/main/java/com/geode/launcher/api/Release.kt index ba41b2b1..ae6d14d5 100644 --- a/app/src/main/java/com/geode/launcher/api/Release.kt +++ b/app/src/main/java/com/geode/launcher/api/Release.kt @@ -44,9 +44,7 @@ class Release( fun getAndroidDownload(): Asset? { // try to find an asset that matches the architecture first - val architecture = LaunchUtils.getApplicationArchitecture() - val platform = if (architecture == "arm64-v8a") - "android64" else "android32" + val platform = LaunchUtils.platformName val releaseSuffix = "$platform.zip" return assets.find { diff --git a/app/src/main/java/com/geode/launcher/utils/LaunchUtils.kt b/app/src/main/java/com/geode/launcher/utils/LaunchUtils.kt index 0ebad8f6..f255d18e 100644 --- a/app/src/main/java/com/geode/launcher/utils/LaunchUtils.kt +++ b/app/src/main/java/com/geode/launcher/utils/LaunchUtils.kt @@ -33,20 +33,18 @@ object LaunchUtils { return game.versionName } - fun getApplicationArchitecture(): String { - // 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 - @Suppress("DEPRECATION") - return Build.CPU_ABI - } + // 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 + @Suppress("DEPRECATION") + val applicationArchitecture: String = Build.CPU_ABI - fun getGeodeFilename(): String { - val abi = getApplicationArchitecture() - return "Geode.$abi.so" - } + val platformName: String = if (applicationArchitecture == "arm64-v8a") + "android64" else "android32" + + val geodeFilename: String = "Geode.$platformName.so" fun getInstalledGeodePath(context: Context): File? { - val geodeName = getGeodeFilename() + val geodeName = geodeFilename val internalGeodePath = File(context.filesDir, "launcher/$geodeName") if (internalGeodePath.exists()) { diff --git a/app/src/main/java/com/geode/launcher/utils/ReleaseManager.kt b/app/src/main/java/com/geode/launcher/utils/ReleaseManager.kt index 4dd9f062..114bf10e 100644 --- a/app/src/main/java/com/geode/launcher/utils/ReleaseManager.kt +++ b/app/src/main/java/com/geode/launcher/utils/ReleaseManager.kt @@ -211,7 +211,7 @@ class ReleaseManager private constructor( } private fun getGeodeOutputPath(): File { - val geodeName = LaunchUtils.getGeodeFilename() + val geodeName = LaunchUtils.geodeFilename val geodeDirectory = LaunchUtils.getBaseDirectory(applicationContext) return File(geodeDirectory, geodeName)