feat(YouTube Music): add support version 7.05.52

This commit is contained in:
inotia00 2024-06-13 00:33:41 +09:00
parent a4c50493f7
commit 58e93da4f8
3 changed files with 28 additions and 23 deletions

View File

@ -75,8 +75,18 @@ object BackgroundPlaybackPatch : BaseBytecodePatch(
} }
// don't play podcast videos // don't play podcast videos
PodCastConfigFingerprint.resultOrThrow().let { // enable by default from YouTube Music 7.05.52+
it.mutableMethod.apply {
val podCastConfigFingerprintResult = PodCastConfigFingerprint.result
val dataSavingSettingsFragmentFingerprintResult =
DataSavingSettingsFragmentFingerprint.result
val isPatchingOldVersion =
podCastConfigFingerprintResult != null
&& dataSavingSettingsFragmentFingerprintResult != null
if (isPatchingOldVersion) {
podCastConfigFingerprintResult!!.mutableMethod.apply {
val insertIndex = implementation!!.instructions.size - 1 val insertIndex = implementation!!.instructions.size - 1
val targetRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA val targetRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
@ -85,11 +95,8 @@ object BackgroundPlaybackPatch : BaseBytecodePatch(
"const/4 v$targetRegister, 0x1" "const/4 v$targetRegister, 0x1"
) )
} }
}
// don't play podcast videos dataSavingSettingsFragmentFingerprintResult!!.mutableMethod.apply {
DataSavingSettingsFragmentFingerprint.resultOrThrow().let {
it.mutableMethod.apply {
val insertIndex = getStringInstructionIndex("pref_key_dont_play_nma_video") + 4 val insertIndex = getStringInstructionIndex("pref_key_dont_play_nma_video") + 4
val targetRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerD val targetRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerD

View File

@ -7,11 +7,12 @@ object Constants {
Patch.CompatiblePackage( Patch.CompatiblePackage(
"com.google.android.apps.youtube.music", "com.google.android.apps.youtube.music",
setOf( setOf(
"6.29.58", // Latest version that supports the 'Restore old player layout' setting. "6.29.58", // This is the latest version that supports the 'Restore old player layout' setting.
"6.33.52", // 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", // Latest version that supports Android 7.0 "6.42.55", // This is the latest version that supports Android 7.0
"6.51.53", // Latest version of YouTube Music 6.xx.xx "6.51.53", // This is the latest version of YouTube Music 6.xx.xx
"7.04.51", // Latest version supported by the RVX patch. "7.04.51", // This was the latest version that was supported by the previous patch.
"7.05.52", // This is the latest version supported by the RVX patch.
) )
) )
) )

View File

@ -1,25 +1,22 @@
package app.revanced.patches.music.utils.integrations.fingerprints package app.revanced.patches.music.utils.integrations.fingerprints
import app.revanced.patches.music.utils.integrations.fingerprints.InitFingerprint.indexOfGetProcessNameInstruction
import app.revanced.patches.shared.integrations.BaseIntegrationsPatch.IntegrationsFingerprint import app.revanced.patches.shared.integrations.BaseIntegrationsPatch.IntegrationsFingerprint
import app.revanced.util.getReference import app.revanced.util.getReference
import app.revanced.util.indexOfFirstInstruction import app.revanced.util.indexOfFirstInstruction
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.Method
import com.android.tools.smali.dexlib2.iface.reference.MethodReference import com.android.tools.smali.dexlib2.iface.reference.MethodReference
internal object InitFingerprint : IntegrationsFingerprint( internal object InitFingerprint : IntegrationsFingerprint(
returnType = "V", returnType = "V",
parameters = emptyList(), parameters = emptyList(),
strings = listOf("activity"), strings = listOf("activity"),
customFingerprint = { methodDef, _ -> customFingerprint = handler@{ methodDef, _ ->
methodDef.name == "onCreate" if (methodDef.name != "onCreate")
&& indexOfGetProcessNameInstruction(methodDef) >= 0 return@handler false
}
) {
fun indexOfGetProcessNameInstruction(methodDef: Method) =
methodDef.indexOfFirstInstruction { methodDef.indexOfFirstInstruction {
opcode == Opcode.INVOKE_STATIC opcode == Opcode.INVOKE_VIRTUAL
&& getReference<MethodReference>()?.name == "getProcessName" && getReference<MethodReference>()?.name == "getRunningAppProcesses"
} } >= 0
} }
)