feat(backdrops): pro-unlock
patch (#1121)
This commit is contained in:
parent
58c3f5ade2
commit
52309463e4
|
@ -0,0 +1,7 @@
|
|||
package app.revanced.patches.backdrops.misc.pro.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.backdrops.wallpapers")])
|
||||
internal annotation class ProUnlockCompatibility
|
|
@ -0,0 +1,15 @@
|
|||
package app.revanced.patches.backdrops.misc.pro.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object ProUnlockFingerprint : MethodFingerprint(
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.INVOKE_INTERFACE,
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.IF_EQZ
|
||||
),
|
||||
customFingerprint = { it.definingClass == "Lcom/backdrops/wallpapers/data/local/DatabaseHandlerIAB;" && it.name == "lambda\$existPurchase\$0" }
|
||||
)
|
|
@ -0,0 +1,42 @@
|
|||
package app.revanced.patches.backdrops.misc.pro.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.backdrops.misc.pro.annotations.ProUnlockCompatibility
|
||||
import app.revanced.patches.backdrops.misc.pro.fingerprints.ProUnlockFingerprint
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@Name("pro-unlock")
|
||||
@Description("Unlocks pro-only functions.")
|
||||
@ProUnlockCompatibility
|
||||
@Version("0.0.1")
|
||||
class ProUnlockPatch : BytecodePatch(
|
||||
listOf(ProUnlockFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
val result = ProUnlockFingerprint.result ?: return PatchResultError("${ProUnlockFingerprint.name} not found")
|
||||
|
||||
val moveRegisterInstruction = result.mutableMethod.instruction(result.scanResult.patternScanResult!!.endIndex - 1)
|
||||
val register = (moveRegisterInstruction as OneRegisterInstruction).registerA
|
||||
|
||||
result.mutableMethod.addInstructions(
|
||||
result.scanResult.patternScanResult!!.endIndex,
|
||||
"""
|
||||
const/4 v$register, 0x1
|
||||
"""
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue