mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-12-07 01:51:27 +01:00
fix exit fullscreen patch
This commit is contained in:
@@ -9,8 +9,8 @@ import app.revanced.patches.youtube.misc.playercontrols.playerControlsPatch
|
||||
import app.revanced.patches.youtube.misc.playertype.playerTypeHookPatch
|
||||
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
|
||||
import app.revanced.patches.youtube.misc.settings.settingsPatch
|
||||
import app.revanced.patches.youtube.shared.loopVideoFingerprint
|
||||
import app.revanced.patches.youtube.shared.loopVideoParentFingerprint
|
||||
import app.revanced.patches.youtube.video.information.videoEndMethod
|
||||
import app.revanced.patches.youtube.video.information.videoInformationPatch
|
||||
import app.revanced.util.addInstructionsAtControlFlowLabel
|
||||
|
||||
@Suppress("unused")
|
||||
@@ -32,7 +32,8 @@ internal val exitFullscreenPatch = bytecodePatch(
|
||||
settingsPatch,
|
||||
addResourcesPatch,
|
||||
playerTypeHookPatch,
|
||||
playerControlsPatch
|
||||
playerControlsPatch,
|
||||
videoInformationPatch
|
||||
)
|
||||
|
||||
// Cannot declare as top level since this patch is in the same package as
|
||||
@@ -48,11 +49,9 @@ internal val exitFullscreenPatch = bytecodePatch(
|
||||
ListPreference("revanced_exit_fullscreen")
|
||||
)
|
||||
|
||||
loopVideoFingerprint.match(loopVideoParentFingerprint.originalClassDef).method.apply {
|
||||
addInstructionsAtControlFlowLabel(
|
||||
implementation!!.instructions.lastIndex,
|
||||
"invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->endOfVideoReached()V",
|
||||
)
|
||||
}
|
||||
videoEndMethod.addInstructionsAtControlFlowLabel(
|
||||
0,
|
||||
"invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->endOfVideoReached()V",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package app.revanced.patches.youtube.video.information
|
||||
|
||||
import app.revanced.patcher.fieldAccess
|
||||
import app.revanced.patcher.fingerprint
|
||||
import app.revanced.patcher.literal
|
||||
import app.revanced.patcher.methodCall
|
||||
import app.revanced.patcher.string
|
||||
import app.revanced.patches.youtube.shared.videoQualityChangedFingerprint
|
||||
import app.revanced.util.getReference
|
||||
@@ -118,6 +120,20 @@ internal val seekRelativeFingerprint = fingerprint {
|
||||
)
|
||||
}
|
||||
|
||||
internal val videoEndFingerprint = fingerprint {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
returns("Z")
|
||||
parameters("J", "L")
|
||||
instructions(
|
||||
methodCall(
|
||||
parameters = listOf(),
|
||||
returnType = "V"
|
||||
),
|
||||
literal(45368273L, maxAfter = 5),
|
||||
string("Attempting to seek when video is not playing"),
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves with the class found in [videoQualityChangedFingerprint].
|
||||
*/
|
||||
|
||||
@@ -70,6 +70,8 @@ private var speedSelectionValueRegister = -1
|
||||
private lateinit var setPlaybackSpeedMethod: MutableMethod
|
||||
private var setPlaybackSpeedMethodIndex = -1
|
||||
|
||||
internal lateinit var videoEndMethod: MutableMethod
|
||||
|
||||
// Used by other patches.
|
||||
internal lateinit var setPlaybackSpeedContainerClassFieldReference: FieldReference
|
||||
private set
|
||||
@@ -143,6 +145,10 @@ val videoInformationPatch = bytecodePatch(
|
||||
}
|
||||
}
|
||||
|
||||
videoEndFingerprint.let {
|
||||
videoEndMethod = navigate(it.originalMethod).to(it.instructionMatches[0].index).stop()
|
||||
}
|
||||
|
||||
/*
|
||||
* Inject call for video ids
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user