mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 13:17:46 +02:00
refactor(Utils): match to official ReVanced code
This commit is contained in:
@ -1,97 +0,0 @@
|
||||
package app.revanced.extensions
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableField
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.util.smali.toInstruction
|
||||
import app.revanced.util.integrations.Constants.PATCHES_PATH
|
||||
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
|
||||
import com.android.tools.smali.dexlib2.iface.Method
|
||||
import com.android.tools.smali.dexlib2.util.MethodUtil
|
||||
import org.w3c.dom.Node
|
||||
|
||||
internal fun MutableMethodImplementation.injectHideCall(
|
||||
index: Int,
|
||||
register: Int,
|
||||
patches: String,
|
||||
method: String
|
||||
) {
|
||||
this.addInstruction(
|
||||
index,
|
||||
"invoke-static { v$register }, $PATCHES_PATH/$patches;->$method(Landroid/view/View;)V".toInstruction()
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return [PatchException] from a [MethodFingerprint].
|
||||
*
|
||||
* @return The [PatchException] for the [MethodFingerprint].
|
||||
*/
|
||||
val MethodFingerprint.exception
|
||||
get() = PatchException("Failed to resolve ${this.javaClass.simpleName}")
|
||||
|
||||
/**
|
||||
* Find the [MutableMethod] from a given [Method] in a [MutableClass].
|
||||
*
|
||||
* @param method The [Method] to find.
|
||||
* @return The [MutableMethod].
|
||||
*/
|
||||
fun MutableClass.findMutableMethodOf(method: Method) = this.methods.first {
|
||||
MethodUtil.methodSignaturesMatch(it, method)
|
||||
}
|
||||
|
||||
/**
|
||||
* apply a transform to all methods of the class
|
||||
*
|
||||
* @param transform the transformation function. original method goes in, transformed method goes out
|
||||
*/
|
||||
fun MutableClass.transformMethods(transform: MutableMethod.() -> MutableMethod) {
|
||||
val transformedMethods = methods.map { it.transform() }
|
||||
methods.clear()
|
||||
methods.addAll(transformedMethods)
|
||||
}
|
||||
|
||||
/**
|
||||
* apply a transform to all fields of the class
|
||||
*
|
||||
* @param transform the transformation function. original field goes in, transformed field goes out
|
||||
*/
|
||||
fun MutableClass.transformFields(transform: MutableField.() -> MutableField) {
|
||||
val transformedFields = fields.map { it.transform() }
|
||||
fields.clear()
|
||||
fields.addAll(transformedFields)
|
||||
}
|
||||
|
||||
/**
|
||||
* traverse the class hierarchy starting from the given root class
|
||||
*
|
||||
* @param targetClass the class to start traversing the class hierarchy from
|
||||
* @param callback function that is called for every class in the hierarchy
|
||||
*/
|
||||
fun BytecodeContext.traverseClassHierarchy(
|
||||
targetClass: MutableClass,
|
||||
callback: MutableClass.() -> Unit
|
||||
) {
|
||||
callback(targetClass)
|
||||
this.findClass(targetClass.superclass ?: return)?.mutableClass?.let {
|
||||
traverseClassHierarchy(it, callback)
|
||||
}
|
||||
}
|
||||
|
||||
internal fun Node.doRecursively(action: (Node) -> Unit) {
|
||||
action(this)
|
||||
for (i in 0 until this.childNodes.length) this.childNodes.item(i).doRecursively(action)
|
||||
}
|
||||
|
||||
internal fun String.startsWithAny(vararg prefixes: String): Boolean {
|
||||
for (prefix in prefixes)
|
||||
if (this.startsWith(prefix))
|
||||
return true
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.account.component
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@ -10,10 +9,11 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.music.account.component.fingerprints.MenuEntryFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.ACCOUNT
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_ACCOUNT
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
@ -43,7 +43,7 @@ object MenuComponentPatch : BytecodePatch(
|
||||
|
||||
addInstruction(
|
||||
textIndex + 1,
|
||||
"invoke-static {v$textRegister, v$viewRegister}, $MUSIC_ACCOUNT->hideAccountMenu(Ljava/lang/CharSequence;Landroid/view/View;)V"
|
||||
"invoke-static {v$textRegister, v$viewRegister}, $ACCOUNT->hideAccountMenu(Ljava/lang/CharSequence;Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: throw MenuEntryFingerprint.exception
|
||||
|
@ -1,10 +1,9 @@
|
||||
package app.revanced.patches.music.account.component.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.MenuEntry
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
|
||||
object MenuEntryFingerprint : MethodFingerprint(
|
||||
object MenuEntryFingerprint : LiteralValueFingerprint(
|
||||
returnType = "V",
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(MenuEntry) }
|
||||
literalSupplier = { MenuEntry }
|
||||
)
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.account.handle
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@ -10,10 +9,11 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.account.handle.fingerprints.AccountSwitcherAccessibilityLabelFingerprint
|
||||
import app.revanced.patches.music.account.handle.fingerprints.NamesInactiveAccountThumbnailSizeFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.ACCOUNT
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_ACCOUNT
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
@ -56,7 +56,7 @@ object HideHandlePatch : BytecodePatch(
|
||||
|
||||
replaceInstruction(
|
||||
index,
|
||||
"invoke-static {v${textViewInstruction.registerC}, v${textViewInstruction.registerD}}, $MUSIC_ACCOUNT->hideHandle(Landroid/widget/TextView;I)V"
|
||||
"invoke-static {v${textViewInstruction.registerC}, v${textViewInstruction.registerD}}, $ACCOUNT->hideHandle(Landroid/widget/TextView;I)V"
|
||||
)
|
||||
|
||||
break
|
||||
@ -75,7 +75,7 @@ object HideHandlePatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
targetIndex, """
|
||||
invoke-static {v$targetRegister}, $MUSIC_ACCOUNT->hideHandle(Z)Z
|
||||
invoke-static {v$targetRegister}, $ACCOUNT->hideHandle(Z)Z
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
|
@ -1,11 +1,10 @@
|
||||
package app.revanced.patches.music.account.handle.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.AccountSwitcherAccessibility
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
|
||||
object AccountSwitcherAccessibilityLabelFingerprint : MethodFingerprint(
|
||||
object AccountSwitcherAccessibilityLabelFingerprint : LiteralValueFingerprint(
|
||||
returnType = "V",
|
||||
parameters = listOf("L", "Ljava/lang/Object;"),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(AccountSwitcherAccessibility) }
|
||||
literalSupplier = { AccountSwitcherAccessibility }
|
||||
)
|
@ -1,11 +1,10 @@
|
||||
package app.revanced.patches.music.account.handle.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.NamesInactiveAccountThumbnailSize
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object NamesInactiveAccountThumbnailSizeFingerprint : MethodFingerprint(
|
||||
object NamesInactiveAccountThumbnailSizeFingerprint : LiteralValueFingerprint(
|
||||
returnType = "V",
|
||||
parameters = listOf("L", "Ljava/lang/Object;"),
|
||||
opcodes = listOf(
|
||||
@ -21,9 +20,5 @@ object NamesInactiveAccountThumbnailSizeFingerprint : MethodFingerprint(
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.IF_EQZ
|
||||
),
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.isWideLiteralExists(
|
||||
NamesInactiveAccountThumbnailSize
|
||||
)
|
||||
}
|
||||
literalSupplier = { NamesInactiveAccountThumbnailSize }
|
||||
)
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.account.tos
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
@ -10,10 +9,11 @@ import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.account.tos.fingerprints.TermsOfServiceFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.ACCOUNT
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_ACCOUNT
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
||||
@ -55,7 +55,7 @@ object TermsContainerPatch : BytecodePatch(
|
||||
)
|
||||
addInstructions(
|
||||
index, """
|
||||
invoke-static {}, $MUSIC_ACCOUNT->hideTermsContainer()I
|
||||
invoke-static {}, $ACCOUNT->hideTermsContainer()I
|
||||
move-result v$visibilityRegister
|
||||
"""
|
||||
)
|
||||
|
@ -1,10 +1,9 @@
|
||||
package app.revanced.patches.music.account.tos.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.TosFooter
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
|
||||
object TermsOfServiceFingerprint : MethodFingerprint(
|
||||
object TermsOfServiceFingerprint : LiteralValueFingerprint(
|
||||
returnType = "Landroid/view/View;",
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(TosFooter) }
|
||||
literalSupplier = { TosFooter }
|
||||
)
|
||||
|
@ -6,9 +6,9 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.utils.actionbarhook.ActionBarHookPatch
|
||||
import app.revanced.patches.music.utils.intenthook.IntentHookPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.patches.music.video.information.VideoInformationPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
|
||||
@Patch(
|
||||
name = "Hook download button",
|
||||
@ -22,7 +22,7 @@ import app.revanced.util.enum.CategoryType
|
||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object DownloadButtonHookPatch : BytecodePatch() {
|
||||
object DownloadButtonHookPatch : BytecodePatch(emptySet()) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.actionbar.label
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@ -9,10 +8,11 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.actionbar.label.fingerprints.ActionBarLabelFingerprint
|
||||
import app.revanced.patches.music.utils.fingerprints.ActionsBarParentFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.ACTIONBAR
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_ACTIONBAR
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
@ -43,7 +43,7 @@ object ActionBarLabelPatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
targetIndex, """
|
||||
invoke-static {v$targetRegister}, $MUSIC_ACTIONBAR->hideActionBarLabel(Z)Z
|
||||
invoke-static {v$targetRegister}, $ACTIONBAR->hideActionBarLabel(Z)Z
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
|
@ -5,8 +5,8 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.utils.actionbarhook.ActionBarHookPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
|
||||
@Patch(
|
||||
name = "Hide radio button",
|
||||
@ -18,7 +18,7 @@ import app.revanced.util.enum.CategoryType
|
||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HideRadioButtonPatch : BytecodePatch() {
|
||||
object HideRadioButtonPatch : BytecodePatch(emptySet()) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.ads.general
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@ -10,14 +9,15 @@ import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.ads.general.fingerprints.FloatingLayoutFingerprint
|
||||
import app.revanced.patches.music.ads.general.fingerprints.NotifierShelfFingerprint
|
||||
import app.revanced.patches.music.ads.music.MusicAdsPatch
|
||||
import app.revanced.patches.music.utils.integrations.Constants.ADS_PATH
|
||||
import app.revanced.patches.music.utils.integrations.Constants.COMPONENTS_PATH
|
||||
import app.revanced.patches.music.utils.litho.LithoFilterPatch
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.FloatingLayout
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
|
||||
import app.revanced.util.integrations.Constants.MUSIC_COMPONENTS_PATH
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.util.getWideLiteralInstructionIndex
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@ -47,12 +47,12 @@ object GeneralAdsPatch : BytecodePatch(
|
||||
*/
|
||||
FloatingLayoutFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = getWideLiteralIndex(FloatingLayout) + 2
|
||||
val targetIndex = getWideLiteralInstructionIndex(FloatingLayout) + 2
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
targetIndex + 1,
|
||||
"invoke-static {v$targetRegister}, $MUSIC_ADS_PATH/PremiumPromotionPatch;->hidePremiumPromotion(Landroid/view/View;)V"
|
||||
"invoke-static {v$targetRegister}, $ADS_PATH/PremiumPromotionPatch;->hidePremiumPromotion(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: throw FloatingLayoutFingerprint.exception
|
||||
@ -63,25 +63,35 @@ object GeneralAdsPatch : BytecodePatch(
|
||||
NotifierShelfFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val linearLayoutIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
val linearLayoutRegister = getInstruction<FiveRegisterInstruction>(linearLayoutIndex).registerC
|
||||
val linearLayoutRegister =
|
||||
getInstruction<FiveRegisterInstruction>(linearLayoutIndex).registerC
|
||||
|
||||
val textViewIndex = linearLayoutIndex + 2
|
||||
val textViewRegister = getInstruction<OneRegisterInstruction>(textViewIndex).registerA
|
||||
val textViewRegister =
|
||||
getInstruction<OneRegisterInstruction>(textViewIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
textViewIndex,
|
||||
"invoke-static {v$linearLayoutRegister, v$textViewRegister}, $MUSIC_ADS_PATH/PremiumRenewalPatch;->hidePremiumRenewal(Landroid/widget/LinearLayout;Landroid/view/View;)V"
|
||||
"invoke-static {v$linearLayoutRegister, v$textViewRegister}, $ADS_PATH/PremiumRenewalPatch;->hidePremiumRenewal(Landroid/widget/LinearLayout;Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: throw NotifierShelfFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(CategoryType.ADS, "revanced_close_interstitial_ads", "true")
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.ADS,
|
||||
"revanced_close_interstitial_ads",
|
||||
"true"
|
||||
)
|
||||
SettingsPatch.addMusicPreference(CategoryType.ADS, "revanced_hide_general_ads", "true")
|
||||
SettingsPatch.addMusicPreference(CategoryType.ADS, "revanced_hide_music_ads", "true")
|
||||
SettingsPatch.addMusicPreference(CategoryType.ADS, "revanced_hide_premium_promotion", "true")
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.ADS,
|
||||
"revanced_hide_premium_promotion",
|
||||
"true"
|
||||
)
|
||||
SettingsPatch.addMusicPreference(CategoryType.ADS, "revanced_hide_premium_renewal", "true")
|
||||
}
|
||||
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"$MUSIC_COMPONENTS_PATH/AdsFilter;"
|
||||
"$COMPONENTS_PATH/AdsFilter;"
|
||||
}
|
||||
|
@ -1,14 +1,13 @@
|
||||
package app.revanced.patches.music.ads.general.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.FloatingLayout
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
object FloatingLayoutFingerprint : MethodFingerprint(
|
||||
object FloatingLayoutFingerprint : LiteralValueFingerprint(
|
||||
returnType = "Landroid/view/View;",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = emptyList(),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(FloatingLayout) }
|
||||
literalSupplier = { FloatingLayout }
|
||||
)
|
@ -1,13 +1,12 @@
|
||||
package app.revanced.patches.music.ads.general.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.MusicNotifierShelf
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object NotifierShelfFingerprint : MethodFingerprint(
|
||||
object NotifierShelfFingerprint : LiteralValueFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
opcodes = listOf(
|
||||
@ -16,5 +15,5 @@ object NotifierShelfFingerprint : MethodFingerprint(
|
||||
Opcode.CHECK_CAST,
|
||||
Opcode.IPUT_OBJECT
|
||||
),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(MusicNotifierShelf) }
|
||||
literalSupplier = { MusicNotifierShelf }
|
||||
)
|
@ -1,8 +1,8 @@
|
||||
package app.revanced.patches.music.ads.music
|
||||
|
||||
import app.revanced.patches.music.utils.integrations.Constants.ADS_PATH
|
||||
import app.revanced.patches.shared.patch.ads.AbstractAdsPatch
|
||||
import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
|
||||
|
||||
object MusicAdsPatch : AbstractAdsPatch(
|
||||
"$MUSIC_ADS_PATH/MusicAdsPatch;->hideMusicAds()Z"
|
||||
"$ADS_PATH/MusicAdsPatch;->hideMusicAds()Z"
|
||||
)
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.flyoutpanel.compactdialog
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
@ -8,10 +7,11 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.music.flyoutpanel.compactdialog.fingerprints.DialogSolidFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.FLYOUT
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_FLYOUT
|
||||
import app.revanced.util.exception
|
||||
|
||||
@Patch(
|
||||
name = "Enable compact dialog",
|
||||
@ -36,7 +36,7 @@ object CompactDialogPatch : BytecodePatch(
|
||||
) {
|
||||
addInstructions(
|
||||
2, """
|
||||
invoke-static {p0}, $MUSIC_FLYOUT->enableCompactDialog(I)I
|
||||
invoke-static {p0}, $FLYOUT->enableCompactDialog(I)I
|
||||
move-result p0
|
||||
"""
|
||||
)
|
||||
|
@ -1,13 +1,12 @@
|
||||
package app.revanced.patches.music.flyoutpanel.compactdialog.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.DialogSolid
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object DialogSolidFingerprint : MethodFingerprint(
|
||||
object DialogSolidFingerprint : LiteralValueFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
@ -16,6 +15,6 @@ object DialogSolidFingerprint : MethodFingerprint(
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.INVOKE_STATIC
|
||||
),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(DialogSolid) }
|
||||
literalSupplier = { DialogSolid }
|
||||
)
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.flyoutpanel.component
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@ -11,9 +10,10 @@ import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.music.flyoutpanel.utils.EnumUtils.getEnumIndex
|
||||
import app.revanced.patches.music.utils.fingerprints.MenuItemFingerprint
|
||||
import app.revanced.patches.music.utils.flyoutbutton.FlyoutButtonContainerPatch
|
||||
import app.revanced.patches.music.utils.integrations.Constants.FLYOUT
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_FLYOUT
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@ -48,7 +48,7 @@ object FlyoutPanelPatch : BytecodePatch(
|
||||
|
||||
addInstructionsWithLabels(
|
||||
enumIndex + 1, """
|
||||
invoke-static {v$enumRegister}, $MUSIC_FLYOUT->hideFlyoutPanels(Ljava/lang/Enum;)Z
|
||||
invoke-static {v$enumRegister}, $FLYOUT->hideFlyoutPanels(Ljava/lang/Enum;)Z
|
||||
move-result v$freeRegister
|
||||
if-nez v$freeRegister, :hide
|
||||
""", ExternalLabel("hide", jumpInstruction)
|
||||
|
@ -6,8 +6,8 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.utils.flyoutbutton.FlyoutButtonContainerPatch
|
||||
import app.revanced.patches.music.utils.overridespeed.OverrideSpeedHookPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
|
||||
@Patch(
|
||||
name = "Enable playback speed",
|
||||
@ -20,7 +20,7 @@ import app.revanced.util.enum.CategoryType
|
||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object PlaybackSpeedPatch : BytecodePatch() {
|
||||
object PlaybackSpeedPatch : BytecodePatch(emptySet()) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.flyoutpanel.replace
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@ -10,10 +9,11 @@ import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.flyoutpanel.utils.EnumUtils.getEnumIndex
|
||||
import app.revanced.patches.music.utils.fingerprints.MenuItemFingerprint
|
||||
import app.revanced.patches.music.utils.flyoutbutton.FlyoutButtonItemResourcePatch
|
||||
import app.revanced.patches.music.utils.integrations.Constants.FLYOUT
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.patches.music.video.information.VideoInformationPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_FLYOUT
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
@ -46,7 +46,7 @@ object ReplaceDismissQueuePatch : BytecodePatch(
|
||||
|
||||
addInstruction(
|
||||
enumIndex + 1,
|
||||
"invoke-static {v$enumRegister, v$textViewRegister, v$imageViewRegister}, $MUSIC_FLYOUT->replaceDismissQueue(Ljava/lang/Enum;Landroid/widget/TextView;Landroid/widget/ImageView;)V"
|
||||
"invoke-static {v$enumRegister, v$textViewRegister, v$imageViewRegister}, $FLYOUT->replaceDismissQueue(Ljava/lang/Enum;Landroid/widget/TextView;Landroid/widget/ImageView;)V"
|
||||
)
|
||||
}
|
||||
} ?: throw MenuItemFingerprint.exception
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.flyoutpanel.sleeptimer
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@ -8,9 +7,10 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.flyoutpanel.sleeptimer.fingerprints.SleepTimerFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.FLYOUT
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_FLYOUT
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
@ -32,7 +32,7 @@ object SleepTimerPatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
insertIndex, """
|
||||
invoke-static {}, $MUSIC_FLYOUT->enableSleepTimer()Z
|
||||
invoke-static {}, $FLYOUT->enableSleepTimer()Z
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
|
@ -1,10 +1,9 @@
|
||||
package app.revanced.patches.music.flyoutpanel.sleeptimer.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.util.bytecode.isWide32LiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
|
||||
object SleepTimerFingerprint : MethodFingerprint(
|
||||
object SleepTimerFingerprint : LiteralValueFingerprint(
|
||||
returnType = "Z",
|
||||
parameters = emptyList(),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45372767) }
|
||||
literalSupplier = { 45372767 }
|
||||
)
|
@ -4,8 +4,8 @@ import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.utils.integrations.Constants.UTILS_PATH
|
||||
import app.revanced.patches.shared.patch.litho.LithoThemePatch
|
||||
import app.revanced.util.integrations.Constants.MUSIC_UTILS_PATH
|
||||
import org.w3c.dom.Element
|
||||
|
||||
@Patch(
|
||||
@ -18,7 +18,7 @@ import org.w3c.dom.Element
|
||||
object AmoledPatch : ResourcePatch() {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
LithoThemePatch.injectCall("$MUSIC_UTILS_PATH/LithoThemePatch;->applyLithoTheme(I)I")
|
||||
LithoThemePatch.injectCall("$UTILS_PATH/LithoThemePatch;->applyLithoTheme(I)I")
|
||||
|
||||
context.xmlEditor["res/values/colors.xml"].use { editor ->
|
||||
val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element
|
||||
|
@ -1,16 +1,16 @@
|
||||
package app.revanced.patches.music.general.autocaptions
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.utils.integrations.Constants.GENERAL
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.patches.shared.fingerprints.captions.SubtitleTrackFingerprint
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_GENERAL
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
@ -32,7 +32,7 @@ object DisableAutoCaptionsPatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
index, """
|
||||
invoke-static {v$register}, $MUSIC_GENERAL->disableAutoCaptions(Z)Z
|
||||
invoke-static {v$register}, $GENERAL->disableAutoCaptions(Z)Z
|
||||
move-result v$register
|
||||
"""
|
||||
)
|
||||
|
@ -1,25 +0,0 @@
|
||||
package app.revanced.patches.music.general.branding.icon
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.util.resources.IconHelper.customIconMusic
|
||||
import app.revanced.util.resources.IconHelper.customIconMusicAdditional
|
||||
|
||||
@Patch(
|
||||
name = "Custom branding icon MMT",
|
||||
description = "Changes the YouTube Music launcher icon to MMT.",
|
||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")],
|
||||
use = false
|
||||
)
|
||||
@Suppress("unused")
|
||||
object CustomBrandingIconMMTPatch : ResourcePatch() {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
context.customIconMusic("mmt")
|
||||
context.customIconMusicAdditional("mmt")
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,112 @@
|
||||
package app.revanced.patches.music.general.branding.icon
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
|
||||
import app.revanced.util.ResourceGroup
|
||||
import app.revanced.util.copyResources
|
||||
import java.io.File
|
||||
import java.nio.file.Files
|
||||
|
||||
@Patch(
|
||||
name = "Custom branding icon YouTube Music",
|
||||
description = "Change the YouTube Music launcher icon to the icon specified in options.json.",
|
||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object CustomBrandingIconPatch : ResourcePatch() {
|
||||
private const val DEFAULT_ICON_KEY = "Revancify Blue"
|
||||
|
||||
private val availableIcon = mapOf(
|
||||
"MMT" to "mmt",
|
||||
DEFAULT_ICON_KEY to "revancify_blue",
|
||||
"Revancify Red" to "revancify_red"
|
||||
)
|
||||
|
||||
private val mipmapIconResourceFileNames = arrayOf(
|
||||
"adaptiveproduct_youtube_music_background_color_108",
|
||||
"adaptiveproduct_youtube_music_foreground_color_108",
|
||||
"ic_launcher_release"
|
||||
).map { "$it.png" }.toTypedArray()
|
||||
|
||||
private val mipmapDirectories = arrayOf(
|
||||
"xxxhdpi",
|
||||
"xxhdpi",
|
||||
"xhdpi",
|
||||
"hdpi",
|
||||
"mdpi"
|
||||
).map { "mipmap-$it" }
|
||||
|
||||
private var AppIcon by stringPatchOption(
|
||||
key = "AppIcon",
|
||||
default = DEFAULT_ICON_KEY,
|
||||
values = availableIcon,
|
||||
title = "App icon",
|
||||
description = """
|
||||
The path to a folder containing the following folders:
|
||||
|
||||
${mipmapDirectories.joinToString("\n") { "- $it" }}
|
||||
|
||||
Each of these folders has to have the following files:
|
||||
|
||||
${mipmapIconResourceFileNames.joinToString("\n") { "- $it" }}
|
||||
"""
|
||||
.split("\n")
|
||||
.joinToString("\n") { it.trimIndent() } // Remove the leading whitespace from each line.
|
||||
.trimIndent(), // Remove the leading newline.
|
||||
)
|
||||
|
||||
override fun execute(context: ResourceContext) {
|
||||
AppIcon?.let { appIcon ->
|
||||
if (!availableIcon.containsKey(appIcon)) {
|
||||
mipmapDirectories.map { directory ->
|
||||
ResourceGroup(
|
||||
directory, *mipmapIconResourceFileNames
|
||||
)
|
||||
}.let { resourceGroups ->
|
||||
val path = File(appIcon)
|
||||
val resourceDirectory = context["res"]
|
||||
|
||||
resourceGroups.forEach { group ->
|
||||
val fromDirectory = path.resolve(group.resourceDirectoryName)
|
||||
val toDirectory = resourceDirectory.resolve(group.resourceDirectoryName)
|
||||
|
||||
group.resources.forEach { iconFileName ->
|
||||
Files.write(
|
||||
toDirectory.resolve(iconFileName).toPath(),
|
||||
fromDirectory.resolve(iconFileName).readBytes()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
val appIconValue = availableIcon[appIcon] + ""
|
||||
val resourcePath = "music/branding/$appIconValue"
|
||||
|
||||
// change launcher icon.
|
||||
mipmapDirectories.map { directory ->
|
||||
ResourceGroup(
|
||||
directory, *mipmapIconResourceFileNames
|
||||
)
|
||||
}.let { resourceGroups ->
|
||||
resourceGroups.forEach {
|
||||
context.copyResources("$resourcePath/launcher", it)
|
||||
}
|
||||
}
|
||||
|
||||
// change monochrome icon.
|
||||
arrayOf(
|
||||
ResourceGroup(
|
||||
"drawable",
|
||||
"ic_app_icons_themed_youtube_music.xml"
|
||||
)
|
||||
).forEach { resourceGroup ->
|
||||
context.copyResources("$resourcePath/monochrome", resourceGroup)
|
||||
}
|
||||
}
|
||||
} ?: throw PatchException("Invalid app icon path.")
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package app.revanced.patches.music.general.branding.icon
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.util.resources.IconHelper.customIconMusic
|
||||
|
||||
@Patch(
|
||||
name = "Custom branding icon Revancify Blue",
|
||||
description = "Changes the YouTube Music launcher icon to Revancify Blue.",
|
||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object CustomBrandingIconRevancifyBluePatch : ResourcePatch() {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
context.customIconMusic("revancify-blue")
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
package app.revanced.patches.music.general.branding.icon
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.util.resources.IconHelper.customIconMusic
|
||||
|
||||
@Patch(
|
||||
name = "Custom branding icon Revancify Red",
|
||||
description = "Changes the YouTube Music launcher icon to Revancify Red.",
|
||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")],
|
||||
use = false
|
||||
)
|
||||
@Suppress("unused")
|
||||
object CustomBrandingIconRevancifyRedPatch : ResourcePatch() {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
context.customIconMusic("revancify-red")
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -4,10 +4,10 @@ import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.utils.integrations.Constants.COMPONENTS_PATH
|
||||
import app.revanced.patches.music.utils.litho.LithoFilterPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_COMPONENTS_PATH
|
||||
|
||||
@Patch(
|
||||
name = "Hide button shelf",
|
||||
@ -19,7 +19,7 @@ import app.revanced.util.integrations.Constants.MUSIC_COMPONENTS_PATH
|
||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HideButtonShelfPatch : BytecodePatch() {
|
||||
object HideButtonShelfPatch : BytecodePatch(emptySet()) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
@ -33,5 +33,5 @@ object HideButtonShelfPatch : BytecodePatch() {
|
||||
}
|
||||
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"$MUSIC_COMPONENTS_PATH/ButtonShelfFilter;"
|
||||
"$COMPONENTS_PATH/ButtonShelfFilter;"
|
||||
}
|
||||
|
@ -4,10 +4,10 @@ import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.utils.integrations.Constants.COMPONENTS_PATH
|
||||
import app.revanced.patches.music.utils.litho.LithoFilterPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_COMPONENTS_PATH
|
||||
|
||||
@Patch(
|
||||
name = "Hide carousel shelf",
|
||||
@ -19,7 +19,7 @@ import app.revanced.util.integrations.Constants.MUSIC_COMPONENTS_PATH
|
||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HideCarouselShelfPatch : BytecodePatch() {
|
||||
object HideCarouselShelfPatch : BytecodePatch(emptySet()) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
@ -33,5 +33,5 @@ object HideCarouselShelfPatch : BytecodePatch() {
|
||||
}
|
||||
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"$MUSIC_COMPONENTS_PATH/CarouselShelfFilter;"
|
||||
"$COMPONENTS_PATH/CarouselShelfFilter;"
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.general.castbutton
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
@ -11,12 +10,13 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.general.castbutton.fingerprints.MediaRouteButtonFingerprint
|
||||
import app.revanced.patches.music.general.castbutton.fingerprints.PlayerOverlayChipFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.GENERAL
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.PlayerOverlayChip
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_GENERAL
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.util.getWideLiteralInstructionIndex
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
@ -47,7 +47,7 @@ object HideCastButtonPatch : BytecodePatch(
|
||||
setVisibilityMethod?.apply {
|
||||
addInstructions(
|
||||
0, """
|
||||
invoke-static {p1}, $MUSIC_GENERAL->hideCastButton(I)I
|
||||
invoke-static {p1}, $GENERAL->hideCastButton(I)I
|
||||
move-result p1
|
||||
"""
|
||||
)
|
||||
@ -59,12 +59,12 @@ object HideCastButtonPatch : BytecodePatch(
|
||||
*/
|
||||
PlayerOverlayChipFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = getWideLiteralIndex(PlayerOverlayChip) + 2
|
||||
val targetIndex = getWideLiteralInstructionIndex(PlayerOverlayChip) + 2
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
targetIndex + 1,
|
||||
"invoke-static {v$targetRegister}, $MUSIC_GENERAL->hideCastButton(Landroid/view/View;)V"
|
||||
"invoke-static {v$targetRegister}, $GENERAL->hideCastButton(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: throw PlayerOverlayChipFingerprint.exception
|
||||
|
@ -1,13 +1,12 @@
|
||||
package app.revanced.patches.music.general.castbutton.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.PlayerOverlayChip
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
object PlayerOverlayChipFingerprint : MethodFingerprint(
|
||||
object PlayerOverlayChipFingerprint : LiteralValueFingerprint(
|
||||
returnType = "L",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(PlayerOverlayChip) }
|
||||
literalSupplier = { PlayerOverlayChip }
|
||||
)
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.general.categorybar
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@ -8,10 +7,11 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.general.categorybar.fingerprints.ChipCloudFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.GENERAL
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_GENERAL
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
@ -35,7 +35,7 @@ object CategoryBarPatch : BytecodePatch(
|
||||
|
||||
addInstruction(
|
||||
targetIndex + 1,
|
||||
"invoke-static { v$targetRegister }, $MUSIC_GENERAL->hideCategoryBar(Landroid/view/View;)V"
|
||||
"invoke-static { v$targetRegister }, $GENERAL->hideCategoryBar(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: throw ChipCloudFingerprint.exception
|
||||
|
@ -1,11 +1,10 @@
|
||||
package app.revanced.patches.music.general.categorybar.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.ChipCloud
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object ChipCloudFingerprint : MethodFingerprint(
|
||||
object ChipCloudFingerprint : LiteralValueFingerprint(
|
||||
returnType = "V",
|
||||
opcodes = listOf(
|
||||
Opcode.CONST,
|
||||
@ -13,6 +12,6 @@ object ChipCloudFingerprint : MethodFingerprint(
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.MOVE_RESULT_OBJECT
|
||||
),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ChipCloud) }
|
||||
literalSupplier = { ChipCloud }
|
||||
)
|
||||
|
||||
|
@ -4,10 +4,10 @@ import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.utils.integrations.Constants.COMPONENTS_PATH
|
||||
import app.revanced.patches.music.utils.litho.LithoFilterPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_COMPONENTS_PATH
|
||||
|
||||
@Patch(
|
||||
name = "Hide channel guidelines",
|
||||
@ -19,7 +19,7 @@ import app.revanced.util.integrations.Constants.MUSIC_COMPONENTS_PATH
|
||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HideChannelGuidelinesPatch : BytecodePatch() {
|
||||
object HideChannelGuidelinesPatch : BytecodePatch(emptySet()) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
@ -33,5 +33,5 @@ object HideChannelGuidelinesPatch : BytecodePatch() {
|
||||
}
|
||||
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"$MUSIC_COMPONENTS_PATH/ChannelGuidelinesFilter;"
|
||||
"$COMPONENTS_PATH/ChannelGuidelinesFilter;"
|
||||
}
|
||||
|
@ -4,10 +4,10 @@ import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.utils.integrations.Constants.COMPONENTS_PATH
|
||||
import app.revanced.patches.music.utils.litho.LithoFilterPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_COMPONENTS_PATH
|
||||
|
||||
@Patch(
|
||||
name = "Enable custom filter",
|
||||
@ -19,7 +19,7 @@ import app.revanced.util.integrations.Constants.MUSIC_COMPONENTS_PATH
|
||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object CustomFilterPatch : BytecodePatch() {
|
||||
object CustomFilterPatch : BytecodePatch(emptySet()) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
@ -38,5 +38,5 @@ object CustomFilterPatch : BytecodePatch() {
|
||||
}
|
||||
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"$MUSIC_COMPONENTS_PATH/CustomFilter;"
|
||||
"$COMPONENTS_PATH/CustomFilter;"
|
||||
}
|
||||
|
@ -4,10 +4,10 @@ import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.utils.integrations.Constants.COMPONENTS_PATH
|
||||
import app.revanced.patches.music.utils.litho.LithoFilterPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_COMPONENTS_PATH
|
||||
|
||||
@Patch(
|
||||
name = "Hide emoji picker",
|
||||
@ -19,7 +19,7 @@ import app.revanced.util.integrations.Constants.MUSIC_COMPONENTS_PATH
|
||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HideEmojiPickerPatch : BytecodePatch() {
|
||||
object HideEmojiPickerPatch : BytecodePatch(emptySet()) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
@ -33,5 +33,5 @@ object HideEmojiPickerPatch : BytecodePatch() {
|
||||
}
|
||||
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"$MUSIC_COMPONENTS_PATH/EmojiPickerFilter;"
|
||||
"$COMPONENTS_PATH/EmojiPickerFilter;"
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.general.floatingbutton
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@ -10,10 +9,11 @@ import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.music.general.floatingbutton.fingerprints.FloatingButtonFingerprint
|
||||
import app.revanced.patches.music.general.floatingbutton.fingerprints.FloatingButtonParentFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.GENERAL
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_GENERAL
|
||||
import app.revanced.util.exception
|
||||
|
||||
@Patch(
|
||||
name = "Hide new playlist button",
|
||||
@ -40,7 +40,7 @@ object NewPlaylistButtonPatch : BytecodePatch(
|
||||
it.mutableMethod.apply {
|
||||
addInstructionsWithLabels(
|
||||
1, """
|
||||
invoke-static {}, $MUSIC_GENERAL->hideNewPlaylistButton()Z
|
||||
invoke-static {}, $GENERAL->hideNewPlaylistButton()Z
|
||||
move-result v0
|
||||
if-eqz v0, :show
|
||||
return-void
|
||||
|
@ -1,16 +1,15 @@
|
||||
package app.revanced.patches.music.general.floatingbutton.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.util.bytecode.isNarrowLiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object FloatingButtonParentFingerprint : MethodFingerprint(
|
||||
object FloatingButtonParentFingerprint : LiteralValueFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(Opcode.INVOKE_DIRECT),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isNarrowLiteralExists(259982244) }
|
||||
literalSupplier = { 259982244 }
|
||||
)
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.general.historybutton
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@ -8,10 +7,11 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.general.historybutton.fingerprints.HistoryMenuItemFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.GENERAL
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_GENERAL
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
@ -36,7 +36,7 @@ object HideHistoryButtonPatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
insertIndex, """
|
||||
invoke-static {v$insertRegister}, $MUSIC_GENERAL->hideHistoryButton(Z)Z
|
||||
invoke-static {v$insertRegister}, $GENERAL->hideHistoryButton(Z)Z
|
||||
move-result v$insertRegister
|
||||
"""
|
||||
)
|
||||
|
@ -3,7 +3,7 @@ package app.revanced.patches.music.general.historybutton.fingerprints
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.HistoryMenuItem
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import app.revanced.util.containsWideLiteralInstructionIndex
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
@ -15,5 +15,8 @@ object HistoryMenuItemFingerprint : MethodFingerprint(
|
||||
Opcode.INVOKE_INTERFACE,
|
||||
Opcode.RETURN_VOID
|
||||
),
|
||||
customFingerprint = { methodDef, classDef -> methodDef.isWideLiteralExists(HistoryMenuItem) && classDef.methods.count() == 5 }
|
||||
customFingerprint = { methodDef, classDef ->
|
||||
methodDef.containsWideLiteralInstructionIndex(HistoryMenuItem)
|
||||
&& classDef.methods.count() == 5
|
||||
}
|
||||
)
|
||||
|
@ -1,16 +1,16 @@
|
||||
package app.revanced.patches.music.general.landscapemode
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.general.landscapemode.fingerprints.TabletIdentifierFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.GENERAL
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_GENERAL
|
||||
import app.revanced.util.exception
|
||||
|
||||
@Patch(
|
||||
name = "Enable landscape mode",
|
||||
@ -29,7 +29,7 @@ object LandScapeModePatch : BytecodePatch(
|
||||
TabletIdentifierFingerprint.result?.let {
|
||||
it.mutableMethod.addInstructions(
|
||||
it.scanResult.patternScanResult!!.endIndex + 1, """
|
||||
invoke-static {p0}, $MUSIC_GENERAL->enableLandScapeMode(Z)Z
|
||||
invoke-static {p0}, $GENERAL->enableLandScapeMode(Z)Z
|
||||
move-result p0
|
||||
"""
|
||||
)
|
||||
|
@ -1,13 +1,12 @@
|
||||
package app.revanced.patches.music.general.landscapemode.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.IsTablet
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object TabletIdentifierFingerprint : MethodFingerprint(
|
||||
object TabletIdentifierFingerprint : LiteralValueFingerprint(
|
||||
returnType = "Z",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||
parameters = listOf("L"),
|
||||
@ -16,6 +15,6 @@ object TabletIdentifierFingerprint : MethodFingerprint(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT
|
||||
),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(IsTablet) }
|
||||
literalSupplier = { IsTablet }
|
||||
)
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.general.oldstylelibraryshelf
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@ -8,10 +7,11 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.general.oldstylelibraryshelf.fingerprints.BrowseIdFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.GENERAL
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.bytecode.getStringIndex
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_GENERAL
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.util.getStringInstructionIndex
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
@ -28,12 +28,12 @@ object OldStyleLibraryShelfPatch : BytecodePatch(
|
||||
|
||||
BrowseIdFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = getStringIndex("FEmusic_offline") - 5
|
||||
val targetIndex = getStringInstructionIndex("FEmusic_offline") - 5
|
||||
val targetRegister = getInstruction<TwoRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
targetIndex + 1, """
|
||||
invoke-static {v$targetRegister}, $MUSIC_GENERAL->enableOldStyleLibraryShelf(Ljava/lang/String;)Ljava/lang/String;
|
||||
invoke-static {v$targetRegister}, $GENERAL->enableOldStyleLibraryShelf(Ljava/lang/String;)Ljava/lang/String;
|
||||
move-result-object v$targetRegister
|
||||
"""
|
||||
)
|
||||
|
@ -1,14 +1,13 @@
|
||||
package app.revanced.patches.music.general.oldstylelibraryshelf.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.util.bytecode.isWide32LiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
object BrowseIdFingerprint : MethodFingerprint(
|
||||
object BrowseIdFingerprint : LiteralValueFingerprint(
|
||||
returnType = "L",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
strings = listOf("FEmusic_offline"),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45358178) }
|
||||
literalSupplier = { 45358178 }
|
||||
)
|
@ -4,10 +4,10 @@ import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.utils.integrations.Constants.COMPONENTS_PATH
|
||||
import app.revanced.patches.music.utils.litho.LithoFilterPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_COMPONENTS_PATH
|
||||
|
||||
@Patch(
|
||||
name = "Hide playlist card",
|
||||
@ -19,7 +19,7 @@ import app.revanced.util.integrations.Constants.MUSIC_COMPONENTS_PATH
|
||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HidePlaylistCardPatch : BytecodePatch() {
|
||||
object HidePlaylistCardPatch : BytecodePatch(emptySet()) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
@ -33,5 +33,5 @@ object HidePlaylistCardPatch : BytecodePatch() {
|
||||
}
|
||||
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"$MUSIC_COMPONENTS_PATH/PlaylistCardFilter;"
|
||||
"$COMPONENTS_PATH/PlaylistCardFilter;"
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.general.startpage
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@ -9,12 +8,13 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.general.startpage.fingerprints.ColdStartUpFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.GENERAL
|
||||
import app.revanced.patches.music.utils.intenthook.IntentHookPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch.contexts
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_GENERAL
|
||||
import app.revanced.util.resources.ResourceUtils.copyXmlNode
|
||||
import app.revanced.util.copyXmlNode
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
@ -39,7 +39,7 @@ object StartPagePatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
targetIndex + 1, """
|
||||
invoke-static {v$targetRegister}, $MUSIC_GENERAL->setStartPage(Ljava/lang/String;)Ljava/lang/String;
|
||||
invoke-static {v$targetRegister}, $GENERAL->setStartPage(Ljava/lang/String;)Ljava/lang/String;
|
||||
move-result-object v$targetRegister
|
||||
return-object v$targetRegister
|
||||
"""
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.general.tooltip
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
@ -8,6 +7,7 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.general.tooltip.fingerprints.TooltipContentViewFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.util.exception
|
||||
|
||||
@Patch(
|
||||
name = "Hide tooltip content",
|
||||
|
@ -1,14 +1,13 @@
|
||||
package app.revanced.patches.music.general.tooltip.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.ToolTipContentView
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
object TooltipContentViewFingerprint : MethodFingerprint(
|
||||
object TooltipContentViewFingerprint : LiteralValueFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ToolTipContentView) }
|
||||
literalSupplier = { ToolTipContentView }
|
||||
)
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.misc.backgroundplay
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
@ -8,6 +7,7 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.music.misc.backgroundplay.fingerprints.BackgroundPlaybackParentFingerprint
|
||||
import app.revanced.util.exception
|
||||
|
||||
@Patch(
|
||||
name = "Background play",
|
||||
|
@ -3,10 +3,10 @@ package app.revanced.patches.music.misc.codecs
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.utils.integrations.Constants.MISC_PATH
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.patches.shared.patch.opus.AbstractOpusCodecsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_MISC_PATH
|
||||
|
||||
@Patch(
|
||||
name = "Enable opus codec",
|
||||
@ -16,7 +16,7 @@ import app.revanced.util.integrations.Constants.MUSIC_MISC_PATH
|
||||
)
|
||||
@Suppress("unused")
|
||||
object CodecsUnlockPatch : AbstractOpusCodecsPatch(
|
||||
"$MUSIC_MISC_PATH/OpusCodecPatch;->enableOpusCodec()Z"
|
||||
"$MISC_PATH/OpusCodecPatch;->enableOpusCodec()Z"
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
super.execute(context)
|
||||
|
@ -4,8 +4,8 @@ import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
|
||||
@Patch(
|
||||
name = "Enable debug logging",
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.misc.exclusiveaudio
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
@ -12,7 +11,8 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.music.misc.exclusiveaudio.fingerprints.DataSavingSettingsFragmentFingerprint
|
||||
import app.revanced.patches.music.misc.exclusiveaudio.fingerprints.MusicBrowserServiceFingerprint
|
||||
import app.revanced.patches.music.misc.exclusiveaudio.fingerprints.PodCastConfigFingerprint
|
||||
import app.revanced.util.bytecode.getStringIndex
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.util.getStringInstructionIndex
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@ -39,7 +39,7 @@ object ExclusiveAudioPatch : BytecodePatch(
|
||||
MusicBrowserServiceFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex =
|
||||
getStringIndex("MBS: Return empty root for client: %s, isFullMediaBrowserEnabled: %b, is client browsable: %b, isRedAccount: %b")
|
||||
getStringInstructionIndex("MBS: Return empty root for client: %s, isFullMediaBrowserEnabled: %b, is client browsable: %b, isRedAccount: %b")
|
||||
|
||||
for (index in targetIndex downTo 0) {
|
||||
if (getInstruction(index).opcode != Opcode.INVOKE_VIRTUAL) continue
|
||||
@ -83,7 +83,7 @@ object ExclusiveAudioPatch : BytecodePatch(
|
||||
|
||||
DataSavingSettingsFragmentFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = getStringIndex("pref_key_dont_play_nma_video") + 4
|
||||
val insertIndex = getStringInstructionIndex("pref_key_dont_play_nma_video") + 4
|
||||
val targetRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerD
|
||||
|
||||
addInstruction(
|
||||
|
@ -1,13 +1,12 @@
|
||||
package app.revanced.patches.music.misc.exclusiveaudio.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.util.bytecode.isWide32LiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
object PodCastConfigFingerprint : MethodFingerprint(
|
||||
object PodCastConfigFingerprint : LiteralValueFingerprint(
|
||||
returnType = "Z",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = emptyList(),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45388403) }
|
||||
literalSupplier = { 45388403 }
|
||||
)
|
@ -1,12 +1,12 @@
|
||||
package app.revanced.patches.music.misc.minimizedplayback
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.misc.minimizedplayback.fingerprints.MinimizedPlaybackManagerFingerprint
|
||||
import app.revanced.util.exception
|
||||
|
||||
@Patch(
|
||||
name = "Enable minimized playback",
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.misc.premium
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
@ -15,7 +14,8 @@ import app.revanced.patches.music.misc.premium.fingerprints.MembershipSettingsFi
|
||||
import app.revanced.patches.music.misc.premium.fingerprints.MembershipSettingsParentFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.PrivacyTosFooter
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.util.getWideLiteralInstructionIndex
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
@ -53,7 +53,7 @@ object HideGetPremiumPatch : BytecodePatch(
|
||||
|
||||
AccountMenuFooterFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = getWideLiteralIndex(PrivacyTosFooter) + 4
|
||||
val targetIndex = getWideLiteralInstructionIndex(PrivacyTosFooter) + 4
|
||||
targetReference = getInstruction<ReferenceInstruction>(targetIndex + 1).reference
|
||||
|
||||
with(
|
||||
|
@ -1,13 +1,12 @@
|
||||
package app.revanced.patches.music.misc.premium.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.PrivacyTosFooter
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object AccountMenuFooterFingerprint : MethodFingerprint(
|
||||
object AccountMenuFooterFingerprint : LiteralValueFingerprint(
|
||||
returnType = "L",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
opcodes = listOf(
|
||||
@ -18,5 +17,5 @@ object AccountMenuFooterFingerprint : MethodFingerprint(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.IGET_OBJECT
|
||||
),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(PrivacyTosFooter) }
|
||||
literalSupplier = { PrivacyTosFooter }
|
||||
)
|
||||
|
@ -4,13 +4,13 @@ import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.general.oldstylelibraryshelf.OldStyleLibraryShelfPatch
|
||||
import app.revanced.patches.music.utils.integrations.Constants.MISC_PATH
|
||||
import app.revanced.patches.music.utils.intenthook.IntentHookPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch.contexts
|
||||
import app.revanced.patches.shared.patch.versionspoof.AbstractVersionSpoofPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_MISC_PATH
|
||||
import app.revanced.util.resources.ResourceUtils.copyXmlNode
|
||||
import app.revanced.util.copyXmlNode
|
||||
|
||||
@Patch(
|
||||
name = "Spoof app version",
|
||||
@ -24,7 +24,7 @@ import app.revanced.util.resources.ResourceUtils.copyXmlNode
|
||||
)
|
||||
@Suppress("unused")
|
||||
object SpoofAppVersionPatch : AbstractVersionSpoofPatch(
|
||||
"$MUSIC_MISC_PATH/SpoofAppVersionPatch;->getVersionOverride(Ljava/lang/String;)Ljava/lang/String;"
|
||||
"$MISC_PATH/SpoofAppVersionPatch;->getVersionOverride(Ljava/lang/String;)Ljava/lang/String;"
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
super.execute(context)
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.misc.tastebuilder
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@ -8,6 +7,7 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.misc.tastebuilder.fingerprints.TasteBuilderConstructorFingerprint
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
|
@ -4,11 +4,11 @@ import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.misc.tracking.fingerprints.ShareLinkFormatterFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.MISC_PATH
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.patches.shared.fingerprints.tracking.CopyTextEndpointFingerprint
|
||||
import app.revanced.patches.shared.patch.tracking.AbstractSanitizeUrlQueryPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_MISC_PATH
|
||||
|
||||
@Patch(
|
||||
name = "Sanitize sharing links",
|
||||
@ -18,7 +18,7 @@ import app.revanced.util.integrations.Constants.MUSIC_MISC_PATH
|
||||
)
|
||||
@Suppress("unused")
|
||||
object SanitizeUrlQueryPatch : AbstractSanitizeUrlQueryPatch(
|
||||
"$MUSIC_MISC_PATH/SanitizeUrlQueryPatch;",
|
||||
"$MISC_PATH/SanitizeUrlQueryPatch;",
|
||||
listOf(
|
||||
CopyTextEndpointFingerprint,
|
||||
ShareLinkFormatterFingerprint
|
||||
|
@ -1,11 +1,9 @@
|
||||
package app.revanced.patches.music.misc.translations
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.resources.ResourceHelper.addTranslations
|
||||
import app.revanced.patches.shared.patch.translations.AbstractTranslationsPatch
|
||||
|
||||
@Patch(
|
||||
name = "Translations",
|
||||
@ -14,14 +12,9 @@ import app.revanced.util.resources.ResourceHelper.addTranslations
|
||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object TranslationsPatch : ResourcePatch() {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
context.addTranslations("music", LANGUAGE_LIST)
|
||||
|
||||
}
|
||||
|
||||
private val LANGUAGE_LIST = arrayOf(
|
||||
object TranslationsPatch : AbstractTranslationsPatch(
|
||||
"music",
|
||||
arrayOf(
|
||||
"bg-rBG",
|
||||
"bn",
|
||||
"cs-rCZ",
|
||||
@ -44,4 +37,4 @@ object TranslationsPatch : ResourcePatch() {
|
||||
"zh-rCN",
|
||||
"zh-rTW"
|
||||
)
|
||||
}
|
||||
)
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.navigation.black
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@ -8,10 +7,11 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.navigation.black.fingerprints.TabLayoutFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.NAVIGATION
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_NAVIGATION
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
@ -36,7 +36,7 @@ object BlackNavigationBarPatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
targetIndex + 1, """
|
||||
invoke-static {}, $MUSIC_NAVIGATION->enableBlackNavigationBar()I
|
||||
invoke-static {}, $NAVIGATION->enableBlackNavigationBar()I
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
|
@ -1,13 +1,12 @@
|
||||
package app.revanced.patches.music.navigation.black.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.ColorGrey
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object TabLayoutFingerprint : MethodFingerprint(
|
||||
object TabLayoutFingerprint : LiteralValueFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = emptyList(),
|
||||
@ -16,6 +15,6 @@ object TabLayoutFingerprint : MethodFingerprint(
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.MOVE_RESULT
|
||||
),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ColorGrey) }
|
||||
literalSupplier = { ColorGrey }
|
||||
)
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.navigation.component
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@ -9,11 +8,12 @@ import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.navigation.component.fingerprints.TabLayoutTextFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.NAVIGATION
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_NAVIGATION
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.util.getWideLiteralInstructionIndex
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
@ -39,7 +39,7 @@ object NavigationBarComponentPatch : BytecodePatch(
|
||||
*/
|
||||
TabLayoutTextFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = getWideLiteralIndex(SharedResourceIdPatch.Text1) + 3
|
||||
val targetIndex = getWideLiteralInstructionIndex(SharedResourceIdPatch.Text1) + 3
|
||||
val targetParameter = getInstruction<ReferenceInstruction>(targetIndex).reference
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
@ -48,7 +48,7 @@ object NavigationBarComponentPatch : BytecodePatch(
|
||||
|
||||
addInstruction(
|
||||
targetIndex + 1,
|
||||
"invoke-static {v$targetRegister}, $MUSIC_NAVIGATION->hideNavigationLabel(Landroid/widget/TextView;)V"
|
||||
"invoke-static {v$targetRegister}, $NAVIGATION->hideNavigationLabel(Landroid/widget/TextView;)V"
|
||||
)
|
||||
}
|
||||
} ?: throw TabLayoutTextFingerprint.exception
|
||||
@ -85,12 +85,12 @@ object NavigationBarComponentPatch : BytecodePatch(
|
||||
|
||||
addInstruction(
|
||||
pivotTabIndex,
|
||||
"invoke-static {v$pivotTabRegister}, $MUSIC_NAVIGATION->hideNavigationButton(Landroid/view/View;)V"
|
||||
"invoke-static {v$pivotTabRegister}, $NAVIGATION->hideNavigationButton(Landroid/view/View;)V"
|
||||
)
|
||||
|
||||
addInstruction(
|
||||
insertIndex,
|
||||
"sput-object v$enumRegister, $MUSIC_NAVIGATION->lastPivotTab:Ljava/lang/Enum;"
|
||||
"sput-object v$enumRegister, $NAVIGATION->lastPivotTab:Ljava/lang/Enum;"
|
||||
)
|
||||
}
|
||||
} ?: throw TabLayoutTextFingerprint.exception
|
||||
|
@ -1,13 +1,12 @@
|
||||
package app.revanced.patches.music.navigation.component.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.Text1
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object TabLayoutTextFingerprint : MethodFingerprint(
|
||||
object TabLayoutTextFingerprint : LiteralValueFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
@ -20,6 +19,6 @@ object TabLayoutTextFingerprint : MethodFingerprint(
|
||||
Opcode.INVOKE_INTERFACE,
|
||||
Opcode.MOVE_RESULT
|
||||
),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(Text1) }
|
||||
literalSupplier = { Text1 }
|
||||
)
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.player.colormatchplayer
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@ -12,9 +11,10 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.music.player.colormatchplayer.fingerprints.NewPlayerColorFingerprint
|
||||
import app.revanced.patches.music.utils.fingerprints.PlayerColorFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.PLAYER
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
@ -83,7 +83,7 @@ object ColorMatchPlayerPatch : BytecodePatch(
|
||||
|
||||
addInstructionsWithLabels(
|
||||
insertIndex, """
|
||||
invoke-static {}, $MUSIC_PLAYER->enableColorMatchPlayer()Z
|
||||
invoke-static {}, $PLAYER->enableColorMatchPlayer()Z
|
||||
move-result v2
|
||||
if-eqz v2, :off
|
||||
iget v0, p0, $miniPlayerReference1
|
||||
@ -118,7 +118,7 @@ object ColorMatchPlayerPatch : BytecodePatch(
|
||||
|
||||
addInstructionsWithLabels(
|
||||
insertIndex, """
|
||||
invoke-static {}, $MUSIC_PLAYER->enableColorMatchPlayer()Z
|
||||
invoke-static {}, $PLAYER->enableColorMatchPlayer()Z
|
||||
move-result v1
|
||||
if-eqz v1, :off
|
||||
iget v0, p0, $miniPlayerReference1
|
||||
|
@ -1,15 +1,15 @@
|
||||
package app.revanced.patches.music.player.minimizedplayer
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.player.minimizedplayer.fingerprints.MinimizedPlayerFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.PLAYER
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
@ -32,7 +32,7 @@ object MinimizedPlayerPatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
index, """
|
||||
invoke-static {v$register}, $MUSIC_PLAYER->enableForceMinimizedPlayer(Z)Z
|
||||
invoke-static {v$register}, $PLAYER->enableForceMinimizedPlayer(Z)Z
|
||||
move-result v$register
|
||||
"""
|
||||
)
|
||||
|
@ -1,15 +1,15 @@
|
||||
package app.revanced.patches.music.player.newplayerbackground
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.player.newplayerbackground.fingerprints.NewPlayerBackgroundFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.PLAYER
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
|
||||
import app.revanced.util.exception
|
||||
|
||||
@Patch(
|
||||
name = "Enable new player background",
|
||||
@ -27,7 +27,7 @@ object NewPlayerBackgroundPatch : BytecodePatch(
|
||||
it.mutableMethod.apply {
|
||||
addInstructions(
|
||||
0, """
|
||||
invoke-static {}, $MUSIC_PLAYER->enableNewPlayerBackground()Z
|
||||
invoke-static {}, $PLAYER->enableNewPlayerBackground()Z
|
||||
move-result v0
|
||||
return v0
|
||||
"""
|
||||
|
@ -1,10 +1,9 @@
|
||||
package app.revanced.patches.music.player.newplayerbackground.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.util.bytecode.isWide32LiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
|
||||
object NewPlayerBackgroundFingerprint : MethodFingerprint(
|
||||
object NewPlayerBackgroundFingerprint : LiteralValueFingerprint(
|
||||
returnType = "Z",
|
||||
parameters = emptyList(),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45415319) }
|
||||
literalSupplier = { 45415319 }
|
||||
)
|
@ -1,15 +1,15 @@
|
||||
package app.revanced.patches.music.player.oldplayerlayout
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.utils.fingerprints.NewPlayerLayoutFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.PLAYER
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
|
||||
import app.revanced.util.exception
|
||||
|
||||
@Patch(
|
||||
name = "Enable old player layout",
|
||||
@ -28,7 +28,7 @@ object OldPlayerLayoutPatch : BytecodePatch(
|
||||
it.mutableMethod.apply {
|
||||
addInstructions(
|
||||
0, """
|
||||
invoke-static {}, $MUSIC_PLAYER->enableOldPlayerLayout()Z
|
||||
invoke-static {}, $PLAYER->enableOldPlayerLayout()Z
|
||||
move-result v0
|
||||
return v0
|
||||
"""
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.player.oldstyleminiplayer
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@ -10,9 +9,10 @@ import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.player.oldstyleminiplayer.fingerprints.NextButtonVisibilityFingerprint
|
||||
import app.revanced.patches.music.player.oldstyleminiplayer.fingerprints.SwipeToCloseFingerprint
|
||||
import app.revanced.patches.music.utils.fingerprints.PlayerColorFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.PLAYER
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
@ -44,7 +44,7 @@ object OldStyleMiniPlayerPatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
targetIndex + 1, """
|
||||
invoke-static {v$targetRegister}, $MUSIC_PLAYER->enableOldStyleMiniPlayer(Z)Z
|
||||
invoke-static {v$targetRegister}, $PLAYER->enableOldStyleMiniPlayer(Z)Z
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
@ -59,7 +59,7 @@ object OldStyleMiniPlayerPatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
insertIndex, """
|
||||
invoke-static {v$targetRegister}, $MUSIC_PLAYER->enableOldStyleMiniPlayer(Z)Z
|
||||
invoke-static {v$targetRegister}, $PLAYER->enableOldStyleMiniPlayer(Z)Z
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
|
@ -1,10 +1,9 @@
|
||||
package app.revanced.patches.music.player.oldstyleminiplayer.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.util.bytecode.isWide32LiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
|
||||
object SwipeToCloseFingerprint : MethodFingerprint(
|
||||
object SwipeToCloseFingerprint : LiteralValueFingerprint(
|
||||
returnType = "Z",
|
||||
parameters = emptyList(),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45398432) }
|
||||
literalSupplier = { 45398432 }
|
||||
)
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.player.repeat
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@ -8,9 +7,10 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.player.repeat.fingerprints.RepeatTrackFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.PLAYER
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
@ -31,7 +31,7 @@ object RememberRepeatPatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
targetIndex, """
|
||||
invoke-static {v$targetRegister}, $MUSIC_PLAYER->rememberRepeatState(Z)Z
|
||||
invoke-static {v$targetRegister}, $PLAYER->rememberRepeatState(Z)Z
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.player.replace
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@ -9,20 +8,21 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.player.replace.fingerprints.CastButtonContainerFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.PLAYER
|
||||
import app.revanced.patches.music.utils.integrations.Constants.UTILS_PATH
|
||||
import app.revanced.patches.music.utils.mainactivity.MainActivityResolvePatch
|
||||
import app.revanced.patches.music.utils.mainactivity.MainActivityResolvePatch.mainActivityClassDef
|
||||
import app.revanced.patches.music.utils.playerresponse.PlayerResponsePatch
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.PlayerCastMediaRouteButton
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch.contexts
|
||||
import app.revanced.patches.music.utils.videotype.VideoTypeHookPatch
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
|
||||
import app.revanced.util.integrations.Constants.MUSIC_UTILS_PATH
|
||||
import app.revanced.util.resources.ResourceUtils
|
||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||
import app.revanced.util.ResourceGroup
|
||||
import app.revanced.util.copyResources
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.util.getWideLiteralInstructionIndex
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
@ -44,13 +44,13 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
use = false
|
||||
)
|
||||
@Suppress("unused")
|
||||
object ReplaceCastButtonPatch : BytecodePatch() {
|
||||
object ReplaceCastButtonPatch : BytecodePatch(emptySet()) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
CastButtonContainerFingerprint.resolve(context, mainActivityClassDef)
|
||||
|
||||
CastButtonContainerFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val freeIndex = getWideLiteralIndex(PlayerCastMediaRouteButton) + 1
|
||||
val freeIndex = getWideLiteralInstructionIndex(PlayerCastMediaRouteButton) + 1
|
||||
val freeRegister = getInstruction<OneRegisterInstruction>(freeIndex).registerA
|
||||
|
||||
val getActivityIndex = freeIndex - 4
|
||||
@ -71,7 +71,7 @@ object ReplaceCastButtonPatch : BytecodePatch() {
|
||||
addInstruction(
|
||||
index + 1,
|
||||
"invoke-static {v$freeRegister, v${viewGroupInstruction.registerC}, v${viewGroupInstruction.registerD}}, " +
|
||||
MUSIC_PLAYER +
|
||||
PLAYER +
|
||||
"->" +
|
||||
"replaceCastButton(Landroid/app/Activity;Landroid/view/ViewGroup;Landroid/view/View;)V"
|
||||
)
|
||||
@ -87,13 +87,13 @@ object ReplaceCastButtonPatch : BytecodePatch() {
|
||||
} ?: throw CastButtonContainerFingerprint.exception
|
||||
|
||||
PlayerResponsePatch.injectPlaylistCall(
|
||||
"$MUSIC_UTILS_PATH/CheckMusicVideoPatch;" +
|
||||
"$UTILS_PATH/CheckMusicVideoPatch;" +
|
||||
"->" +
|
||||
"playbackStart(Ljava/lang/String;Ljava/lang/String;IZ)V"
|
||||
)
|
||||
|
||||
arrayOf(
|
||||
ResourceUtils.ResourceGroup(
|
||||
ResourceGroup(
|
||||
"layout",
|
||||
"open_music_button.xml"
|
||||
)
|
||||
|
@ -1,12 +1,9 @@
|
||||
package app.revanced.patches.music.player.replace.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.PlayerCastMediaRouteButton
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
|
||||
object CastButtonContainerFingerprint : MethodFingerprint(
|
||||
object CastButtonContainerFingerprint : LiteralValueFingerprint(
|
||||
returnType = "V",
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.isWideLiteralExists(PlayerCastMediaRouteButton)
|
||||
}
|
||||
literalSupplier = { PlayerCastMediaRouteButton }
|
||||
)
|
||||
|
@ -1,8 +1,5 @@
|
||||
package app.revanced.patches.music.player.shuffle
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.extensions.transformFields
|
||||
import app.revanced.extensions.traverseClassHierarchy
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
@ -17,9 +14,12 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||
import app.revanced.patches.music.player.shuffle.fingerprints.MusicPlaybackControlsFingerprint
|
||||
import app.revanced.patches.music.player.shuffle.fingerprints.ShuffleClassReferenceFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.PLAYER
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.util.transformFields
|
||||
import app.revanced.util.traverseClassHierarchy
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
@ -78,7 +78,7 @@ object RememberShufflePatch : BytecodePatch(
|
||||
constructorMethod.apply {
|
||||
addInstruction(
|
||||
implementation!!.instructions.size - 1,
|
||||
"sput-object p0, $MUSIC_PLAYBACK_CONTROLS_CLASS_DESCRIPTOR->shuffleClass:$SHUFFLE_CLASS"
|
||||
"sput-object p0, $PLAYBACK_CONTROLS_CLASS_DESCRIPTOR->shuffleClass:$SHUFFLE_CLASS"
|
||||
)
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ object RememberShufflePatch : BytecodePatch(
|
||||
0, """
|
||||
move-object v0, p0
|
||||
""" + shuffleStateLabel + """
|
||||
invoke-static {v1}, $MUSIC_PLAYER->setShuffleState(I)V
|
||||
invoke-static {v1}, $PLAYER->setShuffleState(I)V
|
||||
"""
|
||||
)
|
||||
}
|
||||
@ -112,7 +112,7 @@ object RememberShufflePatch : BytecodePatch(
|
||||
it.mutableMethod.apply {
|
||||
addInstruction(
|
||||
0,
|
||||
"invoke-virtual {v0}, $MUSIC_PLAYBACK_CONTROLS_CLASS_DESCRIPTOR->rememberShuffleState()V"
|
||||
"invoke-virtual {v0}, $PLAYBACK_CONTROLS_CLASS_DESCRIPTOR->rememberShuffleState()V"
|
||||
)
|
||||
|
||||
val shuffleField = ImmutableField(
|
||||
@ -137,10 +137,10 @@ object RememberShufflePatch : BytecodePatch(
|
||||
|
||||
shuffleMethod.addInstructionsWithLabels(
|
||||
0, """
|
||||
invoke-static {}, $MUSIC_PLAYER->getShuffleState()I
|
||||
invoke-static {}, $PLAYER->getShuffleState()I
|
||||
move-result v2
|
||||
if-nez v2, :dont_shuffle
|
||||
sget-object v0, $MUSIC_PLAYBACK_CONTROLS_CLASS_DESCRIPTOR->shuffleClass:$SHUFFLE_CLASS
|
||||
sget-object v0, $PLAYBACK_CONTROLS_CLASS_DESCRIPTOR->shuffleClass:$SHUFFLE_CLASS
|
||||
""" + shuffleStateLabel + """
|
||||
iget-object v3, v0, $imageViewReference
|
||||
invoke-virtual {v3}, Landroid/widget/ImageView;->performClick()Z
|
||||
@ -164,7 +164,7 @@ object RememberShufflePatch : BytecodePatch(
|
||||
|
||||
}
|
||||
|
||||
private const val MUSIC_PLAYBACK_CONTROLS_CLASS_DESCRIPTOR =
|
||||
private const val PLAYBACK_CONTROLS_CLASS_DESCRIPTOR =
|
||||
"Lcom/google/android/apps/youtube/music/watchpage/MusicPlaybackControls;"
|
||||
|
||||
private lateinit var SHUFFLE_CLASS: String
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.player.zenmode
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@ -10,9 +9,10 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.player.zenmode.fingerprints.ZenModeFingerprint
|
||||
import app.revanced.patches.music.utils.fingerprints.PlayerColorFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.PLAYER
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
|
||||
@ -46,7 +46,7 @@ object ZenModePatch : BytecodePatch(
|
||||
|
||||
addInstructionsWithLabels(
|
||||
insertIndex, """
|
||||
invoke-static {}, $MUSIC_PLAYER->enableZenMode()Z
|
||||
invoke-static {}, $PLAYER->enableZenMode()Z
|
||||
move-result v$dummyRegister
|
||||
if-eqz v$dummyRegister, :off
|
||||
const v$dummyRegister, -0xfcfcfd
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.utils.actionbarhook
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@ -8,8 +7,9 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.utils.actionbarhook.fingerprints.ActionBarHookFingerprint
|
||||
import app.revanced.patches.music.utils.fingerprints.ActionsBarParentFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.ACTIONBAR
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.util.integrations.Constants.MUSIC_ACTIONBAR
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@Patch(dependencies = [SharedResourceIdPatch::class])
|
||||
@ -32,7 +32,7 @@ object ActionBarHookPatch : BytecodePatch(
|
||||
|
||||
addInstruction(
|
||||
targetIndex + 1,
|
||||
"invoke-static {v$targetRegister}, $MUSIC_ACTIONBAR->hookActionBar(Landroid/view/ViewGroup;)V"
|
||||
"invoke-static {v$targetRegister}, $ACTIONBAR->hookActionBar(Landroid/view/ViewGroup;)V"
|
||||
)
|
||||
}
|
||||
} ?: throw ActionBarHookFingerprint.exception
|
||||
|
@ -1,14 +1,13 @@
|
||||
package app.revanced.patches.music.utils.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.ActionsContainer
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
object ActionsBarParentFingerprint : MethodFingerprint(
|
||||
object ActionsBarParentFingerprint : LiteralValueFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(ActionsContainer) }
|
||||
literalSupplier = { ActionsContainer }
|
||||
)
|
||||
|
||||
|
@ -1,10 +1,9 @@
|
||||
package app.revanced.patches.music.utils.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.util.bytecode.isWide32LiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
|
||||
object NewPlayerLayoutFingerprint : MethodFingerprint(
|
||||
object NewPlayerLayoutFingerprint : LiteralValueFingerprint(
|
||||
returnType = "Z",
|
||||
parameters = emptyList(),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45399578) }
|
||||
literalSupplier = { 45399578 }
|
||||
)
|
@ -1,14 +1,9 @@
|
||||
package app.revanced.patches.music.utils.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.InlineTimeBarAdBreakMarkerColor
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
|
||||
object SeekBarConstructorFingerprint : MethodFingerprint(
|
||||
object SeekBarConstructorFingerprint : LiteralValueFingerprint(
|
||||
returnType = "V",
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.isWideLiteralExists(
|
||||
InlineTimeBarAdBreakMarkerColor
|
||||
)
|
||||
}
|
||||
literalSupplier = { InlineTimeBarAdBreakMarkerColor }
|
||||
)
|
@ -1,12 +1,12 @@
|
||||
package app.revanced.patches.music.utils.fix.androidauto
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.utils.fix.androidauto.fingerprints.CertificateCheckFingerprint
|
||||
import app.revanced.util.exception
|
||||
|
||||
@Patch(
|
||||
name = "Certificate spoof",
|
||||
|
@ -1,12 +1,12 @@
|
||||
package app.revanced.patches.music.utils.fix.clientspoof
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patches.music.utils.fix.clientspoof.fingerprints.UserAgentHeaderBuilderFingerprint
|
||||
import app.revanced.patches.music.utils.microg.Constants.MUSIC_PACKAGE_NAME
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
|
||||
object ClientSpoofPatch : BytecodePatch(
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.utils.flyoutbutton
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@ -8,10 +7,11 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.utils.flyoutbutton.fingerprints.FlyoutPanelLikeButtonFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.FLYOUT
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.MusicMenuLikeButtons
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
import app.revanced.util.integrations.Constants.MUSIC_FLYOUT
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.util.getWideLiteralInstructionIndex
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@ -28,7 +28,7 @@ object FlyoutButtonContainerPatch : BytecodePatch(
|
||||
|
||||
FlyoutPanelLikeButtonFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = getWideLiteralIndex(MusicMenuLikeButtons)
|
||||
val targetIndex = getWideLiteralInstructionIndex(MusicMenuLikeButtons)
|
||||
|
||||
var insertIndex = -1
|
||||
|
||||
@ -40,7 +40,7 @@ object FlyoutButtonContainerPatch : BytecodePatch(
|
||||
|
||||
addInstruction(
|
||||
index + 1,
|
||||
"invoke-static {v$register}, $MUSIC_FLYOUT->setFlyoutButtonContainer(Landroid/view/View;)V"
|
||||
"invoke-static {v$register}, $FLYOUT->setFlyoutButtonContainer(Landroid/view/View;)V"
|
||||
)
|
||||
break
|
||||
}
|
||||
|
@ -2,8 +2,8 @@ package app.revanced.patches.music.utils.flyoutbutton
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.util.resources.ResourceUtils
|
||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||
import app.revanced.util.ResourceGroup
|
||||
import app.revanced.util.copyResources
|
||||
|
||||
object FlyoutButtonContainerResourcePatch : ResourcePatch() {
|
||||
override fun execute(context: ResourceContext) {
|
||||
@ -14,7 +14,7 @@ object FlyoutButtonContainerResourcePatch : ResourcePatch() {
|
||||
context["res/layout-v21"].mkdirs()
|
||||
|
||||
arrayOf(
|
||||
ResourceUtils.ResourceGroup(
|
||||
ResourceGroup(
|
||||
"layout-v21",
|
||||
"music_menu_like_buttons.xml"
|
||||
)
|
||||
@ -22,7 +22,7 @@ object FlyoutButtonContainerResourcePatch : ResourcePatch() {
|
||||
context.copyResources("music/flyout", resourceGroup)
|
||||
}
|
||||
|
||||
fun copyResources(resourceGroups: List<ResourceUtils.ResourceGroup>) {
|
||||
fun copyResources(resourceGroups: List<ResourceGroup>) {
|
||||
resourceGroups.forEach { context.copyResources("music/flyout", it) }
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ object FlyoutButtonContainerResourcePatch : ResourcePatch() {
|
||||
"yt_outline_play_arrow_half_circle_black_24"
|
||||
).map { "$it.png" }.toTypedArray()
|
||||
|
||||
fun createGroup(directory: String) = ResourceUtils.ResourceGroup(
|
||||
fun createGroup(directory: String) = ResourceGroup(
|
||||
directory, *resourceFileNames
|
||||
)
|
||||
|
||||
|
@ -2,13 +2,13 @@ package app.revanced.patches.music.utils.flyoutbutton
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.util.resources.ResourceUtils
|
||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||
import app.revanced.util.ResourceGroup
|
||||
import app.revanced.util.copyResources
|
||||
|
||||
object FlyoutButtonItemResourcePatch : ResourcePatch() {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
fun copyResources(resourceGroups: List<ResourceUtils.ResourceGroup>) {
|
||||
fun copyResources(resourceGroups: List<ResourceGroup>) {
|
||||
resourceGroups.forEach { context.copyResources("music/flyout", it) }
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ object FlyoutButtonItemResourcePatch : ResourcePatch() {
|
||||
"yt_outline_youtube_logo_icon_black_24"
|
||||
).map { "$it.png" }.toTypedArray()
|
||||
|
||||
fun createGroup(directory: String) = ResourceUtils.ResourceGroup(
|
||||
fun createGroup(directory: String) = ResourceGroup(
|
||||
directory, *resourceFileNames
|
||||
)
|
||||
|
||||
|
@ -1,15 +1,14 @@
|
||||
package app.revanced.patches.music.utils.flyoutbutton.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.MusicMenuLikeButtons
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
object FlyoutPanelLikeButtonFingerprint : MethodFingerprint(
|
||||
object FlyoutPanelLikeButtonFingerprint : LiteralValueFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL or AccessFlags.SYNTHETIC,
|
||||
parameters = listOf("L", "Ljava/lang/Object;"),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(MusicMenuLikeButtons) }
|
||||
literalSupplier = { MusicMenuLikeButtons }
|
||||
)
|
||||
|
||||
|
@ -0,0 +1,26 @@
|
||||
package app.revanced.patches.music.utils.integrations
|
||||
|
||||
@Suppress("MemberVisibilityCanBePrivate")
|
||||
object Constants {
|
||||
const val INTEGRATIONS_PATH = "Lapp/revanced/music"
|
||||
const val PATCHES_PATH = "$INTEGRATIONS_PATH/patches"
|
||||
|
||||
const val ACCOUNT_PATH = "$PATCHES_PATH/account"
|
||||
const val ACTIONBAR_PATH = "$PATCHES_PATH/actionbar"
|
||||
const val ADS_PATH = "$PATCHES_PATH/ads"
|
||||
const val COMPONENTS_PATH = "$PATCHES_PATH/components"
|
||||
const val FLYOUT_PATH = "$PATCHES_PATH/flyout"
|
||||
const val GENERAL_PATH = "$PATCHES_PATH/general"
|
||||
const val MISC_PATH = "$PATCHES_PATH/misc"
|
||||
const val NAVIGATION_PATH = "$PATCHES_PATH/navigation"
|
||||
const val PLAYER_PATH = "$PATCHES_PATH/player"
|
||||
const val VIDEO_PATH = "$PATCHES_PATH/video"
|
||||
const val UTILS_PATH = "$PATCHES_PATH/utils"
|
||||
|
||||
const val ACCOUNT = "$ACCOUNT_PATH/AccountPatch;"
|
||||
const val ACTIONBAR = "$ACTIONBAR_PATH/ActionBarPatch;"
|
||||
const val FLYOUT = "$FLYOUT_PATH/FlyoutPatch;"
|
||||
const val GENERAL = "$GENERAL_PATH/GeneralPatch;"
|
||||
const val NAVIGATION = "$NAVIGATION_PATH/NavigationPatch;"
|
||||
const val PLAYER = "$PLAYER_PATH/PlayerPatch;"
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
package app.revanced.patches.music.utils.integrations
|
||||
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.utils.integrations.Constants.INTEGRATIONS_PATH
|
||||
import app.revanced.patches.music.utils.integrations.fingerprints.InitFingerprint
|
||||
import app.revanced.patches.shared.patch.integrations.AbstractIntegrationsPatch
|
||||
import app.revanced.util.integrations.Constants.MUSIC_INTEGRATIONS_PATH
|
||||
|
||||
@Patch(requiresIntegrations = true)
|
||||
object IntegrationsPatch : AbstractIntegrationsPatch(
|
||||
"$MUSIC_INTEGRATIONS_PATH/utils/ReVancedUtils;",
|
||||
"$INTEGRATIONS_PATH/utils/ReVancedUtils;",
|
||||
setOf(InitFingerprint),
|
||||
)
|
||||
|
@ -1,15 +1,15 @@
|
||||
package app.revanced.patches.music.utils.intenthook
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.music.utils.integrations.Constants.INTEGRATIONS_PATH
|
||||
import app.revanced.patches.music.utils.intenthook.fingerprints.FullStackTraceActivityFingerprint
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.MUSIC_INTEGRATIONS_PATH
|
||||
import app.revanced.util.exception
|
||||
|
||||
@Patch(dependencies = [SettingsPatch::class])
|
||||
object IntentHookPatch : BytecodePatch(
|
||||
@ -21,7 +21,7 @@ object IntentHookPatch : BytecodePatch(
|
||||
it.mutableMethod.apply {
|
||||
addInstructionsWithLabels(
|
||||
1, """
|
||||
invoke-static {p0}, $MUSIC_INTEGRATIONS_PATH/settingsmenu/ReVancedSettingActivity;->initializeSettings(Landroid/app/Activity;)Z
|
||||
invoke-static {p0}, $INTEGRATIONS_PATH/settingsmenu/ReVancedSettingActivity;->initializeSettings(Landroid/app/Activity;)Z
|
||||
move-result v0
|
||||
if-eqz v0, :show
|
||||
return-void
|
||||
|
@ -1,15 +1,15 @@
|
||||
package app.revanced.patches.music.utils.litho
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.utils.integrations.Constants.COMPONENTS_PATH
|
||||
import app.revanced.patches.music.utils.litho.fingerprints.LithoFilterFingerprint
|
||||
import app.revanced.patches.shared.patch.litho.ComponentParserPatch
|
||||
import app.revanced.patches.shared.patch.litho.ComponentParserPatch.pathBuilderHook
|
||||
import app.revanced.util.integrations.Constants.MUSIC_COMPONENTS_PATH
|
||||
import app.revanced.util.exception
|
||||
import java.io.Closeable
|
||||
|
||||
@Patch(dependencies = [ComponentParserPatch::class])
|
||||
@ -17,7 +17,7 @@ object LithoFilterPatch : BytecodePatch(
|
||||
setOf(LithoFilterFingerprint)
|
||||
), Closeable {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"$MUSIC_COMPONENTS_PATH/LithoFilterPatch;"
|
||||
"$COMPONENTS_PATH/LithoFilterPatch;"
|
||||
|
||||
internal lateinit var addFilter: (String) -> Unit
|
||||
private set
|
||||
@ -50,7 +50,7 @@ object LithoFilterPatch : BytecodePatch(
|
||||
.mutableMethod.addInstructions(
|
||||
0, """
|
||||
const/16 v0, $filterCount
|
||||
new-array v0, v0, [$MUSIC_COMPONENTS_PATH/Filter;
|
||||
new-array v0, v0, [$COMPONENTS_PATH/Filter;
|
||||
"""
|
||||
)
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
package app.revanced.patches.music.utils.mainactivity
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.music.utils.integrations.Constants.UTILS_PATH
|
||||
import app.revanced.patches.music.utils.mainactivity.fingerprints.MainActivityFingerprint
|
||||
import app.revanced.util.integrations.Constants.MUSIC_UTILS_PATH
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.iface.ClassDef
|
||||
|
||||
object MainActivityResolvePatch : BytecodePatch(
|
||||
@ -29,7 +29,7 @@ object MainActivityResolvePatch : BytecodePatch(
|
||||
onCreateMethod.apply {
|
||||
addInstruction(
|
||||
2,
|
||||
"invoke-static/range {p0 .. p0}, $MUSIC_UTILS_PATH/$methods;->$descriptor(Landroid/content/Context;)V"
|
||||
"invoke-static/range {p0 .. p0}, $UTILS_PATH/$methods;->$descriptor(Landroid/content/Context;)V"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -16,8 +16,8 @@ import app.revanced.patches.music.utils.microg.fingerprints.CastDynamiteModuleV2
|
||||
import app.revanced.patches.music.utils.microg.fingerprints.GooglePlayUtilityFingerprint
|
||||
import app.revanced.patches.music.utils.microg.fingerprints.PrimeFingerprint
|
||||
import app.revanced.patches.music.utils.microg.fingerprints.ServiceCheckFingerprint
|
||||
import app.revanced.patches.shared.patch.microg.MicroGBytecodeHelper
|
||||
import app.revanced.patches.shared.patch.packagename.PackageNamePatch
|
||||
import app.revanced.util.microg.MicroGBytecodeHelper
|
||||
|
||||
@Patch(
|
||||
name = "MicroG support",
|
||||
|
@ -7,14 +7,14 @@ import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.music.utils.microg.Constants.MUSIC_PACKAGE_NAME
|
||||
import app.revanced.patches.music.utils.microg.Constants.SPOOFED_PACKAGE_NAME
|
||||
import app.revanced.patches.music.utils.microg.Constants.SPOOFED_PACKAGE_SIGNATURE
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.ResourceUtils.addMicroGPreference
|
||||
import app.revanced.patches.music.utils.settings.ResourceUtils.setMicroG
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.patches.shared.patch.microg.Constants.MICROG_PACKAGE_NAME
|
||||
import app.revanced.patches.shared.patch.microg.MicroGManifestHelper.addSpoofingMetadata
|
||||
import app.revanced.patches.shared.patch.microg.MicroGResourceHelper.patchManifest
|
||||
import app.revanced.patches.shared.patch.packagename.PackageNamePatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.microg.Constants.MICROG_PACKAGE_NAME
|
||||
import app.revanced.util.microg.MicroGManifestHelper.addSpoofingMetadata
|
||||
import app.revanced.util.microg.MicroGResourceHelper.patchManifest
|
||||
import app.revanced.util.resources.MusicResourceHelper.addMicroGPreference
|
||||
import app.revanced.util.resources.MusicResourceHelper.setMicroG
|
||||
|
||||
@Patch(
|
||||
dependencies = [
|
||||
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.utils.overridequality
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
@ -10,10 +9,11 @@ import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
|
||||
import app.revanced.patches.music.utils.integrations.Constants.VIDEO_PATH
|
||||
import app.revanced.patches.music.utils.overridequality.fingerprints.VideoQualityListFingerprint
|
||||
import app.revanced.patches.music.utils.overridequality.fingerprints.VideoQualityPatchFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.util.integrations.Constants.MUSIC_VIDEO_PATH
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.immutable.ImmutableField
|
||||
@ -81,7 +81,7 @@ object OverrideQualityHookPatch : BytecodePatch(
|
||||
}
|
||||
|
||||
private const val INTEGRATIONS_VIDEO_QUALITY_CLASS_DESCRIPTOR =
|
||||
"$MUSIC_VIDEO_PATH/VideoQualityPatch;"
|
||||
"$VIDEO_PATH/VideoQualityPatch;"
|
||||
|
||||
private lateinit var QUALITY_CLASS: String
|
||||
private lateinit var QUALITY_METHOD: String
|
||||
|
@ -1,16 +1,15 @@
|
||||
package app.revanced.patches.music.utils.overridequality.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.QualityAuto
|
||||
import app.revanced.util.bytecode.isWideLiteralExists
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object VideoQualityListFingerprint : MethodFingerprint(
|
||||
object VideoQualityListFingerprint : LiteralValueFingerprint(
|
||||
returnType = "V",
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_INTERFACE,
|
||||
Opcode.RETURN_VOID
|
||||
),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(QualityAuto) }
|
||||
literalSupplier = { QualityAuto }
|
||||
)
|
@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.music.utils.overridespeed
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
@ -9,11 +8,12 @@ import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.music.utils.integrations.Constants.INTEGRATIONS_PATH
|
||||
import app.revanced.patches.music.utils.integrations.Constants.VIDEO_PATH
|
||||
import app.revanced.patches.music.utils.overridespeed.fingerprints.PlaybackSpeedFingerprint
|
||||
import app.revanced.patches.music.utils.overridespeed.fingerprints.PlaybackSpeedParentFingerprint
|
||||
import app.revanced.patches.music.utils.overridespeed.fingerprints.PlaybackSpeedPatchFingerprint
|
||||
import app.revanced.util.integrations.Constants.MUSIC_INTEGRATIONS_PATH
|
||||
import app.revanced.util.integrations.Constants.MUSIC_VIDEO_PATH
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction35c
|
||||
import com.android.tools.smali.dexlib2.dexbacked.reference.DexBackedMethodReference
|
||||
@ -101,10 +101,10 @@ object OverrideSpeedHookPatch : BytecodePatch(
|
||||
}
|
||||
|
||||
private const val INTEGRATIONS_PLAYBACK_SPEED_CLASS_DESCRIPTOR =
|
||||
"$MUSIC_VIDEO_PATH/PlaybackSpeedPatch;"
|
||||
"$VIDEO_PATH/PlaybackSpeedPatch;"
|
||||
|
||||
private const val INTEGRATIONS_VIDEO_HELPER_CLASS_DESCRIPTOR =
|
||||
"$MUSIC_INTEGRATIONS_PATH/utils/VideoHelpers;"
|
||||
"$INTEGRATIONS_PATH/utils/VideoHelpers;"
|
||||
|
||||
private lateinit var SPEED_CLASS: String
|
||||
private lateinit var SPEED_REFERENCE: Reference
|
||||
|
@ -1,11 +1,11 @@
|
||||
package app.revanced.patches.music.utils.playerresponse
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.music.utils.playerresponse.fingerprints.PlaybackStartDescriptorFingerprint
|
||||
import app.revanced.util.exception
|
||||
|
||||
object PlayerResponsePatch : BytecodePatch(
|
||||
setOf(PlaybackStartDescriptorFingerprint)
|
||||
|
@ -1,11 +1,11 @@
|
||||
package app.revanced.patches.music.utils.playertype
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patches.music.utils.integrations.Constants.UTILS_PATH
|
||||
import app.revanced.patches.music.utils.playertype.fingerprint.PlayerTypeFingerprint
|
||||
import app.revanced.util.integrations.Constants.MUSIC_UTILS_PATH
|
||||
import app.revanced.util.exception
|
||||
|
||||
@Suppress("unused")
|
||||
object PlayerTypeHookPatch : BytecodePatch(
|
||||
@ -25,5 +25,5 @@ object PlayerTypeHookPatch : BytecodePatch(
|
||||
}
|
||||
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"$MUSIC_UTILS_PATH/PlayerTypeHookPatch;"
|
||||
"$UTILS_PATH/PlayerTypeHookPatch;"
|
||||
}
|
||||
|
@ -4,14 +4,14 @@ import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
|
||||
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
|
||||
import app.revanced.patches.shared.patch.mapping.ResourceType
|
||||
import app.revanced.patches.shared.patch.mapping.ResourceType.BOOL
|
||||
import app.revanced.patches.shared.patch.mapping.ResourceType.COLOR
|
||||
import app.revanced.patches.shared.patch.mapping.ResourceType.DIMEN
|
||||
import app.revanced.patches.shared.patch.mapping.ResourceType.ID
|
||||
import app.revanced.patches.shared.patch.mapping.ResourceType.LAYOUT
|
||||
import app.revanced.patches.shared.patch.mapping.ResourceType.STRING
|
||||
import app.revanced.patches.shared.patch.mapping.ResourceType.STYLE
|
||||
|
||||
@Patch(dependencies = [ResourceMappingPatch::class])
|
||||
object SharedResourceIdPatch : ResourcePatch() {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user