fix exit fullscreen patch

This commit is contained in:
LisoUseInAIKyrios 2025-11-08 22:06:54 +02:00
parent b7c995930a
commit afbcf3d90f
3 changed files with 30 additions and 9 deletions

View file

@ -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.playertype.playerTypeHookPatch
import app.revanced.patches.youtube.misc.settings.PreferenceScreen import app.revanced.patches.youtube.misc.settings.PreferenceScreen
import app.revanced.patches.youtube.misc.settings.settingsPatch import app.revanced.patches.youtube.misc.settings.settingsPatch
import app.revanced.patches.youtube.shared.loopVideoFingerprint import app.revanced.patches.youtube.video.information.videoEndMethod
import app.revanced.patches.youtube.shared.loopVideoParentFingerprint import app.revanced.patches.youtube.video.information.videoInformationPatch
import app.revanced.util.addInstructionsAtControlFlowLabel import app.revanced.util.addInstructionsAtControlFlowLabel
@Suppress("unused") @Suppress("unused")
@ -32,7 +32,8 @@ internal val exitFullscreenPatch = bytecodePatch(
settingsPatch, settingsPatch,
addResourcesPatch, addResourcesPatch,
playerTypeHookPatch, playerTypeHookPatch,
playerControlsPatch playerControlsPatch,
videoInformationPatch
) )
// Cannot declare as top level since this patch is in the same package as // 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") ListPreference("revanced_exit_fullscreen")
) )
loopVideoFingerprint.match(loopVideoParentFingerprint.originalClassDef).method.apply { videoEndMethod.addInstructionsAtControlFlowLabel(
addInstructionsAtControlFlowLabel( 0,
implementation!!.instructions.lastIndex, "invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->endOfVideoReached()V",
"invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->endOfVideoReached()V", )
)
}
} }
} }

View file

@ -2,6 +2,8 @@ package app.revanced.patches.youtube.video.information
import app.revanced.patcher.fieldAccess import app.revanced.patcher.fieldAccess
import app.revanced.patcher.fingerprint import app.revanced.patcher.fingerprint
import app.revanced.patcher.literal
import app.revanced.patcher.methodCall
import app.revanced.patcher.string import app.revanced.patcher.string
import app.revanced.patches.youtube.shared.videoQualityChangedFingerprint import app.revanced.patches.youtube.shared.videoQualityChangedFingerprint
import app.revanced.util.getReference 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]. * Resolves with the class found in [videoQualityChangedFingerprint].
*/ */

View file

@ -70,6 +70,8 @@ private var speedSelectionValueRegister = -1
private lateinit var setPlaybackSpeedMethod: MutableMethod private lateinit var setPlaybackSpeedMethod: MutableMethod
private var setPlaybackSpeedMethodIndex = -1 private var setPlaybackSpeedMethodIndex = -1
internal lateinit var videoEndMethod: MutableMethod
// Used by other patches. // Used by other patches.
internal lateinit var setPlaybackSpeedContainerClassFieldReference: FieldReference internal lateinit var setPlaybackSpeedContainerClassFieldReference: FieldReference
private set 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 * Inject call for video ids
*/ */