mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-13 05:37:40 +02:00
fix(YouTube/Spoof client): player gestures not working when spoofing with Android VR
client
This commit is contained in:
@ -14,6 +14,7 @@ import app.revanced.patches.youtube.utils.compatibility.Constants
|
|||||||
import app.revanced.patches.youtube.utils.fix.client.fingerprints.BuildInitPlaybackRequestFingerprint
|
import app.revanced.patches.youtube.utils.fix.client.fingerprints.BuildInitPlaybackRequestFingerprint
|
||||||
import app.revanced.patches.youtube.utils.fix.client.fingerprints.BuildPlayerRequestURIFingerprint
|
import app.revanced.patches.youtube.utils.fix.client.fingerprints.BuildPlayerRequestURIFingerprint
|
||||||
import app.revanced.patches.youtube.utils.fix.client.fingerprints.CreatePlayerRequestBodyFingerprint
|
import app.revanced.patches.youtube.utils.fix.client.fingerprints.CreatePlayerRequestBodyFingerprint
|
||||||
|
import app.revanced.patches.youtube.utils.fix.client.fingerprints.PlayerGestureConfigSyntheticFingerprint
|
||||||
import app.revanced.patches.youtube.utils.fix.client.fingerprints.SetPlayerRequestClientTypeFingerprint
|
import app.revanced.patches.youtube.utils.fix.client.fingerprints.SetPlayerRequestClientTypeFingerprint
|
||||||
import app.revanced.patches.youtube.utils.integrations.Constants.MISC_PATH
|
import app.revanced.patches.youtube.utils.integrations.Constants.MISC_PATH
|
||||||
import app.revanced.patches.youtube.utils.playertype.PlayerTypeHookPatch
|
import app.revanced.patches.youtube.utils.playertype.PlayerTypeHookPatch
|
||||||
@ -22,6 +23,7 @@ import app.revanced.patches.youtube.video.information.VideoInformationPatch
|
|||||||
import app.revanced.patches.youtube.video.playerresponse.PlayerResponseMethodHookPatch
|
import app.revanced.patches.youtube.video.playerresponse.PlayerResponseMethodHookPatch
|
||||||
import app.revanced.util.getReference
|
import app.revanced.util.getReference
|
||||||
import app.revanced.util.getStringInstructionIndex
|
import app.revanced.util.getStringInstructionIndex
|
||||||
|
import app.revanced.util.getWalkerMethod
|
||||||
import app.revanced.util.patch.BaseBytecodePatch
|
import app.revanced.util.patch.BaseBytecodePatch
|
||||||
import app.revanced.util.resultOrThrow
|
import app.revanced.util.resultOrThrow
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
@ -47,11 +49,15 @@ object SpoofClientPatch : BaseBytecodePatch(
|
|||||||
),
|
),
|
||||||
compatiblePackages = Constants.COMPATIBLE_PACKAGE,
|
compatiblePackages = Constants.COMPATIBLE_PACKAGE,
|
||||||
fingerprints = setOf(
|
fingerprints = setOf(
|
||||||
|
// Client type spoof.
|
||||||
BuildInitPlaybackRequestFingerprint,
|
BuildInitPlaybackRequestFingerprint,
|
||||||
BuildPlayerRequestURIFingerprint,
|
BuildPlayerRequestURIFingerprint,
|
||||||
SetPlayerRequestClientTypeFingerprint,
|
SetPlayerRequestClientTypeFingerprint,
|
||||||
CreatePlayerRequestBodyFingerprint,
|
CreatePlayerRequestBodyFingerprint,
|
||||||
CreatePlayerRequestBodyWithModelFingerprint,
|
CreatePlayerRequestBodyWithModelFingerprint,
|
||||||
|
|
||||||
|
// Player gesture config.
|
||||||
|
PlayerGestureConfigSyntheticFingerprint,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||||
@ -224,6 +230,27 @@ object SpoofClientPatch : BaseBytecodePatch(
|
|||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
|
// region fix player gesture.
|
||||||
|
|
||||||
|
PlayerGestureConfigSyntheticFingerprint.resultOrThrow().let {
|
||||||
|
arrayOf(3, 9).forEach { offSet ->
|
||||||
|
it.getWalkerMethod(context, it.scanResult.patternScanResult!!.endIndex - offSet).apply {
|
||||||
|
val index = implementation!!.instructions.size - 1
|
||||||
|
val register = getInstruction<OneRegisterInstruction>(index).registerA
|
||||||
|
|
||||||
|
addInstructions(
|
||||||
|
index,
|
||||||
|
"""
|
||||||
|
invoke-static {v$register}, $INTEGRATIONS_CLASS_DESCRIPTOR->enablePlayerGesture(Z)Z
|
||||||
|
move-result v$register
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// endregion
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
package app.revanced.patches.youtube.utils.fix.client.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.utils.fix.client.fingerprints.PlayerGestureConfigSyntheticFingerprint.indexOfDownAndOutAllowedInstruction
|
||||||
|
import app.revanced.util.getReference
|
||||||
|
import app.revanced.util.indexOfFirstInstruction
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
import com.android.tools.smali.dexlib2.iface.Method
|
||||||
|
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Annotation [FuzzyPatternScanMethod] is required to maintain compatibility with YouTube v18.29.38 ~ v18.32.39.
|
||||||
|
*
|
||||||
|
* TODO: Remove this annotation if support for YouTube v18.29.38 to v18.32.39 is dropped.
|
||||||
|
*/
|
||||||
|
@FuzzyPatternScanMethod(5)
|
||||||
|
internal object PlayerGestureConfigSyntheticFingerprint : MethodFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = listOf("Ljava/lang/Object;"),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.SGET_OBJECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
Opcode.IF_EQZ,
|
||||||
|
Opcode.IF_EQZ,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.INVOKE_INTERFACE,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL, // playerGestureConfig.downAndOutLandscapeAllowed
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
Opcode.CHECK_CAST,
|
||||||
|
Opcode.IPUT_BOOLEAN,
|
||||||
|
Opcode.INVOKE_INTERFACE,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL, // playerGestureConfig.downAndOutPortraitAllowed
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
Opcode.IPUT_BOOLEAN,
|
||||||
|
Opcode.RETURN_VOID,
|
||||||
|
),
|
||||||
|
customFingerprint = { methodDef, classDef ->
|
||||||
|
indexOfDownAndOutAllowedInstruction(methodDef) > 0 &&
|
||||||
|
// This method is always called "a" because this kind of class always has a single method.
|
||||||
|
methodDef.name == "a" && classDef.methods.count() == 2
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
fun indexOfDownAndOutAllowedInstruction(methodDef: Method) =
|
||||||
|
methodDef.indexOfFirstInstruction {
|
||||||
|
val reference = getReference<MethodReference>()
|
||||||
|
reference?.definingClass == "Lcom/google/android/libraries/youtube/innertube/model/media/PlayerConfigModel;" &&
|
||||||
|
reference.parameterTypes.isEmpty() &&
|
||||||
|
reference.returnType == "Z"
|
||||||
|
}
|
||||||
|
}
|
@ -1429,7 +1429,6 @@ Side effects include:
|
|||||||
<string name="revanced_spoof_client_use_ios_summary_off">"Client is currently spoofed to Android VR. (iOS client is used for Clips or Shorts)
|
<string name="revanced_spoof_client_use_ios_summary_off">"Client is currently spoofed to Android VR. (iOS client is used for Clips or Shorts)
|
||||||
|
|
||||||
Side effects include:
|
Side effects include:
|
||||||
• Player swipe gestures do not work.
|
|
||||||
• Kids videos do not playback.
|
• Kids videos do not playback.
|
||||||
• Paused videos can randomly resume."</string>
|
• Paused videos can randomly resume."</string>
|
||||||
<string name="revanced_spoof_player_parameter_title">Spoof player parameter</string>
|
<string name="revanced_spoof_player_parameter_title">Spoof player parameter</string>
|
||||||
|
Reference in New Issue
Block a user