mirror of
https://github.com/revanced/revanced-patches
synced 2024-12-12 13:17:46 +01:00
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.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
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)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class DisableSignatureDetectionCompatibility
|
internal annotation class DisableSignatureDetectionCompatibility
|
||||||
|
@ -1,9 +1,18 @@
|
|||||||
package app.revanced.patches.photomath.detection.signature.fingerprints
|
package app.revanced.patches.photomath.detection.signature.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
object CheckSignatureFingerprint : MethodFingerprint(
|
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(
|
strings = listOf(
|
||||||
"currentSignature"
|
"currentSignature"
|
||||||
),
|
),
|
||||||
@ -18,4 +27,4 @@ object CheckSignatureFingerprint : MethodFingerprint(
|
|||||||
Opcode.INVOKE_STATIC,
|
Opcode.INVOKE_STATIC,
|
||||||
Opcode.MOVE_RESULT,
|
Opcode.MOVE_RESULT,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -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,42 +1,35 @@
|
|||||||
package app.revanced.patches.photomath.detection.signature.patch
|
package app.revanced.patches.photomath.detection.signature.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.instruction
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
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.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patches.photomath.detection.signature.annotations.DisableSignatureDetectionCompatibility
|
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.CheckSignatureFingerprint
|
||||||
import app.revanced.patches.photomath.detection.signature.fingerprints.MainOnCreateFingerprint
|
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
@Description("Disables detection of incorrect signature.")
|
@Description("Disables detection of incorrect signature.")
|
||||||
@DisableSignatureDetectionCompatibility
|
@DisableSignatureDetectionCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.2")
|
||||||
class SignatureDetectionPatch : BytecodePatch(
|
class SignatureDetectionPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
MainOnCreateFingerprint
|
CheckSignatureFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
val mainOnCreate = MainOnCreateFingerprint.result!!
|
CheckSignatureFingerprint.result?.apply {
|
||||||
|
val signatureCheckInstruction = mutableMethod.instruction(scanResult.patternScanResult!!.endIndex)
|
||||||
val patternResult = CheckSignatureFingerprint.also {
|
|
||||||
it.resolve(context, mainOnCreate.method, mainOnCreate.classDef)
|
|
||||||
}.result!!.scanResult.patternScanResult!!
|
|
||||||
|
|
||||||
mainOnCreate.mutableMethod.apply {
|
|
||||||
val signatureCheckInstruction = instruction(patternResult.endIndex)
|
|
||||||
val checkRegister = (signatureCheckInstruction as OneRegisterInstruction).registerA
|
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()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user