From b1adb5f58404c778950a024665b8c922105b4621 Mon Sep 17 00:00:00 2001 From: inotia00 Date: Tue, 5 Sep 2023 10:33:02 +0900 Subject: [PATCH] fix(music/remember-video-quality): not compatible with latest version --- .../misc/quality/patch/VideoQualityPatch.kt | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/music/misc/quality/patch/VideoQualityPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/quality/patch/VideoQualityPatch.kt index e6ddac4ec..803f8f9b2 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/quality/patch/VideoQualityPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/quality/patch/VideoQualityPatch.kt @@ -63,11 +63,26 @@ class VideoQualityPatch : BytecodePatch( for ((index, instruction) in implementation!!.instructions.withIndex()) { if (instruction.opcode != Opcode.INVOKE_INTERFACE) continue - qualityReference = - getInstruction(index - 1).reference qIndexMethodName = ((getInstruction(index).reference) as MethodReference).name + val qIndexMethodClass = + ((getInstruction(index).reference) as MethodReference).definingClass + + for (qualityReferenceIndex in index downTo 0) { + if (getInstruction(qualityReferenceIndex).opcode != Opcode.IGET_OBJECT) continue + + val targetReference = + getInstruction(qualityReferenceIndex).reference + + if (!targetReference.toString() + .endsWith(qIndexMethodClass) + ) continue + + qualityReference = targetReference + break + } + addInstruction( 0, "invoke-static {p3}, $INTEGRATIONS_VIDEO_QUALITY_CLASS_DESCRIPTOR->userChangedQuality(I)V"