Skip to content

Commit 807494f

Browse files
committed
Merge branch 'dev' into revanced-extended
2 parents d8ae741 + 77153b9 commit 807494f

File tree

37 files changed

+2213
-1800
lines changed

37 files changed

+2213
-1800
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
org.gradle.parallel = true
22
org.gradle.caching = true
33
kotlin.code.style = official
4-
version = 4.15.1
4+
version = 4.16.1

src/main/kotlin/app/revanced/patches/shared/litho/LithoFilterPatch.kt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
1111
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
1212
import app.revanced.patcher.util.smali.ExternalLabel
1313
import app.revanced.patches.shared.integrations.Constants.COMPONENTS_PATH
14+
import app.revanced.patches.shared.litho.fingerprints.BufferUpbFeatureFlagFingerprint
1415
import app.revanced.patches.shared.litho.fingerprints.ByteBufferFingerprint
1516
import app.revanced.patches.shared.litho.fingerprints.EmptyComponentsFingerprint
1617
import app.revanced.patches.shared.litho.fingerprints.PathBuilderFingerprint
18+
import app.revanced.patches.shared.litho.fingerprints.PathUpbFeatureFlagFingerprint
1719
import app.revanced.util.findMethodsOrThrow
1820
import app.revanced.util.getReference
1921
import app.revanced.util.indexOfFirstInstructionOrThrow
2022
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
2123
import app.revanced.util.indexOfFirstStringInstructionOrThrow
24+
import app.revanced.util.injectLiteralInstructionBooleanCall
2225
import app.revanced.util.resultOrThrow
2326
import com.android.tools.smali.dexlib2.AccessFlags
2427
import com.android.tools.smali.dexlib2.Opcode
@@ -38,6 +41,8 @@ object LithoFilterPatch : BytecodePatch(
3841
setOf(
3942
ByteBufferFingerprint,
4043
EmptyComponentsFingerprint,
44+
BufferUpbFeatureFlagFingerprint,
45+
PathUpbFeatureFlagFingerprint,
4146
)
4247
), Closeable {
4348
private const val INTEGRATIONS_LITHO_FILER_CLASS_DESCRIPTOR =
@@ -156,6 +161,28 @@ object LithoFilterPatch : BytecodePatch(
156161
}
157162
}
158163

164+
// region A/B test of new Litho native code.
165+
166+
// Turn off native code that handles litho component names. If this feature is on then nearly
167+
// all litho components have a null name and identifier/path filtering is completely broken.
168+
169+
if (BufferUpbFeatureFlagFingerprint.result != null &&
170+
PathUpbFeatureFlagFingerprint.result != null) {
171+
mapOf(
172+
BufferUpbFeatureFlagFingerprint to 45419603,
173+
PathUpbFeatureFlagFingerprint to 45631264,
174+
).forEach { (fingerprint, literalValue) ->
175+
fingerprint.result?.let {
176+
fingerprint.injectLiteralInstructionBooleanCall(
177+
literalValue,
178+
"0x0"
179+
)
180+
}
181+
}
182+
}
183+
184+
// endregion
185+
159186
// Create a new method to get the filter array to avoid register conflicts.
160187
// This fixes an issue with Integrations compiled with Android Gradle Plugin 8.3.0+.
161188
// https://github.com/ReVanced/revanced-patches/issues/2818
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package app.revanced.patches.shared.litho.fingerprints
2+
3+
import app.revanced.patcher.extensions.or
4+
import app.revanced.util.fingerprint.LiteralValueFingerprint
5+
import com.android.tools.smali.dexlib2.AccessFlags
6+
7+
internal object BufferUpbFeatureFlagFingerprint : LiteralValueFingerprint(
8+
returnType = "L",
9+
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
10+
parameters = listOf("L"),
11+
literalSupplier = { 45419603 },
12+
)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package app.revanced.patches.shared.litho.fingerprints
2+
3+
import app.revanced.patcher.extensions.or
4+
import app.revanced.util.fingerprint.LiteralValueFingerprint
5+
import com.android.tools.smali.dexlib2.AccessFlags
6+
7+
internal object PathUpbFeatureFlagFingerprint : LiteralValueFingerprint(
8+
returnType = "Z",
9+
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
10+
parameters = emptyList(),
11+
literalSupplier = { 45631264 },
12+
)

