fix: freezing panels when watching video in fullscreen (#89)
This commit is contained in:
parent
6f63a3efd9
commit
f5d4f6c341
|
@ -0,0 +1,32 @@
|
||||||
|
package app.revanced.patches.youtube.layout.fullscreenpanels.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
||||||
|
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.shorts.button.annotations.ShortsButtonCompatibility
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
@Name("fullscreen-view-adder-fingerprint")
|
||||||
|
@MatchingMethod(
|
||||||
|
"LFullscreenEngagementPanelOverlay;", "e"
|
||||||
|
)
|
||||||
|
@FuzzyPatternScanMethod(2)
|
||||||
|
@ShortsButtonCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object FullscreenViewAdderFingerprint : MethodFingerprint(
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
listOf("L", "L"),
|
||||||
|
listOf(
|
||||||
|
Opcode.GOTO,
|
||||||
|
Opcode.IGET_BOOLEAN,
|
||||||
|
Opcode.IF_EQ,
|
||||||
|
Opcode.GOTO,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
),
|
||||||
|
null,
|
||||||
|
{ it.definingClass.endsWith("FullscreenEngagementPanelOverlay;") }
|
||||||
|
)
|
|
@ -4,31 +4,47 @@ import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.impl.BytecodeData
|
import app.revanced.patcher.data.impl.BytecodeData
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.extensions.removeInstruction
|
||||||
import app.revanced.patcher.patch.impl.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||||
import app.revanced.patches.youtube.layout.fullscreenpanels.annotations.FullscreenPanelsCompatibility
|
import app.revanced.patches.youtube.layout.fullscreenpanels.annotations.FullscreenPanelsCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.fullscreenpanels.fingerprints.FullscreenViewAdderFingerprint
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
|
import org.jf.dexlib2.iface.reference.MethodReference
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("disable-fullscreen-panels")
|
@Name("disable-fullscreen-panels")
|
||||||
@Description("Disable comments panel in fullscreen view.")
|
@Description("Disable comments panel in fullscreen view.")
|
||||||
@FullscreenPanelsCompatibility
|
@FullscreenPanelsCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class FullscreenPanelsRemovalPatch : BytecodePatch(listOf()) {
|
class FullscreenPanelsRemovalPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
FullscreenViewAdderFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
override fun execute(data: BytecodeData): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
val classDef = data.classes.first { it.type.endsWith("FullscreenEngagementPanelOverlay;") }
|
val method = FullscreenViewAdderFingerprint.result?.mutableMethod!!
|
||||||
val method = data.proxy(classDef).resolve().methods.first { it.name == "<init>" }
|
|
||||||
val implementation = method.implementation!!
|
val implementation = method.implementation!!
|
||||||
|
|
||||||
method.addInstructions(
|
val (visibilityCallIndex, visibilityCall) =
|
||||||
implementation.instructions.count() - 1,
|
implementation.instructions.withIndex()
|
||||||
"""
|
.first { ((it.value as? ReferenceInstruction)?.reference as? MethodReference)?.name == ("setVisibility") }
|
||||||
const/4 v1, 0x0
|
|
||||||
iput-boolean v1, v0, ${classDef.type}->a:Z
|
val gotoIndex =
|
||||||
"""
|
implementation.instructions.subList(0, visibilityCallIndex).indexOfLast { it.opcode == Opcode.GOTO }
|
||||||
)
|
|
||||||
|
//force the if
|
||||||
|
method.removeInstruction(gotoIndex)
|
||||||
|
|
||||||
|
val visibilityIntRegister = (visibilityCall as FiveRegisterInstruction).registerD
|
||||||
|
|
||||||
|
//set the visibility to GONE
|
||||||
|
method.addInstruction(visibilityCallIndex - 1, "const/16 v$visibilityIntRegister, 0x8")
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue