Skip to content

Commit

Permalink
hi mat
Browse files Browse the repository at this point in the history
  • Loading branch information
qimiko committed Jan 18, 2024
1 parent 53d19aa commit e469948
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/com/geode/launcher/GeometryDashActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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("-", "_")
Expand All @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions app/src/main/java/com/geode/launcher/api/Release.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
20 changes: 9 additions & 11 deletions app/src/main/java/com/geode/launcher/utils/LaunchUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e469948

Please sign in to comment.