build: bump patcher to 11.0.1

This commit is contained in:
inotia00
2023-06-18 22:21:37 +09:00
parent af84ca9a4c
commit 9aae2f0032
310 changed files with 760 additions and 715 deletions

View File

@ -5,5 +5,5 @@ import org.jf.dexlib2.Opcode
object OnBackPressedFingerprint : MethodFingerprint(
opcodes = listOf(Opcode.RETURN_VOID),
customFingerprint = { it.definingClass.endsWith("WatchWhileActivity;") && it.name == "onBackPressed" }
customFingerprint = { it, _ -> it.definingClass.endsWith("WatchWhileActivity;") && it.name == "onBackPressed" }
)

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object ScrollPositionFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PROTECTED or AccessFlags.FINAL,
accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL,
parameters = listOf("L"),
opcodes = listOf(
Opcode.IF_NEZ,

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object ScrollTopFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf(),
opcodes = listOf(
Opcode.CHECK_CAST,

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object ScrollTopParentFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
opcodes = listOf(
Opcode.IPUT_OBJECT,
Opcode.IPUT_OBJECT,
@ -20,6 +20,6 @@ object ScrollTopParentFingerprint : MethodFingerprint(
Opcode.IPUT_OBJECT,
Opcode.RETURN_VOID
),
customFingerprint = { it.name == "<init>"}
customFingerprint = { it, _ -> it.name == "<init>"}
)

View File

@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.data.toMethodWalker
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult

View File

@ -5,7 +5,7 @@ import app.revanced.extensions.injectHideCall
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -33,10 +33,10 @@ class GeneralAdsBytecodePatch : BytecodePatch() {
.findMutableMethodOf(method)
.apply {
val insertIndex = method.getWideLiteralIndex(adAttributionId) + 1
if (instruction(insertIndex).opcode != org.jf.dexlib2.Opcode.INVOKE_VIRTUAL)
if (getInstruction(insertIndex).opcode != org.jf.dexlib2.Opcode.INVOKE_VIRTUAL)
return@forEach
val viewRegister = instruction<Instruction35c>(insertIndex).registerC
val viewRegister = getInstruction<Instruction35c>(insertIndex).registerC
this.implementation!!.injectHideCall(insertIndex, viewRegister, "ads/AdsFilter", "hideAdAttributionView")
}

View File

@ -1,14 +1,19 @@
package app.revanced.patches.youtube.ads.getpremium.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
object CompactYpcOfferModuleViewFingerprint : MethodFingerprint(
returnType = "V",
accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL,
parameters = listOf("I", "I"),
opcodes = listOf(
Opcode.ADD_INT_2ADDR,
Opcode.ADD_INT_2ADDR,
Opcode.INVOKE_VIRTUAL,
Opcode.RETURN_VOID
),
customFingerprint = { it.definingClass.endsWith("CompactYpcOfferModuleView;") && it.name == "onMeasure" }
customFingerprint = { it, _ -> it.definingClass.endsWith("CompactYpcOfferModuleView;") && it.name == "onMeasure" }
)

View File

@ -4,8 +4,8 @@ import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -24,19 +24,19 @@ class HideGetPremiumPatch : BytecodePatch(
CompactYpcOfferModuleViewFingerprint.result?.let {
it.mutableMethod.apply {
val startIndex = it.scanResult.patternScanResult!!.startIndex
val measuredWidthRegister = instruction<TwoRegisterInstruction>(startIndex).registerA
val measuredHeightInstruction = instruction<TwoRegisterInstruction>(startIndex + 1)
val measuredWidthRegister = getInstruction<TwoRegisterInstruction>(startIndex).registerA
val measuredHeightInstruction = getInstruction<TwoRegisterInstruction>(startIndex + 1)
val measuredHeightRegister = measuredHeightInstruction.registerA
val tempRegister = measuredHeightInstruction.registerB
addInstructions(
addInstructionsWithLabels(
startIndex + 2, """
invoke-static {}, $PATCHES_PATH/ads/AdsFilter;->hideGetPremium()Z
move-result v$tempRegister
if-eqz v$tempRegister, :show
const/4 v$measuredWidthRegister, 0x0
const/4 v$measuredHeightRegister, 0x0
""", listOf(ExternalLabel("show", instruction(startIndex + 2)))
""", ExternalLabel("show", getInstruction(startIndex + 2))
)
}
} ?: return CompactYpcOfferModuleViewFingerprint.toErrorResult()

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object SwipeRefreshLayoutFingerprint : MethodFingerprint(
returnType = "Z",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf(),
opcodes = listOf(
Opcode.RETURN,
@ -15,5 +15,5 @@ object SwipeRefreshLayoutFingerprint : MethodFingerprint(
Opcode.MOVE_RESULT,
Opcode.RETURN
),
customFingerprint = { it.definingClass.endsWith("SwipeRefreshLayout;") }
customFingerprint = { it, _ -> it.definingClass.endsWith("SwipeRefreshLayout;") }
)

View File

@ -4,8 +4,8 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -26,7 +26,7 @@ class SwipeRefreshPatch : BytecodePatch(
SwipeRefreshLayoutFingerprint.result?.let {
it.mutableMethod.apply {
val insertIndex = it.scanResult.patternScanResult!!.endIndex
val register = instruction<OneRegisterInstruction>(insertIndex).registerA
val register = getInstruction<OneRegisterInstruction>(insertIndex).registerA
addInstruction(
insertIndex,

View File

@ -6,7 +6,7 @@ import org.jf.dexlib2.AccessFlags
object AutoNavInformerFingerprint : MethodFingerprint(
returnType = "Z",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf(),
customFingerprint = { it.definingClass.endsWith("WillAutonavInformer;") }
customFingerprint = { it, _ -> it.definingClass.endsWith("WillAutonavInformer;") }
)

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object RepeatListenerFingerprint : MethodFingerprint(
returnType = "Z",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
opcodes = listOf(
Opcode.INVOKE_VIRTUAL_RANGE,
Opcode.IGET_OBJECT,

View File

@ -6,7 +6,7 @@ import org.jf.dexlib2.AccessFlags
object VideoEndFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf(),
customFingerprint = { it.implementation!!.instructions.count() == 3 && it.annotations.isEmpty()}
customFingerprint = { it, _ -> it.implementation!!.instructions.count() == 3 && it.annotations.isEmpty()}
)

View File

@ -6,7 +6,7 @@ import org.jf.dexlib2.AccessFlags
object VideoEndParentFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
strings = listOf(
"play() called when the player wasn't loaded.",
"play() blocked because Background Playability failed"

View File

@ -4,7 +4,10 @@ import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.*
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
@ -34,13 +37,13 @@ class AutoRepeatPatch : BytecodePatch(
VideoEndFingerprint.also {
it.resolve(context, classDef)
}.result?.mutableMethod?.let {
it.addInstructions(
it.addInstructionsWithLabels(
0, """
invoke-static {}, $VIDEO_PATH/VideoInformation;->shouldAutoRepeat()Z
move-result v0
if-eqz v0, :notrepeat
return-void
""", listOf(ExternalLabel("notrepeat", it.instruction(0)))
""", ExternalLabel("notrepeat", it.getInstruction(0))
)
} ?: return VideoEndFingerprint.toErrorResult()
} ?: return VideoEndParentFingerprint.toErrorResult()
@ -50,20 +53,20 @@ class AutoRepeatPatch : BytecodePatch(
val targetIndex = it.scanResult.patternScanResult!!.startIndex - 1
val endIndex = it.scanResult.patternScanResult!!.endIndex
val registerC = instruction<BuilderInstruction35c>(targetIndex).registerC
val registerD = instruction<BuilderInstruction35c>(targetIndex).registerD
val registerC = getInstruction<BuilderInstruction35c>(targetIndex).registerC
val registerD = getInstruction<BuilderInstruction35c>(targetIndex).registerD
val dummyRegister = (instruction(endIndex) as Instruction31i).registerA
val dummyRegister = (getInstruction(endIndex) as Instruction31i).registerA
val targetReference = instruction<ReferenceInstruction>(targetIndex).reference
val targetReference = getInstruction<ReferenceInstruction>(targetIndex).reference
addInstructions(
addInstructionsWithLabels(
targetIndex + 1, """
invoke-static {}, $UTILS_PATH/EnableAutoRepeatPatch;->shouldAutoRepeat()Z
move-result v$dummyRegister
if-nez v$dummyRegister, :bypass
invoke-virtual {v$registerC, v$registerD}, $targetReference
""", listOf(ExternalLabel("bypass", instruction(targetIndex + 1)))
""", ExternalLabel("bypass", getInstruction(targetIndex + 1))
)
removeInstruction(targetIndex)
}
@ -71,13 +74,13 @@ class AutoRepeatPatch : BytecodePatch(
AutoNavInformerFingerprint.result?.mutableMethod?.let {
val index = it.implementation!!.instructions.size - 1 - 1
val register = it.instruction<OneRegisterInstruction>(index).registerA
val register = it.getInstruction<OneRegisterInstruction>(index).registerA
it.addInstructions(
index + 1, """
invoke-static {v$register}, $UTILS_PATH/EnableAutoRepeatPatch;->enableAutoRepeat(Z)Z
move-result v0
"""
"""
)
} ?: return AutoNavInformerFingerprint.toErrorResult()

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object PrimaryPiPFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("L"),
opcodes = listOf(
Opcode.IGET_OBJECT,

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object SecondaryPiPFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("L"),
opcodes = listOf(
Opcode.IGET_OBJECT,

View File

@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess

View File

@ -8,7 +8,7 @@ import org.jf.dexlib2.AccessFlags
object TooltipContentViewFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("L"),
customFingerprint = { it.isWideLiteralExists(toolTipId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(toolTipId) }
)

View File

@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess

View File

@ -22,5 +22,5 @@ object QualityMenuViewInflateFingerprint : MethodFingerprint(
Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST
),
customFingerprint = { it.isWideLiteralExists(videoQualityFragmentId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(videoQualityFragmentId) }
)

View File

@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -40,7 +40,7 @@ class OldQualityLayoutPatch : BytecodePatch(
QualityMenuViewInflateFingerprint.result?.let {
it.mutableMethod.apply {
val endIndex = it.scanResult.patternScanResult!!.endIndex
val register = instruction<OneRegisterInstruction>(endIndex).registerA
val register = getInstruction<OneRegisterInstruction>(endIndex).registerA
addInstruction(
endIndex + 1,

View File

@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -44,21 +44,21 @@ class HideAutoplayPreviewPatch : BytecodePatch(
LayoutConstructorFingerprint.result?.mutableMethod?.let {
val insertInstruction = it.implementation!!.instructions
val dummyRegister = it.instruction<OneRegisterInstruction>(it.getStringIndex("1.0x")).registerA
val dummyRegister = it.getInstruction<OneRegisterInstruction>(it.getStringIndex("1.0x")).registerA
val insertIndex = it.getWideLiteralIndex(autoNavPreviewId)
val branchIndex = insertInstruction.subList(insertIndex + 1, insertInstruction.size - 1).indexOfFirst { instruction ->
((instruction as? ReferenceInstruction)?.reference as? FieldReference)?.type == "Lcom/google/android/apps/youtube/app/player/autonav/AutonavToggleController;"
} + 1
val jumpInstruction = it.instruction<Instruction>(insertIndex + branchIndex)
val jumpInstruction = it.getInstruction<Instruction>(insertIndex + branchIndex)
it.addInstructions(
it.addInstructionsWithLabels(
insertIndex, """
invoke-static {}, $FULLSCREEN->hideAutoPlayPreview()Z
move-result v$dummyRegister
if-nez v$dummyRegister, :hidden
""", listOf(ExternalLabel("hidden", jumpInstruction))
""", ExternalLabel("hidden", jumpInstruction)
)
} ?: return LayoutConstructorFingerprint.toErrorResult()

View File

@ -6,5 +6,5 @@ import app.revanced.util.bytecode.isWideLiteralExists
object EndScreenResultsFingerprint : MethodFingerprint(
returnType = "V",
customFingerprint = { it.isWideLiteralExists(appRelatedEndScreenResultsId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(appRelatedEndScreenResultsId) }
)

View File

@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -35,13 +35,13 @@ class HideEndScreenOverlayPatch : BytecodePatch(
) {
override fun execute(context: BytecodeContext): PatchResult {
EndScreenResultsFingerprint.result?.mutableMethod?.let {
it.addInstructions(
it.addInstructionsWithLabels(
0, """
invoke-static {}, $FULLSCREEN->hideEndScreenOverlay()Z
move-result v0
if-eqz v0, :show
return-void
""", listOf(ExternalLabel("show", it.instruction(0)))
""", ExternalLabel("show", it.getInstruction(0))
)
} ?: return EndScreenResultsFingerprint.toErrorResult()

View File

@ -10,5 +10,5 @@ object ScrubbingLabelFingerprint : MethodFingerprint(
Opcode.IPUT_BOOLEAN,
Opcode.CONST_WIDE_32
),
customFingerprint = { it.isWideLiteralExists(scrubbingId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(scrubbingId) }
)

View File

@ -5,9 +5,9 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -58,8 +58,8 @@ class HideFilmstripOverlayPatch : BytecodePatch(
}
private companion object {
fun MutableMethod.hook(index: Int) {
val targetInstruction = instruction<TwoRegisterInstruction>(index)
val fieldReference = instruction<ReferenceInstruction>(index).reference
val targetInstruction = getInstruction<TwoRegisterInstruction>(index)
val fieldReference = getInstruction<ReferenceInstruction>(index).reference
replaceInstruction(
index,
"invoke-static {v${targetInstruction.registerA}}, $FULLSCREEN->hideFilmstripOverlay(Z)Z"

View File

@ -12,5 +12,5 @@ object FullscreenViewAdderFingerprint : MethodFingerprint(
Opcode.CONST_4,
Opcode.INVOKE_VIRTUAL
),
customFingerprint = { it.definingClass.endsWith("FullscreenEngagementPanelOverlay;") }
customFingerprint = { it, _ -> it.definingClass.endsWith("FullscreenEngagementPanelOverlay;") }
)

View File

@ -5,9 +5,10 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.removeInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -47,7 +48,7 @@ class HideFullscreenPanelsPatch : BytecodePatch(
FullscreenViewAdderFingerprint.result?.let {
it.mutableMethod.apply {
val endIndex = it.scanResult.patternScanResult!!.endIndex
val register = instruction<Instruction35c>(endIndex).registerD
val register = getInstruction<Instruction35c>(endIndex).registerD
for (i in 1..3) removeInstruction(endIndex - i)
@ -62,7 +63,7 @@ class HideFullscreenPanelsPatch : BytecodePatch(
LayoutConstructorFingerprint.result?.mutableMethod?.let {
val instructions = it.implementation!!.instructions
val dummyRegister = it.instruction<OneRegisterInstruction>(it.getStringIndex("1.0x")).registerA
val dummyRegister = it.getInstruction<OneRegisterInstruction>(it.getStringIndex("1.0x")).registerA
val invokeIndex = instructions.indexOfFirst { instruction ->
instruction.opcode == Opcode.INVOKE_VIRTUAL &&
@ -70,12 +71,12 @@ class HideFullscreenPanelsPatch : BytecodePatch(
"Landroid/widget/FrameLayout;->addView(Landroid/view/View;)V")
}
it.addInstructions(
it.addInstructionsWithLabels(
invokeIndex, """
invoke-static {}, $FULLSCREEN->showFullscreenTitle()Z
move-result v$dummyRegister
if-eqz v$dummyRegister, :hidden
""", listOf(ExternalLabel("hidden", it.instruction(invokeIndex + 1)))
""", ExternalLabel("hidden", it.getInstruction(invokeIndex + 1))
)
} ?: return LayoutConstructorFingerprint.toErrorResult()

View File

@ -5,9 +5,9 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.removeInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
@ -16,7 +16,10 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.fingerprints.*
import app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.fingerprints.MarkerHapticsFingerprint
import app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.fingerprints.ScrubbingHapticsFingerprint
import app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.fingerprints.SeekHapticsFingerprint
import app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.fingerprints.ZoomHapticsFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.FULLSCREEN
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@ -72,12 +75,12 @@ class HapticFeedBackPatch : BytecodePatch(
val startIndex = scanResult.patternScanResult!!.startIndex
val endIndex = scanResult.patternScanResult!!.endIndex
val insertIndex = endIndex + 4
val targetRegister = instruction<OneRegisterInstruction>(insertIndex).registerA
val targetRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
val dummyRegister = targetRegister + 1
removeInstruction(insertIndex)
addInstructions(
addInstructionsWithLabels(
insertIndex, """
invoke-static {}, $FULLSCREEN->$targetMethodName()Z
move-result v$dummyRegister
@ -86,28 +89,28 @@ class HapticFeedBackPatch : BytecodePatch(
goto :exit
:vibrate
const-wide/16 v$targetRegister, 0x19
""", listOf(ExternalLabel("exit", instruction(insertIndex)))
""", ExternalLabel("exit", getInstruction(insertIndex))
)
addInstructions(
addInstructionsWithLabels(
startIndex, """
invoke-static {}, $FULLSCREEN->$targetMethodName()Z
move-result v$dummyRegister
if-eqz v$dummyRegister, :vibrate
return-void
""", listOf(ExternalLabel("vibrate", instruction(startIndex)))
""", ExternalLabel("vibrate", getInstruction(startIndex))
)
}
}
fun MethodFingerprintResult.voidHaptics(targetMethodName: String) {
mutableMethod.addInstructions(
mutableMethod.addInstructionsWithLabels(
0, """
invoke-static {}, $FULLSCREEN->$targetMethodName()Z
move-result v0
if-eqz v0, :vibrate
return-void
""", listOf(ExternalLabel("vibrate", mutableMethod.instruction(0)))
""", ExternalLabel("vibrate", mutableMethod.getInstruction(0))
)
}
}

View File

@ -7,11 +7,11 @@ import org.jf.dexlib2.Opcode
object OrientationPrimaryFingerprint : MethodFingerprint (
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
parameters = listOf("L"),
opcodes = listOf(
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT
),
customFingerprint = {it.name == "<init>"}
customFingerprint = { it, _ -> it.name == "<init>"}
)

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object OrientationSecondaryFingerprint : MethodFingerprint (
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("L"),
opcodes = listOf(
Opcode.INVOKE_STATIC,

View File

@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.BytecodePatch
@ -61,7 +61,7 @@ class LandScapeModePatch : BytecodePatch(
fun MethodFingerprintResult.injectOverride() {
mutableMethod.apply {
val index = scanResult.patternScanResult!!.endIndex
val register = instruction<OneRegisterInstruction>(index).registerA
val register = getInstruction<OneRegisterInstruction>(index).registerA
addInstructions(
index +1, """

View File

@ -6,5 +6,5 @@ import app.revanced.util.bytecode.isWideLiteralExists
object SeekEduContainerFingerprint : MethodFingerprint(
returnType = "V",
customFingerprint = { it.isWideLiteralExists(easySeekEduContainerId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(easySeekEduContainerId) }
)

View File

@ -4,8 +4,8 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -35,13 +35,13 @@ class SeekMessagePatch : BytecodePatch(
override fun execute(context: BytecodeContext): PatchResult {
SeekEduContainerFingerprint.result?.mutableMethod?.let {
it.addInstructions(
it.addInstructionsWithLabels(
0, """
invoke-static {}, $FULLSCREEN->hideSeekMessage()Z
move-result v0
if-eqz v0, :default
return-void
""", listOf(ExternalLabel("default", it.instruction(0)))
""", ExternalLabel("default", it.getInstruction(0))
)
}

View File

@ -12,5 +12,5 @@ object AccountMenuParentFingerprint : MethodFingerprint(
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT
),
customFingerprint = { it.isWideLiteralExists(compactLinkId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(compactLinkId) }
)

View File

@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
@ -41,7 +41,7 @@ class AccountMenuPatch : BytecodePatch(
AccountMenuFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
it.mutableMethod.apply {
val targetIndex = it.scanResult.patternScanResult!!.startIndex + 1
val register = instruction<OneRegisterInstruction>(targetIndex).registerA
val register = getInstruction<OneRegisterInstruction>(targetIndex).registerA
addInstruction(
targetIndex + 1,
@ -52,7 +52,7 @@ class AccountMenuPatch : BytecodePatch(
parentResult.mutableMethod.apply {
val endIndex = parentResult.scanResult.patternScanResult!!.endIndex
val register = instruction<OneRegisterInstruction>(endIndex).registerA
val register = getInstruction<OneRegisterInstruction>(endIndex).registerA
addInstruction(
endIndex + 1,

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object StartVideoInformerFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
opcodes = listOf(
Opcode.INVOKE_INTERFACE,
Opcode.RETURN_VOID

View File

@ -5,8 +5,9 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
@ -57,7 +58,7 @@ class AutoCaptionsPatch : BytecodePatch(
}
SubtitleTrackFingerprint.result?.mutableMethod?.let {
it.addInstructions(
it.addInstructionsWithLabels(
0, """
invoke-static {}, $GENERAL->hideAutoCaptions()Z
move-result v0
@ -66,7 +67,7 @@ class AutoCaptionsPatch : BytecodePatch(
if-nez v0, :auto_captions_shown
const/4 v0, 0x1
return v0
""", listOf(ExternalLabel("auto_captions_shown", it.instruction(0)))
""", ExternalLabel("auto_captions_shown", it.getInstruction(0))
)
} ?: return SubtitleTrackFingerprint.toErrorResult()

View File

@ -6,7 +6,7 @@ import org.jf.dexlib2.AccessFlags
object EngagementPanelControllerFingerprint : MethodFingerprint(
returnType = "L",
access = AccessFlags.PRIVATE or AccessFlags.FINAL,
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL,
strings = listOf(
"EngagementPanelController: cannot show EngagementPanel before EngagementPanelController.init() has been called.",
"[EngagementPanel] Cannot show EngagementPanel before EngagementPanelController.init() has been called."

View File

@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -30,7 +30,7 @@ class PlayerPopupPanelsPatch : BytecodePatch(
override fun execute(context: BytecodeContext): PatchResult {
EngagementPanelControllerFingerprint.result?.mutableMethod?.let {
it.addInstructions(
it.addInstructionsWithLabels(
0, """
invoke-static {}, $GENERAL->hideAutoPlayerPopupPanels()Z
move-result v0
@ -38,7 +38,7 @@ class PlayerPopupPanelsPatch : BytecodePatch(
if-eqz p4, :player_popup_panels_shown
const/4 v0, 0x0
return-object v0
""", listOf(ExternalLabel("player_popup_panels_shown", it.instruction(0)))
""", ExternalLabel("player_popup_panels_shown", it.getInstruction(0))
)
} ?: return EngagementPanelControllerFingerprint.toErrorResult()

View File

@ -12,5 +12,5 @@ object BreakingNewsFingerprint : MethodFingerprint(
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT
),
customFingerprint = { it.isWideLiteralExists(horizontalCardListId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(horizontalCardListId) }
)

View File

@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -39,7 +39,7 @@ class BreakingNewsPatch : BytecodePatch(
BreakingNewsFingerprint.result?.let {
it.mutableMethod.apply {
val targetIndex = it.scanResult.patternScanResult!!.endIndex
val targetRegister = instruction<OneRegisterInstruction>(targetIndex).registerA
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
addInstruction(
targetIndex + 1,
"invoke-static {v$targetRegister}, $GENERAL->hideBreakingNewsShelf(Landroid/view/View;)V"

View File

@ -12,5 +12,5 @@ object FilterBarHeightFingerprint : MethodFingerprint(
Opcode.MOVE_RESULT,
Opcode.IPUT
),
customFingerprint = { it.isWideLiteralExists(filterBarHeightId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(filterBarHeightId) }
)

View File

@ -11,5 +11,5 @@ object RelatedChipCloudFingerprint : MethodFingerprint(
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT
),
customFingerprint = { it.isWideLiteralExists(relatedChipCloudMarginId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(relatedChipCloudMarginId) }
)

View File

@ -13,5 +13,5 @@ object SearchResultsChipBarFingerprint : MethodFingerprint(
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT
),
customFingerprint = { it.isWideLiteralExists(barContainerHeightId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(barContainerHeightId) }
)

View File

@ -5,9 +5,9 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -50,7 +50,7 @@ class CategoryBarPatch : BytecodePatch(
FilterBarHeightFingerprint.result?.let {
it.mutableMethod.apply {
val insertIndex = it.scanResult.patternScanResult!!.endIndex
val register = instruction<TwoRegisterInstruction>(insertIndex).registerA
val register = getInstruction<TwoRegisterInstruction>(insertIndex).registerA
addInstructions(
insertIndex, """
@ -67,7 +67,7 @@ class CategoryBarPatch : BytecodePatch(
RelatedChipCloudFingerprint.result?.let {
it.mutableMethod.apply {
val insertIndex = it.scanResult.patternScanResult!!.endIndex
val register = instruction<OneRegisterInstruction>(insertIndex).registerA
val register = getInstruction<OneRegisterInstruction>(insertIndex).registerA
addInstruction(
insertIndex + 1,
@ -82,7 +82,7 @@ class CategoryBarPatch : BytecodePatch(
SearchResultsChipBarFingerprint.result?.let {
it.mutableMethod.apply {
val targetIndex = it.scanResult.patternScanResult!!.endIndex - 2
val register = instruction<OneRegisterInstruction>(targetIndex).registerA
val register = getInstruction<OneRegisterInstruction>(targetIndex).registerA
addInstructions(
targetIndex + 1, """

View File

@ -12,5 +12,5 @@ object ChannelListSubMenuFingerprint : MethodFingerprint(
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT
),
customFingerprint = { it.isWideLiteralExists(channelListSubMenuId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(channelListSubMenuId) }
)

View File

@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -38,7 +38,7 @@ class ChannelListSubMenuPatch : BytecodePatch(
ChannelListSubMenuFingerprint.result?.let {
it.mutableMethod.apply {
val endIndex = it.scanResult.patternScanResult!!.endIndex
val register = instruction<OneRegisterInstruction>(endIndex).registerA
val register = getInstruction<OneRegisterInstruction>(endIndex).registerA
addInstruction(
endIndex + 1,

View File

@ -11,5 +11,5 @@ object CrowdfundingBoxFingerprint : MethodFingerprint(
Opcode.MOVE_RESULT_OBJECT,
Opcode.IPUT_OBJECT
),
customFingerprint = { it.isWideLiteralExists(donationCompanionResourceId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(donationCompanionResourceId) }
)

View File

@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -38,7 +38,7 @@ class CrowdfundingBoxPatch : BytecodePatch(
CrowdfundingBoxFingerprint.result?.let {
it.mutableMethod.apply {
val insertIndex = it.scanResult.patternScanResult!!.endIndex
val register = instruction<TwoRegisterInstruction>(insertIndex).registerA
val register = getInstruction<TwoRegisterInstruction>(insertIndex).registerA
addInstruction(
insertIndex,

View File

@ -11,5 +11,5 @@ object FloatingMicrophoneFingerprint : MethodFingerprint(
Opcode.IF_EQZ,
Opcode.RETURN_VOID
),
customFingerprint = { it.isWideLiteralExists(fabId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(fabId) }
)

View File

@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -38,7 +38,7 @@ class FloatingMicrophonePatch : BytecodePatch(
FloatingMicrophoneFingerprint.result?.let {
it.mutableMethod.apply {
val insertIndex = it.scanResult.patternScanResult!!.startIndex
val register = instruction<TwoRegisterInstruction>(insertIndex).registerA
val register = getInstruction<TwoRegisterInstruction>(insertIndex).registerA
addInstructions(
insertIndex + 1, """

View File

@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError

View File

@ -12,5 +12,5 @@ object LoadMoreButtonFingerprint : MethodFingerprint(
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT
),
customFingerprint = { it.isWideLiteralExists(expandButtonId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(expandButtonId) }
)

View File

@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -37,7 +37,7 @@ class LoadMoreButtonPatch : BytecodePatch(
LoadMoreButtonFingerprint.result?.let {
it.mutableMethod.apply {
val targetIndex = it.scanResult.patternScanResult!!.endIndex
val targetRegister = instruction<OneRegisterInstruction>(targetIndex).registerA
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
addInstruction(
targetIndex + 1,
"invoke-static {v$targetRegister}, $GENERAL->hideLoadMoreButton(Landroid/view/View;)V"

View File

@ -15,5 +15,5 @@ object AccountSwitcherAccessibilityLabelFingerprint : MethodFingerprint(
Opcode.APUT_OBJECT,
Opcode.CONST
),
customFingerprint = { it.isWideLiteralExists(accountSwitcherAccessibilityId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(accountSwitcherAccessibilityId) }
)

View File

@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -32,7 +32,7 @@ class HideEmailAddressPatch : BytecodePatch(
AccountSwitcherAccessibilityLabelFingerprint.result?.let {
it.mutableMethod.apply {
val insertIndex = it.scanResult.patternScanResult!!.endIndex
val register = instruction<OneRegisterInstruction>(insertIndex - 2).registerA
val register = getInstruction<OneRegisterInstruction>(insertIndex - 2).registerA
addInstructions(
insertIndex, """

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object SearchEndpointFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("L"),
opcodes = listOf(
Opcode.INVOKE_STATIC,

View File

@ -6,7 +6,7 @@ import org.jf.dexlib2.AccessFlags
object SearchEndpointParentFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf(),
strings = listOf("voz-target-id")
)

View File

@ -5,5 +5,5 @@ import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.
import app.revanced.util.bytecode.isWideLiteralExists
object SearchSuggestionEntryFingerprint : MethodFingerprint(
customFingerprint = { it.isWideLiteralExists(searchSuggestionEntryId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(searchSuggestionEntryId) }
)

View File

@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
@ -45,7 +45,7 @@ class SearchTermsPatch : BytecodePatch(
SearchEndpointFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
it.mutableMethod.apply {
val targetIndex = it.scanResult.patternScanResult!!.startIndex + 1
val targetRegister = instruction<OneRegisterInstruction>(targetIndex).registerA
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
addInstruction(
targetIndex + 1,
@ -57,7 +57,7 @@ class SearchTermsPatch : BytecodePatch(
SearchSuggestionEntryFingerprint.result?.mutableMethod?.let {
val targetIndex = it.getWideLiteralIndex(searchSuggestionEntryId) + 2
val targetRegister = it.instruction<OneRegisterInstruction>(targetIndex).registerA
val targetRegister = it.getInstruction<OneRegisterInstruction>(targetIndex).registerA
it.addInstruction(
targetIndex + 4,

View File

@ -6,7 +6,7 @@ import org.jf.dexlib2.AccessFlags
object HideSnackBarFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("L", "L"),
customFingerprint = { it.definingClass.endsWith("BottomUiContainer;") }
customFingerprint = { it, _ -> it.definingClass.endsWith("BottomUiContainer;") }
)

View File

@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -30,13 +30,13 @@ class HideSnackBarPatch : BytecodePatch(
override fun execute(context: BytecodeContext): PatchResult {
HideSnackBarFingerprint.result?.mutableMethod?.let {
it.addInstructions(
it.addInstructionsWithLabels(
0, """
invoke-static {}, $GENERAL->hideSnackBar()Z
move-result v0
if-eqz v0, :default
return-void
""", listOf(ExternalLabel("default", it.instruction(0)))
""", ExternalLabel("default", it.getInstruction(0))
)
} ?: return HideSnackBarFingerprint.toErrorResult()

View File

@ -8,6 +8,6 @@ import org.jf.dexlib2.AccessFlags
object MiniPlayerDimensionsCalculatorFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
customFingerprint = { it.isWideLiteralExists(floatyBarTopMarginId) }
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
customFingerprint = { it, _ -> it.isWideLiteralExists(floatyBarTopMarginId) }
)

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object MiniPlayerOverrideFingerprint : MethodFingerprint(
returnType = "L",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("L"),
strings = listOf("appName")
)

View File

@ -7,6 +7,6 @@ import org.jf.dexlib2.Opcode
object MiniPlayerOverrideNoContextFingerprint : MethodFingerprint(
returnType = "Z",
access = AccessFlags.PRIVATE or AccessFlags.FINAL,
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL,
opcodes = listOf(Opcode.RETURN), // anchor to insert the instruction
)

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object MiniPlayerResponseModelSizeCheckFingerprint : MethodFingerprint(
returnType = "L",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("L", "L"),
opcodes = listOf(
Opcode.RETURN_OBJECT,

View File

@ -6,8 +6,8 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.data.toMethodWalker
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.BytecodePatch
@ -101,7 +101,7 @@ class TabletMiniPlayerPatch : BytecodePatch(
val insertInstructions = this.implementation!!.instructions
for ((index, instruction) in insertInstructions.withIndex()) {
if (instruction.opcode != Opcode.RETURN) continue
val parameterRegister = this.instruction<OneRegisterInstruction>(index).registerA
val parameterRegister = getInstruction<OneRegisterInstruction>(index).registerA
this.insertOverride(index, parameterRegister)
this.insertOverride(insertInstructions.size - 1, parameterRegister)
break
@ -111,7 +111,7 @@ class TabletMiniPlayerPatch : BytecodePatch(
fun MethodFingerprintResult.unwrap(): Triple<MutableMethod, Int, Int> {
val scanIndex = this.scanResult.patternScanResult!!.endIndex
val method = this.mutableMethod
val parameterRegister = method.instruction<OneRegisterInstruction>(scanIndex).registerA
val parameterRegister = method.getInstruction<OneRegisterInstruction>(scanIndex).registerA
return Triple(method, scanIndex, parameterRegister)
}

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object WideSearchbarOneFingerprint : MethodFingerprint(
returnType = "L",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("L", "L"),
opcodes = listOf(
Opcode.IF_NEZ,

View File

@ -5,7 +5,7 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
object WideSearchbarOneParentFingerprint : MethodFingerprint(
returnType = "V", access = AccessFlags.PRIVATE or AccessFlags.FINAL,
returnType = "V", accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL,
parameters = listOf("L"),
strings = listOf(
"FEhistory",

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object WideSearchbarTwoFingerprint : MethodFingerprint(
returnType = "L",
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
opcodes = listOf(
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT,

View File

@ -6,7 +6,7 @@ import org.jf.dexlib2.AccessFlags
object WideSearchbarTwoParentFingerprint : MethodFingerprint(
returnType = "L",
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
strings = listOf(
"Callback already registered.",
"Failed to create SpotlightModeController."

View File

@ -6,7 +6,7 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.data.toMethodWalker
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult

View File

@ -5,8 +5,9 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -46,13 +47,13 @@ class ChangeHomePagePatch : BytecodePatch(
it.mutableMethod.apply {
val index = it.scanResult.patternScanResult!!.endIndex + 1
addInstructions(
addInstructionsWithLabels(
index, """
invoke-static {}, $NAVIGATION->changeHomePage()Z
move-result v0
if-eqz v0, :default
return-void
""", listOf(ExternalLabel("default", instruction(index)))
""", ExternalLabel("default", getInstruction(index))
)
}
} ?: return IntentExceptionFingerprint.toErrorResult()

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object PivotBarSetTextFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
parameters = listOf("L", "L", "L"),
opcodes = listOf(
Opcode.IPUT_OBJECT,
@ -19,5 +19,5 @@ object PivotBarSetTextFingerprint : MethodFingerprint(
Opcode.INVOKE_VIRTUAL,
Opcode.RETURN_VOID
),
customFingerprint = { it.name == "<init>" }
customFingerprint = { it, _ -> it.name == "<init>" }
)

View File

@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -33,10 +33,10 @@ class NavigationLabelPatch : BytecodePatch(
PivotBarSetTextFingerprint.result?.let {
it.mutableMethod.apply {
val targetIndex = it.scanResult.patternScanResult!!.endIndex - 2
val targetReference = instruction<ReferenceInstruction>(targetIndex).reference.toString()
val targetReference = getInstruction<ReferenceInstruction>(targetIndex).reference.toString()
if (targetReference != "Landroid/widget/TextView;")
return PivotBarSetTextFingerprint.toErrorResult()
val targetRegister = instruction<OneRegisterInstruction>(targetIndex).registerA
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
addInstruction(
targetIndex + 1,
"invoke-static {v$targetRegister}, $NAVIGATION->hideNavigationLabel(Landroid/widget/TextView;)V"

View File

@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
@ -98,7 +98,7 @@ class NavigationButtonsPatch : BytecodePatch(
AutoMotiveFingerprint.result?.let {
it.mutableMethod.apply {
val insertIndex = it.scanResult.patternScanResult!!.endIndex
val register = instruction<OneRegisterInstruction>(insertIndex).registerA
val register = getInstruction<OneRegisterInstruction>(insertIndex).registerA
addInstructions(
insertIndex, """

View File

@ -4,5 +4,5 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object ReelWatchEndpointFingerprint : MethodFingerprint(
returnType = "V",
customFingerprint = { it.name == "<init>" }
customFingerprint = { it, _ -> it.name == "<init>" }
)

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object SetPivotBarFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PRIVATE or AccessFlags.FINAL,
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL,
parameters = listOf("Z"),
opcodes = listOf(
Opcode.CHECK_CAST,

View File

@ -6,9 +6,9 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.data.toMethodWalker
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
@ -46,7 +46,7 @@ class ShortsNavBarPatch : BytecodePatch(
SetPivotBarFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
it.mutableMethod.apply {
val startIndex = it.scanResult.patternScanResult!!.startIndex
val register = instruction<OneRegisterInstruction>(startIndex).registerA
val register = getInstruction<OneRegisterInstruction>(startIndex).registerA
addInstruction(
startIndex + 1,
@ -87,7 +87,7 @@ class ShortsNavBarPatch : BytecodePatch(
}.forEach { instruction ->
val insertIndex = indexOf(instruction) + 4
val targetRegister =
navigationEndpointMethod.instruction<OneRegisterInstruction>(insertIndex).registerA
navigationEndpointMethod.getInstruction<OneRegisterInstruction>(insertIndex).registerA
navigationEndpointMethod.addInstructions(
insertIndex,

View File

@ -9,5 +9,5 @@ object PivotBarChangedFingerprint : MethodFingerprint(
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT
),
customFingerprint = { it.definingClass.endsWith("PivotBar;") && it.name == "onConfigurationChanged" }
customFingerprint = { it, _ -> it.definingClass.endsWith("PivotBar;") && it.name == "onConfigurationChanged" }
)

View File

@ -11,5 +11,5 @@ object PivotBarStyleFingerprint : MethodFingerprint(
Opcode.MOVE_RESULT,
Opcode.XOR_INT_2ADDR
),
customFingerprint = { it.definingClass.endsWith("PivotBar;") }
customFingerprint = { it, _ -> it.definingClass.endsWith("PivotBar;") }
)

View File

@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
@ -57,7 +57,7 @@ class TabletNavigationBarPatch : BytecodePatch(
companion object {
private fun MethodFingerprintResult.insertHook() {
val targetIndex = this.scanResult.patternScanResult!!.startIndex + 1
val register = mutableMethod.instruction<OneRegisterInstruction>(targetIndex).registerA
val register = mutableMethod.getInstruction<OneRegisterInstruction>(targetIndex).registerA
mutableMethod.addInstructions(
targetIndex + 1, """

View File

@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -45,21 +45,21 @@ class HideAutoplayButtonPatch : BytecodePatch(
LayoutConstructorFingerprint.result?.mutableMethod?.let {
val insertInstruction = it.implementation!!.instructions
val dummyRegister = it.instruction<OneRegisterInstruction>(it.getStringIndex("1.0x")).registerA
val dummyRegister = it.getInstruction<OneRegisterInstruction>(it.getStringIndex("1.0x")).registerA
val insertIndex = it.getWideLiteralIndex(autoNavPreviewId)
val branchIndex = insertInstruction.subList(insertIndex + 1, insertInstruction.size - 1).indexOfFirst { instruction ->
((instruction as? ReferenceInstruction)?.reference as? MethodReference)?.name == "addOnLayoutChangeListener"
} + 2
val jumpInstruction = it.instruction<Instruction>(insertIndex + branchIndex)
val jumpInstruction = it.getInstruction<Instruction>(insertIndex + branchIndex)
it.addInstructions(
it.addInstructionsWithLabels(
insertIndex, """
invoke-static {}, $PLAYER->hideAutoPlayButton()Z
move-result v$dummyRegister
if-nez v$dummyRegister, :hidden
""", listOf(ExternalLabel("hidden", jumpInstruction))
""", ExternalLabel("hidden", jumpInstruction)
)
} ?: return LayoutConstructorFingerprint.toErrorResult()

View File

@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess

View File

@ -4,7 +4,7 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess

View File

@ -13,5 +13,5 @@ object LayoutCircleFingerprint : MethodFingerprint(
Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST,
),
customFingerprint = { it.isWideLiteralExists(layoutCircleId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(layoutCircleId) }
)

View File

@ -13,5 +13,5 @@ object LayoutIconFingerprint : MethodFingerprint(
Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST,
),
customFingerprint = { it.isWideLiteralExists(layoutIconId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(layoutIconId) }
)

View File

@ -13,5 +13,5 @@ object LayoutVideoFingerprint : MethodFingerprint(
Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST,
),
customFingerprint = { it.isWideLiteralExists(layoutVideoId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(layoutVideoId) }
)

View File

@ -6,7 +6,7 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
@ -42,7 +42,7 @@ class HideEndscreenCardsPatch : BytecodePatch(
fun MethodFingerprintResult.injectHideCalls() {
val index = this.scanResult.patternScanResult!!.endIndex
this.mutableMethod.apply {
val register = this.instruction<OneRegisterInstruction>(index).registerA
val register = getInstruction<OneRegisterInstruction>(index).registerA
this.implementation!!.injectHideCall(index + 1, register, "layout/PlayerPatch", "hideEndScreen")
}
}

View File

@ -6,6 +6,6 @@ import org.jf.dexlib2.AccessFlags
object InfocardsIncognitoFingerprint : MethodFingerprint(
returnType = "L",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
strings = listOf("vibrator")
)

View File

@ -6,6 +6,6 @@ import org.jf.dexlib2.AccessFlags
object InfocardsIncognitoParentFingerprint : MethodFingerprint(
returnType = "L",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
strings = listOf("player_overlay_info_card_teaser"),
)

View File

@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult

View File

@ -5,5 +5,5 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object MusicAppDeeplinkButtonFingerprint : MethodFingerprint(
returnType = "V",
parameters = listOf("Z", "Z"),
customFingerprint = { it.definingClass.endsWith("MusicAppDeeplinkButtonController;") }
customFingerprint = { it, _ -> it.definingClass.endsWith("MusicAppDeeplinkButtonController;") }
)

View File

@ -5,7 +5,8 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -32,12 +33,12 @@ class HideMusicButtonPatch : BytecodePatch(
MusicAppDeeplinkButtonFingerprint.result?.mutableMethod?.let {
it.implementation!!.instructions.apply {
val jumpInstruction = this[size - 1] as Instruction
it.addInstructions(
it.addInstructionsWithLabels(
0, """
invoke-static {}, $PLAYER->hideMusicButton()Z
move-result v0
if-nez v0, :hidden
""", listOf(ExternalLabel("hidden", jumpInstruction))
""", ExternalLabel("hidden", jumpInstruction)
)
}
} ?: return MusicAppDeeplinkButtonFingerprint.toErrorResult()

View File

@ -3,7 +3,7 @@ package app.revanced.patches.youtube.layout.player.playerbuttonbg.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object HidePlayerButtonFingerprint : MethodFingerprint (
customFingerprint = {
customFingerprint = { it, _ ->
it.definingClass == "Lapp/revanced/integrations/patches/layout/PlayerPatch;"
&& it.name == "hidePlayerButton"
}

View File

@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess

View File

@ -5,5 +5,5 @@ import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch.
import app.revanced.util.bytecode.isWideLiteralExists
object ScrimOverlayFingerprint : MethodFingerprint(
customFingerprint = { it.definingClass.endsWith("YouTubeControlsOverlay;") && it.isWideLiteralExists(scrimOverlayId) }
customFingerprint = { it, _ -> it.definingClass.endsWith("YouTubeControlsOverlay;") && it.isWideLiteralExists(scrimOverlayId) }
)

View File

@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
@ -41,8 +41,8 @@ class PlayerOverlayFilterPatch : BytecodePatch(
ScrimOverlayFingerprint.result?.mutableMethod?.let {
val targetIndex = it.getWideLiteralIndex(scrimOverlayId) + 3
val targetParameter = it.instruction<ReferenceInstruction>(targetIndex).reference
val targetRegister = it.instruction<OneRegisterInstruction>(targetIndex).registerA
val targetParameter = it.getInstruction<ReferenceInstruction>(targetIndex).reference
val targetRegister = it.getInstruction<OneRegisterInstruction>(targetIndex).registerA
if (!targetParameter.toString().endsWith("Landroid/widget/ImageView;"))
return PatchResultError("Method signature parameter did not match: $targetParameter")

Some files were not shown because too many files have changed in this diff Show More