fix(music): compile issues due to wrong decoding

This commit is contained in:
inotia00
2023-07-23 21:40:38 +09:00
parent 58dd674ce6
commit ba53f73739
16 changed files with 89 additions and 2 deletions

View File

@ -7,13 +7,16 @@ import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch
import org.w3c.dom.Element import org.w3c.dom.Element
@Patch @Patch
@Name("Amoled") @Name("Amoled")
@Description("Applies pure black theme in flyout panels.") @Description("Applies pure black theme in flyout panels.")
@DependsOn([DecodingPatch::class])
@MusicCompatibility @MusicCompatibility
@Version("0.0.1") @Version("0.0.1")
class AmoledPatch : ResourcePatch { class AmoledPatch : ResourcePatch {

View File

@ -7,14 +7,17 @@ import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility 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.customIconMusic
import app.revanced.util.resources.IconHelper.customIconMusicAdditional import app.revanced.util.resources.IconHelper.customIconMusicAdditional
@Patch(false) @Patch(false)
@Name("Custom branding icon MMT") @Name("Custom branding icon MMT")
@Description("Changes the YouTube Music launcher icon to MMT.") @Description("Changes the YouTube Music launcher icon to MMT.")
@DependsOn([DecodingPatch::class])
@MusicCompatibility @MusicCompatibility
@Version("0.0.1") @Version("0.0.1")
class CustomBrandingIconMMTPatch : ResourcePatch { class CustomBrandingIconMMTPatch : ResourcePatch {

View File

@ -7,13 +7,16 @@ import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility 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.customIconMusic
@Patch @Patch
@Name("Custom branding icon Revancify blue") @Name("Custom branding icon Revancify blue")
@Description("Changes the YouTube Music launcher icon to Revancify Blue.") @Description("Changes the YouTube Music launcher icon to Revancify Blue.")
@DependsOn([DecodingPatch::class])
@MusicCompatibility @MusicCompatibility
@Version("0.0.1") @Version("0.0.1")
class CustomBrandingIconRevancifyBluePatch : ResourcePatch { class CustomBrandingIconRevancifyBluePatch : ResourcePatch {

View File

@ -7,13 +7,16 @@ import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility 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.customIconMusic
@Patch(false) @Patch(false)
@Name("Custom branding icon Revancify red") @Name("Custom branding icon Revancify red")
@Description("Changes the YouTube Music launcher icon to Revancify Red.") @Description("Changes the YouTube Music launcher icon to Revancify Red.")
@DependsOn([DecodingPatch::class])
@MusicCompatibility @MusicCompatibility
@Version("0.0.1") @Version("0.0.1")
class CustomBrandingIconRevancifyRedPatch : ResourcePatch { class CustomBrandingIconRevancifyRedPatch : ResourcePatch {

View File

@ -10,13 +10,20 @@ import app.revanced.patcher.patch.PatchOption
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch
import org.w3c.dom.Element import org.w3c.dom.Element
@Patch(false) @Patch(false)
@Name("Custom branding Music name") @Name("Custom branding Music name")
@Description("Rename the YouTube Music app to the name specified in options.json.") @Description("Rename the YouTube Music app to the name specified in options.json.")
@DependsOn(
[
DecodingPatch::class
]
)
@MusicCompatibility @MusicCompatibility
@Version("0.0.1") @Version("0.0.1")
class CustomBrandingNamePatch : ResourcePatch { class CustomBrandingNamePatch : ResourcePatch {

View File

@ -10,14 +10,17 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.music.misc.backgroundplay.fingerprints.BackgroundPlaybackParentFingerprint import app.revanced.patches.music.misc.backgroundplay.fingerprints.BackgroundPlaybackParentFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch
@Patch @Patch
@Name("Background play") @Name("Background play")
@Description("Enables playing music in the background.") @Description("Enables playing music in the background.")
@DependsOn([DecodingPatch::class])
@MusicCompatibility @MusicCompatibility
@Version("0.0.1") @Version("0.0.1")
class BackgroundPlayPatch : BytecodePatch( class BackgroundPlayPatch : BytecodePatch(

View File

@ -7,12 +7,15 @@ import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch
@Patch @Patch
@Name("Bitrate default value") @Name("Bitrate default value")
@Description("Set the audio quality to \"Always High\" when you first install the app.") @Description("Set the audio quality to \"Always High\" when you first install the app.")
@DependsOn([DecodingPatch::class])
@MusicCompatibility @MusicCompatibility
@Version("0.0.1") @Version("0.0.1")
class BitrateDefaultValuePatch : ResourcePatch { class BitrateDefaultValuePatch : ResourcePatch {

View File

@ -10,13 +10,16 @@ import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.misc.exclusiveaudio.fingerprints.AudioOnlyEnablerFingerprint import app.revanced.patches.music.misc.exclusiveaudio.fingerprints.AudioOnlyEnablerFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch
@Patch @Patch
@Name("Exclusive audio playback") @Name("Exclusive audio playback")
@Description("Enables the option to play music without video.") @Description("Enables the option to play music without video.")
@DependsOn([DecodingPatch::class])
@MusicCompatibility @MusicCompatibility
@Version("0.0.1") @Version("0.0.1")
class ExclusiveAudioPatch : BytecodePatch( class ExclusiveAudioPatch : BytecodePatch(

View File

@ -7,14 +7,17 @@ import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility 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.Files
import java.nio.file.StandardCopyOption import java.nio.file.StandardCopyOption
@Patch @Patch
@Name("Optimize resource") @Name("Optimize resource")
@Description("Remove unnecessary resources.") @Description("Remove unnecessary resources.")
@DependsOn([DecodingPatch::class])
@MusicCompatibility @MusicCompatibility
@Version("0.0.1") @Version("0.0.1")
class OptimizeResourcePatch : ResourcePatch { class OptimizeResourcePatch : ResourcePatch {

View File

@ -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.AccountMenuFooterFingerprint
import app.revanced.patches.music.misc.premium.fingerprints.HideGetPremiumFingerprint import app.revanced.patches.music.misc.premium.fingerprints.HideGetPremiumFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility 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
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.PrivacyTosFooter import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.PrivacyTosFooter
import app.revanced.util.bytecode.getWideLiteralIndex import app.revanced.util.bytecode.getWideLiteralIndex
@ -29,7 +30,12 @@ import org.jf.dexlib2.iface.reference.Reference
@Patch @Patch
@Name("Hide get premium") @Name("Hide get premium")
@Description("Hides \"Get Premium\" label from the account menu.") @Description("Hides \"Get Premium\" label from the account menu.")
@DependsOn([SharedResourceIdPatch::class]) @DependsOn(
[
DecodingPatch::class,
SharedResourceIdPatch::class
]
)
@MusicCompatibility @MusicCompatibility
@Version("0.0.1") @Version("0.0.1")
class HideGetPremiumPatch : BytecodePatch( class HideGetPremiumPatch : BytecodePatch(

View File

@ -10,14 +10,17 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.misc.tastebuilder.fingerprints.TasteBuilderConstructorFingerprint import app.revanced.patches.music.misc.tastebuilder.fingerprints.TasteBuilderConstructorFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility 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 import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
@Patch @Patch
@Name("Hide taste builder") @Name("Hide taste builder")
@Description("Hides the \"Tell us which artists you like\" card from homepage.") @Description("Hides the \"Tell us which artists you like\" card from homepage.")
@DependsOn([DecodingPatch::class])
@MusicCompatibility @MusicCompatibility
@Version("0.0.1") @Version("0.0.1")
class TasteBuilderPatch : BytecodePatch( class TasteBuilderPatch : BytecodePatch(

View File

@ -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.NotifierShelfFingerprint
import app.revanced.patches.music.misc.upgradebutton.fingerprints.PivotBarConstructorFingerprint import app.revanced.patches.music.misc.upgradebutton.fingerprints.PivotBarConstructorFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility 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.integrations.patch.IntegrationsPatch
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction 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.") @Description("Hides upgrade button from navigation bar and hide upgrade banner from homepage.")
@DependsOn( @DependsOn(
[ [
DecodingPatch::class,
IntegrationsPatch::class, IntegrationsPatch::class,
SharedResourceIdPatch::class SharedResourceIdPatch::class
] ]

View File

@ -9,13 +9,16 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility 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.androidauto.fingerprints.CertificateCheckFingerprint
import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch
@Patch @Patch
@Name("Certificate spoof") @Name("Certificate spoof")
@Description("Spoofs the YouTube Music certificate for Android Auto.") @Description("Spoofs the YouTube Music certificate for Android Auto.")
@DependsOn([DecodingPatch::class])
@MusicCompatibility @MusicCompatibility
@Version("0.0.1") @Version("0.0.1")
class AndroidAutoCertificatePatch : BytecodePatch( class AndroidAutoCertificatePatch : BytecodePatch(

View File

@ -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()
}
}

View File

@ -11,6 +11,7 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility 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.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.CastContextFetchFingerprint
import app.revanced.patches.music.utils.microg.bytecode.fingerprints.CastDynamiteModuleFingerprint import app.revanced.patches.music.utils.microg.bytecode.fingerprints.CastDynamiteModuleFingerprint
import app.revanced.patches.music.utils.microg.bytecode.fingerprints.CastDynamiteModuleV2Fingerprint import app.revanced.patches.music.utils.microg.bytecode.fingerprints.CastDynamiteModuleV2Fingerprint
@ -27,6 +28,7 @@ import app.revanced.util.microg.MicroGBytecodeHelper
@DependsOn( @DependsOn(
[ [
ClientSpoofMusicPatch::class, ClientSpoofMusicPatch::class,
DecodingPatch::class,
MicroGResourcePatch::class, MicroGResourcePatch::class,
PackageNamePatch::class PackageNamePatch::class
] ]

View File

@ -9,6 +9,7 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility 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.music.utils.settings.bytecode.patch.SettingsBytecodePatch
import app.revanced.patches.shared.patch.settings.AbstractSettingsResourcePatch import app.revanced.patches.shared.patch.settings.AbstractSettingsResourcePatch
import app.revanced.util.enum.CategoryType import app.revanced.util.enum.CategoryType
@ -29,7 +30,12 @@ import java.nio.file.Paths
@Patch @Patch
@Name("Settings") @Name("Settings")
@Description("Adds settings for ReVanced to YouTube Music.") @Description("Adds settings for ReVanced to YouTube Music.")
@DependsOn([SettingsBytecodePatch::class]) @DependsOn(
[
DecodingPatch::class,
SettingsBytecodePatch::class
]
)
@MusicCompatibility @MusicCompatibility
@Version("0.0.1") @Version("0.0.1")
class SettingsPatch : AbstractSettingsResourcePatch( class SettingsPatch : AbstractSettingsResourcePatch(