fix(YouTube - Spoof video streams): Make it work on 21.x (#6705)
Co-authored-by: wowitsjack <no@email> Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
f045923cef
commit
fdfed3c9dd
8 changed files with 24 additions and 22 deletions
|
|
@ -216,10 +216,10 @@ internal fun spoofVideoStreamsPatch(
|
|||
// A proper fix may include modifying the request body to match the platforms expected body.
|
||||
|
||||
buildMediaDataSourceMethod.apply {
|
||||
val targetIndex = instructions.count() - 1
|
||||
// Find return-void, not the last instruction, which may be a throw in an error branch
|
||||
// where p0 is overwritten by new-instance IllegalArgumentException.
|
||||
val targetIndex = indexOfFirstInstructionOrThrow(Opcode.RETURN_VOID)
|
||||
|
||||
// Instructions are added just before the method returns,
|
||||
// so there's no concern of clobbering in-use registers.
|
||||
addInstructions(
|
||||
targetIndex,
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ internal val BytecodePatchContext.fullscreenButtonMethodMatch by composingFirstM
|
|||
returnType("V")
|
||||
instructions(
|
||||
ResourceType.ID("fullscreen_button"),
|
||||
Opcode.CHECK_CAST()
|
||||
Opcode.INVOKE_VIRTUAL(), // findViewById call.
|
||||
Opcode.MOVE_RESULT_OBJECT() // The actual view, not a check-cast in 21.x.
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -169,14 +169,16 @@ val hidePlayerOverlayButtonsPatch = bytecodePatch(
|
|||
|
||||
fullscreenButtonMethodMatch.let {
|
||||
it.method.apply {
|
||||
val castIndex = it[1]
|
||||
val insertIndex = castIndex + 1
|
||||
val insertRegister = getInstruction<OneRegisterInstruction>(castIndex).registerA
|
||||
// Youtube 21.x doesn't cast the fullscreen button to ImageView anymore,
|
||||
// so match on move-result-object after findViewById instead of check-cast.
|
||||
val moveResultIndex = it[2]
|
||||
val insertIndex = moveResultIndex + 1
|
||||
val insertRegister = getInstruction<OneRegisterInstruction>(moveResultIndex).registerA
|
||||
|
||||
addInstructionsWithLabels(
|
||||
insertIndex,
|
||||
"""
|
||||
invoke-static { v$insertRegister }, ${EXTENSION_CLASS_DESCRIPTOR}->hideFullscreenButton(Landroid/widget/ImageView;)Landroid/widget/ImageView;
|
||||
invoke-static { v$insertRegister }, ${EXTENSION_CLASS_DESCRIPTOR}->hideFullscreenButton(Landroid/view/View;)Landroid/view/View;
|
||||
move-result-object v$insertRegister
|
||||
if-nez v$insertRegister, :show
|
||||
return-void
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ internal val BytecodePatchContext.overlayViewInflateMethodMatch by composingFirs
|
|||
instructions(
|
||||
ResourceType.ID("heatseeker_viewstub"),
|
||||
ResourceType.ID("fullscreen_button"),
|
||||
allOf(Opcode.CHECK_CAST(), type("Landroid/widget/ImageView;")),
|
||||
Opcode.CHECK_CAST(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ val playerControlsPatch = bytecodePatch(
|
|||
addInstruction(
|
||||
index + 1,
|
||||
"invoke-static { v$register }, " +
|
||||
"$EXTENSION_CLASS_DESCRIPTOR->setFullscreenCloseButton(Landroid/widget/ImageView;)V",
|
||||
"$EXTENSION_CLASS_DESCRIPTOR->setFullscreenCloseButton(Landroid/view/View;)V",
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue