mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-06 09:34:37 +02:00
refactor: reformat code and optimize imports
This commit is contained in:
parent
0f820822cf
commit
bf643c23c5
@ -4,9 +4,11 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.MicroGCompatibility
|
||||
import app.revanced.patches.microg.utils.annotations.MicroGCompatibility
|
||||
import app.revanced.util.resources.MicroGResourceUtils.copyFiles
|
||||
|
||||
@Patch(false)
|
||||
|
@ -4,9 +4,11 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.MicroGCompatibility
|
||||
import app.revanced.patches.microg.utils.annotations.MicroGCompatibility
|
||||
import app.revanced.util.resources.MicroGResourceUtils.copyFiles
|
||||
|
||||
@Patch
|
||||
|
@ -5,9 +5,14 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.OptionsContainer
|
||||
import app.revanced.patcher.patch.PatchOption
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.MicroGCompatibility
|
||||
import app.revanced.patches.microg.utils.annotations.MicroGCompatibility
|
||||
import org.w3c.dom.Element
|
||||
|
||||
@Patch
|
||||
@ -25,7 +30,8 @@ class CustomBrandingNamePatch : ResourcePatch {
|
||||
if (!it.name.startsWithAny(*resourceFileNames)) return@forEach
|
||||
|
||||
context.xmlEditor[it.absolutePath].use { editor ->
|
||||
val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element
|
||||
val resourcesNode =
|
||||
editor.file.getElementsByTagName("resources").item(0) as Element
|
||||
var label = ""
|
||||
|
||||
for (i in 0 until resourcesNode.childNodes.length) {
|
||||
@ -42,7 +48,7 @@ class CustomBrandingNamePatch : ResourcePatch {
|
||||
element.textContent = appName
|
||||
}
|
||||
|
||||
"gms_settings_name"-> element.textContent = appName
|
||||
"gms_settings_name" -> element.textContent = appName
|
||||
|
||||
else -> continue
|
||||
}
|
||||
@ -62,10 +68,11 @@ class CustomBrandingNamePatch : ResourcePatch {
|
||||
}
|
||||
}
|
||||
|
||||
}?: return PatchResultError("No app name provided")
|
||||
} ?: return PatchResultError("No app name provided")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object : OptionsContainer() {
|
||||
var MicroGAppName: String? by option(
|
||||
PatchOption.StringOption(
|
||||
|
@ -9,7 +9,7 @@ import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.MicroGCompatibility
|
||||
import app.revanced.patches.microg.utils.annotations.MicroGCompatibility
|
||||
import org.w3c.dom.Element
|
||||
|
||||
@Patch(false)
|
||||
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.shared.annotation
|
||||
package app.revanced.patches.microg.utils.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
@ -6,4 +6,3 @@ import app.revanced.patcher.annotation.Package
|
||||
@Compatibility([Package("com.mgoogle.android.gms")])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class MicroGCompatibility
|
||||
|
@ -8,9 +8,9 @@ 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.litho.patch.MusicLithoFilterPatch
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.patches.shared.patch.videoads.AbstractVideoAdsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
|
||||
@ -24,7 +24,7 @@ import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
|
||||
MusicSettingsPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class MusicVideoAdsPatch : AbstractVideoAdsPatch(
|
||||
"$MUSIC_ADS_PATH/HideMusicAdsPatch;->hideMusicAds()Z"
|
||||
|
@ -8,13 +8,13 @@ import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import org.w3c.dom.Element
|
||||
|
||||
@Patch
|
||||
@Name("amoled")
|
||||
@Description("Applies pure black theme in flyout panels.")
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class AmoledPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
|
@ -12,9 +12,9 @@ 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.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.patches.shared.fingerprints.SubtitleTrackFingerprint
|
||||
import app.revanced.patches.shared.fingerprints.captions.SubtitleTrackFingerprint
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@ -23,7 +23,7 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Name("disable-auto-captions")
|
||||
@Description("Disable forced captions from automatically enabling in video player.")
|
||||
@DependsOn([MusicSettingsPatch::class])
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class DisableAutoCaptionsPatch : BytecodePatch(
|
||||
listOf(SubtitleTrackFingerprint)
|
||||
@ -44,7 +44,11 @@ class DisableAutoCaptionsPatch : BytecodePatch(
|
||||
}
|
||||
} ?: return SubtitleTrackFingerprint.toErrorResult()
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.LAYOUT, "revanced_disable_auto_captions", "false")
|
||||
MusicSettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
"revanced_disable_auto_captions",
|
||||
"false"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -12,10 +12,10 @@ 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.layout.blacknavbar.fingerprints.TabLayoutFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@ -29,7 +29,7 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
SharedResourceIdPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class BlackNavbarPatch : BytecodePatch(
|
||||
listOf(TabLayoutFingerprint)
|
||||
@ -50,7 +50,11 @@ class BlackNavbarPatch : BytecodePatch(
|
||||
}
|
||||
} ?: return TabLayoutFingerprint.toErrorResult()
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.LAYOUT, "revanced_enable_black_navbar", "true")
|
||||
MusicSettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
"revanced_enable_black_navbar",
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -4,16 +4,18 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.util.resources.IconHelper.customIconMusic
|
||||
import app.revanced.util.resources.IconHelper.customIconMusicAdditional
|
||||
|
||||
@Patch(false)
|
||||
@Name("custom-branding-music-mmt")
|
||||
@Description("Changes the YouTube Music launcher icon to MMT.")
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class CustomBrandingMusicIconMMTPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
|
@ -4,15 +4,17 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.util.resources.IconHelper.customIconMusic
|
||||
|
||||
@Patch
|
||||
@Name("custom-branding-music-revancify-blue")
|
||||
@Description("Changes the YouTube Music launcher icon to Revancify Blue.")
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class CustomBrandingMusicIconRevancifyBluePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
|
@ -4,15 +4,17 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.util.resources.IconHelper.customIconMusic
|
||||
|
||||
@Patch(false)
|
||||
@Name("custom-branding-music-revancify-red")
|
||||
@Description("Changes the YouTube Music launcher icon to Revancify Red.")
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class CustomBrandingMusicIconRevancifyRedPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
|
@ -5,15 +5,19 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.OptionsContainer
|
||||
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.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import org.w3c.dom.Element
|
||||
|
||||
@Patch(false)
|
||||
@Name("custom-branding-music-name")
|
||||
@Description("Changes the Music launcher name to your choice (defaults to YTM Extended, ReVanced Music Extended).")
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class CustomBrandingMusicNamePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
@ -27,7 +31,7 @@ class CustomBrandingMusicNamePatch : ResourcePatch {
|
||||
if (!it.name.startsWithAny(*resourceFileNames)) return@forEach
|
||||
|
||||
context.xmlEditor[it.absolutePath].use { editor ->
|
||||
val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element
|
||||
val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element
|
||||
|
||||
for (i in 0 until resourcesNode.childNodes.length) {
|
||||
val node = resourcesNode.childNodes.item(i)
|
||||
@ -45,6 +49,7 @@ class CustomBrandingMusicNamePatch : ResourcePatch {
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object : OptionsContainer() {
|
||||
var MusicLongName: String? by option(
|
||||
PatchOption.StringOption(
|
||||
|
@ -9,9 +9,9 @@ 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.litho.patch.MusicLithoFilterPatch
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.enum.CategoryType
|
||||
|
||||
@Patch
|
||||
@ -23,12 +23,16 @@ import app.revanced.util.enum.CategoryType
|
||||
MusicSettingsPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideButtonShelfPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.LAYOUT, "revanced_hide_button_shelf", "false")
|
||||
MusicSettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
"revanced_hide_button_shelf",
|
||||
"false"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -9,9 +9,9 @@ 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.litho.patch.MusicLithoFilterPatch
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.enum.CategoryType
|
||||
|
||||
@Patch
|
||||
@ -23,12 +23,16 @@ import app.revanced.util.enum.CategoryType
|
||||
MusicSettingsPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideCarouselShelfPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.LAYOUT, "revanced_hide_carousel_shelf", "false")
|
||||
MusicSettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
"revanced_hide_carousel_shelf",
|
||||
"false"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
|
||||
object HideCastButtonFingerprint : MethodFingerprint (
|
||||
object HideCastButtonFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("I")
|
||||
|
@ -4,7 +4,7 @@ import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
|
||||
object HideCastButtonParentFingerprint : MethodFingerprint (
|
||||
object HideCastButtonParentFingerprint : MethodFingerprint(
|
||||
returnType = "Z",
|
||||
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||
strings = listOf("MediaRouteButton")
|
||||
|
@ -12,17 +12,18 @@ 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.layout.castbutton.fingerprints.HideCastButtonFingerprint
|
||||
import app.revanced.patches.music.layout.castbutton.fingerprints.HideCastButtonParentFingerprint
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
|
||||
@Patch
|
||||
@Name("hide-music-cast-button")
|
||||
@Description("Hides the cast button in the video player and header.")
|
||||
@DependsOn([MusicSettingsPatch::class])
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideCastButtonPatch : BytecodePatch(
|
||||
listOf(HideCastButtonParentFingerprint)
|
||||
@ -30,7 +31,12 @@ class HideCastButtonPatch : BytecodePatch(
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
HideCastButtonParentFingerprint.result?.let { parentResult ->
|
||||
HideCastButtonFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.mutableMethod?.addInstructions(
|
||||
HideCastButtonFingerprint.also {
|
||||
it.resolve(
|
||||
context,
|
||||
parentResult.classDef
|
||||
)
|
||||
}.result?.mutableMethod?.addInstructions(
|
||||
0, """
|
||||
invoke-static {p1}, $MUSIC_LAYOUT->hideCastButton(I)I
|
||||
move-result p1
|
||||
@ -38,7 +44,11 @@ class HideCastButtonPatch : BytecodePatch(
|
||||
) ?: return HideCastButtonFingerprint.toErrorResult()
|
||||
} ?: return HideCastButtonParentFingerprint.toErrorResult()
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.LAYOUT, "revanced_hide_cast_button", "true")
|
||||
MusicSettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
"revanced_hide_cast_button",
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -12,10 +12,10 @@ 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.layout.categorybar.fingerprints.ChipCloudFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@ -29,7 +29,7 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
MusicSettingsPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class CategoryBarPatch : BytecodePatch(
|
||||
listOf(ChipCloudFingerprint)
|
||||
@ -47,7 +47,11 @@ class CategoryBarPatch : BytecodePatch(
|
||||
}
|
||||
} ?: return ChipCloudFingerprint.toErrorResult()
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.LAYOUT, "revanced_hide_category_bar", "true")
|
||||
MusicSettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
"revanced_hide_category_bar",
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -16,10 +16,10 @@ 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.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.layout.colormatchplayer.fingerprints.ColorMatchPlayerFingerprint
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.patches.shared.fingerprints.ColorMatchPlayerParentFingerprint
|
||||
import app.revanced.patches.music.utils.fingerprints.ColorMatchPlayerParentFingerprint
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
import org.jf.dexlib2.iface.instruction.Instruction
|
||||
@ -29,7 +29,7 @@ import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||
@Name("enable-color-match-player")
|
||||
@Description("Matches the fullscreen player color with the minimized one.")
|
||||
@DependsOn([MusicSettingsPatch::class])
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class ColorMatchPlayerPatch : BytecodePatch(
|
||||
listOf(ColorMatchPlayerParentFingerprint)
|
||||
@ -37,7 +37,12 @@ class ColorMatchPlayerPatch : BytecodePatch(
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
ColorMatchPlayerParentFingerprint.result?.let { parentResult ->
|
||||
ColorMatchPlayerFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
|
||||
ColorMatchPlayerFingerprint.also {
|
||||
it.resolve(
|
||||
context,
|
||||
parentResult.classDef
|
||||
)
|
||||
}.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
targetMethod = parentResult.mutableMethod
|
||||
|
||||
@ -72,10 +77,15 @@ class ColorMatchPlayerPatch : BytecodePatch(
|
||||
} ?: return ColorMatchPlayerFingerprint.toErrorResult()
|
||||
} ?: return ColorMatchPlayerParentFingerprint.toErrorResult()
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.LAYOUT, "revanced_enable_color_match_player", "true")
|
||||
MusicSettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
"revanced_enable_color_match_player",
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
private lateinit var targetMethod: MutableMethod
|
||||
|
||||
|
@ -13,10 +13,10 @@ 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.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.layout.compactdialog.fingerprints.DialogSolidFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
|
||||
@ -30,17 +30,18 @@ import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
SharedResourceIdPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class CompactDialogPatch : BytecodePatch(
|
||||
listOf(DialogSolidFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
DialogSolidFingerprint.result?.let {
|
||||
with(context
|
||||
.toMethodWalker(it.method)
|
||||
.nextMethod(it.scanResult.patternScanResult!!.endIndex, true)
|
||||
.getMethod() as MutableMethod
|
||||
with(
|
||||
context
|
||||
.toMethodWalker(it.method)
|
||||
.nextMethod(it.scanResult.patternScanResult!!.endIndex, true)
|
||||
.getMethod() as MutableMethod
|
||||
) {
|
||||
addInstructions(
|
||||
2, """
|
||||
@ -51,7 +52,11 @@ class CompactDialogPatch : BytecodePatch(
|
||||
}
|
||||
} ?: return DialogSolidFingerprint.toErrorResult()
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.LAYOUT, "revanced_enable_compact_dialog", "true")
|
||||
MusicSettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
"revanced_enable_compact_dialog",
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -12,9 +12,9 @@ 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.layout.dismissqueue.fingerprints.DismissQueueFingerprint
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@ -23,7 +23,7 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Name("enable-dismiss-queue")
|
||||
@Description("Add dismiss queue to flyout menu. (YT Music v6.04.51+)")
|
||||
@DependsOn([MusicSettingsPatch::class])
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class DismissQueuePatch : BytecodePatch(
|
||||
listOf(DismissQueueFingerprint)
|
||||
@ -44,7 +44,11 @@ class DismissQueuePatch : BytecodePatch(
|
||||
}
|
||||
} ?: return DismissQueueFingerprint.toErrorResult()
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.LAYOUT, "revanced_enable_dismiss_queue", "true")
|
||||
MusicSettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
"revanced_enable_dismiss_queue",
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -14,11 +14,11 @@ 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.smali.ExternalLabel
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.layout.floatingbutton.fingerprints.FloatingButtonFingerprint
|
||||
import app.revanced.patches.music.layout.floatingbutton.fingerprints.FloatingButtonParentFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
|
||||
@ -31,7 +31,7 @@ import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
SharedResourceIdPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class NewPlaylistButtonPatch : BytecodePatch(
|
||||
listOf(FloatingButtonParentFingerprint)
|
||||
@ -39,7 +39,12 @@ class NewPlaylistButtonPatch : BytecodePatch(
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
FloatingButtonParentFingerprint.result?.let { parentResult ->
|
||||
FloatingButtonFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
|
||||
FloatingButtonFingerprint.also {
|
||||
it.resolve(
|
||||
context,
|
||||
parentResult.classDef
|
||||
)
|
||||
}.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
addInstructionsWithLabels(
|
||||
1, """
|
||||
@ -53,7 +58,11 @@ class NewPlaylistButtonPatch : BytecodePatch(
|
||||
} ?: return FloatingButtonFingerprint.toErrorResult()
|
||||
} ?: return FloatingButtonParentFingerprint.toErrorResult()
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.LAYOUT, "revanced_hide_new_playlist_button", "false")
|
||||
MusicSettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
"revanced_hide_new_playlist_button",
|
||||
"false"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -11,10 +11,10 @@ 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.layout.landscapemode.fingerprints.TabletIdentifierFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
|
||||
@ -27,7 +27,7 @@ import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
SharedResourceIdPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class LandScapeModePatch : BytecodePatch(
|
||||
listOf(TabletIdentifierFingerprint)
|
||||
@ -42,7 +42,11 @@ class LandScapeModePatch : BytecodePatch(
|
||||
)
|
||||
} ?: return TabletIdentifierFingerprint.toErrorResult()
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.LAYOUT, "revanced_enable_landscape_mode", "true")
|
||||
MusicSettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
"revanced_enable_landscape_mode",
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -11,9 +11,9 @@ 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.layout.minimizedplayer.fingerprints.MinimizedPlayerFingerprint
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@ -22,7 +22,7 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Name("enable-force-minimized-player")
|
||||
@Description("Permanently keep player minimized even if another track is played.")
|
||||
@DependsOn([MusicSettingsPatch::class])
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class MinimizedPlayerPatch : BytecodePatch(
|
||||
listOf(MinimizedPlayerFingerprint)
|
||||
@ -30,9 +30,10 @@ class MinimizedPlayerPatch : BytecodePatch(
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
MinimizedPlayerFingerprint.result?.let {
|
||||
with (it.mutableMethod) {
|
||||
with(it.mutableMethod) {
|
||||
val index = it.scanResult.patternScanResult!!.endIndex
|
||||
val register = (implementation!!.instructions[index] as OneRegisterInstruction).registerA
|
||||
val register =
|
||||
(implementation!!.instructions[index] as OneRegisterInstruction).registerA
|
||||
|
||||
addInstructions(
|
||||
index, """
|
||||
@ -43,7 +44,11 @@ class MinimizedPlayerPatch : BytecodePatch(
|
||||
}
|
||||
} ?: return MinimizedPlayerFingerprint.toErrorResult()
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.LAYOUT, "revanced_enable_force_minimized_player", "true")
|
||||
MusicSettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
"revanced_enable_force_minimized_player",
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -13,12 +13,12 @@ import app.revanced.patcher.patch.PatchResultError
|
||||
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.layout.navigationlabel.fingerprints.TabLayoutTextFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.Text1
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch.Companion.contexts
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
@ -34,7 +34,7 @@ import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||
MusicSettingsPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class NavigationLabelPatch : BytecodePatch(
|
||||
listOf(TabLayoutTextFingerprint)
|
||||
@ -68,10 +68,15 @@ class NavigationLabelPatch : BytecodePatch(
|
||||
}
|
||||
}
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.LAYOUT, "revanced_hide_navigation_label", "false")
|
||||
MusicSettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
"revanced_hide_navigation_label",
|
||||
"false"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val FLAG = "android:layout_weight"
|
||||
const val RESOURCE_FILE_PATH = "res/layout/image_with_text_tab.xml"
|
||||
|
@ -12,9 +12,9 @@ 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.layout.newlayout.fingerprints.NewLayoutFingerprint
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@ -23,7 +23,7 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Name("enable-new-layout")
|
||||
@Description("Enable new player layouts. (YT Music v5.47.51+)")
|
||||
@DependsOn([MusicSettingsPatch::class])
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class NewLayoutPatch : BytecodePatch(
|
||||
listOf(NewLayoutFingerprint)
|
||||
@ -44,7 +44,11 @@ class NewLayoutPatch : BytecodePatch(
|
||||
}
|
||||
} ?: return NewLayoutFingerprint.toErrorResult()
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.LAYOUT, "revanced_enable_new_layout", "false")
|
||||
MusicSettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
"revanced_enable_new_layout",
|
||||
"false"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object NextButtonVisibilityFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
|
@ -13,11 +13,11 @@ 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.layout.oldstyleminiplayer.fingerprints.NextButtonVisibilityFingerprint
|
||||
import app.revanced.patches.music.layout.oldstyleminiplayer.fingerprints.SwipeToCloseFingerprint
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.patches.shared.fingerprints.ColorMatchPlayerParentFingerprint
|
||||
import app.revanced.patches.music.utils.fingerprints.ColorMatchPlayerParentFingerprint
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@ -26,7 +26,7 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Name("enable-old-style-miniplayer")
|
||||
@Description("Return the miniplayers to old style. (for YT Music v5.55.53+)")
|
||||
@DependsOn([MusicSettingsPatch::class])
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class OldStyleMiniPlayerPatch : BytecodePatch(
|
||||
listOf(
|
||||
@ -37,10 +37,16 @@ class OldStyleMiniPlayerPatch : BytecodePatch(
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
ColorMatchPlayerParentFingerprint.result?.let { parentResult ->
|
||||
NextButtonVisibilityFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
|
||||
NextButtonVisibilityFingerprint.also {
|
||||
it.resolve(
|
||||
context,
|
||||
parentResult.classDef
|
||||
)
|
||||
}.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex + 1
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
val targetRegister =
|
||||
getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
targetIndex + 1, """
|
||||
@ -66,7 +72,11 @@ class OldStyleMiniPlayerPatch : BytecodePatch(
|
||||
}
|
||||
} ?: return SwipeToCloseFingerprint.toErrorResult()
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.LAYOUT, "revanced_enable_old_style_mini_player", "false")
|
||||
MusicSettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
"revanced_enable_old_style_mini_player",
|
||||
"false"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -9,9 +9,9 @@ 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.litho.patch.MusicLithoFilterPatch
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.enum.CategoryType
|
||||
|
||||
@Patch
|
||||
@ -23,12 +23,16 @@ import app.revanced.util.enum.CategoryType
|
||||
MusicSettingsPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class HidePlaylistCardPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.LAYOUT, "revanced_hide_playlist_card", "false")
|
||||
MusicSettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
"revanced_hide_playlist_card",
|
||||
"false"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -12,9 +12,9 @@ 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.layout.sleeptimer.fingerprints.SleepTimerFingerprint
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@ -23,7 +23,7 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Name("enable-sleep-timer")
|
||||
@Description("Add sleep timer to flyout menu.")
|
||||
@DependsOn([MusicSettingsPatch::class])
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class SleepTimerPatch : BytecodePatch(
|
||||
listOf(SleepTimerFingerprint)
|
||||
@ -44,7 +44,11 @@ class SleepTimerPatch : BytecodePatch(
|
||||
}
|
||||
} ?: return SleepTimerFingerprint.toErrorResult()
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.LAYOUT, "revanced_enable_sleep_timer", "true")
|
||||
MusicSettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
"revanced_enable_sleep_timer",
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -14,10 +14,10 @@ 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.layout.zenmode.fingerprints.ZenModeFingerprint
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.patches.shared.fingerprints.ColorMatchPlayerParentFingerprint
|
||||
import app.revanced.patches.music.utils.fingerprints.ColorMatchPlayerParentFingerprint
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@ -27,7 +27,7 @@ import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||
@Name("enable-zen-mode")
|
||||
@Description("Adds a grey tint to the video player to reduce eye strain.")
|
||||
@DependsOn([MusicSettingsPatch::class])
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class ZenModePatch : BytecodePatch(
|
||||
listOf(ColorMatchPlayerParentFingerprint)
|
||||
@ -40,11 +40,13 @@ class ZenModePatch : BytecodePatch(
|
||||
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
|
||||
val firstRegister = getInstruction<OneRegisterInstruction>(startIndex).registerA
|
||||
val secondRegister = getInstruction<OneRegisterInstruction>(startIndex + 2).registerA
|
||||
val secondRegister =
|
||||
getInstruction<OneRegisterInstruction>(startIndex + 2).registerA
|
||||
val dummyRegister = secondRegister + 1
|
||||
|
||||
val referenceIndex = it.scanResult.patternScanResult!!.endIndex + 1
|
||||
val targetReference = getInstruction<ReferenceInstruction>(referenceIndex).reference.toString()
|
||||
val targetReference =
|
||||
getInstruction<ReferenceInstruction>(referenceIndex).reference.toString()
|
||||
|
||||
val insertIndex = referenceIndex + 1
|
||||
|
||||
@ -66,7 +68,11 @@ class ZenModePatch : BytecodePatch(
|
||||
} ?: return ZenModeFingerprint.toErrorResult()
|
||||
} ?: return ColorMatchPlayerParentFingerprint.toErrorResult()
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.LAYOUT, "revanced_enable_zen_mode", "false")
|
||||
MusicSettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
"revanced_enable_zen_mode",
|
||||
"false"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -12,26 +12,25 @@ import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.misc.backgroundplay.fingerprints.BackgroundPlaybackParentFingerprint
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
|
||||
@Patch
|
||||
@Name("background-play")
|
||||
@Description("Enables playing music in the background.")
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class BackgroundPlayPatch : BytecodePatch(
|
||||
listOf(
|
||||
BackgroundPlaybackParentFingerprint
|
||||
)
|
||||
listOf(BackgroundPlaybackParentFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
BackgroundPlaybackParentFingerprint.result?.let {
|
||||
with(context
|
||||
.toMethodWalker(it.method)
|
||||
.nextMethod(it.scanResult.patternScanResult!!.startIndex, true)
|
||||
.getMethod() as MutableMethod
|
||||
with(
|
||||
context
|
||||
.toMethodWalker(it.method)
|
||||
.nextMethod(it.scanResult.patternScanResult!!.startIndex, true)
|
||||
.getMethod() as MutableMethod
|
||||
) {
|
||||
addInstructions(
|
||||
0, """
|
||||
|
@ -8,17 +8,18 @@ import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
|
||||
@Patch
|
||||
@Name("bitrate-default-value")
|
||||
@Description("Set the audio quality to 'Always High' when you first install the app.")
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class BitrateDefaultValuePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
context.xmlEditor[RESOURCE_FILE_PATH].use { editor ->
|
||||
editor.file.getElementsByTagName("com.google.android.apps.youtube.music.ui.preference.PreferenceCategoryCompat").item(0).childNodes.apply {
|
||||
editor.file.getElementsByTagName("com.google.android.apps.youtube.music.ui.preference.PreferenceCategoryCompat")
|
||||
.item(0).childNodes.apply {
|
||||
arrayOf("BitrateAudioMobile", "BitrateAudioWiFi").forEach {
|
||||
for (i in 1 until length) {
|
||||
val view = item(i)
|
||||
@ -26,7 +27,8 @@ class BitrateDefaultValuePatch : ResourcePatch {
|
||||
view.hasAttributes() &&
|
||||
view.attributes.getNamedItem("android:key").nodeValue.endsWith(it)
|
||||
) {
|
||||
view.attributes.getNamedItem("android:defaultValue").nodeValue = "Always High"
|
||||
view.attributes.getNamedItem("android:defaultValue").nodeValue =
|
||||
"Always High"
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ 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.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.patches.shared.patch.opus.AbstractOpusCodecsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_MISC_PATH
|
||||
@ -18,7 +18,7 @@ import app.revanced.util.integrations.Constants.MUSIC_MISC_PATH
|
||||
@Name("enable-opus-codec")
|
||||
@Description("Enable opus codec when playing audio.")
|
||||
@DependsOn([MusicSettingsPatch::class])
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class CodecsUnlockPatch : AbstractOpusCodecsPatch(
|
||||
"$MUSIC_MISC_PATH/OpusCodecPatch;->enableOpusCodec()Z"
|
||||
@ -26,7 +26,11 @@ class CodecsUnlockPatch : AbstractOpusCodecsPatch(
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
super.execute(context)
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.MISC, "revanced_enable_opus_codec", "true")
|
||||
MusicSettingsPatch.addMusicPreference(
|
||||
CategoryType.MISC,
|
||||
"revanced_enable_opus_codec",
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object AudioOnlyEnablerFingerprint: MethodFingerprint(
|
||||
object AudioOnlyEnablerFingerprint : MethodFingerprint(
|
||||
returnType = "Z",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf(),
|
||||
|
@ -11,13 +11,13 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.misc.exclusiveaudio.fingerprints.AudioOnlyEnablerFingerprint
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
|
||||
@Patch
|
||||
@Name("exclusive-audio-playback")
|
||||
@Description("Enables the option to play music without video.")
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class ExclusiveAudioPatch : BytecodePatch(
|
||||
listOf(AudioOnlyEnablerFingerprint)
|
||||
|
@ -10,13 +10,13 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.misc.minimizedplayback.fingerprints.MinimizedPlaybackManagerFingerprint
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
|
||||
@Patch
|
||||
@Name("minimized-playback-music")
|
||||
@Description("Enables minimized playback on Kids music.")
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class MinimizedPlaybackPatch : BytecodePatch(
|
||||
listOf(MinimizedPlaybackManagerFingerprint)
|
||||
|
@ -8,14 +8,14 @@ import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.StandardCopyOption
|
||||
|
||||
@Patch
|
||||
@Name("optimize-resource-music")
|
||||
@Description("Remove unnecessary resources.")
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class OptimizeResourcePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
|
@ -14,11 +14,11 @@ 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.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.misc.premium.fingerprints.AccountMenuFooterFingerprint
|
||||
import app.revanced.patches.music.misc.premium.fingerprints.HideGetPremiumFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.PrivacyTosFooter
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@ -30,7 +30,7 @@ import org.jf.dexlib2.iface.reference.Reference
|
||||
@Name("hide-get-premium")
|
||||
@Description("Removes all \"Get Premium\" evidences from the avatar menu.")
|
||||
@DependsOn([SharedResourceIdPatch::class])
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideGetPremiumPatch : BytecodePatch(
|
||||
listOf(
|
||||
@ -58,17 +58,19 @@ class HideGetPremiumPatch : BytecodePatch(
|
||||
val targetIndex = getWideLiteralIndex(PrivacyTosFooter) + 4
|
||||
targetReference = getInstruction<ReferenceInstruction>(targetIndex + 1).reference
|
||||
|
||||
with (context
|
||||
.toMethodWalker(this)
|
||||
.nextMethod(targetIndex, true)
|
||||
.getMethod() as MutableMethod
|
||||
with(
|
||||
context
|
||||
.toMethodWalker(this)
|
||||
.nextMethod(targetIndex, true)
|
||||
.getMethod() as MutableMethod
|
||||
) {
|
||||
this.implementation!!.instructions.apply {
|
||||
for ((index, instruction) in withIndex()) {
|
||||
if (instruction.opcode != Opcode.IGET_OBJECT) continue
|
||||
|
||||
if (getInstruction<ReferenceInstruction>(index).reference == targetReference) {
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(index + 2).registerA
|
||||
val targetRegister =
|
||||
getInstruction<OneRegisterInstruction>(index + 2).registerA
|
||||
|
||||
addInstruction(
|
||||
index,
|
||||
@ -85,7 +87,8 @@ class HideGetPremiumPatch : BytecodePatch(
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
private companion object{
|
||||
|
||||
private companion object {
|
||||
lateinit var targetReference: Reference
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import org.jf.dexlib2.AccessFlags
|
||||
|
||||
object MusicVideoQualitySettingsParentFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
parameters = listOf("L"),
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(QualityTitle)}
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(QualityTitle) }
|
||||
)
|
@ -15,13 +15,13 @@ 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.misc.quality.fingerprints.MusicVideoQualitySettingsFingerprint
|
||||
import app.revanced.patches.music.misc.quality.fingerprints.MusicVideoQualitySettingsParentFingerprint
|
||||
import app.revanced.patches.music.misc.quality.fingerprints.UserQualityChangeFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.music.utils.videoid.patch.MusicVideoIdPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_MISC_PATH
|
||||
import org.jf.dexlib2.Opcode
|
||||
@ -41,7 +41,7 @@ import org.jf.dexlib2.iface.reference.Reference
|
||||
SharedResourceIdPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class VideoQualityPatch : BytecodePatch(
|
||||
listOf(
|
||||
@ -55,8 +55,10 @@ class VideoQualityPatch : BytecodePatch(
|
||||
it.mutableMethod.apply {
|
||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val qualityChangedClass =
|
||||
context.findClass((getInstruction<BuilderInstruction21c>(endIndex))
|
||||
.reference.toString())!!
|
||||
context.findClass(
|
||||
(getInstruction<BuilderInstruction21c>(endIndex))
|
||||
.reference.toString()
|
||||
)!!
|
||||
.mutableClass
|
||||
|
||||
for (method in qualityChangedClass.methods) {
|
||||
@ -65,8 +67,10 @@ class VideoQualityPatch : BytecodePatch(
|
||||
for ((index, instruction) in implementation!!.instructions.withIndex()) {
|
||||
if (instruction.opcode != Opcode.INVOKE_INTERFACE) continue
|
||||
|
||||
qualityReference = getInstruction<ReferenceInstruction>(index - 1).reference
|
||||
qIndexMethodName = ((getInstruction<Instruction35c>(index).reference) as MethodReference).name
|
||||
qualityReference =
|
||||
getInstruction<ReferenceInstruction>(index - 1).reference
|
||||
qIndexMethodName =
|
||||
((getInstruction<Instruction35c>(index).reference) as MethodReference).name
|
||||
|
||||
addInstruction(
|
||||
0,
|
||||
@ -81,7 +85,12 @@ class VideoQualityPatch : BytecodePatch(
|
||||
} ?: return UserQualityChangeFingerprint.toErrorResult()
|
||||
|
||||
MusicVideoQualitySettingsParentFingerprint.result?.let { parentResult ->
|
||||
MusicVideoQualitySettingsFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.mutableMethod?.addInstructions(
|
||||
MusicVideoQualitySettingsFingerprint.also {
|
||||
it.resolve(
|
||||
context,
|
||||
parentResult.classDef
|
||||
)
|
||||
}.result?.mutableMethod?.addInstructions(
|
||||
0, """
|
||||
const-string v0, "$qIndexMethodName"
|
||||
sput-object v0, $INTEGRATIONS_VIDEO_QUALITY_CLASS_DESCRIPTOR->qIndexMethod:Ljava/lang/String;
|
||||
@ -93,10 +102,15 @@ class VideoQualityPatch : BytecodePatch(
|
||||
} ?: return MusicVideoQualitySettingsParentFingerprint.toErrorResult()
|
||||
|
||||
MusicVideoIdPatch.injectCall("$INTEGRATIONS_VIDEO_QUALITY_CLASS_DESCRIPTOR->newVideoStarted(Ljava/lang/String;)V")
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.MISC, "revanced_enable_save_video_quality", "true")
|
||||
MusicSettingsPatch.addMusicPreference(
|
||||
CategoryType.MISC,
|
||||
"revanced_enable_save_video_quality",
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val INTEGRATIONS_VIDEO_QUALITY_CLASS_DESCRIPTOR =
|
||||
"$MUSIC_MISC_PATH/MusicVideoQualityPatch;"
|
||||
|
@ -5,6 +5,6 @@ import org.jf.dexlib2.Opcode
|
||||
|
||||
object ShowToastFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
parameters = listOf("Landroid/content/Context;","Ljava/lang/CharSequence;","I"),
|
||||
parameters = listOf("Landroid/content/Context;", "Ljava/lang/CharSequence;", "I"),
|
||||
opcodes = listOf(Opcode.IF_EQZ)
|
||||
)
|
||||
|
@ -15,10 +15,13 @@ 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.smali.ExternalLabel
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.misc.sharebuttonhook.fingerprints.ConnectionTrackerFingerprint
|
||||
import app.revanced.patches.music.misc.sharebuttonhook.fingerprints.FullStackTraceActivityFingerprint
|
||||
import app.revanced.patches.music.misc.sharebuttonhook.fingerprints.SharePanelFingerprint
|
||||
import app.revanced.patches.music.misc.sharebuttonhook.fingerprints.ShowToastFingerprint
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.music.misc.sharebuttonhook.fingerprints.*
|
||||
import app.revanced.patches.music.utils.videoid.patch.MusicVideoIdPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_INTEGRATIONS_PATH
|
||||
import app.revanced.util.integrations.Constants.MUSIC_MISC_PATH
|
||||
@ -32,7 +35,7 @@ import app.revanced.util.integrations.Constants.MUSIC_MISC_PATH
|
||||
MusicVideoIdPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class ShareButtonHookPatch : BytecodePatch(
|
||||
listOf(
|
||||
@ -48,7 +51,7 @@ class ShareButtonHookPatch : BytecodePatch(
|
||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
|
||||
addInstructionsWithLabels(
|
||||
targetIndex,"""
|
||||
targetIndex, """
|
||||
invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->overrideSharePanel()Z
|
||||
move-result p1
|
||||
if-eqz p1, :default
|
||||
@ -64,24 +67,33 @@ class ShareButtonHookPatch : BytecodePatch(
|
||||
) ?: return ConnectionTrackerFingerprint.toErrorResult()
|
||||
|
||||
ShowToastFingerprint.result?.mutableMethod?.addInstructions(
|
||||
0,"""
|
||||
0, """
|
||||
invoke-static {p0}, $INTEGRATIONS_CLASS_DESCRIPTOR->dismissContext(Landroid/content/Context;)Landroid/content/Context;
|
||||
move-result-object p0
|
||||
"""
|
||||
) ?: return ShowToastFingerprint.toErrorResult()
|
||||
|
||||
FullStackTraceActivityFingerprint.result?.mutableMethod?.addInstructions(
|
||||
1,"""
|
||||
1, """
|
||||
invoke-static {p0}, $MUSIC_INTEGRATIONS_PATH/settingsmenu/SharedPreferenceChangeListener;->initializeSettings(Landroid/app/Activity;)V
|
||||
return-void
|
||||
"""
|
||||
) ?: return FullStackTraceActivityFingerprint.toErrorResult()
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.MISC, "revanced_hook_share_button", "false")
|
||||
MusicSettingsPatch.addMusicPreferenceWithIntent(CategoryType.MISC, "revanced_default_downloader", "revanced_hook_share_button")
|
||||
MusicSettingsPatch.addMusicPreference(
|
||||
CategoryType.MISC,
|
||||
"revanced_hook_share_button",
|
||||
"false"
|
||||
)
|
||||
MusicSettingsPatch.addMusicPreferenceWithIntent(
|
||||
CategoryType.MISC,
|
||||
"revanced_default_downloader",
|
||||
"revanced_hook_share_button"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val INTEGRATIONS_CLASS_DESCRIPTOR = "$MUSIC_MISC_PATH/HookShareButtonPatch;"
|
||||
}
|
||||
|
@ -19,10 +19,12 @@ import app.revanced.patcher.util.TypeUtil.traverseClassHierarchy
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||
import app.revanced.patcher.util.smali.toInstructions
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.misc.shuffle.fingerprints.MusicPlaybackControlsFingerprint
|
||||
import app.revanced.patches.music.misc.shuffle.fingerprints.ShuffleClassFingerprint
|
||||
import app.revanced.patches.music.misc.shuffle.fingerprints.ShuffleClassReferenceFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.music.misc.shuffle.fingerprints.*
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_MISC_PATH
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
@ -44,7 +46,7 @@ import org.jf.dexlib2.immutable.ImmutableMethodParameter
|
||||
SharedResourceIdPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class EnforceShufflePatch : BytecodePatch(
|
||||
listOf(
|
||||
@ -163,7 +165,11 @@ class EnforceShufflePatch : BytecodePatch(
|
||||
}
|
||||
} ?: return MusicPlaybackControlsFingerprint.toErrorResult()
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.MISC, "revanced_enable_force_shuffle", "true")
|
||||
MusicSettingsPatch.addMusicPreference(
|
||||
CategoryType.MISC,
|
||||
"revanced_enable_force_shuffle",
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -11,14 +11,14 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.misc.tastebuilder.fingerprints.TasteBuilderConstructorFingerprint
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@Name("hide-taste-builder")
|
||||
@Description("Removes the \"Tell us which artists you like\" card from the home screen.")
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class RemoveTasteBuilderPatch : BytecodePatch(
|
||||
listOf(TasteBuilderConstructorFingerprint)
|
||||
|
@ -9,15 +9,15 @@ 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.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.resources.ResourceHelper.addTranslations
|
||||
|
||||
@Patch
|
||||
@Name("translations-music")
|
||||
@Description("Add Crowdin translations for YouTube Music.")
|
||||
@DependsOn([MusicSettingsPatch::class])
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class MusicTranslationsPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
|
@ -16,6 +16,6 @@ object NotifierShelfFingerprint : MethodFingerprint(
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.MOVE_RESULT_OBJECT
|
||||
),
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(MusicNotifierShelf)}
|
||||
customFingerprint = { it, _ -> it.isWideLiteralExists(MusicNotifierShelf) }
|
||||
)
|
||||
|
||||
|
@ -14,11 +14,11 @@ 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.misc.upgradebutton.fingerprints.NotifierShelfFingerprint
|
||||
import app.revanced.patches.music.misc.upgradebutton.fingerprints.PivotBarConstructorFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.patch.MusicIntegrationsPatch
|
||||
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.misc.upgradebutton.fingerprints.*
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.integrations.Constants.INTEGRATIONS_PATH
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
@ -32,7 +32,7 @@ import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
SharedResourceIdPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class RemoveUpgradeButtonPatch : BytecodePatch(
|
||||
listOf(
|
||||
@ -47,14 +47,15 @@ class RemoveUpgradeButtonPatch : BytecodePatch(
|
||||
val targetRegisterA = getInstruction<TwoRegisterInstruction>(targetIndex).registerA
|
||||
val targetRegisterB = getInstruction<TwoRegisterInstruction>(targetIndex).registerB
|
||||
|
||||
val replaceReference = getInstruction<ReferenceInstruction>(targetIndex).reference.toString()
|
||||
val replaceReference =
|
||||
getInstruction<ReferenceInstruction>(targetIndex).reference.toString()
|
||||
|
||||
replaceInstruction(
|
||||
targetIndex,
|
||||
"invoke-interface {v$targetRegisterA}, Ljava/util/List;->size()I"
|
||||
)
|
||||
addInstructionsWithLabels(
|
||||
targetIndex + 1,"""
|
||||
targetIndex + 1, """
|
||||
move-result v1
|
||||
const/4 v2, 0x3
|
||||
if-le v1, v2, :dismiss
|
||||
|
@ -8,8 +8,8 @@ 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.settings.resource.patch.MusicSettingsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.patches.shared.patch.versionspoof.AbstractVersionSpoofPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_MISC_PATH
|
||||
@ -18,14 +18,18 @@ import app.revanced.util.integrations.Constants.MUSIC_MISC_PATH
|
||||
@Name("spoof-app-version")
|
||||
@Description("Spoof the YouTube Music client version.")
|
||||
@DependsOn([MusicSettingsPatch::class])
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class SpoofAppVersionPatch : AbstractVersionSpoofPatch(
|
||||
"$MUSIC_MISC_PATH/SpoofAppVersionPatch;->getVersionOverride(Ljava/lang/String;)Ljava/lang/String;"
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
MusicSettingsPatch.addMusicPreference(CategoryType.MISC, "revanced_spoof_app_version", "false")
|
||||
MusicSettingsPatch.addMusicPreference(
|
||||
CategoryType.MISC,
|
||||
"revanced_spoof_app_version",
|
||||
"false"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
package app.revanced.patches.shared.annotation
|
||||
package app.revanced.patches.music.utils.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.apps.youtube.music")])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class YouTubeMusicCompatibility
|
||||
|
||||
internal annotation class MusicCompatibility
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.shared.fingerprints
|
||||
package app.revanced.patches.music.utils.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -10,13 +10,13 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
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.shared.annotation.YouTubeMusicCompatibility
|
||||
|
||||
@Patch
|
||||
@Name("certificate-spoof")
|
||||
@Description("Spoofs the YouTube Music certificate for Android Auto.")
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class AndroidAutoCertificatePatch : BytecodePatch(
|
||||
listOf(CertificateCheckFingerprint)
|
||||
|
@ -10,14 +10,14 @@ 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.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.fix.clientspoof.fingerprints.UserAgentHeaderBuilderFingerprint
|
||||
import app.revanced.patches.music.utils.microg.shared.Constants.MUSIC_PACKAGE_NAME
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
|
||||
@Name("client-spoof-music")
|
||||
@Description("Spoofs the YouTube Music client.")
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class ClientSpoofMusicPatch : BytecodePatch(
|
||||
listOf(UserAgentHeaderBuilderFingerprint)
|
||||
@ -27,7 +27,8 @@ class ClientSpoofMusicPatch : BytecodePatch(
|
||||
UserAgentHeaderBuilderFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex - 1
|
||||
val packageNameRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerD
|
||||
val packageNameRegister =
|
||||
getInstruction<FiveRegisterInstruction>(insertIndex).registerD
|
||||
|
||||
addInstruction(
|
||||
insertIndex,
|
||||
|
@ -2,13 +2,13 @@ package app.revanced.patches.music.utils.integrations.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.patch.annotations.RequiresIntegrations
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.integrations.fingerprints.InitFingerprint
|
||||
import app.revanced.patches.shared.patch.integrations.AbstractIntegrationsPatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.integrations.Constants.MUSIC_INTEGRATIONS_PATH
|
||||
|
||||
@Name("music-integrations")
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@RequiresIntegrations
|
||||
class MusicIntegrationsPatch : AbstractIntegrationsPatch(
|
||||
"$MUSIC_INTEGRATIONS_PATH/utils/ReVancedUtils;",
|
||||
|
@ -6,14 +6,14 @@ 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.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.patches.shared.fingerprints.IdentifierFingerprint
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.shared.fingerprints.litho.IdentifierFingerprint
|
||||
import app.revanced.patches.shared.patch.litho.ComponentParserPatch
|
||||
import app.revanced.patches.shared.patch.litho.ComponentParserPatch.Companion.identifierHook
|
||||
import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
|
||||
|
||||
@DependsOn([ComponentParserPatch::class])
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class MusicLithoFilterPatch : BytecodePatch(
|
||||
listOf(IdentifierFingerprint)
|
||||
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.misc.microg.bytecode.patch
|
||||
package app.revanced.patches.music.utils.microg.bytecode.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
@ -9,17 +9,17 @@ 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.clientspoof.patch.ClientSpoofMusicPatch
|
||||
import app.revanced.patches.music.utils.microg.resource.patch.MusicMicroGResourcePatch
|
||||
import app.revanced.patches.music.utils.microg.shared.Constants.MUSIC_PACKAGE_NAME
|
||||
import app.revanced.patches.music.utils.microg.shared.Constants.YOUTUBE_PACKAGE_NAME
|
||||
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
|
||||
import app.revanced.patches.music.utils.microg.bytecode.fingerprints.GooglePlayUtilityFingerprint
|
||||
import app.revanced.patches.music.utils.microg.bytecode.fingerprints.PrimeFingerprint
|
||||
import app.revanced.patches.music.utils.microg.bytecode.fingerprints.ServiceCheckFingerprint
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.patches.music.utils.microg.resource.patch.MusicMicroGResourcePatch
|
||||
import app.revanced.patches.music.utils.microg.shared.Constants.MUSIC_PACKAGE_NAME
|
||||
import app.revanced.patches.music.utils.microg.shared.Constants.YOUTUBE_PACKAGE_NAME
|
||||
import app.revanced.patches.shared.patch.packagename.PackageNamePatch
|
||||
import app.revanced.util.microg.MicroGBytecodeHelper
|
||||
|
||||
@ -33,7 +33,7 @@ import app.revanced.util.microg.MicroGBytecodeHelper
|
||||
)
|
||||
@Name("music-microg-support")
|
||||
@Description("Allows ReVanced Music to run without root and under a different package name with MicroG.")
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.2")
|
||||
class MusicMicroGBytecodePatch : BytecodePatch(
|
||||
listOf(
|
||||
|
@ -8,10 +8,10 @@ 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.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.microg.shared.Constants.MUSIC_PACKAGE_NAME
|
||||
import app.revanced.patches.music.utils.microg.shared.Constants.SPOOFED_PACKAGE_NAME
|
||||
import app.revanced.patches.music.utils.microg.shared.Constants.SPOOFED_PACKAGE_SIGNATURE
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.patches.shared.patch.packagename.PackageNamePatch
|
||||
import app.revanced.util.microg.MicroGManifestHelper.addSpoofingMetadata
|
||||
import app.revanced.util.microg.MicroGResourceHelper.patchManifest
|
||||
@ -20,7 +20,7 @@ import app.revanced.util.resources.MusicResourceHelper.setMicroG
|
||||
@Name("music-microg-resource-patch")
|
||||
@Description("Resource patch to allow YouTube Music ReVanced to run without root and under a different package name.")
|
||||
@DependsOn([PackageNamePatch::class])
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.2")
|
||||
class MusicMicroGResourcePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
|
@ -8,14 +8,20 @@ import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
|
||||
import app.revanced.util.enum.ResourceType
|
||||
import app.revanced.util.enum.ResourceType.*
|
||||
import app.revanced.util.enum.ResourceType.BOOL
|
||||
import app.revanced.util.enum.ResourceType.COLOR
|
||||
import app.revanced.util.enum.ResourceType.DIMEN
|
||||
import app.revanced.util.enum.ResourceType.ID
|
||||
import app.revanced.util.enum.ResourceType.LAYOUT
|
||||
import app.revanced.util.enum.ResourceType.STRING
|
||||
import app.revanced.util.enum.ResourceType.STYLE
|
||||
|
||||
@Name("music-resource-id")
|
||||
@DependsOn([ResourceMappingPatch::class])
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class SharedResourceIdPatch : ResourcePatch {
|
||||
internal companion object {
|
||||
|
@ -10,17 +10,17 @@ 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.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.integrations.patch.MusicIntegrationsPatch
|
||||
import app.revanced.patches.music.utils.settings.bytecode.fingerprints.PreferenceFingerprint
|
||||
import app.revanced.patches.music.utils.settings.bytecode.fingerprints.SettingsHeadersFragmentFingerprint
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.integrations.Constants.MUSIC_INTEGRATIONS_PATH
|
||||
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Name("music-settings-bytecode-patch")
|
||||
@DependsOn([MusicIntegrationsPatch::class])
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class MusicSettingsBytecodePatch : BytecodePatch(
|
||||
listOf(
|
||||
@ -57,6 +57,7 @@ class MusicSettingsBytecodePatch : BytecodePatch(
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"$MUSIC_INTEGRATIONS_PATH/settingsmenu/SharedPreferenceChangeListener;"
|
||||
|
@ -8,8 +8,8 @@ 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.settings.bytecode.patch.MusicSettingsBytecodePatch
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.patches.shared.patch.settings.AbstractSettingsResourcePatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.resources.IconHelper
|
||||
@ -29,7 +29,7 @@ import java.nio.file.Paths
|
||||
@Name("music-settings")
|
||||
@Description("Adds settings for ReVanced to YouTube Music.")
|
||||
@DependsOn([MusicSettingsBytecodePatch::class])
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class MusicSettingsPatch : AbstractSettingsResourcePatch(
|
||||
"music/settings",
|
||||
@ -67,8 +67,11 @@ class MusicSettingsPatch : AbstractSettingsResourcePatch(
|
||||
|
||||
if (File(targetDirectory).exists()) {
|
||||
fun copyResources(resourceGroups: List<ResourceUtils.ResourceGroup>) {
|
||||
try { context.copyFiles(resourceGroups, iconPath) }
|
||||
catch (_: Exception) { context.makeDirectoryAndCopyFiles(resourceGroups, iconPath) }
|
||||
try {
|
||||
context.copyFiles(resourceGroups, iconPath)
|
||||
} catch (_: Exception) {
|
||||
context.makeDirectoryAndCopyFiles(resourceGroups, iconPath)
|
||||
}
|
||||
}
|
||||
|
||||
val iconResourceFileNames =
|
||||
@ -88,6 +91,7 @@ class MusicSettingsPatch : AbstractSettingsResourcePatch(
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object {
|
||||
lateinit var contexts: ResourceContext
|
||||
|
||||
|
@ -12,5 +12,5 @@ object MusicVideoIdFingerprint : MethodFingerprint(
|
||||
Opcode.INVOKE_INTERFACE,
|
||||
Opcode.MOVE_RESULT_OBJECT
|
||||
),
|
||||
customFingerprint = { it, _ -> it.definingClass.endsWith("SubtitlesOverlayPresenter;") && it.name == "handleVideoStageEvent" }
|
||||
customFingerprint = { it, _ -> it.definingClass.endsWith("SubtitlesOverlayPresenter;") && it.name == "handleVideoStageEvent" }
|
||||
)
|
||||
|
@ -11,14 +11,14 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.videoid.fingerprint.MusicVideoIdFingerprint
|
||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||
import app.revanced.util.integrations.Constants.MUSIC_UTILS_PATH
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Name("music-video-id-hook")
|
||||
@Description("Hook to detect when the video id changes.")
|
||||
@YouTubeMusicCompatibility
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class MusicVideoIdPatch : BytecodePatch(
|
||||
listOf(MusicVideoIdFingerprint)
|
||||
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.shared.fingerprints
|
||||
package app.revanced.patches.shared.fingerprints.captions
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.shared.fingerprints
|
||||
package app.revanced.patches.shared.fingerprints.litho
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.Opcode
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.shared.fingerprints
|
||||
package app.revanced.patches.shared.fingerprints.litho
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.shared.fingerprints
|
||||
package app.revanced.patches.shared.fingerprints.litho
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.shared.fingerprints
|
||||
package app.revanced.patches.shared.fingerprints.opus
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.shared.fingerprints
|
||||
package app.revanced.patches.shared.fingerprints.opus
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.shared.fingerprints
|
||||
package app.revanced.patches.shared.fingerprints.versionspoof
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.shared.fingerprints
|
||||
package app.revanced.patches.shared.fingerprints.versionspoof
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.shared.fingerprints
|
||||
package app.revanced.patches.shared.fingerprints.videoads
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
@ -8,7 +8,7 @@ import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
|
||||
|
||||
object LegacyVideoAdsFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf(),
|
||||
opcodes = listOf(
|
||||
Opcode.CONST_WIDE_16,
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.shared.fingerprints
|
||||
package app.revanced.patches.shared.fingerprints.videoads
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
|
@ -10,6 +10,7 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patches.shared.patch.integrations.AbstractIntegrationsPatch.IntegrationsFingerprint.RegisterResolver
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.iface.ClassDef
|
||||
import org.jf.dexlib2.iface.Method
|
||||
|
@ -16,9 +16,9 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMut
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.annotation.RVXCompatibility
|
||||
import app.revanced.patches.shared.fingerprints.ByteBufferHookFingerprint
|
||||
import app.revanced.patches.shared.fingerprints.EmptyComponentBuilderFingerprint
|
||||
import app.revanced.patches.shared.fingerprints.IdentifierFingerprint
|
||||
import app.revanced.patches.shared.fingerprints.litho.ByteBufferHookFingerprint
|
||||
import app.revanced.patches.shared.fingerprints.litho.EmptyComponentBuilderFingerprint
|
||||
import app.revanced.patches.shared.fingerprints.litho.IdentifierFingerprint
|
||||
import app.revanced.util.bytecode.getStringIndex
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
@ -45,8 +45,10 @@ class ComponentParserPatch : BytecodePatch(
|
||||
EmptyComponentBuilderFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = getStringIndex("Failed to convert Element to Flatbuffers: %s") + 2
|
||||
val builderMethodDescriptor = getInstruction<ReferenceInstruction>(targetIndex).reference
|
||||
val emptyComponentFieldDescriptor = getInstruction<ReferenceInstruction>(targetIndex + 2).reference
|
||||
val builderMethodDescriptor =
|
||||
getInstruction<ReferenceInstruction>(targetIndex).reference
|
||||
val emptyComponentFieldDescriptor =
|
||||
getInstruction<ReferenceInstruction>(targetIndex + 2).reference
|
||||
|
||||
emptyComponentLabel = """
|
||||
move-object/from16 v0, p1
|
||||
@ -75,14 +77,15 @@ class ComponentParserPatch : BytecodePatch(
|
||||
.toMethodWalker(it.method)
|
||||
.nextMethod(it.scanResult.patternScanResult!!.endIndex, true)
|
||||
.getMethod() as MutableMethod
|
||||
).apply {
|
||||
val methodName = EmptyComponentBuilderFingerprint.result!!.mutableMethod.definingClass
|
||||
).apply {
|
||||
val methodName =
|
||||
EmptyComponentBuilderFingerprint.result!!.mutableMethod.definingClass
|
||||
|
||||
addInstruction(
|
||||
0,
|
||||
"sput-object p2, $methodName->buffer:Ljava/nio/ByteBuffer;"
|
||||
)
|
||||
}
|
||||
addInstruction(
|
||||
0,
|
||||
"sput-object p2, $methodName->buffer:Ljava/nio/ByteBuffer;"
|
||||
)
|
||||
}
|
||||
} ?: return ByteBufferHookFingerprint.toErrorResult()
|
||||
|
||||
IdentifierFingerprint.result?.let {
|
||||
@ -91,7 +94,8 @@ class ComponentParserPatch : BytecodePatch(
|
||||
|
||||
val stringBuilderIndex =
|
||||
implementation!!.instructions.indexOfFirst { instruction ->
|
||||
val fieldReference = (instruction as? ReferenceInstruction)?.reference as? FieldReference
|
||||
val fieldReference =
|
||||
(instruction as? ReferenceInstruction)?.reference as? FieldReference
|
||||
fieldReference?.let { reference -> reference.type == "Ljava/lang/StringBuilder;" } == true
|
||||
}
|
||||
|
||||
@ -101,8 +105,10 @@ class ComponentParserPatch : BytecodePatch(
|
||||
instruction.opcode == Opcode.CONST
|
||||
}
|
||||
|
||||
stringBuilderRegister = getInstruction<TwoRegisterInstruction>(stringBuilderIndex).registerA
|
||||
identifierRegister = getInstruction<OneRegisterInstruction>(identifierIndex).registerA
|
||||
stringBuilderRegister =
|
||||
getInstruction<TwoRegisterInstruction>(stringBuilderIndex).registerA
|
||||
identifierRegister =
|
||||
getInstruction<OneRegisterInstruction>(identifierIndex).registerA
|
||||
objectRegister = getInstruction<BuilderInstruction35c>(objectIndex).registerC
|
||||
freeRegister = getInstruction<OneRegisterInstruction>(freeIndex).registerA
|
||||
|
||||
@ -129,12 +135,14 @@ class ComponentParserPatch : BytecodePatch(
|
||||
) {
|
||||
insertMethod.apply {
|
||||
addInstructionsWithLabels(
|
||||
insertIndex, """
|
||||
insertIndex,
|
||||
"""
|
||||
sget-object v$freeRegister, $definingClass->buffer:Ljava/nio/ByteBuffer;
|
||||
invoke-static {v$stringBuilderRegister, v$identifierRegister, v$objectRegister, v$freeRegister}, $descriptor(Ljava/lang/StringBuilder;Ljava/lang/String;Ljava/lang/Object;Ljava/nio/ByteBuffer;)Z
|
||||
move-result v$freeRegister
|
||||
if-eqz v$freeRegister, :not_an_ad
|
||||
""" + emptyComponentLabel, ExternalLabel("not_an_ad", getInstruction(insertIndex))
|
||||
""" + emptyComponentLabel,
|
||||
ExternalLabel("not_an_ad", getInstruction(insertIndex))
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -144,11 +152,13 @@ class ComponentParserPatch : BytecodePatch(
|
||||
) {
|
||||
insertMethod.apply {
|
||||
addInstructionsWithLabels(
|
||||
insertIndex, """
|
||||
insertIndex,
|
||||
"""
|
||||
invoke-static {v$stringBuilderRegister, v$identifierRegister}, $descriptor(Ljava/lang/StringBuilder;Ljava/lang/String;)Z
|
||||
move-result v$freeRegister
|
||||
if-eqz v$freeRegister, :not_an_ad
|
||||
""" + emptyComponentLabel, ExternalLabel("not_an_ad", getInstruction(insertIndex))
|
||||
""" + emptyComponentLabel,
|
||||
ExternalLabel("not_an_ad", getInstruction(insertIndex))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import org.w3c.dom.Element
|
||||
import java.util.*
|
||||
import java.util.Collections
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
|
@ -11,8 +11,8 @@ import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.fingerprints.CodecReferenceFingerprint
|
||||
import app.revanced.patches.shared.fingerprints.CodecSelectorFingerprint
|
||||
import app.revanced.patches.shared.fingerprints.opus.CodecReferenceFingerprint
|
||||
import app.revanced.patches.shared.fingerprints.opus.CodecSelectorFingerprint
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||
|
@ -4,8 +4,12 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.OptionsContainer
|
||||
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.Patch
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patches.shared.annotation.RVXCompatibility
|
||||
|
||||
@Patch
|
||||
|
@ -27,7 +27,10 @@ abstract class AbstractSettingsResourcePatch(
|
||||
|
||||
/* initialize ReVanced Settings */
|
||||
if (isYouTube)
|
||||
context.copyResources(sourceDirectory, ResourceUtils.ResourceGroup("xml", "revanced_prefs.xml"))
|
||||
context.copyResources(
|
||||
sourceDirectory,
|
||||
ResourceUtils.ResourceGroup("xml", "revanced_prefs.xml")
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patches.shared.fingerprints.ClientInfoFingerprint
|
||||
import app.revanced.patches.shared.fingerprints.ClientInfoParentFingerprint
|
||||
import app.revanced.patches.shared.fingerprints.versionspoof.ClientInfoFingerprint
|
||||
import app.revanced.patches.shared.fingerprints.versionspoof.ClientInfoParentFingerprint
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.dexbacked.reference.DexBackedFieldReference
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@ -26,7 +26,12 @@ abstract class AbstractVersionSpoofPatch(
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
ClientInfoParentFingerprint.result?.let { parentResult ->
|
||||
ClientInfoFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.mutableMethod?.let {
|
||||
ClientInfoFingerprint.also {
|
||||
it.resolve(
|
||||
context,
|
||||
parentResult.classDef
|
||||
)
|
||||
}.result?.mutableMethod?.let {
|
||||
it.apply {
|
||||
var insertIndex = 0
|
||||
val insertInstructions = implementation!!.instructions
|
||||
@ -35,7 +40,8 @@ abstract class AbstractVersionSpoofPatch(
|
||||
for ((index, instruction) in insertInstructions.withIndex()) {
|
||||
if (instruction.opcode != Opcode.SGET_OBJECT) continue
|
||||
|
||||
val indexString = ((instruction as? ReferenceInstruction)?.reference as? DexBackedFieldReference).toString()
|
||||
val indexString =
|
||||
((instruction as? ReferenceInstruction)?.reference as? DexBackedFieldReference).toString()
|
||||
|
||||
if (indexString != targetString) continue
|
||||
|
||||
|
@ -13,8 +13,8 @@ import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.fingerprints.LegacyVideoAdsFingerprint
|
||||
import app.revanced.patches.shared.fingerprints.MainstreamVideoAdsFingerprint
|
||||
import app.revanced.patches.shared.fingerprints.videoads.LegacyVideoAdsFingerprint
|
||||
import app.revanced.patches.shared.fingerprints.videoads.MainstreamVideoAdsFingerprint
|
||||
|
||||
@Name("abstract-video-ads-patch")
|
||||
@Version("0.0.1")
|
||||
@ -31,12 +31,12 @@ abstract class AbstractVideoAdsPatch(
|
||||
(context.toMethodWalker(it.method)
|
||||
.nextMethod(13, true)
|
||||
.getMethod() as MutableMethod).apply {
|
||||
addInstructions(
|
||||
0, """
|
||||
addInstructions(
|
||||
0, """
|
||||
invoke-static {}, $descriptor
|
||||
move-result v1
|
||||
"""
|
||||
)
|
||||
)
|
||||
}
|
||||
} ?: return LegacyVideoAdsFingerprint.toErrorResult()
|
||||
|
||||
|
@ -38,7 +38,12 @@ class GeneralAdsBytecodePatch : BytecodePatch() {
|
||||
|
||||
val viewRegister = getInstruction<Instruction35c>(insertIndex).registerC
|
||||
|
||||
this.implementation!!.injectHideCall(insertIndex, viewRegister, "ads/AdsFilter", "hideAdAttributionView")
|
||||
this.implementation!!.injectHideCall(
|
||||
insertIndex,
|
||||
viewRegister,
|
||||
"ads/AdsFilter",
|
||||
"hideAdAttributionView"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,9 +11,9 @@ 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.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.ads.general.bytecode.patch.GeneralAdsBytecodePatch
|
||||
import app.revanced.patches.youtube.ads.getpremium.patch.HideGetPremiumPatch
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.litho.patch.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.resources.ResourceUtils.copyXmlNode
|
||||
|
@ -24,8 +24,10 @@ class HideGetPremiumPatch : BytecodePatch(
|
||||
CompactYpcOfferModuleViewFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
val measuredWidthRegister = getInstruction<TwoRegisterInstruction>(startIndex).registerA
|
||||
val measuredHeightInstruction = getInstruction<TwoRegisterInstruction>(startIndex + 1)
|
||||
val measuredWidthRegister =
|
||||
getInstruction<TwoRegisterInstruction>(startIndex).registerA
|
||||
val measuredHeightInstruction =
|
||||
getInstruction<TwoRegisterInstruction>(startIndex + 1)
|
||||
val measuredHeightRegister = measuredHeightInstruction.registerA
|
||||
val tempRegister = measuredHeightInstruction.registerB
|
||||
|
||||
|
@ -8,8 +8,8 @@ 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.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.shared.patch.videoads.AbstractVideoAdsPatch
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.ADS_PATH
|
||||
|
||||
|
@ -9,8 +9,8 @@ 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.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.shared.patch.litho.ComponentParserPatch.Companion.objectHook
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.litho.patch.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.BOTTOM_PLAYER
|
||||
|
@ -9,8 +9,8 @@ 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.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.ads.general.bytecode.patch.GeneralAdsBytecodePatch
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
|
||||
@Patch
|
||||
|
@ -9,8 +9,8 @@ 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.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.ads.general.resource.patch.GeneralAdsPatch
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
|
||||
@Patch
|
||||
|
@ -12,7 +12,7 @@ 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.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.flyoutpanel.oldqualitylayout.fingerprints.QualityMenuViewInflateFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
|
@ -13,8 +13,8 @@ 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.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.shared.fingerprints.LayoutConstructorFingerprint
|
||||
import app.revanced.patches.youtube.utils.fingerprints.LayoutConstructorFingerprint
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.AutoNavPreviewStub
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
@ -45,12 +45,15 @@ class HideAutoplayPreviewPatch : BytecodePatch(
|
||||
it.mutableMethod.apply {
|
||||
val insertInstruction = implementation!!.instructions
|
||||
|
||||
val dummyRegister = getInstruction<OneRegisterInstruction>(getStringIndex("1.0x")).registerA
|
||||
val dummyRegister =
|
||||
getInstruction<OneRegisterInstruction>(getStringIndex("1.0x")).registerA
|
||||
val insertIndex = getWideLiteralIndex(AutoNavPreviewStub)
|
||||
|
||||
val branchIndex = insertInstruction.subList(insertIndex + 1, insertInstruction.size - 1).indexOfFirst { instruction ->
|
||||
((instruction as? ReferenceInstruction)?.reference as? FieldReference)?.type == "Lcom/google/android/apps/youtube/app/player/autonav/AutonavToggleController;"
|
||||
} + 1
|
||||
val branchIndex =
|
||||
insertInstruction.subList(insertIndex + 1, insertInstruction.size - 1)
|
||||
.indexOfFirst { instruction ->
|
||||
((instruction as? ReferenceInstruction)?.reference as? FieldReference)?.type == "Lcom/google/android/apps/youtube/app/player/autonav/AutonavToggleController;"
|
||||
} + 1
|
||||
|
||||
val jumpInstruction = getInstruction<Instruction>(insertIndex + branchIndex)
|
||||
|
||||
|
@ -12,5 +12,9 @@ object YouTubeControlsOverlayFingerprint : MethodFingerprint(
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.IF_EQZ
|
||||
),
|
||||
customFingerprint = { it, _ -> it.definingClass.endsWith("YouTubeControlsOverlay;") && it.isWideLiteralExists(YoutubeControlsOverlay) }
|
||||
customFingerprint = { it, _ ->
|
||||
it.definingClass.endsWith("YouTubeControlsOverlay;") && it.isWideLiteralExists(
|
||||
YoutubeControlsOverlay
|
||||
)
|
||||
}
|
||||
)
|
@ -14,7 +14,7 @@ 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.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.fullscreen.compactcontrolsoverlay.fingerprints.YouTubeControlsOverlayFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
@ -38,10 +38,11 @@ class CompactControlsOverlayPatch : BytecodePatch(
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
YouTubeControlsOverlayFingerprint.result?.let {
|
||||
with (context
|
||||
.toMethodWalker(it.method)
|
||||
.nextMethod(it.scanResult.patternScanResult!!.startIndex, true)
|
||||
.getMethod() as MutableMethod
|
||||
with(
|
||||
context
|
||||
.toMethodWalker(it.method)
|
||||
.nextMethod(it.scanResult.patternScanResult!!.startIndex, true)
|
||||
.getMethod() as MutableMethod
|
||||
) {
|
||||
val insertIndex = implementation!!.instructions.size - 1
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
|
@ -13,7 +13,7 @@ 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.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.fullscreen.endscreenoverlay.fingerprints.EndScreenResultsFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
|
@ -6,5 +6,9 @@ import app.revanced.util.bytecode.isWideLiteralExists
|
||||
|
||||
object FullscreenEngagementPanelFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
||||
customFingerprint = { it, _ -> it.definingClass.endsWith("FullscreenEngagementPanelOverlay;") && it.isWideLiteralExists(FullScreenEngagementPanel) }
|
||||
customFingerprint = { it, _ ->
|
||||
it.definingClass.endsWith("FullscreenEngagementPanelOverlay;") && it.isWideLiteralExists(
|
||||
FullScreenEngagementPanel
|
||||
)
|
||||
}
|
||||
)
|
@ -16,8 +16,8 @@ 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.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.shared.fingerprints.LayoutConstructorFingerprint
|
||||
import app.revanced.patches.youtube.utils.fingerprints.LayoutConstructorFingerprint
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.fullscreen.fullscreenpanels.fingerprints.FullscreenEngagementPanelFingerprint
|
||||
import app.revanced.patches.youtube.fullscreen.fullscreenpanels.fingerprints.FullscreenViewAdderFingerprint
|
||||
import app.revanced.patches.youtube.utils.quickactionscontainer.patch.HideQuickActionsContainerPatch
|
||||
@ -83,7 +83,8 @@ class HideFullscreenPanelsPatch : BytecodePatch(
|
||||
|
||||
LayoutConstructorFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val dummyRegister = getInstruction<OneRegisterInstruction>(getStringIndex("1.0x")).registerA
|
||||
val dummyRegister =
|
||||
getInstruction<OneRegisterInstruction>(getStringIndex("1.0x")).registerA
|
||||
|
||||
val invokeIndex = implementation!!.instructions.indexOfFirst { instruction ->
|
||||
instruction.opcode == Opcode.INVOKE_VIRTUAL &&
|
||||
|
@ -5,7 +5,7 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object OrientationPrimaryFingerprint : MethodFingerprint (
|
||||
object OrientationPrimaryFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
parameters = listOf("L"),
|
||||
@ -13,5 +13,5 @@ object OrientationPrimaryFingerprint : MethodFingerprint (
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.MOVE_RESULT
|
||||
),
|
||||
customFingerprint = { it, _ -> it.name == "<init>"}
|
||||
customFingerprint = { it, _ -> it.name == "<init>" }
|
||||
)
|
@ -5,7 +5,7 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object OrientationSecondaryFingerprint : MethodFingerprint (
|
||||
object OrientationSecondaryFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
|
@ -14,8 +14,10 @@ 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.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.fullscreen.landscapemode.fingerprints.*
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.fullscreen.landscapemode.fingerprints.OrientationParentFingerprint
|
||||
import app.revanced.patches.youtube.fullscreen.landscapemode.fingerprints.OrientationPrimaryFingerprint
|
||||
import app.revanced.patches.youtube.fullscreen.landscapemode.fingerprints.OrientationSecondaryFingerprint
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.FULLSCREEN
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@ -35,7 +37,8 @@ class LandScapeModePatch : BytecodePatch(
|
||||
OrientationPrimaryFingerprint,
|
||||
OrientationSecondaryFingerprint
|
||||
).forEach {
|
||||
it.also { it.resolve(context, classDef) }.result?.injectOverride() ?: return it.toErrorResult()
|
||||
it.also { it.resolve(context, classDef) }.result?.injectOverride()
|
||||
?: return it.toErrorResult()
|
||||
}
|
||||
} ?: return OrientationParentFingerprint.toErrorResult()
|
||||
|
||||
@ -64,7 +67,7 @@ class LandScapeModePatch : BytecodePatch(
|
||||
val register = getInstruction<OneRegisterInstruction>(index).registerA
|
||||
|
||||
addInstructions(
|
||||
index +1, """
|
||||
index + 1, """
|
||||
invoke-static {v$register}, $INTEGRATIONS_CLASS_DESCRIPTOR
|
||||
move-result v$register
|
||||
"""
|
||||
|
@ -9,8 +9,8 @@ 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.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.ads.general.resource.patch.GeneralAdsPatch
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.quickactionscontainer.patch.HideQuickActionsContainerPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
|
||||
|
@ -13,7 +13,7 @@ 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.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.general.accountmenu.fingerprints.AccountMenuFingerprint
|
||||
import app.revanced.patches.youtube.general.accountmenu.fingerprints.AccountMenuParentFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user