forked from ReVanced/revanced-patches
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(YouTube Music): Fix compatibility with latest versions (ReVanced#…
- Loading branch information
Showing
22 changed files
with
316 additions
and
356 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/kotlin/app/revanced/patches/music/ad/video/HideMusicVideoAds.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package app.revanced.patches.music.ad.video | ||
|
||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.annotation.CompatiblePackage | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod | ||
import app.revanced.patches.music.ad.video.fingerprints.ShowMusicVideoAdsParentFingerprint | ||
import app.revanced.util.exception | ||
|
||
@Patch( | ||
name = "Hide music video ads", | ||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], | ||
) | ||
@Suppress("unused") | ||
object HideMusicVideoAds : BytecodePatch( | ||
setOf(ShowMusicVideoAdsParentFingerprint), | ||
) { | ||
override fun execute(context: BytecodeContext) { | ||
ShowMusicVideoAdsParentFingerprint.result?.let { | ||
val showMusicVideoAdsMethod = context | ||
.toMethodWalker(it.mutableMethod) | ||
.nextMethod(it.scanResult.patternScanResult!!.startIndex + 1, true).getMethod() as MutableMethod | ||
|
||
showMusicVideoAdsMethod.addInstruction(0, "const/4 p1, 0x0") | ||
} ?: throw ShowMusicVideoAdsParentFingerprint.exception | ||
} | ||
} | ||
|
||
@Deprecated("This patch class has been renamed to HideMusicVideoAds.") | ||
object MusicVideoAdsPatch : BytecodePatch( | ||
dependencies = setOf(HideMusicVideoAds::class), | ||
) { | ||
override fun execute(context: BytecodeContext) { | ||
} | ||
} |
32 changes: 0 additions & 32 deletions
32
src/main/kotlin/app/revanced/patches/music/ad/video/MusicVideoAdsPatch.kt
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
...p/revanced/patches/music/ad/video/fingerprints/ShowMusicVideoAdsConstructorFingerprint.kt
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
...n/kotlin/app/revanced/patches/music/ad/video/fingerprints/ShowMusicVideoAdsFingerprint.kt
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
...in/app/revanced/patches/music/ad/video/fingerprints/ShowMusicVideoAdsParentFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package app.revanced.patches.music.ad.video.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.Opcode | ||
|
||
internal object ShowMusicVideoAdsParentFingerprint : MethodFingerprint( | ||
opcodes = listOf( | ||
Opcode.MOVE_RESULT_OBJECT, | ||
Opcode.INVOKE_VIRTUAL, | ||
Opcode.IGET_OBJECT, | ||
), | ||
strings = listOf("maybeRegenerateCpnAndStatsClient called unexpectedly, but no error."), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 13 additions & 8 deletions
21
...dio/exclusiveaudio/ExclusiveAudioPatch.kt → ...siveaudio/EnableExclusiveAudioPlayback.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,36 @@ | ||
package app.revanced.patches.music.audio.exclusiveaudio | ||
|
||
import app.revanced.util.exception | ||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.annotation.CompatiblePackage | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.music.audio.exclusiveaudio.fingerprints.AllowExclusiveAudioPlaybackFingerprint | ||
import app.revanced.util.exception | ||
|
||
@Patch( | ||
name = "Exclusive audio playback", | ||
name = "Enable exclusive audio playback", | ||
description = "Enables the option to play audio without video.", | ||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")] | ||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], | ||
) | ||
@Suppress("unused") | ||
object ExclusiveAudioPatch : BytecodePatch( | ||
setOf(AllowExclusiveAudioPlaybackFingerprint) | ||
object EnableExclusiveAudioPlayback : BytecodePatch( | ||
setOf(AllowExclusiveAudioPlaybackFingerprint), | ||
) { | ||
override fun execute(context: BytecodeContext) { | ||
AllowExclusiveAudioPlaybackFingerprint.result?.mutableMethod?.apply { | ||
addInstructions( | ||
0, | ||
""" | ||
""" | ||
const/4 v0, 0x1 | ||
return v0 | ||
""" | ||
""", | ||
) | ||
} ?: throw AllowExclusiveAudioPlaybackFingerprint.exception | ||
} | ||
} | ||
} | ||
|
||
@Deprecated("This patch class has been renamed to EnableExclusiveAudioPlayback.") | ||
object ExclusiveAudioPatch : BytecodePatch(emptySet()) { | ||
override fun execute(context: BytecodeContext) = EnableExclusiveAudioPlayback.execute(context) | ||
} |
17 changes: 12 additions & 5 deletions
17
...n/kotlin/app/revanced/patches/music/interaction/permanentshuffle/PermanentShufflePatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,32 @@ | ||
package app.revanced.patches.music.interaction.permanentshuffle | ||
|
||
import app.revanced.util.exception | ||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.annotation.CompatiblePackage | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.music.interaction.permanentshuffle.fingerprints.DisableShuffleFingerprint | ||
|
||
import app.revanced.util.exception | ||
|
||
@Patch( | ||
name = "Permanent shuffle", | ||
description = "Permanently remember your shuffle preference " + | ||
"even if the playlist ends or another track is played.", | ||
"even if the playlist ends or another track is played.", | ||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], | ||
use = false | ||
use = false, | ||
) | ||
@Suppress("unused") | ||
object PermanentShuffleTogglePatch : BytecodePatch(setOf(DisableShuffleFingerprint)) { | ||
object PermanentShufflePatch : BytecodePatch(setOf(DisableShuffleFingerprint)) { | ||
override fun execute(context: BytecodeContext) { | ||
DisableShuffleFingerprint.result?.mutableMethod?.addInstruction(0, "return-void") | ||
?: throw DisableShuffleFingerprint.exception | ||
} | ||
} | ||
|
||
@Deprecated("This patch class has been renamed to PermanentShufflePatch.") | ||
object PermanentShuffleTogglePatch : BytecodePatch( | ||
dependencies = setOf(PermanentShufflePatch::class), | ||
) { | ||
override fun execute(context: BytecodeContext) { | ||
} | ||
} |
34 changes: 0 additions & 34 deletions
34
src/main/kotlin/app/revanced/patches/music/layout/compactheader/CompactHeaderPatch.kt
This file was deleted.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
src/main/kotlin/app/revanced/patches/music/layout/compactheader/HideCategoryBar.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package app.revanced.patches.music.layout.compactheader | ||
|
||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions | ||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.annotation.CompatiblePackage | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.music.layout.compactheader.fingerprints.ConstructCategoryBarFingerprint | ||
import app.revanced.util.exception | ||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction | ||
|
||
@Patch( | ||
name = "Hide category bar", | ||
description = "Hides the category bar at the top of the homepage.", | ||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")], | ||
use = false, | ||
) | ||
@Suppress("unused") | ||
object HideCategoryBar : BytecodePatch( | ||
setOf(ConstructCategoryBarFingerprint), | ||
) { | ||
override fun execute(context: BytecodeContext) { | ||
ConstructCategoryBarFingerprint.result?.let { | ||
it.mutableMethod.apply { | ||
val insertIndex = it.scanResult.patternScanResult!!.startIndex | ||
val register = getInstruction<OneRegisterInstruction>(insertIndex - 1).registerA | ||
|
||
addInstructions( | ||
insertIndex, | ||
""" | ||
const/16 v2, 0x8 | ||
invoke-virtual {v$register, v2}, Landroid/view/View;->setVisibility(I)V | ||
""", | ||
) | ||
} | ||
} ?: throw ConstructCategoryBarFingerprint.exception | ||
} | ||
} | ||
|
||
@Deprecated("This patch class has been renamed to HideCategoryBar.") | ||
object CompactHeaderPatch : BytecodePatch( | ||
dependencies = setOf(HideCategoryBar::class), | ||
) { | ||
override fun execute(context: BytecodeContext) { | ||
} | ||
} |
Oops, something went wrong.