mirror of
https://github.com/geode-sdk/android-launcher.git
synced 2026-10-21 16:32:39 +00:00
use specific message for abi differences
This commit is contained in:
3 files changed
+30
-21
No files matched your search
@@ -63,11 +63,14 @@ class GeometryDashActivity : AppCompatActivity(), Cocos2dxHelper.Cocos2dxHelperL
|
|||||||
|
|
||||||
// generates helpful information for use in debugging library load failures
|
// generates helpful information for use in debugging library load failures
|
||||||
val gdPackageInfo = packageManager.getPackageInfo(Constants.PACKAGE_NAME, 0)
|
val gdPackageInfo = packageManager.getPackageInfo(Constants.PACKAGE_NAME, 0)
|
||||||
val failureReason = LaunchUtils.diagnoseLoadErrors(this, gdPackageInfo)
|
val abiMismatch = LaunchUtils.detectAbiMismatch(this, gdPackageInfo, e)
|
||||||
|
|
||||||
|
val errorMessage = if (abiMismatch) getString(R.string.load_failed_abi_error_description) else
|
||||||
|
getString(R.string.load_failed_link_error_description)
|
||||||
|
|
||||||
returnToMain(
|
returnToMain(
|
||||||
getString(R.string.load_failed_link_error),
|
getString(R.string.load_failed_link_error),
|
||||||
getString(R.string.load_failed_link_error_description, failureReason.name)
|
errorMessage
|
||||||
)
|
)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -11,10 +11,6 @@ import android.util.Log
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
object LaunchUtils {
|
object LaunchUtils {
|
||||||
enum class FailureReason {
|
|
||||||
NOT_FOUND, ABI_MISMATCH, UNKNOWN
|
|
||||||
}
|
|
||||||
|
|
||||||
fun isGeometryDashInstalled(packageManager: PackageManager): Boolean {
|
fun isGeometryDashInstalled(packageManager: PackageManager): Boolean {
|
||||||
return try {
|
return try {
|
||||||
packageManager.getPackageInfo(Constants.PACKAGE_NAME, 0)
|
packageManager.getPackageInfo(Constants.PACKAGE_NAME, 0)
|
||||||
@@ -40,7 +36,7 @@ object LaunchUtils {
|
|||||||
return game.versionName
|
return game.versionName
|
||||||
}
|
}
|
||||||
|
|
||||||
fun diagnoseLoadErrors(context: Context, packageInfo: PackageInfo): FailureReason {
|
fun detectAbiMismatch(context: Context, packageInfo: PackageInfo, loadException: Error): Boolean {
|
||||||
val abi = applicationArchitecture
|
val abi = applicationArchitecture
|
||||||
val isExtracted =
|
val isExtracted =
|
||||||
packageInfo.applicationInfo.flags and ApplicationInfo.FLAG_EXTRACT_NATIVE_LIBS == ApplicationInfo.FLAG_EXTRACT_NATIVE_LIBS
|
packageInfo.applicationInfo.flags and ApplicationInfo.FLAG_EXTRACT_NATIVE_LIBS == ApplicationInfo.FLAG_EXTRACT_NATIVE_LIBS
|
||||||
@@ -50,33 +46,42 @@ object LaunchUtils {
|
|||||||
"Geometry Dash metadata:\nSplit sources: $isSplit\nExtracted libraries: $isExtracted\nLauncher architecture: $abi"
|
"Geometry Dash metadata:\nSplit sources: $isSplit\nExtracted libraries: $isExtracted\nLauncher architecture: $abi"
|
||||||
Log.i("GeodeLauncher", metadata)
|
Log.i("GeodeLauncher", metadata)
|
||||||
|
|
||||||
|
// easiest check! these messages are hardcoded in bionic/linker/linker_phdr.cpp
|
||||||
|
if (loadException.message?.contains("32-bit instead of 64-bit") == true) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (loadException.message?.contains("64-bit instead of 32-bit") == true) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
// determine if it can find gd libraries for the opposite architecture
|
// determine if it can find gd libraries for the opposite architecture
|
||||||
val gdBinaryName = "lib${Constants.COCOS_LIB_NAME}.so"
|
val gdBinaryName = "lib${Constants.COCOS_LIB_NAME}.so"
|
||||||
val oppositeArchitecture = if (abi == "arm64-v8a") "armeabi-v7a" else "arm64-v8a"
|
val oppositeArchitecture = if (abi == "arm64-v8a") "armeabi-v7a" else "arm64-v8a"
|
||||||
|
|
||||||
if (packageInfo.applicationInfo.nativeLibraryDir.contains(oppositeArchitecture)) {
|
// detect issues using native library directory (only works on extracted libraries)
|
||||||
return FailureReason.ABI_MISMATCH
|
val nativeLibraryDir = packageInfo.applicationInfo.nativeLibraryDir
|
||||||
|
|
||||||
|
if (nativeLibraryDir.contains(oppositeArchitecture)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// android has some odd behavior where 32bit libraries get installed to the arm directory instead of armeabi-v7a
|
||||||
|
// detect it, ig
|
||||||
|
if (oppositeArchitecture == "armeabi-v7a" && nativeLibraryDir.contains("/lib/arm/")) {
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isExtracted) {
|
if (!isExtracted) {
|
||||||
try {
|
try {
|
||||||
context.assets.openNonAssetFd("lib/$oppositeArchitecture/$gdBinaryName")
|
context.assets.openNonAssetFd("lib/$oppositeArchitecture/$gdBinaryName")
|
||||||
return FailureReason.ABI_MISMATCH
|
return true
|
||||||
} catch (_: Exception) {
|
} catch (_: Exception) {
|
||||||
// this is good, actually!
|
// this is good, actually!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// try fetching for its own libraries (only for uncompressed libraries)
|
return false
|
||||||
if (!isExtracted) {
|
|
||||||
try {
|
|
||||||
context.assets.openNonAssetFd("lib/$abi/$gdBinaryName")
|
|
||||||
} catch (_: Exception) {
|
|
||||||
return FailureReason.NOT_FOUND
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return FailureReason.UNKNOWN
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// supposedly CPU_ABI returns the current arch for the running application
|
// supposedly CPU_ABI returns the current arch for the running application
|
||||||
|
|||||||
@@ -41,7 +41,8 @@
|
|||||||
|
|
||||||
<!-- GeometryDashActivity strings -->
|
<!-- GeometryDashActivity strings -->
|
||||||
<string name="load_failed_link_error">Failed to link libraries</string>
|
<string name="load_failed_link_error">Failed to link libraries</string>
|
||||||
<string name="load_failed_link_error_description">Game libraries could not be found. This may occur if the architecture of the launcher and Geometry Dash do not match, or from a system bug.\nReported issue: %1$s.\nCheck application logs for more details.</string>
|
<string name="load_failed_link_error_description">Game libraries could not be found. This may occur if the architecture of the launcher and Geometry Dash do not match, or from a system bug.\nCheck application logs for more details.</string>
|
||||||
|
<string name="load_failed_abi_error_description">The architecture of the launcher and Geometry Dash do not match. Please reinstall Geometry Dash from the Play Store or use the \"android32\" version of the launcher to resolve this issue.\nCheck application logs for more details.</string>
|
||||||
<string name="load_failed_generic_error">Load failed</string>
|
<string name="load_failed_generic_error">Load failed</string>
|
||||||
<string name="load_failed_generic_error_description">Uncaught error during game load: `%1$s`.\nCheck application logs for more details. Please report this issue!</string>
|
<string name="load_failed_generic_error_description">Uncaught error during game load: `%1$s`.\nCheck application logs for more details. Please report this issue!</string>
|
||||||
<string name="message_box_cancel">Cancel</string>
|
<string name="message_box_cancel">Cancel</string>
|
||||||
|
|||||||
Reference in new issue
Block a user