mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-04-29 22:24:31 +02:00
fix(YouTube - Swipe controls): Patch fails on YouTube 19.43.41 when Player components
patch is included
This commit is contained in:
parent
09a8eb7114
commit
bccd6dc5df
@ -10,6 +10,7 @@ import app.revanced.util.indexOfFirstInstruction
|
|||||||
import app.revanced.util.or
|
import app.revanced.util.or
|
||||||
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
|
||||||
|
import com.android.tools.smali.dexlib2.iface.Method
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||||
|
|
||||||
internal val fullScreenEngagementOverlayFingerprint = legacyFingerprint(
|
internal val fullScreenEngagementOverlayFingerprint = legacyFingerprint(
|
||||||
@ -113,11 +114,17 @@ internal val playerGestureConfigSyntheticFingerprint = legacyFingerprint(
|
|||||||
// This method is always called "a" because this kind of class always has a single method.
|
// This method is always called "a" because this kind of class always has a single method.
|
||||||
method.name == "a" &&
|
method.name == "a" &&
|
||||||
classDef.methods.count() == 2 &&
|
classDef.methods.count() == 2 &&
|
||||||
method.indexOfFirstInstruction {
|
indexOfPlayerConfigModelBooleanInstruction(method) >= 0
|
||||||
val reference = getReference<MethodReference>()
|
|
||||||
reference?.definingClass == "Lcom/google/android/libraries/youtube/innertube/model/media/PlayerConfigModel;" &&
|
|
||||||
reference.parameterTypes.isEmpty() &&
|
|
||||||
reference.returnType == "Z"
|
|
||||||
} >= 0
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
internal fun indexOfPlayerConfigModelBooleanInstruction(
|
||||||
|
method: Method,
|
||||||
|
startIndex: Int = 0
|
||||||
|
) = method.indexOfFirstInstruction(startIndex) {
|
||||||
|
val reference = getReference<MethodReference>()
|
||||||
|
opcode == Opcode.INVOKE_VIRTUAL &&
|
||||||
|
reference?.definingClass == "Lcom/google/android/libraries/youtube/innertube/model/media/PlayerConfigModel;" &&
|
||||||
|
reference.parameterTypes.isEmpty() &&
|
||||||
|
reference.returnType == "Z"
|
||||||
|
}
|
@ -30,7 +30,6 @@ import app.revanced.patches.youtube.utils.settings.settingsPatch
|
|||||||
import app.revanced.util.ResourceGroup
|
import app.revanced.util.ResourceGroup
|
||||||
import app.revanced.util.copyResources
|
import app.revanced.util.copyResources
|
||||||
import app.revanced.util.fingerprint.injectLiteralInstructionBooleanCall
|
import app.revanced.util.fingerprint.injectLiteralInstructionBooleanCall
|
||||||
import app.revanced.util.fingerprint.matchOrThrow
|
|
||||||
import app.revanced.util.fingerprint.methodOrThrow
|
import app.revanced.util.fingerprint.methodOrThrow
|
||||||
import app.revanced.util.fingerprint.mutableClassOrThrow
|
import app.revanced.util.fingerprint.mutableClassOrThrow
|
||||||
import app.revanced.util.getReference
|
import app.revanced.util.getReference
|
||||||
@ -212,14 +211,17 @@ val swipeControlsPatch = bytecodePatch(
|
|||||||
|
|
||||||
// region patch for disable swipe to enter fullscreen mode (in the player) and disable swipe to exit fullscreen mode
|
// region patch for disable swipe to enter fullscreen mode (in the player) and disable swipe to exit fullscreen mode
|
||||||
|
|
||||||
playerGestureConfigSyntheticFingerprint.matchOrThrow().let {
|
playerGestureConfigSyntheticFingerprint.methodOrThrow().apply {
|
||||||
val endIndex = it.patternMatch!!.endIndex
|
val disableSwipeToExitFullscreenModeIndex =
|
||||||
|
indexOfPlayerConfigModelBooleanInstruction(this)
|
||||||
|
val disableSwipeToEnterFullscreenModeInThePlayerIndex =
|
||||||
|
indexOfPlayerConfigModelBooleanInstruction(this, disableSwipeToExitFullscreenModeIndex + 1)
|
||||||
|
|
||||||
mapOf(
|
mapOf(
|
||||||
3 to "disableSwipeToEnterFullscreenModeInThePlayer",
|
disableSwipeToExitFullscreenModeIndex to "disableSwipeToExitFullscreenMode",
|
||||||
9 to "disableSwipeToExitFullscreenMode"
|
disableSwipeToEnterFullscreenModeInThePlayerIndex to "disableSwipeToEnterFullscreenModeInThePlayer"
|
||||||
).forEach { (offSet, methodName) ->
|
).forEach { (walkerIndex, methodName) ->
|
||||||
it.getWalkerMethod(endIndex - offSet).apply {
|
getWalkerMethod(walkerIndex).apply {
|
||||||
val index = implementation!!.instructions.lastIndex
|
val index = implementation!!.instructions.lastIndex
|
||||||
val register = getInstruction<OneRegisterInstruction>(index).registerA
|
val register = getInstruction<OneRegisterInstruction>(index).registerA
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user