feat(photomath): bump compatibility up to 8.21.0
(#1886)
This commit is contained in:
parent
d86b6a4a65
commit
43464fd6ff
|
@ -3,6 +3,28 @@ package app.revanced.patches.photomath.detection.signature.annotations
|
|||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.microblink.photomath")])
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.microblink.photomath", arrayOf(
|
||||
"8.6.0",
|
||||
"8.7.0",
|
||||
"8.8.0",
|
||||
"8.9.0",
|
||||
"8.10.0",
|
||||
"8.11.0",
|
||||
"8.12.0",
|
||||
"8.13.0",
|
||||
"8.14.0",
|
||||
"8.15.0",
|
||||
"8.16.0",
|
||||
"8.17.0",
|
||||
"8.18.0",
|
||||
"8.18.1",
|
||||
"8.19.0",
|
||||
"8.20.0",
|
||||
"8.21.0",
|
||||
)
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class DisableSignatureDetectionCompatibility
|
|
@ -1,9 +1,18 @@
|
|||
package app.revanced.patches.photomath.detection.signature.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object CheckSignatureFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
customFingerprint = {
|
||||
(it.definingClass == "Lcom/microblink/photomath/main/activity/LauncherActivity;" ||
|
||||
it.definingClass == "Lcom/microblink/photomath/PhotoMath;") &&
|
||||
it.name == "onCreate"
|
||||
},
|
||||
strings = listOf(
|
||||
"currentSignature"
|
||||
),
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
package app.revanced.patches.photomath.detection.signature.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
|
||||
object MainOnCreateFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
customFingerprint = { methodDef ->
|
||||
methodDef.definingClass == "Lcom/microblink/photomath/PhotoMath;" && methodDef.name == "onCreate"
|
||||
}
|
||||
)
|
|
@ -1,40 +1,33 @@
|
|||
package app.revanced.patches.photomath.detection.signature.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.extensions.replaceInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patches.photomath.detection.signature.annotations.DisableSignatureDetectionCompatibility
|
||||
import app.revanced.patches.photomath.detection.signature.fingerprints.CheckSignatureFingerprint
|
||||
import app.revanced.patches.photomath.detection.signature.fingerprints.MainOnCreateFingerprint
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Description("Disables detection of incorrect signature.")
|
||||
@DisableSignatureDetectionCompatibility
|
||||
@Version("0.0.1")
|
||||
@Version("0.0.2")
|
||||
class SignatureDetectionPatch : BytecodePatch(
|
||||
listOf(
|
||||
MainOnCreateFingerprint
|
||||
CheckSignatureFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
val mainOnCreate = MainOnCreateFingerprint.result!!
|
||||
|
||||
val patternResult = CheckSignatureFingerprint.also {
|
||||
it.resolve(context, mainOnCreate.method, mainOnCreate.classDef)
|
||||
}.result!!.scanResult.patternScanResult!!
|
||||
|
||||
mainOnCreate.mutableMethod.apply {
|
||||
val signatureCheckInstruction = instruction(patternResult.endIndex)
|
||||
CheckSignatureFingerprint.result?.apply {
|
||||
val signatureCheckInstruction = mutableMethod.instruction(scanResult.patternScanResult!!.endIndex)
|
||||
val checkRegister = (signatureCheckInstruction as OneRegisterInstruction).registerA
|
||||
|
||||
replaceInstruction(signatureCheckInstruction.location.index, "const/4 v$checkRegister, 0x1")
|
||||
}
|
||||
mutableMethod.replaceInstruction(signatureCheckInstruction.location.index, "const/4 v$checkRegister, 0x1")
|
||||
} ?: throw CheckSignatureFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue