mirror of
https://github.com/ovrport/app.git
synced 2026-10-27 03:19:56 -04:00
fix: Fix patch Fix Unreal Engine 4 crash
This commit is contained in:
1 parent
5fc0e8fef4
commit
c4fc748024
2 files changed
+7
-4
No files matched your search
@@ -14,8 +14,8 @@ class FileTransformer(val file: File) {
|
|||||||
file.writeText(Regex(input, RegexOption.DOT_MATCHES_ALL).replace(file.readText(), output))
|
file.writeText(Regex(input, RegexOption.DOT_MATCHES_ALL).replace(file.readText(), output))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun find(input: String): Boolean {
|
fun readText(): String {
|
||||||
return Regex(input, RegexOption.DOT_MATCHES_ALL).find(file.readText()) != null
|
return file.readText()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun append(line: String) {
|
fun append(line: String) {
|
||||||
@@ -158,7 +158,10 @@ class PatchExecutor(private val workingDir: File) {
|
|||||||
it ?: workingDir.resolve("smali/classes").apply { mkdirs() }
|
it ?: workingDir.resolve("smali/classes").apply { mkdirs() }
|
||||||
}
|
}
|
||||||
.resolve("${fileName}.smali")
|
.resolve("${fileName}.smali")
|
||||||
.apply { createNewFile() }
|
.apply {
|
||||||
|
parentFile?.mkdirs()
|
||||||
|
createNewFile()
|
||||||
|
}
|
||||||
.run {
|
.run {
|
||||||
if (exists()) {
|
if (exists()) {
|
||||||
FileTransformer(this).block()
|
FileTransformer(this).block()
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ object PatchStore {
|
|||||||
}
|
}
|
||||||
PATCHES += Patch("Fix Unreal Engine 4 crash") {
|
PATCHES += Patch("Fix Unreal Engine 4 crash") {
|
||||||
createSmali("com/unity3d/player/UnityPlayer") {
|
createSmali("com/unity3d/player/UnityPlayer") {
|
||||||
if (!find(".*")) {
|
if (readText().isBlank()) {
|
||||||
append(".class public Lcom/unity3d/player/UnityPlayer;")
|
append(".class public Lcom/unity3d/player/UnityPlayer;")
|
||||||
append(".super Ljava/lang/Object;")
|
append(".super Ljava/lang/Object;")
|
||||||
append(".field public static currentActivity:Landroid/app/Activity;")
|
append(".field public static currentActivity:Landroid/app/Activity;")
|
||||||
|
|||||||
Reference in new issue
Block a user