diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/fingerprints/ActionOpenShortsFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/fingerprints/UserWasInShortsFingerprint.kt similarity index 67% rename from src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/fingerprints/ActionOpenShortsFingerprint.kt rename to src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/fingerprints/UserWasInShortsFingerprint.kt index 47ff887d1..cae3effac 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/fingerprints/ActionOpenShortsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/fingerprints/UserWasInShortsFingerprint.kt @@ -9,11 +9,11 @@ import app.revanced.patches.youtube.layout.startupshortsreset.annotations.Startu import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.Opcode -@Name("action-open-shorts-fingerprint") -@MatchingMethod("Lkyt;", "l") +@Name("user-was-in-shorts-fingerprint") +@MatchingMethod("Lkzb;", "e") @StartupShortsResetCompatibility @Version("0.0.1") -object ActionOpenShortsFingerprint : MethodFingerprint( - "V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L", "L"), - strings = listOf("com.google.android.youtube.action.open.shorts"), +object UserWasInShortsFingerprint : MethodFingerprint( + "V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L"), + strings = listOf("Failed to read user_was_in_shorts proto after successful warmup"), ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/patch/DisableShortsOnStartupPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/patch/DisableShortsOnStartupPatch.kt index 79149133c..87469390a 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/patch/DisableShortsOnStartupPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/patch/DisableShortsOnStartupPatch.kt @@ -11,14 +11,11 @@ import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.impl.BytecodePatch import app.revanced.patches.youtube.layout.startupshortsreset.annotations.StartupShortsResetCompatibility -import app.revanced.patches.youtube.layout.startupshortsreset.fingerprints.ActionOpenShortsFingerprint +import app.revanced.patches.youtube.layout.startupshortsreset.fingerprints.UserWasInShortsFingerprint import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference -import org.jf.dexlib2.builder.instruction.BuilderInstruction21c -import org.jf.dexlib2.iface.instruction.OneRegisterInstruction -import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction @Patch @DependsOn([IntegrationsPatch::class, SettingsPatch::class]) @@ -28,7 +25,7 @@ import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction @Version("0.0.1") class DisableShortsOnStartupPatch : BytecodePatch( listOf( - ActionOpenShortsFingerprint + UserWasInShortsFingerprint ) ) { override fun execute(data: BytecodeData): PatchResult { @@ -42,22 +39,14 @@ class DisableShortsOnStartupPatch : BytecodePatch( ) ) - val actionOpenShortsResult = ActionOpenShortsFingerprint.result - val actionOpenShortsMethod = actionOpenShortsResult!!.mutableMethod - val actionOpenShortsInstructions = actionOpenShortsMethod.implementation!!.instructions + val userWasInShortsMethod = UserWasInShortsFingerprint.result!!.mutableMethod - val moveResultIndex = actionOpenShortsResult.scanResult.stringsScanResult!!.matches.first().index + 4 - val iPutBooleanIndex = moveResultIndex + 2 - - val moveResultRegister = (actionOpenShortsInstructions[moveResultIndex] as OneRegisterInstruction).registerA - val iPutBooleanRegister = (actionOpenShortsInstructions[iPutBooleanIndex] as TwoRegisterInstruction).registerA - - actionOpenShortsMethod.addInstructions( - moveResultIndex + 1, """ + userWasInShortsMethod.addInstructions( + 0, """ invoke-static { }, Lapp/revanced/integrations/patches/DisableStartupShortsPlayerPatch;->disableStartupShortsPlayer()Z - move-result v$moveResultRegister - if-eqz v$moveResultRegister, :cond_startup_shorts_reset - const/4 v$iPutBooleanRegister, 0x0 + move-result v0 + if-eqz v0, :cond_startup_shorts_reset + return-void :cond_startup_shorts_reset nop """