mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-04-30 06:34:37 +02:00
chore: Lint code
This commit is contained in:
parent
b32301fd85
commit
512b2526ba
@ -49,6 +49,7 @@ val changeVersionCodePatch = resourcePatch(
|
||||
"Invalid versionCode: $versionCodeString, " +
|
||||
"Version code should be larger than 1 and smaller than $MAX_VALUE."
|
||||
)
|
||||
|
||||
val versionCodeString = versionCodeOption.valueOrThrow()
|
||||
val versionCode: Int
|
||||
|
||||
|
@ -116,7 +116,8 @@ val actionBarComponentsPatch = bytecodePatch(
|
||||
.endsWith("Lcom/google/android/libraries/youtube/common/ui/YouTubeButton;-><init>(Landroid/content/Context;)V")
|
||||
} - 2
|
||||
val replaceInstruction = getInstruction<TwoRegisterInstruction>(replaceIndex)
|
||||
val replaceReference = getInstruction<ReferenceInstruction>(replaceIndex).reference
|
||||
val replaceReference =
|
||||
getInstruction<ReferenceInstruction>(replaceIndex).reference
|
||||
|
||||
addInstructionsWithLabels(
|
||||
replaceIndex + 1, """
|
||||
@ -140,7 +141,8 @@ val actionBarComponentsPatch = bytecodePatch(
|
||||
}
|
||||
val spannedRegister =
|
||||
getInstruction<FiveRegisterInstruction>(spannedIndex).registerC
|
||||
val spannedReference = getInstruction<ReferenceInstruction>(spannedIndex).reference
|
||||
val spannedReference =
|
||||
getInstruction<ReferenceInstruction>(spannedIndex).reference
|
||||
|
||||
addInstructionsWithLabels(
|
||||
spannedIndex + 1, """
|
||||
|
@ -12,7 +12,9 @@ internal val dislikeButtonOnClickListenerFingerprint = legacyFingerprint(
|
||||
parameters = listOf("Landroid/view/View;"),
|
||||
customFingerprint = { method, _ ->
|
||||
method.name == "onClick" &&
|
||||
(method.containsLiteralInstruction(53465L) || method.containsLiteralInstruction(98173L))
|
||||
(method.containsLiteralInstruction(53465L) || method.containsLiteralInstruction(
|
||||
98173L
|
||||
))
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -252,8 +252,14 @@ val customBrandingIconPatch = resourcePatch(
|
||||
}
|
||||
|
||||
mapOf(
|
||||
ADAPTIVE_ICON_BACKGROUND_FILE_NAME to getAdaptiveIconResourceFile("res/mipmap-anydpi/ic_launcher_release.xml", "background"),
|
||||
ADAPTIVE_ICON_FOREGROUND_FILE_NAME to getAdaptiveIconResourceFile("res/mipmap-anydpi/ic_launcher_release.xml", "foreground")
|
||||
ADAPTIVE_ICON_BACKGROUND_FILE_NAME to getAdaptiveIconResourceFile(
|
||||
"res/mipmap-anydpi/ic_launcher_release.xml",
|
||||
"background"
|
||||
),
|
||||
ADAPTIVE_ICON_FOREGROUND_FILE_NAME to getAdaptiveIconResourceFile(
|
||||
"res/mipmap-anydpi/ic_launcher_release.xml",
|
||||
"foreground"
|
||||
)
|
||||
).forEach { (oldIconResourceFile, newIconResourceFile) ->
|
||||
if (oldIconResourceFile != newIconResourceFile) {
|
||||
mipmapDirectories.forEach {
|
||||
|
@ -40,7 +40,8 @@ val DrcAudioPatch = bytecodePatch(
|
||||
fingerprint.matchOrThrow(formatStreamModelConstructorFingerprint).let {
|
||||
it.method.apply {
|
||||
val insertIndex = it.patternMatch!!.endIndex
|
||||
val insertRegister = getInstruction<TwoRegisterInstruction>(insertIndex - 1).registerA
|
||||
val insertRegister =
|
||||
getInstruction<TwoRegisterInstruction>(insertIndex - 1).registerA
|
||||
|
||||
addInstructions(
|
||||
insertIndex,
|
||||
|
@ -823,7 +823,7 @@ val playerComponentsPatch = bytecodePatch(
|
||||
// region patch for remember repeat state
|
||||
|
||||
val (repeatTrackMethod, repeatTrackIndex) = repeatTrackFingerprint.matchOrThrow().let {
|
||||
with (it.method) {
|
||||
with(it.method) {
|
||||
val targetIndex = it.patternMatch!!.endIndex
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
|
@ -80,7 +80,8 @@ val spoofClientPatch = bytecodePatch(
|
||||
val clientInfoVersionIndex = result.stringMatches!!.first().index
|
||||
val clientInfoVersionRegister =
|
||||
getInstruction<OneRegisterInstruction>(clientInfoVersionIndex).registerA
|
||||
val clientInfoClientVersionFieldIndex = indexOfFirstInstructionOrThrow(clientInfoVersionIndex) {
|
||||
val clientInfoClientVersionFieldIndex =
|
||||
indexOfFirstInstructionOrThrow(clientInfoVersionIndex) {
|
||||
opcode == Opcode.IPUT_OBJECT &&
|
||||
(this as TwoRegisterInstruction).registerA == clientInfoVersionRegister
|
||||
}
|
||||
@ -95,9 +96,11 @@ val spoofClientPatch = bytecodePatch(
|
||||
}
|
||||
}
|
||||
|
||||
val clientInfoClientModelField = with (createPlayerRequestBodyWithModelFingerprint.methodOrThrow()) {
|
||||
val clientInfoClientModelField =
|
||||
with(createPlayerRequestBodyWithModelFingerprint.methodOrThrow()) {
|
||||
// The next IPUT_OBJECT instruction after getting the client model is setting the client model field.
|
||||
val clientInfoClientModelIndex = indexOfFirstInstructionOrThrow(indexOfModelInstruction(this)) {
|
||||
val clientInfoClientModelIndex =
|
||||
indexOfFirstInstructionOrThrow(indexOfModelInstruction(this)) {
|
||||
val reference = getReference<FieldReference>()
|
||||
opcode == Opcode.IPUT_OBJECT &&
|
||||
reference?.definingClass == CLIENT_INFO_CLASS_DESCRIPTOR &&
|
||||
@ -106,7 +109,8 @@ val spoofClientPatch = bytecodePatch(
|
||||
getInstruction<ReferenceInstruction>(clientInfoClientModelIndex).reference
|
||||
}
|
||||
|
||||
val clientInfoOsVersionField = with (createPlayerRequestBodyWithVersionReleaseFingerprint.methodOrThrow()) {
|
||||
val clientInfoOsVersionField =
|
||||
with(createPlayerRequestBodyWithVersionReleaseFingerprint.methodOrThrow()) {
|
||||
val buildIndex = indexOfBuildInstruction(this)
|
||||
val clientInfoOsVersionIndex = indexOfFirstInstructionOrThrow(buildIndex - 5) {
|
||||
val reference = getReference<FieldReference>()
|
||||
@ -229,7 +233,8 @@ val spoofClientPatch = bytecodePatch(
|
||||
reference?.returnType == "V" &&
|
||||
reference.parameterTypes.firstOrNull()?.startsWith("[L") == true
|
||||
}
|
||||
val createPlaybackSpeedMenuItemMethod = getWalkerMethod(createPlaybackSpeedMenuItemIndex)
|
||||
val createPlaybackSpeedMenuItemMethod =
|
||||
getWalkerMethod(createPlaybackSpeedMenuItemIndex)
|
||||
createPlaybackSpeedMenuItemMethod.apply {
|
||||
val shouldCreateMenuIndex = indexOfFirstInstructionOrThrow {
|
||||
val reference = getReference<MethodReference>()
|
||||
@ -237,7 +242,8 @@ val spoofClientPatch = bytecodePatch(
|
||||
reference?.returnType == "Z" &&
|
||||
reference.parameterTypes.isEmpty()
|
||||
} + 2
|
||||
val shouldCreateMenuRegister = getInstruction<OneRegisterInstruction>(shouldCreateMenuIndex - 1).registerA
|
||||
val shouldCreateMenuRegister =
|
||||
getInstruction<OneRegisterInstruction>(shouldCreateMenuIndex - 1).registerA
|
||||
|
||||
addInstructions(
|
||||
shouldCreateMenuIndex,
|
||||
|
@ -111,7 +111,8 @@ private val sponsorBlockBytecodePatch = bytecodePatch(
|
||||
rectangleFieldName =
|
||||
musicPlaybackControlsTimeBarOnMeasureFingerprint.matchOrThrow().let {
|
||||
with(it.method) {
|
||||
val rectangleIndex = indexOfFirstInstructionReversedOrThrow(it.patternMatch!!.endIndex) {
|
||||
val rectangleIndex =
|
||||
indexOfFirstInstructionReversedOrThrow(it.patternMatch!!.endIndex) {
|
||||
opcode == Opcode.IGET_OBJECT &&
|
||||
getReference<FieldReference>()?.type == "Landroid/graphics/Rect;"
|
||||
}
|
||||
|
@ -81,13 +81,15 @@ fun baseSpoofStreamingDataPatch(
|
||||
|
||||
// region Replace the streaming data.
|
||||
|
||||
createStreamingDataFingerprint.matchOrThrow(createStreamingDataParentFingerprint).let { result ->
|
||||
createStreamingDataFingerprint.matchOrThrow(createStreamingDataParentFingerprint)
|
||||
.let { result ->
|
||||
result.method.apply {
|
||||
val setStreamDataMethodName = "patch_setStreamingData"
|
||||
val resultMethodType = result.classDef.type
|
||||
val setStreamingDataIndex = result.patternMatch!!.startIndex
|
||||
val setStreamingDataField =
|
||||
getInstruction(setStreamingDataIndex).getReference<FieldReference>().toString()
|
||||
getInstruction(setStreamingDataIndex).getReference<FieldReference>()
|
||||
.toString()
|
||||
|
||||
val playerProtoClass =
|
||||
getInstruction(setStreamingDataIndex + 1).getReference<FieldReference>()!!.definingClass
|
||||
@ -101,7 +103,8 @@ fun baseSpoofStreamingDataPatch(
|
||||
?: throw PatchException("Could not find getStreamingDataField")
|
||||
|
||||
val videoDetailsIndex = result.patternMatch!!.endIndex
|
||||
val videoDetailsRegister = getInstruction<TwoRegisterInstruction>(videoDetailsIndex).registerA
|
||||
val videoDetailsRegister =
|
||||
getInstruction<TwoRegisterInstruction>(videoDetailsIndex).registerA
|
||||
val videoDetailsClass =
|
||||
getInstruction(videoDetailsIndex).getReference<FieldReference>()!!.type
|
||||
|
||||
@ -115,7 +118,13 @@ fun baseSpoofStreamingDataPatch(
|
||||
ImmutableMethod(
|
||||
resultMethodType,
|
||||
setStreamDataMethodName,
|
||||
listOf(ImmutableMethodParameter(videoDetailsClass, annotations, "videoDetails")),
|
||||
listOf(
|
||||
ImmutableMethodParameter(
|
||||
videoDetailsClass,
|
||||
annotations,
|
||||
"videoDetails"
|
||||
)
|
||||
),
|
||||
"V",
|
||||
AccessFlags.PRIVATE.value or AccessFlags.FINAL.value,
|
||||
annotations,
|
||||
@ -159,24 +168,32 @@ fun baseSpoofStreamingDataPatch(
|
||||
}
|
||||
}
|
||||
|
||||
videoStreamingDataConstructorFingerprint.methodOrThrow(videoStreamingDataToStringFingerprint).apply {
|
||||
videoStreamingDataConstructorFingerprint.methodOrThrow(videoStreamingDataToStringFingerprint)
|
||||
.apply {
|
||||
val formatStreamModelInitIndex = indexOfFormatStreamModelInitInstruction(this)
|
||||
val getVideoIdIndex = indexOfFirstInstructionReversedOrThrow(formatStreamModelInitIndex) {
|
||||
val getVideoIdIndex =
|
||||
indexOfFirstInstructionReversedOrThrow(formatStreamModelInitIndex) {
|
||||
val reference = getReference<FieldReference>()
|
||||
opcode == Opcode.IGET_OBJECT &&
|
||||
reference?.type == "Ljava/lang/String;" &&
|
||||
reference.definingClass == definingClass
|
||||
}
|
||||
val getVideoIdReference = getInstruction<ReferenceInstruction>(getVideoIdIndex).reference
|
||||
val getVideoIdReference =
|
||||
getInstruction<ReferenceInstruction>(getVideoIdIndex).reference
|
||||
val insertIndex = indexOfFirstInstructionReversedOrThrow(getVideoIdIndex) {
|
||||
opcode == Opcode.IGET_OBJECT &&
|
||||
getReference<FieldReference>()?.definingClass == STREAMING_DATA_INTERFACE
|
||||
}
|
||||
|
||||
val (freeRegister, streamingDataRegister) = with(getInstruction<TwoRegisterInstruction>(insertIndex)) {
|
||||
val (freeRegister, streamingDataRegister) = with(
|
||||
getInstruction<TwoRegisterInstruction>(
|
||||
insertIndex
|
||||
)
|
||||
) {
|
||||
Pair(registerA, registerB)
|
||||
}
|
||||
val definingClassRegister = getInstruction<TwoRegisterInstruction>(getVideoIdIndex).registerB
|
||||
val definingClassRegister =
|
||||
getInstruction<TwoRegisterInstruction>(getVideoIdIndex).registerB
|
||||
val insertReference = getInstruction<ReferenceInstruction>(insertIndex).reference
|
||||
|
||||
replaceInstruction(
|
||||
|
@ -45,6 +45,7 @@ internal val miniplayerModernCloseButtonFingerprint = legacyFingerprint(
|
||||
)
|
||||
|
||||
internal const val MINIPLAYER_MODERN_FEATURE_KEY = 45622882L
|
||||
|
||||
// In later targets this feature flag does nothing and is dead code.
|
||||
internal const val MINIPLAYER_MODERN_FEATURE_LEGACY_KEY = 45630429L
|
||||
internal const val MINIPLAYER_DOUBLE_TAP_FEATURE_KEY = 45628823L
|
||||
|
@ -173,8 +173,10 @@ val navigationBarComponentsPatch = bytecodePatch(
|
||||
* It was not too hard to fix, so it was implemented as a patch.
|
||||
*/
|
||||
if (is_19_28_or_greater) {
|
||||
val cairoNotificationEnumReference = with (imageEnumConstructorFingerprint.methodOrThrow()) {
|
||||
val stringIndex = indexOfFirstStringInstructionOrThrow(TAB_ACTIVITY_CAIRO_STRING)
|
||||
val cairoNotificationEnumReference =
|
||||
with(imageEnumConstructorFingerprint.methodOrThrow()) {
|
||||
val stringIndex =
|
||||
indexOfFirstStringInstructionOrThrow(TAB_ACTIVITY_CAIRO_STRING)
|
||||
val cairoNotificationEnumIndex = indexOfFirstInstructionOrThrow(stringIndex) {
|
||||
opcode == Opcode.SPUT_OBJECT
|
||||
}
|
||||
@ -189,7 +191,9 @@ val navigationBarComponentsPatch = bytecodePatch(
|
||||
reference.name == "put" &&
|
||||
reference.parameterTypes.firstOrNull() == "Ljava/lang/Enum;"
|
||||
}
|
||||
val (enumMapRegister, enumRegister) = getInstruction<FiveRegisterInstruction>(enumMapIndex).let {
|
||||
val (enumMapRegister, enumRegister) = getInstruction<FiveRegisterInstruction>(
|
||||
enumMapIndex
|
||||
).let {
|
||||
Pair(it.registerC, it.registerD)
|
||||
}
|
||||
|
||||
|
@ -209,8 +209,14 @@ val customBrandingIconPatch = resourcePatch(
|
||||
}
|
||||
|
||||
mapOf(
|
||||
ADAPTIVE_ICON_BACKGROUND_FILE_NAME to getAdaptiveIconResourceFile("res/mipmap-anydpi/ic_launcher.xml", "background"),
|
||||
ADAPTIVE_ICON_FOREGROUND_FILE_NAME to getAdaptiveIconResourceFile("res/mipmap-anydpi/ic_launcher.xml", "foreground")
|
||||
ADAPTIVE_ICON_BACKGROUND_FILE_NAME to getAdaptiveIconResourceFile(
|
||||
"res/mipmap-anydpi/ic_launcher.xml",
|
||||
"background"
|
||||
),
|
||||
ADAPTIVE_ICON_FOREGROUND_FILE_NAME to getAdaptiveIconResourceFile(
|
||||
"res/mipmap-anydpi/ic_launcher.xml",
|
||||
"foreground"
|
||||
)
|
||||
).forEach { (oldIconResourceFile, newIconResourceFile) ->
|
||||
if (oldIconResourceFile != newIconResourceFile) {
|
||||
mipmapDirectories.forEach {
|
||||
|
@ -73,6 +73,7 @@ private fun create9BitSeekbarColorStyles(): String = StringBuilder().apply {
|
||||
|
||||
fun roundTo3BitHex(channel8Bits: Int) =
|
||||
(channel8Bits * 255 / 7).toString(16).padStart(2, '0')
|
||||
|
||||
val r = roundTo3BitHex(red)
|
||||
val g = roundTo3BitHex(green)
|
||||
val b = roundTo3BitHex(blue)
|
||||
@ -261,8 +262,10 @@ val seekbarComponentsPatch = bytecodePatch(
|
||||
onCreateMethod
|
||||
).forEach { method ->
|
||||
method.apply {
|
||||
val literalIndex = indexOfFirstLiteralInstructionOrThrow(launchScreenLayoutTypeLotteFeatureFlag)
|
||||
val resultIndex = indexOfFirstInstructionOrThrow(literalIndex, Opcode.MOVE_RESULT)
|
||||
val literalIndex =
|
||||
indexOfFirstLiteralInstructionOrThrow(launchScreenLayoutTypeLotteFeatureFlag)
|
||||
val resultIndex =
|
||||
indexOfFirstInstructionOrThrow(literalIndex, Opcode.MOVE_RESULT)
|
||||
val register = getInstruction<OneRegisterInstruction>(resultIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
@ -282,8 +285,10 @@ val seekbarComponentsPatch = bytecodePatch(
|
||||
reference?.definingClass == "Landroid/widget/ImageView;" &&
|
||||
reference.name == "getDrawable"
|
||||
}
|
||||
val checkCastIndex = indexOfFirstInstructionOrThrow(drawableIndex, Opcode.CHECK_CAST)
|
||||
val drawableRegister = getInstruction<OneRegisterInstruction>(checkCastIndex).registerA
|
||||
val checkCastIndex =
|
||||
indexOfFirstInstructionOrThrow(drawableIndex, Opcode.CHECK_CAST)
|
||||
val drawableRegister =
|
||||
getInstruction<OneRegisterInstruction>(checkCastIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
checkCastIndex + 1,
|
||||
@ -319,7 +324,10 @@ val seekbarComponentsPatch = bytecodePatch(
|
||||
// instead of allowing 24 bit color the style is restricted to 9-bit (3 bits per color channel)
|
||||
// and the style color closest to the users custom color is used for the splash screen.
|
||||
arrayOf(
|
||||
inputStreamFromBundledResource("youtube/seekbar/values", "attrs.xml")!! to "res/values/attrs.xml",
|
||||
inputStreamFromBundledResource(
|
||||
"youtube/seekbar/values",
|
||||
"attrs.xml"
|
||||
)!! to "res/values/attrs.xml",
|
||||
ByteArrayInputStream(create9BitSeekbarColorStyles().toByteArray()) to "res/values/styles.xml"
|
||||
).forEach { (source, destination) ->
|
||||
"resources".copyXmlNode(
|
||||
@ -328,7 +336,10 @@ val seekbarComponentsPatch = bytecodePatch(
|
||||
).close()
|
||||
}
|
||||
|
||||
fun setSplashDrawablePathFillColor(xmlFileNames: Iterable<String>, vararg resourceNames: String) {
|
||||
fun setSplashDrawablePathFillColor(
|
||||
xmlFileNames: Iterable<String>,
|
||||
vararg resourceNames: String
|
||||
) {
|
||||
xmlFileNames.forEach { xmlFileName ->
|
||||
context.document(xmlFileName).use { document ->
|
||||
resourceNames.forEach { elementId ->
|
||||
@ -342,7 +353,10 @@ val seekbarComponentsPatch = bytecodePatch(
|
||||
throw PatchException("Could not find $attribute for $elementId")
|
||||
}
|
||||
|
||||
element.setAttribute(attribute, "?attr/$splashSeekbarColorAttributeName")
|
||||
element.setAttribute(
|
||||
attribute,
|
||||
"?attr/$splashSeekbarColorAttributeName"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -217,7 +217,8 @@ private val shortsCustomActionsPatch = bytecodePatch(
|
||||
opcode == Opcode.INVOKE_VIRTUAL &&
|
||||
getReference<MethodReference>()?.returnType == "Ljava/lang/Object;"
|
||||
}
|
||||
val getObjectReference = getInstruction<ReferenceInstruction>(getObjectIndex).reference as MethodReference
|
||||
val getObjectReference =
|
||||
getInstruction<ReferenceInstruction>(getObjectIndex).reference as MethodReference
|
||||
|
||||
val bottomSheetMenuInitializeIndex = indexOfFirstInstructionOrThrow {
|
||||
val reference = getReference<MethodReference>()
|
||||
@ -225,17 +226,22 @@ private val shortsCustomActionsPatch = bytecodePatch(
|
||||
reference?.returnType == "V" &&
|
||||
reference.parameterTypes[1] == "Ljava/lang/Object;"
|
||||
}
|
||||
val bottomSheetMenuObjectRegister = getInstruction<RegisterRangeInstruction>(bottomSheetMenuInitializeIndex).startRegister
|
||||
val bottomSheetMenuObject = (getInstruction<ReferenceInstruction>(bottomSheetMenuInitializeIndex).reference as MethodReference).parameterTypes[0]!!
|
||||
val bottomSheetMenuObjectRegister =
|
||||
getInstruction<RegisterRangeInstruction>(bottomSheetMenuInitializeIndex).startRegister
|
||||
val bottomSheetMenuObject =
|
||||
(getInstruction<ReferenceInstruction>(bottomSheetMenuInitializeIndex).reference as MethodReference).parameterTypes[0]!!
|
||||
|
||||
val bottomSheetMenuListIndex = it.patternMatch!!.startIndex
|
||||
val bottomSheetMenuListField = (getInstruction<ReferenceInstruction>(bottomSheetMenuListIndex).reference as FieldReference)
|
||||
val bottomSheetMenuListField =
|
||||
(getInstruction<ReferenceInstruction>(bottomSheetMenuListIndex).reference as FieldReference)
|
||||
|
||||
val bottomSheetMenuClass = bottomSheetMenuListField.definingClass
|
||||
val bottomSheetMenuList = bottomSheetMenuListField.type
|
||||
|
||||
val bottomSheetMenuClassRegister = getInstruction<TwoRegisterInstruction>(bottomSheetMenuListIndex).registerB
|
||||
val bottomSheetMenuListRegister = getInstruction<TwoRegisterInstruction>(bottomSheetMenuListIndex).registerA
|
||||
val bottomSheetMenuClassRegister =
|
||||
getInstruction<TwoRegisterInstruction>(bottomSheetMenuListIndex).registerB
|
||||
val bottomSheetMenuListRegister =
|
||||
getInstruction<TwoRegisterInstruction>(bottomSheetMenuListIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
bottomSheetMenuListIndex + 1,
|
||||
@ -249,7 +255,8 @@ private val shortsCustomActionsPatch = bytecodePatch(
|
||||
"$EXTENSION_CUSTOM_ACTIONS_CLASS_DESCRIPTOR->setFlyoutMenuObject(Ljava/lang/Object;)V"
|
||||
)
|
||||
|
||||
val addFlyoutMenuMethod = findMethodOrThrow(EXTENSION_CUSTOM_ACTIONS_CLASS_DESCRIPTOR) {
|
||||
val addFlyoutMenuMethod =
|
||||
findMethodOrThrow(EXTENSION_CUSTOM_ACTIONS_CLASS_DESCRIPTOR) {
|
||||
name == "addFlyoutMenu" &&
|
||||
accessFlags == AccessFlags.PRIVATE or AccessFlags.STATIC
|
||||
}
|
||||
@ -277,7 +284,8 @@ private val shortsCustomActionsPatch = bytecodePatch(
|
||||
val bottomSheetMenuItemBuilderMethod = bottomSheetMenuItemBuilderFingerprint
|
||||
.methodOrThrow()
|
||||
|
||||
val newParameter = bottomSheetMenuItemBuilderMethod.parameters + listOf(customActionClass)
|
||||
val newParameter =
|
||||
bottomSheetMenuItemBuilderMethod.parameters + listOf(customActionClass)
|
||||
|
||||
it.classDef.methods.add(
|
||||
bottomSheetMenuItemBuilderMethod
|
||||
@ -291,7 +299,8 @@ private val shortsCustomActionsPatch = bytecodePatch(
|
||||
opcode == Opcode.INVOKE_DIRECT &&
|
||||
getReference<MethodReference>()?.returnType == "Landroid/graphics/drawable/Drawable;"
|
||||
}
|
||||
val drawableRegister = getInstruction<OneRegisterInstruction>(drawableIndex + 1).registerA
|
||||
val drawableRegister =
|
||||
getInstruction<OneRegisterInstruction>(drawableIndex + 1).registerA
|
||||
|
||||
addInstructions(
|
||||
drawableIndex + 2, """
|
||||
@ -301,11 +310,14 @@ private val shortsCustomActionsPatch = bytecodePatch(
|
||||
)
|
||||
|
||||
val charSequenceIndex = indexOfSpannedCharSequenceInstruction(this)
|
||||
val charSequenceRegister = getInstruction<OneRegisterInstruction>(charSequenceIndex + 1).registerA
|
||||
val charSequenceRegister =
|
||||
getInstruction<OneRegisterInstruction>(charSequenceIndex + 1).registerA
|
||||
|
||||
val insertIndex = charSequenceIndex + 2
|
||||
|
||||
if (getInstruction<ReferenceInstruction>(insertIndex).reference.toString().startsWith("Lapp/revanced")) {
|
||||
if (getInstruction<ReferenceInstruction>(insertIndex).reference.toString()
|
||||
.startsWith("Lapp/revanced")
|
||||
) {
|
||||
removeInstructions(insertIndex, 2)
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,8 @@ val playerTypeHookPatch = bytecodePatch(
|
||||
|
||||
searchQueryClassFingerprint.methodOrThrow().apply {
|
||||
val searchQueryIndex = indexOfStringIsEmptyInstruction(this) - 1
|
||||
val searchQueryFieldReference = getInstruction<ReferenceInstruction>(searchQueryIndex).reference
|
||||
val searchQueryFieldReference =
|
||||
getInstruction<ReferenceInstruction>(searchQueryIndex).reference
|
||||
val searchQueryClass = (searchQueryFieldReference as FieldReference).definingClass
|
||||
|
||||
findMethodOrThrow(searchQueryClass).apply {
|
||||
|
@ -187,7 +187,10 @@ val videoInformationPatch = bytecodePatch(
|
||||
}
|
||||
}
|
||||
|
||||
fun Pair<String, Fingerprint>.getPlayerResponseInstruction(returnType: String, fromString: Boolean? = null): String {
|
||||
fun Pair<String, Fingerprint>.getPlayerResponseInstruction(
|
||||
returnType: String,
|
||||
fromString: Boolean? = null
|
||||
): String {
|
||||
methodOrThrow().apply {
|
||||
val startIndex = if (fromString == true)
|
||||
matchOrThrow().stringMatches!!.first().index
|
||||
|
Loading…
x
Reference in New Issue
Block a user