Skip to content

Commit

Permalink
Merge branch 'dev' into revanced-extended
Browse files Browse the repository at this point in the history
  • Loading branch information
inotia00 committed Nov 8, 2024
2 parents d8ae741 + 77153b9 commit 807494f
Show file tree
Hide file tree
Showing 37 changed files with 2,213 additions and 1,800 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
org.gradle.parallel = true
org.gradle.caching = true
kotlin.code.style = official
version = 4.15.1
version = 4.16.1
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.integrations.Constants.COMPONENTS_PATH
import app.revanced.patches.shared.litho.fingerprints.BufferUpbFeatureFlagFingerprint
import app.revanced.patches.shared.litho.fingerprints.ByteBufferFingerprint
import app.revanced.patches.shared.litho.fingerprints.EmptyComponentsFingerprint
import app.revanced.patches.shared.litho.fingerprints.PathBuilderFingerprint
import app.revanced.patches.shared.litho.fingerprints.PathUpbFeatureFlagFingerprint
import app.revanced.util.findMethodsOrThrow
import app.revanced.util.getReference
import app.revanced.util.indexOfFirstInstructionOrThrow
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
import app.revanced.util.indexOfFirstStringInstructionOrThrow
import app.revanced.util.injectLiteralInstructionBooleanCall
import app.revanced.util.resultOrThrow
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
Expand All @@ -38,6 +41,8 @@ object LithoFilterPatch : BytecodePatch(
setOf(
ByteBufferFingerprint,
EmptyComponentsFingerprint,
BufferUpbFeatureFlagFingerprint,
PathUpbFeatureFlagFingerprint,
)
), Closeable {
private const val INTEGRATIONS_LITHO_FILER_CLASS_DESCRIPTOR =
Expand Down Expand Up @@ -156,6 +161,28 @@ object LithoFilterPatch : BytecodePatch(
}
}

// region A/B test of new Litho native code.

// Turn off native code that handles litho component names. If this feature is on then nearly
// all litho components have a null name and identifier/path filtering is completely broken.

if (BufferUpbFeatureFlagFingerprint.result != null &&
PathUpbFeatureFlagFingerprint.result != null) {
mapOf(
BufferUpbFeatureFlagFingerprint to 45419603,
PathUpbFeatureFlagFingerprint to 45631264,
).forEach { (fingerprint, literalValue) ->
fingerprint.result?.let {
fingerprint.injectLiteralInstructionBooleanCall(
literalValue,
"0x0"
)
}
}
}

// endregion

// Create a new method to get the filter array to avoid register conflicts.
// This fixes an issue with Integrations compiled with Android Gradle Plugin 8.3.0+.
// https://github.com/ReVanced/revanced-patches/issues/2818
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package app.revanced.patches.shared.litho.fingerprints

import app.revanced.patcher.extensions.or
import app.revanced.util.fingerprint.LiteralValueFingerprint
import com.android.tools.smali.dexlib2.AccessFlags

