feat(youtube): add support version v18.30.37

This commit is contained in:
inotia00 2023-08-05 07:07:40 +09:00
parent 00a36941f3
commit d8a10fecf5
15 changed files with 241 additions and 69 deletions

View File

@ -34,7 +34,8 @@ Example:
"18.24.37", "18.24.37",
"18.25.40", "18.25.40",
"18.27.36", "18.27.36",
"18.29.38" "18.29.38",
"18.30.37"
] ]
} }
] ]

View File

@ -3,14 +3,9 @@ package app.revanced.patches.shared.fingerprints.litho
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
object EmptyComponentBuilderFingerprint : MethodFingerprint( object EmptyComponentBuilderFingerprint : MethodFingerprint(
returnType = "L", returnType = "L",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
opcodes = listOf( strings = listOf("Error while converting %s")
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT
),
strings = listOf("Failed to convert Element to Flatbuffers: %s")
) )

View File

@ -0,0 +1,17 @@
package app.revanced.patches.shared.fingerprints.litho
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
object PbToFbFingerprint : MethodFingerprint(
returnType = "L",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("[B"),
opcodes = listOf(
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT
),
strings = listOf("PbToFb failed: ")
)

View File

@ -0,0 +1,16 @@
package app.revanced.patches.shared.fingerprints.litho
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
object PbToFbLegacyFingerprint : MethodFingerprint(
returnType = "L",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
opcodes = listOf(
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT
),
strings = listOf("Failed to convert Element to Flatbuffers: %s")
)

View File

