mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2024-11-10 09:07:46 +01:00
feat: ˋpflotsh-ecmwf-subscription-unlockˋ patch (#332)
This commit is contained in:
parent
e87666a228
commit
ae2a1d8362
3 changed files with 84 additions and 0 deletions
|
@ -0,0 +1,13 @@
|
|||
package app.revanced.patches.ecmwf.misc.subscription.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.garzotto.pflotsh.ecmwf_a", arrayOf("3.5.4")
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
internal annotation class SubscriptionUnlockCompatibility
|
|
@ -0,0 +1,24 @@
|
|||
package app.revanced.patches.ecmwf.misc.subscription.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.ecmwf.misc.subscription.annotations.SubscriptionUnlockCompatibility
|
||||
|
||||
@Name("subscription-unlock")
|
||||
@MatchingMethod(
|
||||
"Lcom/garzotto/pflotsh/library_a/MapsActivity", "t0"
|
||||
)
|
||||
@SubscriptionUnlockCompatibility
|
||||
@Version("0.0.1")
|
||||
object SubscriptionUnlockFingerprint : MethodFingerprint(
|
||||
"Z",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
{ methodDef ->
|
||||
methodDef.definingClass.endsWith("MapsActivity;") && methodDef.name == "t0"
|
||||
}
|
||||
)
|
|
@ -0,0 +1,47 @@
|
|||
package app.revanced.patches.ecmwf.misc.subscription.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.addInstructions
|
||||
import app.revanced.patcher.extensions.removeInstruction
|
||||
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.ecmwf.misc.subscription.annotations.SubscriptionUnlockCompatibility
|
||||
import app.revanced.patches.ecmwf.misc.subscription.fingerprints.SubscriptionUnlockFingerprint
|
||||
|
||||
@Patch
|
||||
@Name("pflotsh-ecmwf-subscription-unlock")
|
||||
@Description("Unlocks all subscription features.")
|
||||
@SubscriptionUnlockCompatibility
|
||||
@Version("0.0.1")
|
||||
class SubscriptionUnlockPatch : BytecodePatch(
|
||||
listOf(
|
||||
SubscriptionUnlockFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
val result = SubscriptionUnlockFingerprint.result!!
|
||||
val method = result.mutableMethod
|
||||
|
||||
val index = method.implementation!!.instructions.size
|
||||
|
||||
// remove R() at 10212
|
||||
method.removeInstruction(index - 3)
|
||||
// remove R() at 10206
|
||||
method.removeInstruction(index - 5)
|
||||
|
||||
val insertIndex = index
|
||||
|
||||
method.addInstructions(
|
||||
insertIndex - 1 - 2,
|
||||
"""
|
||||
const/4 p1, 0x1
|
||||
"""
|
||||
)
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue