revanced-patches icon indicating copy to clipboard operation
revanced-patches copied to clipboard

feat: Update to patcher v22

Open LisoUseInAIKyrios opened this issue 10 months ago • 69 comments

Initial usage of Patcher v22 method instruction filters.

https://github.com/ReVanced/revanced-patcher/pull/329

LisoUseInAIKyrios avatar Feb 03 '25 15:02 LisoUseInAIKyrios

20.05.35 patched successfully with this PR but get weird issue like this:

WARNING: String revanced_pref_import_export_summary is not raw but contains encoded new line characters: Імпорт / Експорт налаштувань ReVanced

Для збереження налаштувань скопіюйте текст у вікні кнопкою \"Копіювати\" та збережіть його в текстовому файлі.\nДля відновлення налаштувань вставте у вікно збережений раніше текст та натисніть кнопку \"Імпортувати\"
INFO: Compiling modified resources
WARNING: warn: removing resource app.revanced.android.youtube:string/revanced_miniplayer_hide_expand_close_legacy_summary_off without required default value.
WARNING: warn: removing resource app.revanced.android.youtube:string/revanced_miniplayer_hide_expand_close_legacy_summary_on without required default value.
WARNING: warn: removing resource app.revanced.android.youtube:string/revanced_miniplayer_hide_expand_close_legacy_title without required default value.
WARNING: warn: removing resource app.revanced.android.youtube:string/revanced_miniplayer_hide_expand_close_summary_off without required default value.
WARNING: warn: removing resource app.revanced.android.youtube:string/revanced_miniplayer_hide_expand_close_summary_on without required default value.
WARNING: warn: removing resource app.revanced.android.youtube:string/revanced_miniplayer_hide_expand_close_title without required default value.

cyberboh avatar Feb 06 '25 03:02 cyberboh

Ignore it. It's a warning about some of the Crowdin strings and it's already fixed in Crowdin but not synced yet.

LisoUseInAIKyrios avatar Feb 06 '25 04:02 LisoUseInAIKyrios

This PR is great, i can even patch 20.06.36 :)

cyberboh avatar Feb 12 '25 11:02 cyberboh

After refetch new commit, i get error during compiling:

$ ./gradlew build

> Task :patches:compileKotlin FAILED
e: file:///E:/revanced/revanced-patches/patches/src/main/kotlin/app/revanced/patches/shared/misc/mapping/ResourceMappingPatch.kt:4:29 Unresolved reference 'LiteralWideFilter'.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':patches:compileKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

cyberboh avatar Feb 13 '25 12:02 cyberboh

@cyberboh You need to pull the changes from the Patcher PR, then do a gradle publishToMavenLocal on patcher then do a gradle --refresh-dependencies on both cli and patches project.

LisoUseInAIKyrios avatar Feb 13 '25 12:02 LisoUseInAIKyrios

@cyberboh You need to pull the changes from the Patcher PR, then do a gradle publishToMavenLocal on patcher then do a gradle --refresh-dependencies on both cli and patches project.

Actually i did some days ago, and i don't see any patcher v22 PR update today. I compiled https://github.com/ReVanced/revanced-patches/pull/4409/commits/f23834a868b5af5ec5e45b1a2f9791b65bf2c7c1 successfully and can patch YouTube 20.06.33, but i get failed after update this PR to https://github.com/ReVanced/revanced-patches/compare/d2d7284803d500c553790ead5ad3ce81f0da4c5e..042f16f58904d1dc6ccffc10cc7dad1c3f4e0ab9

cyberboh avatar Feb 13 '25 12:02 cyberboh

There are 4 new commits to the Patcher PR, all made in the past few hours.

https://github.com/ReVanced/revanced-patcher/pull/329/commits/d1d5557b5a60052d1dec5f95c83aabbbb3b7b4b7

LisoUseInAIKyrios avatar Feb 13 '25 12:02 LisoUseInAIKyrios

There are 4 new commits to the Patcher PR, all made in the past few hours.

