mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-13 05:37:40 +02:00
fix(youtube/bypass-ambient-mode-restrictions): update fingerprint
This commit is contained in:
@ -0,0 +1,23 @@
|
|||||||
|
package app.revanced.patches.youtube.misc.ambientmode.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.util.bytecode.isNarrowLiteralExists
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
|
object PowerSaveModeAlternativeFingerprint : MethodFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = listOf("Ljava/lang/Object;"),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.IF_GT,
|
||||||
|
Opcode.IGET,
|
||||||
|
Opcode.ADD_INT_2ADDR
|
||||||
|
),
|
||||||
|
customFingerprint = { methodDef, _ ->
|
||||||
|
methodDef.isNarrowLiteralExists(107243) && methodDef.isNarrowLiteralExists(
|
||||||
|
140796
|
||||||
|
) && methodDef.name == "accept"
|
||||||
|
}
|
||||||
|
)
|
@ -10,6 +10,7 @@ import app.revanced.patcher.patch.BytecodePatch
|
|||||||
import app.revanced.patcher.patch.PatchException
|
import app.revanced.patcher.patch.PatchException
|
||||||
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.youtube.misc.ambientmode.fingerprints.PowerSaveModeAlternativeFingerprint
|
||||||
import app.revanced.patches.youtube.misc.ambientmode.fingerprints.PowerSaveModeFingerprint
|
import app.revanced.patches.youtube.misc.ambientmode.fingerprints.PowerSaveModeFingerprint
|
||||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||||
@ -31,11 +32,19 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|||||||
)
|
)
|
||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
class PowerSaveModePatch : BytecodePatch(
|
class PowerSaveModePatch : BytecodePatch(
|
||||||
listOf(PowerSaveModeFingerprint)
|
listOf(
|
||||||
|
PowerSaveModeAlternativeFingerprint,
|
||||||
|
PowerSaveModeFingerprint
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
|
|
||||||
PowerSaveModeFingerprint.result?.let {
|
val result =
|
||||||
|
PowerSaveModeFingerprint.result
|
||||||
|
?: PowerSaveModeAlternativeFingerprint.result
|
||||||
|
?: throw PowerSaveModeFingerprint.exception
|
||||||
|
|
||||||
|
result.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
var insertIndex = -1
|
var insertIndex = -1
|
||||||
|
|
||||||
@ -59,7 +68,7 @@ class PowerSaveModePatch : BytecodePatch(
|
|||||||
if (insertIndex == -1)
|
if (insertIndex == -1)
|
||||||
throw PatchException("Couldn't find PowerManager reference")
|
throw PatchException("Couldn't find PowerManager reference")
|
||||||
}
|
}
|
||||||
} ?: throw PowerSaveModeFingerprint.exception
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
|
Reference in New Issue
Block a user