fix(youtube/disable-shorts-on-startup): not working on YouTube v18.31.40

This commit is contained in:
inotia00
2023-09-17 23:41:07 +09:00
parent e7f98cc170
commit 84e0376299
2 changed files with 10 additions and 14 deletions

View File

@ -2,19 +2,13 @@ package app.revanced.patches.youtube.shorts.startupshortsreset.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 app.revanced.util.bytecode.isWide32LiteralExists
import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
object UserWasInShortsFingerprint : MethodFingerprint( object UserWasInShortsFingerprint : MethodFingerprint(
returnType = "V", returnType = "V",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("Ljava/lang/Object;"), parameters = listOf("Ljava/lang/Object;"),
opcodes = listOf(
Opcode.CHECK_CAST,
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT
),
strings = listOf("Failed to read user_was_in_shorts proto after successful warmup"), strings = listOf("Failed to read user_was_in_shorts proto after successful warmup"),
customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45381394) }
) )

View File

@ -13,6 +13,7 @@ import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.youtube.shorts.startupshortsreset.fingerprints.UserWasInShortsFingerprint import app.revanced.patches.youtube.shorts.startupshortsreset.fingerprints.UserWasInShortsFingerprint
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.getWide32LiteralIndex
import app.revanced.util.integrations.Constants.SHORTS import app.revanced.util.integrations.Constants.SHORTS
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@ -28,17 +29,18 @@ class DisableShortsOnStartupPatch : BytecodePatch(
UserWasInShortsFingerprint.result?.let { UserWasInShortsFingerprint.result?.let {
it.mutableMethod.apply { it.mutableMethod.apply {
val targetIndex = it.scanResult.patternScanResult!!.endIndex val insertIndex = getWide32LiteralIndex(45381394)
val register = getInstruction<OneRegisterInstruction>(targetIndex).registerA + 2 val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
addInstructionsWithLabels( addInstructionsWithLabels(
targetIndex + 1, insertIndex,
""" """
invoke-static { }, $SHORTS->disableStartupShortsPlayer()Z invoke-static { }, $SHORTS->disableStartupShortsPlayer()Z
move-result v$register move-result v$insertRegister
if-eqz v$register, :show_startup_shorts_player if-eqz v$insertRegister, :show_startup_shorts_player
return-void return-void
""", """,
ExternalLabel("show_startup_shorts_player", getInstruction(targetIndex + 1)) ExternalLabel("show_startup_shorts_player", getInstruction(insertIndex))
) )
} }
} ?: throw UserWasInShortsFingerprint.exception } ?: throw UserWasInShortsFingerprint.exception