mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 21:27:43 +02:00
fix(youtube/disable-shorts-on-startup): not working on YouTube v18.31.40
This commit is contained in:
@ -2,19 +2,13 @@ package app.revanced.patches.youtube.shorts.startupshortsreset.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
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.Opcode
|
||||
|
||||
object UserWasInShortsFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
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"),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45381394) }
|
||||
)
|
@ -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.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.bytecode.getWide32LiteralIndex
|
||||
import app.revanced.util.integrations.Constants.SHORTS
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@ -28,17 +29,18 @@ class DisableShortsOnStartupPatch : BytecodePatch(
|
||||
|
||||
UserWasInShortsFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val register = getInstruction<OneRegisterInstruction>(targetIndex).registerA + 2
|
||||
val insertIndex = getWide32LiteralIndex(45381394)
|
||||
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
addInstructionsWithLabels(
|
||||
targetIndex + 1,
|
||||
insertIndex,
|
||||
"""
|
||||
invoke-static { }, $SHORTS->disableStartupShortsPlayer()Z
|
||||
move-result v$register
|
||||
if-eqz v$register, :show_startup_shorts_player
|
||||
move-result v$insertRegister
|
||||
if-eqz v$insertRegister, :show_startup_shorts_player
|
||||
return-void
|
||||
""",
|
||||
ExternalLabel("show_startup_shorts_player", getInstruction(targetIndex + 1))
|
||||
ExternalLabel("show_startup_shorts_player", getInstruction(insertIndex))
|
||||
)
|
||||
}
|
||||
} ?: throw UserWasInShortsFingerprint.exception
|
||||
|
Reference in New Issue
Block a user