diff --git a/src/main/kotlin/app/revanced/patches/music/ad/video/annotations/MusicVideoAdsCompatibility.kt b/src/main/kotlin/app/revanced/patches/music/ad/video/annotations/MusicVideoAdsCompatibility.kt index b7f022d83..da548e9cf 100644 --- a/src/main/kotlin/app/revanced/patches/music/ad/video/annotations/MusicVideoAdsCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/music/ad/video/annotations/MusicVideoAdsCompatibility.kt @@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package @Compatibility( [Package( - "com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51") + "com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51") )] ) @Target(AnnotationTarget.CLASS) diff --git a/src/main/kotlin/app/revanced/patches/music/audio/codecs/annotations/CodecsUnlockCompatibility.kt b/src/main/kotlin/app/revanced/patches/music/audio/codecs/annotations/CodecsUnlockCompatibility.kt index e64e00d60..1b5a7d061 100644 --- a/src/main/kotlin/app/revanced/patches/music/audio/codecs/annotations/CodecsUnlockCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/music/audio/codecs/annotations/CodecsUnlockCompatibility.kt @@ -5,10 +5,9 @@ import app.revanced.patcher.annotation.Package @Compatibility( [Package( - "com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51") + "com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51") )] ) @Target(AnnotationTarget.CLASS) @Retention(AnnotationRetention.RUNTIME) internal annotation class CodecsUnlockCompatibility - diff --git a/src/main/kotlin/app/revanced/patches/music/audio/codecs/fingerprints/CodecsLockFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/audio/codecs/fingerprints/CodecsLockFingerprint.kt index d3c7ba5d2..7ef1a0f68 100644 --- a/src/main/kotlin/app/revanced/patches/music/audio/codecs/fingerprints/CodecsLockFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/audio/codecs/fingerprints/CodecsLockFingerprint.kt @@ -12,17 +12,14 @@ import org.jf.dexlib2.Opcode @Name("codec-lock-fingerprint") @MatchingMethod( - "Labwj;", + "Lacfr;", "a", ) @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @CodecsUnlockCompatibility @Version("0.0.1") object CodecsLockFingerprint : MethodFingerprint( - "L", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L", "L", "L", "L"), listOf( - Opcode.INVOKE_VIRTUAL, - Opcode.MOVE_RESULT_OBJECT, - Opcode.CHECK_CAST, + "L", AccessFlags.PUBLIC or AccessFlags.STATIC, null, listOf( Opcode.INVOKE_DIRECT, Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT, @@ -37,5 +34,6 @@ object CodecsLockFingerprint : MethodFingerprint( Opcode.INVOKE_INTERFACE, Opcode.INVOKE_DIRECT, Opcode.RETURN_OBJECT - ) -) \ No newline at end of file + ), + listOf("eac3_supported") +) diff --git a/src/main/kotlin/app/revanced/patches/music/audio/codecs/patch/CodecsUnlockPatch.kt b/src/main/kotlin/app/revanced/patches/music/audio/codecs/patch/CodecsUnlockPatch.kt index e6a225a26..a9f0e1a22 100644 --- a/src/main/kotlin/app/revanced/patches/music/audio/codecs/patch/CodecsUnlockPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/audio/codecs/patch/CodecsUnlockPatch.kt @@ -13,6 +13,7 @@ import app.revanced.patcher.util.smali.toInstruction import app.revanced.patches.music.audio.codecs.annotations.CodecsUnlockCompatibility import app.revanced.patches.music.audio.codecs.fingerprints.AllCodecsReferenceFingerprint import app.revanced.patches.music.audio.codecs.fingerprints.CodecsLockFingerprint +import org.jf.dexlib2.Opcode @Patch @Name("codecs-unlock") @@ -25,19 +26,29 @@ class CodecsUnlockPatch : BytecodePatch( ) ) { override fun execute(data: BytecodeData): PatchResult { - var result = CodecsLockFingerprint.result!! + val codecsLockResult = CodecsLockFingerprint.result!! - val implementation = result.mutableMethod.implementation!! + val implementation = codecsLockResult.mutableMethod.implementation!! - val instructionIndex = result.patternScanResult!!.startIndex + val scanResultStartIndex = codecsLockResult.patternScanResult!!.startIndex + val instructionIndex = scanResultStartIndex + + if (implementation.instructions[scanResultStartIndex - 1].opcode == Opcode.CHECK_CAST) { + // for 5.16.xx and lower + -3 + } else { + // since 5.17.xx + -2 + } - result = AllCodecsReferenceFingerprint.result!! - val codecMethod = - data.toMethodWalker(result.method).nextMethod(result.patternScanResult!!.startIndex).getMethod() + val allCodecsResult = AllCodecsReferenceFingerprint.result!! + val allCodecsMethod = + data.toMethodWalker(allCodecsResult.method) + .nextMethod(allCodecsResult.patternScanResult!!.startIndex) + .getMethod() implementation.replaceInstruction( instructionIndex, - "invoke-static {}, ${codecMethod.definingClass}->${codecMethod.name}()Ljava/util/Set;".toInstruction() + "invoke-static {}, ${allCodecsMethod.definingClass}->${allCodecsMethod.name}()Ljava/util/Set;".toInstruction() ) return PatchResultSuccess() diff --git a/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/annotations/ExclusiveAudioCompatibility.kt b/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/annotations/ExclusiveAudioCompatibility.kt index 72084fd13..ddd636b5f 100644 --- a/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/annotations/ExclusiveAudioCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/annotations/ExclusiveAudioCompatibility.kt @@ -5,10 +5,9 @@ import app.revanced.patcher.annotation.Package @Compatibility( [Package( - "com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51") + "com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51") )] ) @Target(AnnotationTarget.CLASS) @Retention(AnnotationRetention.RUNTIME) internal annotation class ExclusiveAudioCompatibility - diff --git a/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/annotations/MinimizedPlaybackCompatibility.kt b/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/annotations/MinimizedPlaybackCompatibility.kt index 30004e34a..d0c443b9b 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/annotations/MinimizedPlaybackCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/annotations/MinimizedPlaybackCompatibility.kt @@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package @Compatibility( [Package( - "com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51") + "com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51") )] ) @Target(AnnotationTarget.CLASS) diff --git a/src/main/kotlin/app/revanced/patches/music/layout/premium/annotations/HideGetPremiumCompatibility.kt b/src/main/kotlin/app/revanced/patches/music/layout/premium/annotations/HideGetPremiumCompatibility.kt index 130231a7c..3e36269ce 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/premium/annotations/HideGetPremiumCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/premium/annotations/HideGetPremiumCompatibility.kt @@ -5,10 +5,9 @@ import app.revanced.patcher.annotation.Package @Compatibility( [Package( - "com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51") + "com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51") )] ) @Target(AnnotationTarget.CLASS) @Retention(AnnotationRetention.RUNTIME) internal annotation class HideGetPremiumCompatibility - diff --git a/src/main/kotlin/app/revanced/patches/music/layout/tastebuilder/annotations/RemoveTasteBuilderCompatibility.kt b/src/main/kotlin/app/revanced/patches/music/layout/tastebuilder/annotations/RemoveTasteBuilderCompatibility.kt index 9e7c6afc0..9930c61a1 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/tastebuilder/annotations/RemoveTasteBuilderCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/tastebuilder/annotations/RemoveTasteBuilderCompatibility.kt @@ -3,6 +3,11 @@ package app.revanced.patches.music.layout.tastebuilder.annotations import app.revanced.patcher.annotation.Compatibility import app.revanced.patcher.annotation.Package +/** + * -- Note 2022-08-05 -- + * Since 5.17.xx the tastebuilder component is dismissible, so this patch is less useful + * also it is partly litho now + */ @Compatibility( [Package( "com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51") @@ -11,4 +16,3 @@ import app.revanced.patcher.annotation.Package @Target(AnnotationTarget.CLASS) @Retention(AnnotationRetention.RUNTIME) internal annotation class RemoveTasteBuilderCompatibility - diff --git a/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/annotations/RemoveUpgradeButtonCompatibility.kt b/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/annotations/RemoveUpgradeButtonCompatibility.kt index ee6cb1913..8c146779d 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/annotations/RemoveUpgradeButtonCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/annotations/RemoveUpgradeButtonCompatibility.kt @@ -5,10 +5,9 @@ import app.revanced.patcher.annotation.Package @Compatibility( [Package( - "com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51") + "com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51") )] ) @Target(AnnotationTarget.CLASS) @Retention(AnnotationRetention.RUNTIME) internal annotation class RemoveUpgradeButtonCompatibility - diff --git a/src/main/kotlin/app/revanced/patches/music/misc/microg/annotations/MusicMicroGPatchCompatibility.kt b/src/main/kotlin/app/revanced/patches/music/misc/microg/annotations/MusicMicroGPatchCompatibility.kt index aaa361e67..097e82431 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/microg/annotations/MusicMicroGPatchCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/microg/annotations/MusicMicroGPatchCompatibility.kt @@ -5,9 +5,9 @@ import app.revanced.patcher.annotation.Package @Compatibility( [Package( - "com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51") + "com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51") )] ) @Target(AnnotationTarget.CLASS) @Retention(AnnotationRetention.RUNTIME) -internal annotation class MusicMicroGPatchCompatibility \ No newline at end of file +internal annotation class MusicMicroGPatchCompatibility diff --git a/src/main/kotlin/app/revanced/patches/music/premium/backgroundplay/annotations/BackgroundPlayCompatibility.kt b/src/main/kotlin/app/revanced/patches/music/premium/backgroundplay/annotations/BackgroundPlayCompatibility.kt index adc6c8a5c..6fc8652a2 100644 --- a/src/main/kotlin/app/revanced/patches/music/premium/backgroundplay/annotations/BackgroundPlayCompatibility.kt +++ b/src/main/kotlin/app/revanced/patches/music/premium/backgroundplay/annotations/BackgroundPlayCompatibility.kt @@ -5,10 +5,9 @@ import app.revanced.patcher.annotation.Package @Compatibility( [Package( - "com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51") + "com.google.android.apps.youtube.music", arrayOf("5.14.53", "5.16.51", "5.17.51") )] ) @Target(AnnotationTarget.CLASS) @Retention(AnnotationRetention.RUNTIME) internal annotation class BackgroundPlayCompatibility -