@ -9,6 +9,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
@ -16,6 +17,8 @@ import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.fingerprints.litho.ByteBufferHookFingerprint import app.revanced.patches.shared.fingerprints.litho.ByteBufferHookFingerprint
import app.revanced.patches.shared.fingerprints.litho.EmptyComponentBuilderFingerprint import app.revanced.patches.shared.fingerprints.litho.EmptyComponentBuilderFingerprint
import app.revanced.patches.shared.fingerprints.litho.IdentifierFingerprint import app.revanced.patches.shared.fingerprints.litho.IdentifierFingerprint
import app.revanced.patches.shared.fingerprints.litho.PbToFbFingerprint
import app.revanced.patches.shared.fingerprints.litho.PbToFbLegacyFingerprint
import app.revanced.util.bytecode.getStringIndex import app.revanced.util.bytecode.getStringIndex
import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
@ -31,22 +34,24 @@ class ComponentParserPatch : BytecodePatch(
listOf( listOf(
ByteBufferHookFingerprint, ByteBufferHookFingerprint,
EmptyComponentBuilderFingerprint, EmptyComponentBuilderFingerprint,
IdentifierFingerprint IdentifierFingerprint,
PbToFbFingerprint,
PbToFbLegacyFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
EmptyComponentBuilderFingerprint.result?.let { EmptyComponentBuilderFingerprint.result?.let {
it.mutableMethod.apply { it.mutableMethod.apply {
val byteBufferClassIndex = it.scanResult.patternScanResult!!.startIndex val targetStringIndex = getStringIndex("Error while converting %s")
byteBufferClassLabel =
getInstruction<ReferenceInstruction>(byteBufferClassIndex).reference.toString() for (index in targetStringIndex until implementation!!.instructions.size - 1) {
if (getInstruction(index).opcode != Opcode.INVOKE_STATIC_RANGE) continue
val targetIndex = getStringIndex("Failed to convert Element to Flatbuffers: %s") + 2
val builderMethodDescriptor = val builderMethodDescriptor =
getInstruction<ReferenceInstruction>(targetIndex).reference getInstruction<ReferenceInstruction>(index).reference
val emptyComponentFieldDescriptor = val emptyComponentFieldDescriptor =
getInstruction<ReferenceInstruction>(targetIndex + 2).reference getInstruction<ReferenceInstruction>(index + 2).reference
emptyComponentLabel = """ emptyComponentLabel = """
move-object/from16 v0, p1 move-object/from16 v0, p1
@ -55,21 +60,27 @@ class ComponentParserPatch : BytecodePatch(
iget-object v0, v0, $emptyComponentFieldDescriptor iget-object v0, v0, $emptyComponentFieldDescriptor
return-object v0 return-object v0
""" """
break
}
it.mutableClass.staticFields.add( if (emptyComponentLabel.isEmpty())
ImmutableField( throw PatchResultError("could not find Empty Component Label in method")
definingClass,
"buffer",
"Ljava/nio/ByteBuffer;",
AccessFlags.PUBLIC or AccessFlags.STATIC,
null,
annotations,
null
).toMutable()
)
} }
} ?: return EmptyComponentBuilderFingerprint.toErrorResult() } ?: return EmptyComponentBuilderFingerprint.toErrorResult()
val pbToFbResult = PbToFbFingerprint.result
?: PbToFbLegacyFingerprint.result
?: throw PbToFbLegacyFingerprint.toErrorResult()
pbToFbResult.let {
it.mutableMethod.apply {
val byteBufferClassIndex = it.scanResult.patternScanResult!!.startIndex
byteBufferClassLabel =
getInstruction<ReferenceInstruction>(byteBufferClassIndex).reference.toString()
}
}
ByteBufferHookFingerprint.result?.let { ByteBufferHookFingerprint.result?.let {
(context (context
.toMethodWalker(it.method) .toMethodWalker(it.method)
@ -108,9 +119,28 @@ class ComponentParserPatch : BytecodePatch(
identifierRegister = identifierRegister =
getInstruction<OneRegisterInstruction>(identifierIndex).registerA getInstruction<OneRegisterInstruction>(identifierIndex).registerA
objectRegister = getInstruction<BuilderInstruction35c>(objectIndex).registerC objectRegister = getInstruction<BuilderInstruction35c>(objectIndex).registerC
freeRegister = getInstruction<OneRegisterInstruction>(freeIndex).registerA
val register = getInstruction<OneRegisterInstruction>(freeIndex).registerA
freeRegister =
if (register == stringBuilderRegister || register == identifierRegister || register == objectRegister)
15
else
register
insertIndex = stringBuilderIndex + 1 insertIndex = stringBuilderIndex + 1
it.mutableClass.staticFields.add(
ImmutableField(
definingClass,
"buffer",
"Ljava/nio/ByteBuffer;",
AccessFlags.PUBLIC or AccessFlags.STATIC,
null,
annotations,
null
).toMutable()
)
} }
} ?: return IdentifierFingerprint.toErrorResult() } ?: return IdentifierFingerprint.toErrorResult()
@ -124,7 +154,8 @@ class ComponentParserPatch : BytecodePatch(
var insertIndex by Delegates.notNull<Int>() var insertIndex by Delegates.notNull<Int>()
var freeRegister by Delegates.notNull<Int>() var freeRegister = 15
var identifierRegister by Delegates.notNull<Int>() var identifierRegister by Delegates.notNull<Int>()
var objectRegister by Delegates.notNull<Int>() var objectRegister by Delegates.notNull<Int>()
var stringBuilderRegister by Delegates.notNull<Int>() var stringBuilderRegister by Delegates.notNull<Int>()

View File

@ -0,0 +1,18 @@
package app.revanced.patches.youtube.general.mixplaylists.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
object ElementParserFingerprint : MethodFingerprint(
returnType = "L",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
opcodes = listOf(
Opcode.INVOKE_VIRTUAL_RANGE,
Opcode.MOVE_RESULT_OBJECT,
Opcode.IGET_BOOLEAN,
Opcode.IF_EQZ
),
strings = listOf("Failed to parse Element")
)

View File

@ -13,8 +13,10 @@ import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.youtube.general.mixplaylists.fingerprints.BottomPanelOverlayTextFingerprint import app.revanced.patches.youtube.general.mixplaylists.fingerprints.BottomPanelOverlayTextFingerprint
import app.revanced.patches.youtube.general.mixplaylists.fingerprints.ElementParserFingerprint
import app.revanced.patches.youtube.general.mixplaylists.fingerprints.EmptyFlatBufferFingerprint import app.revanced.patches.youtube.general.mixplaylists.fingerprints.EmptyFlatBufferFingerprint
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
@ -32,6 +34,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
class MixPlaylistsPatch : BytecodePatch( class MixPlaylistsPatch : BytecodePatch(
listOf( listOf(
BottomPanelOverlayTextFingerprint, BottomPanelOverlayTextFingerprint,
ElementParserFingerprint,
EmptyFlatBufferFingerprint EmptyFlatBufferFingerprint
) )
) { ) {
@ -57,6 +60,14 @@ class MixPlaylistsPatch : BytecodePatch(
* Separated from bytebuffer patch * Separated from bytebuffer patch
* Target method is only used for Hide MixPlaylists patch * Target method is only used for Hide MixPlaylists patch
*/ */
ElementParserFingerprint.result
?: EmptyFlatBufferFingerprint.result
?: throw EmptyFlatBufferFingerprint.toErrorResult()
/**
* ~YouTube v18.29.38
*/
EmptyFlatBufferFingerprint.result?.let { EmptyFlatBufferFingerprint.result?.let {
it.mutableMethod.apply { it.mutableMethod.apply {
val insertIndex = implementation!!.instructions.indexOfFirst { instruction -> val insertIndex = implementation!!.instructions.indexOfFirst { instruction ->
@ -65,22 +76,34 @@ class MixPlaylistsPatch : BytecodePatch(
val jumpIndex = getStringIndex("Failed to convert Element to Flatbuffers: %s") + 2 val jumpIndex = getStringIndex("Failed to convert Element to Flatbuffers: %s") + 2
val freeIndex = it.scanResult.patternScanResult!!.startIndex - 1 val freeIndex = it.scanResult.patternScanResult!!.startIndex - 1
val freeRegister = getInstruction<TwoRegisterInstruction>(freeIndex).registerA
addInstructionsWithLabels( inject(freeIndex, insertIndex, jumpIndex)
insertIndex, """ }
invoke-static {v$freeRegister}, $GENERAL->hideMixPlaylists([B)Z }
move-result v$freeRegister
if-nez v$freeRegister, :not_an_ad /**
""", ExternalLabel("not_an_ad", getInstruction(jumpIndex)) * YouTube v18.30.xx~
) */
ElementParserFingerprint.result?.let {
addInstruction( it.mutableMethod.apply {
0, val methodInstructions = implementation!!.instructions
"move-object/from16 v$freeRegister, p3"
) val insertIndex = methodInstructions.indexOfFirst { instruction ->
instruction.opcode == Opcode.INVOKE_INTERFACE
}
val freeIndex = it.scanResult.patternScanResult!!.startIndex - 1
for (index in methodInstructions.size - 1 downTo 0) {
if (getInstruction(index).opcode != Opcode.INVOKE_INTERFACE_RANGE) continue
val jumpIndex = index + 1
inject(freeIndex, insertIndex, jumpIndex)
break
}
}
} }
} ?: return EmptyFlatBufferFingerprint.toErrorResult()
/** /**
* Add settings * Add settings
@ -96,4 +119,26 @@ class MixPlaylistsPatch : BytecodePatch(
return PatchResultSuccess() return PatchResultSuccess()
} }
private companion object {
fun MutableMethod.inject(
freeIndex: Int,
insertIndex: Int,
jumpIndex: Int
) {
val freeRegister = getInstruction<TwoRegisterInstruction>(freeIndex).registerA
addInstructionsWithLabels(
insertIndex, """
invoke-static {v$freeRegister}, $GENERAL->hideMixPlaylists([B)Z
move-result v$freeRegister
if-nez v$freeRegister, :not_an_ad
""", ExternalLabel("not_an_ad", getInstruction(jumpIndex))
)
addInstruction(
0,
"move-object/from16 v$freeRegister, p3"
)
}
}
} }

View File

@ -3,15 +3,9 @@ package app.revanced.patches.youtube.misc.externalbrowser.fingerprints
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
object ExternalBrowserSecondaryFingerprint : MethodFingerprint( object ExternalBrowserSecondaryFingerprint : MethodFingerprint(
returnType = "L", returnType = "L",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
opcodes = listOf(
Opcode.IPUT_OBJECT,
Opcode.NEW_INSTANCE,
Opcode.CONST_STRING
),
strings = listOf("android.support.customtabs.action.CustomTabsService") strings = listOf("android.support.customtabs.action.CustomTabsService")
) )

View File

@ -17,6 +17,7 @@ import app.revanced.patches.youtube.misc.externalbrowser.fingerprints.ExternalBr
import app.revanced.patches.youtube.misc.externalbrowser.fingerprints.ExternalBrowserTertiaryFingerprint import app.revanced.patches.youtube.misc.externalbrowser.fingerprints.ExternalBrowserTertiaryFingerprint
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.bytecode.getStringIndex
import app.revanced.util.integrations.Constants.MISC_PATH import app.revanced.util.integrations.Constants.MISC_PATH
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@ -42,11 +43,11 @@ class ExternalBrowserPatch : BytecodePatch(
).forEach { fingerprint -> ).forEach { fingerprint ->
fingerprint.result?.let { fingerprint.result?.let {
it.mutableMethod.apply { it.mutableMethod.apply {
val endIndex = it.scanResult.patternScanResult!!.endIndex val targetIndex = getStringIndex("android.support.customtabs.action.CustomTabsService")
val register = getInstruction<OneRegisterInstruction>(endIndex).registerA val register = getInstruction<OneRegisterInstruction>(targetIndex).registerA
addInstructions( addInstructions(
endIndex + 1, """ targetIndex + 1, """
invoke-static {v$register}, $MISC_PATH/ExternalBrowserPatch;->enableExternalBrowser(Ljava/lang/String;)Ljava/lang/String; invoke-static {v$register}, $MISC_PATH/ExternalBrowserPatch;->enableExternalBrowser(Ljava/lang/String;)Ljava/lang/String;
move-result-object v$register move-result-object v$register
""" """

View File

@ -79,7 +79,10 @@ class HideFilmstripOverlayPatch : BytecodePatch(
if (SettingsPatch.upward1828) { if (SettingsPatch.upward1828) {
for (index in insertIndex .. initialIndex) { for (index in insertIndex .. initialIndex) {
if (getInstruction(index).opcode != Opcode.CONST_16 && getInstruction(index).opcode != Opcode.CONST) continue if (getInstruction(index).opcode != Opcode.CONST_16 &&
getInstruction(index).opcode != Opcode.CONST_4 &&
getInstruction(index).opcode != Opcode.CONST)
continue
val register = getInstruction<OneRegisterInstruction>(index).registerA val register = getInstruction<OneRegisterInstruction>(index).registerA
val value = getInstruction<WideLiteralInstruction>(index).wideLiteral.toInt() val value = getInstruction<WideLiteralInstruction>(index).wideLiteral.toInt()
@ -89,6 +92,10 @@ class HideFilmstripOverlayPatch : BytecodePatch(
Opcode.CONST_16 -> """ Opcode.CONST_16 -> """
const/16 v$register, $value const/16 v$register, $value
""".trimIndent()
Opcode.CONST_4 -> """
const/4 v$register, $value
""".trimIndent() """.trimIndent()
Opcode.CONST -> """ Opcode.CONST -> """
const v$register, $value const v$register, $value

View File

@ -41,6 +41,9 @@ class ShortsSubscriptionsButtonPatch : BytecodePatch(
} }
} ?: return ShortsSubscriptionsFingerprint.toErrorResult() } ?: return ShortsSubscriptionsFingerprint.toErrorResult()
/**
* Deprecated in YouTube v18.31.xx+
*/
ShortsSubscriptionsTabletParentFingerprint.result?.let { parentResult -> ShortsSubscriptionsTabletParentFingerprint.result?.let { parentResult ->
parentResult.mutableMethod.apply { parentResult.mutableMethod.apply {
val targetIndex = getWideLiteralIndex(ReelPlayerFooter) - 1 val targetIndex = getWideLiteralIndex(ReelPlayerFooter) - 1

View File

@ -13,7 +13,8 @@ import app.revanced.patcher.annotation.Package
"18.24.37", "18.24.37",
"18.25.40", "18.25.40",
"18.27.36", "18.27.36",
"18.29.38" "18.29.38",
"18.30.37"
) )
)] )]
) )

View File

@ -12,6 +12,7 @@ object TextComponentAtomicReferenceFingerprint : MethodFingerprint(
opcodes = listOf( opcodes = listOf(
Opcode.INVOKE_VIRTUAL, Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT, Opcode.MOVE_RESULT_OBJECT,
Opcode.MOVE_OBJECT,
Opcode.CHECK_CAST, Opcode.CHECK_CAST,
Opcode.MOVE_OBJECT Opcode.MOVE_OBJECT
) )

View File

@ -0,0 +1,18 @@
package app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
object TextComponentAtomicReferenceLegacyFingerprint : MethodFingerprint(
returnType = "L",
accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL,
parameters = listOf("L"),
opcodes = listOf(
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST,
Opcode.MOVE_OBJECT
)
)

View File

@ -8,6 +8,7 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint 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.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
@ -20,6 +21,7 @@ import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerpri
import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints.LikeFingerprint import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints.LikeFingerprint
import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints.RemoveLikeFingerprint import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints.RemoveLikeFingerprint
import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints.TextComponentAtomicReferenceFingerprint import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints.TextComponentAtomicReferenceFingerprint
import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints.TextComponentAtomicReferenceLegacyFingerprint
import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints.TextComponentConstructorFingerprint import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints.TextComponentConstructorFingerprint
import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints.TextComponentContextFingerprint import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints.TextComponentContextFingerprint
import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints.TextComponentTmpFingerprint import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints.TextComponentTmpFingerprint
@ -101,12 +103,34 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
} ?: return TextComponentTmpFingerprint.toErrorResult() } ?: return TextComponentTmpFingerprint.toErrorResult()
val textComponentAtomicReferenceResult =
TextComponentAtomicReferenceFingerprint.also { TextComponentAtomicReferenceFingerprint.also {
it.resolve( it.resolve(context, parentResult.classDef)
context, }.result
parentResult.classDef ?:TextComponentAtomicReferenceLegacyFingerprint.also {
) it.resolve(context, parentResult.classDef)
}.result
?: return TextComponentAtomicReferenceLegacyFingerprint.toErrorResult()
TextComponentAtomicReferenceFingerprint.also {
it.resolve(context, parentResult.classDef)
}.result?.let { }.result?.let {
it.mutableMethod.apply {
val startIndex = it.scanResult.patternScanResult!!.startIndex
val originalRegisterA = getInstruction<TwoRegisterInstruction>(startIndex + 2).registerA
replaceInstruction(
startIndex + 2,
"move-object v$originalRegisterA, v$tmpRegister"
)
replaceInstruction(
startIndex + 1,
"move-result-object v$tmpRegister"
)
}
}
textComponentAtomicReferenceResult.let {
it.mutableMethod.apply { it.mutableMethod.apply {
val atomicReferenceStartIndex = it.scanResult.patternScanResult!!.startIndex val atomicReferenceStartIndex = it.scanResult.patternScanResult!!.startIndex
val insertIndex = it.scanResult.patternScanResult!!.endIndex val insertIndex = it.scanResult.patternScanResult!!.endIndex
@ -130,7 +154,7 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
) )
removeInstruction(insertIndex) removeInstruction(insertIndex)
} }
} ?: return TextComponentAtomicReferenceFingerprint.toErrorResult() }
} ?: return TextComponentConstructorFingerprint.toErrorResult() } ?: return TextComponentConstructorFingerprint.toErrorResult()