mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-12-12 04:13:57 +01:00
Compare commits
3 Commits
v2.145.0-d
...
v2.6.0-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3de6790e9f | ||
|
|
c95c241887 | ||
|
|
0f05fbfad9 |
73
.github/ISSUE_TEMPLATE/bug-issue.yml
vendored
73
.github/ISSUE_TEMPLATE/bug-issue.yml
vendored
@@ -1,73 +0,0 @@
|
|||||||
name: 🐞 Bug report
|
|
||||||
description: Report a very clearly broken issue.
|
|
||||||
title: 'bug: <title>'
|
|
||||||
labels: [bug]
|
|
||||||
body:
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: |
|
|
||||||
# ReVanced bug report
|
|
||||||
|
|
||||||
Important to note that your issue may have already been reported before. Please check for existing issues [here](https://github.com/revanced/revanced-patches/labels/bug).
|
|
||||||
|
|
||||||
- type: dropdown
|
|
||||||
attributes:
|
|
||||||
label: Type
|
|
||||||
options:
|
|
||||||
- Error while patching
|
|
||||||
- Error at runtime
|
|
||||||
- Cosmetic
|
|
||||||
- Other
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Bug description
|
|
||||||
description: How did you find the bug? Any additional details that might help?
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Steps to reproduce
|
|
||||||
description: Add the steps to reproduce this bug including your environment.
|
|
||||||
placeholder: Step 1. Download some files. Step 2. ...
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Relevant log output
|
|
||||||
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
|
|
||||||
render: shell
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Screenshots or videos
|
|
||||||
description: Add screenshots or videos that show the bug here.
|
|
||||||
placeholder: Drag and drop the screenshots/videos into this box.
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Solution
|
|
||||||
description: If applicable, add a possible solution.
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Additional context
|
|
||||||
description: Add additional context here.
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
- type: checkboxes
|
|
||||||
id: acknowledgements
|
|
||||||
attributes:
|
|
||||||
label: Acknowledgements
|
|
||||||
description: Your issue will be closed if you haven't done these steps.
|
|
||||||
options:
|
|
||||||
- label: I have searched the existing issues and this is a new and no duplicate or related to another open issue.
|
|
||||||
required: true
|
|
||||||
- label: I have written a short but informative title.
|
|
||||||
required: true
|
|
||||||
- label: I filled out all of the requested information in this issue properly.
|
|
||||||
required: true
|
|
||||||
8
.github/ISSUE_TEMPLATE/config.yml
vendored
8
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,8 +0,0 @@
|
|||||||
blank_issues_enabled: false
|
|
||||||
contact_links:
|
|
||||||
- name: 📃 Documentation
|
|
||||||
url: https://github.com/revanced/revanced-documentation/
|
|
||||||
about: Don't know how or where to start? Check out our documentation!
|
|
||||||
- name: 🗨 Discussions
|
|
||||||
url: https://github.com/revanced/revanced-suggestions/discussions
|
|
||||||
about: Got something you think should change or be added? Search for or start a new discussion!
|
|
||||||
41
.github/ISSUE_TEMPLATE/patch-request.yml
vendored
41
.github/ISSUE_TEMPLATE/patch-request.yml
vendored
@@ -1,41 +0,0 @@
|
|||||||
name: ⭐ Patch Request
|
|
||||||
description: Create a detailed patch request.
|
|
||||||
title: 'feat(patch): '
|
|
||||||
labels: [patch-request]
|
|
||||||
body:
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Application
|
|
||||||
description: Which application is this patch for?
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Issue
|
|
||||||
description: What is the issue this patch should solve?
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Patch
|
|
||||||
description: "Describe the patch you'd like to see in detail."
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Motivation
|
|
||||||
description: Why should your patch request should be considered? What makes it valuable to the community?
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: checkboxes
|
|
||||||
id: acknowledgements
|
|
||||||
attributes:
|
|
||||||
label: Acknowledgements
|
|
||||||
description: Your issue will be closed if you haven't done these steps.
|
|
||||||
options:
|
|
||||||
- label: I have searched the existing issues and this is a new and no duplicate or related to another open issue.
|
|
||||||
required: true
|
|
||||||
- label: I have written a short but informative title.
|
|
||||||
required: true
|
|
||||||
- label: I filled out all of the requested information in this issue properly.
|
|
||||||
required: true
|
|
||||||
24
.github/workflows/pull_request.yml
vendored
24
.github/workflows/pull_request.yml
vendored
@@ -1,24 +0,0 @@
|
|||||||
name: PR to main
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- dev
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
env:
|
|
||||||
MESSAGE: merge branch \`${{ github.head_ref || github.ref_name }}\` to \`main\`
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
pull-request:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Open pull request
|
|
||||||
uses: repo-sync/pull-request@v2
|
|
||||||
with:
|
|
||||||
destination_branch: 'main'
|
|
||||||
pr_title: 'chore: ${{ env.MESSAGE }}'
|
|
||||||
pr_body: 'This pull request will ${{ env.MESSAGE }}.'
|
|
||||||
pr_draft: true
|
|
||||||
25
.github/workflows/release.yml
vendored
25
.github/workflows/release.yml
vendored
@@ -12,35 +12,32 @@ 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@v3
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Setup JDK
|
- name: Setup JDK
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
java-version: '17'
|
java-version: '17'
|
||||||
distribution: 'zulu'
|
distribution: 'adopt'
|
||||||
cache: gradle
|
cache: gradle
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: 'latest'
|
node-version: "lts/*"
|
||||||
cache: 'npm'
|
|
||||||
- name: Setup Android SDK
|
- name: Setup Android SDK
|
||||||
uses: amyu/setup-android@v2
|
uses: android-actions/setup-android@v2
|
||||||
with:
|
|
||||||
cache-disabled: false
|
|
||||||
sdk-version: '33'
|
|
||||||
build-tools-version: '33.0.1'
|
|
||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: ./gradlew generateMeta clean --no-daemon
|
run: ./gradlew build clean
|
||||||
|
- name: Install Android build-tools
|
||||||
|
run: sdkmanager "build-tools;32.0.0"
|
||||||
- name: Setup semantic-release
|
- name: Setup semantic-release
|
||||||
run: npm install semantic-release @saithodev/semantic-release-backmerge @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
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -115,9 +115,3 @@ gradle-app.setting
|
|||||||
|
|
||||||
# Potentially copyrighted test APK
|
# Potentially copyrighted test APK
|
||||||
*.apk
|
*.apk
|
||||||
|
|
||||||
# Ignore vscode config
|
|
||||||
.vscode/
|
|
||||||
|
|
||||||
# Dependency directories
|
|
||||||
node_modules/
|
|
||||||
1
.idea/.gitignore
generated
vendored
1
.idea/.gitignore
generated
vendored
@@ -6,4 +6,3 @@
|
|||||||
/dataSources.local.xml
|
/dataSources.local.xml
|
||||||
# Editor-based HTTP Client requests
|
# Editor-based HTTP Client requests
|
||||||
/httpRequests/
|
/httpRequests/
|
||||||
/kotlinc.xml
|
|
||||||
|
|||||||
12
.releaserc
12
.releaserc
@@ -15,10 +15,8 @@
|
|||||||
"@semantic-release/git",
|
"@semantic-release/git",
|
||||||
{
|
{
|
||||||
"assets": [
|
"assets": [
|
||||||
"README.md",
|
|
||||||
"CHANGELOG.md",
|
"CHANGELOG.md",
|
||||||
"gradle.properties",X
|
"gradle.properties"
|
||||||
"patches.json"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -30,16 +28,10 @@
|
|||||||
"path": "build/libs/*.jar"
|
"path": "build/libs/*.jar"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "patches.json"
|
"path": "build/libs/*.dex"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
|
||||||
[
|
|
||||||
"@saithodev/semantic-release-backmerge",
|
|
||||||
{
|
|
||||||
"branches": [{from: "main", to: "dev"}]
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
2091
CHANGELOG.md
2091
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@@ -1,122 +0,0 @@
|
|||||||
## 🧩 Patches
|
|
||||||
|
|
||||||
The official Patch bundle provided by ReVanced and the community.
|
|
||||||
|
|
||||||
> Looking for the JSON variant of this? [Click here](patches.json).
|
|
||||||
|
|
||||||
{{ table }}
|
|
||||||
|
|
||||||
## 📝 JSON Format
|
|
||||||
|
|
||||||
This section explains the JSON format for the [patches.json](patches.json) file.
|
|
||||||
|
|
||||||
The file contains an array of objects, each object representing a patch. The object contains the following properties:
|
|
||||||
|
|
||||||
| key | description |
|
|
||||||
|-------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
||||||
| `name` | The name of the patch. |
|
|
||||||
| `description` | The description of the patch. |
|
|
||||||
| `version` | The version of the patch. |
|
|
||||||
| `excluded` | Whether the patch is excluded by default. If `true`, the patch must never be included by default. |
|
|
||||||
| `options` | An array of options for this patch. |
|
|
||||||
| `options.key` | The key of the option. |
|
|
||||||
| `options.title` | The title of the option. |
|
|
||||||
| `options.description` | The description of the option. |
|
|
||||||
| `options.required` | Whether the option is required. |
|
|
||||||
| `options.choices?` | An array of choices of the option. This may be `null` if this option has no choices. The element type of this array may be any type. It can be a `String`, `Int` or something else. |
|
|
||||||
| `dependencies` | An array of dependencies, which are patch names. |
|
|
||||||
| `compatiblePackages` | An array of packages compatible with this patch. |
|
|
||||||
| `compatiblePackages.name` | The name of the package. |
|
|
||||||
| `compatiblePackages.versions` | An array of versions of the package compatible with this patch. If empty, all versions are seemingly compatible. |
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```json
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"name": "remember-video-quality",
|
|
||||||
"description": "Adds the ability to remember the video quality you chose in the video quality flyout.",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"excluded": false,
|
|
||||||
"options": [],
|
|
||||||
"dependencies": [
|
|
||||||
"integrations",
|
|
||||||
"video-id-hook"
|
|
||||||
],
|
|
||||||
"compatiblePackages": [
|
|
||||||
{
|
|
||||||
"name": "com.google.android.youtube",
|
|
||||||
"versions": [
|
|
||||||
"17.22.36",
|
|
||||||
"17.24.35",
|
|
||||||
"17.26.35",
|
|
||||||
"17.27.39",
|
|
||||||
"17.28.34",
|
|
||||||
"17.29.34",
|
|
||||||
"17.32.35",
|
|
||||||
"17.33.42"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "theme",
|
|
||||||
"description": "Enables a custom theme.",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"excluded": false,
|
|
||||||
"deprecated": false,
|
|
||||||
"options": [
|
|
||||||
{
|
|
||||||
"key": "theme",
|
|
||||||
"title": "Theme",
|
|
||||||
"description": "Select a theme.",
|
|
||||||
"required": true,
|
|
||||||
"choices": [
|
|
||||||
"Amoled"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dependencies": [
|
|
||||||
"locale-config-fix"
|
|
||||||
],
|
|
||||||
"compatiblePackages": [
|
|
||||||
{
|
|
||||||
"name": "com.google.android.youtube",
|
|
||||||
"versions": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "custom-branding",
|
|
||||||
"description": "Changes the YouTube launcher icon and name to your choice (defaults to ReVanced).",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"excluded": false,
|
|
||||||
"deprecated": false,
|
|
||||||
"options": [
|
|
||||||
{
|
|
||||||
"key": "appName",
|
|
||||||
"title": "Application Name",
|
|
||||||
"description": "The name of the application it will show on your home screen.",
|
|
||||||
"required": true,
|
|
||||||
"choices": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "appIconPath",
|
|
||||||
"title": "Application Icon Path",
|
|
||||||
"description": "A path to the icon of the application.",
|
|
||||||
"required": false,
|
|
||||||
"choices": null
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dependencies": [
|
|
||||||
"locale-config-fix"
|
|
||||||
],
|
|
||||||
"compatiblePackages": [
|
|
||||||
{
|
|
||||||
"name": "com.google.android.youtube",
|
|
||||||
"versions": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
```
|
|
||||||
364
README.md
364
README.md
@@ -1,363 +1 @@
|
|||||||
## 🧩 Patches
|
Repo for all ReVanced patches
|
||||||
|
|
||||||
The official Patch bundle provided by ReVanced and the community.
|
|
||||||
|
|
||||||
> Looking for the JSON variant of this? [Click here](patches.json).
|
|
||||||
|
|
||||||
### [📦 `com.google.android.youtube`](https://play.google.com/store/apps/details?id=com.google.android.youtube)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `always-autorepeat` | Always repeats the playing video again. | 17.45.36 |
|
|
||||||
| `client-spoof` | Spoofs the YouTube or Vanced client to prevent playback issues. | all |
|
|
||||||
| `comments` | Hides components related to comments. | 17.45.36 |
|
|
||||||
| `custom-branding` | Changes the YouTube launcher icon and name to your choice (defaults to ReVanced). | all |
|
|
||||||
| `custom-video-buffer` | Lets you change the buffers of videos. | 17.45.36 |
|
|
||||||
| `custom-video-speed` | Adds more video speed options. | 17.45.36 |
|
|
||||||
| `debugging` | Adds debugging options. | all |
|
|
||||||
| `disable-auto-captions` | Disable forced captions from being automatically enabled. | 17.45.36 |
|
|
||||||
| `disable-auto-player-popup-panels` | Disable automatic popup panels (playlist or live chat) on video player. | 17.45.36 |
|
|
||||||
| `disable-fullscreen-panels` | Disables video description and comments panel in fullscreen view. | 17.45.36 |
|
|
||||||
| `disable-startup-shorts-player` | Disables playing YouTube Shorts when launching YouTube. | 17.45.36 |
|
|
||||||
| `disable-zoom-haptics` | Disables haptics when zooming. | all |
|
|
||||||
| `downloads` | Enables downloading music and videos from YouTube. | 17.45.36 |
|
|
||||||
| `enable-wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | 17.45.36 |
|
|
||||||
| `general-ads` | Removes general ads. | 17.45.36 |
|
|
||||||
| `hdr-auto-brightness` | Makes the brightness of HDR videos follow the system default. | 17.45.36 |
|
|
||||||
| `hide-album-cards` | Hides the album cards below the artist description. | 17.45.36 |
|
|
||||||
| `hide-artist-card` | Hides the artist card below the searchbar. | 17.45.36 |
|
|
||||||
| `hide-autoplay-button` | Hides the autoplay button in the video player. | 17.45.36 |
|
|
||||||
| `hide-captions-button` | Hides the captions button on video player. | 17.45.36 |
|
|
||||||
| `hide-cast-button` | Hides the cast button in the video player. | all |
|
|
||||||
| `hide-create-button` | Hides the create button in the navigation bar. | 17.45.36 |
|
|
||||||
| `hide-crowdfunding-box` | Hides the crowdfunding box between the player and video description. | 17.45.36 |
|
|
||||||
| `hide-email-address` | Hides the email address in the account switcher. | 17.45.36 |
|
|
||||||
| `hide-endscreen-cards` | Hides the suggested video cards at the end of a video in fullscreen. | 17.45.36 |
|
|
||||||
| `hide-info-cards` | Hides info-cards in videos. | 17.45.36 |
|
|
||||||
| `hide-my-mix` | Hides mix playlists. | 17.45.36 |
|
|
||||||
| `hide-shorts-button` | Hides the shorts button on the navigation bar. | 17.45.36 |
|
|
||||||
| `hide-time-and-seekbar` | Hides progress bar and time counter on videos. | 17.45.36 |
|
|
||||||
| `hide-video-buttons` | Adds options to hide action buttons under a video. | 17.45.36 |
|
|
||||||
| `hide-watch-in-vr` | Hides the Watch in VR option in the player settings flyout panel. | 17.45.36 |
|
|
||||||
| `hide-watermark` | Hides creator's watermarks on videos. | 17.45.36 |
|
|
||||||
| `microg-support` | Allows YouTube ReVanced to run without root and under a different package name with Vanced MicroG. | 17.45.36 |
|
|
||||||
| `minimized-playback` | Enables minimized and background playback. | 17.45.36 |
|
|
||||||
| `old-quality-layout` | Enables the original video quality flyout in the video player settings | 17.45.36 |
|
|
||||||
| `open-links-directly` | Bypasses URL redirects and opens links directly inside YouTube app. | 17.45.36 |
|
|
||||||
| `premium-heading` | Shows premium branding on the home screen. | all |
|
|
||||||
| `remember-video-quality` | Adds the ability to remember the video quality you chose in the video quality flyout. | 17.45.36 |
|
|
||||||
| `remove-player-button-background` | Removes the background from the video player buttons. | 17.45.36 |
|
|
||||||
| `return-youtube-dislike` | Shows the dislike count of videos using the Return YouTube Dislike API. | 17.45.36 |
|
|
||||||
| `seekbar-tapping` | Enables tap-to-seek on the seekbar of the video player. | 17.45.36 |
|
|
||||||
| `settings` | Adds settings for ReVanced to YouTube. | all |
|
|
||||||
| `sponsorblock` | Integrate SponsorBlock. | 17.45.36 |
|
|
||||||
| `swipe-controls` | Adds volume and brightness swipe controls. | 17.45.36 |
|
|
||||||
| `tablet-mini-player` | Enables the tablet mini player layout. | 17.45.36 |
|
|
||||||
| `theme` | Applies a custom theme. | all |
|
|
||||||
| `video-ads` | Removes ads in the video player. | 17.45.36 |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `com.google.android.apps.youtube.music`](https://play.google.com/store/apps/details?id=com.google.android.apps.youtube.music)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `background-play` | Enables playing music in the background. | 5.36.51 |
|
|
||||||
| `codecs-unlock` | Adds more audio codec options. The new audio codecs usually result in better audio quality. | 5.36.51 |
|
|
||||||
| `compact-header` | Hides the music category bar at the top of the homepage. | 5.36.51 |
|
|
||||||
| `exclusive-audio-playback` | Enables the option to play music without video. | 5.36.51 |
|
|
||||||
| `hide-get-premium` | Removes all "Get Premium" evidences from the avatar menu. | 5.36.51 |
|
|
||||||
| `minimized-playback-music` | Enables minimized playback on Kids music. | 5.36.51 |
|
|
||||||
| `music-microg-support` | Allows YouTube Music ReVanced to run without root and under a different package name. | 5.36.51 |
|
|
||||||
| `music-video-ads` | Removes ads in the music player. | 5.36.51 |
|
|
||||||
| `tasteBuilder-remover` | Removes the "Tell us which artists you like" card from the home screen. | 5.36.51 |
|
|
||||||
| `upgrade-button-remover` | Removes the upgrade tab from the pivot bar. | 5.36.51 |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `com.ss.android.ugc.trill`](https://play.google.com/store/apps/details?id=com.ss.android.ugc.trill)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `disable-login-requirement` | Do not force login. | all |
|
|
||||||
| `downloads` | Removes download restrictions and changes the default path to download to. | all |
|
|
||||||
| `feed-filter` | Filters tiktok videos: removing ads, removing livestreams. | all |
|
|
||||||
| `fix-google-login` | Allows logging in with a Google account. | all |
|
|
||||||
| `hide-ads` | Removes ads from TikTok. | all |
|
|
||||||
| `playback-speed` | Enables the playback speed option for all videos. | all |
|
|
||||||
| `settings` | Adds ReVanced settings to TikTok. | all |
|
|
||||||
| `show-seekbar` | Shows progress bar for all video. | all |
|
|
||||||
| `sim-spoof` | Spoofs the information which is retrieved from the sim-card. | all |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `com.zhiliaoapp.musically`](https://play.google.com/store/apps/details?id=com.zhiliaoapp.musically)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `disable-login-requirement` | Do not force login. | all |
|
|
||||||
| `downloads` | Removes download restrictions and changes the default path to download to. | all |
|
|
||||||
| `feed-filter` | Filters tiktok videos: removing ads, removing livestreams. | all |
|
|
||||||
| `fix-google-login` | Allows logging in with a Google account. | all |
|
|
||||||
| `hide-ads` | Removes ads from TikTok. | all |
|
|
||||||
| `playback-speed` | Enables the playback speed option for all videos. | all |
|
|
||||||
| `settings` | Adds ReVanced settings to TikTok. | all |
|
|
||||||
| `show-seekbar` | Shows progress bar for all video. | all |
|
|
||||||
| `sim-spoof` | Spoofs the information which is retrieved from the sim-card. | all |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `tv.twitch.android.app`](https://play.google.com/store/apps/details?id=tv.twitch.android.app)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `block-audio-ads` | Blocks audio ads in streams and VODs. | all |
|
|
||||||
| `block-embedded-ads` | Blocks embedded steam ads using services like TTV.lol or PurpleAdBlocker. | all |
|
|
||||||
| `block-video-ads` | Blocks video ads in streams and VODs. | all |
|
|
||||||
| `debug-mode` | Enables Twitch's internal debugging mode. | all |
|
|
||||||
| `settings` | Adds settings menu to Twitch. | all |
|
|
||||||
| `show-deleted-messages` | Shows deleted chat messages behind a clickable spoiler. | all |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `com.spotify.music`](https://play.google.com/store/apps/details?id=com.spotify.music)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `disable-capture-restriction` | Allows capturing Spotify's audio output while screen sharing or screen recording. | all |
|
|
||||||
| `hide-premium-navbar` | Removes the premium tab from the navbar. | all |
|
|
||||||
| `spotify-theme` | Applies a custom theme. | all |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `com.twitter.android`](https://play.google.com/store/apps/details?id=com.twitter.android)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `dynamic-color` | Replaces the default Twitter Blue with the users Material You palette. | all |
|
|
||||||
| `monochrome-icon` | Adds a monochrome icon. | all |
|
|
||||||
| `timeline-ads` | Removes ads from the Twitter timeline. | all |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `com.reddit.frontpage`](https://play.google.com/store/apps/details?id=com.reddit.frontpage)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `general-reddit-ads` | Removes general ads from the Reddit frontpage and subreddits. | all |
|
|
||||||
| `premium-icon-reddit` | Unlocks premium Reddit app icons. | all |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `com.vanced.android.youtube`](https://play.google.com/store/apps/details?id=com.vanced.android.youtube)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `client-spoof` | Spoofs the YouTube or Vanced client to prevent playback issues. | all |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `com.myprog.hexedit`](https://play.google.com/store/apps/details?id=com.myprog.hexedit)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `disable-ads` | Disables ads in HexEditor. | all |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `org.citra.citra_emu`](https://play.google.com/store/apps/details?id=org.citra.citra_emu)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `premium-unlock` | Unlocks premium functions. | all |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `org.citra.citra_emu.canary`](https://play.google.com/store/apps/details?id=org.citra.citra_emu.canary)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `premium-unlock` | Unlocks premium functions. | all |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `com.backdrops.wallpapers`](https://play.google.com/store/apps/details?id=com.backdrops.wallpapers)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `pro-unlock` | Unlocks pro-only functions. | all |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `de.dwd.warnapp`](https://play.google.com/store/apps/details?id=de.dwd.warnapp)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `promo-code-unlock` | Disables the validation of promo code. Any code will work to unlock all features. | all |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `co.windyapp.android`](https://play.google.com/store/apps/details?id=co.windyapp.android)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `unlock-pro` | Unlocks all pro features. | all |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `org.totschnig.myexpenses`](https://play.google.com/store/apps/details?id=org.totschnig.myexpenses)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `unlock-pro` | Unlocks all professional features. | all |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `com.awedea.nyx`](https://play.google.com/store/apps/details?id=com.awedea.nyx)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `unlock-pro` | Unlocks all pro features. | all |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `com.ithebk.expensemanager`](https://play.google.com/store/apps/details?id=com.ithebk.expensemanager)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `unlock-pro` | Unlocks pro features. | all |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `ginlemon.iconpackstudio`](https://play.google.com/store/apps/details?id=ginlemon.iconpackstudio)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `unlock-pro` | Unlocks all pro features. | all |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `com.ticktick.task`](https://play.google.com/store/apps/details?id=com.ticktick.task)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `unlock-themes` | Unlocks all themes. | all |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 📝 JSON Format
|
|
||||||
|
|
||||||
This section explains the JSON format for the [patches.json](patches.json) file.
|
|
||||||
|
|
||||||
The file contains an array of objects, each object representing a patch. The object contains the following properties:
|
|
||||||
|
|
||||||
| key | description |
|
|
||||||
|-------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
||||||
| `name` | The name of the patch. |
|
|
||||||
| `description` | The description of the patch. |
|
|
||||||
| `version` | The version of the patch. |
|
|
||||||
| `excluded` | Whether the patch is excluded by default. If `true`, the patch must never be included by default. |
|
|
||||||
| `options` | An array of options for this patch. |
|
|
||||||
| `options.key` | The key of the option. |
|
|
||||||
| `options.title` | The title of the option. |
|
|
||||||
| `options.description` | The description of the option. |
|
|
||||||
| `options.required` | Whether the option is required. |
|
|
||||||
| `options.choices?` | An array of choices of the option. This may be `null` if this option has no choices. The element type of this array may be any type. It can be a `String`, `Int` or something else. |
|
|
||||||
| `dependencies` | An array of dependencies, which are patch names. |
|
|
||||||
| `compatiblePackages` | An array of packages compatible with this patch. |
|
|
||||||
| `compatiblePackages.name` | The name of the package. |
|
|
||||||
| `compatiblePackages.versions` | An array of versions of the package compatible with this patch. If empty, all versions are seemingly compatible. |
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```json
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"name": "remember-video-quality",
|
|
||||||
"description": "Adds the ability to remember the video quality you chose in the video quality flyout.",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"excluded": false,
|
|
||||||
"options": [],
|
|
||||||
"dependencies": [
|
|
||||||
"integrations",
|
|
||||||
"video-id-hook"
|
|
||||||
],
|
|
||||||
"compatiblePackages": [
|
|
||||||
{
|
|
||||||
"name": "com.google.android.youtube",
|
|
||||||
"versions": [
|
|
||||||
"17.22.36",
|
|
||||||
"17.24.35",
|
|
||||||
"17.26.35",
|
|
||||||
"17.27.39",
|
|
||||||
"17.28.34",
|
|
||||||
"17.29.34",
|
|
||||||
"17.32.35",
|
|
||||||
"17.33.42"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "theme",
|
|
||||||
"description": "Enables a custom theme.",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"excluded": false,
|
|
||||||
"deprecated": false,
|
|
||||||
"options": [
|
|
||||||
{
|
|
||||||
"key": "theme",
|
|
||||||
"title": "Theme",
|
|
||||||
"description": "Select a theme.",
|
|
||||||
"required": true,
|
|
||||||
"choices": [
|
|
||||||
"Amoled"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dependencies": [
|
|
||||||
"locale-config-fix"
|
|
||||||
],
|
|
||||||
"compatiblePackages": [
|
|
||||||
{
|
|
||||||
"name": "com.google.android.youtube",
|
|
||||||
"versions": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "custom-branding",
|
|
||||||
"description": "Changes the YouTube launcher icon and name to your choice (defaults to ReVanced).",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"excluded": false,
|
|
||||||
"deprecated": false,
|
|
||||||
"options": [
|
|
||||||
{
|
|
||||||
"key": "appName",
|
|
||||||
"title": "Application Name",
|
|
||||||
"description": "The name of the application it will show on your home screen.",
|
|
||||||
"required": true,
|
|
||||||
"choices": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "appIconPath",
|
|
||||||
"title": "Application Icon Path",
|
|
||||||
"description": "A path to the icon of the application.",
|
|
||||||
"required": false,
|
|
||||||
"choices": null
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dependencies": [
|
|
||||||
"locale-config-fix"
|
|
||||||
],
|
|
||||||
"compatiblePackages": [
|
|
||||||
{
|
|
||||||
"name": "com.google.android.youtube",
|
|
||||||
"versions": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -20,21 +20,22 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("app.revanced:revanced-patcher:6.3.1")
|
implementation(kotlin("stdlib"))
|
||||||
|
|
||||||
|
implementation("app.revanced:revanced-patcher:2.1.2")
|
||||||
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
||||||
// Required for meta
|
|
||||||
implementation("com.google.code.gson:gson:2.10")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
register<DefaultTask>("generateBundle") {
|
register<DefaultTask>("generateDex") {
|
||||||
description = "Generate dex files from build and bundle them in the jar file"
|
description = "Generate dex files from build"
|
||||||
dependsOn(build)
|
dependsOn(build)
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
val androidHome = System.getenv("ANDROID_HOME") ?: throw GradleException("ANDROID_HOME not found")
|
val androidHome = System.getenv("ANDROID_HOME") ?: throw GradleException("ANDROID_HOME not found")
|
||||||
val d8 = "${androidHome}/build-tools/33.0.1/d8"
|
val d8 = "${androidHome}/build-tools/32.0.0/d8"
|
||||||
val input = configurations.archives.get().allArtifacts.files.files.first().absolutePath
|
val input = configurations.archives.get().allArtifacts.files.files.first().absolutePath
|
||||||
|
val output = input.replace(".jar", ".dex")
|
||||||
val work = File("${buildDir}/libs")
|
val work = File("${buildDir}/libs")
|
||||||
|
|
||||||
exec {
|
exec {
|
||||||
@@ -44,23 +45,16 @@ tasks {
|
|||||||
|
|
||||||
exec {
|
exec {
|
||||||
workingDir = work
|
workingDir = work
|
||||||
commandLine = listOf("zip", "-u", input, "classes.dex")
|
commandLine = listOf("mv", "classes.dex", output)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
register<JavaExec>("generateMeta") {
|
|
||||||
description = "Generate metadata for this bundle"
|
|
||||||
dependsOn(build)
|
|
||||||
|
|
||||||
classpath = sourceSets["main"].runtimeClasspath
|
|
||||||
mainClass.set("app.revanced.meta.Meta")
|
|
||||||
}
|
|
||||||
// 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(named("generateBundle"), named("generateMeta"))
|
dependsOn(named("generateDex"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.145.0-dev.1
|
version = 2.6.0-dev.1
|
||||||
|
|||||||
6107
package-lock.json
generated
6107
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"devDependencies": {
|
|
||||||
"@semantic-release/changelog": "^6.0.2",
|
|
||||||
"@semantic-release/git": "^10.0.1",
|
|
||||||
"gradle-semantic-release-plugin": "^1.7.4",
|
|
||||||
"semantic-release": "^19.0.5"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,44 +1,36 @@
|
|||||||
package app.revanced.extensions
|
package app.revanced.extensions
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
|
import app.revanced.patcher.util.smali.toInstruction
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import org.jf.dexlib2.builder.MutableMethodImplementation
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
|
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
|
||||||
import org.jf.dexlib2.iface.Method
|
|
||||||
import org.jf.dexlib2.util.MethodUtil
|
|
||||||
import org.w3c.dom.Node
|
import org.w3c.dom.Node
|
||||||
|
|
||||||
// TODO: populate this to all patches
|
internal fun MutableMethodImplementation.injectHideCall(
|
||||||
/**
|
index: Int,
|
||||||
* Convert a [MethodFingerprint] to a [PatchResultError].
|
register: Int
|
||||||
*
|
) {
|
||||||
* @return A [PatchResultError] for the [MethodFingerprint].
|
this.addInstruction(
|
||||||
*/
|
index,
|
||||||
fun MethodFingerprint.toErrorResult() = PatchResultError("Failed to resolve $name")
|
"invoke-static { v$register }, Lapp/revanced/integrations/patches/HideHomeAdsPatch;->HideHomeAds(Landroid/view/View;)V".toInstruction()
|
||||||
|
)
|
||||||
/**
|
|
||||||
* Find the [MutableMethod] from a given [Method] in a [MutableClass].
|
|
||||||
*
|
|
||||||
* @param method The [Method] to find.
|
|
||||||
* @return The [MutableMethod].
|
|
||||||
*/
|
|
||||||
fun MutableClass.findMutableMethodOf(method: Method) = this.methods.first {
|
|
||||||
MethodUtil.methodSignaturesMatch(it, method)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* apply a transform to all methods of the class
|
|
||||||
*
|
|
||||||
* @param transform the transformation function. original method goes in, transformed method goes out
|
|
||||||
*/
|
|
||||||
fun MutableClass.transformMethods(transform: MutableMethod.() -> MutableMethod) {
|
|
||||||
val transformedMethods = methods.map { it.transform() }
|
|
||||||
methods.clear()
|
|
||||||
methods.addAll(transformedMethods)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun Node.doRecursively(action: (Node) -> Unit) {
|
internal fun Node.doRecursively(action: (Node) -> Unit) {
|
||||||
action(this)
|
action(this)
|
||||||
for (i in 0 until this.childNodes.length) this.childNodes.item(i).doRecursively(action)
|
for (i in 0 until this.childNodes.length) this.childNodes.item(i).doRecursively(action)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal fun String.startsWithAny(vararg prefixes: String): Boolean {
|
||||||
|
for (prefix in prefixes)
|
||||||
|
if (this.startsWith(prefix))
|
||||||
|
return true
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
internal fun String.equalsAny(vararg other: String): Boolean {
|
||||||
|
for (_other in other)
|
||||||
|
if (this == _other)
|
||||||
|
return true
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
package app.revanced.meta
|
|
||||||
|
|
||||||
import app.revanced.meta.json.generateJson
|
|
||||||
import app.revanced.meta.readme.generateText
|
|
||||||
import app.revanced.patcher.data.Context
|
|
||||||
import app.revanced.patcher.patch.Patch
|
|
||||||
import app.revanced.patcher.util.patch.PatchBundle
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
typealias Bundle = List<Class<out Patch<Context>>>
|
|
||||||
|
|
||||||
object Meta {
|
|
||||||
@JvmStatic
|
|
||||||
fun main(args: Array<String>) {
|
|
||||||
val patches = accumulatePatches()
|
|
||||||
if (patches.isEmpty()) throw IllegalStateException("No patches found")
|
|
||||||
|
|
||||||
generateText(patches)
|
|
||||||
generateJson(patches)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun accumulatePatches() = PatchBundle.Jar(
|
|
||||||
File("build/libs/").listFiles()!!.first {
|
|
||||||
it.name.startsWith("revanced-patches-") && it.name.endsWith(".jar")
|
|
||||||
}.absolutePath
|
|
||||||
).loadPatches()
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
package app.revanced.meta.json
|
|
||||||
|
|
||||||
import app.revanced.meta.Bundle
|
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.dependencies
|
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.description
|
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.include
|
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.options
|
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.version
|
|
||||||
import app.revanced.patcher.patch.PatchOption
|
|
||||||
import com.google.gson.GsonBuilder
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
private val gson = GsonBuilder().serializeNulls().create()
|
|
||||||
|
|
||||||
fun generateJson(bundle: Bundle) {
|
|
||||||
val patches = bundle.map {
|
|
||||||
JsonPatch(
|
|
||||||
it.patchName,
|
|
||||||
it.description ?: "This patch has no description.",
|
|
||||||
it.version ?: "0.0.0",
|
|
||||||
!it.include,
|
|
||||||
it.options?.map { option ->
|
|
||||||
Option(
|
|
||||||
option.key,
|
|
||||||
option.title,
|
|
||||||
option.description,
|
|
||||||
option.required,
|
|
||||||
option.let { lo ->
|
|
||||||
if (lo is PatchOption.ListOption<*>) {
|
|
||||||
lo.options.toMutableList().toTypedArray()
|
|
||||||
} else null
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}?.toTypedArray() ?: emptyArray(),
|
|
||||||
it.dependencies?.map { dep ->
|
|
||||||
dep.java.patchName
|
|
||||||
}?.toTypedArray() ?: emptyArray(),
|
|
||||||
it.compatiblePackages?.map { pkg ->
|
|
||||||
CompatiblePackage(pkg.name, pkg.versions)
|
|
||||||
}?.toTypedArray() ?: emptyArray()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
val json = File("patches.json")
|
|
||||||
json.writeText(gson.toJson(patches))
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
@file:Suppress("ArrayInDataClass") // We don't need it here.
|
|
||||||
|
|
||||||
package app.revanced.meta.json
|
|
||||||
|
|
||||||
data class JsonPatch(
|
|
||||||
val name: String,
|
|
||||||
val description: String,
|
|
||||||
val version: String,
|
|
||||||
val excluded: Boolean,
|
|
||||||
val options: Array<Option>,
|
|
||||||
val dependencies: Array<String>,
|
|
||||||
val compatiblePackages: Array<CompatiblePackage>,
|
|
||||||
)
|
|
||||||
|
|
||||||
data class CompatiblePackage(
|
|
||||||
val name: String,
|
|
||||||
val versions: Array<String>,
|
|
||||||
)
|
|
||||||
|
|
||||||
data class Option(
|
|
||||||
val key: String,
|
|
||||||
val title: String,
|
|
||||||
val description: String,
|
|
||||||
val required: Boolean,
|
|
||||||
val choices: Array<*>?,
|
|
||||||
)
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package app.revanced.meta.readme
|
|
||||||
|
|
||||||
import app.revanced.patcher.data.Context
|
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
|
||||||
import app.revanced.patcher.patch.Patch
|
|
||||||
|
|
||||||
internal fun Class<out Patch<Context>>.getLatestVersion() =
|
|
||||||
this.compatiblePackages?.first()?.versions?.map {
|
|
||||||
SemanticVersion.fromString(it)
|
|
||||||
}?.maxWithOrNull(SemanticVersionComparator)
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
package app.revanced.meta.readme
|
|
||||||
|
|
||||||
import app.revanced.meta.Bundle
|
|
||||||
import app.revanced.patcher.data.Context
|
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.description
|
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
|
||||||
import app.revanced.patcher.patch.Patch
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
private const val TABLE_HEADER =
|
|
||||||
"| \uD83D\uDC8A Patch | \uD83D\uDCDC Description | \uD83C\uDFF9 Target Version |\n" + "|:--------:|:--------------:|:-----------------:|"
|
|
||||||
|
|
||||||
private val TABLE_REGEX = Regex("\\{\\{\\s?table\\s?}}")
|
|
||||||
|
|
||||||
fun generateText(bundle: Bundle) {
|
|
||||||
val output = StringBuilder()
|
|
||||||
val packages = mutableMapOf<String, MutableList<Class<out Patch<Context>>>>()
|
|
||||||
|
|
||||||
for (patch in bundle) {
|
|
||||||
patch.compatiblePackages?.forEach { pkg ->
|
|
||||||
if (!packages.contains(pkg.name)) packages[pkg.name] = mutableListOf()
|
|
||||||
packages[pkg.name]!!.add(patch)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (pkg in packages.entries.sortedByDescending { it.value.size }) {
|
|
||||||
output.appendLine("### [\uD83D\uDCE6 `${pkg.key}`](https://play.google.com/store/apps/details?id=${pkg.key})")
|
|
||||||
output.appendLine("<details>\n")
|
|
||||||
|
|
||||||
output.appendLine(TABLE_HEADER)
|
|
||||||
pkg.value.forEach { output.appendLine("| `${it.patchName}` | ${it.description} | ${it.getLatestVersion() ?: "all"} |") }
|
|
||||||
|
|
||||||
output.appendLine("</details>\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
val readmeTemplate = Template(File("README-template.md").readText())
|
|
||||||
readmeTemplate.replaceVariable(TABLE_REGEX, output.toString())
|
|
||||||
|
|
||||||
val readme = File("README.md")
|
|
||||||
readme.writeText(readmeTemplate.toString())
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
package app.revanced.meta.readme
|
|
||||||
|
|
||||||
data class SemanticVersion(val major: Int, val minor: Int, val patch: Int) {
|
|
||||||
companion object {
|
|
||||||
fun fromString(version: String): SemanticVersion {
|
|
||||||
val parts = version.split(".")
|
|
||||||
if (parts.count() != 3) throw IllegalArgumentException("Invalid semantic version")
|
|
||||||
val versionNumbers = parts.map { it.toInt() }
|
|
||||||
return SemanticVersion(versionNumbers[0], versionNumbers[1], versionNumbers[2])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun toString(): String = "$major.$minor.$patch"
|
|
||||||
}
|
|
||||||
|
|
||||||
object SemanticVersionComparator : Comparator<SemanticVersion> {
|
|
||||||
override fun compare(a: SemanticVersion, b: SemanticVersion): Int = when {
|
|
||||||
a.major != b.major -> a.major - b.major
|
|
||||||
a.minor != b.minor -> a.minor - b.minor
|
|
||||||
else -> a.patch - b.patch
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package app.revanced.meta.readme
|
|
||||||
|
|
||||||
class Template(template: String) {
|
|
||||||
val result = StringBuilder(template)
|
|
||||||
|
|
||||||
fun replaceVariable(regex: Regex, value: String) {
|
|
||||||
val range = regex.find(result)!!.range
|
|
||||||
result.replace(range.first, range.last + 1, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun toString(): String = result.toString()
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
package app.revanced.patches.all.interaction.gestures.patch
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.ResourceContext
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.ResourcePatch
|
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
|
|
||||||
@Patch
|
|
||||||
@Name("predictive-back-gesture")
|
|
||||||
@Description("Enables the predictive back gesture introduced on Android 13.")
|
|
||||||
@Version("0.0.1")
|
|
||||||
class PredictiveBackGesturePatch : ResourcePatch {
|
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
|
||||||
context.xmlEditor["AndroidManifest.xml"].use { editor ->
|
|
||||||
val document = editor.file
|
|
||||||
|
|
||||||
with(document.getElementsByTagName("application").item(0)) {
|
|
||||||
if (attributes.getNamedItem(FLAG) != null) return@with
|
|
||||||
|
|
||||||
document.createAttribute(FLAG)
|
|
||||||
.apply { value = "true" }
|
|
||||||
.let(attributes::setNamedItem)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
|
|
||||||
private companion object {
|
|
||||||
const val FLAG = "android:enableOnBackInvokedCallback"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package app.revanced.patches.backdrops.misc.pro.annotations
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
|
||||||
import app.revanced.patcher.annotation.Package
|
|
||||||
|
|
||||||
@Compatibility([Package("com.backdrops.wallpapers")])
|
|
||||||
internal annotation class ProUnlockCompatibility
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package app.revanced.patches.backdrops.misc.pro.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
|
|
||||||
object ProUnlockFingerprint : MethodFingerprint(
|
|
||||||
opcodes = listOf(
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
Opcode.INVOKE_INTERFACE,
|
|
||||||
Opcode.MOVE_RESULT,
|
|
||||||
Opcode.IF_EQZ
|
|
||||||
),
|
|
||||||
customFingerprint = { it.definingClass == "Lcom/backdrops/wallpapers/data/local/DatabaseHandlerIAB;" && it.name == "lambda\$existPurchase\$0" }
|
|
||||||
)
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
package app.revanced.patches.backdrops.misc.pro.patch
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
|
||||||
import app.revanced.patcher.extensions.instruction
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
import app.revanced.patches.backdrops.misc.pro.annotations.ProUnlockCompatibility
|
|
||||||
import app.revanced.patches.backdrops.misc.pro.fingerprints.ProUnlockFingerprint
|
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
|
||||||
|
|
||||||
@Patch
|
|
||||||
@Name("pro-unlock")
|
|
||||||
@Description("Unlocks pro-only functions.")
|
|
||||||
@ProUnlockCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class ProUnlockPatch : BytecodePatch(
|
|
||||||
listOf(ProUnlockFingerprint)
|
|
||||||
) {
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
|
||||||
val result = ProUnlockFingerprint.result ?: return PatchResultError("${ProUnlockFingerprint.name} not found")
|
|
||||||
|
|
||||||
val moveRegisterInstruction = result.mutableMethod.instruction(result.scanResult.patternScanResult!!.endIndex - 1)
|
|
||||||
val register = (moveRegisterInstruction as OneRegisterInstruction).registerA
|
|
||||||
|
|
||||||
result.mutableMethod.addInstructions(
|
|
||||||
result.scanResult.patternScanResult!!.endIndex,
|
|
||||||
"""
|
|
||||||
const/4 v$register, 0x1
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package app.revanced.patches.citra.misc.premium.annotations
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
|
||||||
import app.revanced.patcher.annotation.Package
|
|
||||||
|
|
||||||
@Compatibility([Package("org.citra.citra_emu"), Package("org.citra.citra_emu.canary")])
|
|
||||||
internal annotation class PremiumUnlockCompatbility
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package app.revanced.patches.citra.misc.premium.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
|
|
||||||
object PremiumUnlockFingerprint : MethodFingerprint(
|
|
||||||
customFingerprint = { it.definingClass == "Lorg/citra/citra_emu/ui/main/MainActivity;" && it.name == "isPremiumActive" }
|
|
||||||
)
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
package app.revanced.patches.citra.misc.premium.patch
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
|
|
||||||
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.patches.citra.misc.premium.annotations.PremiumUnlockCompatbility
|
|
||||||
import app.revanced.patches.citra.misc.premium.fingerprints.PremiumUnlockFingerprint
|
|
||||||
|
|
||||||
@Patch
|
|
||||||
@Name("premium-unlock")
|
|
||||||
@Description("Unlocks premium functions.")
|
|
||||||
@PremiumUnlockCompatbility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class PremiumUnlockPatch : BytecodePatch(
|
|
||||||
listOf(PremiumUnlockFingerprint)
|
|
||||||
) {
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
|
||||||
val result = PremiumUnlockFingerprint.result ?: return PatchResultError("${PremiumUnlockFingerprint.name} not found")
|
|
||||||
|
|
||||||
result.mutableMethod.addInstructions(
|
|
||||||
0,
|
|
||||||
"""
|
|
||||||
const v0, 0x1
|
|
||||||
return v0
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package app.revanced.patches.hexeditor.ad.annotations
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
|
||||||
import app.revanced.patcher.annotation.Package
|
|
||||||
|
|
||||||
@Compatibility(
|
|
||||||
[
|
|
||||||
Package("com.myprog.hexedit")
|
|
||||||
]
|
|
||||||
)
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
|
||||||
internal annotation class HexEditorAdsCompatibility
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package app.revanced.patches.hexeditor.ad.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
|
|
||||||
object PrimaryAdsFingerprint : MethodFingerprint(
|
|
||||||
customFingerprint = { methodDef ->
|
|
||||||
methodDef.definingClass.endsWith("PreferencesHelper;") && methodDef.name == "isAdsDisabled"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
package app.revanced.patches.hexeditor.ad.patch
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.removeInstruction
|
|
||||||
import app.revanced.patcher.extensions.replaceInstructions
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
import app.revanced.patches.hexeditor.ad.annotations.HexEditorAdsCompatibility
|
|
||||||
import app.revanced.patches.hexeditor.ad.fingerprints.PrimaryAdsFingerprint
|
|
||||||
|
|
||||||
@Patch
|
|
||||||
@Name("disable-ads")
|
|
||||||
@Description("Disables ads in HexEditor.")
|
|
||||||
@HexEditorAdsCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class HexEditorAdsPatch : BytecodePatch(
|
|
||||||
listOf(
|
|
||||||
PrimaryAdsFingerprint
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
|
||||||
val method = PrimaryAdsFingerprint.result!!.mutableMethod
|
|
||||||
|
|
||||||
method.replaceInstructions(
|
|
||||||
0,
|
|
||||||
"""
|
|
||||||
const/4 v0, 0x1
|
|
||||||
return v0
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package app.revanced.patches.iconpackstudio.misc.pro.annotations
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
|
||||||
import app.revanced.patcher.annotation.Package
|
|
||||||
|
|
||||||
@Compatibility([Package("ginlemon.iconpackstudio")])
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
|
||||||
internal annotation class UnlockProCompatibility
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package app.revanced.patches.iconpackstudio.misc.pro.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
|
|
||||||
object CheckProFingerprint : MethodFingerprint(
|
|
||||||
"Z",
|
|
||||||
customFingerprint = { it.definingClass.endsWith("IPSPurchaseRepository;")}
|
|
||||||
)
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
package app.revanced.patches.iconpackstudio.misc.pro.patch
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
|
||||||
import app.revanced.patcher.extensions.removeInstruction
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
import app.revanced.patches.iconpackstudio.misc.pro.annotations.UnlockProCompatibility
|
|
||||||
import app.revanced.patches.iconpackstudio.misc.pro.fingerprints.CheckProFingerprint
|
|
||||||
|
|
||||||
@Patch
|
|
||||||
@Name("unlock-pro")
|
|
||||||
@Description("Unlocks all pro features.")
|
|
||||||
@UnlockProCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class UnlockProPatch : BytecodePatch(
|
|
||||||
listOf(
|
|
||||||
CheckProFingerprint
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
|
||||||
val method = CheckProFingerprint.result!!.mutableMethod
|
|
||||||
method.addInstructions(
|
|
||||||
0,
|
|
||||||
"""
|
|
||||||
const/4 v0, 0x1
|
|
||||||
return v0
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package app.revanced.patches.moneymanager.annotations
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
|
||||||
import app.revanced.patcher.annotation.Package
|
|
||||||
|
|
||||||
@Compatibility([Package("com.ithebk.expensemanager")])
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
|
||||||
internal annotation class UnlockProCompatibility
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package app.revanced.patches.moneymanager.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import org.jf.dexlib2.AccessFlags
|
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
|
|
||||||
object UnlockProFingerprint : MethodFingerprint(
|
|
||||||
"Z",
|
|
||||||
AccessFlags.STATIC or AccessFlags.SYNTHETIC,
|
|
||||||
parameters = listOf("L"),
|
|
||||||
opcodes = listOf(
|
|
||||||
Opcode.IGET_BOOLEAN,
|
|
||||||
Opcode.RETURN
|
|
||||||
),
|
|
||||||
customFingerprint = { methodDef ->
|
|
||||||
methodDef.definingClass.endsWith("MainActivity;")
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
package app.revanced.patches.moneymanager.patch
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
import app.revanced.patches.moneymanager.annotations.UnlockProCompatibility
|
|
||||||
import app.revanced.patches.moneymanager.fingerprints.UnlockProFingerprint
|
|
||||||
|
|
||||||
@Patch
|
|
||||||
@Name("unlock-pro")
|
|
||||||
@Description("Unlocks pro features.")
|
|
||||||
@UnlockProCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class UnlockProPatch : BytecodePatch(
|
|
||||||
listOf(UnlockProFingerprint)
|
|
||||||
) {
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
|
||||||
UnlockProFingerprint.result!!.mutableMethod.addInstructions(
|
|
||||||
0,
|
|
||||||
"""
|
|
||||||
const/4 v0, 0x1
|
|
||||||
|
|
||||||
return v0
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package app.revanced.patches.music.ad.video.annotations
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
|
||||||
import app.revanced.patcher.annotation.Package
|
|
||||||
|
|
||||||
@Compatibility(
|
|
||||||
[Package(
|
|
||||||
"com.google.android.apps.youtube.music",
|
|
||||||
arrayOf(
|
|
||||||
"5.14.53",
|
|
||||||
"5.16.51",
|
|
||||||
"5.17.51",
|
|
||||||
"5.21.52",
|
|
||||||
"5.22.54",
|
|
||||||
"5.23.50",
|
|
||||||
"5.25.51",
|
|
||||||
"5.25.52",
|
|
||||||
"5.26.52",
|
|
||||||
"5.27.51",
|
|
||||||
"5.28.52",
|
|
||||||
"5.29.52",
|
|
||||||
"5.31.50",
|
|
||||||
"5.34.51",
|
|
||||||
"5.36.51"
|
|
||||||
)
|
|
||||||
)]
|
|
||||||
)
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
|
||||||
internal annotation class MusicVideoAdsCompatibility
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package app.revanced.patches.music.ad.video.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import org.jf.dexlib2.AccessFlags
|
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
|
|
||||||
object ShowMusicVideoAdsFingerprint : MethodFingerprint(
|
|
||||||
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("Z"), listOf(
|
|
||||||
Opcode.IPUT_BOOLEAN,
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.RETURN_VOID
|
|
||||||
)
|
|
||||||
)
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
package app.revanced.patches.music.ad.video.patch
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
import app.revanced.patches.music.ad.video.annotations.MusicVideoAdsCompatibility
|
|
||||||
import app.revanced.patches.music.ad.video.fingerprints.ShowMusicVideoAdsConstructorFingerprint
|
|
||||||
import app.revanced.patches.music.ad.video.fingerprints.ShowMusicVideoAdsFingerprint
|
|
||||||
|
|
||||||
@Patch
|
|
||||||
@Name("music-video-ads")
|
|
||||||
@Description("Removes ads in the music player.")
|
|
||||||
@MusicVideoAdsCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class MusicVideoAdsPatch : BytecodePatch(
|
|
||||||
listOf(
|
|
||||||
ShowMusicVideoAdsConstructorFingerprint
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
|
||||||
ShowMusicVideoAdsFingerprint.resolve(context, ShowMusicVideoAdsConstructorFingerprint.result!!.classDef)
|
|
||||||
|
|
||||||
val result = ShowMusicVideoAdsFingerprint.result!!
|
|
||||||
|
|
||||||
result.mutableMethod.addInstructions(
|
|
||||||
result.scanResult.patternScanResult!!.startIndex, """
|
|
||||||
const/4 p1, 0x0
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,26 +5,10 @@ import app.revanced.patcher.annotation.Package
|
|||||||
|
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.apps.youtube.music",
|
"com.google.android.apps.youtube.music", arrayOf("5.03.50")
|
||||||
arrayOf(
|
|
||||||
"5.14.53",
|
|
||||||
"5.16.51",
|
|
||||||
"5.17.51",
|
|
||||||
"5.21.52",
|
|
||||||
"5.22.54",
|
|
||||||
"5.23.50",
|
|
||||||
"5.25.51",
|
|
||||||
"5.25.52",
|
|
||||||
"5.26.52",
|
|
||||||
"5.27.51",
|
|
||||||
"5.28.52",
|
|
||||||
"5.29.52",
|
|
||||||
"5.31.50",
|
|
||||||
"5.34.51",
|
|
||||||
"5.36.51"
|
|
||||||
)
|
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
internal annotation class CodecsUnlockCompatibility
|
internal annotation class CodecsUnlockCompatibility
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,23 @@
|
|||||||
package app.revanced.patches.music.audio.codecs.fingerprints
|
package app.revanced.patches.music.audio.codecs.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
|
||||||
import app.revanced.patcher. fingerprint.method.impl.MethodFingerprint
|
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.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-fingerprint")
|
||||||
|
@MatchingMethod(
|
||||||
|
"Laari;",
|
||||||
|
"b",
|
||||||
|
)
|
||||||
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
|
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
|
||||||
|
@CodecsUnlockCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
object AllCodecsReferenceFingerprint : MethodFingerprint(
|
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,
|
||||||
|
|||||||
@@ -1,15 +1,27 @@
|
|||||||
package app.revanced.patches.music.audio.codecs.fingerprints
|
package app.revanced.patches.music.audio.codecs.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
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.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-fingerprint")
|
||||||
|
@MatchingMethod(
|
||||||
|
"Labwj;",
|
||||||
|
"a",
|
||||||
|
)
|
||||||
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
|
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
|
||||||
|
@CodecsUnlockCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
object CodecsLockFingerprint : MethodFingerprint(
|
object CodecsLockFingerprint : MethodFingerprint(
|
||||||
"L", AccessFlags.PUBLIC or AccessFlags.STATIC, opcodes = listOf(
|
"L", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L", "L", "L", "L"), listOf(
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
Opcode.INVOKE_DIRECT,
|
Opcode.INVOKE_DIRECT,
|
||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.MOVE_RESULT,
|
Opcode.MOVE_RESULT,
|
||||||
@@ -17,13 +29,19 @@ object CodecsLockFingerprint : MethodFingerprint(
|
|||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.MOVE_RESULT,
|
Opcode.MOVE_RESULT,
|
||||||
Opcode.IF_NEZ,
|
Opcode.IF_NEZ,
|
||||||
|
Opcode.SGET,
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.INVOKE_INTERFACE,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
Opcode.IF_NEZ,
|
||||||
Opcode.SGET_OBJECT,
|
Opcode.SGET_OBJECT,
|
||||||
Opcode.IGET_OBJECT,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.INVOKE_STATIC,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.CHECK_CAST,
|
||||||
Opcode.INVOKE_INTERFACE,
|
Opcode.INVOKE_INTERFACE,
|
||||||
Opcode.INVOKE_DIRECT,
|
Opcode.INVOKE_DIRECT,
|
||||||
Opcode.RETURN_OBJECT
|
Opcode.RETURN_OBJECT
|
||||||
),
|
)
|
||||||
strings = listOf("eac3_supported")
|
|
||||||
)
|
)
|
||||||
@@ -3,21 +3,20 @@ 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.BytecodeContext
|
import app.revanced.patcher.data.impl.BytecodeData
|
||||||
import app.revanced.patcher.data.toMethodWalker
|
import app.revanced.patcher.data.impl.toMethodWalker
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
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.fingerprints.AllCodecsReferenceFingerprint
|
import app.revanced.patches.music.audio.codecs.fingerprints.AllCodecsReferenceFingerprint
|
||||||
import app.revanced.patches.music.audio.codecs.fingerprints.CodecsLockFingerprint
|
import app.revanced.patches.music.audio.codecs.fingerprints.CodecsLockFingerprint
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("codecs-unlock")
|
@Name("codecs-unlock")
|
||||||
@Description("Adds more audio codec options. The new audio codecs usually result in better audio quality.")
|
@Description("Enables more audio codecs. Usually results in better audio quality but may depend on song and device.")
|
||||||
@CodecsUnlockCompatibility
|
@CodecsUnlockCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class CodecsUnlockPatch : BytecodePatch(
|
class CodecsUnlockPatch : BytecodePatch(
|
||||||
@@ -25,30 +24,20 @@ class CodecsUnlockPatch : BytecodePatch(
|
|||||||
CodecsLockFingerprint, AllCodecsReferenceFingerprint
|
CodecsLockFingerprint, AllCodecsReferenceFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
val codecsLockResult = CodecsLockFingerprint.result!!
|
var result = CodecsLockFingerprint.result!!
|
||||||
|
|
||||||
val implementation = codecsLockResult.mutableMethod.implementation!!
|
val implementation = result.mutableMethod.implementation!!
|
||||||
|
|
||||||
val scanResultStartIndex = codecsLockResult.scanResult.patternScanResult!!.startIndex
|
val instructionIndex = result.patternScanResult!!.startIndex
|
||||||
val instructionIndex = scanResultStartIndex +
|
|
||||||
if (implementation.instructions[scanResultStartIndex - 1].opcode == Opcode.CHECK_CAST) {
|
|
||||||
// for 5.16.xx and lower
|
|
||||||
-3
|
|
||||||
} else {
|
|
||||||
// since 5.17.xx
|
|
||||||
-2
|
|
||||||
}
|
|
||||||
|
|
||||||
val allCodecsResult = AllCodecsReferenceFingerprint.result!!
|
result = AllCodecsReferenceFingerprint.result!!
|
||||||
val allCodecsMethod =
|
val codecMethod =
|
||||||
context.toMethodWalker(allCodecsResult.method)
|
data.toMethodWalker(result.method).nextMethod(result.patternScanResult!!.startIndex).getMethod()
|
||||||
.nextMethod(allCodecsResult.scanResult.patternScanResult!!.startIndex)
|
|
||||||
.getMethod()
|
|
||||||
|
|
||||||
implementation.replaceInstruction(
|
implementation.replaceInstruction(
|
||||||
instructionIndex,
|
instructionIndex,
|
||||||
"invoke-static {}, ${allCodecsMethod.definingClass}->${allCodecsMethod.name}()Ljava/util/Set;".toInstruction()
|
"invoke-static {}, ${codecMethod.definingClass}->${codecMethod.name}()Ljava/util/Set;".toInstruction()
|
||||||
)
|
)
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
|
|||||||
@@ -5,26 +5,10 @@ import app.revanced.patcher.annotation.Package
|
|||||||
|
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.apps.youtube.music",
|
"com.google.android.apps.youtube.music", arrayOf("5.03.50")
|
||||||
arrayOf(
|
|
||||||
"5.14.53",
|
|
||||||
"5.16.51",
|
|
||||||
"5.17.51",
|
|
||||||
"5.21.52",
|
|
||||||
"5.22.54",
|
|
||||||
"5.23.50",
|
|
||||||
"5.25.51",
|
|
||||||
"5.25.52",
|
|
||||||
"5.26.52",
|
|
||||||
"5.27.51",
|
|
||||||
"5.28.52",
|
|
||||||
"5.29.52",
|
|
||||||
"5.31.50",
|
|
||||||
"5.34.51",
|
|
||||||
"5.36.51"
|
|
||||||
)
|
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
internal annotation class ExclusiveAudioCompatibility
|
internal annotation class ExclusiveAudioCompatibility
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,23 @@
|
|||||||
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.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.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
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("audio-only-enabler-fingerprint")
|
||||||
|
@MatchingMethod(
|
||||||
|
"Lgmd;",
|
||||||
|
"d"
|
||||||
|
)
|
||||||
|
@DirectPatternScanMethod
|
||||||
|
@ExclusiveAudioCompatibility
|
||||||
|
@Version(
|
||||||
|
"0.0.1"
|
||||||
|
)
|
||||||
object AudioOnlyEnablerFingerprint: MethodFingerprint(
|
object AudioOnlyEnablerFingerprint: MethodFingerprint(
|
||||||
"Z", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf(), listOf(
|
"Z", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf(), listOf(
|
||||||
Opcode.IGET_OBJECT,
|
Opcode.IGET_OBJECT,
|
||||||
|
|||||||
@@ -1,13 +1,22 @@
|
|||||||
package app.revanced.patches.music.audio.exclusiveaudio.fingerprints
|
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.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
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.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-fingerprints")
|
||||||
|
@MatchingMethod(
|
||||||
|
"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
|
||||||
|
@Version("0.0.1")
|
||||||
object ExclusiveAudioFingerprint : MethodFingerprint(
|
object ExclusiveAudioFingerprint : MethodFingerprint(
|
||||||
"V",
|
"V",
|
||||||
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
|||||||
@@ -1,30 +1,34 @@
|
|||||||
package app.revanced.patches.music.audio.exclusiveaudio.patch
|
package app.revanced.patches.music.audio.exclusiveaudio.patch
|
||||||
|
|
||||||
|
import AudioOnlyEnablerFingerprint
|
||||||
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.BytecodeContext
|
import app.revanced.patcher.data.impl.BytecodeData
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
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.impl.BytecodePatch
|
||||||
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.fingerprints.AudioOnlyEnablerFingerprint
|
import app.revanced.patches.music.audio.exclusiveaudio.fingerprints.ExclusiveAudioFingerprint
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("exclusive-audio-playback")
|
@Name("exclusive-audio-playback")
|
||||||
@Description("Enables the option to play music without video.")
|
@Description("Add the option to play music without video.")
|
||||||
@ExclusiveAudioCompatibility
|
@ExclusiveAudioCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class ExclusiveAudioPatch : BytecodePatch(
|
class ExclusiveAudioPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
AudioOnlyEnablerFingerprint
|
ExclusiveAudioFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
val method = AudioOnlyEnablerFingerprint.result!!.mutableMethod
|
ExclusiveAudioFingerprint.resolve(data, AudioOnlyEnablerFingerprint.result!!.classDef)
|
||||||
|
|
||||||
|
val method = ExclusiveAudioFingerprint.result!!.mutableMethod
|
||||||
method.replaceInstruction(method.implementation!!.instructions.count() - 1, "const/4 v0, 0x1")
|
method.replaceInstruction(method.implementation!!.instructions.count() - 1, "const/4 v0, 0x1")
|
||||||
method.addInstruction("return v0")
|
method.addInstruction("return v0")
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
package app.revanced.patches.music.layout.compactheader.annotations
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
|
||||||
import app.revanced.patcher.annotation.Package
|
|
||||||
|
|
||||||
@Compatibility(
|
|
||||||
[Package(
|
|
||||||
"com.google.android.apps.youtube.music",
|
|
||||||
arrayOf(
|
|
||||||
"5.14.53",
|
|
||||||
"5.16.51",
|
|
||||||
"5.21.52",
|
|
||||||
"5.22.54",
|
|
||||||
"5.23.50",
|
|
||||||
"5.25.51",
|
|
||||||
"5.25.52",
|
|
||||||
"5.26.52",
|
|
||||||
"5.27.51",
|
|
||||||
"5.28.52",
|
|
||||||
"5.29.52",
|
|
||||||
"5.31.50",
|
|
||||||
"5.34.51",
|
|
||||||
"5.36.51"
|
|
||||||
)
|
|
||||||
)]
|
|
||||||
)
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
|
||||||
internal annotation class CompactHeaderCompatibility
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
package app.revanced.patches.music.layout.compactheader.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import org.jf.dexlib2.AccessFlags
|
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
|
|
||||||
object CompactHeaderConstructorFingerprint : MethodFingerprint(
|
|
||||||
"V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("L", "L", "L", "L", "L"), listOf(
|
|
||||||
Opcode.INVOKE_DIRECT,
|
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.NEW_INSTANCE,
|
|
||||||
Opcode.INVOKE_DIRECT,
|
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.CONST,
|
|
||||||
Opcode.CONST_4,
|
|
||||||
Opcode.INVOKE_STATIC,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
Opcode.CHECK_CAST
|
|
||||||
)
|
|
||||||
)
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
package app.revanced.patches.music.layout.compactheader.patch
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
import app.revanced.patches.music.layout.compactheader.annotations.CompactHeaderCompatibility
|
|
||||||
import app.revanced.patches.music.layout.compactheader.fingerprints.CompactHeaderConstructorFingerprint
|
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction11x
|
|
||||||
|
|
||||||
@Patch(false)
|
|
||||||
@Name("compact-header")
|
|
||||||
@Description("Hides the music category bar at the top of the homepage.")
|
|
||||||
@CompactHeaderCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class CompactHeaderPatch : BytecodePatch(
|
|
||||||
listOf(
|
|
||||||
CompactHeaderConstructorFingerprint
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
|
||||||
val result = CompactHeaderConstructorFingerprint.result!!
|
|
||||||
val method = result.mutableMethod
|
|
||||||
|
|
||||||
val insertIndex = result.scanResult.patternScanResult!!.endIndex
|
|
||||||
val register = (method.implementation!!.instructions[insertIndex - 1] as BuilderInstruction11x).registerA
|
|
||||||
method.addInstructions(
|
|
||||||
insertIndex, """
|
|
||||||
const/16 v2, 0x8
|
|
||||||
invoke-virtual {v${register}, v2}, Landroid/view/View;->setVisibility(I)V
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package app.revanced.patches.music.layout.minimizedplayback.annotations
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
|
||||||
import app.revanced.patcher.annotation.Package
|
|
||||||
|
|
||||||
@Compatibility(
|
|
||||||
[Package(
|
|
||||||
"com.google.android.apps.youtube.music",
|
|
||||||
arrayOf(
|
|
||||||
"5.14.53",
|
|
||||||
"5.16.51",
|
|
||||||
"5.17.51",
|
|
||||||
"5.21.52",
|
|
||||||
"5.22.54",
|
|
||||||
"5.23.50",
|
|
||||||
"5.25.51",
|
|
||||||
"5.25.52",
|
|
||||||
"5.26.52",
|
|
||||||
"5.27.51",
|
|
||||||
"5.28.52",
|
|
||||||
"5.29.52",
|
|
||||||
"5.31.50",
|
|
||||||
"5.34.51",
|
|
||||||
"5.36.51"
|
|
||||||
)
|
|
||||||
)]
|
|
||||||
)
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
|
||||||
internal annotation class MinimizedPlaybackCompatibility
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package app.revanced.patches.music.layout.minimizedplayback.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import org.jf.dexlib2.AccessFlags
|
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
|
|
||||||
object MinimizedPlaybackManagerFingerprint : MethodFingerprint(
|
|
||||||
"V",
|
|
||||||
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
|
||||||
listOf("I", "L", "Z"),
|
|
||||||
listOf(
|
|
||||||
Opcode.IGET,
|
|
||||||
Opcode.IF_NE,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.IF_NE,
|
|
||||||
Opcode.IGET_BOOLEAN,
|
|
||||||
Opcode.IF_EQ,
|
|
||||||
Opcode.GOTO,
|
|
||||||
Opcode.RETURN_VOID,
|
|
||||||
Opcode.SGET_OBJECT,
|
|
||||||
Opcode.CONST_4,
|
|
||||||
Opcode.IF_NE,
|
|
||||||
Opcode.IPUT_BOOLEAN,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
package app.revanced.patches.music.layout.minimizedplayback.patch
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
import app.revanced.patches.music.layout.minimizedplayback.annotations.MinimizedPlaybackCompatibility
|
|
||||||
import app.revanced.patches.music.layout.minimizedplayback.fingerprints.MinimizedPlaybackManagerFingerprint
|
|
||||||
|
|
||||||
@Patch
|
|
||||||
@Name("minimized-playback-music")
|
|
||||||
@Description("Enables minimized playback on Kids music.")
|
|
||||||
@MinimizedPlaybackCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class MinimizedPlaybackPatch : BytecodePatch(
|
|
||||||
listOf(
|
|
||||||
MinimizedPlaybackManagerFingerprint
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
|
||||||
MinimizedPlaybackManagerFingerprint.result!!.mutableMethod.addInstructions(
|
|
||||||
0, """
|
|
||||||
return-void
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package app.revanced.patches.music.layout.premium.annotations
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
|
||||||
import app.revanced.patcher.annotation.Package
|
|
||||||
|
|
||||||
@Compatibility(
|
|
||||||
[Package(
|
|
||||||
"com.google.android.apps.youtube.music",
|
|
||||||
arrayOf(
|
|
||||||
"5.14.53",
|
|
||||||
"5.16.51",
|
|
||||||
"5.17.51",
|
|
||||||
"5.21.52",
|
|
||||||
"5.22.54",
|
|
||||||
"5.23.50",
|
|
||||||
"5.25.51",
|
|
||||||
"5.25.52",
|
|
||||||
"5.26.52",
|
|
||||||
"5.27.51",
|
|
||||||
"5.28.52",
|
|
||||||
"5.29.52",
|
|
||||||
"5.31.50",
|
|
||||||
"5.34.51",
|
|
||||||
"5.36.51"
|
|
||||||
)
|
|
||||||
)]
|
|
||||||
)
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
|
||||||
internal annotation class HideGetPremiumCompatibility
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package app.revanced.patches.music.layout.premium.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import org.jf.dexlib2.AccessFlags
|
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
|
|
||||||
object HideGetPremiumFingerprint : MethodFingerprint(
|
|
||||||
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf(), listOf(
|
|
||||||
Opcode.IF_NEZ,
|
|
||||||
Opcode.CONST_16,
|
|
||||||
Opcode.GOTO,
|
|
||||||
Opcode.NOP,
|
|
||||||
Opcode.INVOKE_VIRTUAL
|
|
||||||
)
|
|
||||||
)
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package app.revanced.patches.music.layout.premium.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import org.jf.dexlib2.AccessFlags
|
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
|
|
||||||
object HideGetPremiumParentFingerprint : MethodFingerprint(
|
|
||||||
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf(), listOf(
|
|
||||||
Opcode.IGET_BOOLEAN,
|
|
||||||
Opcode.CONST_4,
|
|
||||||
Opcode.IF_EQZ,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
Opcode.INVOKE_STATIC
|
|
||||||
),
|
|
||||||
listOf("FEmusic_history"),
|
|
||||||
)
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
package app.revanced.patches.music.layout.premium.patch
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
import app.revanced.patches.music.layout.premium.annotations.HideGetPremiumCompatibility
|
|
||||||
import app.revanced.patches.music.layout.premium.fingerprints.HideGetPremiumFingerprint
|
|
||||||
import app.revanced.patches.music.layout.premium.fingerprints.HideGetPremiumParentFingerprint
|
|
||||||
|
|
||||||
@Patch
|
|
||||||
@Name("hide-get-premium")
|
|
||||||
@Description("Removes all \"Get Premium\" evidences from the avatar menu.")
|
|
||||||
@HideGetPremiumCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class HideGetPremiumPatch : BytecodePatch(
|
|
||||||
listOf(
|
|
||||||
HideGetPremiumParentFingerprint
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
|
||||||
val parentResult = HideGetPremiumParentFingerprint.result!!
|
|
||||||
HideGetPremiumFingerprint.resolve(context, parentResult.classDef)
|
|
||||||
|
|
||||||
val startIndex = parentResult.scanResult.patternScanResult!!.startIndex
|
|
||||||
|
|
||||||
val parentMethod = parentResult.mutableMethod
|
|
||||||
parentMethod.replaceInstruction(
|
|
||||||
startIndex, """
|
|
||||||
const/4 v1, 0x0
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
val result = HideGetPremiumFingerprint.result!!
|
|
||||||
val method = result.mutableMethod
|
|
||||||
method.addInstructions(
|
|
||||||
startIndex, """
|
|
||||||
const/16 v0, 0x8
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,30 +3,12 @@ package app.revanced.patches.music.layout.tastebuilder.annotations
|
|||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
/**
|
|
||||||
* -- Note 2022-08-05 --
|
|
||||||
* Since 5.17.xx the tastebuilder component is dismissible, so this patch is less useful
|
|
||||||
* also it is partly litho now
|
|
||||||
*/
|
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.apps.youtube.music",
|
"com.google.android.apps.youtube.music", arrayOf("5.03.50")
|
||||||
arrayOf(
|
|
||||||
"5.21.52",
|
|
||||||
"5.22.54",
|
|
||||||
"5.23.50",
|
|
||||||
"5.25.51",
|
|
||||||
"5.25.52",
|
|
||||||
"5.26.52",
|
|
||||||
"5.27.51",
|
|
||||||
"5.28.52",
|
|
||||||
"5.29.52",
|
|
||||||
"5.31.50",
|
|
||||||
"5.34.51",
|
|
||||||
"5.36.51"
|
|
||||||
)
|
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
internal annotation class RemoveTasteBuilderCompatibility
|
internal annotation class RemoveTasteBuilderCompatibility
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,24 @@
|
|||||||
package app.revanced.patches.music.layout.tastebuilder.fingerprints
|
package app.revanced.patches.music.layout.tastebuilder.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
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.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-fingerprint")
|
||||||
|
@MatchingMethod(
|
||||||
|
"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
|
||||||
|
@Version("0.0.1")
|
||||||
object TasteBuilderConstructorFingerprint : MethodFingerprint(
|
object TasteBuilderConstructorFingerprint : MethodFingerprint(
|
||||||
"V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("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,
|
||||||
Opcode.NEW_INSTANCE,
|
Opcode.NEW_INSTANCE,
|
||||||
@@ -26,9 +35,9 @@ object TasteBuilderConstructorFingerprint : MethodFingerprint(
|
|||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
Opcode.CHECK_CAST,
|
Opcode.CHECK_CAST,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
Opcode.NEW_INSTANCE,
|
Opcode.NEW_INSTANCE,
|
||||||
Opcode.INVOKE_DIRECT,
|
Opcode.INVOKE_DIRECT,
|
||||||
Opcode.IPUT_OBJECT,
|
Opcode.IPUT_OBJECT
|
||||||
Opcode.CONST
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -3,19 +3,19 @@ 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.BytecodeContext
|
import app.revanced.patcher.data.impl.BytecodeData
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
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.fingerprints.TasteBuilderConstructorFingerprint
|
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
|
||||||
@Name("tasteBuilder-remover")
|
@Name("tasteBuilder-remover")
|
||||||
@Description("Removes the \"Tell us which artists you like\" card from the home screen.")
|
@Description("Removes the \"Tell us which artists you like\" card from the Home screen. The same functionality can be triggered from the settings anyway.")
|
||||||
@RemoveTasteBuilderCompatibility
|
@RemoveTasteBuilderCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class RemoveTasteBuilderPatch : BytecodePatch(
|
class RemoveTasteBuilderPatch : BytecodePatch(
|
||||||
@@ -23,11 +23,11 @@ class RemoveTasteBuilderPatch : BytecodePatch(
|
|||||||
TasteBuilderConstructorFingerprint
|
TasteBuilderConstructorFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
val result = TasteBuilderConstructorFingerprint.result!!
|
val result = TasteBuilderConstructorFingerprint.result!!
|
||||||
val method = result.mutableMethod
|
val method = result.mutableMethod
|
||||||
|
|
||||||
val insertIndex = result.scanResult.patternScanResult!!.endIndex - 8
|
val insertIndex = result.patternScanResult!!.endIndex - 8
|
||||||
val register = (method.implementation!!.instructions[insertIndex] as Instruction22c).registerA
|
val register = (method.implementation!!.instructions[insertIndex] as Instruction22c).registerA
|
||||||
method.addInstructions(
|
method.addInstructions(
|
||||||
insertIndex, """
|
insertIndex, """
|
||||||
|
|||||||
@@ -5,26 +5,10 @@ import app.revanced.patcher.annotation.Package
|
|||||||
|
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.apps.youtube.music",
|
"com.google.android.apps.youtube.music", arrayOf("5.03.50")
|
||||||
arrayOf(
|
|
||||||
"5.14.53",
|
|
||||||
"5.16.51",
|
|
||||||
"5.17.51",
|
|
||||||
"5.21.52",
|
|
||||||
"5.22.54",
|
|
||||||
"5.23.50",
|
|
||||||
"5.25.51",
|
|
||||||
"5.25.52",
|
|
||||||
"5.26.52",
|
|
||||||
"5.27.51",
|
|
||||||
"5.28.52",
|
|
||||||
"5.29.52",
|
|
||||||
"5.31.50",
|
|
||||||
"5.34.51",
|
|
||||||
"5.36.51"
|
|
||||||
)
|
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
internal annotation class RemoveUpgradeButtonCompatibility
|
internal annotation class RemoveUpgradeButtonCompatibility
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,22 @@
|
|||||||
package app.revanced.patches.music.layout.upgradebutton.fingerprints
|
package app.revanced.patches.music.layout.upgradebutton.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
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.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-fingerprint")
|
||||||
|
@MatchingMethod(
|
||||||
|
"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
|
||||||
|
@Version("0.0.1")
|
||||||
object PivotBarConstructorFingerprint : MethodFingerprint(
|
object PivotBarConstructorFingerprint : MethodFingerprint(
|
||||||
"V",
|
"V",
|
||||||
AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ 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.BytecodeContext
|
import app.revanced.patcher.data.impl.BytecodeData
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
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.fingerprints.PivotBarConstructorFingerprint
|
import app.revanced.patches.music.layout.upgradebutton.fingerprints.PivotBarConstructorFingerprint
|
||||||
@@ -20,7 +20,7 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
|||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("upgrade-button-remover")
|
@Name("upgrade-button-remover")
|
||||||
@Description("Removes the upgrade tab from the pivot bar.")
|
@Description("Remove the upgrade tab from the pivot bar in YouTube music.")
|
||||||
@RemoveUpgradeButtonCompatibility
|
@RemoveUpgradeButtonCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class RemoveUpgradeButtonPatch : BytecodePatch(
|
class RemoveUpgradeButtonPatch : BytecodePatch(
|
||||||
@@ -28,12 +28,12 @@ class RemoveUpgradeButtonPatch : BytecodePatch(
|
|||||||
PivotBarConstructorFingerprint
|
PivotBarConstructorFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
val result = PivotBarConstructorFingerprint.result!!
|
val result = PivotBarConstructorFingerprint.result!!
|
||||||
val implementation = result.mutableMethod.implementation!!
|
val implementation = result.mutableMethod.implementation!!
|
||||||
|
|
||||||
val pivotBarElementFieldRef =
|
val pivotBarElementFieldRef =
|
||||||
(implementation.instructions[result.scanResult.patternScanResult!!.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
|
||||||
@@ -46,18 +46,16 @@ class RemoveUpgradeButtonPatch : BytecodePatch(
|
|||||||
""".toInstructions().toMutableList()
|
""".toInstructions().toMutableList()
|
||||||
|
|
||||||
|
|
||||||
val endIndex = result.scanResult.patternScanResult!!.endIndex
|
|
||||||
|
|
||||||
// replace the instruction to retain the label at given index
|
// replace the instruction to retain the label at given index
|
||||||
implementation.replaceInstruction(
|
implementation.replaceInstruction(
|
||||||
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(
|
||||||
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()
|
||||||
@@ -66,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(endIndex)
|
Opcode.IF_LE, 1, 2, implementation.newLabelForIndex(result.patternScanResult!!.endIndex)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
implementation.addInstructions(
|
implementation.addInstructions(
|
||||||
endIndex, instructionList
|
result.patternScanResult!!.endIndex, instructionList
|
||||||
)
|
)
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
package app.revanced.patches.music.misc.microg.annotations
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
|
||||||
import app.revanced.patcher.annotation.Package
|
|
||||||
|
|
||||||
@Compatibility(
|
|
||||||
[Package(
|
|
||||||
"com.google.android.apps.youtube.music",
|
|
||||||
arrayOf(
|
|
||||||
"5.14.53",
|
|
||||||
"5.16.51",
|
|
||||||
"5.17.51",
|
|
||||||
"5.21.52",
|
|
||||||
"5.22.54",
|
|
||||||
"5.23.50",
|
|
||||||
"5.25.51",
|
|
||||||
"5.25.52",
|
|
||||||
"5.26.52",
|
|
||||||
"5.27.51",
|
|
||||||
"5.28.52",
|
|
||||||
"5.29.52",
|
|
||||||
"5.31.50",
|
|
||||||
"5.34.51",
|
|
||||||
"5.36.51"
|
|
||||||
)
|
|
||||||
)]
|
|
||||||
)
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
|
||||||
internal annotation class MusicMicroGPatchCompatibility
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package app.revanced.patches.music.misc.microg.fingerprints
|
|
||||||
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
|
|
||||||
object CastContextFetchFingerprint : MethodFingerprint(
|
|
||||||
strings = listOf("Error fetching CastContext.")
|
|
||||||
)
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package app.revanced.patches.music.misc.microg.fingerprints
|
|
||||||
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
|
|
||||||
object CastDynamiteModuleFingerprint : MethodFingerprint(
|
|
||||||
strings = listOf("com.google.android.gms.cast.framework.internal.CastDynamiteModuleImpl")
|
|
||||||
)
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package app.revanced.patches.music.misc.microg.fingerprints
|
|
||||||
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
|
|
||||||
object CastDynamiteModuleV2Fingerprint : MethodFingerprint(
|
|
||||||
strings = listOf("Failed to load module via V2: ")
|
|
||||||
)
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package app.revanced.patches.music.misc.microg.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import org.jf.dexlib2.AccessFlags
|
|
||||||
|
|
||||||
object GooglePlayUtilityFingerprint : MethodFingerprint(
|
|
||||||
"I",
|
|
||||||
AccessFlags.PUBLIC or AccessFlags.STATIC,
|
|
||||||
listOf("L", "I"),
|
|
||||||
strings = listOf(
|
|
||||||
"This should never happen.",
|
|
||||||
"MetadataValueReader",
|
|
||||||
"GooglePlayServicesUtil",
|
|
||||||
"com.android.vending",
|
|
||||||
"android.hardware.type.embedded"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package app.revanced.patches.music.misc.microg.fingerprints
|
|
||||||
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
|
|
||||||
object PrimeFingerprint : MethodFingerprint(
|
|
||||||
strings = listOf("com.google.android.GoogleCamera", "com.android.vending")
|
|
||||||
)
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package app.revanced.patches.music.misc.microg.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import org.jf.dexlib2.AccessFlags
|
|
||||||
|
|
||||||
|
|
||||||
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
|
|
||||||
object ServiceCheckFingerprint : MethodFingerprint(
|
|
||||||
"V",
|
|
||||||
AccessFlags.PUBLIC or AccessFlags.STATIC,
|
|
||||||
listOf("L", "I"),
|
|
||||||
strings = listOf("Google Play Services not available")
|
|
||||||
)
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
package app.revanced.patches.music.misc.microg.patch.bytecode
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
import app.revanced.patches.music.misc.microg.annotations.MusicMicroGPatchCompatibility
|
|
||||||
import app.revanced.patches.music.misc.microg.fingerprints.*
|
|
||||||
import app.revanced.patches.music.misc.microg.patch.resource.MusicMicroGResourcePatch
|
|
||||||
import app.revanced.patches.music.misc.microg.shared.Constants.MUSIC_PACKAGE_NAME
|
|
||||||
import app.revanced.patches.music.misc.microg.shared.Constants.REVANCED_MUSIC_PACKAGE_NAME
|
|
||||||
import app.revanced.patches.youtube.misc.microg.shared.Constants
|
|
||||||
import app.revanced.util.microg.MicroGBytecodeHelper
|
|
||||||
|
|
||||||
@Patch
|
|
||||||
@DependsOn([MusicMicroGResourcePatch::class])
|
|
||||||
@Name("music-microg-support")
|
|
||||||
@Description("Allows YouTube Music ReVanced to run without root and under a different package name.")
|
|
||||||
@MusicMicroGPatchCompatibility
|
|
||||||
@Version("0.0.2")
|
|
||||||
class MusicMicroGBytecodePatch : BytecodePatch(
|
|
||||||
listOf(
|
|
||||||
ServiceCheckFingerprint,
|
|
||||||
GooglePlayUtilityFingerprint,
|
|
||||||
CastDynamiteModuleFingerprint,
|
|
||||||
CastDynamiteModuleV2Fingerprint,
|
|
||||||
CastContextFetchFingerprint,
|
|
||||||
PrimeFingerprint,
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
// NOTE: the previous patch also replaced the following strings, but it seems like they are not needed:
|
|
||||||
// - "com.google.android.gms.chimera.GmsIntentOperationService",
|
|
||||||
// - "com.google.android.gms.phenotype.internal.IPhenotypeCallbacks",
|
|
||||||
// - "com.google.android.gms.phenotype.internal.IPhenotypeService",
|
|
||||||
// - "com.google.android.gms.phenotype.PACKAGE_NAME",
|
|
||||||
// - "com.google.android.gms.phenotype.UPDATE",
|
|
||||||
// - "com.google.android.gms.phenotype",
|
|
||||||
override fun execute(context: BytecodeContext) =
|
|
||||||
// apply common microG patch
|
|
||||||
MicroGBytecodeHelper.patchBytecode(
|
|
||||||
context,
|
|
||||||
arrayOf(
|
|
||||||
MicroGBytecodeHelper.packageNameTransform(
|
|
||||||
Constants.PACKAGE_NAME,
|
|
||||||
Constants.REVANCED_PACKAGE_NAME
|
|
||||||
)
|
|
||||||
),
|
|
||||||
MicroGBytecodeHelper.PrimeMethodTransformationData(
|
|
||||||
PrimeFingerprint,
|
|
||||||
MUSIC_PACKAGE_NAME,
|
|
||||||
REVANCED_MUSIC_PACKAGE_NAME
|
|
||||||
),
|
|
||||||
listOf(
|
|
||||||
ServiceCheckFingerprint,
|
|
||||||
GooglePlayUtilityFingerprint,
|
|
||||||
CastDynamiteModuleFingerprint,
|
|
||||||
CastDynamiteModuleV2Fingerprint,
|
|
||||||
CastContextFetchFingerprint
|
|
||||||
)
|
|
||||||
).let { PatchResultSuccess() }
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
package app.revanced.patches.music.misc.microg.patch.resource
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.ResourceContext
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.ResourcePatch
|
|
||||||
import app.revanced.patches.music.misc.microg.annotations.MusicMicroGPatchCompatibility
|
|
||||||
import app.revanced.patches.music.misc.microg.shared.Constants.MUSIC_PACKAGE_NAME
|
|
||||||
import app.revanced.patches.music.misc.microg.shared.Constants.REVANCED_MUSIC_APP_NAME
|
|
||||||
import app.revanced.patches.music.misc.microg.shared.Constants.REVANCED_MUSIC_PACKAGE_NAME
|
|
||||||
import app.revanced.patches.music.misc.microg.shared.Constants.SPOOFED_PACKAGE_NAME
|
|
||||||
import app.revanced.patches.music.misc.microg.shared.Constants.SPOOFED_PACKAGE_SIGNATURE
|
|
||||||
import app.revanced.util.microg.MicroGManifestHelper
|
|
||||||
import app.revanced.util.microg.MicroGResourceHelper
|
|
||||||
|
|
||||||
@Name("music-microg-resource-patch")
|
|
||||||
@Description("Resource patch to allow YouTube Music ReVanced to run without root and under a different package name.")
|
|
||||||
@MusicMicroGPatchCompatibility
|
|
||||||
@Version("0.0.2")
|
|
||||||
class MusicMicroGResourcePatch : ResourcePatch {
|
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
|
||||||
// update manifest
|
|
||||||
MicroGResourceHelper.patchManifest(
|
|
||||||
context,
|
|
||||||
MUSIC_PACKAGE_NAME,
|
|
||||||
REVANCED_MUSIC_PACKAGE_NAME,
|
|
||||||
REVANCED_MUSIC_APP_NAME
|
|
||||||
)
|
|
||||||
|
|
||||||
// add metadata to the manifest
|
|
||||||
MicroGManifestHelper.addSpoofingMetadata(
|
|
||||||
context,
|
|
||||||
SPOOFED_PACKAGE_NAME,
|
|
||||||
SPOOFED_PACKAGE_SIGNATURE
|
|
||||||
)
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package app.revanced.patches.music.misc.microg.shared
|
|
||||||
|
|
||||||
object Constants {
|
|
||||||
internal const val REVANCED_MUSIC_APP_NAME = "YT Music ReVanced"
|
|
||||||
internal const val REVANCED_MUSIC_PACKAGE_NAME = "app.revanced.android.apps.youtube.music"
|
|
||||||
internal const val MUSIC_PACKAGE_NAME = "com.google.android.apps.youtube.music"
|
|
||||||
internal const val SPOOFED_PACKAGE_NAME = MUSIC_PACKAGE_NAME
|
|
||||||
internal const val SPOOFED_PACKAGE_SIGNATURE = "afb0fed5eeaebdd86f56a97742f4b6b33ef59875"
|
|
||||||
}
|
|
||||||
@@ -5,26 +5,10 @@ import app.revanced.patcher.annotation.Package
|
|||||||
|
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package(
|
[Package(
|
||||||
"com.google.android.apps.youtube.music",
|
"com.google.android.apps.youtube.music", arrayOf("5.03.50")
|
||||||
arrayOf(
|
|
||||||
"5.14.53",
|
|
||||||
"5.16.51",
|
|
||||||
"5.17.51",
|
|
||||||
"5.21.52",
|
|
||||||
"5.22.54",
|
|
||||||
"5.23.50",
|
|
||||||
"5.25.51",
|
|
||||||
"5.25.52",
|
|
||||||
"5.26.52",
|
|
||||||
"5.27.51",
|
|
||||||
"5.28.52",
|
|
||||||
"5.29.52",
|
|
||||||
"5.31.50",
|
|
||||||
"5.34.51",
|
|
||||||
"5.36.51"
|
|
||||||
)
|
|
||||||
)]
|
)]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
internal annotation class BackgroundPlayCompatibility
|
internal annotation class BackgroundPlayCompatibility
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,22 @@
|
|||||||
package app.revanced.patches.music.premium.backgroundplay.fingerprints
|
package app.revanced.patches.music.premium.backgroundplay.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
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.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-fingerprint")
|
||||||
|
@MatchingMethod(
|
||||||
|
"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
|
||||||
|
@Version("0.0.1")
|
||||||
object BackgroundPlaybackDisableFingerprint : MethodFingerprint(
|
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,
|
||||||
|
|||||||
@@ -3,18 +3,18 @@ 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.BytecodeContext
|
import app.revanced.patcher.data.impl.BytecodeData
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
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.fingerprints.BackgroundPlaybackDisableFingerprint
|
import app.revanced.patches.music.premium.backgroundplay.fingerprints.BackgroundPlaybackDisableFingerprint
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("background-play")
|
@Name("background-play")
|
||||||
@Description("Enables playing music in the background.")
|
@Description("Enable playing music in the background.")
|
||||||
@BackgroundPlayCompatibility
|
@BackgroundPlayCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class BackgroundPlayPatch : BytecodePatch(
|
class BackgroundPlayPatch : BytecodePatch(
|
||||||
@@ -22,7 +22,7 @@ class BackgroundPlayPatch : BytecodePatch(
|
|||||||
BackgroundPlaybackDisableFingerprint
|
BackgroundPlaybackDisableFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
BackgroundPlaybackDisableFingerprint.result!!.mutableMethod.addInstructions(
|
BackgroundPlaybackDisableFingerprint.result!!.mutableMethod.addInstructions(
|
||||||
0,
|
0,
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
package app.revanced.patches.myexpenses.misc.pro.annotations
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
|
||||||
import app.revanced.patcher.annotation.Package
|
|
||||||
|
|
||||||
@Compatibility([Package("org.totschnig.myexpenses")])
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
|
||||||
internal annotation class UnlockProCompatibility
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package app.revanced.patches.myexpenses.misc.pro.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
|
|
||||||
object IsEnabledFingerprint : MethodFingerprint(
|
|
||||||
"Z",
|
|
||||||
strings = listOf("feature", "feature.licenceStatus")
|
|
||||||
)
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
package app.revanced.patches.myexpenses.misc.pro.patch
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
|
||||||
import app.revanced.patcher.extensions.removeInstruction
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
import app.revanced.patches.myexpenses.misc.pro.annotations.UnlockProCompatibility
|
|
||||||
import app.revanced.patches.myexpenses.misc.pro.fingerprints.IsEnabledFingerprint
|
|
||||||
|
|
||||||
@Patch
|
|
||||||
@Name("unlock-pro")
|
|
||||||
@Description("Unlocks all professional features.")
|
|
||||||
@UnlockProCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class UnlockProPatch : BytecodePatch(
|
|
||||||
listOf(
|
|
||||||
IsEnabledFingerprint
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
|
||||||
val method = IsEnabledFingerprint.result!!.mutableMethod
|
|
||||||
method.addInstructions(
|
|
||||||
0,
|
|
||||||
"""
|
|
||||||
const/4 v0, 0x1
|
|
||||||
return v0
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package app.revanced.patches.nyx.misc.pro.annotations
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
|
||||||
import app.revanced.patcher.annotation.Package
|
|
||||||
|
|
||||||
@Compatibility([Package("com.awedea.nyx")])
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
|
||||||
internal annotation class UnlockProCompatibility
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package app.revanced.patches.nyx.misc.pro.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
|
|
||||||
object CheckProFingerprint : MethodFingerprint(
|
|
||||||
customFingerprint = { methodDef ->
|
|
||||||
methodDef.definingClass.endsWith("BillingManager;") && methodDef.name == "isProVersion"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
package app.revanced.patches.nyx.misc.pro.patch
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
|
||||||
import app.revanced.patcher.extensions.removeInstruction
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
import app.revanced.patches.nyx.misc.pro.annotations.UnlockProCompatibility
|
|
||||||
import app.revanced.patches.nyx.misc.pro.fingerprints.CheckProFingerprint
|
|
||||||
|
|
||||||
@Patch
|
|
||||||
@Name("unlock-pro")
|
|
||||||
@Description("Unlocks all pro features.")
|
|
||||||
@UnlockProCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class UnlockProPatch : BytecodePatch(
|
|
||||||
listOf(
|
|
||||||
CheckProFingerprint
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
|
||||||
val method = CheckProFingerprint.result!!.mutableMethod
|
|
||||||
method.addInstructions(
|
|
||||||
0,
|
|
||||||
"""
|
|
||||||
const/4 v0, 0x1
|
|
||||||
return v0
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package app.revanced.patches.reddit.ad.general.annotations
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
|
||||||
import app.revanced.patcher.annotation.Package
|
|
||||||
|
|
||||||
@Compatibility([Package("com.reddit.frontpage")])
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
|
||||||
internal annotation class GeneralAdsCompatibility
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
package app.revanced.patches.reddit.ad.general.patch
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
import app.revanced.patches.reddit.ad.general.annotations.GeneralAdsCompatibility
|
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction21c
|
|
||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
|
||||||
import org.jf.dexlib2.iface.reference.StringReference
|
|
||||||
import org.jf.dexlib2.immutable.reference.ImmutableStringReference
|
|
||||||
|
|
||||||
@Patch
|
|
||||||
@Name("general-reddit-ads")
|
|
||||||
@Description("Removes general ads from the Reddit frontpage and subreddits.")
|
|
||||||
@GeneralAdsCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class GeneralAdsPatch : BytecodePatch() {
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
|
||||||
context.classes.forEach { classDef ->
|
|
||||||
classDef.methods.forEach methodLoop@{ method ->
|
|
||||||
val implementation = method.implementation ?: return@methodLoop
|
|
||||||
|
|
||||||
implementation.instructions.forEachIndexed { i, instruction ->
|
|
||||||
if (instruction.opcode != Opcode.CONST_STRING) return@forEachIndexed
|
|
||||||
if (((instruction as ReferenceInstruction).reference as StringReference).string != "AdPost") return@forEachIndexed
|
|
||||||
|
|
||||||
val proxiedClass = context.proxy(classDef).mutableClass
|
|
||||||
|
|
||||||
val proxiedImplementation = proxiedClass.methods.first {
|
|
||||||
it.name == method.name && it.parameterTypes.containsAll(method.parameterTypes)
|
|
||||||
}.implementation!!
|
|
||||||
|
|
||||||
var newString = "AdPost1"
|
|
||||||
if (proxiedImplementation.instructions[i - 1].opcode == Opcode.CONST_STRING) {
|
|
||||||
newString = "SubredditPost"
|
|
||||||
}
|
|
||||||
proxiedImplementation.replaceInstruction(
|
|
||||||
i, BuilderInstruction21c(
|
|
||||||
Opcode.CONST_STRING, (proxiedImplementation.instructions[i] as BuilderInstruction21c).registerA, ImmutableStringReference(newString)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package app.revanced.patches.reddit.layout.premiumicon.annotations
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
|
||||||
import app.revanced.patcher.annotation.Package
|
|
||||||
|
|
||||||
@Compatibility([Package("com.reddit.frontpage")])
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
|
||||||
internal annotation class PremiumIconCompatibility
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package app.revanced.patches.reddit.layout.premiumicon.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
|
|
||||||
object PremiumIconFingerprint : MethodFingerprint(
|
|
||||||
"Z",
|
|
||||||
customFingerprint = { methodDef ->
|
|
||||||
methodDef.definingClass.endsWith("MyAccount;") && methodDef.name == "isPremiumSubscriber"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
package app.revanced.patches.reddit.layout.premiumicon.patch
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
|
||||||
import app.revanced.patches.reddit.layout.premiumicon.annotations.PremiumIconCompatibility
|
|
||||||
import app.revanced.patches.reddit.layout.premiumicon.fingerprints.PremiumIconFingerprint
|
|
||||||
|
|
||||||
@Patch
|
|
||||||
@Name("premium-icon-reddit")
|
|
||||||
@Description("Unlocks premium Reddit app icons.")
|
|
||||||
@PremiumIconCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class PremiumIconPatch : BytecodePatch(
|
|
||||||
listOf(
|
|
||||||
PremiumIconFingerprint
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
|
||||||
val method = PremiumIconFingerprint.result!!.mutableMethod
|
|
||||||
method.addInstructions(
|
|
||||||
0,
|
|
||||||
"""
|
|
||||||
const/4 v0, 0x1
|
|
||||||
return v0
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package app.revanced.patches.shared.fingerprints
|
|
||||||
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
|
|
||||||
object WatchWhileActivityFingerprint : MethodFingerprint(
|
|
||||||
customFingerprint = { methodDef ->
|
|
||||||
methodDef.definingClass.endsWith("WatchWhileActivity;") && methodDef.name == "<init>"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
package app.revanced.patches.shared.integrations.patch
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import org.jf.dexlib2.iface.Method
|
|
||||||
|
|
||||||
@Description("Applies mandatory patches to implement the ReVanced integrations into the application.")
|
|
||||||
@Version("0.0.1")
|
|
||||||
abstract class AbstractIntegrationsPatch(
|
|
||||||
private val integrationsDescriptor: String,
|
|
||||||
private val hooks: Iterable<IntegrationsFingerprint>
|
|
||||||
) : BytecodePatch(hooks) {
|
|
||||||
/**
|
|
||||||
* [MethodFingerprint] for integrations.
|
|
||||||
*
|
|
||||||
* @param contextRegisterResolver A [RegisterResolver] to get the register.
|
|
||||||
* @see MethodFingerprint
|
|
||||||
*/
|
|
||||||
abstract class IntegrationsFingerprint(
|
|
||||||
strings: Iterable<String>? = null,
|
|
||||||
customFingerprint: ((methodDef: Method) -> Boolean)? = null,
|
|
||||||
private val contextRegisterResolver: (Method) -> Int = object : RegisterResolver {}
|
|
||||||
) : MethodFingerprint(strings = strings, customFingerprint = customFingerprint) {
|
|
||||||
fun invoke(integrationsDescriptor: String): PatchResult {
|
|
||||||
result?.mutableMethod?.let { method ->
|
|
||||||
val contextRegister = contextRegisterResolver(method)
|
|
||||||
|
|
||||||
method.addInstruction(
|
|
||||||
0,
|
|
||||||
"sput-object v$contextRegister, " +
|
|
||||||
"$integrationsDescriptor->context:Landroid/content/Context;"
|
|
||||||
)
|
|
||||||
} ?: return PatchResultError("Could not find hook target fingerprint.")
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
|
|
||||||
interface RegisterResolver : (Method) -> Int {
|
|
||||||
override operator fun invoke(method: Method) = method.implementation!!.registerCount - 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
|
||||||
if (context.findClass(integrationsDescriptor) == null) return MISSING_INTEGRATIONS
|
|
||||||
|
|
||||||
for (hook in hooks) hook.invoke(integrationsDescriptor).let {
|
|
||||||
if (it is PatchResultError) return it
|
|
||||||
}
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
|
|
||||||
private companion object {
|
|
||||||
val MISSING_INTEGRATIONS = PatchResultError(
|
|
||||||
"Integrations have not been merged yet. " +
|
|
||||||
"This patch can not succeed without merging the integrations."
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
package app.revanced.patches.shared.mapping.misc.patch
|
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.ResourceContext
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.patch.ResourcePatch
|
|
||||||
import org.w3c.dom.Element
|
|
||||||
import java.util.*
|
|
||||||
import java.util.concurrent.Executors
|
|
||||||
import java.util.concurrent.TimeUnit
|
|
||||||
|
|
||||||
|
|
||||||
@Name("resource-mapping")
|
|
||||||
@Description("Creates a map of public resources.")
|
|
||||||
@Version("0.0.1")
|
|
||||||
class ResourceMappingPatch : ResourcePatch {
|
|
||||||
companion object {
|
|
||||||
internal lateinit var resourceMappings: List<ResourceElement>
|
|
||||||
private set
|
|
||||||
|
|
||||||
private val THREAD_COUNT = Runtime.getRuntime().availableProcessors()
|
|
||||||
private val threadPoolExecutor = Executors.newFixedThreadPool(THREAD_COUNT)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
|
||||||
// save the file in memory to concurrently read from
|
|
||||||
val resourceXmlFile = context["res/values/public.xml"].readBytes()
|
|
||||||
|
|
||||||
// create a synchronized list to store the resource mappings
|
|
||||||
val mappings = Collections.synchronizedList(mutableListOf<ResourceElement>())
|
|
||||||
|
|
||||||
for (threadIndex in 0 until THREAD_COUNT) {
|
|
||||||
threadPoolExecutor.execute thread@{
|
|
||||||
context.xmlEditor[resourceXmlFile.inputStream()].use { editor ->
|
|
||||||
val resources = editor.file.documentElement.childNodes
|
|
||||||
val resourcesLength = resources.length
|
|
||||||
val jobSize = resourcesLength / THREAD_COUNT
|
|
||||||
|
|
||||||
val batchStart = jobSize * threadIndex
|
|
||||||
val batchEnd = jobSize * (threadIndex + 1)
|
|
||||||
element@ for (i in batchStart until batchEnd) {
|
|
||||||
// make sure to not to go out of bounds when rounding errors occur at calculating the jobSize
|
|
||||||
if (i >= resourcesLength) return@thread
|
|
||||||
|
|
||||||
val node = resources.item(i)
|
|
||||||
if (node !is Element) continue
|
|
||||||
|
|
||||||
val nameAttribute = node.getAttribute("name")
|
|
||||||
val typeAttribute = node.getAttribute("type")
|
|
||||||
|
|
||||||
if (node.nodeName != "public" || nameAttribute.startsWith("APKTOOL")) continue
|
|
||||||
|
|
||||||
val id = node.getAttribute("id").substring(2).toLong(16)
|
|
||||||
mappings.add(ResourceElement(typeAttribute, nameAttribute, id))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
threadPoolExecutor
|
|
||||||
.also { it.shutdown() }
|
|
||||||
.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS)
|
|
||||||
|
|
||||||
resourceMappings = mappings
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
data class ResourceElement(val type: String, val name: String, val id: Long)
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
package app.revanced.patches.shared.settings.preference
|
|
||||||
|
|
||||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
|
||||||
import org.w3c.dom.Document
|
|
||||||
import org.w3c.dom.Element
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base preference class for all preferences.
|
|
||||||
*
|
|
||||||
* @param key The key of the preference.
|
|
||||||
* @param title The title of the preference.
|
|
||||||
*/
|
|
||||||
internal abstract class BasePreference(
|
|
||||||
override val key: String,
|
|
||||||
override val title: StringResource,
|
|
||||||
) : IPreference {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Serialize preference element to XML.
|
|
||||||
* Overriding methods should invoke super and operate on its return value.
|
|
||||||
* @param ownerDocument Target document to create elements from.
|
|
||||||
* @param resourceCallback Called when a resource has been processed.
|
|
||||||
*/
|
|
||||||
open fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)? = null): Element {
|
|
||||||
return ownerDocument.createElement(tag).apply {
|
|
||||||
if(key.isNotEmpty())
|
|
||||||
setAttribute("android:key", key)
|
|
||||||
setAttribute("android:title", "@string/${title.also { resourceCallback?.invoke(it) }.name}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package app.revanced.patches.shared.settings.preference
|
|
||||||
|
|
||||||
import org.w3c.dom.Document
|
|
||||||
import org.w3c.dom.Element
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base resource class for all resources.
|
|
||||||
*
|
|
||||||
* @param name The name of the resource.
|
|
||||||
*/
|
|
||||||
internal abstract class BaseResource(
|
|
||||||
override val name: String
|
|
||||||
) : IResource {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Serialize resource element to XML.
|
|
||||||
* Overriding methods should invoke super and operate on its return value.
|
|
||||||
* @param ownerDocument Target document to create elements from.
|
|
||||||
* @param resourceCallback Called when a resource has been processed.
|
|
||||||
*/
|
|
||||||
open fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)? = null): Element {
|
|
||||||
return ownerDocument.createElement(tag).apply {
|
|
||||||
setAttribute("name", name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
package app.revanced.patches.shared.settings.preference
|
|
||||||
|
|
||||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
|
||||||
import org.w3c.dom.Element
|
|
||||||
import org.w3c.dom.Node
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a resource node child
|
|
||||||
*
|
|
||||||
* @param resource The resource to add.
|
|
||||||
* @param resourceCallback Called when a resource has been processed.
|
|
||||||
*/
|
|
||||||
internal fun Node.addResource(resource: BaseResource, resourceCallback: ((IResource) -> Unit)? = null) {
|
|
||||||
appendChild(resource.serialize(ownerDocument, resourceCallback))
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a preference node child to the settings.
|
|
||||||
*
|
|
||||||
* @param preference The preference to add.
|
|
||||||
* @param resourceCallback Called when a resource has been processed.
|
|
||||||
*/
|
|
||||||
internal fun Node.addPreference(preference: BasePreference, resourceCallback: ((IResource) -> Unit)? = null) {
|
|
||||||
appendChild(preference.serialize(ownerDocument, resourceCallback))
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun Element.addSummary(summaryResource: StringResource?, summaryType: SummaryType = SummaryType.DEFAULT) =
|
|
||||||
summaryResource?.let { summary ->
|
|
||||||
setAttribute("android:${summaryType.type}", "@string/${summary.name}")
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun <T> Element.addDefault(default: T) {
|
|
||||||
default?.let {
|
|
||||||
setAttribute(
|
|
||||||
"android:defaultValue", when (it) {
|
|
||||||
is Boolean -> if (it) "true" else "false"
|
|
||||||
is String -> it
|
|
||||||
else -> throw IllegalArgumentException("Unsupported default value type: ${it::class.java.name}")
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
package app.revanced.patches.shared.settings.preference
|
|
||||||
|
|
||||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Preference
|
|
||||||
*/
|
|
||||||
internal interface IPreference {
|
|
||||||
/**
|
|
||||||
* Key of the preference.
|
|
||||||
*/
|
|
||||||
val key: String
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Title of the preference.
|
|
||||||
*/
|
|
||||||
val title: StringResource
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tag name of the preference.
|
|
||||||
*/
|
|
||||||
val tag: String
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package app.revanced.patches.shared.settings.preference
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resource
|
|
||||||
*/
|
|
||||||
internal interface IResource {
|
|
||||||
/**
|
|
||||||
* Name of the resource.
|
|
||||||
*/
|
|
||||||
val name: String
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tag name of the resource.
|
|
||||||
*/
|
|
||||||
val tag: String
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package app.revanced.patches.shared.settings.preference
|
|
||||||
|
|
||||||
enum class SummaryType(val type: String) {
|
|
||||||
DEFAULT("summary"), ON("summaryOn"), OFF("summaryOff")
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user