feat(YouTube): add support version 19.26.42

This commit is contained in:
inotia00 2024-07-14 14:35:37 +09:00
parent 355490cbd0
commit 3de7307a95
4 changed files with 26 additions and 37 deletions

View File

@ -13,7 +13,7 @@ object Constants {
"18.48.39", // This is the last version that do not use Rolling Number. "18.48.39", // This is the last version that do not use Rolling Number.
"19.05.36", // This is the last version with the least YouTube experimental flag. "19.05.36", // This is the last version with the least YouTube experimental flag.
"19.16.39", // This is the last version that supports the 'Restore old seekbar thumbnails' setting. "19.16.39", // This is the last version that supports the 'Restore old seekbar thumbnails' setting.
"19.25.39", // This is the latest version supported by the RVX patch. "19.26.42", // This is the latest version supported by the RVX patch.
) )
) )
) )

View File

@ -1,16 +1,8 @@
package app.revanced.patches.youtube.utils.fingerprints package app.revanced.patches.youtube.utils.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint import app.revanced.util.fingerprint.LiteralValueFingerprint
import com.android.tools.smali.dexlib2.Opcode
internal object VideoEndFingerprint : MethodFingerprint( internal object VideoEndFingerprint : LiteralValueFingerprint(
opcodes = listOf( strings = listOf("Attempting to seek during an ad"),
Opcode.INVOKE_VIRTUAL, literalSupplier = { 45368273 }
Opcode.INVOKE_VIRTUAL_RANGE,
Opcode.IGET_OBJECT,
Opcode.IGET_OBJECT,
Opcode.CHECK_CAST,
Opcode.CONST_WIDE_32
),
strings = listOf("Attempting to seek during an ad")
) )

View File

@ -3,13 +3,18 @@ package app.revanced.patches.youtube.utils.recyclerview
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.fingerprint.MethodFingerprintResult
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.youtube.utils.recyclerview.fingerprints.BottomSheetRecyclerViewBuilderFingerprint import app.revanced.patches.youtube.utils.recyclerview.fingerprints.BottomSheetRecyclerViewBuilderFingerprint
import app.revanced.patches.youtube.utils.recyclerview.fingerprints.RecyclerViewTreeObserverFingerprint import app.revanced.patches.youtube.utils.recyclerview.fingerprints.RecyclerViewTreeObserverFingerprint
import app.revanced.util.getReference
import app.revanced.util.getTargetIndexReversedOrThrow
import app.revanced.util.getWideLiteralInstructionIndex import app.revanced.util.getWideLiteralInstructionIndex
import app.revanced.util.indexOfFirstInstructionOrThrow
import app.revanced.util.resultOrThrow import app.revanced.util.resultOrThrow
import com.android.tools.smali.dexlib2.Opcode
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.reference.FieldReference
object BottomSheetRecyclerViewPatch : BytecodePatch( object BottomSheetRecyclerViewPatch : BytecodePatch(
setOf( setOf(
@ -17,7 +22,9 @@ object BottomSheetRecyclerViewPatch : BytecodePatch(
RecyclerViewTreeObserverFingerprint RecyclerViewTreeObserverFingerprint
) )
) { ) {
private lateinit var recyclerViewTreeObserverResult: MethodFingerprintResult private lateinit var recyclerViewTreeObserverMutableMethod: MutableMethod
private var recyclerViewTreeObserverInsertIndex = 0
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
@ -39,22 +46,21 @@ object BottomSheetRecyclerViewPatch : BytecodePatch(
} }
} }
recyclerViewTreeObserverResult = RecyclerViewTreeObserverFingerprint.resultOrThrow() RecyclerViewTreeObserverFingerprint.resultOrThrow().mutableMethod.apply {
recyclerViewTreeObserverMutableMethod = this
} val onDrawListenerIndex = indexOfFirstInstructionOrThrow {
opcode == Opcode.IPUT_OBJECT
fun injectCall(descriptor: String) { && getReference<FieldReference>()?.type == "Landroid/view/ViewTreeObserver${'$'}OnDrawListener;"
recyclerViewTreeObserverResult.let {
it.mutableMethod.apply {
val insertIndex = it.scanResult.patternScanResult!!.startIndex
val recyclerViewRegister = 2
addInstruction(
insertIndex,
"invoke-static/range { p$recyclerViewRegister .. p$recyclerViewRegister }, $descriptor"
)
} }
recyclerViewTreeObserverInsertIndex = getTargetIndexReversedOrThrow(onDrawListenerIndex, Opcode.CHECK_CAST) + 1
} }
} }
internal fun injectCall(descriptor: String) =
recyclerViewTreeObserverMutableMethod.addInstruction(
recyclerViewTreeObserverInsertIndex++,
"invoke-static/range { p2 .. p2 }, $descriptor"
)
} }

View File

@ -3,18 +3,9 @@ package app.revanced.patches.youtube.utils.recyclerview.fingerprints
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.MethodFingerprint import app.revanced.patcher.fingerprint.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
internal object RecyclerViewTreeObserverFingerprint : MethodFingerprint( internal object RecyclerViewTreeObserverFingerprint : MethodFingerprint(
returnType = "V", returnType = "V",
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
opcodes = listOf(
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT,
Opcode.INVOKE_VIRTUAL,
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT,
Opcode.IPUT_OBJECT
),
strings = listOf("LithoRVSLCBinder") strings = listOf("LithoRVSLCBinder")
) )