fix(youtube/disable-startup-shorts-player): do not prevent playing videos on startup (#714)
This commit is contained in:
parent
c1ce12ed12
commit
5b904dc5d3
|
@ -9,11 +9,11 @@ import app.revanced.patches.youtube.layout.startupshortsreset.annotations.Startu
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
@Name("action-open-shorts-fingerprint")
|
@Name("user-was-in-shorts-fingerprint")
|
||||||
@MatchingMethod("Lkyt;", "l")
|
@MatchingMethod("Lkzb;", "e")
|
||||||
@StartupShortsResetCompatibility
|
@StartupShortsResetCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
object ActionOpenShortsFingerprint : MethodFingerprint(
|
object UserWasInShortsFingerprint : MethodFingerprint(
|
||||||
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L", "L"),
|
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L"),
|
||||||
strings = listOf("com.google.android.youtube.action.open.shorts"),
|
strings = listOf("Failed to read user_was_in_shorts proto after successful warmup"),
|
||||||
)
|
)
|
|
@ -11,14 +11,11 @@ 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.patch.impl.BytecodePatch
|
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||||
import app.revanced.patches.youtube.layout.startupshortsreset.annotations.StartupShortsResetCompatibility
|
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.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
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.StringResource
|
||||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
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
|
@Patch
|
||||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||||
|
@ -28,7 +25,7 @@ import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class DisableShortsOnStartupPatch : BytecodePatch(
|
class DisableShortsOnStartupPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
ActionOpenShortsFingerprint
|
UserWasInShortsFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(data: BytecodeData): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
|
@ -42,22 +39,14 @@ class DisableShortsOnStartupPatch : BytecodePatch(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
val actionOpenShortsResult = ActionOpenShortsFingerprint.result
|
val userWasInShortsMethod = UserWasInShortsFingerprint.result!!.mutableMethod
|
||||||
val actionOpenShortsMethod = actionOpenShortsResult!!.mutableMethod
|
|
||||||
val actionOpenShortsInstructions = actionOpenShortsMethod.implementation!!.instructions
|
|
||||||
|
|
||||||
val moveResultIndex = actionOpenShortsResult.scanResult.stringsScanResult!!.matches.first().index + 4
|
userWasInShortsMethod.addInstructions(
|
||||||
val iPutBooleanIndex = moveResultIndex + 2
|
0, """
|
||||||
|
|
||||||
val moveResultRegister = (actionOpenShortsInstructions[moveResultIndex] as OneRegisterInstruction).registerA
|
|
||||||
val iPutBooleanRegister = (actionOpenShortsInstructions[iPutBooleanIndex] as TwoRegisterInstruction).registerA
|
|
||||||
|
|
||||||
actionOpenShortsMethod.addInstructions(
|
|
||||||
moveResultIndex + 1, """
|
|
||||||
invoke-static { }, Lapp/revanced/integrations/patches/DisableStartupShortsPlayerPatch;->disableStartupShortsPlayer()Z
|
invoke-static { }, Lapp/revanced/integrations/patches/DisableStartupShortsPlayerPatch;->disableStartupShortsPlayer()Z
|
||||||
move-result v$moveResultRegister
|
move-result v0
|
||||||
if-eqz v$moveResultRegister, :cond_startup_shorts_reset
|
if-eqz v0, :cond_startup_shorts_reset
|
||||||
const/4 v$iPutBooleanRegister, 0x0
|
return-void
|
||||||
:cond_startup_shorts_reset
|
:cond_startup_shorts_reset
|
||||||
nop
|
nop
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue