mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 21:27:43 +02:00
chore: lint code
This commit is contained in:
@ -284,7 +284,8 @@ object LayoutComponentsPatch : BaseBytecodePatch(
|
||||
)
|
||||
SearchBarFingerprint.resultOrThrow().let {
|
||||
it.mutableMethod.apply {
|
||||
val setVisibilityIndex = getTargetIndexWithMethodReferenceNameOrThrow("setVisibility")
|
||||
val setVisibilityIndex =
|
||||
getTargetIndexWithMethodReferenceNameOrThrow("setVisibility")
|
||||
val setVisibilityInstruction =
|
||||
getInstruction<FiveRegisterInstruction>(setVisibilityIndex)
|
||||
|
||||
|
@ -42,7 +42,8 @@ object DislikeRedirectionPatch : BaseBytecodePatch(
|
||||
PendingIntentReceiverFingerprint.resultOrThrow().let {
|
||||
it.mutableMethod.apply {
|
||||
val startIndex = getStringInstructionIndex("YTM Dislike")
|
||||
val onClickRelayIndex = getTargetIndexReversedOrThrow(startIndex, Opcode.INVOKE_VIRTUAL)
|
||||
val onClickRelayIndex =
|
||||
getTargetIndexReversedOrThrow(startIndex, Opcode.INVOKE_VIRTUAL)
|
||||
val onClickRelayMethod = getWalkerMethod(context, onClickRelayIndex)
|
||||
|
||||
onClickRelayMethod.apply {
|
||||
|
@ -133,7 +133,8 @@ object PlayerComponentsPatch : BaseBytecodePatch(
|
||||
colorMathPlayerMethodParameter = parameters
|
||||
|
||||
val relativeIndex = it.scanResult.patternScanResult!!.endIndex + 1
|
||||
val invokeVirtualIndex = getTargetIndexOrThrow(relativeIndex, Opcode.INVOKE_VIRTUAL)
|
||||
val invokeVirtualIndex =
|
||||
getTargetIndexOrThrow(relativeIndex, Opcode.INVOKE_VIRTUAL)
|
||||
val iGetIndex = getTargetIndexOrThrow(relativeIndex, Opcode.IGET)
|
||||
|
||||
colorMathPlayerInvokeVirtualReference =
|
||||
|
@ -33,7 +33,10 @@ object RestoreOldHeaderPatch : BytecodePatch(
|
||||
HeaderSwitchConfigFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex =
|
||||
getTargetIndexOrThrow(getWideLiteralInstructionIndex(45617851), Opcode.MOVE_RESULT)
|
||||
getTargetIndexOrThrow(
|
||||
getWideLiteralInstructionIndex(45617851),
|
||||
Opcode.MOVE_RESULT
|
||||
)
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
|
@ -79,7 +79,8 @@ object SponsorBlockBytecodePatch : BytecodePatch(
|
||||
)
|
||||
|
||||
// Draw segment
|
||||
val drawCircleIndex = getTargetIndexWithMethodReferenceNameReversedOrThrow("drawCircle")
|
||||
val drawCircleIndex =
|
||||
getTargetIndexWithMethodReferenceNameReversedOrThrow("drawCircle")
|
||||
val drawCircleInstruction = getInstruction<FiveRegisterInstruction>(drawCircleIndex)
|
||||
addInstruction(
|
||||
drawCircleIndex,
|
||||
|
@ -138,7 +138,8 @@ object VideoInformationPatch : BytecodePatch(
|
||||
)
|
||||
VideoLengthFingerprint.resultOrThrow().let {
|
||||
it.mutableMethod.apply {
|
||||
val invalidateIndex = getTargetIndexWithMethodReferenceNameReversedOrThrow("invalidate")
|
||||
val invalidateIndex =
|
||||
getTargetIndexWithMethodReferenceNameReversedOrThrow("invalidate")
|
||||
val rectangleIndex = getTargetIndexWithFieldReferenceTypeReversedOrThrow(
|
||||
invalidateIndex + 1,
|
||||
"Landroid/graphics/Rect;"
|
||||
|
@ -138,7 +138,8 @@ abstract class BaseGmsCoreSupportPatch(
|
||||
getTargetIndexWithReference(GET_PACKAGE_NAME_METHOD_REFERENCE)
|
||||
|
||||
if (getPackageNameIndex > -1) {
|
||||
val targetRegister = (getInstruction(getPackageNameIndex) as FiveRegisterInstruction).registerC
|
||||
val targetRegister =
|
||||
(getInstruction(getPackageNameIndex) as FiveRegisterInstruction).registerC
|
||||
|
||||
replaceInstruction(
|
||||
getPackageNameIndex,
|
||||
|
@ -142,7 +142,8 @@ object LithoFilterPatch : BytecodePatch(
|
||||
|
||||
val emptyStringIndex = getStringInstructionIndex("")
|
||||
|
||||
val identifierIndex = getTargetIndexReversedOrThrow(emptyStringIndex, Opcode.IPUT_OBJECT)
|
||||
val identifierIndex =
|
||||
getTargetIndexReversedOrThrow(emptyStringIndex, Opcode.IPUT_OBJECT)
|
||||
val identifierRegister =
|
||||
getInstruction<TwoRegisterInstruction>(identifierIndex).registerA
|
||||
|
||||
|
@ -37,7 +37,10 @@ object AudioTracksPatch : BaseBytecodePatch(
|
||||
"Ljava/util/List;->add(Ljava/lang/Object;)Z"
|
||||
)
|
||||
val insertIndex =
|
||||
getTargetIndexWithReferenceOrThrow(arrayListIndex, "Ljava/util/List;->isEmpty()Z") + 2
|
||||
getTargetIndexWithReferenceOrThrow(
|
||||
arrayListIndex,
|
||||
"Ljava/util/List;->isEmpty()Z"
|
||||
) + 2
|
||||
|
||||
val formatStreamModelRegister =
|
||||
getInstruction<OneRegisterInstruction>(formatStreamModelIndex).registerA
|
||||
|
@ -349,7 +349,10 @@ object ToolBarComponentsPatch : BaseBytecodePatch(
|
||||
it.mutableMethod.apply {
|
||||
val startIndex = getWideLiteralInstructionIndex(VoiceSearch)
|
||||
val setOnClickListenerIndex =
|
||||
getTargetIndexWithMethodReferenceNameOrThrow(startIndex, "setOnClickListener")
|
||||
getTargetIndexWithMethodReferenceNameOrThrow(
|
||||
startIndex,
|
||||
"setOnClickListener"
|
||||
)
|
||||
val viewRegister =
|
||||
getInstruction<FiveRegisterInstruction>(setOnClickListenerIndex).registerC
|
||||
|
||||
|
@ -125,7 +125,8 @@ object PlayerButtonsPatch : BaseBytecodePatch(
|
||||
|
||||
TitleAnchorFingerprint.resultOrThrow().mutableMethod.apply {
|
||||
val titleAnchorConstIndex = getWideLiteralInstructionIndex(TitleAnchor)
|
||||
val titleAnchorIndex = getTargetIndexOrThrow(titleAnchorConstIndex, Opcode.MOVE_RESULT_OBJECT)
|
||||
val titleAnchorIndex =
|
||||
getTargetIndexOrThrow(titleAnchorConstIndex, Opcode.MOVE_RESULT_OBJECT)
|
||||
val titleAnchorRegister =
|
||||
getInstruction<OneRegisterInstruction>(titleAnchorIndex).registerA
|
||||
|
||||
|
@ -203,7 +203,8 @@ object PlayerComponentsPatch : BaseBytecodePatch(
|
||||
it.mutableMethod.apply {
|
||||
val constIndex = getWideLiteralInstructionIndex(FadeDurationFast)
|
||||
val constRegister = getInstruction<OneRegisterInstruction>(constIndex).registerA
|
||||
val insertIndex = getTargetIndexReversedOrThrow(constIndex, Opcode.INVOKE_VIRTUAL) + 1
|
||||
val insertIndex =
|
||||
getTargetIndexReversedOrThrow(constIndex, Opcode.INVOKE_VIRTUAL) + 1
|
||||
val jumpIndex = implementation!!.instructions.let { instruction ->
|
||||
insertIndex + instruction.subList(insertIndex, instruction.size - 1)
|
||||
.indexOfFirst { instructions ->
|
||||
|
@ -94,7 +94,8 @@ object DescriptionComponentsPatch : BaseBytecodePatch(
|
||||
if (SettingsPatch.upward1902) {
|
||||
TextViewComponentFingerprint.resultOrThrow().let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = getTargetIndexWithMethodReferenceNameOrThrow("setTextIsSelectable")
|
||||
val insertIndex =
|
||||
getTargetIndexWithMethodReferenceNameOrThrow("setTextIsSelectable")
|
||||
val insertInstruction = getInstruction<FiveRegisterInstruction>(insertIndex)
|
||||
|
||||
replaceInstruction(
|
||||
|
@ -144,7 +144,8 @@ object ChangeTogglePatch : BaseBytecodePatch(
|
||||
val checkCastIndex = getTargetIndexReversedOrThrow(stringIndex, Opcode.CHECK_CAST)
|
||||
val iGetObjectPrimaryIndex =
|
||||
getTargetIndexReversedOrThrow(checkCastIndex, Opcode.IGET_OBJECT)
|
||||
val iGetObjectSecondaryIndex = getTargetIndexOrThrow(checkCastIndex, Opcode.IGET_OBJECT)
|
||||
val iGetObjectSecondaryIndex =
|
||||
getTargetIndexOrThrow(checkCastIndex, Opcode.IGET_OBJECT)
|
||||
|
||||
val checkCastReference =
|
||||
getInstruction<ReferenceInstruction>(checkCastIndex).reference
|
||||
|
@ -182,7 +182,8 @@ object FullscreenComponentsPatch : BaseBytecodePatch(
|
||||
|
||||
YouTubeControlsOverlayFingerprint.resultOrThrow().let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = getTargetIndexWithMethodReferenceNameOrThrow("setFocusableInTouchMode")
|
||||
val targetIndex =
|
||||
getTargetIndexWithMethodReferenceNameOrThrow("setFocusableInTouchMode")
|
||||
val walkerIndex = getTargetIndexOrThrow(targetIndex, Opcode.INVOKE_STATIC)
|
||||
|
||||
val walkerMethod = getWalkerMethod(context, walkerIndex)
|
||||
|
@ -179,7 +179,8 @@ object SpeedOverlayPatch : BytecodePatch(
|
||||
) + 1
|
||||
insertRegister =
|
||||
getInstruction<FiveRegisterInstruction>(insertIndex - 1).registerC
|
||||
jumpIndex = getTargetIndexOrThrow(speedOverlayValueIndex, Opcode.RETURN_VOID) + 1
|
||||
jumpIndex =
|
||||
getTargetIndexOrThrow(speedOverlayValueIndex, Opcode.RETURN_VOID) + 1
|
||||
hook(insertIndex, insertRegister, jumpIndex)
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,8 @@ object ShortsComponentPatch : BaseBytecodePatch(
|
||||
(instruction.value as? WideLiteralInstruction)?.wideLiteral == ReelPivotButton
|
||||
}
|
||||
val targetIndex = constCalls.elementAt(constCalls.size - 1).index
|
||||
val insertIndex = getTargetIndexReversedOrThrow(targetIndex, Opcode.INVOKE_STATIC) + 1
|
||||
val insertIndex =
|
||||
getTargetIndexReversedOrThrow(targetIndex, Opcode.INVOKE_STATIC) + 1
|
||||
if (insertIndex == 0)
|
||||
throw PatchException("insert index not found")
|
||||
|
||||
|
@ -33,7 +33,10 @@ object CairoSettingsPatch : BytecodePatch(
|
||||
CarioFragmentConfigFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex =
|
||||
getTargetIndexOrThrow(getWideLiteralInstructionIndex(45532100), Opcode.MOVE_RESULT)
|
||||
getTargetIndexOrThrow(
|
||||
getWideLiteralInstructionIndex(45532100),
|
||||
Opcode.MOVE_RESULT
|
||||
)
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
|
@ -27,7 +27,10 @@ object ConversionContextObfuscationPatch : BytecodePatch(
|
||||
ObfuscationConfigFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex =
|
||||
getTargetIndexOrThrow(getWideLiteralInstructionIndex(45631264), Opcode.MOVE_RESULT)
|
||||
getTargetIndexOrThrow(
|
||||
getWideLiteralInstructionIndex(45631264),
|
||||
Opcode.MOVE_RESULT
|
||||
)
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
|
@ -28,7 +28,10 @@ object ShortsPlaybackPatch : BytecodePatch(
|
||||
ShortsPlaybackFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex =
|
||||
getTargetIndexOrThrow(getWideLiteralInstructionIndex(45387052), Opcode.MOVE_RESULT)
|
||||
getTargetIndexOrThrow(
|
||||
getWideLiteralInstructionIndex(45387052),
|
||||
Opcode.MOVE_RESULT
|
||||
)
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
|
@ -128,7 +128,8 @@ object PlayerTypeHookPatch : BytecodePatch(
|
||||
// Insert before the first ViewGroup method call after inflating,
|
||||
// so this works regardless which layout is used.
|
||||
ActionBarSearchResultsFingerprint.resultOrThrow().mutableMethod.apply {
|
||||
val instructionIndex = getTargetIndexWithMethodReferenceNameOrThrow("setLayoutDirection")
|
||||
val instructionIndex =
|
||||
getTargetIndexWithMethodReferenceNameOrThrow("setLayoutDirection")
|
||||
val viewRegister = getInstruction<FiveRegisterInstruction>(instructionIndex).registerC
|
||||
|
||||
addInstruction(
|
||||
|
@ -36,8 +36,10 @@ object ReturnYouTubeDislikeShortsPatch : BytecodePatch(
|
||||
it.mutableMethod.apply {
|
||||
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
|
||||
val isDisLikesBooleanIndex = getTargetIndexReversedOrThrow(startIndex, Opcode.IGET_BOOLEAN)
|
||||
val textViewFieldIndex = getTargetIndexReversedOrThrow(startIndex, Opcode.IGET_OBJECT)
|
||||
val isDisLikesBooleanIndex =
|
||||
getTargetIndexReversedOrThrow(startIndex, Opcode.IGET_BOOLEAN)
|
||||
val textViewFieldIndex =
|
||||
getTargetIndexReversedOrThrow(startIndex, Opcode.IGET_OBJECT)
|
||||
|
||||
// If the field is true, the TextView is for a dislike button.
|
||||
val isDisLikesBooleanReference =
|
||||
|
@ -146,7 +146,8 @@ object SponsorBlockBytecodePatch : BytecodePatch(
|
||||
// Replace strings
|
||||
RectangleFieldInvalidatorFingerprint.resultOrThrow().let { result ->
|
||||
result.mutableMethod.apply {
|
||||
val invalidateIndex = getTargetIndexWithMethodReferenceNameReversedOrThrow("invalidate")
|
||||
val invalidateIndex =
|
||||
getTargetIndexWithMethodReferenceNameReversedOrThrow("invalidate")
|
||||
val rectangleIndex = getTargetIndexWithFieldReferenceTypeReversedOrThrow(
|
||||
invalidateIndex + 1,
|
||||
"Landroid/graphics/Rect;"
|
||||
|
@ -8,6 +8,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.storyboard.fingerprints.PlayerResponseModelGeneralStoryboardRendererFingerprint
|
||||
import app.revanced.patches.youtube.utils.storyboard.fingerprints.PlayerResponseModelLiveStreamStoryboardRendererFingerprint
|
||||
import app.revanced.patches.youtube.utils.storyboard.fingerprints.PlayerResponseModelStoryboardRecommendedLevelFingerprint
|
||||
@ -16,7 +17,6 @@ import app.revanced.patches.youtube.utils.storyboard.fingerprints.StoryboardRend
|
||||
import app.revanced.patches.youtube.utils.storyboard.fingerprints.StoryboardRendererSpecFingerprint
|
||||
import app.revanced.patches.youtube.utils.storyboard.fingerprints.StoryboardThumbnailFingerprint
|
||||
import app.revanced.patches.youtube.utils.storyboard.fingerprints.StoryboardThumbnailParentFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.util.resultOrThrow
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
|
@ -281,7 +281,10 @@ object VideoInformationPatch : BytecodePatch(
|
||||
val speedSelectionValueInstructionIndex = getTargetIndexOrThrow(Opcode.IGET)
|
||||
|
||||
val setPlaybackSpeedContainerClassFieldIndex =
|
||||
getTargetIndexReversedOrThrow(speedSelectionValueInstructionIndex, Opcode.IGET_OBJECT)
|
||||
getTargetIndexReversedOrThrow(
|
||||
speedSelectionValueInstructionIndex,
|
||||
Opcode.IGET_OBJECT
|
||||
)
|
||||
val setPlaybackSpeedContainerClassFieldReference =
|
||||
getInstruction<ReferenceInstruction>(setPlaybackSpeedContainerClassFieldIndex).reference.toString()
|
||||
|
||||
|
@ -111,7 +111,7 @@ object VideoPlaybackPatch : BaseBytecodePatch(
|
||||
val stringIndex = getStringInstructionIndex("av1_profile_main_10_hdr_10_plus_supported")
|
||||
val walkerIndex = indexOfFirstInstructionOrThrow(stringIndex) {
|
||||
val reference = getReference<MethodReference>()
|
||||
reference?.parameterTypes == listOf("I", "Landroid/view/Display;")
|
||||
reference?.parameterTypes == listOf("I", "Landroid/view/Display;")
|
||||
&& reference.returnType == "Z"
|
||||
}
|
||||
|
||||
|
@ -22,9 +22,9 @@ object PlayerResponseMethodHookPatch :
|
||||
|
||||
// Registers used to pass the parameters to integrations.
|
||||
private var playerResponseMethodCopyRegisters = false
|
||||
private lateinit var REGISTER_VIDEO_ID : String
|
||||
private lateinit var REGISTER_PLAYER_PARAMETER : String
|
||||
private lateinit var REGISTER_IS_SHORT_AND_OPENING_OR_PLAYING : String
|
||||
private lateinit var REGISTER_VIDEO_ID: String
|
||||
private lateinit var REGISTER_PLAYER_PARAMETER: String
|
||||
private lateinit var REGISTER_IS_SHORT_AND_OPENING_OR_PLAYING: String
|
||||
|
||||
private lateinit var playerResponseMethod: MutableMethod
|
||||
private var numberOfInstructionsAdded = 0
|
||||
@ -86,7 +86,8 @@ object PlayerResponseMethodHookPatch :
|
||||
if (playerResponseMethodCopyRegisters) {
|
||||
playerResponseMethod.apply {
|
||||
addInstructions(
|
||||
0, """
|
||||
0,
|
||||
"""
|
||||
move-object/from16 $REGISTER_VIDEO_ID, p$PARAMETER_VIDEO_ID
|
||||
move-object/from16 $REGISTER_PLAYER_PARAMETER, p$PARAMETER_PLAYER_PARAMETER
|
||||
move/from16 $REGISTER_IS_SHORT_AND_OPENING_OR_PLAYING, p$PARAMETER_IS_SHORT_AND_OPENING_OR_PLAYING
|
||||
|
Reference in New Issue
Block a user