mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-21 01:53:56 +00:00
Compare commits
4 Commits
v2.174.0-d
...
v2.174.0-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
81a5d37bc3 | ||
|
|
c50f703551 | ||
|
|
85516401be | ||
|
|
311f5d80fc |
@@ -1,3 +1,10 @@
|
|||||||
|
# [2.174.0-dev.5](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.4...v2.174.0-dev.5) (2023-05-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **spotify/disable-capture-restriction:** make compatible with latest versions ([#2095](https://github.com/revanced/revanced-patches/issues/2095)) ([e48f127](https://github.com/revanced/revanced-patches/commit/e48f1278da2a9d82e70be41fa2c4c480c574816b))
|
||||||
|
|
||||||
# [2.174.0-dev.4](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.3...v2.174.0-dev.4) (2023-05-07)
|
# [2.174.0-dev.4](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.3...v2.174.0-dev.4) (2023-05-07)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
The official ReVanced Patches.
|
The official ReVanced Patches.
|
||||||
|
|
||||||
|
## 📋 List of patches in this repository
|
||||||
|
|
||||||
{{ table }}
|
{{ table }}
|
||||||
|
|
||||||
> Looking for the JSON variant of this? [Click here](patches.json).
|
> Looking for the JSON variant of this? [Click here](patches.json).
|
||||||
@@ -64,7 +66,6 @@ Example:
|
|||||||
"description": "Enables a custom theme.",
|
"description": "Enables a custom theme.",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"excluded": false,
|
"excluded": false,
|
||||||
"deprecated": false,
|
|
||||||
"options": [
|
"options": [
|
||||||
{
|
{
|
||||||
"key": "theme",
|
"key": "theme",
|
||||||
@@ -91,7 +92,6 @@ Example:
|
|||||||
"description": "Changes the YouTube launcher icon and name to your choice (defaults to ReVanced).",
|
"description": "Changes the YouTube launcher icon and name to your choice (defaults to ReVanced).",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"excluded": false,
|
"excluded": false,
|
||||||
"deprecated": false,
|
|
||||||
"options": [
|
"options": [
|
||||||
{
|
{
|
||||||
"key": "appName",
|
"key": "appName",
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
The official ReVanced Patches.
|
The official ReVanced Patches.
|
||||||
|
|
||||||
|
## 📋 List of patches in this repository
|
||||||
|
|
||||||
### [📦 `com.google.android.youtube`](https://play.google.com/store/apps/details?id=com.google.android.youtube)
|
### [📦 `com.google.android.youtube`](https://play.google.com/store/apps/details?id=com.google.android.youtube)
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
@@ -428,7 +430,6 @@ Example:
|
|||||||
"description": "Enables a custom theme.",
|
"description": "Enables a custom theme.",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"excluded": false,
|
"excluded": false,
|
||||||
"deprecated": false,
|
|
||||||
"options": [
|
"options": [
|
||||||
{
|
{
|
||||||
"key": "theme",
|
"key": "theme",
|
||||||
@@ -455,7 +456,6 @@ Example:
|
|||||||
"description": "Changes the YouTube launcher icon and name to your choice (defaults to ReVanced).",
|
"description": "Changes the YouTube launcher icon and name to your choice (defaults to ReVanced).",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"excluded": false,
|
"excluded": false,
|
||||||
"deprecated": false,
|
|
||||||
"options": [
|
"options": [
|
||||||
{
|
{
|
||||||
"key": "appName",
|
"key": "appName",
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.174.0-dev.4
|
version = 2.174.0-dev.5
|
||||||
|
|||||||
@@ -8,18 +8,13 @@ import app.revanced.patcher.extensions.instruction
|
|||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.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.PatchResultError
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
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.patches.spotify.audio.annotation.DisableCaptureRestrictionCompatibility
|
import app.revanced.patches.spotify.audio.annotation.DisableCaptureRestrictionCompatibility
|
||||||
import app.revanced.patches.spotify.audio.fingerprints.DisableCaptureRestrictionAudioDriverFingerprint
|
import app.revanced.patches.spotify.audio.fingerprints.DisableCaptureRestrictionAudioDriverFingerprint
|
||||||
import app.revanced.patches.spotify.audio.resource.patch.DisableCaptureRestrictionResourcePatch
|
import app.revanced.patches.spotify.audio.resource.patch.DisableCaptureRestrictionResourcePatch
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
|
||||||
import org.jf.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("disable-capture-restriction")
|
@Name("disable-capture-restriction")
|
||||||
@@ -35,51 +30,16 @@ class DisableCaptureRestrictionBytecodePatch : BytecodePatch(
|
|||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
val method = DisableCaptureRestrictionAudioDriverFingerprint.result!!.mutableMethod
|
val method = DisableCaptureRestrictionAudioDriverFingerprint.result!!.mutableMethod
|
||||||
|
|
||||||
var invokePosition: Int? = null
|
method.apply {
|
||||||
var invokeParamRegister: Int? = null
|
// Replace constant
|
||||||
|
val original = instruction(0) as OneRegisterInstruction
|
||||||
// Find INVOKE_VIRTUAL opcode with call to AudioAttributesBuilder.setAllowedCapturePolicy(I)
|
replaceInstruction(
|
||||||
for ((index, instruction) in method.implementation!!.instructions.withIndex()) {
|
0,
|
||||||
if(instruction.opcode != Opcode.INVOKE_VIRTUAL)
|
"const/4 v${original.registerA}, $ALLOW_CAPTURE_BY_ALL"
|
||||||
continue
|
|
||||||
|
|
||||||
val methodName = ((instruction as ReferenceInstruction).reference as MethodReference).name
|
|
||||||
if (methodName != "setAllowedCapturePolicy")
|
|
||||||
continue
|
|
||||||
|
|
||||||
// Store register of the integer parameter for setAllowedCapturePolicy
|
|
||||||
invokeParamRegister = (instruction as FiveRegisterInstruction).registerD
|
|
||||||
invokePosition = index
|
|
||||||
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if(invokePosition == null || invokeParamRegister == null)
|
|
||||||
return PatchResultError("Cannot find setAllowedCapturePolicy method call")
|
|
||||||
|
|
||||||
// Walk back to the const/4 instruction that sets the parameter register
|
|
||||||
var matchFound = false
|
|
||||||
for (index in invokePosition downTo 0) {
|
|
||||||
val instruction = method.instruction(index)
|
|
||||||
if(instruction.opcode != Opcode.CONST_4)
|
|
||||||
continue
|
|
||||||
|
|
||||||
val register = (instruction as OneRegisterInstruction).registerA
|
|
||||||
if(register != invokeParamRegister)
|
|
||||||
continue
|
|
||||||
|
|
||||||
// Replace parameter value
|
|
||||||
method.replaceInstruction(
|
|
||||||
index, "const/4 v$register, $ALLOW_CAPTURE_BY_ALL"
|
|
||||||
)
|
)
|
||||||
matchFound = true
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return if (matchFound)
|
return PatchResultSuccess()
|
||||||
PatchResultSuccess()
|
|
||||||
else
|
|
||||||
PatchResultError("Const instruction not found")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
|
|||||||
@@ -1,10 +1,27 @@
|
|||||||
package app.revanced.patches.spotify.audio.fingerprints
|
package app.revanced.patches.spotify.audio.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.iface.instruction.ReferenceInstruction
|
||||||
|
import org.jf.dexlib2.iface.reference.MethodReference
|
||||||
|
|
||||||
object DisableCaptureRestrictionAudioDriverFingerprint : MethodFingerprint(
|
object DisableCaptureRestrictionAudioDriverFingerprint : MethodFingerprint(
|
||||||
|
"L",
|
||||||
|
AccessFlags.PUBLIC or AccessFlags.STATIC or AccessFlags.SYNTHETIC or AccessFlags.BRIDGE,
|
||||||
|
listOf("L"),
|
||||||
|
listOf(
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.RETURN_OBJECT
|
||||||
|
),
|
||||||
customFingerprint = { methodDef ->
|
customFingerprint = { methodDef ->
|
||||||
methodDef.definingClass == "Lcom/spotify/playback/playbacknative/AudioDriver;" && methodDef.name == "constructAudioAttributes"
|
// Check for method call to AudioAttributes$Builder.setAllowedCapturePolicy Android API
|
||||||
|
methodDef.implementation?.instructions?.any {
|
||||||
|
((it as? ReferenceInstruction)?.reference as? MethodReference)?.name == "setAllowedCapturePolicy"
|
||||||
|
} == true
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
Reference in New Issue
Block a user