add the logcat writer

This commit is contained in:
altalk23 committed 2023-10-15 16:43:05 +03:00
1 parent e34bfc50a2
commit 92228933b0
4 files changed
+31 -1

No files matched your search

+1
View File
@@ -11,6 +11,7 @@
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-feature
android:name="android.hardware.wifi"
@@ -134,7 +134,10 @@ class GeometryDashActivity : AppCompatActivity(), Cocos2dxHelper.Cocos2dxHelperL
// just gonna like copy the binary from external
// also i get 20 million permission denied errors
getExternalFilesDir(null)?.let { dir ->
val externalGeodePath = File(dir.path, "Geode.so")
val externalGeodePath = LaunchUtils.getInstalledGeodePath(this)
if (externalGeodePath == null) {
return false
}
val copiedPath = File(filesDir.path, "copied")
if (copiedPath.exists()) {
@@ -70,6 +70,27 @@ object GeodeUtils {
}
}
@JvmStatic
fun writeLogcatCrashBuffer(path: String): Boolean {
try {
val logcatProcess = Runtime.getRuntime().exec("logcat -v brief -b crash -d")
val logcatFile = File(path)
logcatFile.outputStream().use { output ->
logcatProcess.inputStream.use { input ->
input.copyTo(output)
}
}
return true
}
catch (e: Exception) {
Log.e("Geode", "Failed to write logcat crash buffer", e)
return false
}
}
@JvmStatic
fun writeClipboard(text: String) {
activity.get()?.run {
@@ -23,6 +23,11 @@ object LaunchUtils {
return internalGeodePath
}
context.getExternalFilesDir(null)?.let { dir->
val updateGeodePath = File(dir.path, "game/geode/update/Geode.so")
if (updateGeodePath.exists()) {
return updateGeodePath
}
val externalGeodePath = File(dir.path, "Geode.so")
if (externalGeodePath.exists()) {
return externalGeodePath