refactor(photomath): EnableBookpointPatch

This commit is contained in:
Pun Butrach
2026-01-12 17:25:01 +07:00
parent be005c533a
commit f4a04e7917
2 changed files with 20 additions and 13 deletions

View File

@@ -1,14 +1,15 @@
package app.revanced.patches.photomath.misc.unlock.bookpoint
import app.revanced.patcher.extensions.replaceInstructions
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.patch.creatingBytecodePatch
val enableBookpointPatch = bytecodePatch(
@Suppress("unused")
val `Enable bookpoint` by creatingBytecodePatch(
description = "Enables textbook access",
) {
apply {
isBookpointEnabledFingerprint.method.replaceInstructions(
isBookpointEnabledMethod.replaceInstructions(
0,
"""
const/4 v0, 0x1

View File

@@ -1,16 +1,22 @@
package app.revanced.patches.photomath.misc.unlock.bookpoint
import app.revanced.patcher.BytecodePatchContextMethodMatching.gettingFirstMutableMethodDeclaratively
import app.revanced.patcher.accessFlags
import app.revanced.patcher.instructions
import app.revanced.patcher.invoke
import app.revanced.patcher.parameterTypes
import app.revanced.patcher.patch.BytecodePatchContext
import app.revanced.patcher.returnType
import com.android.tools.smali.dexlib2.AccessFlags
import app.revanced.patcher.fingerprint
internal val isBookpointEnabledFingerprint = fingerprint {
internal val BytecodePatchContext.isBookpointEnabledMethod by gettingFirstMutableMethodDeclaratively {
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
returns("Z")
parameters()
strings(
"NoGeoData",
"NoCountryInGeo",
"RemoteConfig",
"GeoRCMismatch"
returnType("Z")
parameterTypes()
instructions(
"NoGeoData"(),
"NoCountryInGeo"(),
"RemoteConfig"(),
"GeoRCMismatch"()
)
}
}