ReVanced/revanced-patcher@d1d5557

Ohh i did not see that, will try refetch it. 👍

cyberboh avatar Feb 13 '25 12:02 cyberboh

Do you know the reason for the delay in merging? It is difficult to switch between branches to test new versions.

MarcaDian avatar Feb 13 '25 13:02 MarcaDian

There is pending review on the patcher PR about general concepts introduced in the PR that need some discussion

oSumAtrIX avatar Feb 13 '25 13:02 oSumAtrIX

Hide Shorts components patch fails in 20.07.33

SEVERE: "Hide Shorts components" failed:
app.revanced.patcher.patch.PatchException: Could not find resource type: dimen name: reel_player_right_cell_button_height
        at app.revanced.patches.shared.misc.mapping.ResourceMappingPatchKt.getResourceId(ResourceMappingPatch.kt:20)
        at app.revanced.patches.shared.misc.mapping.ResourceMappingPatchKt.resourceLiteral$lambda$0(ResourceMappingPatch.kt:37)
        at app.revanced.patcher.LiteralFilter.matches(InstructionFilter.kt:197)
        at app.revanced.patcher.Fingerprint.matchOrNull$matchFilters(Fingerprint.kt:233)
        at app.revanced.patcher.Fingerprint.matchOrNull(Fingerprint.kt:266)
        at app.revanced.patcher.Fingerprint.matchOrNull(Fingerprint.kt:119)
        at app.revanced.patcher.Fingerprint.matchOrNull(Fingerprint.kt:95)
        at app.revanced.patcher.Fingerprint.match(Fingerprint.kt:291)
        at app.revanced.patcher.Fingerprint.getMethod(Fingerprint.kt:437)
        at app.revanced.patches.youtube.layout.hide.shorts.HideShortsComponentsPatchKt.hideShortsComponentsPatch$lambda$14$lambda$13(HideShortsComponentsPatch.kt:176)
        at app.revanced.patcher.patch.Patch.execute(Patch.kt:71)
        at app.revanced.patcher.patch.BytecodePatch.execute$revanced_patcher(Patch.kt:160)
        at app.revanced.patcher.Patcher$invoke$1.invokeSuspend$execute(Patcher.kt:84)
        at app.revanced.patcher.Patcher$invoke$1.invokeSuspend(Patcher.kt:109)
        at app.revanced.patcher.Patcher$invoke$1.invoke(Patcher.kt)
        at app.revanced.patcher.Patcher$invoke$1.invoke(Patcher.kt)
        at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:57)
        at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:226)
        at app.revanced.cli.command.PatchCommand$run$1$4.invokeSuspend(PatchCommand.kt:315)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
        at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:277)
        at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:95)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:69)
        at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:48)
        at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
        at app.revanced.cli.command.PatchCommand.run(PatchCommand.kt:314)
        at picocli.CommandLine.executeUserObject(CommandLine.java:2030)
        at picocli.CommandLine.access$1500(CommandLine.java:148)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2465)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2457)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2419)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2277)
        at picocli.CommandLine$RunLast.execute(CommandLine.java:2421)
        at picocli.CommandLine.execute(CommandLine.java:2174)
        at app.revanced.cli.command.MainCommandKt.main(MainCommand.kt:12)

cyberboh avatar Feb 19 '25 03:02 cyberboh

@cyberboh Update and try again

LisoUseInAIKyrios avatar Feb 19 '25 06:02 LisoUseInAIKyrios

