feat(youtube): add support version v18.27.35

This commit is contained in:
inotia00
2023-07-23 01:56:13 +09:00
parent a2b163eed1
commit db82839a9c
5 changed files with 34 additions and 13 deletions

View File

@ -32,7 +32,8 @@ Example:
"18.22.37", "18.22.37",
"18.23.36", "18.23.36",
"18.24.37", "18.24.37",
"18.25.40" "18.25.40",
"18.27.35"
] ]
} }
] ]

View File

@ -24,6 +24,7 @@ import app.revanced.patches.youtube.utils.quickactions.patch.QuickActionsHookPat
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.FullScreenEngagementPanel import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.FullScreenEngagementPanel
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.getNarrowLiteralIndex
import app.revanced.util.bytecode.getStringIndex import app.revanced.util.bytecode.getStringIndex
import app.revanced.util.bytecode.getWideLiteralIndex import app.revanced.util.bytecode.getWideLiteralIndex
import app.revanced.util.integrations.Constants.FULLSCREEN import app.revanced.util.integrations.Constants.FULLSCREEN
@ -84,7 +85,7 @@ class HideFullscreenPanelsPatch : BytecodePatch(
LayoutConstructorFingerprint.result?.let { LayoutConstructorFingerprint.result?.let {
it.mutableMethod.apply { it.mutableMethod.apply {
val dummyRegister = val dummyRegister =
getInstruction<OneRegisterInstruction>(getStringIndex("1.0x")).registerA getInstruction<OneRegisterInstruction>(getNarrowLiteralIndex(159962)).registerA
val invokeIndex = implementation!!.instructions.indexOfFirst { instruction -> val invokeIndex = implementation!!.instructions.indexOfFirst { instruction ->
instruction.opcode == Opcode.INVOKE_VIRTUAL && instruction.opcode == Opcode.INVOKE_VIRTUAL &&

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 org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
object EmptyFlatBufferFingerprint : 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 convert Element to Flatbuffers: %s")
)

View File

@ -14,8 +14,8 @@ 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.smali.ExternalLabel import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.fingerprints.litho.EmptyComponentBuilderFingerprint
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.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
import app.revanced.util.bytecode.getStringIndex import app.revanced.util.bytecode.getStringIndex
@ -33,7 +33,7 @@ import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
class MixPlaylistsPatch : BytecodePatch( class MixPlaylistsPatch : BytecodePatch(
listOf( listOf(
BottomPanelOverlayTextFingerprint, BottomPanelOverlayTextFingerprint,
EmptyComponentBuilderFingerprint EmptyFlatBufferFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
@ -58,22 +58,22 @@ 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
*/ */
EmptyComponentBuilderFingerprint.result?.let { EmptyFlatBufferFingerprint.result?.let {
it.mutableMethod.apply { it.mutableMethod.apply {
val freeIndex = implementation!!.instructions.indexOfFirst { instruction -> val insertIndex = implementation!!.instructions.indexOfFirst { instruction ->
instruction.opcode == Opcode.CONST_4 instruction.opcode == Opcode.CHECK_CAST
} } + 1
val jumpIndex = getStringIndex("Failed to convert Element to Flatbuffers: %s") + 2 val jumpIndex = getStringIndex("Failed to convert Element to Flatbuffers: %s") + 2
val insertIndex = freeIndex + 5
val freeRegister = getInstruction<OneRegisterInstruction>(freeIndex).registerA + 1 val freeIndex = it.scanResult.patternScanResult!!.startIndex - 1
val freeRegister = getInstruction<TwoRegisterInstruction>(freeIndex).registerA
addInstructionsWithLabels( addInstructionsWithLabels(
insertIndex, """ insertIndex, """
invoke-static {v$freeRegister}, $GENERAL->hideMixPlaylists([B)Z invoke-static {v$freeRegister}, $GENERAL->hideMixPlaylists([B)Z
move-result v$freeRegister move-result v$freeRegister
if-nez v$freeRegister, :not_an_ad if-nez v$freeRegister, :not_an_ad
""", ExternalLabel("not_an_ad", getInstruction(jumpIndex)) """, ExternalLabel("not_an_ad", getInstruction(jumpIndex))
) )
addInstruction( addInstruction(
@ -81,7 +81,7 @@ class MixPlaylistsPatch : BytecodePatch(
"move-object/from16 v$freeRegister, p3" "move-object/from16 v$freeRegister, p3"
) )
} }
} ?: return EmptyComponentBuilderFingerprint.toErrorResult() } ?: return EmptyFlatBufferFingerprint.toErrorResult()
/** /**
* Add settings * Add settings

View File

@ -11,7 +11,8 @@ import app.revanced.patcher.annotation.Package
"18.22.37", "18.22.37",
"18.23.36", "18.23.36",
"18.24.37", "18.24.37",
"18.25.40" "18.25.40",
"18.27.35"
) )
)] )]
) )