internal object BufferUpbFeatureFlagFingerprint : LiteralValueFingerprint(
returnType = "L",
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
parameters = listOf("L"),
literalSupplier = { 45419603 },
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package app.revanced.patches.shared.litho.fingerprints

import app.revanced.patcher.extensions.or
import app.revanced.util.fingerprint.LiteralValueFingerprint
import com.android.tools.smali.dexlib2.AccessFlags

internal object PathUpbFeatureFlagFingerprint : LiteralValueFingerprint(
returnType = "Z",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = emptyList(),
literalSupplier = { 45631264 },
)
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ abstract class BaseMainActivityResolvePatch(
) {
lateinit var mainActivityMutableClass: MutableClass
lateinit var onConfigurationChangedMethod: MutableMethod
lateinit var onCreateMethod: MutableMethod

private lateinit var constructorMethod: MutableMethod
private lateinit var onBackPressedMethod: MutableMethod
private lateinit var onCreateMethod: MutableMethod

private var constructorMethodIndex by Delegates.notNull<Int>()
private var onBackPressedMethodIndex by Delegates.notNull<Int>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import app.revanced.patches.youtube.utils.fingerprints.ScrollTopParentFingerprin
import app.revanced.patches.youtube.utils.integrations.Constants.COMPONENTS_PATH
import app.revanced.patches.youtube.utils.integrations.Constants.FEED_CLASS_DESCRIPTOR
import app.revanced.patches.youtube.utils.integrations.Constants.FEED_PATH
import app.revanced.patches.youtube.utils.mainactivity.MainActivityResolvePatch
import app.revanced.patches.youtube.utils.navigation.NavigationBarHookPatch
import app.revanced.patches.youtube.utils.playertype.PlayerTypeHookPatch
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
Expand Down Expand Up @@ -62,6 +63,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
import com.android.tools.smali.dexlib2.iface.reference.StringReference
import com.android.tools.smali.dexlib2.util.MethodUtil

@Suppress("unused")
Expand All @@ -70,6 +72,7 @@ object FeedComponentsPatch : BaseBytecodePatch(
description = "Adds options to hide components related to feeds.",
dependencies = setOf(
LithoFilterPatch::class,
MainActivityResolvePatch::class,
NavigationBarHookPatch::class,
PlayerTypeHookPatch::class,
SettingsPatch::class,
Expand Down Expand Up @@ -175,6 +178,27 @@ object FeedComponentsPatch : BaseBytecodePatch(

// endregion

// region patch for hide floating button

MainActivityResolvePatch.onCreateMethod.apply {
val fabIndex = indexOfFirstInstructionOrThrow {
opcode == Opcode.CONST_STRING &&
getReference<StringReference>()?.string == "fab"
}
val fabRegister = getInstruction<OneRegisterInstruction>(fabIndex).registerA
val jumpIndex = indexOfFirstInstructionOrThrow(fabIndex + 1, Opcode.CONST_STRING)

addInstructionsWithLabels(
fabIndex, """
invoke-static {}, $FEED_CLASS_DESCRIPTOR->hideFloatingButton()Z
move-result v$fabRegister
if-nez v$fabRegister, :hide
""", ExternalLabel("hide", getInstruction(jumpIndex))
)
}

// endregion

// region patch for hide relative video

fun Method.indexOfEngagementPanelBuilderInstruction(targetMethod: MutableMethod) =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
package app.revanced.patches.youtube.general.spoofappversion

import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
import app.revanced.patches.youtube.utils.integrations.Constants.PATCH_STATUS_CLASS_DESCRIPTOR
import app.revanced.patches.youtube.utils.settings.SettingsBytecodePatch
import app.revanced.patches.youtube.utils.settings.SettingsPatch
import app.revanced.util.appendAppVersion
import app.revanced.util.findMethodOrThrow
import app.revanced.util.patch.BaseResourcePatch

@Suppress("unused")
Expand All @@ -17,7 +13,6 @@ object SpoofAppVersionPatch : BaseResourcePatch(
"This can be used to restore old UI elements and features.",
dependencies = setOf(
SettingsPatch::class,
SettingsBytecodePatch::class,
SpoofAppVersionBytecodePatch::class
),
compatiblePackages = COMPATIBLE_PACKAGE
Expand All @@ -30,18 +25,6 @@ object SpoofAppVersionPatch : BaseResourcePatch(
context.appendAppVersion("18.38.45")
if (SettingsPatch.upward1849) {
context.appendAppVersion("18.48.39")
if (SettingsPatch.upward1915) {
context.appendAppVersion("19.13.37")

SettingsBytecodePatch.contexts.findMethodOrThrow(
PATCH_STATUS_CLASS_DESCRIPTOR
) {
name == "SpoofAppVersionDefaultString"
}.replaceInstruction(
0,
"const-string v0, \"19.13.37\""
)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import app.revanced.patches.shared.drawable.DrawableColorPatch
import app.revanced.patches.youtube.player.seekbar.fingerprints.CairoSeekbarConfigFingerprint
import app.revanced.patches.youtube.player.seekbar.fingerprints.ControlsOverlayStyleFingerprint
import app.revanced.patches.youtube.player.seekbar.fingerprints.SeekbarTappingFingerprint
import app.revanced.patches.youtube.player.seekbar.fingerprints.SeekbarThumbnailsQualityFingerprint
import app.revanced.patches.youtube.player.seekbar.fingerprints.ShortsSeekbarColorFingerprint
import app.revanced.patches.youtube.player.seekbar.fingerprints.ThumbnailPreviewConfigFingerprint
import app.revanced.patches.youtube.player.seekbar.fingerprints.TimeCounterFingerprint
Expand All @@ -23,6 +24,7 @@ import app.revanced.patches.youtube.utils.fingerprints.SeekbarFingerprint
import app.revanced.patches.youtube.utils.fingerprints.SeekbarOnDrawFingerprint
import app.revanced.patches.youtube.utils.fingerprints.TotalTimeFingerprint
import app.revanced.patches.youtube.utils.flyoutmenu.FlyoutMenuHookPatch
import app.revanced.patches.youtube.utils.integrations.Constants.PATCH_STATUS_CLASS_DESCRIPTOR
import app.revanced.patches.youtube.utils.integrations.Constants.PLAYER_CLASS_DESCRIPTOR
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.InlineTimeBarColorizedBarPlayedColorDark
Expand All @@ -40,6 +42,7 @@ import app.revanced.util.indexOfFirstWideLiteralInstructionValueOrThrow
import app.revanced.util.injectLiteralInstructionBooleanCall
import app.revanced.util.patch.BaseBytecodePatch
import app.revanced.util.resultOrThrow
import app.revanced.util.updatePatchStatus
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.NarrowLiteralInstruction
Expand Down Expand Up @@ -68,6 +71,7 @@ object SeekbarComponentsPatch : BaseBytecodePatch(
PlayerSeekbarColorFingerprint,
SeekbarFingerprint,
SeekbarTappingFingerprint,
SeekbarThumbnailsQualityFingerprint,
ShortsSeekbarColorFingerprint,
TimelineMarkerArrayFingerprint,
ThumbnailPreviewConfigFingerprint,
Expand Down Expand Up @@ -212,6 +216,16 @@ object SeekbarComponentsPatch : BaseBytecodePatch(

// endregion

// region patch for high quality thumbnails

// TODO: This will be added when support for newer YouTube versions is added.
// SeekbarThumbnailsQualityFingerprint.injectLiteralInstructionBooleanCall(
// 45399684,
// "$PLAYER_CLASS_DESCRIPTOR->enableHighQualityFullscreenThumbnails()Z"
// )

// endregion

// region patch for hide chapter

TimelineMarkerArrayFingerprint.resultOrThrow().let {
Expand Down Expand Up @@ -299,6 +313,8 @@ object SeekbarComponentsPatch : BaseBytecodePatch(
)

settingArray += "SETTINGS: RESTORE_OLD_SEEKBAR_THUMBNAILS"

context.updatePatchStatus(PATCH_STATUS_CLASS_DESCRIPTOR, "OldSeekbarThumbnailsDefaultBoolean")
}
?: println("WARNING: Restore old seekbar thumbnails setting is not supported in this version. Use YouTube 19.16.39 or earlier.")

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package app.revanced.patches.youtube.player.seekbar.fingerprints

import app.revanced.util.fingerprint.LiteralValueFingerprint

internal object SeekbarThumbnailsQualityFingerprint : LiteralValueFingerprint(
returnType = "Z",
parameters = emptyList(),
literalSupplier = { 45399684 },
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package app.revanced.patches.youtube.utils.fix.bottomui
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.youtube.utils.fix.bottomui.fingerprints.ExploderControlsFingerprint
import app.revanced.patches.youtube.utils.fix.bottomui.fingerprints.FullscreenButtonPositionFingerprint
import app.revanced.patches.youtube.utils.fix.bottomui.fingerprints.FullscreenButtonViewStubFingerprint
import app.revanced.util.injectLiteralInstructionBooleanCall
Expand All @@ -12,6 +13,7 @@ import app.revanced.util.injectLiteralInstructionBooleanCall
)
object CfBottomUIPatch : BytecodePatch(
setOf(
ExploderControlsFingerprint,
FullscreenButtonPositionFingerprint,
FullscreenButtonViewStubFingerprint
)
Expand All @@ -23,6 +25,7 @@ object CfBottomUIPatch : BytecodePatch(
* Therefore, this patch only applies to versions that can resolve this fingerprint.
*/
mapOf(
ExploderControlsFingerprint to 45643739,
FullscreenButtonViewStubFingerprint to 45617294,
FullscreenButtonPositionFingerprint to 45627640
).forEach { (fingerprint, literalValue) ->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package app.revanced.patches.youtube.utils.fix.bottomui.fingerprints

import app.revanced.util.fingerprint.LiteralValueFingerprint

internal object ExploderControlsFingerprint : LiteralValueFingerprint(
returnType = "Z",
literalSupplier = { 45643739 },
)
4 changes: 4 additions & 0 deletions src/main/resources/music/translations/cs-rCZ/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
<resources>
<!-- Shared -->
<string name="revanced_extended_settings_title">ReVanced Extended</string>
<string name="revanced_extended_reset_to_default_toast">Obnovit na výchozí hodnoty.</string>
<!-- Shared Category -->
<string name="revanced_extended_restart_first_run"></string>
<string name="revanced_extended_restart_message">Obnovit a restartovat</string>
<!-- PreferenceScreen: Account -->
<string name="revanced_preference_screen_account_title"></string>
<string name="revanced_hide_account_menu_title">Skrýt nabídku účtu</string>
<string name="revanced_hide_account_menu_summary">Skryje prvky nabídky účtu pomocí vlastního filtru.</string>
<string name="revanced_hide_account_menu_filter_strings_title">Filtr nabídky účtu</string>
<!-- PreferenceScreen: Action Bar -->
<string name="revanced_external_downloader_package_name_title">Název balíčku pro externí stahování</string>
<string name="revanced_external_downloader_package_name_summary">Název balíčku externí nainstalované aplikace na stahování, jako jsou např. NewPipe nebo Seal</string>
Expand Down
Loading

0 comments on commit 807494f

Please sign in to comment.