I think that was previously caused by each thread parsing the xml (each thread called document(resourceXmlFile.inputStream()).use { document ->), where each thread had it's own instance. Or maybe it was previously slow due to something in an older version of the library.

But now it's taking less than 0.1 second to parse everything in a single thread. Multiple threads is now slower since there's too much contention between the threads (and it's now only 0.1 seconds so it's not worth any extra complexity even if there was any performance to gain).

Using a single thread is likely better on memory too.

I haven't tried on a phone, but my laptop is 4 years old and patching on my phone is about the same speed as my laptop.

  Update: I found why the old implementation was so slow. Previously it used a recursive function that iteratively called childNodes and that function creates a new list every time. The fix is to call childNodes as few times as possible and store the node list to a local variable.

https://github.com/ReVanced/revanced-patches/blob/d451910e802b4d1b6308829dfec3b18166996ef7/src/main/kotlin/app/revanced/extensions/Extensions.kt#L195

https://github.com/ReVanced/revanced-patches/blob/d451910e802b4d1b6308829dfec3b18166996ef7/src/main/kotlin/app/revanced/patches/youtube/misc/mapping/patch/ResourceIdMappingProviderResourcePatch.kt#L25

The childNodes performance issue was identified by Kitadai31 and the last remaining places affected by this was fixed with https://github.com/ReVanced/revanced-patches/commit/0868e38ce614738e7172ee84b1e2a7d274178757

LisoUseInAIKyrios avatar Feb 19 '25 06:02 LisoUseInAIKyrios

@cyberboh Update and try again

Confirmed, it works. No any errors occurred during patching 20.07.33. Kudos 💯

cyberboh avatar Feb 19 '25 13:02 cyberboh

Noticed strange behavior of the seekbar color: after switching from fullscreen mode to vertical mode, the green segment of the sponsorblock changes its length. 20.07.33

Edit: After a reboot, this behavior disappeared.

Screenrecorder-2025-02-19-18-50-51-942.gif

Screenrecorder-2025-02-19-18-48-27-482.gif

MarcaDian avatar Feb 19 '25 16:02 MarcaDian

20.07 seems a little buggy. The dislikes text looks wrong (text is too large, and might be using the wrong font), and it's like that unpatched. Maybe they changed the text intentionally but it doesn't look right.

I've been using 20.06 and encountered no issues.

LisoUseInAIKyrios avatar Feb 19 '25 17:02 LisoUseInAIKyrios

20.07 seems a little buggy. The dislikes text looks wrong (text is too large, and might be using the wrong font), and it's like that unpatched. Maybe they changed the text intentionally but it doesn't look right.

I've been using 20.06 and encountered no issues.

I noticed the same. And weirdly, 20.07.33 is not available in playstore even with my beta tester account. Maybe google pulled it out. A week ago, I got 20.07.32 in my tab but now I check it, it's gone and replaced by 20.06.36. Soon, google will release 20.08 or 20.09 (whatever version they want) and could be with fixes this tiny bug.

cyberboh avatar Feb 20 '25 00:02 cyberboh

@LisoUseInAIKyrios Dislikes tiny bug finally fixed in 20.07.37. Also, this PR can be used to patch 20.08.32 successfully which is recently released. Personally tested. 👍

cyberboh avatar Feb 20 '25 04:02 cyberboh

I was thinking that maybe it would be useful to create a specific (and always open) PR like this, related to new YouTube versions adaptation. This would help to avoid two situations:

  1. Possible unwanted A/B tests.
  2. Many patches broken in one time, caused by the ignored new stock versions released (like switching from 19.25 to 19.47 for example).

0xrxL avatar Feb 20 '25 05:02 0xrxL

@0xrxL it's simpler to fix new versions using refactor/chore commits such as https://github.com/ReVanced/revanced-patches/pull/4179 and users who care can turn off version checks and patch using dev/main releases.

The changes have been here to test out the patcher changes and because some of the fingerprints changes got too complicated to use without the patcher changes (one in particular would have needed 4 different fingerprints, and here it's a single fingerprint).

LisoUseInAIKyrios avatar Feb 20 '25 07:02 LisoUseInAIKyrios

20.07 seems a little buggy. The dislikes text looks wrong (text is too large, and might be using the wrong font), and it's like that unpatched. Maybe they changed the text intentionally but it doesn't look right.

I've been using 20.06 and encountered no issues.

Seem this is caused by RYD patch is not compatible with 20.07+. My conclusion above is based on my test:

  1. 20.07+ patched with default patches, disable spoof streams, restart app, RYD is buggy.
  2. Then cleared data 20.07+ , RYD is normal, but after tick untick any options that need restart the app, issue is back.
  3. 20.06 is normal, even i tick untick and restart the app many times. Tested in 20.06.42

cyberboh avatar Feb 20 '25 13:02 cyberboh

What bugs are referring to? The only bug I find is the text font looks wrong and the vertical alignment is not quite right. Both issues are present with 20.07+ with and without RYD enabled. I don't experience any other issues.

LisoUseInAIKyrios avatar Feb 20 '25 13:02 LisoUseInAIKyrios

Yes i mean the text issue is not fit to the likes dislikes button. I just patched with default patches, and think this is caused by RYD. If the issue is not caused by RYD, maybe caused by another patch or Google add some more A/B flags.

cyberboh avatar Feb 20 '25 13:02 cyberboh

I just tried unpatched 20.08 and the same RYD text issues are present there. It's an issue with YouTube itself.

LisoUseInAIKyrios avatar Feb 20 '25 13:02 LisoUseInAIKyrios

Some users write that in some cases the seekbar panel (timebar, chapters, buttons) may disappear. Perhaps this is also a bug of an unpatched app. v20.07 I think it is better to inform about it.

Edit: Ha-ha, Now I have it too.

This happens during a double-tap to seek, if correctly guess the moment when the double tap animation ends and tap at this moment again, the bottom layout will not appear.

If double tap again, the layout will return.

Screenshot_2025-02-20-20-05-33-700_app.revanced.android.youtube.jpg

Screenshot_2025-02-20-20-05-40-859_app.revanced.android.youtube.jpg

MarcaDian avatar Feb 20 '25 17:02 MarcaDian

I just tried unpatched 20.08 and the same RYD text issues are present there. It's an issue with YouTube itself.

I was thinking it was not a bug. Starting 20.07 onwards, Google changed the likes dislikes font.

cyberboh avatar Feb 21 '25 07:02 cyberboh

This happens during a double-tap to seek, if correctly guess the moment when the double tap animation ends and tap at this moment again, the bottom layout will not appear.

If double tap again, the layout will return.

Can someone confirm this bug? I tried to reproduce it on 19.50.41 RVP v5.12.0, or this is a bug of some hook (probably a double-tap to seek or fullscreen button), or a bug of the YouTube app itself, or a bug after https://github.com/ReVanced/revanced-patches/pull/4469 , or a bug of this PR. Bug is present on 20.06.42 and 20.07.37 and 20.08.34 from my side.

MarcaDian avatar Feb 21 '25 11:02 MarcaDian

This happens during a double-tap to seek, if correctly guess the moment when the double tap animation ends and tap at this moment again, the bottom layout will not appear. If double tap again, the layout will return.

Can someone confirm this bug? I tried to reproduce it on 19.50.41 RVP v5.12.0, or this is a bug of some hook (probably a double-tap to seek or fullscreen button), or a bug of the YouTube app itself, or a bug after #4469 , or a bug of this PR. Bug is present on 20.06.42 and 20.07.37 from my side.

I get the same on 20.06.42 19.50.41 is fine here with 5.12.0 patches. So i guess this caused from this PR. Dunno how to debug

cyberboh avatar Feb 21 '25 11:02 cyberboh

Nothing in this PR changes the final patched app (except for adding Miniplayer type 4, but that's unrelated). It must be something with 20.x.

LisoUseInAIKyrios avatar Feb 21 '25 11:02 LisoUseInAIKyrios

Nothing in this PR changes the final patched app (except for adding Miniplayer type 4, but that's unrelated). It must be something with 20.x.

Oh... I remember the bug appears after i select miniplayer type 4. After i changed to type 3, it is fine. So maybe patch for miniplayer type 4 is the culprit.

cyberboh avatar Feb 21 '25 12:02 cyberboh