mirror of
https://github.com/revanced/revanced-patches
synced 2024-08-29 02:25:15 +02:00
fix: disable-fullscreen-panels patch not working (#213)
This commit is contained in:
parent
7b70b8555b
commit
5372105e72
@ -2,7 +2,7 @@ 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.DirectPatternScanMethod
|
||||
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
|
||||
@ -12,21 +12,14 @@ import org.jf.dexlib2.Opcode
|
||||
@MatchingMethod(
|
||||
"LFullscreenEngagementPanelOverlay;", "e"
|
||||
)
|
||||
@FuzzyPatternScanMethod(2)
|
||||
@DirectPatternScanMethod
|
||||
@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;") }
|
||||
listOf(
|
||||
Opcode.IGET_BOOLEAN
|
||||
)
|
||||
)
|
||||
|
@ -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.DirectPatternScanMethod
|
||||
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-parent-fingerprint")
|
||||
@MatchingMethod(
|
||||
"LFullscreenEngagementPanelOverlay;", "e"
|
||||
)
|
||||
@DirectPatternScanMethod
|
||||
@ShortsButtonCompatibility
|
||||
@Version("0.0.1")
|
||||
object FullscreenViewAdderParentFingerprint : 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;") }
|
||||
)
|
@ -5,6 +5,8 @@ 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.extensions.removeInstruction
|
||||
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
@ -13,9 +15,8 @@ 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 app.revanced.patches.youtube.layout.fullscreenpanels.fingerprints.FullscreenViewAdderParentFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import org.jf.dexlib2.iface.reference.MethodReference
|
||||
|
||||
@Patch
|
||||
@Name("disable-fullscreen-panels")
|
||||
@ -25,23 +26,23 @@ import org.jf.dexlib2.iface.reference.MethodReference
|
||||
@Version("0.0.1")
|
||||
class FullscreenPanelsRemoverPatch : BytecodePatch(
|
||||
listOf(
|
||||
FullscreenViewAdderFingerprint
|
||||
FullscreenViewAdderParentFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
val result = FullscreenViewAdderFingerprint.result
|
||||
val parentResult = FullscreenViewAdderParentFingerprint.result!!
|
||||
FullscreenViewAdderFingerprint.resolve(data, parentResult.method, parentResult.classDef)
|
||||
val result = FullscreenViewAdderParentFingerprint.result
|
||||
?: return PatchResultError("Fingerprint not resolved!")
|
||||
|
||||
val method = result.mutableMethod
|
||||
val implementation = method.implementation
|
||||
?: return PatchResultError("Implementation not found!")
|
||||
|
||||
val visibilityCallIndex = implementation.instructions.withIndex()
|
||||
.first { ((it.value as? ReferenceInstruction)?.reference as? MethodReference)?.name == ("setVisibility") }.index
|
||||
val ifIndex = result.patternScanResult!!.startIndex + 2
|
||||
|
||||
method.removeInstruction(ifIndex)
|
||||
method.addInstructions(
|
||||
visibilityCallIndex - 1, """
|
||||
invoke-static { }, Lapp/revanced/integrations/patches/FullscreenPanelsRemoverPatch;->getFullsceenPanelsVisibility()I
|
||||
ifIndex, """
|
||||
invoke-static {}, Lapp/revanced/integrations/patches/FullscreenPanelsRemoverPatch;->getFullscreenPanelsVisibility()I
|
||||
move-result p1
|
||||
"""
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user