fix(YouTube/Disable shorts on startup): patch does not work on YouTube v18.29.38

This commit is contained in:
inotia00 2024-03-20 01:33:26 +09:00
parent 096871e6af
commit dd6a63bb20
2 changed files with 4 additions and 8 deletions

View File

@ -12,6 +12,7 @@ import app.revanced.patches.youtube.shorts.startupshortsreset.fingerprints.UserW
import app.revanced.patches.youtube.utils.integrations.Constants.SHORTS import app.revanced.patches.youtube.utils.integrations.Constants.SHORTS
import app.revanced.patches.youtube.utils.settings.SettingsPatch import app.revanced.patches.youtube.utils.settings.SettingsPatch
import app.revanced.util.exception import app.revanced.util.exception
import app.revanced.util.getStringInstructionIndex
import app.revanced.util.getTargetIndexReversed import app.revanced.util.getTargetIndexReversed
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
@ -61,8 +62,9 @@ object DisableShortsOnStartupPatch : BytecodePatch(
UserWasInShortsFingerprint.result?.let { UserWasInShortsFingerprint.result?.let {
it.mutableMethod.apply { it.mutableMethod.apply {
val startIndex = it.scanResult.patternScanResult!!.startIndex val startIndex = getStringInstructionIndex("Failed to read user_was_in_shorts proto after successful warmup")
val targetIndex = getTargetIndexReversed(startIndex, Opcode.RETURN_VOID) + 1 val exceptionIndex = getTargetIndexReversed(startIndex, Opcode.RETURN_VOID) - 1
val targetIndex = getTargetIndexReversed(exceptionIndex, Opcode.RETURN_VOID) + 1
if (getInstruction(targetIndex).opcode != Opcode.IGET_OBJECT) if (getInstruction(targetIndex).opcode != Opcode.IGET_OBJECT)
throw PatchException("Failed to find insert index") throw PatchException("Failed to find insert index")

View File

@ -3,16 +3,10 @@ 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.MethodFingerprint import app.revanced.patcher.fingerprint.MethodFingerprint
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(
null,
Opcode.RETURN_VOID,
Opcode.MOVE_EXCEPTION
),
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")
) )