mirror of
https://github.com/geode-sdk/android-launcher.git
synced 2026-10-21 08:19:33 +00:00
make geode load failures a hard error
This commit is contained in:
4 files changed
+37
-16
No files matched your search
@@ -136,8 +136,25 @@ class GeometryDashActivity : AppCompatActivity(), Cocos2dxHelper.Cocos2dxHelperL
|
||||
|
||||
setupPostLibraryLoad(gdPackageInfo)
|
||||
|
||||
if (!loadGeodeLibrary()) {
|
||||
try {
|
||||
loadGeodeLibrary()
|
||||
} catch (e: UnsatisfiedLinkError) {
|
||||
handleGeodeException(e)
|
||||
} catch (e: Exception) {
|
||||
handleGeodeException(e)
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleGeodeException(e: Throwable) {
|
||||
e.printStackTrace()
|
||||
|
||||
val ignoreFailure = PreferenceUtils.get(this)
|
||||
.getBoolean(PreferenceUtils.Key.IGNORE_LOAD_FAILURE)
|
||||
|
||||
if (ignoreFailure) {
|
||||
Log.w("GeodeLauncher", "could not load Geode object!")
|
||||
} else {
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,26 +226,26 @@ class GeometryDashActivity : AppCompatActivity(), Cocos2dxHelper.Cocos2dxHelperL
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeDynamicallyLoadedCode")
|
||||
private fun loadGeodeLibrary(): Boolean {
|
||||
private fun loadGeodeLibrary() {
|
||||
// Load Geode if exists
|
||||
// bundling the object with the application allows for nicer backtraces
|
||||
try {
|
||||
// put libgeode.so in jniLibs/armeabi-v7a to get this
|
||||
System.loadLibrary("geode")
|
||||
return true
|
||||
return
|
||||
} catch (e: UnsatisfiedLinkError) {
|
||||
// but users may prefer it stored with data
|
||||
val geodeFilename = LaunchUtils.geodeFilename
|
||||
val geodePath = File(filesDir.path, "launcher/$geodeFilename")
|
||||
if (geodePath.exists()) {
|
||||
System.load(geodePath.path)
|
||||
return true
|
||||
return
|
||||
}
|
||||
|
||||
// you know zmx i have 0 clue what this does so im
|
||||
// just gonna like copy the binary from external
|
||||
// also i get 20 million permission denied errors
|
||||
val externalGeodePath = LaunchUtils.getInstalledGeodePath(this) ?: return false
|
||||
val externalGeodePath = LaunchUtils.getInstalledGeodePath(this)!!
|
||||
|
||||
val copiedPath = File(filesDir.path, "copied")
|
||||
if (copiedPath.exists()) {
|
||||
@@ -245,17 +262,14 @@ class GeometryDashActivity : AppCompatActivity(), Cocos2dxHelper.Cocos2dxHelperL
|
||||
)
|
||||
|
||||
if (copiedGeodePath.exists()) {
|
||||
try {
|
||||
println("Loading Geode from ${externalGeodePath.name}")
|
||||
System.load(copiedGeodePath.path)
|
||||
} catch (e: UnsatisfiedLinkError) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
println("Loading Geode from ${externalGeodePath.name}")
|
||||
System.load(copiedGeodePath.path)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
private fun createView(): FrameLayout {
|
||||
|
||||
@@ -368,6 +368,10 @@ fun SettingsScreen(
|
||||
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*(){}<>[]?:;'\"~`-_+=\\| ".contains(c)
|
||||
}}
|
||||
)
|
||||
SettingsCard(
|
||||
title = stringResource(R.string.preference_ignore_load_failure_name),
|
||||
preferenceKey = PreferenceUtils.Key.IGNORE_LOAD_FAILURE,
|
||||
)
|
||||
OptionsButton(
|
||||
title = context.getString(R.string.preferences_copy_external_button),
|
||||
description = LaunchUtils.getBaseDirectory(context).path,
|
||||
|
||||
@@ -134,7 +134,8 @@ class PreferenceUtils(private val sharedPreferences: SharedPreferences) {
|
||||
CURRENT_RELEASE_MODIFIED,
|
||||
LAST_DISMISSED_UPDATE,
|
||||
DISMISSED_GJ_UPDATE,
|
||||
LAUNCH_ARGUMENTS
|
||||
LAUNCH_ARGUMENTS,
|
||||
IGNORE_LOAD_FAILURE
|
||||
}
|
||||
|
||||
private fun defaultValueForBooleanKey(key: Key): Boolean {
|
||||
@@ -159,6 +160,7 @@ class PreferenceUtils(private val sharedPreferences: SharedPreferences) {
|
||||
Key.LAST_DISMISSED_UPDATE -> "PreferenceLastDismissedUpdate"
|
||||
Key.DISMISSED_GJ_UPDATE -> "PreferenceDismissedGJUpdate"
|
||||
Key.LAUNCH_ARGUMENTS -> "PreferenceLaunchArguments"
|
||||
Key.IGNORE_LOAD_FAILURE -> "PreferenceIgnoreLoadFailure"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,11 +46,11 @@
|
||||
|
||||
<!-- GeometryDashActivity strings -->
|
||||
<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.\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 or version 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_need_64bit_description">The architecture of the launcher and Geometry Dash do not match. Please reinstall Geometry Dash from the Play Store or use the 64-bit version of the launcher to resolve this issue.\nCheck application logs for more details.</string>
|
||||
<string name="load_failed_abi_error_need_32bit_description">The architecture of the launcher and Geometry Dash do not match. Please reinstall Geometry Dash from the Play Store or use the 32-bit 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_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.</string>
|
||||
<string name="message_box_cancel">Cancel</string>
|
||||
<string name="message_box_accept">OK</string>
|
||||
|
||||
@@ -93,6 +93,7 @@
|
||||
<string name="preference_category_developer">Developer</string>
|
||||
<string name="preference_launch_arguments_name">Launch arguments</string>
|
||||
<string name="preference_launch_arguments_set_title">Set launch arguments</string>
|
||||
<string name="preference_ignore_load_failure_name">Ignore loader errors</string>
|
||||
|
||||
<!-- ApplicationLogsActivity strings -->
|
||||
<string name="title_activity_application_logs">Application Logs</string>
|
||||
|
||||
Reference in new issue
Block a user