mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-13 05:37:40 +02:00
fix(youtube/spoof-player-parameters): fix some side effects
This commit is contained in:
@ -6,7 +6,7 @@ import app.revanced.util.bytecode.isWideLiteralExists
|
|||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
object PlayerResponseModelImplFingerprint : MethodFingerprint(
|
object PlayerResponseModelImplGeneralFingerprint : MethodFingerprint(
|
||||||
returnType = "Ljava/lang/String;",
|
returnType = "Ljava/lang/String;",
|
||||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = emptyList(),
|
parameters = emptyList(),
|
@ -0,0 +1,23 @@
|
|||||||
|
package app.revanced.patches.youtube.utils.fix.parameter.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
|
object PlayerResponseModelImplLiveStreamFingerprint : MethodFingerprint(
|
||||||
|
returnType = "Ljava/lang/String;",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = emptyList(),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.RETURN_OBJECT,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.RETURN_OBJECT
|
||||||
|
),
|
||||||
|
customFingerprint = { methodDef, _ ->
|
||||||
|
methodDef.definingClass.endsWith("/PlayerResponseModelImpl;") && methodDef.isWideLiteralExists(
|
||||||
|
70276274
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
@ -3,10 +3,12 @@ package app.revanced.patches.youtube.utils.fix.parameter.fingerprints
|
|||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
object StoryboardRendererSpecFingerprint : MethodFingerprint(
|
object StoryboardRendererSpecFingerprint : MethodFingerprint(
|
||||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||||
returnType = "L",
|
returnType = "L",
|
||||||
parameters = listOf("Ljava/lang/String;", "J"),
|
parameters = listOf("Ljava/lang/String;", "J"),
|
||||||
|
opcodes = listOf(Opcode.IF_EQZ),
|
||||||
strings = listOf("\\|"),
|
strings = listOf("\\|"),
|
||||||
)
|
)
|
@ -0,0 +1,15 @@
|
|||||||
|
package app.revanced.patches.youtube.utils.fix.parameter.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
|
object StoryboardRendererSpecRecommendedLevelFingerprint : MethodFingerprint(
|
||||||
|
strings = listOf("#-1#"),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.INVOKE_INTERFACE,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.INVOKE_INTERFACE,
|
||||||
|
Opcode.MOVE_RESULT
|
||||||
|
)
|
||||||
|
)
|
@ -15,25 +15,35 @@ import app.revanced.patcher.patch.annotations.Patch
|
|||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||||
import app.revanced.patches.youtube.utils.fix.parameter.fingerprints.PlayerParameterBuilderFingerprint
|
import app.revanced.patches.youtube.utils.fix.parameter.fingerprints.PlayerParameterBuilderFingerprint
|
||||||
import app.revanced.patches.youtube.utils.fix.parameter.fingerprints.PlayerResponseModelImplFingerprint
|
import app.revanced.patches.youtube.utils.fix.parameter.fingerprints.PlayerResponseModelImplGeneralFingerprint
|
||||||
|
import app.revanced.patches.youtube.utils.fix.parameter.fingerprints.PlayerResponseModelImplLiveStreamFingerprint
|
||||||
import app.revanced.patches.youtube.utils.fix.parameter.fingerprints.StoryboardRendererSpecFingerprint
|
import app.revanced.patches.youtube.utils.fix.parameter.fingerprints.StoryboardRendererSpecFingerprint
|
||||||
|
import app.revanced.patches.youtube.utils.fix.parameter.fingerprints.StoryboardRendererSpecRecommendedLevelFingerprint
|
||||||
import app.revanced.patches.youtube.utils.fix.parameter.fingerprints.StoryboardThumbnailFingerprint
|
import app.revanced.patches.youtube.utils.fix.parameter.fingerprints.StoryboardThumbnailFingerprint
|
||||||
import app.revanced.patches.youtube.utils.fix.parameter.fingerprints.StoryboardThumbnailParentFingerprint
|
import app.revanced.patches.youtube.utils.fix.parameter.fingerprints.StoryboardThumbnailParentFingerprint
|
||||||
import app.revanced.patches.youtube.utils.playertype.patch.PlayerTypeHookPatch
|
import app.revanced.patches.youtube.utils.playertype.patch.PlayerTypeHookPatch
|
||||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||||
import app.revanced.util.integrations.Constants.MISC_PATH
|
import app.revanced.util.integrations.Constants.MISC_PATH
|
||||||
|
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
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("Spoof player parameters")
|
@Name("Spoof player parameters")
|
||||||
@Description("Spoofs player parameters to prevent playback issues.")
|
@Description("Spoofs player parameters to prevent playback issues.")
|
||||||
@DependsOn([PlayerTypeHookPatch::class])
|
@DependsOn(
|
||||||
|
[
|
||||||
|
PlayerTypeHookPatch::class,
|
||||||
|
SettingsPatch::class
|
||||||
|
]
|
||||||
|
)
|
||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
class SpoofPlayerParameterPatch : BytecodePatch(
|
class SpoofPlayerParameterPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
PlayerParameterBuilderFingerprint,
|
PlayerParameterBuilderFingerprint,
|
||||||
PlayerResponseModelImplFingerprint,
|
PlayerResponseModelImplGeneralFingerprint,
|
||||||
|
PlayerResponseModelImplLiveStreamFingerprint,
|
||||||
StoryboardRendererSpecFingerprint,
|
StoryboardRendererSpecFingerprint,
|
||||||
|
StoryboardRendererSpecRecommendedLevelFingerprint,
|
||||||
StoryboardThumbnailParentFingerprint
|
StoryboardThumbnailParentFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
@ -88,37 +98,60 @@ class SpoofPlayerParameterPatch : BytecodePatch(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook StoryBoard Renderer URL
|
* Hook StoryBoard Renderer URL
|
||||||
* TODO: Find a way to increase the quality of SeekBar thumbnail previews
|
|
||||||
*/
|
*/
|
||||||
PlayerResponseModelImplFingerprint.result?.let {
|
arrayOf(
|
||||||
|
PlayerResponseModelImplGeneralFingerprint,
|
||||||
|
PlayerResponseModelImplLiveStreamFingerprint,
|
||||||
|
StoryboardRendererSpecFingerprint
|
||||||
|
).forEach { fingerprint ->
|
||||||
|
fingerprint.result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val getStoryBoardIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
val getStoryBoardRegister =
|
||||||
|
getInstruction<OneRegisterInstruction>(getStoryBoardIndex).registerA
|
||||||
|
|
||||||
|
addInstructionsWithLabels(
|
||||||
|
getStoryBoardIndex, """
|
||||||
|
if-nez v$getStoryBoardRegister, :ignore
|
||||||
|
invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->getStoryboardRendererSpec()Ljava/lang/String;
|
||||||
|
move-result-object v$getStoryBoardRegister
|
||||||
|
""", ExternalLabel("ignore", getInstruction(getStoryBoardIndex))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: throw fingerprint.exception
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hook recommended value and StoryBoard Renderer for live stream
|
||||||
|
*/
|
||||||
|
StoryboardRendererSpecRecommendedLevelFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val getStoryBoardIndex = it.scanResult.patternScanResult!!.endIndex
|
val moveOriginalRecommendedValueIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val getStoryBoardRegister =
|
val originalValueRegister =
|
||||||
getInstruction<OneRegisterInstruction>(getStoryBoardIndex).registerA
|
getInstruction<OneRegisterInstruction>(moveOriginalRecommendedValueIndex).registerA
|
||||||
|
|
||||||
|
val liveStreamStoryBoardUrlIndex =
|
||||||
|
implementation!!.instructions.indexOfFirst { instruction ->
|
||||||
|
instruction.opcode == Opcode.INVOKE_INTERFACE
|
||||||
|
} + 1
|
||||||
|
val liveStreamStoryBoardUrlRegister =
|
||||||
|
getInstruction<OneRegisterInstruction>(liveStreamStoryBoardUrlIndex).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
getStoryBoardIndex, """
|
moveOriginalRecommendedValueIndex + 1, """
|
||||||
invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->getStoryboardRendererSpec()Ljava/lang/String;
|
invoke-static { v$originalValueRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->getRecommendedLevel(I)I
|
||||||
move-result-object v$getStoryBoardRegister
|
move-result v$originalValueRegister
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
addInstructions(
|
||||||
|
liveStreamStoryBoardUrlIndex + 1, """
|
||||||
|
invoke-static { v$liveStreamStoryBoardUrlRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->getStoryboardRendererSpec(Ljava/lang/String;)Ljava/lang/String;
|
||||||
|
move-result-object v$liveStreamStoryBoardUrlRegister
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} ?: throw PlayerResponseModelImplFingerprint.exception
|
} ?: throw StoryboardRendererSpecRecommendedLevelFingerprint.exception
|
||||||
|
|
||||||
StoryboardRendererSpecFingerprint.result?.let {
|
|
||||||
it.mutableMethod.apply {
|
|
||||||
val storyBoardUrlParams = 0
|
|
||||||
|
|
||||||
addInstructionsWithLabels(
|
|
||||||
0, """
|
|
||||||
if-nez p$storyBoardUrlParams, :ignore
|
|
||||||
invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->getStoryboardRendererSpec()Ljava/lang/String;
|
|
||||||
move-result-object p$storyBoardUrlParams
|
|
||||||
""", ExternalLabel("ignore", getInstruction(0))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} ?: throw StoryboardRendererSpecFingerprint.exception
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
|
@ -639,8 +639,8 @@ If later turned off, the old UI may remain until clear the app data"</string>
|
|||||||
|
|
||||||
Known issues
|
Known issues
|
||||||
• Enhanced bitrate is not available
|
• Enhanced bitrate is not available
|
||||||
• Offline downloads may not work
|
• No seekbar thumbnails for paid videos
|
||||||
• SeekBar thumbnail preview quality is very low"</string>
|
• Offline downloads may not work"</string>
|
||||||
<string name="revanced_spoof_player_parameter_title">Spoof player parameter</string>
|
<string name="revanced_spoof_player_parameter_title">Spoof player parameter</string>
|
||||||
<string name="revanced_swipe_controls">Swipe controls</string>
|
<string name="revanced_swipe_controls">Swipe controls</string>
|
||||||
<string name="revanced_swipe_magnitude_threshold_summary">The amount of threshold for swipe to occur</string>
|
<string name="revanced_swipe_magnitude_threshold_summary">The amount of threshold for swipe to occur</string>
|
||||||
|
Reference in New Issue
Block a user