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.patch.BytecodePatch
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.misc.splash.fingerprints.CairoSplashAnimationConfigFingerprint
@ -18,7 +19,8 @@ import app.revanced.util.literalInstructionBooleanHook
CompatiblePackage(
"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) {
CairoSplashAnimationConfigFingerprint.literalInstructionBooleanHook(
45635386,
"$MISC_PATH/CairoSplashAnimationPatch;->enableCairoSplashAnimation()Z"
)
CairoSplashAnimationConfigFingerprint.result?.let {
CairoSplashAnimationConfigFingerprint.literalInstructionBooleanHook(
45635386,
"$MISC_PATH/CairoSplashAnimationPatch;->enableCairoSplashAnimation()Z"
)
SettingsPatch.addSwitchPreference(
CategoryType.MISC,
"revanced_enable_cairo_splash_animation",
"false"
)
SettingsPatch.addSwitchPreference(
CategoryType.MISC,
"revanced_enable_cairo_splash_animation",
"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.integrations.Constants.NAVIGATION_CLASS_DESCRIPTOR
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.SettingsPatch
import app.revanced.util.getReference
import app.revanced.util.getTargetIndexOrThrow
import app.revanced.util.getTargetIndexWithMethodReferenceNameOrThrow
import app.revanced.util.getWideLiteralInstructionIndex
import app.revanced.util.indexOfFirstInstructionOrThrow
import app.revanced.util.patch.BaseBytecodePatch
import app.revanced.util.resultOrThrow
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.ReferenceInstruction
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
@Suppress("DEPRECATION", "SpellCheckingInspection", "unused")
object NavigationBarComponentsPatch : BaseBytecodePatch(
@ -44,18 +49,20 @@ object NavigationBarComponentsPatch : BaseBytecodePatch(
/**
* Enable black navigation bar
*/
TabLayoutFingerprint.resultOrThrow().let {
it.mutableMethod.apply {
val targetIndex = it.scanResult.patternScanResult!!.endIndex
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
addInstructions(
targetIndex + 1, """
invoke-static {}, $NAVIGATION_CLASS_DESCRIPTOR->enableBlackNavigationBar()I
move-result v$targetRegister
"""
)
TabLayoutFingerprint.resultOrThrow().mutableMethod.apply {
val constIndex = getWideLiteralInstructionIndex(ColorGrey)
val insertIndex = indexOfFirstInstructionOrThrow(constIndex) {
opcode == Opcode.INVOKE_VIRTUAL
&& getReference<MethodReference>()?.name == "setBackgroundColor"
}
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.util.fingerprint.LiteralValueFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
internal object TabLayoutFingerprint : LiteralValueFingerprint(
returnType = "V",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = emptyList(),
opcodes = listOf(
Opcode.CONST,
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT
),
strings = listOf("FEmusic_radio_builder"),
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.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
"7.08.54", // 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.11.51", // This was the latest version that was supported by the previous 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) =
onCreateMethod.injectMethodCall(classDescriptor, methodDescriptor)
private fun getMethod(methodDescriptor: String) =
internal fun getMethod(methodDescriptor: String) =
mainActivityMutableClass.methods.find { method -> method.name == methodDescriptor }
?: throw PatchException("Could not find $methodDescriptor")