feat: promo-code-unlock
patch (#292)
This commit is contained in:
parent
ebe986b67f
commit
d5df2e68f4
|
@ -0,0 +1,13 @@
|
|||
package app.revanced.patches.warnwetter.misc.promocode.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"de.dwd.warnapp", arrayOf()
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
internal annotation class PromoCodeUnlockCompatibility
|
|
@ -0,0 +1,26 @@
|
|||
package app.revanced.patches.warnwetter.misc.promocode.fingerprints
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||
import app.revanced.patches.youtube.layout.createbutton.annotations.CreateButtonCompatibility
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@Name("promo-code-unlock-fingerprint")
|
||||
@MatchingMethod(
|
||||
"Lde/dwd/warnapp/model/PromoTokenVerification;", "isValid"
|
||||
)
|
||||
@CreateButtonCompatibility
|
||||
@Version("0.0.1")
|
||||
object PromoCodeUnlockFingerprint : MethodFingerprint(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
{ methodDef ->
|
||||
methodDef.definingClass.endsWith("PromoTokenVerification;") && methodDef.name == "isValid"
|
||||
}
|
||||
)
|
|
@ -0,0 +1,42 @@
|
|||
package app.revanced.patches.warnwetter.misc.promocode.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.impl.BytecodeData
|
||||
import app.revanced.patcher.extensions.removeInstruction
|
||||
import app.revanced.patcher.extensions.removeInstructions
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patches.warnwetter.misc.promocode.annotations.PromoCodeUnlockCompatibility
|
||||
import app.revanced.patches.warnwetter.misc.promocode.fingerprints.PromoCodeUnlockFingerprint
|
||||
|
||||
@Patch
|
||||
@Name("promo-code-unlock")
|
||||
@Description("Disables the validation of promo code. Any code will work to unlock all features.")
|
||||
@PromoCodeUnlockCompatibility
|
||||
@Version("0.0.1")
|
||||
class PromoCodeUnlockPatch : BytecodePatch(
|
||||
listOf(
|
||||
PromoCodeUnlockFingerprint
|
||||
)
|
||||
) {
|
||||
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
val method = PromoCodeUnlockFingerprint.result!!.mutableMethod
|
||||
method.addInstructions(
|
||||
0,
|
||||
"""
|
||||
const/4 v0, 0x1
|
||||
return v0
|
||||
"""
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in a new issue