mirror of
https://github.com/revanced/revanced-patches
synced 2024-11-09 05:17:06 +01:00
feat(yuka): unlock-premium
patch (#1608)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
f8ba61ccc6
commit
71e15945c1
@ -0,0 +1,9 @@
|
||||
package app.revanced.patches.yuka.misc.unlockpremium.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("io.yuka.android")])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
internal annotation class UnlockPremiumCompatibility
|
@ -0,0 +1,15 @@
|
||||
package app.revanced.patches.yuka.misc.unlockpremium.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 IsPremiumFingerprint : MethodFingerprint(
|
||||
returnType = "Z",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
opcodes = listOf(
|
||||
Opcode.IGET_BOOLEAN,
|
||||
Opcode.RETURN,
|
||||
)
|
||||
)
|
@ -0,0 +1,13 @@
|
||||
package app.revanced.patches.yuka.misc.unlockpremium.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
|
||||
object YukaUserConstructorFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
strings = listOf(
|
||||
"premiumProvider"
|
||||
)
|
||||
)
|
@ -0,0 +1,41 @@
|
||||
package app.revanced.patches.yuka.misc.unlockpremium.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.addInstructions
|
||||
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.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.yuka.misc.unlockpremium.annotations.UnlockPremiumCompatibility
|
||||
import app.revanced.patches.yuka.misc.unlockpremium.fingerprints.IsPremiumFingerprint
|
||||
import app.revanced.patches.yuka.misc.unlockpremium.fingerprints.YukaUserConstructorFingerprint
|
||||
|
||||
@Patch
|
||||
@Name("unlock-premium")
|
||||
@Description("Unlocks premium features.")
|
||||
@UnlockPremiumCompatibility
|
||||
@Version("0.0.1")
|
||||
class UnlockPremiunPatch : BytecodePatch(
|
||||
listOf(
|
||||
YukaUserConstructorFingerprint
|
||||
)
|
||||
) {
|
||||
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
IsPremiumFingerprint.resolve(context,YukaUserConstructorFingerprint.result!!.classDef)
|
||||
val method = IsPremiumFingerprint.result!!.mutableMethod
|
||||
method.addInstructions(
|
||||
0,
|
||||
"""
|
||||
const/4 v0, 0x1
|
||||
return v0
|
||||
"""
|
||||
)
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user