From b44ac9b26f13a561eac6819e794c9bf1998081b1 Mon Sep 17 00:00:00 2001 From: obXfuse Date: Wed, 18 Mar 2026 20:57:47 -0400 Subject: [PATCH 1/2] feat(amznmusic): add unlimited track skipping patch --- .../misc/skips/UnlimitedSkipsPatch.kt | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 patches/src/main/kotlin/app/revanced/patches/amznmusic/misc/skips/UnlimitedSkipsPatch.kt diff --git a/patches/src/main/kotlin/app/revanced/patches/amznmusic/misc/skips/UnlimitedSkipsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/amznmusic/misc/skips/UnlimitedSkipsPatch.kt new file mode 100644 index 0000000000..e1cda9dd74 --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/amznmusic/misc/skips/UnlimitedSkipsPatch.kt @@ -0,0 +1,23 @@ +package app.revanced.patches.amznmusic.misc.skips + +import app.revanced.patcher.extensions.addInstructions +import app.revanced.patcher.firstMethod +import app.revanced.patcher.patch.bytecodePatch + +@Suppress("unused") +val unlimitedSkipsPatch = bytecodePatch( + name = "Unlimited track skipping", + description = "Unlocks the ability to skip tracks without restriction.", +) { + compatibleWith("com.amazon.mp3") + + apply { + firstMethod { name == "getRule" && definingClass == $$"Lcom/amazon/music/freetier/featuregating/FMPMFeatureGating$STATION_UNLIMITED_SKIPS;" } + .addInstructions(0, + """ + new-instance p0, Lcom/amazon/music/platform/featuregate/rules/TrueRule; + invoke-direct {p0}, Lcom/amazon/music/platform/featuregate/rules/TrueRule;->()V + return-object p0 + """) + } +} From 37ac390a2e168f82fd7419eb1b7c5d0a94fab518 Mon Sep 17 00:00:00 2001 From: obXfuse Date: Sat, 21 Mar 2026 03:39:04 -0400 Subject: [PATCH 2/2] refactor(amazonmusic): use Fingerprints.kt file for matching --- patches/api/patches.api | 4 ++++ .../revanced/patches/amazonmusic/misc/Fingerprints.kt | 11 +++++++++++ .../misc/UnlimitedTrackSkippingPatch.kt} | 8 +++----- 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 patches/src/main/kotlin/app/revanced/patches/amazonmusic/misc/Fingerprints.kt rename patches/src/main/kotlin/app/revanced/patches/{amznmusic/misc/skips/UnlimitedSkipsPatch.kt => amazonmusic/misc/UnlimitedTrackSkippingPatch.kt} (61%) diff --git a/patches/api/patches.api b/patches/api/patches.api index be251e84a5..87c662b6ba 100644 --- a/patches/api/patches.api +++ b/patches/api/patches.api @@ -153,6 +153,10 @@ public final class app/revanced/patches/amazon/DeepLinkingPatchKt { public static final fun getAlwaysAllowDeepLinkingPatch ()Lapp/revanced/patcher/patch/Patch; } +public final class app/revanced/patches/amazonmusic/misc/UnlimitedTrackSkippingPatchKt { + public static final fun getUnlimitedTrackSkippingPatch ()Lapp/revanced/patcher/patch/Patch; +} + public final class app/revanced/patches/angulus/ads/RemoveAdsPatchKt { public static final fun getHideAdsPatch ()Lapp/revanced/patcher/patch/Patch; } diff --git a/patches/src/main/kotlin/app/revanced/patches/amazonmusic/misc/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/amazonmusic/misc/Fingerprints.kt new file mode 100644 index 0000000000..730701cada --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/amazonmusic/misc/Fingerprints.kt @@ -0,0 +1,11 @@ +package app.revanced.patches.amazonmusic.misc + +import app.revanced.patcher.gettingFirstMethodDeclaratively +import app.revanced.patcher.type +import app.revanced.patcher.name +import app.revanced.patcher.patch.BytecodePatchContext + +internal val BytecodePatchContext.getRuleMethod by gettingFirstMethodDeclaratively { + type($$"Lcom/amazon/music/freetier/featuregating/FMPMFeatureGating$STATION_UNLIMITED_SKIPS;") + name("getRule") +} diff --git a/patches/src/main/kotlin/app/revanced/patches/amznmusic/misc/skips/UnlimitedSkipsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/amazonmusic/misc/UnlimitedTrackSkippingPatch.kt similarity index 61% rename from patches/src/main/kotlin/app/revanced/patches/amznmusic/misc/skips/UnlimitedSkipsPatch.kt rename to patches/src/main/kotlin/app/revanced/patches/amazonmusic/misc/UnlimitedTrackSkippingPatch.kt index e1cda9dd74..8da5de4a6d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/amznmusic/misc/skips/UnlimitedSkipsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/amazonmusic/misc/UnlimitedTrackSkippingPatch.kt @@ -1,19 +1,17 @@ -package app.revanced.patches.amznmusic.misc.skips +package app.revanced.patches.amazonmusic.misc import app.revanced.patcher.extensions.addInstructions -import app.revanced.patcher.firstMethod import app.revanced.patcher.patch.bytecodePatch @Suppress("unused") -val unlimitedSkipsPatch = bytecodePatch( +val unlimitedTrackSkippingPatch = bytecodePatch( name = "Unlimited track skipping", description = "Unlocks the ability to skip tracks without restriction.", ) { compatibleWith("com.amazon.mp3") apply { - firstMethod { name == "getRule" && definingClass == $$"Lcom/amazon/music/freetier/featuregating/FMPMFeatureGating$STATION_UNLIMITED_SKIPS;" } - .addInstructions(0, + getRuleMethod.addInstructions(0, """ new-instance p0, Lcom/amazon/music/platform/featuregate/rules/TrueRule; invoke-direct {p0}, Lcom/amazon/music/platform/featuregate/rules/TrueRule;->()V