diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/startupshortsreset/DisableShortsOnStartupPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/startupshortsreset/DisableShortsOnStartupPatch.kt index 503f70b07..0b517936f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/startupshortsreset/DisableShortsOnStartupPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/startupshortsreset/DisableShortsOnStartupPatch.kt @@ -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.settings.SettingsPatch import app.revanced.util.exception +import app.revanced.util.getStringInstructionIndex import app.revanced.util.getTargetIndexReversed import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction @@ -61,8 +62,9 @@ object DisableShortsOnStartupPatch : BytecodePatch( UserWasInShortsFingerprint.result?.let { it.mutableMethod.apply { - val startIndex = it.scanResult.patternScanResult!!.startIndex - val targetIndex = getTargetIndexReversed(startIndex, Opcode.RETURN_VOID) + 1 + val startIndex = getStringInstructionIndex("Failed to read user_was_in_shorts proto after successful warmup") + val exceptionIndex = getTargetIndexReversed(startIndex, Opcode.RETURN_VOID) - 1 + val targetIndex = getTargetIndexReversed(exceptionIndex, Opcode.RETURN_VOID) + 1 if (getInstruction(targetIndex).opcode != Opcode.IGET_OBJECT) throw PatchException("Failed to find insert index") diff --git a/src/main/kotlin/app/revanced/patches/youtube/shorts/startupshortsreset/fingerprints/UserWasInShortsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/shorts/startupshortsreset/fingerprints/UserWasInShortsFingerprint.kt index ccc8f7cb8..97bda4213 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/shorts/startupshortsreset/fingerprints/UserWasInShortsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/shorts/startupshortsreset/fingerprints/UserWasInShortsFingerprint.kt @@ -3,16 +3,10 @@ package app.revanced.patches.youtube.shorts.startupshortsreset.fingerprints import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.MethodFingerprint import com.android.tools.smali.dexlib2.AccessFlags -import com.android.tools.smali.dexlib2.Opcode object UserWasInShortsFingerprint : MethodFingerprint( returnType = "V", accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, 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") ) \ No newline at end of file