Compare commits

...

83 Commits

Author SHA1 Message Date
semantic-release-bot
902754363c chore(release): 2.6.0-dev.2 [skip ci]
# [2.6.0-dev.2](https://github.com/revanced/revanced-patches/compare/v2.6.0-dev.1...v2.6.0-dev.2) (2022-07-02)

### Bug Fixes

* remove refreshing home screen not working ([42def27](42def27fa5))
2022-07-02 22:41:07 +00:00
oSumAtrIX
42def27fa5 fix: remove refreshing home screen not working 2022-07-03 00:39:27 +02:00
oSumAtrIX
7986c57a6f refactor: add package for fingerprints 2022-07-02 16:15:48 +02:00
semantic-release-bot
3de6790e9f chore(release): 2.6.0-dev.1 [skip ci]
# [2.6.0-dev.1](https://github.com/revanced/revanced-patches/compare/v2.5.1-dev.1...v2.6.0-dev.1) (2022-07-02)

### Features

* migrate to breaking changes of patcher ([c95c241](c95c241887))
2022-07-02 02:24:43 +00:00
oSumAtrIX
c95c241887 feat: migrate to breaking changes of patcher 2022-07-02 04:21:48 +02:00
semantic-release-bot
0f05fbfad9 chore(release): 2.5.1-dev.1 [skip ci]
## [2.5.1-dev.1](https://github.com/revanced/revanced-patches/compare/v2.5.0...v2.5.1-dev.1) (2022-06-30)

### Bug Fixes