src/main/kotlin/app/revanced/patches/shared/mainactivity/BaseMainActivityResolvePatch.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ abstract class BaseMainActivityResolvePatch(
1919
) {
2020
lateinit var mainActivityMutableClass: MutableClass
2121
lateinit var onConfigurationChangedMethod: MutableMethod
22+
lateinit var onCreateMethod: MutableMethod
2223

2324
private lateinit var constructorMethod: MutableMethod
2425
private lateinit var onBackPressedMethod: MutableMethod
25-
private lateinit var onCreateMethod: MutableMethod
2626

2727
private var constructorMethodIndex by Delegates.notNull<Int>()
2828
private var onBackPressedMethodIndex by Delegates.notNull<Int>()

src/main/kotlin/app/revanced/patches/youtube/feed/components/FeedComponentsPatch.kt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import app.revanced.patches.youtube.utils.fingerprints.ScrollTopParentFingerprin
3535
import app.revanced.patches.youtube.utils.integrations.Constants.COMPONENTS_PATH
3636
import app.revanced.patches.youtube.utils.integrations.Constants.FEED_CLASS_DESCRIPTOR
3737
import app.revanced.patches.youtube.utils.integrations.Constants.FEED_PATH
38+
import app.revanced.patches.youtube.utils.mainactivity.MainActivityResolvePatch
3839
import app.revanced.patches.youtube.utils.navigation.NavigationBarHookPatch
3940
import app.revanced.patches.youtube.utils.playertype.PlayerTypeHookPatch
4041
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
@@ -62,6 +63,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
6263
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
6364
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
6465
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
66+
import com.android.tools.smali.dexlib2.iface.reference.StringReference
6567
import com.android.tools.smali.dexlib2.util.MethodUtil
6668

6769
@Suppress("unused")
@@ -70,6 +72,7 @@ object FeedComponentsPatch : BaseBytecodePatch(
7072
description = "Adds options to hide components related to feeds.",
7173
dependencies = setOf(
7274
LithoFilterPatch::class,
75+
MainActivityResolvePatch::class,
7376
NavigationBarHookPatch::class,
7477
PlayerTypeHookPatch::class,
7578
SettingsPatch::class,
@@ -175,6 +178,27 @@ object FeedComponentsPatch : BaseBytecodePatch(
175178

176179
// endregion
177180

181+
// region patch for hide floating button
182+
183+
MainActivityResolvePatch.onCreateMethod.apply {
184+
val fabIndex = indexOfFirstInstructionOrThrow {
185+
opcode == Opcode.CONST_STRING &&
186+
getReference<StringReference>()?.string == "fab"
187+
}
188+
val fabRegister = getInstruction<OneRegisterInstruction>(fabIndex).registerA
189+
val jumpIndex = indexOfFirstInstructionOrThrow(fabIndex + 1, Opcode.CONST_STRING)
190+
191+
addInstructionsWithLabels(
192+
fabIndex, """
193+
invoke-static {}, $FEED_CLASS_DESCRIPTOR->hideFloatingButton()Z
194+
move-result v$fabRegister
195+
if-nez v$fabRegister, :hide
196+
""", ExternalLabel("hide", getInstruction(jumpIndex))
197+
)
198+
}
199+
200+
// endregion
201+
178202
// region patch for hide relative video
179203

180204
fun Method.indexOfEngagementPanelBuilderInstruction(targetMethod: MutableMethod) =

src/main/kotlin/app/revanced/patches/youtube/general/spoofappversion/SpoofAppVersionPatch.kt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
package app.revanced.patches.youtube.general.spoofappversion
22

33
import app.revanced.patcher.data.ResourceContext
4-
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
54
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
6-
import app.revanced.patches.youtube.utils.integrations.Constants.PATCH_STATUS_CLASS_DESCRIPTOR
7-
import app.revanced.patches.youtube.utils.settings.SettingsBytecodePatch
85
import app.revanced.patches.youtube.utils.settings.SettingsPatch
96
import app.revanced.util.appendAppVersion
10-
import app.revanced.util.findMethodOrThrow
117
import app.revanced.util.patch.BaseResourcePatch
128

139
@Suppress("unused")
@@ -17,7 +13,6 @@ object SpoofAppVersionPatch : BaseResourcePatch(
1713
"This can be used to restore old UI elements and features.",
1814
dependencies = setOf(
1915
SettingsPatch::class,
20-
SettingsBytecodePatch::class,
2116
SpoofAppVersionBytecodePatch::class
2217
),
2318
compatiblePackages = COMPATIBLE_PACKAGE
@@ -30,18 +25,6 @@ object SpoofAppVersionPatch : BaseResourcePatch(
3025
context.appendAppVersion("18.38.45")
3126
if (SettingsPatch.upward1849) {
3227
context.appendAppVersion("18.48.39")
33-
if (SettingsPatch.upward1915) {
34-
context.appendAppVersion("19.13.37")
35-
36-
SettingsBytecodePatch.contexts.findMethodOrThrow(
37-
PATCH_STATUS_CLASS_DESCRIPTOR
38-
) {
39-
name == "SpoofAppVersionDefaultString"
40-
}.replaceInstruction(
41-
0,
42-
"const-string v0, \"19.13.37\""
43-
)
44-
}
4528
}
4629
}
4730
}

src/main/kotlin/app/revanced/patches/youtube/player/seekbar/SeekbarComponentsPatch.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import app.revanced.patches.shared.drawable.DrawableColorPatch
1111
import app.revanced.patches.youtube.player.seekbar.fingerprints.CairoSeekbarConfigFingerprint
1212
import app.revanced.patches.youtube.player.seekbar.fingerprints.ControlsOverlayStyleFingerprint
1313
import app.revanced.patches.youtube.player.seekbar.fingerprints.SeekbarTappingFingerprint
14+
import app.revanced.patches.youtube.player.seekbar.fingerprints.SeekbarThumbnailsQualityFingerprint
1415
import app.revanced.patches.youtube.player.seekbar.fingerprints.ShortsSeekbarColorFingerprint
1516
import app.revanced.patches.youtube.player.seekbar.fingerprints.ThumbnailPreviewConfigFingerprint
1617
import app.revanced.patches.youtube.player.seekbar.fingerprints.TimeCounterFingerprint
@@ -23,6 +24,7 @@ import app.revanced.patches.youtube.utils.fingerprints.SeekbarFingerprint
2324
import app.revanced.patches.youtube.utils.fingerprints.SeekbarOnDrawFingerprint
2425
import app.revanced.patches.youtube.utils.fingerprints.TotalTimeFingerprint
2526
import app.revanced.patches.youtube.utils.flyoutmenu.FlyoutMenuHookPatch
27+
import app.revanced.patches.youtube.utils.integrations.Constants.PATCH_STATUS_CLASS_DESCRIPTOR
2628
import app.revanced.patches.youtube.utils.integrations.Constants.PLAYER_CLASS_DESCRIPTOR
2729
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
2830
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.InlineTimeBarColorizedBarPlayedColorDark
@@ -40,6 +42,7 @@ import app.revanced.util.indexOfFirstWideLiteralInstructionValueOrThrow
4042
import app.revanced.util.injectLiteralInstructionBooleanCall
4143
import app.revanced.util.patch.BaseBytecodePatch
4244
import app.revanced.util.resultOrThrow
45+
import app.revanced.util.updatePatchStatus
4346
import com.android.tools.smali.dexlib2.Opcode
4447
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
4548
import com.android.tools.smali.dexlib2.iface.instruction.NarrowLiteralInstruction
@@ -68,6 +71,7 @@ object SeekbarComponentsPatch : BaseBytecodePatch(
6871
PlayerSeekbarColorFingerprint,
6972
SeekbarFingerprint,
7073
SeekbarTappingFingerprint,
74+
SeekbarThumbnailsQualityFingerprint,
7175
ShortsSeekbarColorFingerprint,
7276
TimelineMarkerArrayFingerprint,
7377
ThumbnailPreviewConfigFingerprint,
@@ -212,6 +216,16 @@ object SeekbarComponentsPatch : BaseBytecodePatch(
212216

213217
// endregion
214218

219+
// region patch for high quality thumbnails
220+
221+
// TODO: This will be added when support for newer YouTube versions is added.
222+
// SeekbarThumbnailsQualityFingerprint.injectLiteralInstructionBooleanCall(
223+
// 45399684,
224+
// "$PLAYER_CLASS_DESCRIPTOR->enableHighQualityFullscreenThumbnails()Z"
225+
// )
226+
227+
// endregion
228+
215229
// region patch for hide chapter
216230

217231
TimelineMarkerArrayFingerprint.resultOrThrow().let {
@@ -299,6 +313,8 @@ object SeekbarComponentsPatch : BaseBytecodePatch(
299313
)
300314

301315
settingArray += "SETTINGS: RESTORE_OLD_SEEKBAR_THUMBNAILS"
316+
317+
context.updatePatchStatus(PATCH_STATUS_CLASS_DESCRIPTOR, "OldSeekbarThumbnailsDefaultBoolean")
302318
}
303319
?: println("WARNING: Restore old seekbar thumbnails setting is not supported in this version. Use YouTube 19.16.39 or earlier.")
304320

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package app.revanced.patches.youtube.player.seekbar.fingerprints
2+
3+
import app.revanced.util.fingerprint.LiteralValueFingerprint
4+
5+
internal object SeekbarThumbnailsQualityFingerprint : LiteralValueFingerprint(
6+
returnType = "Z",
7+
parameters = emptyList(),
8+
literalSupplier = { 45399684 },
9+
)

src/main/kotlin/app/revanced/patches/youtube/utils/fix/bottomui/CfBottomUIPatch.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package app.revanced.patches.youtube.utils.fix.bottomui
33
import app.revanced.patcher.data.BytecodeContext
44
import app.revanced.patcher.patch.BytecodePatch
55
import app.revanced.patcher.patch.annotation.Patch
6+
import app.revanced.patches.youtube.utils.fix.bottomui.fingerprints.ExploderControlsFingerprint
67
import app.revanced.patches.youtube.utils.fix.bottomui.fingerprints.FullscreenButtonPositionFingerprint
78
import app.revanced.patches.youtube.utils.fix.bottomui.fingerprints.FullscreenButtonViewStubFingerprint
89
import app.revanced.util.injectLiteralInstructionBooleanCall
@@ -12,6 +13,7 @@ import app.revanced.util.injectLiteralInstructionBooleanCall
1213
)
1314
object CfBottomUIPatch : BytecodePatch(
1415
setOf(
16+
ExploderControlsFingerprint,
1517
FullscreenButtonPositionFingerprint,
1618
FullscreenButtonViewStubFingerprint
1719
)
@@ -23,6 +25,7 @@ object CfBottomUIPatch : BytecodePatch(
2325
* Therefore, this patch only applies to versions that can resolve this fingerprint.
2426
*/
2527
mapOf(
28+
ExploderControlsFingerprint to 45643739,
2629
FullscreenButtonViewStubFingerprint to 45617294,
2730
FullscreenButtonPositionFingerprint to 45627640
2831
).forEach { (fingerprint, literalValue) ->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package app.revanced.patches.youtube.utils.fix.bottomui.fingerprints
2+
3+
import app.revanced.util.fingerprint.LiteralValueFingerprint
4+
5+
internal object ExploderControlsFingerprint : LiteralValueFingerprint(
6+
returnType = "Z",
7+
literalSupplier = { 45643739 },
8+
)

src/main/resources/music/translations/cs-rCZ/strings.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22
<resources>
33
<!-- Shared -->
44
<string name="revanced_extended_settings_title">ReVanced Extended</string>
5+
<string name="revanced_extended_reset_to_default_toast">Obnovit na výchozí hodnoty.</string>
56
<!-- Shared Category -->
67
<string name="revanced_extended_restart_first_run"></string>
78
<string name="revanced_extended_restart_message">Obnovit a restartovat</string>
89
<!-- PreferenceScreen: Account -->
910
<string name="revanced_preference_screen_account_title"></string>
11+
<string name="revanced_hide_account_menu_title">Skrýt nabídku účtu</string>
12+
<string name="revanced_hide_account_menu_summary">Skryje prvky nabídky účtu pomocí vlastního filtru.</string>
13+
<string name="revanced_hide_account_menu_filter_strings_title">Filtr nabídky účtu</string>
1014
<!-- PreferenceScreen: Action Bar -->
1115
<string name="revanced_external_downloader_package_name_title">Název balíčku pro externí stahování</string>
1216
<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>

0 commit comments

Comments
 (0)