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.
"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.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
import app.revanced.patcher.fingerprint.MethodFingerprint
import com.android.tools.smali.dexlib2.Opcode
import app.revanced.util.fingerprint.LiteralValueFingerprint
internal object VideoEndFingerprint : MethodFingerprint(
opcodes = listOf(
Opcode.INVOKE_VIRTUAL,
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")
internal object VideoEndFingerprint : LiteralValueFingerprint(
strings = listOf("Attempting to seek during an ad"),
literalSupplier = { 45368273 }
)

View File

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