diff --git a/src/main/kotlin/app/revanced/patches/music/layout/amoled/patch/AmoledPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/amoled/patch/AmoledPatch.kt index 412639d26..1cf58b184 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/amoled/patch/AmoledPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/amoled/patch/AmoledPatch.kt @@ -7,13 +7,16 @@ import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.music.utils.annotations.MusicCompatibility +import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch import org.w3c.dom.Element @Patch @Name("Amoled") @Description("Applies pure black theme in flyout panels.") +@DependsOn([DecodingPatch::class]) @MusicCompatibility @Version("0.0.1") class AmoledPatch : ResourcePatch { diff --git a/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingIconMMTPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingIconMMTPatch.kt index 396967d83..008c46c69 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingIconMMTPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingIconMMTPatch.kt @@ -7,14 +7,17 @@ import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.music.utils.annotations.MusicCompatibility +import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch import app.revanced.util.resources.IconHelper.customIconMusic import app.revanced.util.resources.IconHelper.customIconMusicAdditional @Patch(false) @Name("Custom branding icon MMT") @Description("Changes the YouTube Music launcher icon to MMT.") +@DependsOn([DecodingPatch::class]) @MusicCompatibility @Version("0.0.1") class CustomBrandingIconMMTPatch : ResourcePatch { diff --git a/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingIconRevancifyBluePatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingIconRevancifyBluePatch.kt index 3226401ac..82343e323 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingIconRevancifyBluePatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingIconRevancifyBluePatch.kt @@ -7,13 +7,16 @@ import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.music.utils.annotations.MusicCompatibility +import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch import app.revanced.util.resources.IconHelper.customIconMusic @Patch @Name("Custom branding icon Revancify blue") @Description("Changes the YouTube Music launcher icon to Revancify Blue.") +@DependsOn([DecodingPatch::class]) @MusicCompatibility @Version("0.0.1") class CustomBrandingIconRevancifyBluePatch : ResourcePatch { diff --git a/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingIconRevancifyRedPatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingIconRevancifyRedPatch.kt index 32273c5b7..92d9b7ec3 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingIconRevancifyRedPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/branding/icon/patch/CustomBrandingIconRevancifyRedPatch.kt @@ -7,13 +7,16 @@ import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.music.utils.annotations.MusicCompatibility +import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch import app.revanced.util.resources.IconHelper.customIconMusic @Patch(false) @Name("Custom branding icon Revancify red") @Description("Changes the YouTube Music launcher icon to Revancify Red.") +@DependsOn([DecodingPatch::class]) @MusicCompatibility @Version("0.0.1") class CustomBrandingIconRevancifyRedPatch : ResourcePatch { diff --git a/src/main/kotlin/app/revanced/patches/music/layout/branding/name/patch/CustomBrandingNamePatch.kt b/src/main/kotlin/app/revanced/patches/music/layout/branding/name/patch/CustomBrandingNamePatch.kt index 95a6cd5b3..b0f818076 100644 --- a/src/main/kotlin/app/revanced/patches/music/layout/branding/name/patch/CustomBrandingNamePatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/layout/branding/name/patch/CustomBrandingNamePatch.kt @@ -10,13 +10,20 @@ import app.revanced.patcher.patch.PatchOption import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.music.utils.annotations.MusicCompatibility +import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch import org.w3c.dom.Element @Patch(false) @Name("Custom branding Music name") @Description("Rename the YouTube Music app to the name specified in options.json.") +@DependsOn( + [ + DecodingPatch::class + ] +) @MusicCompatibility @Version("0.0.1") class CustomBrandingNamePatch : ResourcePatch { diff --git a/src/main/kotlin/app/revanced/patches/music/misc/backgroundplay/patch/BackgroundPlayPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/backgroundplay/patch/BackgroundPlayPatch.kt index 2501075f3..e132d1eaa 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/backgroundplay/patch/BackgroundPlayPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/backgroundplay/patch/BackgroundPlayPatch.kt @@ -10,14 +10,17 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patches.music.misc.backgroundplay.fingerprints.BackgroundPlaybackParentFingerprint import app.revanced.patches.music.utils.annotations.MusicCompatibility +import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch @Patch @Name("Background play") @Description("Enables playing music in the background.") +@DependsOn([DecodingPatch::class]) @MusicCompatibility @Version("0.0.1") class BackgroundPlayPatch : BytecodePatch( diff --git a/src/main/kotlin/app/revanced/patches/music/misc/bitrate/patch/BitrateDefaultValuePatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/bitrate/patch/BitrateDefaultValuePatch.kt index 236a302aa..9ff52d10e 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/bitrate/patch/BitrateDefaultValuePatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/bitrate/patch/BitrateDefaultValuePatch.kt @@ -7,12 +7,15 @@ import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.music.utils.annotations.MusicCompatibility +import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch @Patch @Name("Bitrate default value") @Description("Set the audio quality to \"Always High\" when you first install the app.") +@DependsOn([DecodingPatch::class]) @MusicCompatibility @Version("0.0.1") class BitrateDefaultValuePatch : ResourcePatch { diff --git a/src/main/kotlin/app/revanced/patches/music/misc/exclusiveaudio/patch/ExclusiveAudioPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/exclusiveaudio/patch/ExclusiveAudioPatch.kt index 3f50f1d65..1d134bb41 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/exclusiveaudio/patch/ExclusiveAudioPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/exclusiveaudio/patch/ExclusiveAudioPatch.kt @@ -10,13 +10,16 @@ import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.music.misc.exclusiveaudio.fingerprints.AudioOnlyEnablerFingerprint import app.revanced.patches.music.utils.annotations.MusicCompatibility +import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch @Patch @Name("Exclusive audio playback") @Description("Enables the option to play music without video.") +@DependsOn([DecodingPatch::class]) @MusicCompatibility @Version("0.0.1") class ExclusiveAudioPatch : BytecodePatch( diff --git a/src/main/kotlin/app/revanced/patches/music/misc/optimizeresource/patch/OptimizeResourcePatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/optimizeresource/patch/OptimizeResourcePatch.kt index c5f97f067..26092e5c6 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/optimizeresource/patch/OptimizeResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/optimizeresource/patch/OptimizeResourcePatch.kt @@ -7,14 +7,17 @@ import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch +import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.music.utils.annotations.MusicCompatibility +import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch import java.nio.file.Files import java.nio.file.StandardCopyOption @Patch @Name("Optimize resource") @Description("Remove unnecessary resources.") +@DependsOn([DecodingPatch::class]) @MusicCompatibility @Version("0.0.1") class OptimizeResourcePatch : ResourcePatch { diff --git a/src/main/kotlin/app/revanced/patches/music/misc/premium/patch/HideGetPremiumPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/premium/patch/HideGetPremiumPatch.kt index d270653ed..978cfd28e 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/premium/patch/HideGetPremiumPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/premium/patch/HideGetPremiumPatch.kt @@ -17,6 +17,7 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patches.music.misc.premium.fingerprints.AccountMenuFooterFingerprint import app.revanced.patches.music.misc.premium.fingerprints.HideGetPremiumFingerprint import app.revanced.patches.music.utils.annotations.MusicCompatibility +import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.PrivacyTosFooter import app.revanced.util.bytecode.getWideLiteralIndex @@ -29,7 +30,12 @@ import org.jf.dexlib2.iface.reference.Reference @Patch @Name("Hide get premium") @Description("Hides \"Get Premium\" label from the account menu.") -@DependsOn([SharedResourceIdPatch::class]) +@DependsOn( + [ + DecodingPatch::class, + SharedResourceIdPatch::class + ] +) @MusicCompatibility @Version("0.0.1") class HideGetPremiumPatch : BytecodePatch( diff --git a/src/main/kotlin/app/revanced/patches/music/misc/tastebuilder/patch/TasteBuilderPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/tastebuilder/patch/TasteBuilderPatch.kt index 3dceb8196..9f320b932 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/tastebuilder/patch/TasteBuilderPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/tastebuilder/patch/TasteBuilderPatch.kt @@ -10,14 +10,17 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.music.misc.tastebuilder.fingerprints.TasteBuilderConstructorFingerprint import app.revanced.patches.music.utils.annotations.MusicCompatibility +import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction @Patch @Name("Hide taste builder") @Description("Hides the \"Tell us which artists you like\" card from homepage.") +@DependsOn([DecodingPatch::class]) @MusicCompatibility @Version("0.0.1") class TasteBuilderPatch : BytecodePatch( diff --git a/src/main/kotlin/app/revanced/patches/music/misc/upgradebutton/patch/UpgradeButtonPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/upgradebutton/patch/UpgradeButtonPatch.kt index 222c48b50..405a7caa5 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/upgradebutton/patch/UpgradeButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/upgradebutton/patch/UpgradeButtonPatch.kt @@ -17,6 +17,7 @@ import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.music.misc.upgradebutton.fingerprints.NotifierShelfFingerprint import app.revanced.patches.music.misc.upgradebutton.fingerprints.PivotBarConstructorFingerprint import app.revanced.patches.music.utils.annotations.MusicCompatibility +import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch import app.revanced.patches.music.utils.integrations.patch.IntegrationsPatch import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch import org.jf.dexlib2.iface.instruction.OneRegisterInstruction @@ -28,6 +29,7 @@ import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction @Description("Hides upgrade button from navigation bar and hide upgrade banner from homepage.") @DependsOn( [ + DecodingPatch::class, IntegrationsPatch::class, SharedResourceIdPatch::class ] diff --git a/src/main/kotlin/app/revanced/patches/music/utils/fix/androidauto/patch/AndroidAutoCertificatePatch.kt b/src/main/kotlin/app/revanced/patches/music/utils/fix/androidauto/patch/AndroidAutoCertificatePatch.kt index 95287f62e..1ae8669f8 100644 --- a/src/main/kotlin/app/revanced/patches/music/utils/fix/androidauto/patch/AndroidAutoCertificatePatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/utils/fix/androidauto/patch/AndroidAutoCertificatePatch.kt @@ -9,13 +9,16 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.fix.androidauto.fingerprints.CertificateCheckFingerprint +import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch @Patch @Name("Certificate spoof") @Description("Spoofs the YouTube Music certificate for Android Auto.") +@DependsOn([DecodingPatch::class]) @MusicCompatibility @Version("0.0.1") class AndroidAutoCertificatePatch : BytecodePatch( diff --git a/src/main/kotlin/app/revanced/patches/music/utils/fix/decoding/patch/DecodingPatch.kt b/src/main/kotlin/app/revanced/patches/music/utils/fix/decoding/patch/DecodingPatch.kt new file mode 100644 index 000000000..47ff8771f --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/music/utils/fix/decoding/patch/DecodingPatch.kt @@ -0,0 +1,34 @@ +package app.revanced.patches.music.utils.fix.decoding.patch + +import app.revanced.patcher.data.ResourceContext +import app.revanced.patcher.patch.PatchResult +import app.revanced.patcher.patch.PatchResultSuccess +import app.revanced.patcher.patch.ResourcePatch + +class DecodingPatch : ResourcePatch { + override fun execute(context: ResourceContext): PatchResult { + + /** + * For some reason, Androlib is incorrectly decoding some resources of YT Music + */ + arrayOf( + "res/layout/fullscreen_loading_spinner.xml", + "res/layout/notification_media_cancel_action.xml" + ).forEach { xmlPath -> + context[xmlPath].apply { + writeText( + readText() + .replace( + "@android:drawable/emulator_circular_window_overlay", + "@android:drawable/screen_background_dark_transparent" + ).replace( + "@android:drawable/ab_share_pack_material", + "@android:drawable/ic_menu_close_clear_cancel" + ) + ) + } + } + + return PatchResultSuccess() + } +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/music/utils/microg/bytecode/patch/MicroGPatch.kt b/src/main/kotlin/app/revanced/patches/music/utils/microg/bytecode/patch/MicroGPatch.kt index 88f12fcb3..9058d6860 100644 --- a/src/main/kotlin/app/revanced/patches/music/utils/microg/bytecode/patch/MicroGPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/utils/microg/bytecode/patch/MicroGPatch.kt @@ -11,6 +11,7 @@ import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.fix.clientspoof.patch.ClientSpoofMusicPatch +import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch import app.revanced.patches.music.utils.microg.bytecode.fingerprints.CastContextFetchFingerprint import app.revanced.patches.music.utils.microg.bytecode.fingerprints.CastDynamiteModuleFingerprint import app.revanced.patches.music.utils.microg.bytecode.fingerprints.CastDynamiteModuleV2Fingerprint @@ -27,6 +28,7 @@ import app.revanced.util.microg.MicroGBytecodeHelper @DependsOn( [ ClientSpoofMusicPatch::class, + DecodingPatch::class, MicroGResourcePatch::class, PackageNamePatch::class ] diff --git a/src/main/kotlin/app/revanced/patches/music/utils/settings/resource/patch/SettingsPatch.kt b/src/main/kotlin/app/revanced/patches/music/utils/settings/resource/patch/SettingsPatch.kt index 7360b62ea..d5a280516 100644 --- a/src/main/kotlin/app/revanced/patches/music/utils/settings/resource/patch/SettingsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/utils/settings/resource/patch/SettingsPatch.kt @@ -9,6 +9,7 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.music.utils.annotations.MusicCompatibility +import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch import app.revanced.patches.music.utils.settings.bytecode.patch.SettingsBytecodePatch import app.revanced.patches.shared.patch.settings.AbstractSettingsResourcePatch import app.revanced.util.enum.CategoryType @@ -29,7 +30,12 @@ import java.nio.file.Paths @Patch @Name("Settings") @Description("Adds settings for ReVanced to YouTube Music.") -@DependsOn([SettingsBytecodePatch::class]) +@DependsOn( + [ + DecodingPatch::class, + SettingsBytecodePatch::class + ] +) @MusicCompatibility @Version("0.0.1") class SettingsPatch : AbstractSettingsResourcePatch(