Skip to content

Commit b8a62ae

Browse files
inotia00anddea
authored andcommitted
feat(YouTube Music): Add support version 7.11.51 ~ 7.12.51
1 parent d756780 commit b8a62ae

5 files changed

Lines changed: 37 additions & 30 deletions

File tree

src/main/kotlin/app/revanced/patches/music/misc/splash/CairoSplashAnimationPatch.kt

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package app.revanced.patches.music.misc.splash
22

33
import app.revanced.patcher.data.BytecodeContext
44
import app.revanced.patcher.patch.BytecodePatch
5+
import app.revanced.patcher.patch.PatchException
56
import app.revanced.patcher.patch.annotation.CompatiblePackage
67
import app.revanced.patcher.patch.annotation.Patch
78
import app.revanced.patches.music.misc.splash.fingerprints.CairoSplashAnimationConfigFingerprint
@@ -18,7 +19,8 @@ import app.revanced.util.literalInstructionBooleanHook
1819
CompatiblePackage(
1920
"com.google.android.apps.youtube.music",
2021
[
21-
"7.08.52",
22+
"7.08.54",
23+
"7.12.51",
2224
]
2325
)
2426
]
@@ -29,16 +31,19 @@ object CairoSplashAnimationPatch : BytecodePatch(
2931
) {
3032
override fun execute(context: BytecodeContext) {
3133

32-
CairoSplashAnimationConfigFingerprint.literalInstructionBooleanHook(
33-
45635386,
34-
"$MISC_PATH/CairoSplashAnimationPatch;->enableCairoSplashAnimation()Z"
35-
)
34+
CairoSplashAnimationConfigFingerprint.result?.let {
35+
CairoSplashAnimationConfigFingerprint.literalInstructionBooleanHook(
36+
45635386,
37+
"$MISC_PATH/CairoSplashAnimationPatch;->enableCairoSplashAnimation()Z"
38+
)
3639

37-
SettingsPatch.addSwitchPreference(
38-
CategoryType.MISC,
39-
"revanced_enable_cairo_splash_animation",
40-
"false"
41-
)
40+
SettingsPatch.addSwitchPreference(
41+
CategoryType.MISC,
42+
"revanced_enable_cairo_splash_animation",
43+
"false"
44+
)
45+
46+
} ?: throw PatchException("WARNING: This patch is not supported in this version. Use YouTube Music 7.08.54 or later.")
4247

4348
}
4449
}

src/main/kotlin/app/revanced/patches/music/navigation/components/NavigationBarComponentsPatch.kt

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,22 @@ import app.revanced.patches.music.navigation.components.fingerprints.TabLayoutTe
1010
import app.revanced.patches.music.utils.compatibility.Constants.COMPATIBLE_PACKAGE
1111
import app.revanced.patches.music.utils.integrations.Constants.NAVIGATION_CLASS_DESCRIPTOR
1212
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
13+
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.ColorGrey
1314
import app.revanced.patches.music.utils.settings.CategoryType
1415
import app.revanced.patches.music.utils.settings.SettingsPatch
16+
import app.revanced.util.getReference
1517
import app.revanced.util.getTargetIndexOrThrow
1618
import app.revanced.util.getTargetIndexWithMethodReferenceNameOrThrow
1719
import app.revanced.util.getWideLiteralInstructionIndex
20+
import app.revanced.util.indexOfFirstInstructionOrThrow
1821
import app.revanced.util.patch.BaseBytecodePatch
1922
import app.revanced.util.resultOrThrow
2023
import com.android.tools.smali.dexlib2.Opcode
24+
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
2125
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
2226
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
2327
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
28+
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
2429

2530
@Suppress("DEPRECATION", "SpellCheckingInspection", "unused")
2631
object NavigationBarComponentsPatch : BaseBytecodePatch(
@@ -44,18 +49,20 @@ object NavigationBarComponentsPatch : BaseBytecodePatch(
4449
/**
4550
* Enable black navigation bar
4651
*/
47-
TabLayoutFingerprint.resultOrThrow().let {
48-
it.mutableMethod.apply {
49-
val targetIndex = it.scanResult.patternScanResult!!.endIndex
50-
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
51-
52-
addInstructions(
53-
targetIndex + 1, """
54-
invoke-static {}, $NAVIGATION_CLASS_DESCRIPTOR->enableBlackNavigationBar()I
55-
move-result v$targetRegister
56-
"""
57-
)
52+
TabLayoutFingerprint.resultOrThrow().mutableMethod.apply {
53+
val constIndex = getWideLiteralInstructionIndex(ColorGrey)
54+
val insertIndex = indexOfFirstInstructionOrThrow(constIndex) {
55+
opcode == Opcode.INVOKE_VIRTUAL
56+
&& getReference<MethodReference>()?.name == "setBackgroundColor"
5857
}
58+
val insertRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerD
59+
60+
addInstructions(
61+
insertIndex, """
62+
invoke-static {}, $NAVIGATION_CLASS_DESCRIPTOR->enableBlackNavigationBar()I
63+
move-result v$insertRegister
64+
"""
65+
)
5966
}
6067

6168
/**

src/main/kotlin/app/revanced/patches/music/navigation/components/fingerprints/TabLayoutFingerprint.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,12 @@ import app.revanced.patcher.extensions.or
44
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.ColorGrey
55
import app.revanced.util.fingerprint.LiteralValueFingerprint
66
import com.android.tools.smali.dexlib2.AccessFlags
7-
import com.android.tools.smali.dexlib2.Opcode
87

98
internal object TabLayoutFingerprint : LiteralValueFingerprint(
109
returnType = "V",
1110
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
1211
parameters = emptyList(),
13-
opcodes = listOf(
14-
Opcode.CONST,
15-
Opcode.INVOKE_STATIC,
16-
Opcode.MOVE_RESULT
17-
),
12+
strings = listOf("FEmusic_radio_builder"),
1813
literalSupplier = { ColorGrey }
1914
)
2015

src/main/kotlin/app/revanced/patches/music/utils/compatibility/Constants.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ object Constants {
1111
"6.33.52", // This is the latest version with the legacy code of YouTube Music.
1212
"6.42.55", // This is the latest version that supports Android 7.0
1313
"6.51.53", // This is the latest version of YouTube Music 6.xx.xx
14-
"7.08.54", // This was the latest version that was supported by the previous patch.
15-
"7.10.52", // This is the latest version supported by the RVX patch.
14+
"7.11.51", // This was the latest version that was supported by the previous patch.
15+
"7.12.51", // This is the latest version supported by the RVX patch.
1616
)
1717
)
1818
)

src/main/kotlin/app/revanced/patches/shared/mainactivity/BaseMainActivityResolvePatch.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ abstract class BaseMainActivityResolvePatch(
6161
fun injectOnCreateMethodCall(classDescriptor: String, methodDescriptor: String) =
6262
onCreateMethod.injectMethodCall(classDescriptor, methodDescriptor)
6363

64-
private fun getMethod(methodDescriptor: String) =
64+
internal fun getMethod(methodDescriptor: String) =
6565
mainActivityMutableClass.methods.find { method -> method.name == methodDescriptor }
6666
?: throw PatchException("Could not find $methodDescriptor")
6767

0 commit comments

Comments
 (0)