feat(YouTube Music): add support version 7.11.51 ~ 7.12.51

This commit is contained in:
inotia00
2024-07-30 22:43:27 +09:00
parent 65bb424e95
commit b31e763c86
5 changed files with 37 additions and 30 deletions

View File

@ -2,6 +2,7 @@ package app.revanced.patches.music.misc.splash
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.misc.splash.fingerprints.CairoSplashAnimationConfigFingerprint import app.revanced.patches.music.misc.splash.fingerprints.CairoSplashAnimationConfigFingerprint
@ -18,7 +19,8 @@ import app.revanced.util.literalInstructionBooleanHook
CompatiblePackage( CompatiblePackage(
"com.google.android.apps.youtube.music", "com.google.android.apps.youtube.music",
[ [
"7.08.52", "7.08.54",
"7.12.51",
] ]
) )
] ]
@ -29,16 +31,19 @@ object CairoSplashAnimationPatch : BytecodePatch(
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
CairoSplashAnimationConfigFingerprint.literalInstructionBooleanHook( CairoSplashAnimationConfigFingerprint.result?.let {
45635386, CairoSplashAnimationConfigFingerprint.literalInstructionBooleanHook(
"$MISC_PATH/CairoSplashAnimationPatch;->enableCairoSplashAnimation()Z" 45635386,
) "$MISC_PATH/CairoSplashAnimationPatch;->enableCairoSplashAnimation()Z"
)
SettingsPatch.addSwitchPreference( SettingsPatch.addSwitchPreference(
CategoryType.MISC, CategoryType.MISC,
"revanced_enable_cairo_splash_animation", "revanced_enable_cairo_splash_animation",
"false" "false"
) )
} ?: throw PatchException("WARNING: This patch is not supported in this version. Use YouTube Music 7.08.54 or later.")
} }
} }

View File

@ -10,17 +10,22 @@ import app.revanced.patches.music.navigation.components.fingerprints.TabLayoutTe
import app.revanced.patches.music.utils.compatibility.Constants.COMPATIBLE_PACKAGE import app.revanced.patches.music.utils.compatibility.Constants.COMPATIBLE_PACKAGE
import app.revanced.patches.music.utils.integrations.Constants.NAVIGATION_CLASS_DESCRIPTOR import app.revanced.patches.music.utils.integrations.Constants.NAVIGATION_CLASS_DESCRIPTOR
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.ColorGrey
import app.revanced.patches.music.utils.settings.CategoryType import app.revanced.patches.music.utils.settings.CategoryType
import app.revanced.patches.music.utils.settings.SettingsPatch import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.getReference
import app.revanced.util.getTargetIndexOrThrow import app.revanced.util.getTargetIndexOrThrow
import app.revanced.util.getTargetIndexWithMethodReferenceNameOrThrow import app.revanced.util.getTargetIndexWithMethodReferenceNameOrThrow
import app.revanced.util.getWideLiteralInstructionIndex import app.revanced.util.getWideLiteralInstructionIndex
import app.revanced.util.indexOfFirstInstructionOrThrow
import app.revanced.util.patch.BaseBytecodePatch import app.revanced.util.patch.BaseBytecodePatch
import app.revanced.util.resultOrThrow import app.revanced.util.resultOrThrow
import com.android.tools.smali.dexlib2.Opcode 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 import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
@Suppress("DEPRECATION", "SpellCheckingInspection", "unused") @Suppress("DEPRECATION", "SpellCheckingInspection", "unused")
object NavigationBarComponentsPatch : BaseBytecodePatch( object NavigationBarComponentsPatch : BaseBytecodePatch(
@ -44,18 +49,20 @@ object NavigationBarComponentsPatch : BaseBytecodePatch(
/** /**
* Enable black navigation bar * Enable black navigation bar
*/ */
TabLayoutFingerprint.resultOrThrow().let { TabLayoutFingerprint.resultOrThrow().mutableMethod.apply {
it.mutableMethod.apply { val constIndex = getWideLiteralInstructionIndex(ColorGrey)
val targetIndex = it.scanResult.patternScanResult!!.endIndex val insertIndex = indexOfFirstInstructionOrThrow(constIndex) {
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA opcode == Opcode.INVOKE_VIRTUAL
&& getReference<MethodReference>()?.name == "setBackgroundColor"
addInstructions(
targetIndex + 1, """
invoke-static {}, $NAVIGATION_CLASS_DESCRIPTOR->enableBlackNavigationBar()I
move-result v$targetRegister
"""
)
} }
val insertRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerD
addInstructions(
insertIndex, """
invoke-static {}, $NAVIGATION_CLASS_DESCRIPTOR->enableBlackNavigationBar()I
move-result v$insertRegister
"""
)
} }
/** /**

View File

@ -4,17 +4,12 @@ import app.revanced.patcher.extensions.or
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.ColorGrey import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.ColorGrey
import app.revanced.util.fingerprint.LiteralValueFingerprint import app.revanced.util.fingerprint.LiteralValueFingerprint
import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
internal object TabLayoutFingerprint : LiteralValueFingerprint( internal object TabLayoutFingerprint : LiteralValueFingerprint(
returnType = "V", returnType = "V",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = emptyList(), parameters = emptyList(),
opcodes = listOf( strings = listOf("FEmusic_radio_builder"),
Opcode.CONST,
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT
),
literalSupplier = { ColorGrey } literalSupplier = { ColorGrey }
) )

View File

@ -11,8 +11,8 @@ object Constants {
"6.33.52", // This is the latest version with the legacy code of YouTube Music. "6.33.52", // This is the latest version with the legacy code of YouTube Music.
"6.42.55", // This is the latest version that supports Android 7.0 "6.42.55", // This is the latest version that supports Android 7.0
"6.51.53", // This is the latest version of YouTube Music 6.xx.xx "6.51.53", // This is the latest version of YouTube Music 6.xx.xx
"7.08.54", // This was the latest version that was supported by the previous patch. "7.11.51", // This was the latest version that was supported by the previous patch.
"7.10.52", // This is the latest version supported by the RVX patch. "7.12.51", // This is the latest version supported by the RVX patch.
) )
) )
) )

View File

@ -61,7 +61,7 @@ abstract class BaseMainActivityResolvePatch(
fun injectOnCreateMethodCall(classDescriptor: String, methodDescriptor: String) = fun injectOnCreateMethodCall(classDescriptor: String, methodDescriptor: String) =
onCreateMethod.injectMethodCall(classDescriptor, methodDescriptor) onCreateMethod.injectMethodCall(classDescriptor, methodDescriptor)
private fun getMethod(methodDescriptor: String) = internal fun getMethod(methodDescriptor: String) =
mainActivityMutableClass.methods.find { method -> method.name == methodDescriptor } mainActivityMutableClass.methods.find { method -> method.name == methodDescriptor }
?: throw PatchException("Could not find $methodDescriptor") ?: throw PatchException("Could not find $methodDescriptor")