mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-02 23:54:33 +02:00
fix(YouTube/Settings): CairoSettings
is applied due to A/B testing https://github.com/inotia00/ReVanced_Extended/issues/2099
This commit is contained in:
parent
fb1fd09fac
commit
e565fed07e
@ -0,0 +1,46 @@
|
||||
package app.revanced.patches.youtube.utils.fix.cairo
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.misc.minimizedplayback.MinimizedPlaybackPatch
|
||||
import app.revanced.patches.youtube.utils.fix.cairo.fingerprints.CarioFragmentConfigFingerprint
|
||||
import app.revanced.util.getTargetIndex
|
||||
import app.revanced.util.getWideLiteralInstructionIndex
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
description = "Fixes issues where Cairo Fragment is applied."
|
||||
)
|
||||
object CairoSettingsPatch : BytecodePatch(
|
||||
setOf(CarioFragmentConfigFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
/**
|
||||
* Cairo Fragment was added since YouTube v19.04.38.
|
||||
* Disable this for the following reasons:
|
||||
* 1. [MinimizedPlaybackPatch] does not activate the Minimized playback setting of Cairo Fragment.
|
||||
* 2. Some patches implemented in RVX do not yet support Cairo Fragments.
|
||||
*
|
||||
* See <a href="https://github.com/inotia00/ReVanced_Extended/issues/2099">ReVanced_Extended#2099</a>
|
||||
* or <a href="https://github.com/qnblackcat/uYouPlus/issues/1468">uYouPlus#1468</a>
|
||||
* for screenshots of the Cairo Fragment.
|
||||
*/
|
||||
CarioFragmentConfigFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = getTargetIndex(getWideLiteralInstructionIndex(45532100), Opcode.MOVE_RESULT)
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
targetIndex + 1,
|
||||
"const/4 v$targetRegister, 0x0"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package app.revanced.patches.youtube.utils.fix.cairo.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
/**
|
||||
* Added in YouTube v19.04.38
|
||||
*
|
||||
* When this value is TRUE, Cairo Fragment is used.
|
||||
* In this case, some of patches may be broken, so set this value to FALSE.
|
||||
*/
|
||||
internal object CarioFragmentConfigFingerprint : LiteralValueFingerprint(
|
||||
returnType = "Z",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
literalSupplier = { 45532100 }
|
||||
)
|
@ -4,6 +4,7 @@ import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patches.shared.elements.StringsElementsUtils.removeStringsElements
|
||||
import app.revanced.patches.shared.mapping.ResourceMappingPatch
|
||||
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
|
||||
import app.revanced.patches.youtube.utils.fix.cairo.CairoSettingsPatch
|
||||
import app.revanced.patches.youtube.utils.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.settings.ResourceUtils.addPreference
|
||||
@ -30,7 +31,8 @@ object SettingsPatch : BaseResourcePatch(
|
||||
IntegrationsPatch::class,
|
||||
ResourceMappingPatch::class,
|
||||
SharedResourceIdPatch::class,
|
||||
SettingsBytecodePatch::class
|
||||
SettingsBytecodePatch::class,
|
||||
CairoSettingsPatch::class
|
||||
),
|
||||
compatiblePackages = COMPATIBLE_PACKAGE,
|
||||
requiresIntegrations = true
|
||||
@ -46,7 +48,6 @@ object SettingsPatch : BaseResourcePatch(
|
||||
internal var upward1842 = false
|
||||
internal var upward1849 = false
|
||||
internal var upward1902 = false
|
||||
internal var upward1909 = false
|
||||
internal var upward1912 = false
|
||||
|
||||
override fun execute(context: ResourceContext) {
|
||||
@ -81,7 +82,6 @@ object SettingsPatch : BaseResourcePatch(
|
||||
upward1842 = 234302000 <= playServicesVersion
|
||||
upward1849 = 235000000 <= playServicesVersion
|
||||
upward1902 = 240204000 < playServicesVersion
|
||||
upward1909 = 241002000 <= playServicesVersion
|
||||
upward1912 = 241302000 <= playServicesVersion
|
||||
|
||||
break
|
||||
|
Loading…
x
Reference in New Issue
Block a user