feat(YouTube): Support version 18.29.38
This commit is contained in:
+2
-4
@@ -10,6 +10,7 @@ object VideoIdFingerprint : MethodFingerprint(
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.IF_EQZ,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
@@ -23,8 +24,5 @@ object VideoIdFingerprint : MethodFingerprint(
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.INVOKE_INTERFACE,
|
||||
Opcode.MOVE_RESULT_OBJECT
|
||||
),
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.definingClass.endsWith("SubtitlesOverlayPresenter;")
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
+17
-4
@@ -9,8 +9,21 @@ object VideoIdFingerprintBackgroundPlay : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.DECLARED_SYNCHRONIZED or AccessFlags.FINAL or AccessFlags.PUBLIC,
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(Opcode.INVOKE_INTERFACE),
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.definingClass.endsWith("PlaybackLifecycleMonitor;")
|
||||
}
|
||||
opcodes = listOf(
|
||||
Opcode.MONITOR_EXIT,
|
||||
Opcode.RETURN_VOID,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.NEW_ARRAY,
|
||||
Opcode.SGET_OBJECT,
|
||||
Opcode.APUT_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.IF_EQZ,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.IF_EQZ,
|
||||
Opcode.INVOKE_INTERFACE,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -6,6 +6,7 @@ import app.revanced.patcher.annotation.Name
|
||||
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.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
@@ -25,27 +26,33 @@ class VideoIdPatch : BytecodePatch(
|
||||
listOf(VideoIdFingerprint, VideoIdFingerprintBackgroundPlay)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
VideoIdFingerprint.result?.let { result ->
|
||||
val videoIdRegisterInstructionIndex = result.scanResult.patternScanResult!!.endIndex
|
||||
/**
|
||||
* Supplies the method and register index of the video id register.
|
||||
*
|
||||
* @param consumer Consumer that receives the method, insert index and video id register index.
|
||||
*/
|
||||
fun MethodFingerprint.setFields(consumer: (MutableMethod, Int, Int) -> Unit) = result?.let { result ->
|
||||
val videoIdRegisterIndex = result.scanResult.patternScanResult!!.endIndex
|
||||
|
||||
result.mutableMethod.let {
|
||||
val videoIdRegister = it.getInstruction<OneRegisterInstruction>(videoIdRegisterIndex).registerA
|
||||
val insertIndex = videoIdRegisterIndex + 1
|
||||
consumer(it, insertIndex, videoIdRegister)
|
||||
|
||||
result.mutableMethod.also {
|
||||
insertMethod = it
|
||||
}.apply {
|
||||
videoIdRegister = getInstruction<OneRegisterInstruction>(videoIdRegisterInstructionIndex).registerA
|
||||
insertIndex = videoIdRegisterInstructionIndex + 1
|
||||
}
|
||||
} ?: return VideoIdFingerprint.toErrorResult()
|
||||
} ?: throw VideoIdFingerprint.toErrorResult()
|
||||
|
||||
VideoIdFingerprintBackgroundPlay.result?.let { result ->
|
||||
val endIndex = result.scanResult.patternScanResult!!.endIndex
|
||||
VideoIdFingerprint.setFields { method, insertIndex, videoIdRegister ->
|
||||
insertMethod = method
|
||||
VideoIdPatch.insertIndex = insertIndex
|
||||
VideoIdPatch.videoIdRegister = videoIdRegister
|
||||
}
|
||||
|
||||
result.mutableMethod.also {
|
||||
backgroundPlaybackMethod = it
|
||||
}.apply {
|
||||
backgroundPlaybackVideoIdRegister = getInstruction<OneRegisterInstruction>(endIndex + 1).registerA
|
||||
backgroundPlaybackInsertIndex = endIndex + 2
|
||||
}
|
||||
} ?: return VideoIdFingerprintBackgroundPlay.toErrorResult()
|
||||
VideoIdFingerprintBackgroundPlay.setFields { method, insertIndex, videoIdRegister ->
|
||||
backgroundPlaybackMethod = method
|
||||
backgroundPlaybackInsertIndex = insertIndex
|
||||
backgroundPlaybackVideoIdRegister = videoIdRegister
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user