mirror of
https://github.com/revanced/revanced-patches
synced 2024-11-30 21:52:56 +01:00
fix: wrong opcode pattern for enable-seekbar-tapping-signature
This commit is contained in:
parent
0924ca2ad3
commit
1d833957ed
@ -30,7 +30,7 @@ class EnableSeekbarTappingPatch : Patch(
|
||||
MethodSignature(
|
||||
MethodSignatureMetadata(
|
||||
"enable-seekbar-tapping-parent-signature",
|
||||
MethodMetadata(null, null), // unknown
|
||||
MethodMetadata("Lesa;", "<init>"), // unknown
|
||||
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
|
||||
compatiblePackages,
|
||||
"Signature for a parent method, which is needed to find the actual method required to be patched.",
|
||||
@ -75,7 +75,7 @@ class EnableSeekbarTappingPatch : Patch(
|
||||
MethodSignature(
|
||||
MethodSignatureMetadata(
|
||||
"enable-seekbar-tapping-signature",
|
||||
MethodMetadata(null, null), // unknown
|
||||
MethodMetadata("Lesa;", "onTouchEvent"), // unknown
|
||||
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
|
||||
compatiblePackages,
|
||||
"Signature for the method required to be patched.",
|
||||
@ -85,17 +85,6 @@ class EnableSeekbarTappingPatch : Patch(
|
||||
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
listOf("L"),
|
||||
listOf(
|
||||
Opcode.CMPG_DOUBLE,
|
||||
Opcode.IF_GTZ,
|
||||
Opcode.GOTO,
|
||||
Opcode.INT_TO_FLOAT,
|
||||
Opcode.INT_TO_FLOAT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.IF_NEZ,
|
||||
Opcode.RETURN,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.IF_EQZ,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_WIDE,
|
||||
Opcode.INT_TO_FLOAT,
|
||||
@ -116,6 +105,15 @@ class EnableSeekbarTappingPatch : Patch(
|
||||
Opcode.NEW_INSTANCE,
|
||||
Opcode.INVOKE_DIRECT,
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.NEW_INSTANCE,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.FLOAT_TO_INT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.FLOAT_TO_INT,
|
||||
Opcode.INVOKE_DIRECT,
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL
|
||||
)
|
||||
)
|
||||
@ -156,7 +154,7 @@ class EnableSeekbarTappingPatch : Patch(
|
||||
val oMethod = tapSeekMethods["O"]!!
|
||||
|
||||
// get the required register
|
||||
val instruction = implementation.instructions[result.scanData.endIndex + 1]
|
||||
val instruction = implementation.instructions[result.scanData.endIndex - 1]
|
||||
if (instruction.opcode != Opcode.INVOKE_VIRTUAL)
|
||||
return PatchResultError("Could not find the correct register")
|
||||
val register = (instruction as Instruction35c).registerC
|
||||
|
@ -10,7 +10,7 @@ import java.io.File
|
||||
internal class SignatureChecker {
|
||||
@Test
|
||||
fun checkSignatures() {
|
||||
val file = File("stock.apk")
|
||||
val file = File("newest.apk")
|
||||
if (!file.exists()) {
|
||||
throw IllegalStateException("Missing stock.apk! To run this test, please place stock.apk here: ${file.absolutePath}")
|
||||
}
|
||||
@ -26,21 +26,14 @@ internal class SignatureChecker {
|
||||
val patternScanMethod = signature.metadata.patternScanMethod
|
||||
if (patternScanMethod is PatternScanMethod.Fuzzy) {
|
||||
val warnings = patternScanMethod.warnings!!
|
||||
println("Signature ${signature.metadata.name} had ${warnings.size} warnings!")
|
||||
val method = signature.result!!.method
|
||||
val instructions = method.implementation!!.instructions
|
||||
println("class = ${method.definingClass}, method = ${printMethod(method)}")
|
||||
|
||||
println("Signature: ${signature.metadata.name}.\nMethod: ${method.definingClass}->${method.toStr()}\nWarnings: ${warnings.count()}")
|
||||
for (warning in warnings) {
|
||||
println("-".repeat(10))
|
||||
for (i in (warning.actualIndex - 5).coerceAtLeast(0) until warning.actualIndex) {
|
||||
println("$i: ${instructions[i].opcode}")
|
||||
}
|
||||
println("${warning.actualIndex}: $warning")
|
||||
for (i in warning.actualIndex + 1 until (warning.actualIndex + 5).coerceAtMost(instructions.size)) {
|
||||
println("$i: ${instructions[i].opcode}")
|
||||
}
|
||||
println("${warning.instructionIndex} / ${warning.patternIndex}: ${warning.current} (expected: ${warning.expected})")
|
||||
}
|
||||
println("=".repeat(20))
|
||||
|
||||
println("=".repeat(20) + "\n")
|
||||
}
|
||||
}
|
||||
if (unresolved.isNotEmpty()) {
|
||||
@ -52,7 +45,7 @@ internal class SignatureChecker {
|
||||
}
|
||||
}
|
||||
|
||||
private fun printMethod(method: Method): String {
|
||||
return "${method.name}(${method.parameterTypes.joinToString("")})${method.returnType}"
|
||||
private fun Method.toStr(): String {
|
||||
return "${this.name}(${this.parameterTypes.joinToString("")})${this.returnType}"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user