mirror of
https://github.com/revanced/revanced-patches
synced 2024-12-03 17:32:57 +01:00
fix(youtube/general-ads): don't early return when not necessary (#1353)
This commit is contained in:
parent
52226797be
commit
003a400ce4
@ -7,6 +7,9 @@ import org.jf.dexlib2.Opcode
|
|||||||
object CanScrollVerticallyFingerprint : MethodFingerprint(
|
object CanScrollVerticallyFingerprint : MethodFingerprint(
|
||||||
"Z",
|
"Z",
|
||||||
parameters = emptyList(),
|
parameters = emptyList(),
|
||||||
opcodes = listOf(Opcode.INSTANCE_OF),
|
opcodes = listOf(
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
),
|
||||||
customFingerprint = { methodDef -> methodDef.definingClass.endsWith("SwipeRefreshLayout;") }
|
customFingerprint = { methodDef -> methodDef.definingClass.endsWith("SwipeRefreshLayout;") }
|
||||||
)
|
)
|
||||||
|
@ -4,12 +4,14 @@ import app.revanced.extensions.toErrorResult
|
|||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.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.patches.youtube.misc.fix.verticalscroll.annotations.VerticalScrollCompatibility
|
import app.revanced.patches.youtube.misc.fix.verticalscroll.annotations.VerticalScrollCompatibility
|
||||||
import app.revanced.patches.youtube.misc.fix.verticalscroll.fingerprints.CanScrollVerticallyFingerprint
|
import app.revanced.patches.youtube.misc.fix.verticalscroll.fingerprints.CanScrollVerticallyFingerprint
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
@Description("Fixes issues with scrolling on the home screen when the first component is of type EmptyComponent.")
|
@Description("Fixes issues with scrolling on the home screen when the first component is of type EmptyComponent.")
|
||||||
@VerticalScrollCompatibility
|
@VerticalScrollCompatibility
|
||||||
@ -20,13 +22,17 @@ class VerticalScrollPatch : BytecodePatch(
|
|||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
val result = CanScrollVerticallyFingerprint.result ?: return CanScrollVerticallyFingerprint.toErrorResult()
|
val result = CanScrollVerticallyFingerprint.result ?: return CanScrollVerticallyFingerprint.toErrorResult()
|
||||||
|
|
||||||
result.mutableMethod.addInstructions(
|
with(result) {
|
||||||
0,
|
val method = mutableMethod
|
||||||
"""
|
|
||||||
const/4 v0, 0x0
|
val moveResultIndex = scanResult.patternScanResult!!.endIndex
|
||||||
return v0
|
val moveResultRegister = (method.instruction(moveResultIndex) as OneRegisterInstruction).registerA
|
||||||
"""
|
|
||||||
)
|
method.addInstruction(
|
||||||
|
moveResultIndex + 1,
|
||||||
|
"const/4 v$moveResultRegister, 0x0"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user