* freezing panels when watching video in fullscreen ([#89](https://github.com/revanced/revanced-patches/issues/89)) ([d3e1419](d3e1419d0e))
* invalid version in compatibility annotation ([#90](https://github.com/revanced/revanced-patches/issues/90)) ([c21e177](c21e177ed1))
2022-06-30 19:33:13 +00:00
Aunali321
c21e177ed1 fix: invalid version in compatibility annotation (#90) 2022-06-30 20:24:29 +02:00
bogadana
d3e1419d0e fix: freezing panels when watching video in fullscreen (#89) 2022-06-30 19:15:51 +02:00
semantic-release-bot
f44d09059b chore(release): 2.5.0 [skip ci]
# [2.5.0](https://github.com/revanced/revanced-patches/compare/v2.4.0...v2.5.0) (2022-06-30)

### Features

* hide watermark support for 17.25.34 ([#87](https://github.com/revanced/revanced-patches/issues/87)) ([185f6d8](185f6d84fb))
2022-06-30 15:45:24 +00:00
Aunali321
185f6d84fb feat: hide watermark support for 17.25.34 (#87) 2022-06-30 17:43:21 +02:00
semantic-release-bot
3dc6be5d8d chore(release): 2.4.0 [skip ci]
# [2.4.0](https://github.com/revanced/revanced-patches/compare/v2.3.1...v2.4.0) (2022-06-30)

### Features

* add youtube version 17.25.34 ([#85](https://github.com/revanced/revanced-patches/issues/85)) ([742e239](742e2394a9))
2022-06-30 12:51:48 +00:00
Aunali321
742e2394a9 feat: add youtube version 17.25.34 (#85) 2022-06-30 14:50:16 +02:00
bogadana
d9d389b939 refactor: change name to fit in (#86) 2022-06-30 14:48:27 +02:00
semantic-release-bot
b0775e13d5 chore(release): 2.3.1 [skip ci]
## [2.3.1](https://github.com/revanced/revanced-patches/compare/v2.3.0...v2.3.1) (2022-06-30)

### Bug Fixes

* change fingerprint to work on latest youtube ([#80](https://github.com/revanced/revanced-patches/issues/80)) ([0fe98b6](0fe98b6c5e))
2022-06-30 04:19:47 +00:00
bogadana
0fe98b6c5e fix: change fingerprint to work on latest youtube (#80) 2022-06-30 06:18:14 +02:00
oSumAtrIX
3a78021f5e refactor: description of custom-playback-speed patch. 2022-06-30 02:48:18 +02:00
oSumAtrIX
e096009893 refactor: hide-autoplay-button & refactor: hide-autoplay-button && premium-heading patch 2022-06-30 02:39:24 +02:00
semantic-release-bot
b599ee2096 chore(release): 2.3.0 [skip ci]
# [2.3.0](https://github.com/revanced/revanced-patches/compare/v2.2.0...v2.3.0) (2022-06-30)

### Features

* `disable-autoplay-button` patch ([#79](https://github.com/revanced/revanced-patches/issues/79)) ([bd7cede](bd7cedee48))
2022-06-30 00:36:57 +00:00
bogadana
bd7cedee48 feat: disable-autoplay-button patch (#79) 2022-06-30 02:35:11 +02:00
oSumAtrIX
278c07ea56 build: bump patcher dependency version 2022-06-30 01:41:38 +02:00
semantic-release-bot
6dc2875057 chore(release): 2.2.0 [skip ci]
# [2.2.0](https://github.com/revanced/revanced-patches/compare/v2.1.0...v2.2.0) (2022-06-29)

### Features

* make resource mapping patch aware of types ([#77](https://github.com/revanced/revanced-patches/issues/77)) ([7b24071](7b24071956))
2022-06-29 22:50:21 +00:00
bogadana
7b24071956 feat: make resource mapping patch aware of types (#77) 2022-06-30 00:48:53 +02:00
semantic-release-bot
6c472aa71d chore(release): 2.1.0 [skip ci]
# [2.1.0](https://github.com/revanced/revanced-patches/compare/v2.0.3...v2.1.0) (2022-06-28)

### Features

* `custom-playback-speed` patch ([#50](https://github.com/revanced/revanced-patches/issues/50)) ([ca66490](ca66490930))
2022-06-28 21:44:38 +00:00
bogadana
ca66490930 feat: custom-playback-speed patch (#50) 2022-06-28 23:43:07 +02:00
semantic-release-bot
5317a482d1 chore(release): 2.0.3 [skip ci]
## [2.0.3](https://github.com/revanced/revanced-patches/compare/v2.0.2...v2.0.3) (2022-06-27)

### Bug Fixes

* check if resource files exist ([f21d1d8](f21d1d83f6))
2022-06-27 22:41:37 +00:00
oSumAtrIX
f21d1d83f6 fix: check if resource files exist 2022-06-28 00:39:51 +02:00
semantic-release-bot
bb6c805f55 chore(release): 2.0.2 [skip ci]
## [2.0.2](https://github.com/revanced/revanced-patches/compare/v2.0.1...v2.0.2) (2022-06-27)

### Bug Fixes

* some more refactoring of integrations, add hide-watermark patch ([#63](https://github.com/revanced/revanced-patches/issues/63)) ([c5dfe3e](c5dfe3e842))
2022-06-27 20:10:53 +00:00
Joey Peter
c5dfe3e842 fix: some more refactoring of integrations, add hide-watermark patch (#63)
* refactor: integrations

* add HideWatermark patch

* add hidewatermark patch

* fix bug

* use latest patcher version

* Fix sig name

* update to fingerprints

* make cleaner patch

* add 17.24.35 support for hide-watermark
2022-06-27 22:09:17 +02:00
oSumAtrIX
4290a4e820 refactor: remove trimIndent before compiling instructions 2022-06-27 01:09:40 +02:00
semantic-release-bot
1f6b450df3 chore(release): 2.0.1 [skip ci]
## [2.0.1](https://github.com/revanced/revanced-patches/compare/v2.0.0...v2.0.1) (2022-06-26)

### Bug Fixes

* invalid string in strings list ([a29de19](a29de19d4c))
* migrate to new `proxy` api ([d9f05ff](d9f05ffdf8))
2022-06-26 16:12:29 +00:00
oSumAtrIX
d9f05ffdf8 fix: migrate to new proxy api 2022-06-26 18:10:37 +02:00
oSumAtrIX
ddc693e909 build: bump patcher dependency version 2022-06-26 18:03:38 +02:00
oSumAtrIX
a29de19d4c fix: invalid string in strings list 2022-06-26 17:59:28 +02:00
semantic-release-bot
c6d50e8450 chore(release): 2.0.0 [skip ci]
# [2.0.0](https://github.com/revanced/revanced-patches/compare/v1.11.0...v2.0.0) (2022-06-26)

### Code Refactoring

* migrate from `Signature` to `Fingerprint` ([f0aeece](f0aeece867))

### BREAKING CHANGES

* Not backwards compatible, since a lot of classes where renamed.
2022-06-26 14:36:01 +00:00
oSumAtrIX
f0aeece867 refactor: migrate from Signature to Fingerprint
BREAKING CHANGE: Not backwards compatible, since a lot of classes where renamed.
2022-06-26 16:33:58 +02:00
semantic-release-bot
015443d9db chore(release): 1.11.0 [skip ci]
# [1.11.0](https://github.com/revanced/revanced-patches/compare/v1.10.5...v1.11.0) (2022-06-26)

### Features

* add youtube version 17.24.35 ([fde42c5](fde42c5bae))
* add youtube version 17.24.35 ([b4ae564](b4ae564102))
2022-06-26 12:26:50 +00:00
Joey Peter
fde42c5bae feat: add youtube version 17.24.35 2022-06-26 14:25:23 +02:00
Aunali321
b4ae564102 feat: add youtube version 17.24.35 2022-06-26 12:12:05 +05:30
semantic-release-bot
aabbe110b9 chore(release): 1.10.5 [skip ci]
## [1.10.5](https://github.com/revanced/revanced-patches/compare/v1.10.4...v1.10.5) (2022-06-25)

### Bug Fixes

* put back proper variable ([#61](https://github.com/revanced/revanced-patches/issues/61)) ([35b86c7](35b86c7d78))
2022-06-25 00:17:35 +00:00
bogadana
35b86c7d78 fix: put back proper variable (#61) 2022-06-25 02:15:58 +02:00
semantic-release-bot
e101af72d4 chore(release): 1.10.4 [skip ci]
## [1.10.4](https://github.com/revanced/revanced-patches/compare/v1.10.3...v1.10.4) (2022-06-23)

### Bug Fixes

* missing brackets at inlining ([59509a3](59509a307e))
2022-06-23 22:57:58 +00:00
oSumAtrIX
59509a307e fix: missing brackets at inlining 2022-06-24 00:56:29 +02:00
Joey Peter
ccf0218b6c refactor: integrations (#44) 2022-06-24 00:17:49 +02:00
semantic-release-bot
d5597fb002 chore(release): 1.10.3 [skip ci]
## [1.10.3](https://github.com/revanced/revanced-patches/compare/v1.10.2...v1.10.3) (2022-06-23)

### Bug Fixes

* get create button view register by more reliable means ([#59](https://github.com/revanced/revanced-patches/issues/59)) ([0515a50](0515a500c6))
2022-06-23 22:07:17 +00:00
bogadana
0515a500c6 fix: get create button view register by more reliable means (#59) 2022-06-24 00:05:41 +02:00
semantic-release-bot
636aac1a28 chore(release): 1.10.2 [skip ci]
## [1.10.2](https://github.com/revanced/revanced-patches/compare/v1.10.1...v1.10.2) (2022-06-23)

### Bug Fixes

* `disable-create-button` not working with prebuilt jar file ([#55](https://github.com/revanced/revanced-patches/issues/55)) ([8ff6c15](8ff6c159fa))
2022-06-23 13:07:52 +00:00
Itroublve
8ff6c159fa fix: disable-create-button not working with prebuilt jar file (#55) 2022-06-23 15:06:00 +02:00
semantic-release-bot
a84766aad9 chore(release): 1.10.1 [skip ci]
## [1.10.1](https://github.com/revanced/revanced-patches/compare/v1.10.0...v1.10.1) (2022-06-23)

### Bug Fixes

* patcher not propagating dexlib ([a120be4](a120be4a79))
* update patcher version ([8cba2c0](8cba2c0f8f))
2022-06-23 10:25:07 +00:00
Sculas
a120be4a79 fix: patcher not propagating dexlib 2022-06-23 12:23:31 +02:00
Sculas
8cba2c0f8f fix: update patcher version 2022-06-23 12:15:00 +02:00
Itroublve
579297efa3 refactor: Migrate to new extension methods for String.toInstruction(...) and String.toInstructions(...) (#45) 2022-06-23 02:22:42 +02:00
semantic-release-bot
9094a69be8 chore(release): 1.10.0 [skip ci]
# [1.10.0](https://github.com/revanced/revanced-patches/compare/v1.9.1...v1.10.0) (2022-06-23)

### Features

* add compatibility for YouTube v17.23.36 and v17.24.34 ([20c77c1](20c77c1769))
2022-06-23 00:21:14 +00:00
Joey Peter
20c77c1769 feat: add compatibility for YouTube v17.23.36 and v17.24.34 2022-06-23 02:19:35 +02:00
semantic-release-bot
fcc450efb4 chore(release): 1.9.1 [skip ci]
## [1.9.1](https://github.com/revanced/revanced-patches/compare/v1.9.0...v1.9.1) (2022-06-21)

### Bug Fixes

* update patcher version ([f02e8b1](f02e8b13ac))
2022-06-21 22:03:16 +00:00
Sculas
f02e8b13ac fix: update patcher version 2022-06-22 00:01:36 +02:00
semantic-release-bot
4c4f7adbce chore(release): 1.9.0 [skip ci]
# [1.9.0](https://github.com/revanced/revanced-patches/compare/v1.8.2...v1.9.0) (2022-06-21)

### Features

* use `install` mode by default ([6662be8](6662be893c))
2022-06-21 16:44:01 +00:00
oSumAtrIX
6662be893c feat: use install mode by default 2022-06-21 18:30:06 +02:00
semantic-release-bot
41cf8e3fa9 chore(release): 1.8.2 [skip ci]
## [1.8.2](https://github.com/revanced/revanced-patches/compare/v1.8.1...v1.8.2) (2022-06-20)

### Bug Fixes

* migrate to breaking changes from patcher ([e002818](e00281819c))
* old usage of `toInstructions` extension method ([aec1602](aec1602a39))
2022-06-20 19:35:33 +00:00
oSumAtrIX
aec1602a39 fix: old usage of toInstructions extension method 2022-06-20 21:33:45 +02:00
oSumAtrIX
e00281819c fix: migrate to breaking changes from patcher 2022-06-20 21:29:55 +02:00
oSumAtrIX
48cf778d56 refactor: improve microg-support reference patches 2022-06-20 21:29:54 +02:00
semantic-release-bot
e6506bd4b4 chore(release): 1.8.1 [skip ci]
## [1.8.1](https://github.com/revanced/revanced-patches/compare/v1.8.0...v1.8.1) (2022-06-20)

### Bug Fixes

* add execute permission to `./gradlew` file ([3a29b6d](3a29b6db64))
2022-06-20 17:19:31 +00:00
MedzikUser
3a29b6db64 fix: add execute permission to ./gradlew file 2022-06-20 19:17:54 +02:00
semantic-release-bot
cecee8f70e chore(release): 1.8.0 [skip ci]
# [1.8.0](https://github.com/revanced/revanced-patches/compare/v1.7.0...v1.8.0) (2022-06-20)

### Features

* bump compatibility of patches for Youtube to v17.23.35 ([e5cad5f](e5cad5f022))
2022-06-20 08:56:19 +00:00
oSumAtrIX
e5cad5f022 feat: bump compatibility of patches for Youtube to v17.23.35 2022-06-20 10:54:37 +02:00
TheJeterLP
85e584f65a fix double character 2022-06-20 10:30:07 +02:00
TheJeterLP
78fe1b67ea bump youtube version to 12.23.35 2022-06-20 10:25:59 +02:00
Joey Peter
9c33d67d80 Update GeneralAdsCompatibility.kt 2022-06-20 10:20:19 +02:00
semantic-release-bot
16d234e761 chore(release): 1.7.0 [skip ci]
# [1.7.0](https://github.com/revanced/revanced-patches/compare/v1.6.4...v1.7.0) (2022-06-20)

### Features

* `disable-fullscreen-panels` patch ([5797e15](5797e15b06))
2022-06-20 06:05:30 +00:00
oSumAtrIX
635f65e5a1 Merge pull request #38 from bogadana/main
feat: `disable-fullscreen-panels` patch
2022-06-20 08:03:45 +02:00
oSumAtrIX
3ef5d2a29d refactor: patch description 2022-06-20 08:03:02 +02:00
bogadana
5797e15b06 feat: disable-fullscreen-panels patch 2022-06-20 01:29:47 +02:00
semantic-release-bot
c987357959 chore(release): 1.6.4 [skip ci]
## [1.6.4](https://github.com/revanced/revanced-patches/compare/v1.6.3...v1.6.4) (2022-06-19)

### Bug Fixes

* update patcher version ([#35](https://github.com/revanced/revanced-patches/issues/35)) ([e452969](e452969cdd)), closes [#34](https://github.com/revanced/revanced-patches/issues/34)
2022-06-19 15:28:06 +00:00
Sculas
e452969cdd fix: update patcher version (#35)
Fixes #34
2022-06-19 17:26:08 +02:00
semantic-release-bot
7484f52bc4 chore(release): 1.6.3 [skip ci]
## [1.6.3](https://github.com/revanced/revanced-patches/compare/v1.6.2...v1.6.3) (2022-06-16)

### Bug Fixes

* wrong dex path ([938dd03](938dd030b0))
2022-06-16 11:38:30 +00:00
Sculas
938dd030b0 fix: wrong dex path 2022-06-16 13:36:52 +02:00
semantic-release-bot
990806118f chore(release): 1.6.2 [skip ci]
## [1.6.2](https://github.com/revanced/revanced-patches/compare/v1.6.1...v1.6.2) (2022-06-16)

### Bug Fixes

* broken gradle task ([6ae1e1d](6ae1e1d0aa))
2022-06-16 11:35:50 +00:00
Sculas
6ae1e1d0aa fix: broken gradle task 2022-06-16 13:33:50 +02:00
semantic-release-bot
ed6a0e5403 chore(release): 1.6.1 [skip ci]
## [1.6.1](https://github.com/revanced/revanced-patches/compare/v1.6.0...v1.6.1) (2022-06-16)

### Bug Fixes

* broken gradle task ([d48a8e9](d48a8e93a2))
2022-06-16 11:29:49 +00:00
Lucaskyy
d48a8e93a2 fix: broken gradle task 2022-06-16 13:27:45 +02:00
semantic-release-bot
51f0a011a7 chore(release): 1.6.0 [skip ci]
# [1.6.0](https://github.com/revanced/revanced-patches/compare/v1.5.3...v1.6.0) (2022-06-16)

### Bug Fixes

* broken gradle task ([0a6a9e9](0a6a9e9f4b))

### Features

* generate dex files using gradle task ([8669a22](8669a22689))
2022-06-16 10:57:06 +00:00
Lucaskyy
0a6a9e9f4b fix: broken gradle task 2022-06-16 12:55:13 +02:00
Lucaskyy
8669a22689 feat: generate dex files using gradle task 2022-06-16 12:47:49 +02:00
89 changed files with 1429 additions and 656 deletions

View File

@@ -12,7 +12,7 @@ on:
jobs: jobs:
release: release:
name: Release name: Release
runs-on: ubuntu-latest runs-on: ubuntu-18.04
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
@@ -30,23 +30,12 @@ jobs:
node-version: "lts/*" node-version: "lts/*"
- name: Setup Android SDK - name: Setup Android SDK
uses: android-actions/setup-android@v2 uses: android-actions/setup-android@v2
- name: Make gradlew executable
run: chmod +x gradlew
- name: Build with Gradle - name: Build with Gradle
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew build run: ./gradlew build clean
- name: Install Android build-tools - name: Install Android build-tools
run: sdkmanager "build-tools;32.0.0" run: sdkmanager "build-tools;32.0.0"
- name: Generate Patches DEX
run: |
mkdir -p bin
fn=$(find build/libs -maxdepth 1 | grep -P "[\d]+\.jar")
out=bin/$(basename "$fn" | sed 's/jar/dex/g')
$ANDROID_HOME/build-tools/32.0.0/d8 $fn
mv *.dex $out
- name: Clean build
run: ./gradlew clean
- name: Setup semantic-release - name: Setup semantic-release
run: npm install -g semantic-release @semantic-release/git @semantic-release/changelog gradle-semantic-release-plugin -D run: npm install -g semantic-release @semantic-release/git @semantic-release/changelog gradle-semantic-release-plugin -D
- name: Release - name: Release

View File

@@ -28,7 +28,7 @@
"path": "build/libs/*.jar" "path": "build/libs/*.jar"
}, },
{ {
"path": "bin/*.dex" "path": "build/libs/*.dex"
} }
] ]
} }

View File

@@ -1,3 +1,235 @@
# [2.6.0-dev.2](https://github.com/revanced/revanced-patches/compare/v2.6.0-dev.1...v2.6.0-dev.2) (2022-07-02)
### Bug Fixes
* remove refreshing home screen not working ([ec7ae90](https://github.com/revanced/revanced-patches/commit/ec7ae900181b6456c692adb3b5bb337e81bc5fea))
# [2.6.0-dev.1](https://github.com/revanced/revanced-patches/compare/v2.5.1-dev.1...v2.6.0-dev.1) (2022-07-02)
### Features
* migrate to breaking changes of patcher ([a116852](https://github.com/revanced/revanced-patches/commit/a11685263fb2274c67684258e73c5247502cb010))
## [2.5.1-dev.1](https://github.com/revanced/revanced-patches/compare/v2.5.0...v2.5.1-dev.1) (2022-06-30)
### Bug Fixes
* freezing panels when watching video in fullscreen ([#89](https://github.com/revanced/revanced-patches/issues/89)) ([f5d4f6c](https://github.com/revanced/revanced-patches/commit/f5d4f6c3419916c6a9cf67babc6be8a64c854d3b))
* invalid version in compatibility annotation ([#90](https://github.com/revanced/revanced-patches/issues/90)) ([df43547](https://github.com/revanced/revanced-patches/commit/df435475cdd0494a1e4ea9e2980c2998c9bc7048))
# [2.5.0](https://github.com/revanced/revanced-patches/compare/v2.4.0...v2.5.0) (2022-06-30)
### Features
* hide watermark support for 17.25.34 ([#87](https://github.com/revanced/revanced-patches/issues/87)) ([0cdb65b](https://github.com/revanced/revanced-patches/commit/0cdb65bbb3e7b9d75eb393ee87e3718bcd6af4b3))
# [2.4.0](https://github.com/revanced/revanced-patches/compare/v2.3.1...v2.4.0) (2022-06-30)
### Features
* add youtube version 17.25.34 ([#85](https://github.com/revanced/revanced-patches/issues/85)) ([889c9d5](https://github.com/revanced/revanced-patches/commit/889c9d564d16c6e68a52095a4fc8e6d04346c9e9))
## [2.3.1](https://github.com/revanced/revanced-patches/compare/v2.3.0...v2.3.1) (2022-06-30)
### Bug Fixes
* change fingerprint to work on latest youtube ([#80](https://github.com/revanced/revanced-patches/issues/80)) ([4dba323](https://github.com/revanced/revanced-patches/commit/4dba323ddf8980cd2b0908a0de41c4b4dea6b0d7))
# [2.3.0](https://github.com/revanced/revanced-patches/compare/v2.2.0...v2.3.0) (2022-06-30)
### Features
* `disable-autoplay-button` patch ([#79](https://github.com/revanced/revanced-patches/issues/79)) ([0d6fb51](https://github.com/revanced/revanced-patches/commit/0d6fb51e025649aae37e230778ea367482fab0d7))
# [2.2.0](https://github.com/revanced/revanced-patches/compare/v2.1.0...v2.2.0) (2022-06-29)
### Features
* make resource mapping patch aware of types ([#77](https://github.com/revanced/revanced-patches/issues/77)) ([188491a](https://github.com/revanced/revanced-patches/commit/188491a707abccc1164413f075d8a66c145a1455))
# [2.1.0](https://github.com/revanced/revanced-patches/compare/v2.0.3...v2.1.0) (2022-06-28)
### Features
* `custom-playback-speed` patch ([#50](https://github.com/revanced/revanced-patches/issues/50)) ([224254b](https://github.com/revanced/revanced-patches/commit/224254bcce2b394bbfd2549089f0204ce4ed4a89))
## [2.0.3](https://github.com/revanced/revanced-patches/compare/v2.0.2...v2.0.3) (2022-06-27)
### Bug Fixes
* check if resource files exist ([ba1f3af](https://github.com/revanced/revanced-patches/commit/ba1f3af99be58edc44ed1b8f1875508d5034efd8))
## [2.0.2](https://github.com/revanced/revanced-patches/compare/v2.0.1...v2.0.2) (2022-06-27)
### Bug Fixes
* some more refactoring of integrations, add hide-watermark patch ([#63](https://github.com/revanced/revanced-patches/issues/63)) ([feb09c5](https://github.com/revanced/revanced-patches/commit/feb09c56f475e2537a67d3636b08737848158a8e))
## [2.0.1](https://github.com/revanced/revanced-patches/compare/v2.0.0...v2.0.1) (2022-06-26)
### Bug Fixes
* invalid string in strings list ([f08b53b](https://github.com/revanced/revanced-patches/commit/f08b53b07d93bd8ac6e7da376ea6e6023e53076e))
* migrate to new `proxy` api ([db32ffe](https://github.com/revanced/revanced-patches/commit/db32ffe56a8e73177bef724ee10eda9a28b367b8))
# [2.0.0](https://github.com/revanced/revanced-patches/compare/v1.11.0...v2.0.0) (2022-06-26)
### Code Refactoring
* migrate from `Signature` to `Fingerprint` ([084078e](https://github.com/revanced/revanced-patches/commit/084078e7f1852ccd2045e3fa8aedc25a7fd5faa8))
### BREAKING CHANGES
* Not backwards compatible, since a lot of classes where renamed.
# [1.11.0](https://github.com/revanced/revanced-patches/compare/v1.10.5...v1.11.0) (2022-06-26)
### Features
* add youtube version 17.24.35 ([ec626cc](https://github.com/revanced/revanced-patches/commit/ec626ccfa2bcf14b722d08110382de009a1c12b4))
* add youtube version 17.24.35 ([adc60a6](https://github.com/revanced/revanced-patches/commit/adc60a6fa09f6a21800ba51b8ca888d11a17e870))
## [1.10.5](https://github.com/revanced/revanced-patches/compare/v1.10.4...v1.10.5) (2022-06-25)
### Bug Fixes
* put back proper variable ([#61](https://github.com/revanced/revanced-patches/issues/61)) ([d26c423](https://github.com/revanced/revanced-patches/commit/d26c4233031fd418eb37c8f05e9bc1857e0572e6))
## [1.10.4](https://github.com/revanced/revanced-patches/compare/v1.10.3...v1.10.4) (2022-06-23)
### Bug Fixes
* missing brackets at inlining ([8936c8a](https://github.com/revanced/revanced-patches/commit/8936c8aaedb56817cda5eec5f4a8c32f433862aa))
## [1.10.3](https://github.com/revanced/revanced-patches/compare/v1.10.2...v1.10.3) (2022-06-23)
### Bug Fixes
* get create button view register by more reliable means ([#59](https://github.com/revanced/revanced-patches/issues/59)) ([6ab821e](https://github.com/revanced/revanced-patches/commit/6ab821e377176f4e9f1b7ec2b58a924fa40299db))
## [1.10.2](https://github.com/revanced/revanced-patches/compare/v1.10.1...v1.10.2) (2022-06-23)
### Bug Fixes
* `disable-create-button` not working with prebuilt jar file ([#55](https://github.com/revanced/revanced-patches/issues/55)) ([78be64a](https://github.com/revanced/revanced-patches/commit/78be64accc2023281c0c376849cdb0213622dc5c))
## [1.10.1](https://github.com/revanced/revanced-patches/compare/v1.10.0...v1.10.1) (2022-06-23)
### Bug Fixes
* patcher not propagating dexlib ([980c486](https://github.com/revanced/revanced-patches/commit/980c48673259496d793bc7f864ad355188dcf7b6))
* update patcher version ([e3d0bb7](https://github.com/revanced/revanced-patches/commit/e3d0bb7ee1923ea996cf637267c62d233a74c7fa))
# [1.10.0](https://github.com/revanced/revanced-patches/compare/v1.9.1...v1.10.0) (2022-06-23)
### Features
* add compatibility for YouTube v17.23.36 and v17.24.34 ([1812bc3](https://github.com/revanced/revanced-patches/commit/1812bc39e0e88f1ab02ae8127e9000780eedf49c))
## [1.9.1](https://github.com/revanced/revanced-patches/compare/v1.9.0...v1.9.1) (2022-06-21)
### Bug Fixes
* update patcher version ([5f54bc9](https://github.com/revanced/revanced-patches/commit/5f54bc9aa8fd8b83448141a9b05746e3e977369d))
# [1.9.0](https://github.com/revanced/revanced-patches/compare/v1.8.2...v1.9.0) (2022-06-21)
### Features
* use `install` mode by default ([c2b2993](https://github.com/revanced/revanced-patches/commit/c2b299336a984d66a2d066e5ebe9c4f9bee5c2aa))
## [1.8.2](https://github.com/revanced/revanced-patches/compare/v1.8.1...v1.8.2) (2022-06-20)
### Bug Fixes
* migrate to breaking changes from patcher ([2c0a419](https://github.com/revanced/revanced-patches/commit/2c0a4196fed2fbdcd454ed882b720898d3050c51))
* old usage of `toInstructions` extension method ([65ddd52](https://github.com/revanced/revanced-patches/commit/65ddd522dca19e0590d9cb6fdb2d85ad7b98481e))
## [1.8.1](https://github.com/revanced/revanced-patches/compare/v1.8.0...v1.8.1) (2022-06-20)
### Bug Fixes
* add execute permission to `./gradlew` file ([ff7a560](https://github.com/revanced/revanced-patches/commit/ff7a5602f68428111fea6c60cbea694592039ef1))
# [1.8.0](https://github.com/revanced/revanced-patches/compare/v1.7.0...v1.8.0) (2022-06-20)
### Features
* bump compatibility of patches for Youtube to v17.23.35 ([3748d05](https://github.com/revanced/revanced-patches/commit/3748d0533e62a8871ab2202ce9b61170a90dae62))
# [1.7.0](https://github.com/revanced/revanced-patches/compare/v1.6.4...v1.7.0) (2022-06-20)
### Features
* `disable-fullscreen-panels` patch ([3bf0561](https://github.com/revanced/revanced-patches/commit/3bf056163500b006d1a20c5f3a3e0c92fec13bd8))
## [1.6.4](https://github.com/revanced/revanced-patches/compare/v1.6.3...v1.6.4) (2022-06-19)
### Bug Fixes
* update patcher version ([#35](https://github.com/revanced/revanced-patches/issues/35)) ([1a379df](https://github.com/revanced/revanced-patches/commit/1a379dfd974b9f92d4bd0d5d7a4711eb6d1060b3)), closes [#34](https://github.com/revanced/revanced-patches/issues/34)
## [1.6.3](https://github.com/revanced/revanced-patches/compare/v1.6.2...v1.6.3) (2022-06-16)
### Bug Fixes
* wrong dex path ([170fbbb](https://github.com/revanced/revanced-patches/commit/170fbbb99e4a2dbe3e0febe44d07a692aa9d7224))
## [1.6.2](https://github.com/revanced/revanced-patches/compare/v1.6.1...v1.6.2) (2022-06-16)
### Bug Fixes
* broken gradle task ([91483a8](https://github.com/revanced/revanced-patches/commit/91483a8fbf92559d079dc52f846f5f871f5d6b5c))
## [1.6.1](https://github.com/revanced/revanced-patches/compare/v1.6.0...v1.6.1) (2022-06-16)
### Bug Fixes
* broken gradle task ([4d07961](https://github.com/revanced/revanced-patches/commit/4d07961c8afd24da7f8879d11419147f2e100f05))
# [1.6.0](https://github.com/revanced/revanced-patches/compare/v1.5.3...v1.6.0) (2022-06-16)
### Bug Fixes
* broken gradle task ([28e3f55](https://github.com/revanced/revanced-patches/commit/28e3f554ea6a7144416523fe48ce7adbb613b263))
### Features
* generate dex files using gradle task ([c34c1be](https://github.com/revanced/revanced-patches/commit/c34c1be21f50b4f720a7cd81e0dfe5ef6330caab))
## [1.5.3](https://github.com/revanced/revanced-patches/compare/v1.5.2...v1.5.3) (2022-06-16) ## [1.5.3](https://github.com/revanced/revanced-patches/compare/v1.5.2...v1.5.3) (2022-06-16)

View File

@@ -1,2 +1 @@
# revanced-patches Repo for all ReVanced patches
Repo for all ReVanced patches

View File

@@ -4,13 +4,17 @@ plugins {
group = "app.revanced" group = "app.revanced"
val githubUsername: String = project.findProperty("gpr.user") as? String ?: System.getenv("GITHUB_ACTOR")
val githubPassword: String = project.findProperty("gpr.key") as? String ?: System.getenv("GITHUB_TOKEN")
repositories { repositories {
mavenCentral() mavenCentral()
mavenLocal()
maven { maven {
url = uri("https://maven.pkg.github.com/revanced/revanced-patcher") url = uri("https://maven.pkg.github.com/revanced/revanced-patcher")
credentials { credentials {
username = project.findProperty("gpr.user") as? String ?: System.getenv("GITHUB_ACTOR") username = githubUsername
password = project.findProperty("gpr.key") as? String ?: System.getenv("GITHUB_TOKEN") password = githubPassword
} }
} }
} }
@@ -18,16 +22,39 @@ repositories {
dependencies { dependencies {
implementation(kotlin("stdlib")) implementation(kotlin("stdlib"))
implementation("app.revanced:revanced-patcher:1.1.0") implementation("app.revanced:revanced-patcher:2.1.2")
implementation("app.revanced:multidexlib2:2.5.2.r2")
} }
tasks { tasks {
register<DefaultTask>("generateDex") {
description = "Generate dex files from build"
dependsOn(build)
doLast {
val androidHome = System.getenv("ANDROID_HOME") ?: throw GradleException("ANDROID_HOME not found")
val d8 = "${androidHome}/build-tools/32.0.0/d8"
val input = configurations.archives.get().allArtifacts.files.files.first().absolutePath
val output = input.replace(".jar", ".dex")
val work = File("${buildDir}/libs")
exec {
workingDir = work
commandLine = listOf(d8, input)
}
exec {
workingDir = work
commandLine = listOf("mv", "classes.dex", output)
}
}
}
// Dummy task to fix the Gradle semantic-release plugin. // Dummy task to fix the Gradle semantic-release plugin.
// Remove this if you forked it to support building only. // Remove this if you forked it to support building only.
// Tracking issue: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435 // Tracking issue: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435
register<DefaultTask>("publish") { register<DefaultTask>("publish") {
group = "publish" group = "publish"
description = "Dummy task" description = "Dummy task"
dependsOn(build) dependsOn(named("generateDex"))
} }
} }

View File

@@ -1,2 +1,2 @@
kotlin.code.style = official kotlin.code.style = official
version = 1.5.3 version = 2.6.0-dev.2

0
gradlew vendored Normal file → Executable file
View File

View File

@@ -10,7 +10,7 @@ internal fun MutableMethodImplementation.injectHideCall(
) { ) {
this.addInstruction( this.addInstruction(
index, index,
"invoke-static { v$register }, Lfi/razerman/youtube/XAdRemover;->HideView(Landroid/view/View;)V".toInstruction() "invoke-static { v$register }, Lapp/revanced/integrations/patches/HideHomeAdsPatch;->HideHomeAds(Landroid/view/View;)V".toInstruction()
) )
} }

View File

@@ -1,16 +1,16 @@
package app.revanced.patches.music.audio.codecs.signatures package app.revanced.patches.music.audio.codecs.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher. fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.music.audio.codecs.annotations.CodecsUnlockCompatibility import app.revanced.patches.music.audio.codecs.annotations.CodecsUnlockCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("all-codecs-reference-signature") @Name("all-codecs-reference-fingerprint")
@MatchingMethod( @MatchingMethod(
"Laari;", "Laari;",
"b", "b",
@@ -18,7 +18,7 @@ import org.jf.dexlib2.Opcode
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@CodecsUnlockCompatibility @CodecsUnlockCompatibility
@Version("0.0.1") @Version("0.0.1")
object AllCodecsReferenceSignature : MethodSignature( object AllCodecsReferenceFingerprint : MethodFingerprint(
"J", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L"), listOf( "J", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L"), listOf(
Opcode.INVOKE_STATIC, Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT, Opcode.MOVE_RESULT_OBJECT,

View File

@@ -1,16 +1,16 @@
package app.revanced.patches.music.audio.codecs.signatures package app.revanced.patches.music.audio.codecs.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.music.audio.codecs.annotations.CodecsUnlockCompatibility import app.revanced.patches.music.audio.codecs.annotations.CodecsUnlockCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("codec-lock-signature") @Name("codec-lock-fingerprint")
@MatchingMethod( @MatchingMethod(
"Labwj;", "Labwj;",
"a", "a",
@@ -18,7 +18,7 @@ import org.jf.dexlib2.Opcode
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@CodecsUnlockCompatibility @CodecsUnlockCompatibility
@Version("0.0.1") @Version("0.0.1")
object CodecsLockSignature : MethodSignature( object CodecsLockFingerprint : MethodFingerprint(
"L", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L", "L", "L", "L"), listOf( "L", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L", "L", "L", "L"), listOf(
Opcode.INVOKE_STATIC, Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT, Opcode.MOVE_RESULT_OBJECT,

View File

@@ -3,16 +3,16 @@ package app.revanced.patches.music.audio.codecs.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.data.implementation.toMethodWalker import app.revanced.patcher.data.impl.toMethodWalker
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.util.smali.toInstruction import app.revanced.patcher.util.smali.toInstruction
import app.revanced.patches.music.audio.codecs.annotations.CodecsUnlockCompatibility import app.revanced.patches.music.audio.codecs.annotations.CodecsUnlockCompatibility
import app.revanced.patches.music.audio.codecs.signatures.AllCodecsReferenceSignature import app.revanced.patches.music.audio.codecs.fingerprints.AllCodecsReferenceFingerprint
import app.revanced.patches.music.audio.codecs.signatures.CodecsLockSignature import app.revanced.patches.music.audio.codecs.fingerprints.CodecsLockFingerprint
@Patch @Patch
@Name("codecs-unlock") @Name("codecs-unlock")
@@ -21,19 +21,19 @@ import app.revanced.patches.music.audio.codecs.signatures.CodecsLockSignature
@Version("0.0.1") @Version("0.0.1")
class CodecsUnlockPatch : BytecodePatch( class CodecsUnlockPatch : BytecodePatch(
listOf( listOf(
CodecsLockSignature, AllCodecsReferenceSignature CodecsLockFingerprint, AllCodecsReferenceFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
var result = signatures.first().result!! var result = CodecsLockFingerprint.result!!
val implementation = result.method.implementation!! val implementation = result.mutableMethod.implementation!!
val instructionIndex = result.scanResult.startIndex val instructionIndex = result.patternScanResult!!.startIndex
result = signatures.last().result!! result = AllCodecsReferenceFingerprint.result!!
val codecMethod = val codecMethod =
data.toMethodWalker(result.immutableMethod).nextMethod(result.scanResult.startIndex).getMethod() data.toMethodWalker(result.method).nextMethod(result.patternScanResult!!.startIndex).getMethod()
implementation.replaceInstruction( implementation.replaceInstruction(
instructionIndex, instructionIndex,

View File

@@ -0,0 +1,43 @@
package app.revanced.patches.music.audio.exclusiveaudio.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.audio.exclusiveaudio.annotations.ExclusiveAudioCompatibility
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@Name("audio-only-enabler-fingerprint")
@MatchingMethod(
"Lgmd;",
"d"
)
@DirectPatternScanMethod
@ExclusiveAudioCompatibility
@Version(
"0.0.1"
)
object AudioOnlyEnablerFingerprint: MethodFingerprint(
"Z", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf(), listOf(
Opcode.IGET_OBJECT,
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT_OBJECT,
Opcode.IGET_OBJECT,
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST,
Opcode.IF_NEZ,
Opcode.IGET_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT,
Opcode.GOTO,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT,
Opcode.RETURN
)
)

View File

@@ -1,23 +1,23 @@
package app.revanced.patches.music.audio.exclusiveaudio.signatures package app.revanced.patches.music.audio.exclusiveaudio.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.music.audio.exclusiveaudio.annotations.ExclusiveAudioCompatibility import app.revanced.patches.music.audio.exclusiveaudio.annotations.ExclusiveAudioCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("exclusive-audio-signature") @Name("exclusive-audio-fingerprints")
@MatchingMethod( @MatchingMethod(
"Lgmd;", "c" "Lgmd;", "c"
) )
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@ExclusiveAudioCompatibility @ExclusiveAudioCompatibility
@Version("0.0.1") @Version("0.0.1")
object ExclusiveAudioSignature : MethodSignature( object ExclusiveAudioFingerprint : MethodFingerprint(
"V", "V",
AccessFlags.PUBLIC or AccessFlags.FINAL, AccessFlags.PUBLIC or AccessFlags.FINAL,
listOf("L", "Z"), listOf("L", "Z"),

View File

@@ -3,21 +3,17 @@ package app.revanced.patches.music.audio.exclusiveaudio.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultError
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patcher.signature.implementation.method.MethodSignature
import app.revanced.patcher.signature.implementation.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod
import app.revanced.patcher.util.smali.toInstruction
import app.revanced.patches.music.audio.exclusiveaudio.annotations.ExclusiveAudioCompatibility import app.revanced.patches.music.audio.exclusiveaudio.annotations.ExclusiveAudioCompatibility
import app.revanced.patches.music.audio.exclusiveaudio.signatures.ExclusiveAudioSignature import app.revanced.patches.music.audio.exclusiveaudio.fingerprints.AudioOnlyEnablerFingerprint
import org.jf.dexlib2.AccessFlags import app.revanced.patches.music.audio.exclusiveaudio.fingerprints.ExclusiveAudioFingerprint
import org.jf.dexlib2.Opcode
@Patch @Patch
@Name("exclusive-audio-playback") @Name("exclusive-audio-playback")
@@ -26,45 +22,16 @@ import org.jf.dexlib2.Opcode
@Version("0.0.1") @Version("0.0.1")
class ExclusiveAudioPatch : BytecodePatch( class ExclusiveAudioPatch : BytecodePatch(
listOf( listOf(
ExclusiveAudioSignature ExclusiveAudioFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
val result = signatures.first().result!!.findParentMethod(@Name("audio-only-enabler-method") @MatchingMethod( ExclusiveAudioFingerprint.resolve(data, AudioOnlyEnablerFingerprint.result!!.classDef)
"Lgmd;",
"d"
) @DirectPatternScanMethod @ExclusiveAudioCompatibility @Version(
"0.0.1"
) object : MethodSignature(
"Z", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf(), listOf(
Opcode.IGET_OBJECT,
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT_OBJECT,
Opcode.IGET_OBJECT,
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST,
Opcode.IF_NEZ,
Opcode.IGET_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT,
Opcode.GOTO,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT,
Opcode.RETURN
)
) {}) ?: return PatchResultError("Required parent method could not be found.")
val implementation = result.method.implementation!! val method = ExclusiveAudioFingerprint.result!!.mutableMethod
implementation.replaceInstruction( method.replaceInstruction(method.implementation!!.instructions.count() - 1, "const/4 v0, 0x1")
implementation.instructions.count() - 1, "const/4 v0, 0x1".toInstruction() method.addInstruction("return v0")
)
implementation.addInstruction(
"return v0".toInstruction()
)
return PatchResultSuccess() return PatchResultSuccess()
} }
} }

View File

@@ -1,23 +1,23 @@
package app.revanced.patches.music.layout.tastebuilder.signatures package app.revanced.patches.music.layout.tastebuilder.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.music.layout.tastebuilder.annotations.RemoveTasteBuilderCompatibility import app.revanced.patches.music.layout.tastebuilder.annotations.RemoveTasteBuilderCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("taste-builder-constructor") @Name("taste-builder-constructor-fingerprint")
@MatchingMethod( @MatchingMethod(
"Lkyu;", "<init>" "Lkyu;", "<init>"
) )
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@RemoveTasteBuilderCompatibility @RemoveTasteBuilderCompatibility
@Version("0.0.1") @Version("0.0.1")
object TasteBuilderConstructorSignature : MethodSignature( object TasteBuilderConstructorFingerprint : MethodFingerprint(
"V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("L", "L", "L", "L"), listOf( "V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("L", "L", "L", "L"), listOf(
Opcode.INVOKE_DIRECT, Opcode.INVOKE_DIRECT,
Opcode.INVOKE_VIRTUAL, Opcode.INVOKE_VIRTUAL,

View File

@@ -3,15 +3,14 @@ package app.revanced.patches.music.layout.tastebuilder.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.music.layout.tastebuilder.annotations.RemoveTasteBuilderCompatibility import app.revanced.patches.music.layout.tastebuilder.annotations.RemoveTasteBuilderCompatibility
import app.revanced.patches.music.layout.tastebuilder.signatures.TasteBuilderConstructorSignature import app.revanced.patches.music.layout.tastebuilder.fingerprints.TasteBuilderConstructorFingerprint
import org.jf.dexlib2.iface.instruction.formats.Instruction22c import org.jf.dexlib2.iface.instruction.formats.Instruction22c
@Patch @Patch
@@ -21,24 +20,20 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction22c
@Version("0.0.1") @Version("0.0.1")
class RemoveTasteBuilderPatch : BytecodePatch( class RemoveTasteBuilderPatch : BytecodePatch(
listOf( listOf(
TasteBuilderConstructorSignature TasteBuilderConstructorFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
val result = signatures.first().result!! val result = TasteBuilderConstructorFingerprint.result!!
val implementation = result.method.implementation!! val method = result.mutableMethod
val insertIndex = result.scanResult.endIndex - 8 val insertIndex = result.patternScanResult!!.endIndex - 8
val register = (method.implementation!!.instructions[insertIndex] as Instruction22c).registerA
val register = (implementation.instructions[insertIndex] as Instruction22c).registerA method.addInstructions(
insertIndex, """
val instructionList = """
const/16 v1, 0x8 const/16 v1, 0x8
invoke-virtual {v${register}, v1}, Landroid/view/View;->setVisibility(I)V invoke-virtual {v${register}, v1}, Landroid/view/View;->setVisibility(I)V
""".trimIndent().toInstructions().toMutableList() """
implementation.addInstructions(
insertIndex, instructionList
) )
return PatchResultSuccess() return PatchResultSuccess()

View File

@@ -1,23 +1,23 @@
package app.revanced.patches.music.layout.upgradebutton.signatures package app.revanced.patches.music.layout.upgradebutton.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.music.layout.upgradebutton.annotations.RemoveUpgradeButtonCompatibility import app.revanced.patches.music.layout.upgradebutton.annotations.RemoveUpgradeButtonCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("pivot-bar-constructor") @Name("pivot-bar-constructor-fingerprint")
@MatchingMethod( @MatchingMethod(
"Lhfu;", "<init2>" "Lhfu;", "<init2>"
) )
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@RemoveUpgradeButtonCompatibility @RemoveUpgradeButtonCompatibility
@Version("0.0.1") @Version("0.0.1")
object PivotBarConstructorSignature : MethodSignature( object PivotBarConstructorFingerprint : MethodFingerprint(
"V", "V",
AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
listOf("L", "Z"), listOf("L", "Z"),

View File

@@ -3,15 +3,15 @@ package app.revanced.patches.music.layout.upgradebutton.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.util.smali.toInstructions import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.music.layout.upgradebutton.annotations.RemoveUpgradeButtonCompatibility import app.revanced.patches.music.layout.upgradebutton.annotations.RemoveUpgradeButtonCompatibility
import app.revanced.patches.music.layout.upgradebutton.signatures.PivotBarConstructorSignature import app.revanced.patches.music.layout.upgradebutton.fingerprints.PivotBarConstructorFingerprint
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
import org.jf.dexlib2.builder.instruction.BuilderInstruction22t import org.jf.dexlib2.builder.instruction.BuilderInstruction22t
import org.jf.dexlib2.iface.instruction.formats.Instruction22c import org.jf.dexlib2.iface.instruction.formats.Instruction22c
@@ -25,15 +25,15 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction35c
@Version("0.0.1") @Version("0.0.1")
class RemoveUpgradeButtonPatch : BytecodePatch( class RemoveUpgradeButtonPatch : BytecodePatch(
listOf( listOf(
PivotBarConstructorSignature PivotBarConstructorFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
val result = signatures.first().result!! val result = PivotBarConstructorFingerprint.result!!
val implementation = result.method.implementation!! val implementation = result.mutableMethod.implementation!!
val pivotBarElementFieldRef = val pivotBarElementFieldRef =
(implementation.instructions[result.scanResult.endIndex - 1] as Instruction22c).reference (implementation.instructions[result.patternScanResult!!.endIndex - 1] as Instruction22c).reference
val register = (implementation.instructions.first() as Instruction35c).registerC val register = (implementation.instructions.first() as Instruction35c).registerC
// first compile all the needed instructions // first compile all the needed instructions
@@ -43,19 +43,19 @@ class RemoveUpgradeButtonPatch : BytecodePatch(
const/4 v2, 0x3 const/4 v2, 0x3
invoke-interface {v0, v2}, Ljava/util/List;->remove(I)Ljava/lang/Object; invoke-interface {v0, v2}, Ljava/util/List;->remove(I)Ljava/lang/Object;
iput-object v0, v$register, $pivotBarElementFieldRef iput-object v0, v$register, $pivotBarElementFieldRef
""".trimIndent().toInstructions().toMutableList() """.toInstructions().toMutableList()
// replace the instruction to retain the label at given index // replace the instruction to retain the label at given index
implementation.replaceInstruction( implementation.replaceInstruction(
result.scanResult.endIndex - 1, instructionList[0] // invoke-interface result.patternScanResult!!.endIndex - 1, instructionList[0] // invoke-interface
) )
// do not forget to remove this instruction since we added it already // do not forget to remove this instruction since we added it already
instructionList.removeFirst() instructionList.removeFirst()
val exitInstruction = instructionList.last() // iput-object val exitInstruction = instructionList.last() // iput-object
implementation.addInstruction( implementation.addInstruction(
result.scanResult.endIndex, exitInstruction result.patternScanResult!!.endIndex, exitInstruction
) )
// do not forget to remove this instruction since we added it already // do not forget to remove this instruction since we added it already
instructionList.removeLast() instructionList.removeLast()
@@ -64,12 +64,12 @@ class RemoveUpgradeButtonPatch : BytecodePatch(
instructionList.add( instructionList.add(
2, // if-le 2, // if-le
BuilderInstruction22t( BuilderInstruction22t(
Opcode.IF_LE, 1, 2, implementation.newLabelForIndex(result.scanResult.endIndex) Opcode.IF_LE, 1, 2, implementation.newLabelForIndex(result.patternScanResult!!.endIndex)
) )
) )
implementation.addInstructions( implementation.addInstructions(
result.scanResult.endIndex, instructionList result.patternScanResult!!.endIndex, instructionList
) )
return PatchResultSuccess() return PatchResultSuccess()
} }

View File

@@ -1,23 +1,23 @@
package app.revanced.patches.music.premium.backgroundplay.signatures package app.revanced.patches.music.premium.backgroundplay.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.music.premium.backgroundplay.annotations.BackgroundPlayCompatibility import app.revanced.patches.music.premium.backgroundplay.annotations.BackgroundPlayCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("background-playback-disabler-signature") @Name("background-playback-disabler-fingerprint")
@MatchingMethod( @MatchingMethod(
"Lafgf;", "e" "Lafgf;", "e"
) )
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@BackgroundPlayCompatibility @BackgroundPlayCompatibility
@Version("0.0.1") @Version("0.0.1")
object BackgroundPlaybackDisableSignature : MethodSignature( object BackgroundPlaybackDisableFingerprint : MethodFingerprint(
"Z", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L"), listOf( "Z", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L"), listOf(
Opcode.CONST_4, Opcode.CONST_4,
Opcode.IF_EQZ, Opcode.IF_EQZ,

View File

@@ -3,15 +3,14 @@ package app.revanced.patches.music.premium.backgroundplay.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.music.premium.backgroundplay.annotations.BackgroundPlayCompatibility import app.revanced.patches.music.premium.backgroundplay.annotations.BackgroundPlayCompatibility
import app.revanced.patches.music.premium.backgroundplay.signatures.BackgroundPlaybackDisableSignature import app.revanced.patches.music.premium.backgroundplay.fingerprints.BackgroundPlaybackDisableFingerprint
@Patch @Patch
@Name("background-play") @Name("background-play")
@@ -20,16 +19,16 @@ import app.revanced.patches.music.premium.backgroundplay.signatures.BackgroundPl
@Version("0.0.1") @Version("0.0.1")
class BackgroundPlayPatch : BytecodePatch( class BackgroundPlayPatch : BytecodePatch(
listOf( listOf(
BackgroundPlaybackDisableSignature BackgroundPlaybackDisableFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
signatures.first().result!!.method.implementation!!.addInstructions( BackgroundPlaybackDisableFingerprint.result!!.mutableMethod.addInstructions(
0, 0,
""" """
const/4 v0, 0x1 const/4 v0, 0x1
return v0 return v0
""".trimIndent().toInstructions() """
) )
return PatchResultSuccess() return PatchResultSuccess()

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.19.36", "17.20.37", "17.22.36") "com.google.android.youtube", arrayOf("17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34","17.24.35","17.25.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -2,7 +2,7 @@ package app.revanced.patches.youtube.ad.general.bytecode.extensions
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.softCompareTo import app.revanced.patcher.extensions.softCompareTo
import app.revanced.patcher.patch.implementation.misc.PatchResultError import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.util.proxy.mutableTypes.MutableClass import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import org.jf.dexlib2.builder.BuilderInstruction import org.jf.dexlib2.builder.BuilderInstruction

View File

@@ -4,15 +4,14 @@ import app.revanced.extensions.injectHideCall
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.data.implementation.proxy
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Dependencies import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultError
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patcher.util.proxy.mutableTypes.MutableClass import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patcher.util.smali.toInstructions import app.revanced.patcher.util.smali.toInstructions
@@ -22,7 +21,6 @@ import app.revanced.patches.youtube.ad.general.bytecode.extensions.MethodExtensi
import app.revanced.patches.youtube.ad.general.bytecode.extensions.MethodExtensions.insertBlocks import app.revanced.patches.youtube.ad.general.bytecode.extensions.MethodExtensions.insertBlocks
import app.revanced.patches.youtube.ad.general.bytecode.extensions.MethodExtensions.toDescriptor import app.revanced.patches.youtube.ad.general.bytecode.extensions.MethodExtensions.toDescriptor
import app.revanced.patches.youtube.ad.general.bytecode.utils.MethodUtils.createMutableMethod import app.revanced.patches.youtube.ad.general.bytecode.utils.MethodUtils.createMutableMethod
import app.revanced.patches.youtube.ad.general.resource.patch.GeneralResourceAdsPatch
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.mapping.patch.ResourceIdMappingProviderResourcePatch import app.revanced.patches.youtube.misc.mapping.patch.ResourceIdMappingProviderResourcePatch
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@@ -41,7 +39,7 @@ import org.jf.dexlib2.immutable.reference.ImmutableMethodReference
@Patch @Patch
@Dependencies( @Dependencies(
dependencies = [ResourceIdMappingProviderResourcePatch::class, IntegrationsPatch::class, GeneralResourceAdsPatch::class] dependencies = [ResourceIdMappingProviderResourcePatch::class, IntegrationsPatch::class]
) )
@Name("general-ads") @Name("general-ads")
@Description("Patch to remove general ads in bytecode.") @Description("Patch to remove general ads in bytecode.")
@@ -63,8 +61,8 @@ class GeneralBytecodeAdsPatch : BytecodePatch(
"endscreen_element_layout_icon", "endscreen_element_layout_icon",
"promoted_video_item_land", "promoted_video_item_land",
"promoted_video_item_full_bleed", "promoted_video_item_full_bleed",
).map { ).map { name ->
ResourceIdMappingProviderResourcePatch.resourceMappings[it]!! ResourceIdMappingProviderResourcePatch.resourceMappings.first { it.name == name }.id
} }
private val stringReferences = arrayOf( private val stringReferences = arrayOf(
@@ -148,11 +146,11 @@ class GeneralBytecodeAdsPatch : BytecodePatch(
mutableClass!!.findMutableMethodOf(method) mutableClass!!.findMutableMethodOf(method)
// TODO: dynamically get registers // TODO: dynamically get registers
mutableMethod!!.implementation!!.addInstructions( mutableMethod!!.addInstructions(
insertIndex, """ insertIndex, """
const/16 v1, 0x8 const/16 v1, 0x8
invoke-virtual {v0,v1}, Landroid/widget/FrameLayout;->setVisibility(I)V invoke-virtual {v0,v1}, Landroid/widget/FrameLayout;->setVisibility(I)V
""".trimIndent().toInstructions() """
) )
} }
@@ -242,25 +240,23 @@ class GeneralBytecodeAdsPatch : BytecodePatch(
BuilderInstruction21t(Opcode.IF_EQZ, 1, lithoRemoveLabel) BuilderInstruction21t(Opcode.IF_EQZ, 1, lithoRemoveLabel)
// create blocks // create blocks
val parameters = lithoMethod.parameterTypes.joinToString("") { it }
val registers = lithoMethodImplementation.registerCount
val block1 = """ val block1 = """
invoke-static/range {p3}, $thisType->getTemplateName($templateNameParameterType)Ljava/lang/String; invoke-static/range {p3}, $thisType->getTemplateName($templateNameParameterType)Ljava/lang/String;
move-result-object v0 move-result-object v0
""".trimIndent().toInstructions(parameters, registers, false) """.toInstructions(lithoMethod)
val block2 = """ val block2 = """
move-object/from16 v1, p3 move-object/from16 v1, p3
iget-object v2, v1, $templateNameParameterType->b:Ljava/nio/ByteBuffer; iget-object v2, v1, $templateNameParameterType->b:Ljava/nio/ByteBuffer;
invoke-static {v0, v2}, Lfi/razerman/youtube/litho/LithoAdRemoval;->containsAd(Ljava/lang/String;Ljava/nio/ByteBuffer;)Z invoke-static {v0, v2}, Lapp/revanced/integrations/patches/GeneralBytecodeAdsPatch;->containsAd(Ljava/lang/String;Ljava/nio/ByteBuffer;)Z
move-result v1 move-result v1
""".trimIndent().toInstructions(parameters, registers, false) """.toInstructions(lithoMethod)
val block3 = """ val block3 = """
move-object/from16 v2, p1 move-object/from16 v2, p1
invoke-static {v2}, $descriptor1 invoke-static {v2}, $descriptor1
move-result-object v0 move-result-object v0
iget-object v0, v0, $descriptor2 iget-object v0, v0, $descriptor2
return-object v0 return-object v0
""".trimIndent().toInstructions(parameters, registers, false) """.toInstructions(lithoMethod)
// insert blocks and branch instructions // insert blocks and branch instructions
lithoMethodImplementation.insertBlocks( lithoMethodImplementation.insertBlocks(
@@ -371,7 +367,7 @@ class GeneralBytecodeAdsPatch : BytecodePatch(
const v0, $lithoConstant const v0, $lithoConstant
invoke-static {p0, v0}, ${descriptors[1]} invoke-static {p0, v0}, ${descriptors[1]}
move-result-object p0 move-result-object p0
""".trimIndent().toInstructions() """.toInstructions()
val block2 = """ val block2 = """
invoke-static {p0}, ${descriptors[2]} invoke-static {p0}, ${descriptors[2]}
move-result-object p0 move-result-object p0
@@ -379,12 +375,12 @@ class GeneralBytecodeAdsPatch : BytecodePatch(
move-result-object v0 move-result-object v0
invoke-static {v0}, ${this.type}->getIsEmpty(Ljava/lang/String;)Z invoke-static {v0}, ${this.type}->getIsEmpty(Ljava/lang/String;)Z
move-result v0 move-result v0
""".trimIndent().toInstructions() """.toInstructions()
val block3 = """ val block3 = """
invoke-virtual {p0}, ${descriptors[3]} invoke-virtual {p0}, ${descriptors[3]}
move-result-object p0 move-result-object p0
return-object p0 return-object p0
""".trimIndent().toInstructions() """.toInstructions()
// create target instruction // create target instruction
val targetInstruction = BuilderInstruction11n(Opcode.CONST_4, 1, 0) val targetInstruction = BuilderInstruction11n(Opcode.CONST_4, 1, 0)

View File

@@ -1,60 +0,0 @@
package app.revanced.patches.youtube.ad.general.resource.patch
import app.revanced.extensions.doRecursively
import app.revanced.extensions.startsWithAny
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.ResourceData
import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.implementation.ResourcePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patches.youtube.ad.general.annotation.GeneralAdsCompatibility
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
import org.w3c.dom.Element
@Dependencies(dependencies = [FixLocaleConfigErrorPatch::class])
@Name("general-resource-ads")
@Description("Patch to remove general ads in resources.")
@GeneralAdsCompatibility
@Version("0.0.1")
class GeneralResourceAdsPatch : ResourcePatch() {
// list of resource file names which need to be hidden
private val resourceFileNames = arrayOf(
"compact_promoted_video_item.xml",
"inline_muted_metadata_swap.xml",
"interstitial_promo_view.xml",
"pip_ad_overlay.xml",
"promoted_",
"watch_metadata_companion_cards.xml",
//"watch_while_activity.xml" // FIXME: find out why patching this resource fails
)
// the attributes to change the value of
private val replacements = arrayOf(
"height",
"width",
"marginTop",
)
override fun execute(data: ResourceData): PatchResult {
data.forEach {
if (!it.name.startsWithAny(*resourceFileNames)) return@forEach
// for each file in the "layouts" directory replace all necessary attributes content
data.getXmlEditor(it.absolutePath).use { editor ->
editor.file.doRecursively { node ->
replacements.forEach replacement@{ replacement ->
if (node !is Element) return@replacement
node.getAttributeNode("android:layout_$replacement")?.let { attribute ->
attribute.textContent = "1.0dip"
}
}
}
}
}
return PatchResultSuccess()
}
}

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36") "com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34","17.24.35","17.25.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -1,16 +1,16 @@
package app.revanced.patches.youtube.ad.video.signatures package app.revanced.patches.youtube.ad.video.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("show-video-ads-constructor-signature") @Name("show-video-ads-constructor-fingerprint")
@MatchingMethod( @MatchingMethod(
"Laair", "Laair",
"<init>", "<init>",
@@ -18,7 +18,7 @@ import org.jf.dexlib2.Opcode
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@VideoAdsCompatibility @VideoAdsCompatibility
@Version("0.0.1") @Version("0.0.1")
object ShowVideoAdsConstructorSignature : MethodSignature( object ShowVideoAdsConstructorFingerprint : MethodFingerprint(
"V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("L", "L", "L"), listOf( "V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("L", "L", "L"), listOf(
Opcode.INVOKE_DIRECT, Opcode.INVOKE_DIRECT,
Opcode.NEW_INSTANCE, Opcode.NEW_INSTANCE,

View File

@@ -0,0 +1,21 @@
package app.revanced.patches.youtube.ad.video.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility
import org.jf.dexlib2.AccessFlags
@Name("show-video-ads-method-fingerprint")
@MatchingMethod(
definingClass = "zai"
)
@DirectPatternScanMethod
@VideoAdsCompatibility
@Version("0.0.1")
object ShowVideoAdsFingerprint : MethodFingerprint(
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("Z"), null
)

View File

@@ -3,23 +3,18 @@ package app.revanced.patches.youtube.ad.video.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Dependencies import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultError
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patcher.signature.implementation.method.MethodSignature
import app.revanced.patcher.signature.implementation.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod
import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility
import app.revanced.patches.youtube.ad.video.signatures.ShowVideoAdsConstructorSignature import app.revanced.patches.youtube.ad.video.fingerprints.ShowVideoAdsConstructorFingerprint
import app.revanced.patches.youtube.ad.video.fingerprints.ShowVideoAdsFingerprint
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import org.jf.dexlib2.AccessFlags
@Patch @Patch
@Dependencies(dependencies = [IntegrationsPatch::class]) @Dependencies(dependencies = [IntegrationsPatch::class])
@@ -29,23 +24,18 @@ import org.jf.dexlib2.AccessFlags
@Version("0.0.1") @Version("0.0.1")
class VideoAdsPatch : BytecodePatch( class VideoAdsPatch : BytecodePatch(
listOf( listOf(
ShowVideoAdsConstructorSignature ShowVideoAdsConstructorFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
val result = ShowVideoAdsFingerprint.resolve(data, ShowVideoAdsConstructorFingerprint.result!!.classDef)
signatures.first().result!!.findParentMethod(@Name("show-video-ads-method-signature") @MatchingMethod(
definingClass = "zai"
) @DirectPatternScanMethod @VideoAdsCompatibility @Version("0.0.1") object : MethodSignature(
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("Z"), null
) {}) ?: return PatchResultError("Required parent method could not be found.")
// Override the parameter by calling shouldShowAds and setting the parameter to the result // Override the parameter by calling shouldShowAds and setting the parameter to the result
result.method.implementation!!.addInstructions( ShowVideoAdsFingerprint.result!!.mutableMethod.addInstructions(
0, """ 0, """
invoke-static { }, Lfi/vanced/libraries/youtube/whitelisting/Whitelist;->shouldShowAds()Z invoke-static { }, Lapp/revanced/integrations/patches/VideoAdsPatch;->shouldShowAds()Z
move-result v1 move-result v1
""".trimIndent().toInstructions() """
) )
return PatchResultSuccess() return PatchResultSuccess()

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.17.34", "17.19.36", "17.20.37", "17.22.36") "com.google.android.youtube", arrayOf("17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34","17.24.35","17.25.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -1,21 +1,21 @@
package app.revanced.patches.youtube.interaction.seekbar.signatures package app.revanced.patches.youtube.interaction.seekbar.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.youtube.interaction.seekbar.annotation.SeekbarTappingCompatibility import app.revanced.patches.youtube.interaction.seekbar.annotation.SeekbarTappingCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("enable-seekbar-tapping-signature") @Name("enable-seekbar-tapping-fingerprint")
@MatchingMethod("Lfbl;", "onTouchEvent") @MatchingMethod("Lfbl;", "onTouchEvent")
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@SeekbarTappingCompatibility @SeekbarTappingCompatibility
@Version("0.0.1") @Version("0.0.1")
object SeekbarTappingSignature : MethodSignature( object SeekbarTappingFingerprint : MethodFingerprint(
"Z", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L"), listOf( "Z", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L"), listOf(
Opcode.INVOKE_VIRTUAL, Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_WIDE, Opcode.MOVE_RESULT_WIDE,

View File

@@ -1,21 +1,21 @@
package app.revanced.patches.youtube.interaction.seekbar.signatures package app.revanced.patches.youtube.interaction.seekbar.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.youtube.interaction.seekbar.annotation.SeekbarTappingCompatibility import app.revanced.patches.youtube.interaction.seekbar.annotation.SeekbarTappingCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("enable-seekbar-tapping-parent") @Name("enable-seekbar-tapping-parent-fingerprint")
@MatchingMethod("Lzmx;", "I") @MatchingMethod("Lzmx;", "I")
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@SeekbarTappingCompatibility @SeekbarTappingCompatibility
@Version("0.0.1") @Version("0.0.1")
object SeekbarTappingParentSignature : MethodSignature( object SeekbarTappingParentFingerprint : MethodFingerprint(
"L", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf(), listOf( "L", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf(), listOf(
Opcode.INVOKE_VIRTUAL, Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT, Opcode.MOVE_RESULT_OBJECT,

View File

@@ -3,18 +3,17 @@ package app.revanced.patches.youtube.interaction.seekbar.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Dependencies import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultError
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.youtube.interaction.seekbar.annotation.SeekbarTappingCompatibility import app.revanced.patches.youtube.interaction.seekbar.annotation.SeekbarTappingCompatibility
import app.revanced.patches.youtube.interaction.seekbar.signatures.SeekbarTappingParentSignature import app.revanced.patches.youtube.interaction.seekbar.fingerprints.SeekbarTappingFingerprint
import app.revanced.patches.youtube.interaction.seekbar.signatures.SeekbarTappingSignature import app.revanced.patches.youtube.interaction.seekbar.fingerprints.SeekbarTappingParentFingerprint
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
@@ -30,16 +29,16 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction35c
@Version("0.0.1") @Version("0.0.1")
class EnableSeekbarTappingPatch : BytecodePatch( class EnableSeekbarTappingPatch : BytecodePatch(
listOf( listOf(
SeekbarTappingParentSignature, SeekbarTappingSignature SeekbarTappingParentFingerprint, SeekbarTappingFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
var result = signatures.first().result!! var result = SeekbarTappingParentFingerprint.result!!
val tapSeekMethods = mutableMapOf<String, Method>() val tapSeekMethods = mutableMapOf<String, Method>()
// find the methods which tap the seekbar // find the methods which tap the seekbar
for (it in result.definingClassProxy.immutableClass.methods) { for (it in result.classDef.methods) {
if (it.implementation == null) continue if (it.implementation == null) continue
val instructions = it.implementation!!.instructions val instructions = it.implementation!!.instructions
@@ -58,38 +57,38 @@ class EnableSeekbarTappingPatch : BytecodePatch(
if (literal == 2) tapSeekMethods["O"] = it if (literal == 2) tapSeekMethods["O"] = it
} }
// replace map because we dont need the upper one anymore // replace map because we don't need the upper one anymore
result = signatures.last().result!! result = SeekbarTappingFingerprint.result!!
val implementation = result.method.implementation!! val implementation = result.mutableMethod.implementation!!
// if tap-seeking is enabled, do not invoke the two methods below // if tap-seeking is enabled, do not invoke the two methods below
val pMethod = tapSeekMethods["P"]!! val pMethod = tapSeekMethods["P"]!!
val oMethod = tapSeekMethods["O"]!! val oMethod = tapSeekMethods["O"]!!
// get the required register // get the required register
val instruction = implementation.instructions[result.scanResult.endIndex] val instruction = implementation.instructions[result.patternScanResult!!.endIndex]
if (instruction.opcode != Opcode.INVOKE_VIRTUAL) return PatchResultError("Could not find the correct register") if (instruction.opcode != Opcode.INVOKE_VIRTUAL) return PatchResultError("Could not find the correct register")
val register = (instruction as Instruction35c).registerC val register = (instruction as Instruction35c).registerC
// the instructions are written in reverse order. // the instructions are written in reverse order.
implementation.addInstructions( result.mutableMethod.addInstructions(
result.scanResult.endIndex + 1, """ result.patternScanResult!!.endIndex + 1, """
invoke-virtual { v$register, v2 }, ${oMethod.definingClass}->${oMethod.name}(I)V invoke-virtual { v$register, v2 }, ${oMethod.definingClass}->${oMethod.name}(I)V
invoke-virtual { v$register, v2 }, ${pMethod.definingClass}->${pMethod.name}(I)V invoke-virtual { v$register, v2 }, ${pMethod.definingClass}->${pMethod.name}(I)V
""".trimIndent().toInstructions() """
) )
// if tap-seeking is disabled, do not invoke the two methods above by jumping to the else label // if tap-seeking is disabled, do not invoke the two methods above by jumping to the else label
val elseLabel = implementation.newLabelForIndex(result.scanResult.endIndex + 1) val elseLabel = implementation.newLabelForIndex(result.patternScanResult!!.endIndex + 1)
implementation.addInstruction( implementation.addInstruction(
result.scanResult.endIndex + 1, BuilderInstruction21t(Opcode.IF_EQZ, 0, elseLabel) result.patternScanResult!!.endIndex + 1, BuilderInstruction21t(Opcode.IF_EQZ, 0, elseLabel)
) )
implementation.addInstructions( result.mutableMethod.addInstructions(
result.scanResult.endIndex + 1, """ result.patternScanResult!!.endIndex + 1, """
invoke-static { }, Lfi/razerman/youtube/preferences/BooleanPreferences;->isTapSeekingEnabled()Z invoke-static { }, Lapp/revanced/integrations/patches/SeekbarTappingPatch;->isTapSeekingEnabled()Z
move-result v0 move-result v0
""".trimIndent().toInstructions() """
) )
return PatchResultSuccess() return PatchResultSuccess()
} }

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36") "com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34","17.24.35","17.25.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -3,12 +3,12 @@ package app.revanced.patches.youtube.layout.amoled.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.ResourceData import app.revanced.patcher.data.impl.ResourceData
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Dependencies import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.ResourcePatch import app.revanced.patcher.patch.impl.ResourcePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patches.youtube.layout.amoled.annotations.AmoledCompatibility import app.revanced.patches.youtube.layout.amoled.annotations.AmoledCompatibility
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
import org.w3c.dom.Element import org.w3c.dom.Element
@@ -26,7 +26,7 @@ import java.io.File
@Version("0.0.1") @Version("0.0.1")
class AmoledPatch : ResourcePatch() { class AmoledPatch : ResourcePatch() {
override fun execute(data: ResourceData): PatchResult { override fun execute(data: ResourceData): PatchResult {
data.getXmlEditor("res${File.separator}values${File.separator}colors.xml").use { editor -> data.xmlEditor["res${File.separator}values${File.separator}colors.xml"].use { editor ->
val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element
for (i in 0 until resourcesNode.childNodes.length) { for (i in 0 until resourcesNode.childNodes.length) {

View File

@@ -0,0 +1,13 @@
package app.revanced.patches.youtube.layout.autoplaybutton.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf("17.25.34")
)]
)
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class AutoplayButtonCompatibility

View File

@@ -0,0 +1,34 @@
package app.revanced.patches.youtube.layout.autoplaybutton.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.autoplaybutton.annotations.AutoplayButtonCompatibility
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@Name("autonav-informer-fingerprint")
@MatchingMethod(
"LWillAutonavInformer;", "k"
)
@FuzzyPatternScanMethod(2)
@AutoplayButtonCompatibility
@Version("0.0.1")
object AutonavInformerFingerprint : MethodFingerprint(
"Z",
AccessFlags.PUBLIC or AccessFlags.FINAL,
null,
listOf(
Opcode.IGET_OBJECT,
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT,
),
null,
{ it.definingClass.endsWith("WillAutonavInformer;") }
)

View File

@@ -0,0 +1,32 @@
package app.revanced.patches.youtube.layout.autoplaybutton.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.autoplaybutton.annotations.AutoplayButtonCompatibility
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@Name("layout-constructor-fingerprint")
@MatchingMethod(
"LYouTubeControlsOverlay;", "F"
)
@FuzzyPatternScanMethod(2)
@AutoplayButtonCompatibility
@Version("0.0.1")
object LayoutConstructorFingerprint : MethodFingerprint(
"V",
AccessFlags.PUBLIC or AccessFlags.FINAL,
null,
listOf(
Opcode.CONST,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST,
Opcode.INVOKE_VIRTUAL,
),
listOf("1.0x")
)

View File

@@ -0,0 +1,61 @@
package app.revanced.patches.youtube.layout.autoplaybutton.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.removeInstructions
import app.revanced.patcher.extensions.replaceInstructions
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.youtube.layout.autoplaybutton.annotations.AutoplayButtonCompatibility
import app.revanced.patches.youtube.layout.autoplaybutton.fingerprints.AutonavInformerFingerprint
import app.revanced.patches.youtube.layout.autoplaybutton.fingerprints.LayoutConstructorFingerprint
import app.revanced.patches.youtube.misc.mapping.patch.ResourceIdMappingProviderResourcePatch
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
@Patch
@Dependencies(dependencies = [ResourceIdMappingProviderResourcePatch::class])
@Name("hide-autoplay-button")
@Description("Disable the autoplay button.")
@AutoplayButtonCompatibility
@Version("0.0.1")
class HideAutoplayButton : BytecodePatch(
listOf(
LayoutConstructorFingerprint, AutonavInformerFingerprint
)
) {
override fun execute(data: BytecodeData): PatchResult {
val layoutGenMethod = LayoutConstructorFingerprint.result!!.mutableMethod
val autonavToggle =
ResourceIdMappingProviderResourcePatch.resourceMappings.first { it.type == "id" && it.name == "autonav_toggle" }
val autonavPreviewStub =
ResourceIdMappingProviderResourcePatch.resourceMappings.first { it.type == "id" && it.name == "autonav_preview_stub" }
val autonavToggleConstIndex =
layoutGenMethod.implementation!!.instructions.indexOfFirst { (it as? WideLiteralInstruction)?.wideLiteral == autonavToggle.id }
val autonavPreviewStubConstIndex =
layoutGenMethod.implementation!!.instructions.indexOfFirst { (it as? WideLiteralInstruction)?.wideLiteral == autonavPreviewStub.id }
//remove adding autoplay button to the layout
layoutGenMethod.removeInstructions(autonavToggleConstIndex, 5)
layoutGenMethod.removeInstructions(autonavPreviewStubConstIndex, 5)
val autonavInformerMethod = AutonavInformerFingerprint.result!!.mutableMethod
//force disable autoplay since it's hard to do without the button
autonavInformerMethod.replaceInstructions(
0,
"""
const/4 v0, 0x0
return v0
"""
)
return PatchResultSuccess()
}
}

View File

@@ -3,17 +3,18 @@ package app.revanced.patches.youtube.layout.branding.header.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.ResourceData import app.revanced.patcher.data.impl.ResourceData
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Dependencies import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.ResourcePatch import app.revanced.patcher.patch.impl.ResourcePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultError
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patches.youtube.layout.branding.header.annotations.PremiumHeadingCompatibility import app.revanced.patches.youtube.layout.branding.header.annotations.PremiumHeadingCompatibility
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
import java.nio.file.Files import java.nio.file.Files
import java.nio.file.StandardCopyOption import java.nio.file.StandardCopyOption
import kotlin.io.path.exists
@Patch @Patch
@Dependencies( @Dependencies(
@@ -25,7 +26,7 @@ import java.nio.file.StandardCopyOption
@Version("0.0.1") @Version("0.0.1")
class PremiumHeadingPatch : ResourcePatch() { class PremiumHeadingPatch : ResourcePatch() {
override fun execute(data: ResourceData): PatchResult { override fun execute(data: ResourceData): PatchResult {
val resDirectory = data.get("res") val resDirectory = data["res"]
if (!resDirectory.isDirectory) return PatchResultError("The res folder can not be found.") if (!resDirectory.isDirectory) return PatchResultError("The res folder can not be found.")
val (original, replacement) = "yt_premium_wordmark_header" to "yt_wordmark_header" val (original, replacement) = "yt_premium_wordmark_header" to "yt_wordmark_header"
@@ -34,9 +35,14 @@ class PremiumHeadingPatch : ResourcePatch() {
arrayOf("xxxhdpi", "xxhdpi", "xhdpi", "hdpi", "mdpi").forEach { size -> arrayOf("xxxhdpi", "xxhdpi", "xhdpi", "hdpi", "mdpi").forEach { size ->
val headingDirectory = resDirectory.resolve("drawable-$size") val headingDirectory = resDirectory.resolve("drawable-$size")
modes.forEach {mode -> modes.forEach {mode ->
val fromPath = headingDirectory.resolve("${original}_$mode.png").toPath()
val toPath = headingDirectory.resolve("${replacement}_$mode.png").toPath()
if (!fromPath.exists())
return PatchResultError("The file $fromPath does not exist in the resources. Therefore, this patch can not succeed.")
Files.copy( Files.copy(
headingDirectory.resolve("${original}_$mode.png").toPath(), fromPath,
headingDirectory.resolve("${replacement}_$mode.png").toPath(), toPath,
StandardCopyOption.REPLACE_EXISTING StandardCopyOption.REPLACE_EXISTING
) )
} }

View File

@@ -3,13 +3,13 @@ package app.revanced.patches.youtube.layout.branding.icon.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.ResourceData import app.revanced.patcher.data.impl.ResourceData
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Dependencies import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.ResourcePatch import app.revanced.patcher.patch.impl.ResourcePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultError
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patches.youtube.layout.branding.icon.annotations.CustomBrandingCompatibility import app.revanced.patches.youtube.layout.branding.icon.annotations.CustomBrandingCompatibility
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
import java.nio.file.Files import java.nio.file.Files
@@ -24,7 +24,7 @@ import java.nio.file.Files
@Version("0.0.1") @Version("0.0.1")
class CustomBrandingPatch : ResourcePatch() { class CustomBrandingPatch : ResourcePatch() {
override fun execute(data: ResourceData): PatchResult { override fun execute(data: ResourceData): PatchResult {
val resDirectory = data.get("res") val resDirectory = data["res"]
if (!resDirectory.isDirectory) return PatchResultError("The res folder can not be found.") if (!resDirectory.isDirectory) return PatchResultError("The res folder can not be found.")
val iconNames = arrayOf( val iconNames = arrayOf(

View File

@@ -3,15 +3,13 @@ package app.revanced.patches.youtube.layout.castbutton.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.data.implementation.proxy
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.annotations.Dependencies import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.youtube.layout.castbutton.annotations.CastButtonCompatibility import app.revanced.patches.youtube.layout.castbutton.annotations.CastButtonCompatibility
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
@@ -26,14 +24,14 @@ class HideCastButtonPatch : BytecodePatch(listOf()) {
data.classes.forEach { classDef -> data.classes.forEach { classDef ->
classDef.methods.forEach { method -> classDef.methods.forEach { method ->
if (classDef.type.endsWith("MediaRouteButton;") && method.name == "setVisibility") { if (classDef.type.endsWith("MediaRouteButton;") && method.name == "setVisibility") {
val implementation = val setVisibilityMethod =
data.proxy(classDef).resolve().methods.first { it.name == "setVisibility" }.implementation!! data.proxy(classDef).resolve().methods.first { it.name == "setVisibility" }
implementation.addInstructions( setVisibilityMethod.addInstructions(
0, """ 0, """
invoke-static {p1}, Lfi/razerman/youtube/XGlobals;->getCastButtonOverrideV2(I)I invoke-static {p1}, Lapp/revanced/integrations/patches/HideCastButtonPatch;->getCastButtonOverrideV2(I)I
move-result p1 move-result p1
""".trimIndent().toInstructions("I", 2, false) """
) )
} }
} }

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36") "com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34","17.24.35","17.25.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -1,23 +1,23 @@
package app.revanced.patches.youtube.layout.createbutton.signatures package app.revanced.patches.youtube.layout.createbutton.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.youtube.layout.createbutton.annotations.CreateButtonCompatibility import app.revanced.patches.youtube.layout.createbutton.annotations.CreateButtonCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("create-button-signature") @Name("create-button-fingerprint")
@MatchingMethod( @MatchingMethod(
"Lknw", "z" "Lknw", "z"
) )
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@CreateButtonCompatibility @CreateButtonCompatibility
@Version("0.0.1") @Version("0.0.1")
object CreateButtonSignature : MethodSignature( object CreateButtonFingerprint : MethodFingerprint(
"V", "V",
AccessFlags.PUBLIC or AccessFlags.FINAL, AccessFlags.PUBLIC or AccessFlags.FINAL,
listOf("Z"), listOf("Z"),

View File

@@ -3,46 +3,64 @@ package app.revanced.patches.youtube.layout.createbutton.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Dependencies import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultError
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patcher.util.smali.toInstruction
import app.revanced.patches.youtube.layout.createbutton.annotations.CreateButtonCompatibility import app.revanced.patches.youtube.layout.createbutton.annotations.CreateButtonCompatibility
import app.revanced.patches.youtube.layout.createbutton.signatures.CreateButtonSignature import app.revanced.patches.youtube.layout.createbutton.fingerprints.CreateButtonFingerprint
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.mapping.patch.ResourceIdMappingProviderResourcePatch
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.formats.Instruction35c import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
import org.jf.dexlib2.iface.reference.MethodReference
@Patch @Patch
@Dependencies(dependencies = [IntegrationsPatch::class]) @Dependencies(dependencies = [IntegrationsPatch::class, ResourceIdMappingProviderResourcePatch::class])
@Name("disable-create-button") @Name("disable-create-button")
@Description("Disable the create button.") @Description("Disable the create button.")
@CreateButtonCompatibility @CreateButtonCompatibility
@Version("0.0.1") @Version("0.0.1")
class CreateButtonRemoverPatch : BytecodePatch( class CreateButtonRemoverPatch : BytecodePatch(
listOf( listOf(
CreateButtonSignature CreateButtonFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
val result = signatures.first().result!! val result = CreateButtonFingerprint.result!!
// Get the required register which holds the view object we need to pass to the method hideCreateButton // Get the required register which holds the view object we need to pass to the method hideCreateButton
val implementation = result.method.implementation!! val implementation = result.mutableMethod.implementation!!
val instruction = implementation.instructions[result.scanResult.endIndex + 1]
if (instruction.opcode != Opcode.INVOKE_STATIC) return PatchResultError("Could not find the correct register") val imageOnlyLayout =
val register = (instruction as Instruction35c).registerC ResourceIdMappingProviderResourcePatch.resourceMappings.first { it.type == "layout" && it.name == "image_only_tab" }
val imageOnlyLayoutConstIndex =
implementation.instructions.indexOfFirst { (it as? WideLiteralInstruction)?.wideLiteral == imageOnlyLayout.id }
val (instructionIndex, instruction) = implementation.instructions.drop(imageOnlyLayoutConstIndex).withIndex()
.first {
(((it.value as? ReferenceInstruction)?.reference) as? MethodReference)?.definingClass?.contains("PivotBar")
?: false
}
if (instruction.opcode != Opcode.INVOKE_VIRTUAL) return PatchResultError("Could not find the correct instruction")
val moveResultIndex = imageOnlyLayoutConstIndex + instructionIndex + 1
val moveResultInstruction = implementation.instructions[moveResultIndex] as OneRegisterInstruction
// Hide the button view via proxy by passing it to the hideCreateButton method // Hide the button view via proxy by passing it to the hideCreateButton method
implementation.addInstruction( result.mutableMethod.addInstruction(
result.scanResult.endIndex + 1, moveResultIndex + 1,
"invoke-static { v$register }, Lfi/razerman/youtube/XAdRemover;->hideCreateButton(Landroid/view/View;)V".toInstruction() "invoke-static { v${moveResultInstruction.registerA} }, Lapp/revanced/integrations/patches/HideCreateButtonPatch;->hideCreateButton(Landroid/view/View;)V"
) )
return PatchResultSuccess() return PatchResultSuccess()
} }
} }

View File

@@ -0,0 +1,13 @@
package app.revanced.patches.youtube.layout.fullscreenpanels.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf("17.23.35", "17.23.36", "17.24.34","17.24.35","17.25.34")
)]
)
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class FullscreenPanelsCompatibility

View File

@@ -0,0 +1,32 @@
package app.revanced.patches.youtube.layout.fullscreenpanels.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.shorts.button.annotations.ShortsButtonCompatibility
import org.jf.dexlib2.Opcode
@Name("fullscreen-view-adder-fingerprint")
@MatchingMethod(
"LFullscreenEngagementPanelOverlay;", "e"
)
@FuzzyPatternScanMethod(2)
@ShortsButtonCompatibility
@Version("0.0.1")
object FullscreenViewAdderFingerprint : MethodFingerprint(
null,
null,
listOf("L", "L"),
listOf(
Opcode.GOTO,
Opcode.IGET_BOOLEAN,
Opcode.IF_EQ,
Opcode.GOTO,
Opcode.CONST_4,
Opcode.INVOKE_VIRTUAL,
),
null,
{ it.definingClass.endsWith("FullscreenEngagementPanelOverlay;") }
)

View File

@@ -0,0 +1,51 @@
package app.revanced.patches.youtube.layout.fullscreenpanels.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.removeInstruction
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.youtube.layout.fullscreenpanels.annotations.FullscreenPanelsCompatibility
import app.revanced.patches.youtube.layout.fullscreenpanels.fingerprints.FullscreenViewAdderFingerprint
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.reference.MethodReference
@Patch
@Name("disable-fullscreen-panels")
@Description("Disable comments panel in fullscreen view.")
@FullscreenPanelsCompatibility
@Version("0.0.1")
class FullscreenPanelsRemovalPatch : BytecodePatch(
listOf(
FullscreenViewAdderFingerprint
)
) {
override fun execute(data: BytecodeData): PatchResult {
val method = FullscreenViewAdderFingerprint.result?.mutableMethod!!
val implementation = method.implementation!!
val (visibilityCallIndex, visibilityCall) =
implementation.instructions.withIndex()
.first { ((it.value as? ReferenceInstruction)?.reference as? MethodReference)?.name == ("setVisibility") }
val gotoIndex =
implementation.instructions.subList(0, visibilityCallIndex).indexOfLast { it.opcode == Opcode.GOTO }
//force the if
method.removeInstruction(gotoIndex)
val visibilityIntRegister = (visibilityCall as FiveRegisterInstruction).registerD
//set the visibility to GONE
method.addInstruction(visibilityCallIndex - 1, "const/16 v$visibilityIntRegister, 0x8")
return PatchResultSuccess()
}
}

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36") "com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34","17.24.35","17.25.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -1,23 +1,23 @@
package app.revanced.patches.youtube.layout.minimizedplayback.signatures package app.revanced.patches.youtube.layout.minimizedplayback.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.youtube.layout.minimizedplayback.annotations.MinimizedPlaybackCompatibility import app.revanced.patches.youtube.layout.minimizedplayback.annotations.MinimizedPlaybackCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("minimized-playback-manager-signature") @Name("minimized-playback-manager-fingerprint")
@MatchingMethod( @MatchingMethod(
"Lyuf", "n" "Lyuf", "n"
) )
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@MinimizedPlaybackCompatibility @MinimizedPlaybackCompatibility
@Version("0.0.1") @Version("0.0.1")
object MinimizedPlaybackManagerSignature : MethodSignature( object MinimizedPlaybackManagerFingerprint : MethodFingerprint(
"Z", "Z",
AccessFlags.PUBLIC or AccessFlags.STATIC, AccessFlags.PUBLIC or AccessFlags.STATIC,
listOf("L"), listOf("L"),

View File

@@ -3,15 +3,14 @@ package app.revanced.patches.youtube.layout.minimizedplayback.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.youtube.layout.minimizedplayback.annotations.MinimizedPlaybackCompatibility import app.revanced.patches.youtube.layout.minimizedplayback.annotations.MinimizedPlaybackCompatibility
import app.revanced.patches.youtube.layout.minimizedplayback.signatures.MinimizedPlaybackManagerSignature import app.revanced.patches.youtube.layout.minimizedplayback.fingerprints.MinimizedPlaybackManagerFingerprint
@Patch @Patch
@@ -21,17 +20,17 @@ import app.revanced.patches.youtube.layout.minimizedplayback.signatures.Minimize
@Version("0.0.1") @Version("0.0.1")
class MinimizedPlaybackPatch : BytecodePatch( class MinimizedPlaybackPatch : BytecodePatch(
listOf( listOf(
MinimizedPlaybackManagerSignature MinimizedPlaybackManagerFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
// Instead of removing all instructions like Vanced, // Instead of removing all instructions like Vanced,
// we return the method at the beginning instead // we return the method at the beginning instead
signatures.first().result!!.method.implementation!!.addInstructions( MinimizedPlaybackManagerFingerprint.result!!.mutableMethod.addInstructions(
0, """ 0, """
const/4 v0, 0x1 const/4 v0, 0x1
return v0 return v0
""".trimIndent().toInstructions() """
) )
return PatchResultSuccess() return PatchResultSuccess()
} }

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.17.34", "17.19.36", "17.20.37", "17.22.36") "com.google.android.youtube", arrayOf("17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34","17.24.35","17.25.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -0,0 +1,29 @@
package app.revanced.patches.youtube.layout.oldqualitylayout.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.oldqualitylayout.annotations.OldQualityLayoutCompatibility
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@Name("old-quality-fingerprint")
@MatchingMethod(definingClass = "Libh")
@FuzzyPatternScanMethod(2)
@OldQualityLayoutCompatibility
@Version("0.0.1")
object OldQualityFingerprint : MethodFingerprint(
"L", AccessFlags.FINAL or AccessFlags.PRIVATE, listOf("Z"), listOf(
Opcode.CONST_4,
Opcode.INVOKE_VIRTUAL,
Opcode.IGET_OBJECT,
Opcode.IGET_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.IGET_OBJECT,
Opcode.GOTO,
Opcode.IGET_OBJECT,
)
)

View File

@@ -1,23 +1,23 @@
package app.revanced.patches.youtube.layout.oldqualitylayout.signatures package app.revanced.patches.youtube.layout.oldqualitylayout.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.youtube.layout.oldqualitylayout.annotations.OldQualityLayoutCompatibility import app.revanced.patches.youtube.layout.oldqualitylayout.annotations.OldQualityLayoutCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("old-quality-parent-method-signature") @Name("old-quality-parent-method-fingerprint")
@MatchingMethod( @MatchingMethod(
"Libh", "<init>" "Libh", "<init>"
) )
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@OldQualityLayoutCompatibility @OldQualityLayoutCompatibility
@Version("0.0.1") @Version("0.0.1")
object OldQualityParentSignature : MethodSignature( object OldQualityParentFingerprint : MethodFingerprint(
"V", "V",
AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
listOf("L", "L", "L", "L", "L", "L", "L"), listOf("L", "L", "L", "L", "L", "L", "L"),

View File

@@ -3,23 +3,19 @@ package app.revanced.patches.youtube.layout.oldqualitylayout.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Dependencies import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultError
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patcher.signature.implementation.method.MethodSignature
import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod
import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.youtube.layout.oldqualitylayout.annotations.OldQualityLayoutCompatibility import app.revanced.patches.youtube.layout.oldqualitylayout.annotations.OldQualityLayoutCompatibility
import app.revanced.patches.youtube.layout.oldqualitylayout.signatures.OldQualityParentSignature import app.revanced.patches.youtube.layout.oldqualitylayout.fingerprints.OldQualityFingerprint
import app.revanced.patches.youtube.layout.oldqualitylayout.fingerprints.OldQualityParentFingerprint
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
@@ -31,37 +27,26 @@ import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
@Version("0.0.1") @Version("0.0.1")
class OldQualityLayoutPatch : BytecodePatch( class OldQualityLayoutPatch : BytecodePatch(
listOf( listOf(
OldQualityParentSignature OldQualityParentFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
val result = signatures.first().result!!.findParentMethod(@Name("old-quality-signature") @MatchingMethod( OldQualityFingerprint.resolve(data, OldQualityParentFingerprint.result!!.classDef)
definingClass = "Libh" val result = OldQualityFingerprint.result
) @FuzzyPatternScanMethod(2) @OldQualityLayoutCompatibility @Version("0.0.1") object : MethodSignature( ?: return PatchResultError("Required parent method could not be found.")
"L", AccessFlags.FINAL or AccessFlags.PRIVATE, listOf("Z"), listOf(
Opcode.CONST_4,
Opcode.INVOKE_VIRTUAL,
Opcode.IGET_OBJECT,
Opcode.IGET_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.IGET_OBJECT,
Opcode.GOTO,
Opcode.IGET_OBJECT,
)
) {}) ?: return PatchResultError("Required parent method could not be found.")
val implementation = result.method.implementation!! val implementation = result.mutableMethod.implementation!!
// if useOldStyleQualitySettings == true, jump over all instructions // if useOldStyleQualitySettings == true, jump over all instructions
val jmpInstruction = BuilderInstruction21t( val jmpInstruction = BuilderInstruction21t(
Opcode.IF_NEZ, 0, implementation.instructions[result.scanResult.endIndex].location.labels.first() Opcode.IF_NEZ, 0, implementation.instructions[result.patternScanResult!!.endIndex].location.labels.first()
) )
implementation.addInstruction(5, jmpInstruction) implementation.addInstruction(5, jmpInstruction)
implementation.addInstructions( result.mutableMethod.addInstructions(
0, """ 0, """
invoke-static { }, Lfi/razerman/youtube/XGlobals;->useOldStyleQualitySettings()Z invoke-static { }, Lapp/revanced/integrations/patches/OldStyleQualityPatch;->useOldStyleQualitySettings()Z
move-result v0 move-result v0
""".trimIndent().toInstructions() """
) )
return PatchResultSuccess() return PatchResultSuccess()

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34") "com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.23.35", "17.23.36", "17.24.34","17.24.35","17.25.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -1,22 +1,22 @@
package app.revanced.patches.youtube.layout.reels.signatures package app.revanced.patches.youtube.layout.reels.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.youtube.layout.reels.annotations.HideReelsCompatibility import app.revanced.patches.youtube.layout.reels.annotations.HideReelsCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
@Name("hide-reels-signature") @Name("hide-reels-fingerprint")
@MatchingMethod( @MatchingMethod(
"Ljvy", "<init>" "Ljvy", "<init>"
) )
@FuzzyPatternScanMethod(3) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(3) // FIXME: Test this threshold and find the best value.
@HideReelsCompatibility @HideReelsCompatibility
@Version("0.0.1") @Version("0.0.1")
object HideReelsSignature : MethodSignature( object HideReelsFingerprint : MethodFingerprint(
null, AccessFlags.PROTECTED or AccessFlags.FINAL, listOf("L", "L"), null, null, AccessFlags.PROTECTED or AccessFlags.FINAL, listOf("L", "L"), null,
listOf("multiReelDismissalCallback", "reelItemRenderers", "reelDismissalInfo") listOf("multiReelDismissalCallback", "reelItemRenderers", "reelDismissalInfo")
) )

View File

@@ -2,14 +2,14 @@ package app.revanced.patches.youtube.layout.reels.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.util.smali.toInstruction
import app.revanced.patches.youtube.layout.reels.annotations.HideReelsCompatibility import app.revanced.patches.youtube.layout.reels.annotations.HideReelsCompatibility
import app.revanced.patches.youtube.layout.reels.signatures.HideReelsSignature import app.revanced.patches.youtube.layout.reels.fingerprints.HideReelsFingerprint
//@Patch TODO: this is currently in the general-bytecode-ads patch due to the integrations having a preference for including reels or not. Move it here. //@Patch TODO: this is currently in the general-bytecode-ads patch due to the integrations having a preference for including reels or not. Move it here.
@Name("hide-reels") @Name("hide-reels")
@@ -18,18 +18,17 @@ import app.revanced.patches.youtube.layout.reels.signatures.HideReelsSignature
@Version("0.0.1") @Version("0.0.1")
class HideReelsPatch : BytecodePatch( class HideReelsPatch : BytecodePatch(
listOf( listOf(
HideReelsSignature HideReelsFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
val result = signatures.first().result!! val result = HideReelsFingerprint.result!!
val implementation = result.method.implementation!!
// HideReel will hide the reel view before it is being used, // HideReel will hide the reel view before it is being used,
// so we pass the view to the HideReel method // so we pass the view to the HideReel method
implementation.addInstruction( result.mutableMethod.addInstruction(
result.scanResult.endIndex, result.patternScanResult!!.endIndex,
"invoke-static { v2 }, Lfi/razerman/youtube/XAdRemover;->HideReel(Landroid/view/View;)V".toInstruction() "invoke-static { v2 }, Lapp/revanced/integrations/patches/HideReelsPatch;->HideReel(Landroid/view/View;)V"
) )
return PatchResultSuccess() return PatchResultSuccess()

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36") "com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34","17.24.35","17.25.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -1,23 +1,23 @@
package app.revanced.patches.youtube.layout.shorts.button.signatures package app.revanced.patches.youtube.layout.shorts.button.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.shorts.button.annotations.ShortsButtonCompatibility import app.revanced.patches.youtube.layout.shorts.button.annotations.ShortsButtonCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("pivotbar-buttons-tabenum-signature") @Name("pivotbar-buttons-tabenum-fingerprint")
@MatchingMethod( @MatchingMethod(
"Lknw", "z" "Lknw;", "z"
) )
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@ShortsButtonCompatibility @ShortsButtonCompatibility
@Version("0.0.1") @Version("0.0.1")
object PivotBarButtonTabenumSignature : MethodSignature( object PivotBarButtonTabEnumFingerprint : MethodFingerprint(
"V", "V",
AccessFlags.PUBLIC or AccessFlags.FINAL, AccessFlags.PUBLIC or AccessFlags.FINAL,
listOf("Z"), listOf("Z"),
@@ -42,4 +42,4 @@ object PivotBarButtonTabenumSignature : MethodSignature(
Opcode.INVOKE_STATIC, // SomeEnum.fromValue(tabOrdinal) Opcode.INVOKE_STATIC, // SomeEnum.fromValue(tabOrdinal)
Opcode.MOVE_RESULT_OBJECT Opcode.MOVE_RESULT_OBJECT
) )
) )

View File

@@ -1,23 +1,23 @@
package app.revanced.patches.youtube.layout.shorts.button.signatures package app.revanced.patches.youtube.layout.shorts.button.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.shorts.button.annotations.ShortsButtonCompatibility import app.revanced.patches.youtube.layout.shorts.button.annotations.ShortsButtonCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("pivotbar-buttons-view-signature") @Name("pivotbar-buttons-view-fingerprint")
@MatchingMethod( @MatchingMethod(
"Lknw", "z" "Lknw;", "z"
) )
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@ShortsButtonCompatibility @ShortsButtonCompatibility
@Version("0.0.1") @Version("0.0.1")
object PivotBarButtonsViewSignature : MethodSignature( object PivotBarButtonsViewFingerprint : MethodFingerprint(
"V", "V",
AccessFlags.PUBLIC or AccessFlags.FINAL, AccessFlags.PUBLIC or AccessFlags.FINAL,
listOf("Z"), listOf("Z"),

View File

@@ -3,52 +3,53 @@ package app.revanced.patches.youtube.layout.shorts.button.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Dependencies import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patcher.util.smali.toInstruction
import app.revanced.patches.youtube.layout.shorts.button.annotations.ShortsButtonCompatibility import app.revanced.patches.youtube.layout.shorts.button.annotations.ShortsButtonCompatibility
import app.revanced.patches.youtube.layout.shorts.button.signatures.PivotBarButtonTabenumSignature import app.revanced.patches.youtube.layout.shorts.button.fingerprints.PivotBarButtonTabEnumFingerprint
import app.revanced.patches.youtube.layout.shorts.button.signatures.PivotBarButtonsViewSignature import app.revanced.patches.youtube.layout.shorts.button.fingerprints.PivotBarButtonsViewFingerprint
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import org.jf.dexlib2.iface.instruction.formats.Instruction11x import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Patch @Patch
@Dependencies(dependencies = [IntegrationsPatch::class]) @Dependencies(dependencies = [IntegrationsPatch::class])
@Name("disable-shorts-button") @Name("hide-shorts-button")
@Description("Hide the shorts button.") @Description("Hide the shorts button.")
@ShortsButtonCompatibility @ShortsButtonCompatibility
@Version("0.0.1") @Version("0.0.1")
class ShortsButtonRemoverPatch : BytecodePatch( class ShortsButtonRemoverPatch : BytecodePatch(
listOf( listOf(
PivotBarButtonTabenumSignature, PivotBarButtonsViewSignature PivotBarButtonTabEnumFingerprint, PivotBarButtonsViewFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
val result1 = signatures.first().result!! val tabEnumResult = PivotBarButtonTabEnumFingerprint.result!!
val implementation1 = result1.method.implementation!! val tabEnumImplementation = tabEnumResult.mutableMethod.implementation!!
val moveEnumInstruction = implementation1.instructions[result1.scanResult.endIndex] val moveEnumInstruction = tabEnumImplementation.instructions[tabEnumResult.patternScanResult!!.endIndex]
val enumRegister = (moveEnumInstruction as Instruction11x).registerA val enumRegister = (moveEnumInstruction as OneRegisterInstruction).registerA
val buttonsViewResult = PivotBarButtonsViewFingerprint.result!!
val buttonsViewImplementation = buttonsViewResult.mutableMethod.implementation!!
val moveViewInstruction = buttonsViewImplementation.instructions[buttonsViewResult.patternScanResult!!.endIndex]
val viewRegister = (moveViewInstruction as OneRegisterInstruction).registerA
val result2 = signatures.last().result!!
val implementation2 = result2.method.implementation!!
val moveViewInstruction = implementation2.instructions[result2.scanResult.endIndex]
val viewRegister = (moveViewInstruction as Instruction11x).registerA
// Save the tab enum in XGlobals to avoid smali/register workarounds // Save the tab enum in XGlobals to avoid smali/register workarounds
implementation1.addInstruction( tabEnumResult.mutableMethod.addInstruction(
result1.scanResult.endIndex + 1, tabEnumResult.patternScanResult!!.endIndex + 1,
"sput-object v$enumRegister, Lfi/razerman/youtube/XGlobals;->lastPivotTab:Ljava/lang/Enum;".toInstruction() "sput-object v$enumRegister, Lapp/revanced/integrations/patches/HideShortsButtonPatch;->lastPivotTab:Ljava/lang/Enum;"
) )
// Hide the button view via proxy by passing it to the hideShortsButton method // Hide the button view via proxy by passing it to the hideShortsButton method
// It only hides it if the last tab name is "TAB_SHORTS" // It only hides it if the last tab name is "TAB_SHORTS"
implementation2.addInstruction( buttonsViewResult.mutableMethod.addInstruction(
result2.scanResult.endIndex + 2, buttonsViewResult.patternScanResult!!.endIndex + 2,
"invoke-static { v$viewRegister }, Lfi/razerman/youtube/XAdRemover;->hideShortsButton(Landroid/view/View;)V".toInstruction() "invoke-static { v$viewRegister }, Lapp/revanced/integrations/patches/HideShortsButtonPatch;->hideShortsButton(Landroid/view/View;)V"
) )
return PatchResultSuccess() return PatchResultSuccess()

View File

@@ -0,0 +1,13 @@
package app.revanced.patches.youtube.layout.watermark.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf("17.24.34", "17.24.35", "17.25.34")
)]
)
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class HideWatermarkCompatibility

View File

@@ -0,0 +1,21 @@
package app.revanced.patches.youtube.layout.watermark.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.watermark.annotations.HideWatermarkCompatibility
import org.jf.dexlib2.AccessFlags
@Name("hide-watermark-signature")
@MatchingMethod(
"Ljvy;", "<init>"
)
@FuzzyPatternScanMethod(3)
@HideWatermarkCompatibility
@Version("0.0.1")
object HideWatermarkFingerprint : MethodFingerprint (
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L", "L"), null ,null, null
)

View File

@@ -0,0 +1,21 @@
package app.revanced.patches.youtube.layout.watermark.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.watermark.annotations.HideWatermarkCompatibility
import org.jf.dexlib2.AccessFlags
@Name("hide-watermark-parent-signature")
@MatchingMethod(
"Ljvy;", "<init>"
)
@FuzzyPatternScanMethod(3)
@HideWatermarkCompatibility
@Version("0.0.1")
object HideWatermarkParentFingerprint : MethodFingerprint (
"L", AccessFlags.PUBLIC or AccessFlags.FINAL, null, null, listOf("player_overlay_in_video_programming"), null
)

View File

@@ -0,0 +1,51 @@
package app.revanced.patches.youtube.layout.watermark.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.removeInstruction
import app.revanced.patcher.extensions.removeInstructions
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.youtube.layout.watermark.annotations.HideWatermarkCompatibility
import app.revanced.patches.youtube.layout.watermark.fingerprints.HideWatermarkParentFingerprint
import app.revanced.patches.youtube.layout.watermark.fingerprints.HideWatermarkFingerprint
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
@Patch
@Dependencies(dependencies = [IntegrationsPatch::class])
@Name("hide-watermark")
@Description("Hide Watermark on the page.")
@HideWatermarkCompatibility
@Version("0.0.1")
class HideWatermarkPatch : BytecodePatch(
listOf(
HideWatermarkParentFingerprint
)
) {
override fun execute(data: BytecodeData): PatchResult {
HideWatermarkFingerprint.resolve(data, HideWatermarkParentFingerprint.result!!.classDef)
val result = HideWatermarkFingerprint.result
?: return PatchResultError("Required parent method could not be found.")
val method = result.mutableMethod
val line = method.implementation!!.instructions.size - 5
method.removeInstruction(line)
method.addInstructions(
line, """
invoke-static {}, Lapp/revanced/integrations/patches/BrandingWaterMarkPatch;->isBrandingWatermarkShown()Z
move-result p2
"""
)
return PatchResultSuccess()
}
}

View File

@@ -0,0 +1,13 @@
package app.revanced.patches.youtube.misc.customplaybackspeed.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf("17.24.34","17.25.34")
)]
)
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class CustomPlaybackSpeedCompatibility

View File

@@ -0,0 +1,33 @@
package app.revanced.patches.youtube.misc.customplaybackspeed.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.youtube.misc.customplaybackspeed.annotations.CustomPlaybackSpeedCompatibility
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@Name("speed-array-generator-fingerprint")
@MatchingMethod(
"Lzdj;", "d"
)
@FuzzyPatternScanMethod(2)
@CustomPlaybackSpeedCompatibility
@Version("0.0.1")
object SpeedArrayGeneratorFingerprint : MethodFingerprint(
"[L",
AccessFlags.PUBLIC or AccessFlags.STATIC,
null,
listOf(
Opcode.IF_NEZ,
Opcode.SGET_OBJECT,
Opcode.GOTO,
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT_OBJECT,
Opcode.IGET_OBJECT,
),
listOf("0.0#")
)

View File

@@ -0,0 +1,34 @@
package app.revanced.patches.youtube.misc.customplaybackspeed.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.youtube.misc.customplaybackspeed.annotations.CustomPlaybackSpeedCompatibility
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@Name("speed-limiter-fingerprint")
@MatchingMethod(
"Lxgy;", "y"
)
@FuzzyPatternScanMethod(2)
@CustomPlaybackSpeedCompatibility
@Version("0.0.1")
object SpeedLimiterFingerprint : MethodFingerprint(
"V",
AccessFlags.PUBLIC or AccessFlags.FINAL,
listOf("F"),
listOf(
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT,
Opcode.IF_EQZ,
Opcode.CONST_HIGH16,
Opcode.GOTO,
Opcode.CONST_HIGH16,
Opcode.CONST_HIGH16,
Opcode.INVOKE_STATIC,
),
)

View File

@@ -0,0 +1,110 @@
package app.revanced.patches.youtube.misc.customplaybackspeed.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.youtube.misc.customplaybackspeed.annotations.CustomPlaybackSpeedCompatibility
import app.revanced.patches.youtube.misc.customplaybackspeed.fingerprints.SpeedArrayGeneratorFingerprint
import app.revanced.patches.youtube.misc.customplaybackspeed.fingerprints.SpeedLimiterFingerprint
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.reference.FieldReference
import org.jf.dexlib2.iface.reference.MethodReference
@Patch
@Name("custom-playback-speed")
@Description("Allows to change the default playback speed options.")
@Dependencies(dependencies = [IntegrationsPatch::class])
@CustomPlaybackSpeedCompatibility
@Version("0.0.1")
class CustomPlaybackSpeedPatch : BytecodePatch(
listOf(
SpeedArrayGeneratorFingerprint, SpeedLimiterFingerprint
)
) {
override fun execute(data: BytecodeData): PatchResult {
val arrayGenMethod = SpeedArrayGeneratorFingerprint.result?.mutableMethod!!
val arrayGenMethodImpl = arrayGenMethod.implementation!!
val sizeCallIndex = arrayGenMethodImpl.instructions
.indexOfFirst { ((it as? ReferenceInstruction)?.reference as? MethodReference)?.name == "size" }
if (sizeCallIndex == -1) return PatchResultError("Couldn't find call to size()")
val sizeCallResultRegister =
(arrayGenMethodImpl.instructions.elementAt(sizeCallIndex + 1) as OneRegisterInstruction).registerA
arrayGenMethod.replaceInstruction(
sizeCallIndex + 1,
"const/4 v$sizeCallResultRegister, 0x0"
)
val (arrayLengthConstIndex, arrayLengthConst) = arrayGenMethodImpl.instructions.withIndex()
.first { (it.value as? NarrowLiteralInstruction)?.narrowLiteral == 7 }
val arrayLengthConstDestination = (arrayLengthConst as OneRegisterInstruction).registerA
val videoSpeedsArrayType = "Lapp/revanced/integrations/videoplayer/videosettings/VideoSpeed;->videoSpeeds:[F"
arrayGenMethod.addInstructions(
arrayLengthConstIndex + 1,
"""
sget-object v$arrayLengthConstDestination, $videoSpeedsArrayType
array-length v$arrayLengthConstDestination, v$arrayLengthConstDestination
"""
)
val (originalArrayFetchIndex, originalArrayFetch) = arrayGenMethodImpl.instructions.withIndex()
.first {
val reference = ((it.value as? ReferenceInstruction)?.reference as? FieldReference)
reference?.definingClass?.contains("PlayerConfigModel") ?: false &&
reference?.type == "[F"
}
val originalArrayFetchDestination = (originalArrayFetch as OneRegisterInstruction).registerA
arrayGenMethod.replaceInstruction(
originalArrayFetchIndex,
"sget-object v$originalArrayFetchDestination, $videoSpeedsArrayType"
)
val limiterMethod = SpeedLimiterFingerprint.result?.mutableMethod!!;
val limiterMethodImpl = limiterMethod.implementation!!
val speedLimitMin = 0.25f
val speedLimitMax = 100f
val (limiterMinConstIndex, limiterMinConst) = limiterMethodImpl.instructions.withIndex()
.first { (it.value as? NarrowLiteralInstruction)?.narrowLiteral == 0.25f.toRawBits() }
val (limiterMaxConstIndex, limiterMaxConst) = limiterMethodImpl.instructions.withIndex()
.first { (it.value as? NarrowLiteralInstruction)?.narrowLiteral == 2.0f.toRawBits() }
val limiterMinConstDestination = (limiterMinConst as OneRegisterInstruction).registerA
val limiterMaxConstDestination = (limiterMaxConst as OneRegisterInstruction).registerA
fun hexFloat(float: Float): String = "0x%08x".format(float.toRawBits())
limiterMethod.replaceInstruction(
limiterMinConstIndex,
"const/high16 v$limiterMinConstDestination, ${hexFloat(speedLimitMin)}"
)
limiterMethod.replaceInstruction(
limiterMaxConstIndex,
"const/high16 v$limiterMaxConstDestination, ${hexFloat(speedLimitMax)}"
)
return PatchResultSuccess()
}
}

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.03.38", "17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36") "com.google.android.youtube", arrayOf("17.03.38", "17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34","17.24.35","17.25.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -1,18 +1,18 @@
package app.revanced.patches.youtube.misc.integrations.signatures package app.revanced.patches.youtube.misc.integrations.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.youtube.misc.integrations.annotations.IntegrationsCompatibility import app.revanced.patches.youtube.misc.integrations.annotations.IntegrationsCompatibility
@Name("init-signature") @Name("init-fingerprint")
@MatchingMethod( @MatchingMethod(
"Lacuu", "onCreate" "Lacuu", "onCreate"
) )
@IntegrationsCompatibility @IntegrationsCompatibility
@Version("0.0.1") @Version("0.0.1")
object InitSignature : MethodSignature( object InitFingerprint : MethodFingerprint(
null, null, null, null, null, null, null, null,
listOf("Application creation") listOf("Application creation")
) )

View File

@@ -3,17 +3,17 @@ package app.revanced.patches.youtube.misc.integrations.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.implementation.misc.PatchResultError import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
import app.revanced.patcher.util.smali.toInstructions import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.youtube.misc.integrations.annotations.IntegrationsCompatibility import app.revanced.patches.youtube.misc.integrations.annotations.IntegrationsCompatibility
import app.revanced.patches.youtube.misc.integrations.signatures.InitSignature import app.revanced.patches.youtube.misc.integrations.fingerprints.InitFingerprint
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.immutable.ImmutableMethod import org.jf.dexlib2.immutable.ImmutableMethod
import org.jf.dexlib2.immutable.ImmutableMethodImplementation import org.jf.dexlib2.immutable.ImmutableMethodImplementation
@@ -24,26 +24,27 @@ import org.jf.dexlib2.immutable.ImmutableMethodImplementation
@Version("0.0.1") @Version("0.0.1")
class IntegrationsPatch : BytecodePatch( class IntegrationsPatch : BytecodePatch(
listOf( listOf(
InitSignature InitFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
if (data.findClass("Lapp/revanced/integrations/Globals") == null) if (data.findClass("Lapp/revanced/integrations/utils/ReVancedUtils") == null)
return PatchResultError("Integrations have not been merged yet. This patch can not succeed without the integrations.") return PatchResultError("Integrations have not been merged yet. This patch can not succeed without the integrations.")
val result = signatures.first().result!! val result = InitFingerprint.result!!
val implementation = result.method.implementation!! val method = result.mutableMethod
val implementation = method.implementation!!
val count = implementation.registerCount - 1 val count = implementation.registerCount - 1
implementation.addInstructions( method.addInstructions(
result.scanResult.endIndex + 1, """ 0, """
invoke-static {v$count}, Lpl/jakubweg/StringRef;->setContext(Landroid/content/Context;)V invoke-static {v$count}, Lapp/revanced/integrations/sponsorblock/StringRef;->setContext(Landroid/content/Context;)V
sput-object v$count, Lapp/revanced/integrations/Globals;->context:Landroid/content/Context; sput-object v$count, Lapp/revanced/integrations/utils/ReVancedUtils;->context:Landroid/content/Context;
""".trimIndent().toInstructions() """
) )
val classDef = result.definingClassProxy.resolve() val classDef = result.mutableClass
classDef.methods.add( classDef.methods.add(
ImmutableMethod( ImmutableMethod(
classDef.type, classDef.type,
@@ -55,10 +56,10 @@ class IntegrationsPatch : BytecodePatch(
null, null,
ImmutableMethodImplementation( ImmutableMethodImplementation(
1, """ 1, """
invoke-static { }, Lapp/revanced/integrations/Globals;->getAppContext()Landroid/content/Context; invoke-static { }, Lapp/revanced/integrations/utils/ReVancedUtils;->getAppContext()Landroid/content/Context;
move-result-object v0 move-result-object v0
return-object v0 return-object v0
""".trimIndent().toInstructions(), null, null """.toInstructions(), null, null
) )
).toMutable() ).toMutable()
) )

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36") "com.google.android.youtube", arrayOf("17.14.35", "17.17.34", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34","17.24.35","17.25.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -3,10 +3,10 @@ package app.revanced.patches.youtube.misc.manifest.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.ResourceData import app.revanced.patcher.data.impl.ResourceData
import app.revanced.patcher.patch.implementation.ResourcePatch import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.patch.impl.ResourcePatch
import app.revanced.patches.youtube.misc.manifest.annotations.FixLocaleConfigErrorCompatibility import app.revanced.patches.youtube.misc.manifest.annotations.FixLocaleConfigErrorCompatibility
import org.w3c.dom.Element import org.w3c.dom.Element
@@ -17,7 +17,7 @@ import org.w3c.dom.Element
class FixLocaleConfigErrorPatch : ResourcePatch() { class FixLocaleConfigErrorPatch : ResourcePatch() {
override fun execute(data: ResourceData): PatchResult { override fun execute(data: ResourceData): PatchResult {
// create an xml editor instance // create an xml editor instance
data.getXmlEditor("AndroidManifest.xml").use { data.xmlEditor["AndroidManifest.xml"].use {
// edit the application nodes attribute... // edit the application nodes attribute...
val applicationNode = it val applicationNode = it
.file .file

View File

@@ -4,10 +4,10 @@ import app.revanced.extensions.doRecursively
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.ResourceData import app.revanced.patcher.data.impl.ResourceData
import app.revanced.patcher.patch.implementation.ResourcePatch import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.patch.impl.ResourcePatch
import org.w3c.dom.Element import org.w3c.dom.Element
@Name("resource-id-mapping-provider-resource-patch-dependency") @Name("resource-id-mapping-provider-resource-patch-dependency")
@@ -15,22 +15,26 @@ import org.w3c.dom.Element
@Version("0.0.1") @Version("0.0.1")
class ResourceIdMappingProviderResourcePatch : ResourcePatch() { class ResourceIdMappingProviderResourcePatch : ResourcePatch() {
companion object { companion object {
internal lateinit var resourceMappings: Map<String, Long> internal lateinit var resourceMappings: List<ResourceElement>
private set private set
} }
override fun execute(data: ResourceData): PatchResult { override fun execute(data: ResourceData): PatchResult {
data.getXmlEditor("res/values/public.xml").use { editor -> data.xmlEditor["res/values/public.xml"].use { editor ->
resourceMappings = buildMap { resourceMappings = buildList {
editor.file.documentElement.doRecursively { node -> editor.file.documentElement.doRecursively { node ->
if (node !is Element) return@doRecursively if (node !is Element) return@doRecursively
val nameAttribute = node.getAttribute("name") val nameAttribute = node.getAttribute("name")
val typeAttribute = node.getAttribute("type")
if (node.nodeName != "public" || nameAttribute.startsWith("APKTOOL")) return@doRecursively if (node.nodeName != "public" || nameAttribute.startsWith("APKTOOL")) return@doRecursively
this[nameAttribute] = node.getAttribute("id").substring(2).toLong(16) val id = node.getAttribute("id").substring(2).toLong(16)
add(ResourceElement(typeAttribute, nameAttribute, id))
} }
} }
} }
return PatchResultSuccess() return PatchResultSuccess()
} }
} }
data class ResourceElement(val type: String, val name: String, val id: Long)

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility( @Compatibility(
[Package( [Package(
"com.google.android.youtube", arrayOf("17.14.35", "17.19.36", "17.20.37", "17.22.36") "com.google.android.youtube", arrayOf("17.14.35", "17.19.36", "17.20.37", "17.22.36", "17.23.35", "17.23.36", "17.24.34","17.24.35","17.25.34")
)] )]
) )
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)

View File

@@ -0,0 +1,20 @@
package app.revanced.patches.youtube.misc.microg.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
@Name("cast-context-fetch-fingerprint")
@MatchingMethod(
"Lvvz;", "a"
)
@DirectPatternScanMethod
@MicroGPatchCompatibility
@Version("0.0.1")
object CastContextFetchFingerprint : MethodFingerprint(
null, null, null, null,
listOf("Error fetching CastContext.")
)

View File

@@ -0,0 +1,20 @@
package app.revanced.patches.youtube.misc.microg.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
@Name("cast-module-fingerprint")
@MatchingMethod(
"Llqh;", "c"
)
@DirectPatternScanMethod
@MicroGPatchCompatibility
@Version("0.0.1")
object CastDynamiteModuleFingerprint : MethodFingerprint(
null, null, null, null,
listOf("com.google.android.gms.cast.framework.internal.CastDynamiteModuleImpl")
)

View File

@@ -0,0 +1,20 @@
package app.revanced.patches.youtube.misc.microg.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
@Name("cast-context-fetch-fingerprint")
@MatchingMethod(
"Lmcf;", "c"
)
@DirectPatternScanMethod
@MicroGPatchCompatibility
@Version("0.0.1")
object CastDynamiteModuleV2Fingerprint : MethodFingerprint(
null, null, null, null,
listOf("Failed to load module via V2: ")
)

View File

@@ -1,23 +1,23 @@
package app.revanced.patches.youtube.misc.microg.signatures package app.revanced.patches.youtube.misc.microg.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("google-play-utility-signature") @Name("google-play-utility-fingerprint")
@MatchingMethod( @MatchingMethod(
"Llss;", "b" "Llss;", "b"
) )
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@MicroGPatchCompatibility @MicroGPatchCompatibility
@Version("0.0.1") @Version("0.0.1")
object GooglePlayUtilitySignature : MethodSignature( object GooglePlayUtilityFingerprint : MethodFingerprint(
"I", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L", "L"), listOf( "I", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L", "L"), listOf(
Opcode.INVOKE_VIRTUAL, Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT, Opcode.MOVE_RESULT_OBJECT,

View File

@@ -1,23 +1,23 @@
package app.revanced.patches.youtube.misc.microg.signatures package app.revanced.patches.youtube.misc.microg.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("google-play-sig-check-signature") @Name("google-play-sig-check-fingerprint")
@MatchingMethod( @MatchingMethod(
"Ldwn;", "d" "Ldwn;", "d"
) )
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@MicroGPatchCompatibility @MicroGPatchCompatibility
@Version("0.0.1") @Version("0.0.1")
object IntegrityCheckSignature : MethodSignature( object IntegrityCheckFingerprint : MethodFingerprint(
"L", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L", "L"), listOf( "L", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L", "L"), listOf(
Opcode.MOVE_OBJECT_FROM16, Opcode.MOVE_OBJECT_FROM16,
Opcode.CONST_STRING, Opcode.CONST_STRING,

View File

@@ -0,0 +1,19 @@
package app.revanced.patches.youtube.misc.microg.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
@Name("google-play-prime-fingerprint")
@MatchingMethod(
"Lpag;", "d"
)
@DirectPatternScanMethod
@MicroGPatchCompatibility
@Version("0.0.1")
object PrimeFingerprint : MethodFingerprint(
null, null, null, null, listOf("com.google.android.GoogleCamera", "com.android.vending")
)

View File

@@ -1,23 +1,23 @@
package app.revanced.patches.youtube.misc.microg.signatures package app.revanced.patches.youtube.misc.microg.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.signature.implementation.method.MethodSignature import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.signature.implementation.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("google-play-service-checker-signature") @Name("google-play-service-checker-fingerprint")
@MatchingMethod( @MatchingMethod(
"Llss;", "d" "Llss;", "d"
) )
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@MicroGPatchCompatibility @MicroGPatchCompatibility
@Version("0.0.1") @Version("0.0.1")
object ServiceCheckSignature : MethodSignature( object ServiceCheckFingerprint : MethodFingerprint(
"V", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L", "I"), listOf( "V", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L", "I"), listOf(
Opcode.SGET_OBJECT, Opcode.SGET_OBJECT,
Opcode.INVOKE_VIRTUAL, Opcode.INVOKE_VIRTUAL,

View File

@@ -4,24 +4,23 @@ import app.revanced.extensions.equalsAny
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.data.implementation.proxy
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.patch.annotations.Dependencies import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.util.proxy.mutableTypes.MutableClass import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
import app.revanced.patcher.util.smali.toInstruction
import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.youtube.layout.castbutton.patch.HideCastButtonPatch import app.revanced.patches.youtube.layout.castbutton.patch.HideCastButtonPatch
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
import app.revanced.patches.youtube.misc.microg.patch.resource.MicroGResourcePatch import app.revanced.patches.youtube.misc.microg.patch.resource.MicroGResourcePatch
import app.revanced.patches.youtube.misc.microg.patch.resource.enum.StringReplaceMode import app.revanced.patches.youtube.misc.microg.patch.resource.enum.StringReplaceMode
import app.revanced.patches.youtube.misc.microg.shared.Constants.BASE_MICROG_PACKAGE_NAME import app.revanced.patches.youtube.misc.microg.shared.Constants.BASE_MICROG_PACKAGE_NAME
import app.revanced.patches.youtube.misc.microg.shared.Constants.REVANCED_PACKAGE_NAME import app.revanced.patches.youtube.misc.microg.shared.Constants.REVANCED_PACKAGE_NAME
import app.revanced.patches.youtube.misc.microg.signatures.* import app.revanced.patches.youtube.misc.microg.fingerprints.*
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
import org.jf.dexlib2.builder.MutableMethodImplementation import org.jf.dexlib2.builder.MutableMethodImplementation
import org.jf.dexlib2.builder.instruction.BuilderInstruction21c import org.jf.dexlib2.builder.instruction.BuilderInstruction21c
@@ -29,9 +28,13 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction21c
import org.jf.dexlib2.iface.reference.StringReference import org.jf.dexlib2.iface.reference.StringReference
import org.jf.dexlib2.immutable.reference.ImmutableStringReference import org.jf.dexlib2.immutable.reference.ImmutableStringReference
@Patch(include = false) @Patch
@Dependencies( @Dependencies(
dependencies = [MicroGResourcePatch::class, HideCastButtonPatch::class] dependencies = [
MicroGResourcePatch::class,
HideCastButtonPatch::class,
FixLocaleConfigErrorPatch::class
]
) )
@Name("microg-support") @Name("microg-support")
@Description("Patch to allow YouTube ReVanced to run without root and under a different package name.") @Description("Patch to allow YouTube ReVanced to run without root and under a different package name.")
@@ -39,13 +42,13 @@ import org.jf.dexlib2.immutable.reference.ImmutableStringReference
@Version("0.0.1") @Version("0.0.1")
class MicroGBytecodePatch : BytecodePatch( class MicroGBytecodePatch : BytecodePatch(
listOf( listOf(
IntegrityCheckSignature, IntegrityCheckFingerprint,
ServiceCheckSignature, ServiceCheckFingerprint,
GooglePlayUtilitySignature, GooglePlayUtilityFingerprint,
CastDynamiteModuleSignature, CastDynamiteModuleFingerprint,
CastDynamiteModuleV2Signature, CastDynamiteModuleV2Fingerprint,
CastContextFetchSignature, CastContextFetchFingerprint,
PrimeSignature, PrimeFingerprint,
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(data: BytecodeData): PatchResult {
@@ -65,13 +68,11 @@ class MicroGBytecodePatch : BytecodePatch(
val replaceMode = if (stringValue.equalsAny( val replaceMode = if (stringValue.equalsAny(
"com.google.android.gms", "com.google.android.gms",
"com.google.android.youtube.fileprovider",
"com.google.android.c2dm.intent.REGISTER", "com.google.android.c2dm.intent.REGISTER",
"com.google.android.c2dm.permission.SEND", "com.google.android.c2dm.permission.SEND",
"com.google.iid.TOKEN_REQUEST", "com.google.iid.TOKEN_REQUEST",
"com.google", "com.google",
"com.google.android.gms.auth.accounts", "com.google.android.gms.auth.accounts",
"com.google.android.youtube.SuggestionProvider",
"com.google.android.c2dm.intent.REGISTRATION", "com.google.android.c2dm.intent.REGISTRATION",
"com.google.android.gsf.action.GET_GLS", "com.google.android.gsf.action.GET_GLS",
"com.google.android.gsf.login", "com.google.android.gsf.login",
@@ -117,14 +118,20 @@ class MicroGBytecodePatch : BytecodePatch(
} }
} }
signatures.last()
return PatchResultSuccess() return PatchResultSuccess()
} }
private fun disablePlayServiceChecksAndFixCastIssues() { private fun disablePlayServiceChecksAndFixCastIssues() {
for (i in 0 until signatures.count() - 1) { listOf(
val result = signatures.elementAt(i).result!! IntegrityCheckFingerprint,
val stringInstructions = when (result.immutableMethod.returnType.first()) { ServiceCheckFingerprint,
GooglePlayUtilityFingerprint,
CastDynamiteModuleFingerprint,
CastDynamiteModuleV2Fingerprint,
CastContextFetchFingerprint
).forEach { fingerprint ->
val result = fingerprint.result!!
val stringInstructions = when (result.method.returnType.first()) {
'L' -> """ 'L' -> """
const/4 v0, 0x0 const/4 v0, 0x0
return-object v0 return-object v0
@@ -138,12 +145,13 @@ class MicroGBytecodePatch : BytecodePatch(
else -> throw Exception("This case should never happen.") else -> throw Exception("This case should never happen.")
} }
result.method.implementation!!.addInstructions( result.mutableMethod.addInstructions(
0, stringInstructions.trimIndent().toInstructions() 0, stringInstructions
) )
} }
val implementation = signatures.last().result!!.method.implementation!! val primeMethod = PrimeFingerprint.result!!.mutableMethod
val implementation = primeMethod.implementation!!
var register = 2 var register = 2
val index = implementation.instructions.indexOfFirst { val index = implementation.instructions.indexOfFirst {
@@ -156,8 +164,8 @@ class MicroGBytecodePatch : BytecodePatch(
return@indexOfFirst true return@indexOfFirst true
} }
implementation.replaceInstruction( primeMethod.replaceInstruction(
index, "const-string v$register, \"$REVANCED_PACKAGE_NAME\"".toInstruction() index, "const-string v$register, \"$REVANCED_PACKAGE_NAME\""
) )
} }
} }

View File

@@ -3,10 +3,10 @@ package app.revanced.patches.youtube.misc.microg.patch.resource
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.ResourceData import app.revanced.patcher.data.impl.ResourceData
import app.revanced.patcher.patch.implementation.ResourcePatch import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess import app.revanced.patcher.patch.impl.ResourcePatch
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
import app.revanced.patches.youtube.misc.microg.shared.Constants.BASE_MICROG_PACKAGE_NAME import app.revanced.patches.youtube.misc.microg.shared.Constants.BASE_MICROG_PACKAGE_NAME
import app.revanced.patches.youtube.misc.microg.shared.Constants.REVANCED_APP_NAME import app.revanced.patches.youtube.misc.microg.shared.Constants.REVANCED_APP_NAME
@@ -18,7 +18,7 @@ import app.revanced.patches.youtube.misc.microg.shared.Constants.REVANCED_PACKAG
@Version("0.0.1") @Version("0.0.1")
class MicroGResourcePatch : ResourcePatch() { class MicroGResourcePatch : ResourcePatch() {
override fun execute(data: ResourceData): PatchResult { override fun execute(data: ResourceData): PatchResult {
data.getXmlEditor("res/xml/settings_fragment.xml").use { data.xmlEditor["res/xml/settings_fragment.xml"].use {
val settingsElementIntent = it.file.createElement("intent") val settingsElementIntent = it.file.createElement("intent")
settingsElementIntent.setAttribute("android:targetPackage", "$BASE_MICROG_PACKAGE_NAME.android.gms") settingsElementIntent.setAttribute("android:targetPackage", "$BASE_MICROG_PACKAGE_NAME.android.gms")
settingsElementIntent.setAttribute("android:targetClass", "org.microg.gms.ui.SettingsActivity") settingsElementIntent.setAttribute("android:targetClass", "org.microg.gms.ui.SettingsActivity")
@@ -39,10 +39,6 @@ class MicroGResourcePatch : ResourcePatch() {
"android:label=\"@string/application_name", "android:label=\"$REVANCED_APP_NAME" "android:label=\"@string/application_name", "android:label=\"$REVANCED_APP_NAME"
).replace( ).replace(
"android:authorities=\"com.google.android.youtube", "android:authorities=\"$REVANCED_PACKAGE_NAME" "android:authorities=\"com.google.android.youtube", "android:authorities=\"$REVANCED_PACKAGE_NAME"
).replace(
"com.google.android.youtube.fileprovider", "$REVANCED_PACKAGE_NAME.fileprovider"
).replace(
"com.google.android.youtube.SuggestionProvider", "$REVANCED_PACKAGE_NAME.SuggestionProvider"
).replace( ).replace(
"com.google.android.youtube.permission.C2D_MESSAGE", "$REVANCED_PACKAGE_NAME.permission.C2D_MESSAGE" "com.google.android.youtube.permission.C2D_MESSAGE", "$REVANCED_PACKAGE_NAME.permission.C2D_MESSAGE"
).replace( // TODO: might not be needed ).replace( // TODO: might not be needed

View File

@@ -1,20 +0,0 @@
package app.revanced.patches.youtube.misc.microg.signatures
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.signature.implementation.method.MethodSignature
import app.revanced.patcher.signature.implementation.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
@Name("cast-context-fetch-signature")
@MatchingMethod(
"Lvvz;", "a"
)
@DirectPatternScanMethod
@MicroGPatchCompatibility
@Version("0.0.1")
object CastContextFetchSignature : MethodSignature(
null, null, null, null,
listOf("Error fetching CastContext.")
)

View File

@@ -1,20 +0,0 @@
package app.revanced.patches.youtube.misc.microg.signatures
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.signature.implementation.method.MethodSignature
import app.revanced.patcher.signature.implementation.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
@Name("cast-module-signature")
@MatchingMethod(
"Llqh;", "c"
)
@DirectPatternScanMethod
@MicroGPatchCompatibility
@Version("0.0.1")
object CastDynamiteModuleSignature : MethodSignature(
null, null, null, null,
listOf("com.google.android.gms.cast.framework.internal.CastDynamiteModuleImpl")
)

View File

@@ -1,20 +0,0 @@
package app.revanced.patches.youtube.misc.microg.signatures
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.signature.implementation.method.MethodSignature
import app.revanced.patcher.signature.implementation.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
@Name("cast-context-fetch-signature")
@MatchingMethod(
"Lmcf;", "c"
)
@DirectPatternScanMethod
@MicroGPatchCompatibility
@Version("0.0.1")
object CastDynamiteModuleV2Signature : MethodSignature(
null, null, null, null,
listOf("Failed to load module via V2: ")
)

View File

@@ -1,19 +0,0 @@
package app.revanced.patches.youtube.misc.microg.signatures
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.signature.implementation.method.MethodSignature
import app.revanced.patcher.signature.implementation.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.signature.implementation.method.annotation.MatchingMethod
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
@Name("google-play-prime-signature")
@MatchingMethod(
"Lpag;", "d"
)
@DirectPatternScanMethod
@MicroGPatchCompatibility
@Version("0.0.1")
object PrimeSignature : MethodSignature(
null, null, null, null, listOf("com.google.android.GoogleCamera", "com.android.vending")
)