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

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object PowerSaveModeFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("L"),
opcodes = listOf(
Opcode.IGET_OBJECT,
@ -21,5 +21,5 @@ object PowerSaveModeFingerprint : MethodFingerprint(
Opcode.INVOKE_VIRTUAL,
Opcode.RETURN_VOID
),
customFingerprint = { it.name == "accept" }
customFingerprint = { it, _ -> it.name == "accept" }
)

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

@ -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
@ -28,7 +28,7 @@ class ClientSpoofPatch : BytecodePatch(
UserAgentHeaderBuilderFingerprint.result?.let {
it.mutableMethod.apply {
val insertIndex = it.scanResult.patternScanResult!!.endIndex
val packageNameRegister = instruction<FiveRegisterInstruction>(insertIndex).registerD
val packageNameRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerD
addInstruction(insertIndex, "const-string v$packageNameRegister, \"$PACKAGE_NAME\"")
}
} ?: return UserAgentHeaderBuilderFingerprint.toErrorResult()

View File

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

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object ExternalBrowserSecondaryFingerprint : MethodFingerprint(
returnType = "L",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
opcodes = listOf(
Opcode.IPUT_OBJECT,
Opcode.NEW_INSTANCE,

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object ExternalBrowserTertiaryFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
opcodes = listOf(
Opcode.CHECK_CAST,
Opcode.NEW_INSTANCE,

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
@ -41,7 +41,7 @@ class ExternalBrowserPatch : BytecodePatch(
val result = it.result?: return it.toErrorResult()
it.result?.mutableMethod?.apply {
val endIndex = result.scanResult.patternScanResult!!.endIndex
val register = instruction<OneRegisterInstruction>(endIndex).registerA
val register = getInstruction<OneRegisterInstruction>(endIndex).registerA
addInstructions(
endIndex + 1, """
invoke-static {v$register}, $MISC_PATH/ExternalBrowserPatch;->enableExternalBrowser(Ljava/lang/String;)Ljava/lang/String;

View File

@ -11,5 +11,5 @@ object VideoCapabilitiesFingerprint : MethodFingerprint(
Opcode.IPUT,
Opcode.IPUT
),
customFingerprint = { it.name == "<init>" }
customFingerprint = { it, _ -> it.name == "<init>" }
)

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object Vp9PrimaryFingerprint : MethodFingerprint(
returnType = "Z",
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
parameters = listOf("I"),
opcodes = listOf(
Opcode.RETURN,

View File

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

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object Vp9SecondaryFingerprint : MethodFingerprint(
returnType = "Z",
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
parameters = listOf("L", "I"),
opcodes = listOf(
Opcode.RETURN,

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.addInstructions
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.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.BytecodePatch
@ -109,8 +109,8 @@ class ForceVP9CodecPatch : BytecodePatch(
val startIndex = scanResult.patternScanResult!!.startIndex
val endIndex = scanResult.patternScanResult!!.endIndex
val startRegister = instruction<OneRegisterInstruction>(startIndex).registerA
val endRegister = instruction<OneRegisterInstruction>(endIndex).registerA
val startRegister = getInstruction<OneRegisterInstruction>(startIndex).registerA
val endRegister = getInstruction<OneRegisterInstruction>(endIndex).registerA
hookOverride(endIndex + 1, endRegister)
removeInstruction(endIndex)
@ -148,7 +148,7 @@ class ForceVP9CodecPatch : BytecodePatch(
if (indexString != targetString) continue
val register = instruction<OneRegisterInstruction>(index).registerA
val register = getInstruction<OneRegisterInstruction>(index).registerA
addInstructions(
index + 1, """

View File

@ -3,6 +3,6 @@ package app.revanced.patches.youtube.misc.integrations.fingerprints
import app.revanced.patches.shared.patch.integrations.AbstractIntegrationsPatch.IntegrationsFingerprint
object ServiceFingerprint : IntegrationsFingerprint(
customFingerprint = { it.definingClass.endsWith("ApiPlayerService;") && it.name == "<init>" },
customFingerprint = { it, _ -> it.definingClass.endsWith("ApiPlayerService;") && it.name == "<init>" },
contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size }
)

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.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
@ -38,12 +39,12 @@ class LayoutSwitchPatch : BytecodePatch(
ClientFormFactorFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
it.mutableMethod.apply {
val jumpIndex = it.scanResult.patternScanResult!!.startIndex + 1
addInstructions(
addInstructionsWithLabels(
1, """
invoke-static {}, $MISC_PATH/LayoutOverridePatch;->enableTabletLayout()Z
move-result v2
if-nez v2, :tablet_layout
""", listOf(ExternalLabel("tablet_layout", instruction(jumpIndex)))
""", ExternalLabel("tablet_layout", getInstruction(jumpIndex))
)
}
} ?: return ClientFormFactorFingerprint.toErrorResult()

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object LithoThemeFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PROTECTED or AccessFlags.FINAL,
accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL,
parameters = listOf("L"),
opcodes = listOf(
Opcode.IF_NEZ,
@ -15,5 +15,5 @@ object LithoThemeFingerprint : MethodFingerprint(
Opcode.INVOKE_VIRTUAL, // Paint.setColor: inject point
Opcode.RETURN_VOID
),
customFingerprint = { it.name == "onBoundsChange" }
customFingerprint = { it, _ -> it.name == "onBoundsChange" }
)

View File

@ -2,8 +2,8 @@ package app.revanced.patches.youtube.misc.litho.patch
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
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.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
@ -11,7 +11,6 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
import app.revanced.util.integrations.Constants.ADS_PATH
@DependsOn(
[
@ -28,7 +27,7 @@ class ByteBufferFilterPatch : ResourcePatch {
companion object{
fun inject(descriptor: String){
LithoFilterPatch.lithoMethod.addInstructions(
LithoFilterPatch.lithoMethod.addInstructionsWithLabels(
0, """
move-object/from16 v10, p3
iget-object v10, v10, ${LithoFilterPatch.objectReference}
@ -44,7 +43,7 @@ class ByteBufferFilterPatch : ResourcePatch {
move-result-object v0
iget-object v0, v0, ${LithoFilterPatch.emptyComponentFieldDescriptor}
return-object v0
""", listOf(ExternalLabel("do_not_block", LithoFilterPatch.lithoMethod.instruction(0)))
""", ExternalLabel("do_not_block", LithoFilterPatch.lithoMethod.getInstruction(0))
)
}
}

View File

@ -3,8 +3,8 @@ package app.revanced.patches.youtube.misc.litho.patch
import app.revanced.extensions.toErrorResult
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
@ -48,12 +48,12 @@ class LithoFilterPatch : BytecodePatch(
LithoBufferFingerprint.result?.let {
val startIndex = it.scanResult.patternScanResult!!.startIndex
bufferReference = it.mutableMethod.instruction<ReferenceInstruction>(startIndex).reference
bufferReference = it.mutableMethod.getInstruction<ReferenceInstruction>(startIndex).reference
} ?: return LithoBufferFingerprint.toErrorResult()
LithoObjectFingerprint.result?.let {
val endIndex = it.scanResult.patternScanResult!!.endIndex
objectRegister = it.mutableMethod.instruction<BuilderInstruction35c>(endIndex).registerC
objectRegister = it.mutableMethod.getInstruction<BuilderInstruction35c>(endIndex).registerC
} ?: return LithoObjectFingerprint.toErrorResult()
LithoFingerprint.result?.let { result ->
@ -62,23 +62,23 @@ class LithoFilterPatch : BytecodePatch(
lithoMethod.apply {
val bufferIndex = getNarrowLiteralIndex(168777401)
val bufferRegister = instruction<OneRegisterInstruction>(bufferIndex).registerA
val bufferRegister = getInstruction<OneRegisterInstruction>(bufferIndex).registerA
val targetIndex = getStringIndex("Element missing type extension") + 2
val identifierRegister = instruction<OneRegisterInstruction>(endIndex).registerA
val identifierRegister = getInstruction<OneRegisterInstruction>(endIndex).registerA
builderMethodDescriptor = instruction<ReferenceInstruction>(targetIndex).reference
emptyComponentFieldDescriptor = instruction<ReferenceInstruction>(targetIndex + 2).reference
builderMethodDescriptor = getInstruction<ReferenceInstruction>(targetIndex).reference
emptyComponentFieldDescriptor = getInstruction<ReferenceInstruction>(targetIndex + 2).reference
implementation!!.instructions.apply {
filter { instruction ->
val fieldReference = (instruction as? ReferenceInstruction)?.reference as? FieldReference
fieldReference?.let { it.type == "Ljava/lang/StringBuilder;" } == true
}.forEach { instruction ->
val insertIndex = indexOf(instruction)
val stringBuilderRegister = lithoMethod.instruction<TwoRegisterInstruction>(insertIndex).registerA
val stringBuilderRegister = lithoMethod.getInstruction<TwoRegisterInstruction>(insertIndex).registerA
val objectIndex = lithoMethod.getStringIndex("") - 2
objectReference = lithoMethod.instruction<ReferenceInstruction>(objectIndex).reference
lithoMethod.addInstructions(
objectReference = lithoMethod.getInstruction<ReferenceInstruction>(objectIndex).reference
lithoMethod.addInstructionsWithLabels(
insertIndex + 1, """
move-object/from16 v$bufferRegister, p3
iget-object v$bufferRegister, v$bufferRegister, $objectReference
@ -93,7 +93,7 @@ class LithoFilterPatch : BytecodePatch(
move-result-object v0
iget-object v0, v0, $emptyComponentFieldDescriptor
return-object v0
""", listOf(ExternalLabel("not_an_ad", lithoMethod.instruction(insertIndex + 1)))
""", ExternalLabel("not_an_ad", lithoMethod.getInstruction(insertIndex + 1))
)
}
}

View File

@ -4,7 +4,7 @@ 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.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess

View File

@ -5,6 +5,6 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
object GooglePlayUtilityFingerprint : MethodFingerprint(
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
strings = listOf("This should never happen.", "MetadataValueReader", "com.google.android.gms")
)

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object KidsMinimizedPlaybackPolicyControllerFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("I", "L", "L"),
opcodes = listOf(
Opcode.IF_EQZ,
@ -19,5 +19,5 @@ object KidsMinimizedPlaybackPolicyControllerFingerprint : MethodFingerprint(
Opcode.IGET,
Opcode.INVOKE_STATIC
),
customFingerprint = { it.definingClass.endsWith("MinimizedPlaybackPolicyController;") }
customFingerprint = { it, _ -> it.definingClass.endsWith("MinimizedPlaybackPolicyController;") }
)

View File

@ -8,8 +8,8 @@ import org.jf.dexlib2.Opcode
object MinimizedPlaybackManagerFingerprint : MethodFingerprint(
returnType = "Z",
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
parameters = listOf("L"),
opcodes = listOf(Opcode.AND_INT_LIT16),
customFingerprint = { it.isNarrowLiteralExists(64657230) }
customFingerprint = { it, _ -> it.isNarrowLiteralExists(64657230) }
)

View File

@ -9,7 +9,7 @@ import org.jf.dexlib2.Opcode
object MinimizedPlaybackSettingsFingerprint : MethodFingerprint(
returnType = "L",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
opcodes = listOf(
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT,
@ -19,5 +19,5 @@ object MinimizedPlaybackSettingsFingerprint : MethodFingerprint(
Opcode.IF_NEZ,
Opcode.GOTO
),
customFingerprint = { it.isWideLiteralExists(backgroundCategoryId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(backgroundCategoryId) }
)

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.addInstruction
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
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

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object OpenLinksDirectlyFingerprintPrimary : MethodFingerprint(
returnType = "Ljava/lang/Object",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("Ljava/lang/Object"),
opcodes = listOf(
Opcode.INVOKE_STATIC,

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object OpenLinksDirectlyFingerprintSecondary : MethodFingerprint(
returnType = "Landroid/net/Uri",
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
parameters = listOf("Ljava/lang/String"),
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.instruction
import app.revanced.patcher.extensions.replaceInstruction
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
@ -39,7 +39,7 @@ class OpenLinksDirectlyPatch : BytecodePatch(
val result = it.result?: return it.toErrorResult()
val insertIndex = result.scanResult.patternScanResult!!.startIndex
result.mutableMethod.apply {
val register = instruction<Instruction35c>(insertIndex).registerC
val register = getInstruction<Instruction35c>(insertIndex).registerC
replaceInstruction(
insertIndex,
"invoke-static {v$register}, $MISC_PATH/OpenLinksDirectlyPatch;->enableBypassRedirect(Ljava/lang/String;)Landroid/net/Uri;"

View File

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

View File

@ -12,5 +12,5 @@ object VideoSpeedChangedFingerprint : MethodFingerprint(
Opcode.IGET_OBJECT,
Opcode.INVOKE_VIRTUAL
),
customFingerprint = { it.name == "onItemClick" }
customFingerprint = { it, _ -> it.name == "onItemClick" }
)

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object VideoSpeedParentFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
parameters = listOf("L", "L", "[L", "I"),
opcodes = listOf(
Opcode.ARRAY_LENGTH,

View File

@ -6,7 +6,7 @@ import org.jf.dexlib2.AccessFlags
object VideoSpeedPatchFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
parameters = listOf("F"),
customFingerprint = { it.definingClass.endsWith("/VideoSpeedPatch;") && it.name == "overrideSpeed"}
customFingerprint = { it, _ -> it.definingClass.endsWith("/VideoSpeedPatch;") && it.name == "overrideSpeed"}
)

View File

@ -6,7 +6,7 @@ import org.jf.dexlib2.AccessFlags
object VideoSpeedSettingsFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("[L", "I"),
strings = listOf("menu_item_playback_speed")
)

View File

@ -5,7 +5,11 @@ 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.*
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.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.BytecodePatch
@ -49,9 +53,9 @@ class OverrideSpeedHookPatch : BytecodePatch(
val startIndex = it.scanResult.patternScanResult!!.startIndex
val endIndex = it.scanResult.patternScanResult!!.endIndex
val reference1 = instruction<ReferenceInstruction>(startIndex).reference
val reference2 = instruction<ReferenceInstruction>(endIndex - 1).reference
val reference3 = instruction<ReferenceInstruction>(endIndex).reference
val reference1 = getInstruction<ReferenceInstruction>(startIndex).reference
val reference2 = getInstruction<ReferenceInstruction>(endIndex - 1).reference
val reference3 = getInstruction<ReferenceInstruction>(endIndex).reference
val fieldReference = reference2 as FieldReference
val parentMutableClass = parentResult.mutableClass
@ -100,7 +104,7 @@ class OverrideSpeedHookPatch : BytecodePatch(
SpeedClassFingerprint.result?.let {
it.mutableMethod.apply {
val index = it.scanResult.patternScanResult!!.endIndex
val register = instruction<OneRegisterInstruction>(index).registerA
val register = getInstruction<OneRegisterInstruction>(index).registerA
SPEED_CLASS = this.returnType
replaceInstruction(
index,

View File

@ -7,5 +7,5 @@ import org.jf.dexlib2.Opcode
object LiveChatFingerprint : MethodFingerprint(
opcodes = listOf(Opcode.NEW_INSTANCE),
customFingerprint = { it.isWideLiteralExists(liveChatButtonId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(liveChatButtonId) }
)

View File

@ -5,8 +5,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.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
@ -30,7 +30,7 @@ class PlayerButtonPatch : BytecodePatch(
LiveChatFingerprint.result?.let {
val endIndex = it.scanResult.patternScanResult!!.endIndex
val instructions = it.mutableMethod.instruction(endIndex)
val instructions = it.mutableMethod.getInstruction(endIndex)
val imageButtonClass =
context
.findClass((instructions as BuilderInstruction21c)

View File

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

View File

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

View File

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

View File

@ -8,7 +8,7 @@ object SeekEDUVisibleFingerprint : MethodFingerprint(
returnType = "V",
parameters = listOf("Z"),
opcodes = listOf(Opcode.OR_INT_LIT8),
customFingerprint = { methodDef ->
customFingerprint = { methodDef, _ ->
methodDef.implementation!!.instructions.any {
((it as? NarrowLiteralInstruction)?.narrowLiteral == 32)
}

View File

@ -8,7 +8,7 @@ object UserScrubbingFingerprint : MethodFingerprint(
returnType = "V",
parameters = listOf("Z"),
opcodes = listOf(Opcode.OR_INT_LIT8),
customFingerprint = { methodDef ->
customFingerprint = { methodDef, _ ->
methodDef.implementation!!.instructions.any {
((it as? NarrowLiteralInstruction)?.narrowLiteral == 64)
}

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
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
@ -71,7 +71,7 @@ class PlayerControlsPatch : BytecodePatch(
) {
val endIndex = scanResult.patternScanResult!!.endIndex
with (mutableMethod) {
val viewRegister = (instruction(endIndex) as OneRegisterInstruction).registerA
val viewRegister = (getInstruction(endIndex) as OneRegisterInstruction).registerA
addInstruction(
endIndex + 1,
"invoke-static {v$viewRegister}, $descriptor->initialize(Ljava/lang/Object;)V"

View File

@ -3,7 +3,7 @@ package app.revanced.patches.youtube.misc.playeroverlay.fingerprint
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object PlayerOverlaysOnFinishInflateFingerprint : MethodFingerprint(
customFingerprint = {
customFingerprint = { it, _ ->
it.definingClass.endsWith("YouTubePlayerOverlaysLayout;") && it.name == "onFinishInflate"
}
)

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

@ -7,13 +7,13 @@ import org.jf.dexlib2.Opcode
object UpdatePlayerTypeFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("L"),
opcodes = listOf(
Opcode.IF_NE,
Opcode.RETURN_VOID
),
customFingerprint = {
customFingerprint = { it, _ ->
it.definingClass.endsWith("YouTubePlayerOverlaysLayout;")
}
)

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,5 +4,5 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object SubtitleWindowFingerprint : MethodFingerprint(
parameters = listOf("I", "I", "I", "Z", "Z"),
customFingerprint = { it.definingClass.endsWith("SubtitleWindowSettings;") && it.name == "<init>" }
customFingerprint = { it, _ -> it.definingClass.endsWith("SubtitleWindowSettings;") && it.name == "<init>" }
)

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.addInstruction
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
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

@ -5,7 +5,7 @@ import org.jf.dexlib2.AccessFlags
object CronetEngineBuilderFingerprint : MethodFingerprint(
returnType = "L",
access = AccessFlags.PUBLIC.value,
accessFlags = AccessFlags.PUBLIC.value,
parameters = listOf("Z"),
customFingerprint = { it.definingClass == "Lorg/chromium/net/CronetEngine\$Builder;" && it.name == "enableQuic" }
customFingerprint = { it, _ -> it.definingClass == "Lorg/chromium/net/CronetEngine\$Builder;" && it.name == "enableQuic" }
)

View File

@ -5,7 +5,7 @@ import org.jf.dexlib2.AccessFlags
object ExperimentalCronetEngineBuilderFingerprint : MethodFingerprint(
returnType = "L",
access = AccessFlags.PUBLIC.value,
accessFlags = AccessFlags.PUBLIC.value,
parameters = listOf("Z"),
customFingerprint = { it.definingClass == "Lorg/chromium/net/ExperimentalCronetEngine\$Builder;" && it.name == "enableQuic" }
customFingerprint = { it, _ -> it.definingClass == "Lorg/chromium/net/ExperimentalCronetEngine\$Builder;" && it.name == "enableQuic" }
)

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.PatchResultSuccess

View File

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

View File

@ -6,6 +6,6 @@ import org.jf.dexlib2.AccessFlags
object TextComponentConstructorFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PRIVATE or AccessFlags.CONSTRUCTOR,
accessFlags = AccessFlags.PRIVATE or AccessFlags.CONSTRUCTOR,
strings = listOf("TextComponent")
)

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object TextComponentContextFingerprint : MethodFingerprint(
returnType = "L",
access = AccessFlags.PROTECTED or AccessFlags.FINAL,
accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL,
parameters = listOf("L"),
opcodes = listOf(
Opcode.IGET_OBJECT, // conversion context

View File

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

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.replaceInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
@ -72,7 +72,7 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
with (it.mutableMethod) {
val conversionContextIndex = it.scanResult.patternScanResult!!.startIndex
conversionContextFieldReference =
instruction<ReferenceInstruction>(conversionContextIndex).reference
getInstruction<ReferenceInstruction>(conversionContextIndex).reference
}
} ?: return TextComponentContextFingerprint.toErrorResult()
@ -80,7 +80,7 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
it.mutableMethod.apply {
val startIndex = it.scanResult.patternScanResult!!.startIndex
tmpRegister =
instruction<FiveRegisterInstruction>(startIndex).registerE
getInstruction<FiveRegisterInstruction>(startIndex).registerE
}
} ?: return TextComponentTmpFingerprint.toErrorResult()
@ -89,10 +89,10 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
with (it.mutableMethod) {
val atomicReferenceStartIndex = it.scanResult.patternScanResult!!.startIndex
val insertIndex = it.scanResult.patternScanResult!!.endIndex
val moveCharSequenceInstruction = instruction<TwoRegisterInstruction>(insertIndex)
val moveCharSequenceInstruction = getInstruction<TwoRegisterInstruction>(insertIndex)
val atomicReferenceRegister =
instruction<FiveRegisterInstruction>(atomicReferenceStartIndex).registerC
getInstruction<FiveRegisterInstruction>(atomicReferenceStartIndex).registerC
val charSequenceRegister =
moveCharSequenceInstruction.registerB

View File

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

View File

@ -10,5 +10,5 @@ object ButtonTagOnClickFingerprint : MethodFingerprint(
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT
),
customFingerprint = { it.name == "onClick" }
customFingerprint = { it, _ -> it.name == "onClick" }
)

View File

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

View File

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

View File

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

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.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
@ -42,14 +42,14 @@ class ReturnYouTubeDislikeOldLayoutPatch : BytecodePatch(
it.mutableMethod.apply {
val startIndex = it.scanResult.patternScanResult!!.startIndex
slimMetadataButtonViewFieldReference =
instruction<ReferenceInstruction>(startIndex).reference
getInstruction<ReferenceInstruction>(startIndex).reference
}
} ?: return SlimMetadataButtonViewFingerprint.toErrorResult()
SlimMetadataButtonTextFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
it.mutableMethod.apply {
val insertIndex = it.scanResult.patternScanResult!!.startIndex
val setTextInstruction = instruction<FiveRegisterInstruction>(insertIndex)
val setTextInstruction = getInstruction<FiveRegisterInstruction>(insertIndex)
val tempRegister =
setTextInstruction.registerC + 1
@ -75,14 +75,14 @@ class ReturnYouTubeDislikeOldLayoutPatch : BytecodePatch(
it.mutableMethod.apply {
val startIndex = it.scanResult.patternScanResult!!.startIndex
getActiveBooleanFieldReference =
instruction<ReferenceInstruction>(startIndex).reference
getInstruction<ReferenceInstruction>(startIndex).reference
}
} ?: return ButtonTagOnClickFingerprint.toErrorResult()
parentResult.mutableMethod.apply {
val dislikeButtonIndex = getWideLiteralIndex(dislikeButtonId)
val dislikeButtonRegister = instruction<OneRegisterInstruction>(dislikeButtonIndex).registerA
val dislikeButtonInstruction = instruction<TwoRegisterInstruction>(dislikeButtonIndex - 1)
val dislikeButtonRegister = getInstruction<OneRegisterInstruction>(dislikeButtonIndex).registerA
val dislikeButtonInstruction = getInstruction<TwoRegisterInstruction>(dislikeButtonIndex - 1)
addInstructions(
dislikeButtonIndex, """
@ -93,8 +93,8 @@ class ReturnYouTubeDislikeOldLayoutPatch : BytecodePatch(
)
val likeButtonIndex = getWideLiteralIndex(likeButtonId)
val likeButtonRegister = instruction<OneRegisterInstruction>(likeButtonIndex).registerA
val likeButtonInstruction = instruction<TwoRegisterInstruction>(likeButtonIndex - 1)
val likeButtonRegister = getInstruction<OneRegisterInstruction>(likeButtonIndex).registerA
val likeButtonInstruction = getInstruction<TwoRegisterInstruction>(likeButtonIndex - 1)
addInstructions(
likeButtonIndex, """

View File

@ -5,8 +5,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.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -30,14 +30,14 @@ class ReturnYouTubeDislikeShortsPatch : BytecodePatch(
.getMethod() as MutableMethod
).apply {
val insertIndex = implementation!!.instructions.size - 1
val insertRegister = instruction<OneRegisterInstruction>(insertIndex).registerA
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
this.insertShorts(insertIndex, insertRegister)
}
it.mutableMethod.apply {
val insertIndex = it.scanResult.patternScanResult!!.startIndex + 2
val insertRegister = instruction<OneRegisterInstruction>(insertIndex - 1).registerA
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex - 1).registerA
this.insertShorts(insertIndex, insertRegister)
}

View File

@ -8,5 +8,5 @@ import org.jf.dexlib2.Opcode
object ThemeSetterSystemFingerprint : MethodFingerprint(
returnType = "L",
opcodes = listOf(Opcode.RETURN_OBJECT),
customFingerprint = { it.isWideLiteralExists(appearanceStringId) }
customFingerprint = { it, _ -> it.isWideLiteralExists(appearanceStringId) }
)

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.addInstruction
import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
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

View File

@ -12,5 +12,5 @@ object OverlayViewLayoutFingerprint : MethodFingerprint(
Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST
),
customFingerprint = { it.definingClass.endsWith("YouTubeControlsOverlay;") && it.isWideLiteralExists(insetOverlayViewLayoutId) }
customFingerprint = { it, _ -> it.definingClass.endsWith("YouTubeControlsOverlay;") && it.isWideLiteralExists(insetOverlayViewLayoutId) }
)

View File

@ -3,5 +3,5 @@ package app.revanced.patches.youtube.misc.sponsorblock.bytecode.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object PlayerControllerFingerprint : MethodFingerprint(
customFingerprint = { it.definingClass.endsWith("SegmentPlaybackController;") && it.name == "setSponsorBarRect" }
customFingerprint = { it, _ -> it.definingClass.endsWith("SegmentPlaybackController;") && it.name == "setSponsorBarRect" }
)

View File

@ -4,10 +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.addInstruction
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.replaceInstruction
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.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
@ -96,7 +96,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
for ((index, instruction) in insertInstructions.withIndex()) {
if (instruction.opcode != Opcode.INVOKE_STATIC) continue
val invokeInstruction = insertMethod.instruction<Instruction35c>(index)
val invokeInstruction = insertMethod.getInstruction<Instruction35c>(index)
if ((invokeInstruction.reference as MethodReference).name != "round") continue
val insertIndex = index + 2
@ -143,7 +143,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
val drawSegmentInstructionInsertIndex = index - 1
val (canvasInstance, centerY) =
insertMethod.instruction<FiveRegisterInstruction>(drawSegmentInstructionInsertIndex).let { it.registerC to it.registerE }
insertMethod.getInstruction<FiveRegisterInstruction>(drawSegmentInstructionInsertIndex).let { it.registerC to it.registerE }
insertMethod.addInstruction(
drawSegmentInstructionInsertIndex,
@ -173,7 +173,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
TotalTimeFingerprint.result?.mutableMethod?.let {
it.apply {
val targetIndex = getWideLiteralIndex(totalTimeId) + 2
val targetRegister = instruction<OneRegisterInstruction>(targetIndex).registerA
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
addInstructions(
targetIndex + 1, """
@ -190,7 +190,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
OverlayViewLayoutFingerprint.result?.mutableMethod?.let{
it.apply{
val targetIndex = getWideLiteralIndex(insetOverlayViewLayoutId) + 3
val targetRegister = instruction<OneRegisterInstruction>(targetIndex).registerA
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
addInstruction(
targetIndex + 1,
@ -207,7 +207,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
for ((index, instruction) in instructions.withIndex()) {
if (instruction.opcode != Opcode.CONST_STRING) continue
val register = it.instruction<OneRegisterInstruction>(index).registerA
val register = it.getInstruction<OneRegisterInstruction>(index).registerA
it.replaceInstruction(
index,
"const-string v$register, \"${MainstreamVideoIdPatch.reactReference}\""

View File

@ -7,11 +7,11 @@ import org.jf.dexlib2.Opcode
object OnDrawFingerprint : MethodFingerprint (
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("L"),
opcodes = listOf(
Opcode.MOVE_OBJECT_FROM16,
Opcode.MOVE_OBJECT_FROM16
),
customFingerprint = {it.name == "onDraw"}
customFingerprint = { it, _ -> it.name == "onDraw"}
)

View File

@ -7,10 +7,10 @@ import org.jf.dexlib2.Opcode
object LegacyVideoIdFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.DECLARED_SYNCHRONIZED or AccessFlags.FINAL or AccessFlags.PUBLIC,
accessFlags = AccessFlags.DECLARED_SYNCHRONIZED or AccessFlags.FINAL or AccessFlags.PUBLIC,
parameters = listOf("L"),
opcodes = listOf(Opcode.INVOKE_INTERFACE),
customFingerprint = {
customFingerprint = { it, _ ->
it.definingClass.endsWith("PlaybackLifecycleMonitor;")
}
)

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.PatchResultSuccess

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object MainstreamVideoIdFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("L"),
opcodes = listOf(
Opcode.INVOKE_INTERFACE,
@ -15,5 +15,5 @@ object MainstreamVideoIdFingerprint : MethodFingerprint(
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT_OBJECT
),
customFingerprint = { it.definingClass.endsWith("SubtitlesOverlayPresenter;") }
customFingerprint = { it, _ -> it.definingClass.endsWith("SubtitlesOverlayPresenter;") }
)

View File

@ -6,9 +6,9 @@ import org.jf.dexlib2.AccessFlags
object TimebarFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("L"),
customFingerprint = {
customFingerprint = { it, _ ->
it.definingClass.endsWith("/TimeBar;")
&& it.name.contains("draw")
}

View File

@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
object VideoTimeHighPrecisionFingerprint : MethodFingerprint (
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
parameters = listOf("J", "J", "J", "J", "I", "L"),
opcodes = listOf(
Opcode.INVOKE_DIRECT,

View File

@ -6,7 +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.*
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
@ -90,7 +92,7 @@ class MainstreamVideoIdPatch : BytecodePatch(
} ?: return SeekFingerprint.toErrorResult()
} ?: return PlayerInitFingerprint.toErrorResult()
/*
/**
* Set the high precision video time method
*/
VideoTimeHighPrecisionParentFingerprint.result?.let { parentResult ->
@ -99,12 +101,12 @@ class MainstreamVideoIdPatch : BytecodePatch(
} ?: return VideoTimeHighPrecisionFingerprint.toErrorResult()
} ?: return VideoTimeHighPrecisionParentFingerprint.toErrorResult()
/*
/**
* Hook the methods which set the time
*/
highPrecisionTimeHook(INTEGRATIONS_CLASS_DESCRIPTOR, "setVideoTime")
/*
/**
* Set current video time
*/
PlayerControllerSetTimeReferenceFingerprint.result?.let {