mirror of
https://github.com/revanced/revanced-patches
synced 2024-12-11 19:57:47 +01:00
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.Version
|
||||
import app.revanced.patcher.data.impl.BytecodeData
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.extensions.removeInstruction
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
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.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
|
||||
@Name("disable-fullscreen-panels")
|
||||
@Description("Disable comments panel in fullscreen view.")
|
||||
@FullscreenPanelsCompatibility
|
||||
@Version("0.0.1")
|
||||
class FullscreenPanelsRemovalPatch : BytecodePatch(listOf()) {
|
||||
class FullscreenPanelsRemovalPatch : BytecodePatch(
|
||||
listOf(
|
||||
FullscreenViewAdderFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
val classDef = data.classes.first { it.type.endsWith("FullscreenEngagementPanelOverlay;") }
|
||||
val method = data.proxy(classDef).resolve().methods.first { it.name == "<init>" }
|
||||
val method = FullscreenViewAdderFingerprint.result?.mutableMethod!!
|
||||
val implementation = method.implementation!!
|
||||
|
||||
method.addInstructions(
|
||||
implementation.instructions.count() - 1,
|
||||
"""
|
||||
const/4 v1, 0x0
|
||||
iput-boolean v1, v0, ${classDef.type}->a:Z
|
||||
"""
|
||||
)
|
||||
val (visibilityCallIndex, visibilityCall) =
|
||||
implementation.instructions.withIndex()
|
||||
.first { ((it.value as? ReferenceInstruction)?.reference as? MethodReference)?.name == ("setVisibility") }
|
||||
|
||||
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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user