mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-02 15:44:37 +02:00
build: bump patcher to 11.0.1
This commit is contained in:
parent
af84ca9a4c
commit
9aae2f0032
2
.github/ISSUE_TEMPLATE/bug-issue.yml
vendored
2
.github/ISSUE_TEMPLATE/bug-issue.yml
vendored
@ -1,6 +1,6 @@
|
|||||||
name: 🐞 Bug report
|
name: 🐞 Bug report
|
||||||
description: Report a very clearly broken issue.
|
description: Report a very clearly broken issue.
|
||||||
title: 'bug: <title>'
|
title: 'bug: '
|
||||||
labels: [bug]
|
labels: [bug]
|
||||||
body:
|
body:
|
||||||
- type: markdown
|
- type: markdown
|
||||||
|
6
.github/ISSUE_TEMPLATE/patch-request.yml
vendored
6
.github/ISSUE_TEMPLATE/patch-request.yml
vendored
@ -1,6 +1,6 @@
|
|||||||
name: ⭐ Patch Request
|
name: ⭐ Patch Request
|
||||||
description: Create a detailed patch request.
|
description: Create a detailed patch request.
|
||||||
title: 'feat(patch): '
|
title: 'feat: '
|
||||||
labels: [patch-request]
|
labels: [patch-request]
|
||||||
body:
|
body:
|
||||||
- type: textarea
|
- type: textarea
|
||||||
@ -24,7 +24,7 @@ body:
|
|||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Motivation
|
label: Motivation
|
||||||
description: Why should your patch request should be considered? What makes it valuable to the community?
|
description: Why should your patch request be considered? What makes it valuable to the community?
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: checkboxes
|
- type: checkboxes
|
||||||
@ -38,4 +38,4 @@ body:
|
|||||||
- label: I have written a short but informative title.
|
- label: I have written a short but informative title.
|
||||||
required: true
|
required: true
|
||||||
- label: I filled out all of the requested information in this issue properly.
|
- label: I filled out all of the requested information in this issue properly.
|
||||||
required: true
|
required: true
|
||||||
|
2
.github/config.yml
vendored
Normal file
2
.github/config.yml
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
firstPRMergeComment: >
|
||||||
|
Thank you for contributing to ReVanced. Join us on [Discord](https://revanced.app/discord) if you want to receive a contributor role.
|
7
.github/workflows/pull_request.yml
vendored
7
.github/workflows/pull_request.yml
vendored
@ -21,5 +21,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
destination_branch: 'main'
|
destination_branch: 'main'
|
||||||
pr_title: 'chore: ${{ env.MESSAGE }}'
|
pr_title: 'chore: ${{ env.MESSAGE }}'
|
||||||
pr_body: 'This pull request will ${{ env.MESSAGE }}.'
|
pr_body: |
|
||||||
|
This pull request will ${{ env.MESSAGE }}.
|
||||||
|
|
||||||
|
## Dependencies before merge
|
||||||
|
|
||||||
|
- [ ] https://github.com/revanced/revanced-integrations
|
||||||
pr_draft: true
|
pr_draft: true
|
||||||
|
25
.github/workflows/release.yml
vendored
25
.github/workflows/release.yml
vendored
@ -23,23 +23,16 @@ jobs:
|
|||||||
# https://github.com/cycjimmy/semantic-release-action#private-packages
|
# https://github.com/cycjimmy/semantic-release-action#private-packages
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Setup JDK
|
- name: Cache
|
||||||
uses: actions/setup-java@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
java-version: '17'
|
path: |
|
||||||
distribution: 'zulu'
|
${{ runner.home }}/.gradle/caches
|
||||||
cache: gradle
|
${{ runner.home }}/.gradle/wrapper
|
||||||
- name: Setup Node.js
|
.gradle
|
||||||
uses: actions/setup-node@v3
|
build
|
||||||
with:
|
node_modules
|
||||||
node-version: '18'
|
key: ${{ runner.os }}-gradle-npm-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'package-lock.json') }}
|
||||||
cache: 'npm'
|
|
||||||
- name: Setup Android SDK
|
|
||||||
uses: amyu/setup-android@v2
|
|
||||||
with:
|
|
||||||
cache-disabled: false
|
|
||||||
sdk-version: '33'
|
|
||||||
build-tools-version: '33.0.2'
|
|
||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm") version "1.8.20"
|
kotlin("jvm") version "1.8.22"
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "app.revanced"
|
group = "app.revanced"
|
||||||
@ -20,7 +20,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("app.revanced:revanced-patcher:7.1.1")
|
implementation("app.revanced:revanced-patcher:11.0.1")
|
||||||
implementation("app.revanced:multidexlib2:2.5.3-a3836654")
|
implementation("app.revanced:multidexlib2:2.5.3-a3836654")
|
||||||
// Required for meta
|
// Required for meta
|
||||||
implementation("com.google.code.gson:gson:2.10.1")
|
implementation("com.google.code.gson:gson:2.10.1")
|
||||||
@ -33,7 +33,7 @@ tasks {
|
|||||||
|
|
||||||
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.2/d8"
|
val d8 = "${androidHome}/build-tools/34.0.0/d8"
|
||||||
val input = configurations.archives.get().allArtifacts.files.files.first().absolutePath
|
val input = configurations.archives.get().allArtifacts.files.files.first().absolutePath
|
||||||
val work = File("${buildDir}/libs")
|
val work = File("${buildDir}/libs")
|
||||||
|
|
||||||
|
@ -2,9 +2,7 @@ package app.revanced.extensions
|
|||||||
|
|
||||||
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
|
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
import app.revanced.patcher.patch.PatchResultError
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableField
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableField
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
@ -80,10 +78,4 @@ internal fun String.startsWithAny(vararg prefixes: String): Boolean {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun toResult(errorIndex: Int): PatchResult {
|
|
||||||
return if (errorIndex == -1)
|
|
||||||
PatchResultSuccess()
|
|
||||||
else
|
|
||||||
PatchResultError("Instruction not found: $errorIndex")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import app.revanced.patcher.patch.Patch
|
|||||||
import app.revanced.patcher.util.patch.PatchBundle
|
import app.revanced.patcher.util.patch.PatchBundle
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
typealias PatchBundlePatches = List<Class<out Patch<Context>>>
|
internal typealias PatchBundlePatches = List<Class<out Patch<Context>>>
|
||||||
|
|
||||||
internal interface PatchesFileGenerator {
|
internal interface PatchesFileGenerator {
|
||||||
fun generate(bundle: PatchBundlePatches)
|
fun generate(bundle: PatchBundlePatches)
|
||||||
|
@ -5,6 +5,7 @@ import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
|||||||
import app.revanced.patcher.extensions.PatchExtensions.description
|
import app.revanced.patcher.extensions.PatchExtensions.description
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||||
import app.revanced.patcher.patch.Patch
|
import app.revanced.patcher.patch.Patch
|
||||||
|
import com.unascribed.flexver.FlexVerComparator
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
internal class ReadmeGenerator : PatchesFileGenerator {
|
internal class ReadmeGenerator : PatchesFileGenerator {
|
||||||
@ -37,9 +38,8 @@ internal class ReadmeGenerator : PatchesFileGenerator {
|
|||||||
}
|
}
|
||||||
}.let { commonMap ->
|
}.let { commonMap ->
|
||||||
commonMap.maxByOrNull { it.value }?.value?.let {
|
commonMap.maxByOrNull { it.value }?.value?.let {
|
||||||
// This is not foolproof, because for example v1.0.0-dev.0 will be returned instead of v1.0.0-release.
|
commonMap.entries.filter { mostCommon -> mostCommon.value == it }
|
||||||
// Unfortunately this can not be solved easily because versioning can be complex.
|
.maxOfWith(FlexVerComparator::compare, Map.Entry<String, Int>::key)
|
||||||
commonMap.entries.filter { mostCommon -> mostCommon.value == it }.maxBy { it.key }.key
|
|
||||||
} ?: "all"
|
} ?: "all"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,8 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.*
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.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
|
||||||
@ -29,15 +30,18 @@ class DisableAutoCaptionsPatch : BytecodePatch(
|
|||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
SubtitleTrackFingerprint.result?.mutableMethod?.let {
|
SubtitleTrackFingerprint.result?.let {
|
||||||
val index = it.implementation!!.instructions.size - 1
|
it.mutableMethod.apply {
|
||||||
val register = it.instruction<OneRegisterInstruction>(index).registerA
|
val index = implementation!!.instructions.size - 1
|
||||||
it.addInstructions(
|
val register = getInstruction<OneRegisterInstruction>(index).registerA
|
||||||
index, """
|
|
||||||
invoke-static {v$register}, $MUSIC_LAYOUT->disableAutoCaptions(Z)Z
|
addInstructions(
|
||||||
move-result v$register
|
index, """
|
||||||
"""
|
invoke-static {v$register}, $MUSIC_LAYOUT->disableAutoCaptions(Z)Z
|
||||||
)
|
move-result v$register
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
} ?: return SubtitleTrackFingerprint.toErrorResult()
|
} ?: return SubtitleTrackFingerprint.toErrorResult()
|
||||||
|
|
||||||
MusicSettingsPatch.addMusicPreference(CategoryType.LAYOUT, "revanced_disable_auto_captions", "false")
|
MusicSettingsPatch.addMusicPreference(CategoryType.LAYOUT, "revanced_disable_auto_captions", "false")
|
||||||
|
@ -9,13 +9,13 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object TabLayoutFingerprint : MethodFingerprint(
|
object TabLayoutFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf(),
|
parameters = listOf(),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.CONST,
|
Opcode.CONST,
|
||||||
Opcode.INVOKE_STATIC,
|
Opcode.INVOKE_STATIC,
|
||||||
Opcode.MOVE_RESULT
|
Opcode.MOVE_RESULT
|
||||||
),
|
),
|
||||||
customFingerprint = { it.isWideLiteralExists(colorGreyId) }
|
customFingerprint = { it, _ -> it.isWideLiteralExists(colorGreyId) }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.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
|
||||||
@ -39,7 +39,7 @@ class BlackNavbarPatch : BytecodePatch(
|
|||||||
TabLayoutFingerprint.result?.let {
|
TabLayoutFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val targetRegister = instruction<OneRegisterInstruction>(targetIndex).registerA
|
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
targetIndex + 1, """
|
targetIndex + 1, """
|
||||||
|
@ -6,6 +6,6 @@ import org.jf.dexlib2.AccessFlags
|
|||||||
|
|
||||||
object HideCastButtonFingerprint : MethodFingerprint (
|
object HideCastButtonFingerprint : MethodFingerprint (
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf("I")
|
parameters = listOf("I")
|
||||||
)
|
)
|
@ -6,6 +6,6 @@ import org.jf.dexlib2.AccessFlags
|
|||||||
|
|
||||||
object HideCastButtonParentFingerprint : MethodFingerprint (
|
object HideCastButtonParentFingerprint : MethodFingerprint (
|
||||||
returnType = "Z",
|
returnType = "Z",
|
||||||
access = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||||
strings = listOf("MediaRouteButton")
|
strings = listOf("MediaRouteButton")
|
||||||
)
|
)
|
||||||
|
@ -5,7 +5,7 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
@ -13,6 +13,6 @@ object ChipCloudFingerprint : MethodFingerprint(
|
|||||||
Opcode.INVOKE_STATIC,
|
Opcode.INVOKE_STATIC,
|
||||||
Opcode.MOVE_RESULT_OBJECT
|
Opcode.MOVE_RESULT_OBJECT
|
||||||
),
|
),
|
||||||
customFingerprint = { it.isWideLiteralExists(chipCloudId) }
|
customFingerprint = { it, _ -> it.isWideLiteralExists(chipCloudId) }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.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
|
||||||
@ -38,7 +38,7 @@ class CategoryBarPatch : BytecodePatch(
|
|||||||
ChipCloudFingerprint.result?.let {
|
ChipCloudFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val targetRegister = instruction<OneRegisterInstruction>(targetIndex).registerA
|
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
targetIndex + 1,
|
targetIndex + 1,
|
||||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object ColorMatchPlayerFingerprint : MethodFingerprint(
|
object ColorMatchPlayerFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf("L", "J"),
|
parameters = listOf("L", "J"),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.INVOKE_DIRECT,
|
Opcode.INVOKE_DIRECT,
|
||||||
|
@ -5,9 +5,9 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.removeInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
@ -42,11 +42,11 @@ class ColorMatchPlayerPatch : BytecodePatch(
|
|||||||
targetMethod = parentResult.mutableMethod
|
targetMethod = parentResult.mutableMethod
|
||||||
|
|
||||||
val insertIndex = it.scanResult.patternScanResult!!.startIndex + 1
|
val insertIndex = it.scanResult.patternScanResult!!.startIndex + 1
|
||||||
val jumpInstruction = instruction<Instruction>(insertIndex)
|
val jumpInstruction = getInstruction<Instruction>(insertIndex)
|
||||||
|
|
||||||
val type = it.classDef.type
|
val type = it.classDef.type
|
||||||
|
|
||||||
addInstructions(
|
addInstructionsWithLabels(
|
||||||
insertIndex, """
|
insertIndex, """
|
||||||
invoke-static {}, $MUSIC_LAYOUT->enableColorMatchPlayer()Z
|
invoke-static {}, $MUSIC_LAYOUT->enableColorMatchPlayer()Z
|
||||||
move-result v2
|
move-result v2
|
||||||
@ -65,7 +65,7 @@ class ColorMatchPlayerPatch : BytecodePatch(
|
|||||||
goto :exit
|
goto :exit
|
||||||
:off
|
:off
|
||||||
invoke-direct {p0}, ${type}->${parentResult.mutableMethod.name}()V
|
invoke-direct {p0}, ${type}->${parentResult.mutableMethod.name}()V
|
||||||
""", listOf(ExternalLabel("exit", jumpInstruction))
|
""", ExternalLabel("exit", jumpInstruction)
|
||||||
)
|
)
|
||||||
removeInstruction(insertIndex - 1)
|
removeInstruction(insertIndex - 1)
|
||||||
}
|
}
|
||||||
@ -79,8 +79,8 @@ class ColorMatchPlayerPatch : BytecodePatch(
|
|||||||
private companion object {
|
private companion object {
|
||||||
private lateinit var targetMethod: MutableMethod
|
private lateinit var targetMethod: MutableMethod
|
||||||
|
|
||||||
fun descriptor(index: Int):String {
|
fun descriptor(index: Int): String {
|
||||||
return (targetMethod.instruction(index) as ReferenceInstruction).reference.toString()
|
return targetMethod.getInstruction<ReferenceInstruction>(index).reference.toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,13 +9,13 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object DialogSolidFingerprint : MethodFingerprint(
|
object DialogSolidFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf("L"),
|
parameters = listOf("L"),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
Opcode.INVOKE_STATIC
|
Opcode.INVOKE_STATIC
|
||||||
),
|
),
|
||||||
customFingerprint = { it.isWideLiteralExists(dialogSolidId) }
|
customFingerprint = { it, _ -> it.isWideLiteralExists(dialogSolidId) }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.data.toMethodWalker
|
import app.revanced.patcher.data.toMethodWalker
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.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
|
||||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object FloatingButtonFingerprint : MethodFingerprint(
|
object FloatingButtonFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||||
parameters = listOf("L"),
|
parameters = listOf("L"),
|
||||||
opcodes = listOf(Opcode.AND_INT_LIT16)
|
opcodes = listOf(Opcode.AND_INT_LIT16)
|
||||||
)
|
)
|
||||||
|
@ -8,9 +8,9 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object FloatingButtonParentFingerprint : MethodFingerprint(
|
object FloatingButtonParentFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PROTECTED or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL,
|
||||||
parameters = listOf("L"),
|
parameters = listOf("L"),
|
||||||
opcodes = listOf(Opcode.INVOKE_DIRECT),
|
opcodes = listOf(Opcode.INVOKE_DIRECT),
|
||||||
customFingerprint = { it.isNarrowLiteralExists(259982244) }
|
customFingerprint = { it, _ -> it.isNarrowLiteralExists(259982244) }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
@ -38,15 +38,17 @@ class NewPlaylistButtonPatch : BytecodePatch(
|
|||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
FloatingButtonParentFingerprint.result?.let { parentResult ->
|
FloatingButtonParentFingerprint.result?.let { parentResult ->
|
||||||
FloatingButtonFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.mutableMethod?.let {
|
FloatingButtonFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
|
||||||
it.addInstructions(
|
it.mutableMethod.apply {
|
||||||
1, """
|
addInstructionsWithLabels(
|
||||||
invoke-static {}, $MUSIC_LAYOUT->hideNewPlaylistButton()Z
|
1, """
|
||||||
move-result v0
|
invoke-static {}, $MUSIC_LAYOUT->hideNewPlaylistButton()Z
|
||||||
if-eqz v0, :show
|
move-result v0
|
||||||
return-void
|
if-eqz v0, :show
|
||||||
""", listOf(ExternalLabel("show", it.instruction(1)))
|
return-void
|
||||||
)
|
""", ExternalLabel("show", getInstruction(1))
|
||||||
|
)
|
||||||
|
}
|
||||||
} ?: return FloatingButtonFingerprint.toErrorResult()
|
} ?: return FloatingButtonFingerprint.toErrorResult()
|
||||||
} ?: return FloatingButtonParentFingerprint.toErrorResult()
|
} ?: return FloatingButtonParentFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
@ -9,13 +9,13 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object TabletIdentifierFingerprint : MethodFingerprint(
|
object TabletIdentifierFingerprint : MethodFingerprint(
|
||||||
returnType = "Z",
|
returnType = "Z",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||||
parameters = listOf("L"),
|
parameters = listOf("L"),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.CONST,
|
Opcode.CONST,
|
||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.MOVE_RESULT
|
Opcode.MOVE_RESULT
|
||||||
),
|
),
|
||||||
customFingerprint = { it.isWideLiteralExists(isTabletId) }
|
customFingerprint = { it, _ -> it.isWideLiteralExists(isTabletId) }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.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
|
||||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object MinimizedPlayerFingerprint : MethodFingerprint(
|
object MinimizedPlayerFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf("L", "L"),
|
parameters = listOf("L", "L"),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
@ -5,7 +5,7 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.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
|
||||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object ZenModeFingerprint : MethodFingerprint(
|
object ZenModeFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf("L", "J"),
|
parameters = listOf("L", "J"),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.MOVE_RESULT,
|
Opcode.MOVE_RESULT,
|
||||||
|
@ -5,9 +5,9 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.removeInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
@ -39,16 +39,16 @@ class ZenModePatch : BytecodePatch(
|
|||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
||||||
|
|
||||||
val firstRegister = instruction<OneRegisterInstruction>(startIndex).registerA
|
val firstRegister = getInstruction<OneRegisterInstruction>(startIndex).registerA
|
||||||
val secondRegister = instruction<OneRegisterInstruction>(startIndex + 2).registerA
|
val secondRegister = getInstruction<OneRegisterInstruction>(startIndex + 2).registerA
|
||||||
val dummyRegister = secondRegister + 1
|
val dummyRegister = secondRegister + 1
|
||||||
|
|
||||||
val referenceIndex = it.scanResult.patternScanResult!!.endIndex + 1
|
val referenceIndex = it.scanResult.patternScanResult!!.endIndex + 1
|
||||||
val targetReference = (instruction(referenceIndex) as ReferenceInstruction).reference.toString()
|
val targetReference = getInstruction<ReferenceInstruction>(referenceIndex).reference.toString()
|
||||||
|
|
||||||
val insertIndex = referenceIndex + 1
|
val insertIndex = referenceIndex + 1
|
||||||
|
|
||||||
addInstructions(
|
addInstructionsWithLabels(
|
||||||
insertIndex, """
|
insertIndex, """
|
||||||
invoke-static {}, $MUSIC_LAYOUT->enableZenMode()Z
|
invoke-static {}, $MUSIC_LAYOUT->enableZenMode()Z
|
||||||
move-result v$dummyRegister
|
move-result v$dummyRegister
|
||||||
|
@ -5,7 +5,7 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.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
|
||||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object BackgroundPlaybackParentFingerprint : MethodFingerprint(
|
object BackgroundPlaybackParentFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf(),
|
parameters = listOf(),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.INVOKE_STATIC,
|
Opcode.INVOKE_STATIC,
|
||||||
@ -17,5 +17,5 @@ object BackgroundPlaybackParentFingerprint : MethodFingerprint(
|
|||||||
Opcode.GOTO,
|
Opcode.GOTO,
|
||||||
Opcode.NOP
|
Opcode.NOP
|
||||||
),
|
),
|
||||||
customFingerprint = { it.definingClass.endsWith("/WatchFragment;") }
|
customFingerprint = { it, _ -> it.definingClass.endsWith("/WatchFragment;") }
|
||||||
)
|
)
|
@ -6,7 +6,7 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.data.toMethodWalker
|
import app.revanced.patcher.data.toMethodWalker
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.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
|
||||||
|
@ -5,8 +5,8 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.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
|
||||||
@ -27,7 +27,7 @@ class ClientSpoofMusicPatch : BytecodePatch(
|
|||||||
UserAgentHeaderBuilderFingerprint.result?.let {
|
UserAgentHeaderBuilderFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex - 1
|
val insertIndex = it.scanResult.patternScanResult!!.endIndex - 1
|
||||||
val packageNameRegister = instruction<FiveRegisterInstruction>(insertIndex).registerD
|
val packageNameRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerD
|
||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
insertIndex,
|
insertIndex,
|
||||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object AllCodecsFingerprint : MethodFingerprint(
|
object AllCodecsFingerprint : MethodFingerprint(
|
||||||
returnType = "J",
|
returnType = "J",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.IF_NEZ,
|
Opcode.IF_NEZ,
|
||||||
Opcode.GOTO,
|
Opcode.GOTO,
|
||||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object AllCodecsParentFingerprint : MethodFingerprint(
|
object AllCodecsParentFingerprint : MethodFingerprint(
|
||||||
returnType = "J",
|
returnType = "J",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf("L"),
|
parameters = listOf("L"),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.INVOKE_SUPER
|
Opcode.INVOKE_SUPER
|
||||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object CodecsLockFingerprint : MethodFingerprint(
|
object CodecsLockFingerprint : MethodFingerprint(
|
||||||
returnType = "L",
|
returnType = "L",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.NEW_INSTANCE,
|
Opcode.NEW_INSTANCE,
|
||||||
Opcode.NEW_INSTANCE,
|
Opcode.NEW_INSTANCE,
|
||||||
|
@ -6,8 +6,8 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.data.toMethodWalker
|
import app.revanced.patcher.data.toMethodWalker
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
@ -15,7 +15,9 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
|||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
import app.revanced.patches.music.misc.codecs.fingerprints.*
|
import app.revanced.patches.music.misc.codecs.fingerprints.AllCodecsFingerprint
|
||||||
|
import app.revanced.patches.music.misc.codecs.fingerprints.AllCodecsParentFingerprint
|
||||||
|
import app.revanced.patches.music.misc.codecs.fingerprints.CodecsLockFingerprint
|
||||||
import app.revanced.patches.music.misc.settings.resource.patch.MusicSettingsPatch
|
import app.revanced.patches.music.misc.settings.resource.patch.MusicSettingsPatch
|
||||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||||
import app.revanced.util.enum.CategoryType
|
import app.revanced.util.enum.CategoryType
|
||||||
@ -49,15 +51,15 @@ class CodecsUnlockPatch : BytecodePatch(
|
|||||||
CodecsLockFingerprint.result?.let {
|
CodecsLockFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val targetRegister = instruction<OneRegisterInstruction>(targetIndex).registerA
|
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||||
addInstructions(
|
addInstructionsWithLabels(
|
||||||
targetIndex + 1, """
|
targetIndex + 1, """
|
||||||
invoke-static {}, $MUSIC_MISC_PATH/OpusCodecPatch;->enableOpusCodec()Z
|
invoke-static {}, $MUSIC_MISC_PATH/OpusCodecPatch;->enableOpusCodec()Z
|
||||||
move-result v7
|
move-result v7
|
||||||
if-eqz v7, :mp4a
|
if-eqz v7, :mp4a
|
||||||
invoke-static {}, ${allCodecsMethod.definingClass}->${allCodecsMethod.name}()Ljava/util/Set;
|
invoke-static {}, ${allCodecsMethod.definingClass}->${allCodecsMethod.name}()Ljava/util/Set;
|
||||||
move-result-object v$targetRegister
|
move-result-object v$targetRegister
|
||||||
""", listOf(ExternalLabel("mp4a", instruction(targetIndex + 1)))
|
""", ExternalLabel("mp4a", getInstruction(targetIndex + 1))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} ?: return CodecsLockFingerprint.toErrorResult()
|
} ?: return CodecsLockFingerprint.toErrorResult()
|
||||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object AudioOnlyEnablerFingerprint: MethodFingerprint(
|
object AudioOnlyEnablerFingerprint: MethodFingerprint(
|
||||||
returnType = "Z",
|
returnType = "Z",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf(),
|
parameters = listOf(),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.IGET_OBJECT,
|
Opcode.IGET_OBJECT,
|
||||||
|
@ -5,8 +5,8 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.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
|
||||||
|
@ -3,8 +3,8 @@ package app.revanced.patches.music.misc.litho.patch
|
|||||||
import app.revanced.extensions.toErrorResult
|
import app.revanced.extensions.toErrorResult
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.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
|
||||||
@ -33,24 +33,24 @@ class MusicLithoFilterPatch : BytecodePatch(
|
|||||||
|
|
||||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val bufferIndex = getNarrowLiteralIndex(168777401)
|
val bufferIndex = getNarrowLiteralIndex(168777401)
|
||||||
val bufferRegister = instruction<OneRegisterInstruction>(bufferIndex).registerA
|
val bufferRegister = getInstruction<OneRegisterInstruction>(bufferIndex).registerA
|
||||||
val targetIndex = targetInstruction.indexOfFirst { instruction ->
|
val targetIndex = targetInstruction.indexOfFirst { instruction ->
|
||||||
instruction.opcode == Opcode.CONST_STRING &&
|
instruction.opcode == Opcode.CONST_STRING &&
|
||||||
(instruction as BuilderInstruction21c).reference.toString() == "Element missing type extension"
|
(instruction as BuilderInstruction21c).reference.toString() == "Element missing type extension"
|
||||||
} + 2
|
} + 2
|
||||||
|
|
||||||
val builderMethodDescriptor = (instruction(targetIndex) as ReferenceInstruction).reference as MethodReference
|
val builderMethodDescriptor = (getInstruction(targetIndex) as ReferenceInstruction).reference as MethodReference
|
||||||
val emptyComponentFieldDescriptor = (instruction(targetIndex + 2) as ReferenceInstruction).reference as FieldReference
|
val emptyComponentFieldDescriptor = (getInstruction(targetIndex + 2) as ReferenceInstruction).reference as FieldReference
|
||||||
val identifierRegister = instruction<OneRegisterInstruction>(endIndex).registerA
|
val identifierRegister = getInstruction<OneRegisterInstruction>(endIndex).registerA
|
||||||
|
|
||||||
targetInstruction.filter { instruction ->
|
targetInstruction.filter { instruction ->
|
||||||
val fieldReference = (instruction as? ReferenceInstruction)?.reference as? FieldReference
|
val fieldReference = (instruction as? ReferenceInstruction)?.reference as? FieldReference
|
||||||
fieldReference?.let { reference -> reference.type == "Ljava/lang/StringBuilder;" } == true
|
fieldReference?.let { reference -> reference.type == "Ljava/lang/StringBuilder;" } == true
|
||||||
}.forEach { instruction ->
|
}.forEach { instruction ->
|
||||||
val insertIndex = targetInstruction.indexOf(instruction)
|
val insertIndex = targetInstruction.indexOf(instruction)
|
||||||
val stringBuilderRegister = instruction<TwoRegisterInstruction>(insertIndex).registerA
|
val stringBuilderRegister = getInstruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructionsWithLabels(
|
||||||
insertIndex, """
|
insertIndex, """
|
||||||
invoke-static {v$stringBuilderRegister, v$identifierRegister}, $MUSIC_ADS_PATH/MusicLithoFilterPatch;->filter(Ljava/lang/StringBuilder;Ljava/lang/String;)Z
|
invoke-static {v$stringBuilderRegister, v$identifierRegister}, $MUSIC_ADS_PATH/MusicLithoFilterPatch;->filter(Ljava/lang/StringBuilder;Ljava/lang/String;)Z
|
||||||
move-result v$bufferRegister
|
move-result v$bufferRegister
|
||||||
@ -60,7 +60,7 @@ class MusicLithoFilterPatch : BytecodePatch(
|
|||||||
move-result-object v0
|
move-result-object v0
|
||||||
iget-object v0, v0, $emptyComponentFieldDescriptor
|
iget-object v0, v0, $emptyComponentFieldDescriptor
|
||||||
return-object v0
|
return-object v0
|
||||||
""", listOf(ExternalLabel("not_an_ad", instruction(insertIndex)))
|
""", ExternalLabel("not_an_ad", getInstruction(insertIndex))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object MinimizedPlaybackManagerFingerprint : MethodFingerprint(
|
object MinimizedPlaybackManagerFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf("I", "L", "Z"),
|
parameters = listOf("I", "L", "Z"),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.IGET,
|
Opcode.IGET,
|
||||||
|
@ -5,7 +5,7 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.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
|
||||||
|
@ -9,7 +9,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object AccountMenuFooterFingerprint : MethodFingerprint(
|
object AccountMenuFooterFingerprint : MethodFingerprint(
|
||||||
returnType = "L",
|
returnType = "L",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.CONST,
|
Opcode.CONST,
|
||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
@ -18,5 +18,5 @@ object AccountMenuFooterFingerprint : MethodFingerprint(
|
|||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.IGET_OBJECT
|
Opcode.IGET_OBJECT
|
||||||
),
|
),
|
||||||
customFingerprint = { it.isWideLiteralExists(privacyTosFooterId) }
|
customFingerprint = { it, _ -> it.isWideLiteralExists(privacyTosFooterId) }
|
||||||
)
|
)
|
||||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object HideGetPremiumFingerprint : MethodFingerprint(
|
object HideGetPremiumFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf(),
|
parameters = listOf(),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.IGET_BOOLEAN,
|
Opcode.IGET_BOOLEAN,
|
||||||
|
@ -6,8 +6,8 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.data.toMethodWalker
|
import app.revanced.patcher.data.toMethodWalker
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.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
|
||||||
@ -43,7 +43,7 @@ class HideGetPremiumPatch : BytecodePatch(
|
|||||||
HideGetPremiumFingerprint.result?.let {
|
HideGetPremiumFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val insertIndex = it.scanResult.patternScanResult!!.startIndex
|
val insertIndex = it.scanResult.patternScanResult!!.startIndex
|
||||||
val register = instruction<TwoRegisterInstruction>(insertIndex).registerA
|
val register = getInstruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
insertIndex + 1,
|
insertIndex + 1,
|
||||||
@ -56,7 +56,7 @@ class HideGetPremiumPatch : BytecodePatch(
|
|||||||
AccountMenuFooterFingerprint.result?.let {
|
AccountMenuFooterFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val targetIndex = getWideLiteralIndex(privacyTosFooterId) + 4
|
val targetIndex = getWideLiteralIndex(privacyTosFooterId) + 4
|
||||||
targetReference = instruction<ReferenceInstruction>(targetIndex + 1).reference
|
targetReference = getInstruction<ReferenceInstruction>(targetIndex + 1).reference
|
||||||
|
|
||||||
with (context
|
with (context
|
||||||
.toMethodWalker(this)
|
.toMethodWalker(this)
|
||||||
@ -67,8 +67,8 @@ class HideGetPremiumPatch : BytecodePatch(
|
|||||||
for ((index, instruction) in withIndex()) {
|
for ((index, instruction) in withIndex()) {
|
||||||
if (instruction.opcode != Opcode.IGET_OBJECT) continue
|
if (instruction.opcode != Opcode.IGET_OBJECT) continue
|
||||||
|
|
||||||
if (instruction<ReferenceInstruction>(index).reference == targetReference) {
|
if (getInstruction<ReferenceInstruction>(index).reference == targetReference) {
|
||||||
val targetRegister = instruction<OneRegisterInstruction>(index + 2).registerA
|
val targetRegister = getInstruction<OneRegisterInstruction>(index + 2).registerA
|
||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
index,
|
index,
|
||||||
|
@ -9,5 +9,5 @@ object MusicVideoQualitySetterFingerprint : MethodFingerprint(
|
|||||||
Opcode.CHECK_CAST,
|
Opcode.CHECK_CAST,
|
||||||
Opcode.IPUT_OBJECT
|
Opcode.IPUT_OBJECT
|
||||||
),
|
),
|
||||||
customFingerprint = { it.name == "<init>" }
|
customFingerprint = { it, _ -> it.name == "<init>" }
|
||||||
)
|
)
|
@ -7,5 +7,5 @@ import app.revanced.util.bytecode.isWideLiteralExists
|
|||||||
object MusicVideoQualitySetterParentFingerprint : MethodFingerprint(
|
object MusicVideoQualitySetterParentFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
parameters = listOf("L"),
|
parameters = listOf("L"),
|
||||||
customFingerprint = { it.isWideLiteralExists(qualityAutoId)}
|
customFingerprint = { it, _ -> it.isWideLiteralExists(qualityAutoId)}
|
||||||
)
|
)
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object MusicVideoQualitySettingsFingerprint : MethodFingerprint(
|
object MusicVideoQualitySettingsFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf("[L", "I", "Z"),
|
parameters = listOf("[L", "I", "Z"),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.IPUT_OBJECT,
|
Opcode.IPUT_OBJECT,
|
||||||
|
@ -7,5 +7,5 @@ import app.revanced.util.bytecode.isWideLiteralExists
|
|||||||
object MusicVideoQualitySettingsParentFingerprint : MethodFingerprint(
|
object MusicVideoQualitySettingsParentFingerprint : MethodFingerprint(
|
||||||
returnType = "L",
|
returnType = "L",
|
||||||
parameters = listOf(),
|
parameters = listOf(),
|
||||||
customFingerprint = { it.isWideLiteralExists(qualityTitleId)}
|
customFingerprint = { it, _ -> it.isWideLiteralExists(qualityTitleId)}
|
||||||
)
|
)
|
@ -6,9 +6,9 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
@ -53,7 +53,7 @@ class VideoQualityPatch : BytecodePatch(
|
|||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
|
||||||
qualityReference = instruction<ReferenceInstruction>(endIndex).reference
|
qualityReference = getInstruction<ReferenceInstruction>(endIndex).reference
|
||||||
qualityFieldReference = qualityReference as FieldReference
|
qualityFieldReference = qualityReference as FieldReference
|
||||||
|
|
||||||
qIndexMethodName = context
|
qIndexMethodName = context
|
||||||
@ -79,7 +79,7 @@ class VideoQualityPatch : BytecodePatch(
|
|||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val qualityChangedClass =
|
val qualityChangedClass =
|
||||||
context.findClass((instruction<BuilderInstruction21c>(endIndex))
|
context.findClass((getInstruction<BuilderInstruction21c>(endIndex))
|
||||||
.reference.toString())!!
|
.reference.toString())!!
|
||||||
.mutableClass
|
.mutableClass
|
||||||
|
|
||||||
|
@ -19,5 +19,5 @@ object PreferenceFingerprint : MethodFingerprint(
|
|||||||
Opcode.IGET_OBJECT,
|
Opcode.IGET_OBJECT,
|
||||||
Opcode.INVOKE_INTERFACE
|
Opcode.INVOKE_INTERFACE
|
||||||
),
|
),
|
||||||
customFingerprint = { it.definingClass == "Landroidx/preference/Preference;" }
|
customFingerprint = { it, _ -> it.definingClass == "Landroidx/preference/Preference;" }
|
||||||
)
|
)
|
@ -12,5 +12,5 @@ object SettingsHeadersFragmentFingerprint : MethodFingerprint(
|
|||||||
Opcode.MOVE_RESULT_OBJECT
|
Opcode.MOVE_RESULT_OBJECT
|
||||||
|
|
||||||
),
|
),
|
||||||
customFingerprint = { it.definingClass.endsWith("/SettingsHeadersFragment;") && it.name == "onCreate" }
|
customFingerprint = { it, _ -> it.definingClass.endsWith("/SettingsHeadersFragment;") && it.name == "onCreate" }
|
||||||
)
|
)
|
@ -4,8 +4,8 @@ import app.revanced.extensions.toErrorResult
|
|||||||
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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.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
|
||||||
@ -32,7 +32,7 @@ class MusicSettingsBytecodePatch : BytecodePatch(
|
|||||||
SettingsHeadersFragmentFingerprint.result?.let {
|
SettingsHeadersFragmentFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val targetRegister = instruction<OneRegisterInstruction>(targetIndex).registerA
|
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
targetIndex + 1,
|
targetIndex + 1,
|
||||||
@ -44,8 +44,8 @@ class MusicSettingsBytecodePatch : BytecodePatch(
|
|||||||
PreferenceFingerprint.result?.let {
|
PreferenceFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val keyRegister = instruction<FiveRegisterInstruction>(targetIndex).registerD
|
val keyRegister = getInstruction<FiveRegisterInstruction>(targetIndex).registerD
|
||||||
val valueRegister = instruction<FiveRegisterInstruction>(targetIndex).registerE
|
val valueRegister = getInstruction<FiveRegisterInstruction>(targetIndex).registerE
|
||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
targetIndex,
|
targetIndex,
|
||||||
|
@ -3,7 +3,7 @@ package app.revanced.patches.music.misc.sharebuttonhook.fingerprints
|
|||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
|
||||||
object FullStackTraceActivityFingerprint : MethodFingerprint(
|
object FullStackTraceActivityFingerprint : MethodFingerprint(
|
||||||
customFingerprint = {
|
customFingerprint = { it, _ ->
|
||||||
it.definingClass.endsWith("FullStackTraceActivity;") && it.name == "onCreate"
|
it.definingClass.endsWith("FullStackTraceActivity;") && it.name == "onCreate"
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -5,9 +5,10 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.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
|
||||||
@ -48,13 +49,13 @@ class ShareButtonHookPatch : BytecodePatch(
|
|||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex
|
val targetIndex = it.scanResult.patternScanResult!!.startIndex
|
||||||
|
|
||||||
addInstructions(
|
addInstructionsWithLabels(
|
||||||
targetIndex,"""
|
targetIndex,"""
|
||||||
invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->overrideSharePanel()Z
|
invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->overrideSharePanel()Z
|
||||||
move-result p1
|
move-result p1
|
||||||
if-eqz p1, :default
|
if-eqz p1, :default
|
||||||
return-void
|
return-void
|
||||||
""", listOf(ExternalLabel("default", instruction(targetIndex)))
|
""", ExternalLabel("default", getInstruction(targetIndex))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} ?: return SharePanelFingerprint.toErrorResult()
|
} ?: return SharePanelFingerprint.toErrorResult()
|
||||||
@ -75,7 +76,7 @@ class ShareButtonHookPatch : BytecodePatch(
|
|||||||
1,"""
|
1,"""
|
||||||
invoke-static {p0}, $MUSIC_INTEGRATIONS_PATH/settingsmenu/SharedPreferenceChangeListener;->initializeSettings(Landroid/app/Activity;)V
|
invoke-static {p0}, $MUSIC_INTEGRATIONS_PATH/settingsmenu/SharedPreferenceChangeListener;->initializeSettings(Landroid/app/Activity;)V
|
||||||
return-void
|
return-void
|
||||||
"""
|
"""
|
||||||
) ?: return FullStackTraceActivityFingerprint.toErrorResult()
|
) ?: return FullStackTraceActivityFingerprint.toErrorResult()
|
||||||
|
|
||||||
MusicSettingsPatch.addMusicPreference(CategoryType.MISC, "revanced_hook_share_button", "false")
|
MusicSettingsPatch.addMusicPreference(CategoryType.MISC, "revanced_hook_share_button", "false")
|
||||||
|
@ -7,12 +7,12 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object MusicPlaybackControlsFingerprint : MethodFingerprint(
|
object MusicPlaybackControlsFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf("Z"),
|
parameters = listOf("Z"),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.IPUT_BOOLEAN,
|
Opcode.IPUT_BOOLEAN,
|
||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.RETURN_VOID
|
Opcode.RETURN_VOID
|
||||||
),
|
),
|
||||||
customFingerprint = { it.definingClass.endsWith("MusicPlaybackControls;") }
|
customFingerprint = { it, _ -> it.definingClass.endsWith("MusicPlaybackControls;") }
|
||||||
)
|
)
|
||||||
|
@ -9,7 +9,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object ShuffleClassFingerprint : MethodFingerprint(
|
object ShuffleClassFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
@ -18,6 +18,6 @@ object ShuffleClassFingerprint : MethodFingerprint(
|
|||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.RETURN_VOID
|
Opcode.RETURN_VOID
|
||||||
),
|
),
|
||||||
customFingerprint = { it.name == "<init>" && it.isWideLiteralExists(disabledIconId) }
|
customFingerprint = { it, _ -> it.name == "<init>" && it.isWideLiteralExists(disabledIconId) }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object ShuffleClassReferenceFingerprint : MethodFingerprint(
|
object ShuffleClassReferenceFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf(),
|
parameters = listOf(),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.IGET_OBJECT,
|
Opcode.IGET_OBJECT,
|
||||||
|
@ -6,9 +6,9 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
@ -65,10 +65,10 @@ class EnforceShufflePatch : BytecodePatch(
|
|||||||
|
|
||||||
SHUFFLE_CLASS = it.classDef.type
|
SHUFFLE_CLASS = it.classDef.type
|
||||||
|
|
||||||
shuffleReference1 = instruction(startIndex).descriptor
|
shuffleReference1 = getInstruction(startIndex).descriptor
|
||||||
shuffleReference2 = instruction(startIndex + 1).descriptor
|
shuffleReference2 = getInstruction(startIndex + 1).descriptor
|
||||||
shuffleReference3 = instruction(endIndex).descriptor
|
shuffleReference3 = getInstruction(endIndex).descriptor
|
||||||
shuffleReference4 = instruction(imageViewIndex).descriptor
|
shuffleReference4 = getInstruction(imageViewIndex).descriptor
|
||||||
}
|
}
|
||||||
} ?: return ShuffleClassReferenceFingerprint.toErrorResult()
|
} ?: return ShuffleClassReferenceFingerprint.toErrorResult()
|
||||||
|
|
||||||
@ -99,8 +99,8 @@ class EnforceShufflePatch : BytecodePatch(
|
|||||||
|
|
||||||
MusicPlaybackControlsFingerprint.result?.let {
|
MusicPlaybackControlsFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
shuffleReference5 = instruction(0).descriptor
|
shuffleReference5 = getInstruction(0).descriptor
|
||||||
shuffleReference6 = instruction(1).descriptor
|
shuffleReference6 = getInstruction(1).descriptor
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
0, """
|
0, """
|
||||||
|
@ -9,5 +9,5 @@ object MusicPlaybackControlsClickFingerprint : MethodFingerprint(
|
|||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.RETURN_VOID
|
Opcode.RETURN_VOID
|
||||||
),
|
),
|
||||||
customFingerprint = { it.definingClass.endsWith("/MusicPlaybackControls;") && it.name == "onClick" }
|
customFingerprint = { it, _ -> it.definingClass.endsWith("/MusicPlaybackControls;") && it.name == "onClick" }
|
||||||
)
|
)
|
||||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object MusicPlaybackControlsTimeFingerprint : MethodFingerprint(
|
object MusicPlaybackControlsTimeFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL or AccessFlags.SYNTHETIC,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL or AccessFlags.SYNTHETIC,
|
||||||
parameters = listOf("J","J","J","J"),
|
parameters = listOf("J","J","J","J"),
|
||||||
opcodes = listOf(Opcode.RETURN_VOID),
|
opcodes = listOf(Opcode.RETURN_VOID),
|
||||||
)
|
)
|
@ -4,7 +4,7 @@ import app.revanced.extensions.toErrorResult
|
|||||||
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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
@ -9,7 +9,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
|
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
|
||||||
object TasteBuilderConstructorFingerprint : MethodFingerprint(
|
object TasteBuilderConstructorFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||||
parameters = listOf("L", "L", "L"),
|
parameters = listOf("L", "L", "L"),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.INVOKE_DIRECT,
|
Opcode.INVOKE_DIRECT,
|
||||||
|
@ -5,8 +5,8 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.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
|
||||||
@ -27,7 +27,7 @@ class RemoveTasteBuilderPatch : BytecodePatch(
|
|||||||
TasteBuilderConstructorFingerprint.result?.let {
|
TasteBuilderConstructorFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex - 8
|
val insertIndex = it.scanResult.patternScanResult!!.endIndex - 8
|
||||||
val register = instruction<TwoRegisterInstruction>(insertIndex).registerA
|
val register = getInstruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
insertIndex, """
|
insertIndex, """
|
||||||
|
@ -9,13 +9,13 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object NotifierShelfFingerprint : MethodFingerprint(
|
object NotifierShelfFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.CONST,
|
Opcode.CONST,
|
||||||
Opcode.CONST_4,
|
Opcode.CONST_4,
|
||||||
Opcode.INVOKE_STATIC,
|
Opcode.INVOKE_STATIC,
|
||||||
Opcode.MOVE_RESULT_OBJECT
|
Opcode.MOVE_RESULT_OBJECT
|
||||||
),
|
),
|
||||||
customFingerprint = { it.isWideLiteralExists(notifierShelfId)}
|
customFingerprint = { it, _ -> it.isWideLiteralExists(notifierShelfId)}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -8,10 +8,10 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object PivotBarConstructorFingerprint : MethodFingerprint(
|
object PivotBarConstructorFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.IPUT_OBJECT,
|
Opcode.IPUT_OBJECT,
|
||||||
Opcode.RETURN_VOID
|
Opcode.RETURN_VOID
|
||||||
),
|
),
|
||||||
customFingerprint = { it.name == "<init>" && it.isNarrowLiteralExists(117501096) }
|
customFingerprint = { it, _ -> it.name == "<init>" && it.isNarrowLiteralExists(117501096) }
|
||||||
)
|
)
|
@ -5,10 +5,10 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.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
|
||||||
@ -16,7 +16,8 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
|||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patches.music.misc.integrations.patch.MusicIntegrationsPatch
|
import app.revanced.patches.music.misc.integrations.patch.MusicIntegrationsPatch
|
||||||
import app.revanced.patches.music.misc.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.music.misc.resourceid.patch.SharedResourceIdPatch
|
||||||
import app.revanced.patches.music.misc.upgradebutton.fingerprints.*
|
import app.revanced.patches.music.misc.upgradebutton.fingerprints.NotifierShelfFingerprint
|
||||||
|
import app.revanced.patches.music.misc.upgradebutton.fingerprints.PivotBarConstructorFingerprint
|
||||||
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
|
||||||
import app.revanced.util.integrations.Constants.INTEGRATIONS_PATH
|
import app.revanced.util.integrations.Constants.INTEGRATIONS_PATH
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
@ -44,16 +45,16 @@ class RemoveUpgradeButtonPatch : BytecodePatch(
|
|||||||
PivotBarConstructorFingerprint.result?.let {
|
PivotBarConstructorFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex
|
val targetIndex = it.scanResult.patternScanResult!!.startIndex
|
||||||
val targetRegisterA = instruction<TwoRegisterInstruction>(targetIndex).registerA
|
val targetRegisterA = getInstruction<TwoRegisterInstruction>(targetIndex).registerA
|
||||||
val targetRegisterB = instruction<TwoRegisterInstruction>(targetIndex).registerB
|
val targetRegisterB = getInstruction<TwoRegisterInstruction>(targetIndex).registerB
|
||||||
|
|
||||||
val replaceReference = instruction<ReferenceInstruction>(targetIndex).reference.toString()
|
val replaceReference = getInstruction<ReferenceInstruction>(targetIndex).reference.toString()
|
||||||
|
|
||||||
replaceInstruction(
|
replaceInstruction(
|
||||||
targetIndex,
|
targetIndex,
|
||||||
"invoke-interface {v$targetRegisterA}, Ljava/util/List;->size()I"
|
"invoke-interface {v$targetRegisterA}, Ljava/util/List;->size()I"
|
||||||
)
|
)
|
||||||
addInstructions(
|
addInstructionsWithLabels(
|
||||||
targetIndex + 1,"""
|
targetIndex + 1,"""
|
||||||
move-result v1
|
move-result v1
|
||||||
const/4 v2, 0x3
|
const/4 v2, 0x3
|
||||||
@ -69,7 +70,7 @@ class RemoveUpgradeButtonPatch : BytecodePatch(
|
|||||||
NotifierShelfFingerprint.result?.let {
|
NotifierShelfFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val targetRegister = instruction<OneRegisterInstruction>(targetIndex).registerA
|
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||||
addInstruction(
|
addInstruction(
|
||||||
targetIndex + 1,
|
targetIndex + 1,
|
||||||
"invoke-static {v$targetRegister}, $INTEGRATIONS_PATH/adremover/AdRemoverAPI;->HideViewWithLayout1dp(Landroid/view/View;)V"
|
"invoke-static {v$targetRegister}, $INTEGRATIONS_PATH/adremover/AdRemoverAPI;->HideViewWithLayout1dp(Landroid/view/View;)V"
|
||||||
|
@ -12,5 +12,5 @@ object MusicVideoIdFingerprint : MethodFingerprint(
|
|||||||
Opcode.INVOKE_INTERFACE,
|
Opcode.INVOKE_INTERFACE,
|
||||||
Opcode.MOVE_RESULT_OBJECT
|
Opcode.MOVE_RESULT_OBJECT
|
||||||
),
|
),
|
||||||
customFingerprint = { it.definingClass.endsWith("SubtitlesOverlayPresenter;") && it.name == "handleVideoStageEvent" }
|
customFingerprint = { it, _ -> it.definingClass.endsWith("SubtitlesOverlayPresenter;") && it.name == "handleVideoStageEvent" }
|
||||||
)
|
)
|
||||||
|
@ -5,7 +5,8 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.*
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.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
|
||||||
@ -28,7 +29,7 @@ class MusicVideoIdPatch : BytecodePatch(
|
|||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
insertIndex = it.scanResult.patternScanResult!!.endIndex
|
insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
insertMethod = this
|
insertMethod = this
|
||||||
videoIdRegister = instruction<OneRegisterInstruction>(insertIndex).registerA
|
videoIdRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
}
|
}
|
||||||
offset++ // offset so setVideoId is called before any injected call
|
offset++ // offset so setVideoId is called before any injected call
|
||||||
} ?: return MusicVideoIdFingerprint.toErrorResult()
|
} ?: return MusicVideoIdFingerprint.toErrorResult()
|
||||||
@ -54,7 +55,7 @@ class MusicVideoIdPatch : BytecodePatch(
|
|||||||
fun injectCall(
|
fun injectCall(
|
||||||
methodDescriptor: String
|
methodDescriptor: String
|
||||||
) {
|
) {
|
||||||
insertMethod.addInstructions(
|
insertMethod.addInstruction(
|
||||||
insertIndex + offset, // move-result-object offset
|
insertIndex + offset, // move-result-object offset
|
||||||
"invoke-static {v$videoIdRegister}, $methodDescriptor"
|
"invoke-static {v$videoIdRegister}, $methodDescriptor"
|
||||||
)
|
)
|
||||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object ClientInfoFingerprint : MethodFingerprint(
|
object ClientInfoFingerprint : MethodFingerprint(
|
||||||
returnType = "L",
|
returnType = "L",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf(),
|
parameters = listOf(),
|
||||||
opcodes = listOf(Opcode.OR_INT_LIT16)
|
opcodes = listOf(Opcode.OR_INT_LIT16)
|
||||||
)
|
)
|
||||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object ColorMatchPlayerParentFingerprint : MethodFingerprint(
|
object ColorMatchPlayerParentFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.IGET,
|
Opcode.IGET,
|
||||||
Opcode.IGET,
|
Opcode.IGET,
|
||||||
|
@ -4,5 +4,5 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|||||||
|
|
||||||
object LayoutConstructorFingerprint : MethodFingerprint(
|
object LayoutConstructorFingerprint : MethodFingerprint(
|
||||||
strings = listOf("1.0x"),
|
strings = listOf("1.0x"),
|
||||||
customFingerprint = { it.definingClass.endsWith("YouTubeControlsOverlay;") }
|
customFingerprint = { it, _ -> it.definingClass.endsWith("YouTubeControlsOverlay;") }
|
||||||
)
|
)
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object LayoutSwitchFingerprint : MethodFingerprint(
|
object LayoutSwitchFingerprint : MethodFingerprint(
|
||||||
returnType = "I",
|
returnType = "I",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||||
parameters = listOf("L"),
|
parameters = listOf("L"),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
@ -8,7 +8,7 @@ import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
|
|||||||
|
|
||||||
object LegacyVideoAdsFingerprint : MethodFingerprint(
|
object LegacyVideoAdsFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf(),
|
parameters = listOf(),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.CONST_WIDE_16,
|
Opcode.CONST_WIDE_16,
|
||||||
@ -20,7 +20,7 @@ object LegacyVideoAdsFingerprint : MethodFingerprint(
|
|||||||
Opcode.IPUT_WIDE,
|
Opcode.IPUT_WIDE,
|
||||||
Opcode.CONST_4,
|
Opcode.CONST_4,
|
||||||
),
|
),
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { methodDef, _ ->
|
||||||
methodDef.implementation!!.instructions.any {
|
methodDef.implementation!!.instructions.any {
|
||||||
((it as? NarrowLiteralInstruction)?.narrowLiteral == 4)
|
((it as? NarrowLiteralInstruction)?.narrowLiteral == 4)
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object LithoBufferFingerprint : MethodFingerprint(
|
object LithoBufferFingerprint : MethodFingerprint(
|
||||||
returnType = "L",
|
returnType = "L",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.CHECK_CAST,
|
Opcode.CHECK_CAST,
|
||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object LithoFingerprint : MethodFingerprint(
|
object LithoFingerprint : MethodFingerprint(
|
||||||
returnType = "L",
|
returnType = "L",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.IF_EQZ
|
Opcode.IF_EQZ
|
||||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object LithoObjectFingerprint : MethodFingerprint(
|
object LithoObjectFingerprint : MethodFingerprint(
|
||||||
returnType = "L",
|
returnType = "L",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.CONST_STRING,
|
Opcode.CONST_STRING,
|
||||||
Opcode.INVOKE_VIRTUAL
|
Opcode.INVOKE_VIRTUAL
|
||||||
|
@ -9,10 +9,10 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object PivotBarCreateButtonViewFingerprint : MethodFingerprint(
|
object PivotBarCreateButtonViewFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.MOVE_OBJECT,
|
Opcode.MOVE_OBJECT,
|
||||||
Opcode.INVOKE_DIRECT_RANGE, // unique instruction anchor
|
Opcode.INVOKE_DIRECT_RANGE, // unique instruction anchor
|
||||||
),
|
),
|
||||||
customFingerprint = { it.isWideLiteralExists(imageOnlyTabId) }
|
customFingerprint = { it, _ -> it.isWideLiteralExists(imageOnlyTabId) }
|
||||||
)
|
)
|
@ -7,8 +7,8 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object SubtitleButtonControllerFingerprint : MethodFingerprint(
|
object SubtitleButtonControllerFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf("L"),
|
parameters = listOf("Lcom/google/android/libraries/youtube/player/subtitles/model/SubtitleTrack;"),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.IGET_OBJECT,
|
Opcode.IGET_OBJECT,
|
||||||
Opcode.IF_NEZ,
|
Opcode.IF_NEZ,
|
||||||
@ -19,5 +19,6 @@ object SubtitleButtonControllerFingerprint : MethodFingerprint(
|
|||||||
Opcode.CONST,
|
Opcode.CONST,
|
||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.IGET_OBJECT
|
Opcode.IGET_OBJECT
|
||||||
)
|
),
|
||||||
|
customFingerprint = { it, _ -> it.definingClass.endsWith("SubtitleButtonController;") }
|
||||||
)
|
)
|
@ -6,6 +6,6 @@ import org.jf.dexlib2.AccessFlags
|
|||||||
|
|
||||||
object SubtitleTrackFingerprint : MethodFingerprint(
|
object SubtitleTrackFingerprint : MethodFingerprint(
|
||||||
returnType = "Z",
|
returnType = "Z",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
strings = listOf("DISABLE_CAPTIONS_OPTION")
|
strings = listOf("DISABLE_CAPTIONS_OPTION")
|
||||||
)
|
)
|
@ -6,5 +6,5 @@ import app.revanced.util.bytecode.isWideLiteralExists
|
|||||||
|
|
||||||
object TotalTimeFingerprint : MethodFingerprint(
|
object TotalTimeFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
customFingerprint = { it.isWideLiteralExists(totalTimeId) }
|
customFingerprint = { it, _ -> it.isWideLiteralExists(totalTimeId) }
|
||||||
)
|
)
|
@ -4,13 +4,14 @@ import app.revanced.extensions.toErrorResult
|
|||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
import app.revanced.patcher.patch.PatchResultError
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patches.shared.patch.integrations.AbstractIntegrationsPatch.IntegrationsFingerprint.RegisterResolver
|
import org.jf.dexlib2.Opcode
|
||||||
|
import org.jf.dexlib2.iface.ClassDef
|
||||||
import org.jf.dexlib2.iface.Method
|
import org.jf.dexlib2.iface.Method
|
||||||
|
|
||||||
@Description("Applies mandatory patches to implement the ReVanced integrations into the application.")
|
@Description("Applies mandatory patches to implement the ReVanced integrations into the application.")
|
||||||
@ -26,11 +27,21 @@ abstract class AbstractIntegrationsPatch(
|
|||||||
* @see MethodFingerprint
|
* @see MethodFingerprint
|
||||||
*/
|
*/
|
||||||
abstract class IntegrationsFingerprint(
|
abstract class IntegrationsFingerprint(
|
||||||
|
returnType: String? = null,
|
||||||
|
accessFlags: Int? = null,
|
||||||
|
parameters: Iterable<String>? = null,
|
||||||
|
opcodes: Iterable<Opcode?>? = null,
|
||||||
strings: Iterable<String>? = null,
|
strings: Iterable<String>? = null,
|
||||||
customFingerprint: ((methodDef: Method) -> Boolean)? = null,
|
customFingerprint: ((methodDef: Method, classDef: ClassDef) -> Boolean)? = null,
|
||||||
private val contextRegisterResolver: (Method) -> Int = object : RegisterResolver {}
|
private val contextRegisterResolver: (Method) -> Int = object : RegisterResolver {}
|
||||||
) : MethodFingerprint(strings = strings, customFingerprint = customFingerprint) {
|
) : MethodFingerprint(
|
||||||
|
returnType,
|
||||||
|
accessFlags,
|
||||||
|
parameters,
|
||||||
|
opcodes,
|
||||||
|
strings,
|
||||||
|
customFingerprint
|
||||||
|
) {
|
||||||
fun invoke(integrationsDescriptor: String): PatchResult {
|
fun invoke(integrationsDescriptor: String): PatchResult {
|
||||||
result?.mutableMethod?.let { method ->
|
result?.mutableMethod?.let { method ->
|
||||||
val contextRegister = contextRegisterResolver(method)
|
val contextRegister = contextRegisterResolver(method)
|
||||||
@ -41,6 +52,7 @@ abstract class AbstractIntegrationsPatch(
|
|||||||
"$integrationsDescriptor->context:Landroid/content/Context;"
|
"$integrationsDescriptor->context:Landroid/content/Context;"
|
||||||
)
|
)
|
||||||
} ?: return toErrorResult()
|
} ?: return toErrorResult()
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import app.revanced.extensions.toErrorResult
|
|||||||
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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
@ -5,8 +5,9 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.data.toMethodWalker
|
import app.revanced.patcher.data.toMethodWalker
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.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
|
||||||
@ -55,13 +56,13 @@ class GeneralVideoAdsPatch : BytecodePatch(
|
|||||||
fun injectMainstreamAds(
|
fun injectMainstreamAds(
|
||||||
descriptor: String
|
descriptor: String
|
||||||
) {
|
) {
|
||||||
mainstreamVideoAdsMethod.addInstructions(
|
mainstreamVideoAdsMethod.addInstructionsWithLabels(
|
||||||
0, """
|
0, """
|
||||||
invoke-static {}, $descriptor
|
invoke-static {}, $descriptor
|
||||||
move-result v0
|
move-result v0
|
||||||
if-nez v0, :show_video_ads
|
if-nez v0, :show_video_ads
|
||||||
return-void
|
return-void
|
||||||
""", listOf(ExternalLabel("show_video_ads", mainstreamVideoAdsMethod.instruction(0)))
|
""", ExternalLabel("show_video_ads", mainstreamVideoAdsMethod.getInstruction(0))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,5 +5,5 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object OnBackPressedFingerprint : MethodFingerprint(
|
object OnBackPressedFingerprint : MethodFingerprint(
|
||||||
opcodes = listOf(Opcode.RETURN_VOID),
|
opcodes = listOf(Opcode.RETURN_VOID),
|
||||||
customFingerprint = { it.definingClass.endsWith("WatchWhileActivity;") && it.name == "onBackPressed" }
|
customFingerprint = { it, _ -> it.definingClass.endsWith("WatchWhileActivity;") && it.name == "onBackPressed" }
|
||||||
)
|
)
|
||||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object ScrollPositionFingerprint : MethodFingerprint(
|
object ScrollPositionFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PROTECTED or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL,
|
||||||
parameters = listOf("L"),
|
parameters = listOf("L"),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.IF_NEZ,
|
Opcode.IF_NEZ,
|
||||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object ScrollTopFingerprint : MethodFingerprint(
|
object ScrollTopFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf(),
|
parameters = listOf(),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.CHECK_CAST,
|
Opcode.CHECK_CAST,
|
||||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object ScrollTopParentFingerprint : MethodFingerprint(
|
object ScrollTopParentFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.IPUT_OBJECT,
|
Opcode.IPUT_OBJECT,
|
||||||
Opcode.IPUT_OBJECT,
|
Opcode.IPUT_OBJECT,
|
||||||
@ -20,6 +20,6 @@ object ScrollTopParentFingerprint : MethodFingerprint(
|
|||||||
Opcode.IPUT_OBJECT,
|
Opcode.IPUT_OBJECT,
|
||||||
Opcode.RETURN_VOID
|
Opcode.RETURN_VOID
|
||||||
),
|
),
|
||||||
customFingerprint = { it.name == "<init>"}
|
customFingerprint = { it, _ -> it.name == "<init>"}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.data.toMethodWalker
|
import app.revanced.patcher.data.toMethodWalker
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
@ -5,7 +5,7 @@ import app.revanced.extensions.injectHideCall
|
|||||||
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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.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
|
||||||
@ -33,10 +33,10 @@ class GeneralAdsBytecodePatch : BytecodePatch() {
|
|||||||
.findMutableMethodOf(method)
|
.findMutableMethodOf(method)
|
||||||
.apply {
|
.apply {
|
||||||
val insertIndex = method.getWideLiteralIndex(adAttributionId) + 1
|
val insertIndex = method.getWideLiteralIndex(adAttributionId) + 1
|
||||||
if (instruction(insertIndex).opcode != org.jf.dexlib2.Opcode.INVOKE_VIRTUAL)
|
if (getInstruction(insertIndex).opcode != org.jf.dexlib2.Opcode.INVOKE_VIRTUAL)
|
||||||
return@forEach
|
return@forEach
|
||||||
|
|
||||||
val viewRegister = instruction<Instruction35c>(insertIndex).registerC
|
val viewRegister = getInstruction<Instruction35c>(insertIndex).registerC
|
||||||
|
|
||||||
this.implementation!!.injectHideCall(insertIndex, viewRegister, "ads/AdsFilter", "hideAdAttributionView")
|
this.implementation!!.injectHideCall(insertIndex, viewRegister, "ads/AdsFilter", "hideAdAttributionView")
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,19 @@
|
|||||||
package app.revanced.patches.youtube.ads.getpremium.fingerprints
|
package app.revanced.patches.youtube.ads.getpremium.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
object CompactYpcOfferModuleViewFingerprint : MethodFingerprint(
|
object CompactYpcOfferModuleViewFingerprint : MethodFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL,
|
||||||
|
parameters = listOf("I", "I"),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.ADD_INT_2ADDR,
|
Opcode.ADD_INT_2ADDR,
|
||||||
Opcode.ADD_INT_2ADDR,
|
Opcode.ADD_INT_2ADDR,
|
||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.RETURN_VOID
|
Opcode.RETURN_VOID
|
||||||
),
|
),
|
||||||
customFingerprint = { it.definingClass.endsWith("CompactYpcOfferModuleView;") && it.name == "onMeasure" }
|
customFingerprint = { it, _ -> it.definingClass.endsWith("CompactYpcOfferModuleView;") && it.name == "onMeasure" }
|
||||||
)
|
)
|
@ -4,8 +4,8 @@ import app.revanced.extensions.toErrorResult
|
|||||||
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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.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
|
||||||
@ -24,19 +24,19 @@ class HideGetPremiumPatch : BytecodePatch(
|
|||||||
CompactYpcOfferModuleViewFingerprint.result?.let {
|
CompactYpcOfferModuleViewFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
||||||
val measuredWidthRegister = instruction<TwoRegisterInstruction>(startIndex).registerA
|
val measuredWidthRegister = getInstruction<TwoRegisterInstruction>(startIndex).registerA
|
||||||
val measuredHeightInstruction = instruction<TwoRegisterInstruction>(startIndex + 1)
|
val measuredHeightInstruction = getInstruction<TwoRegisterInstruction>(startIndex + 1)
|
||||||
val measuredHeightRegister = measuredHeightInstruction.registerA
|
val measuredHeightRegister = measuredHeightInstruction.registerA
|
||||||
val tempRegister = measuredHeightInstruction.registerB
|
val tempRegister = measuredHeightInstruction.registerB
|
||||||
|
|
||||||
addInstructions(
|
addInstructionsWithLabels(
|
||||||
startIndex + 2, """
|
startIndex + 2, """
|
||||||
invoke-static {}, $PATCHES_PATH/ads/AdsFilter;->hideGetPremium()Z
|
invoke-static {}, $PATCHES_PATH/ads/AdsFilter;->hideGetPremium()Z
|
||||||
move-result v$tempRegister
|
move-result v$tempRegister
|
||||||
if-eqz v$tempRegister, :show
|
if-eqz v$tempRegister, :show
|
||||||
const/4 v$measuredWidthRegister, 0x0
|
const/4 v$measuredWidthRegister, 0x0
|
||||||
const/4 v$measuredHeightRegister, 0x0
|
const/4 v$measuredHeightRegister, 0x0
|
||||||
""", listOf(ExternalLabel("show", instruction(startIndex + 2)))
|
""", ExternalLabel("show", getInstruction(startIndex + 2))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} ?: return CompactYpcOfferModuleViewFingerprint.toErrorResult()
|
} ?: return CompactYpcOfferModuleViewFingerprint.toErrorResult()
|
||||||
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object SwipeRefreshLayoutFingerprint : MethodFingerprint(
|
object SwipeRefreshLayoutFingerprint : MethodFingerprint(
|
||||||
returnType = "Z",
|
returnType = "Z",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf(),
|
parameters = listOf(),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.RETURN,
|
Opcode.RETURN,
|
||||||
@ -15,5 +15,5 @@ object SwipeRefreshLayoutFingerprint : MethodFingerprint(
|
|||||||
Opcode.MOVE_RESULT,
|
Opcode.MOVE_RESULT,
|
||||||
Opcode.RETURN
|
Opcode.RETURN
|
||||||
),
|
),
|
||||||
customFingerprint = { it.definingClass.endsWith("SwipeRefreshLayout;") }
|
customFingerprint = { it, _ -> it.definingClass.endsWith("SwipeRefreshLayout;") }
|
||||||
)
|
)
|
||||||
|
@ -4,8 +4,8 @@ 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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.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
|
||||||
@ -26,7 +26,7 @@ class SwipeRefreshPatch : BytecodePatch(
|
|||||||
SwipeRefreshLayoutFingerprint.result?.let {
|
SwipeRefreshLayoutFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
val register = instruction<OneRegisterInstruction>(insertIndex).registerA
|
val register = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
addInstruction(
|
addInstruction(
|
||||||
insertIndex,
|
insertIndex,
|
||||||
|
@ -6,7 +6,7 @@ import org.jf.dexlib2.AccessFlags
|
|||||||
|
|
||||||
object AutoNavInformerFingerprint : MethodFingerprint(
|
object AutoNavInformerFingerprint : MethodFingerprint(
|
||||||
returnType = "Z",
|
returnType = "Z",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf(),
|
parameters = listOf(),
|
||||||
customFingerprint = { it.definingClass.endsWith("WillAutonavInformer;") }
|
customFingerprint = { it, _ -> it.definingClass.endsWith("WillAutonavInformer;") }
|
||||||
)
|
)
|
@ -7,7 +7,7 @@ import org.jf.dexlib2.Opcode
|
|||||||
|
|
||||||
object RepeatListenerFingerprint : MethodFingerprint(
|
object RepeatListenerFingerprint : MethodFingerprint(
|
||||||
returnType = "Z",
|
returnType = "Z",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.INVOKE_VIRTUAL_RANGE,
|
Opcode.INVOKE_VIRTUAL_RANGE,
|
||||||
Opcode.IGET_OBJECT,
|
Opcode.IGET_OBJECT,
|
||||||
|
@ -6,7 +6,7 @@ import org.jf.dexlib2.AccessFlags
|
|||||||
|
|
||||||
object VideoEndFingerprint : MethodFingerprint(
|
object VideoEndFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf(),
|
parameters = listOf(),
|
||||||
customFingerprint = { it.implementation!!.instructions.count() == 3 && it.annotations.isEmpty()}
|
customFingerprint = { it, _ -> it.implementation!!.instructions.count() == 3 && it.annotations.isEmpty()}
|
||||||
)
|
)
|
@ -6,7 +6,7 @@ import org.jf.dexlib2.AccessFlags
|
|||||||
|
|
||||||
object VideoEndParentFingerprint : MethodFingerprint(
|
object VideoEndParentFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
strings = listOf(
|
strings = listOf(
|
||||||
"play() called when the player wasn't loaded.",
|
"play() called when the player wasn't loaded.",
|
||||||
"play() blocked because Background Playability failed"
|
"play() blocked because Background Playability failed"
|
||||||
|
@ -4,7 +4,10 @@ import app.revanced.extensions.toErrorResult
|
|||||||
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.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.*
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
@ -34,13 +37,13 @@ class AutoRepeatPatch : BytecodePatch(
|
|||||||
VideoEndFingerprint.also {
|
VideoEndFingerprint.also {
|
||||||
it.resolve(context, classDef)
|
it.resolve(context, classDef)
|
||||||
}.result?.mutableMethod?.let {
|
}.result?.mutableMethod?.let {
|
||||||
it.addInstructions(
|
it.addInstructionsWithLabels(
|
||||||
0, """
|
0, """
|
||||||
invoke-static {}, $VIDEO_PATH/VideoInformation;->shouldAutoRepeat()Z
|
invoke-static {}, $VIDEO_PATH/VideoInformation;->shouldAutoRepeat()Z
|
||||||
move-result v0
|
move-result v0
|
||||||
if-eqz v0, :notrepeat
|
if-eqz v0, :notrepeat
|
||||||
return-void
|
return-void
|
||||||
""", listOf(ExternalLabel("notrepeat", it.instruction(0)))
|
""", ExternalLabel("notrepeat", it.getInstruction(0))
|
||||||
)
|
)
|
||||||
} ?: return VideoEndFingerprint.toErrorResult()
|
} ?: return VideoEndFingerprint.toErrorResult()
|
||||||
} ?: return VideoEndParentFingerprint.toErrorResult()
|
} ?: return VideoEndParentFingerprint.toErrorResult()
|
||||||
@ -50,20 +53,20 @@ class AutoRepeatPatch : BytecodePatch(
|
|||||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex - 1
|
val targetIndex = it.scanResult.patternScanResult!!.startIndex - 1
|
||||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
|
||||||
val registerC = instruction<BuilderInstruction35c>(targetIndex).registerC
|
val registerC = getInstruction<BuilderInstruction35c>(targetIndex).registerC
|
||||||
val registerD = instruction<BuilderInstruction35c>(targetIndex).registerD
|
val registerD = getInstruction<BuilderInstruction35c>(targetIndex).registerD
|
||||||
|
|
||||||
val dummyRegister = (instruction(endIndex) as Instruction31i).registerA
|
val dummyRegister = (getInstruction(endIndex) as Instruction31i).registerA
|
||||||
|
|
||||||
val targetReference = instruction<ReferenceInstruction>(targetIndex).reference
|
val targetReference = getInstruction<ReferenceInstruction>(targetIndex).reference
|
||||||
|
|
||||||
addInstructions(
|
addInstructionsWithLabels(
|
||||||
targetIndex + 1, """
|
targetIndex + 1, """
|
||||||
invoke-static {}, $UTILS_PATH/EnableAutoRepeatPatch;->shouldAutoRepeat()Z
|
invoke-static {}, $UTILS_PATH/EnableAutoRepeatPatch;->shouldAutoRepeat()Z
|
||||||
move-result v$dummyRegister
|
move-result v$dummyRegister
|
||||||
if-nez v$dummyRegister, :bypass
|
if-nez v$dummyRegister, :bypass
|
||||||
invoke-virtual {v$registerC, v$registerD}, $targetReference
|
invoke-virtual {v$registerC, v$registerD}, $targetReference
|
||||||
""", listOf(ExternalLabel("bypass", instruction(targetIndex + 1)))
|
""", ExternalLabel("bypass", getInstruction(targetIndex + 1))
|
||||||
)
|
)
|
||||||
removeInstruction(targetIndex)
|
removeInstruction(targetIndex)
|
||||||
}
|
}
|
||||||
@ -71,13 +74,13 @@ class AutoRepeatPatch : BytecodePatch(
|
|||||||
|
|
||||||
AutoNavInformerFingerprint.result?.mutableMethod?.let {
|
AutoNavInformerFingerprint.result?.mutableMethod?.let {
|
||||||
val index = it.implementation!!.instructions.size - 1 - 1
|
val index = it.implementation!!.instructions.size - 1 - 1
|
||||||
val register = it.instruction<OneRegisterInstruction>(index).registerA
|
val register = it.getInstruction<OneRegisterInstruction>(index).registerA
|
||||||
|
|
||||||
it.addInstructions(
|
it.addInstructions(
|
||||||
index + 1, """
|
index + 1, """
|
||||||
invoke-static {v$register}, $UTILS_PATH/EnableAutoRepeatPatch;->enableAutoRepeat(Z)Z
|
invoke-static {v$register}, $UTILS_PATH/EnableAutoRepeatPatch;->enableAutoRepeat(Z)Z
|
||||||
move-result v0
|
move-result v0
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
} ?: return AutoNavInformerFingerprint.toErrorResult()
|
} ?: return AutoNavInformerFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user