mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-04 16:44:29 +02:00
refactor(default-video-quality): improve the patch method
This commit is contained in:
parent
a4ca3b8ca9
commit
e2a4d02acf
@ -10,8 +10,8 @@ object VideoQualitySettingsParentFingerprint : MethodFingerprint(
|
|||||||
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf("[L", "I", "Z"),
|
parameters = listOf("[L", "I", "Z"),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.IF_EQZ,
|
Opcode.IF_NE,
|
||||||
Opcode.IF_EQ,
|
Opcode.IGET,
|
||||||
Opcode.IF_EQ
|
Opcode.IF_EQ
|
||||||
),
|
),
|
||||||
strings = listOf("menu_item_video_quality")
|
strings = listOf("menu_item_video_quality")
|
||||||
|
@ -6,6 +6,7 @@ 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.addInstruction
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.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
|
||||||
@ -51,6 +52,7 @@ class VideoQualityBytecodePatch : BytecodePatch(
|
|||||||
relayFieldReference = (it.implementation!!.instructions.elementAt(0) as ReferenceInstruction).reference as FieldReference
|
relayFieldReference = (it.implementation!!.instructions.elementAt(0) as ReferenceInstruction).reference as FieldReference
|
||||||
} ?: return VideoQualitySettingsFingerprint.toErrorResult()
|
} ?: return VideoQualitySettingsFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
parentResult.mutableMethod.removeInstruction(parentResult.scanResult.patternScanResult!!.endIndex)
|
||||||
parentResult.mutableMethod.addInstructions(
|
parentResult.mutableMethod.addInstructions(
|
||||||
0, """
|
0, """
|
||||||
iget-object v0, p0, ${parentResult.classDef.type}->${relayFieldReference.name}:${relayFieldReference.type}
|
iget-object v0, p0, ${parentResult.classDef.type}->${relayFieldReference.name}:${relayFieldReference.type}
|
||||||
@ -61,7 +63,7 @@ class VideoQualityBytecodePatch : BytecodePatch(
|
|||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
LegacyVideoIdPatch.qualityOffSet = 5
|
LegacyVideoIdPatch.qualityOffSet = 4
|
||||||
} ?: return VideoQualitySettingsParentFingerprint.toErrorResult()
|
} ?: return VideoQualitySettingsParentFingerprint.toErrorResult()
|
||||||
|
|
||||||
LegacyVideoIdPatch.injectCall("$INTEGRATIONS_VIDEO_QUALITY_CLASS_DESCRIPTOR->newVideoStarted(Ljava/lang/String;)V")
|
LegacyVideoIdPatch.injectCall("$INTEGRATIONS_VIDEO_QUALITY_CLASS_DESCRIPTOR->newVideoStarted(Ljava/lang/String;)V")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user