mirror of
https://github.com/ReVanced/revanced-patcher.git
synced 2024-11-10 01:02:22 +01:00
feat: Improve SignatureResolver
This commit is contained in:
parent
0d8d19e708
commit
139a23b750
3 changed files with 7 additions and 12 deletions
|
@ -2,7 +2,7 @@ package app.revanced.patcher
|
|||
|
||||
import app.revanced.patcher.cache.Cache
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.resolver.SignatureResolver
|
||||
import app.revanced.patcher.signature.resolver.SignatureResolver
|
||||
import app.revanced.patcher.signature.MethodSignature
|
||||
import lanchon.multidexlib2.BasicDexFileNamer
|
||||
import lanchon.multidexlib2.DexIO
|
||||
|
|
|
@ -2,7 +2,7 @@ package app.revanced.patcher.signature
|
|||
|
||||
import app.revanced.patcher.proxy.ClassProxy
|
||||
import app.revanced.patcher.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.resolver.SignatureResolver
|
||||
import app.revanced.patcher.signature.resolver.SignatureResolver
|
||||
|
||||
/**
|
||||
* Represents the result of a [SignatureResolver].
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package app.revanced.patcher.resolver
|
||||
package app.revanced.patcher.signature.resolver
|
||||
|
||||
import app.revanced.patcher.cache.MethodMap
|
||||
import app.revanced.patcher.proxy.ClassProxy
|
||||
|
@ -38,11 +38,6 @@ internal class SignatureResolver(
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: remove?
|
||||
for (signature in methodSignatures) {
|
||||
if (methodMap.containsKey(signature.name)) continue
|
||||
}
|
||||
|
||||
return methodMap
|
||||
}
|
||||
|
||||
|
@ -75,7 +70,7 @@ internal class SignatureResolver(
|
|||
}
|
||||
|
||||
signature.methodParameters?.let { _ ->
|
||||
if (!signature.methodParameters.all { signatureMethodParameter ->
|
||||
if (signature.methodParameters.count() != method.parameterTypes.count() || !signature.methodParameters.all { signatureMethodParameter ->
|
||||
method.parameterTypes.any { methodParameter ->
|
||||
methodParameter.startsWith(signatureMethodParameter)
|
||||
}
|
||||
|
@ -94,10 +89,10 @@ private operator fun ClassDef.component1() = this
|
|||
private operator fun ClassDef.component2() = this.methods
|
||||
|
||||
private fun MutableIterable<Instruction>.scanFor(pattern: Array<Opcode>): PatternScanResult? {
|
||||
// TODO: create var for count?
|
||||
for (instructionIndex in 0 until this.count()) {
|
||||
val count = this.count()
|
||||
for (instructionIndex in 0 until count) {
|
||||
var patternIndex = 0
|
||||
while (instructionIndex + patternIndex < this.count()) {
|
||||
while (instructionIndex + patternIndex < count) {
|
||||
if (this.elementAt(instructionIndex + patternIndex).opcode != pattern[patternIndex]) break
|
||||
if (++patternIndex < pattern.size) continue
|
||||
|
Loading…
Reference in a new issue