From cd0bb9344bd72efb399dd1c5464da6e810433809 Mon Sep 17 00:00:00 2001 From: FullerBread2032 Date: Sat, 7 Sep 2024 17:56:49 +0200 Subject: [PATCH 1/2] Fix(Soundcloud): Fix Hide ads patch in newer versions --- .../soundcloud/ad/fingerprints/InterceptFingerprint.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/soundcloud/ad/fingerprints/InterceptFingerprint.kt b/src/main/kotlin/app/revanced/patches/soundcloud/ad/fingerprints/InterceptFingerprint.kt index d9f1e58749..1b54b5963a 100644 --- a/src/main/kotlin/app/revanced/patches/soundcloud/ad/fingerprints/InterceptFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/soundcloud/ad/fingerprints/InterceptFingerprint.kt @@ -11,12 +11,10 @@ internal object InterceptFingerprint : MethodFingerprint( opcodes = listOf( Opcode.INVOKE_INTERFACE, Opcode.MOVE_RESULT_OBJECT, - Opcode.INVOKE_VIRTUAL, - Opcode.MOVE_RESULT, - Opcode.IF_EQZ, + Opcode.CONST_4 ), strings = listOf("SC-Mob-UserPlan", "Configuration"), customFingerprint = { _, classDef -> - classDef.sourceFile == "ApiUserPlanInterceptor.java" + classDef.sourceFile == "ApiUserPlanInterceptor.kt" }, ) From 85483256ac0c56565dc74c289599f57ca7843078 Mon Sep 17 00:00:00 2001 From: FullerBread2032 Date: Sat, 7 Sep 2024 21:51:24 +0200 Subject: [PATCH 2/2] Support for older version --- .../app/revanced/patches/soundcloud/ad/HideAdsPatch.kt | 2 +- .../soundcloud/ad/fingerprints/InterceptFingerprint.kt | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/soundcloud/ad/HideAdsPatch.kt b/src/main/kotlin/app/revanced/patches/soundcloud/ad/HideAdsPatch.kt index 4f538458a3..ea94b3f2a5 100644 --- a/src/main/kotlin/app/revanced/patches/soundcloud/ad/HideAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/soundcloud/ad/HideAdsPatch.kt @@ -62,7 +62,7 @@ object HideAdsPatch : BytecodePatch( // Prevent verification of an HTTP header containing the user's current plan, which would contradict the previous patch. InterceptFingerprint.resultOrThrow().let { result -> - val conditionIndex = result.scanResult.patternScanResult!!.endIndex + val conditionIndex = result.scanResult.patternScanResult!!.endIndex + 1 result.mutableMethod.addInstruction( conditionIndex, "return-object p1", diff --git a/src/main/kotlin/app/revanced/patches/soundcloud/ad/fingerprints/InterceptFingerprint.kt b/src/main/kotlin/app/revanced/patches/soundcloud/ad/fingerprints/InterceptFingerprint.kt index 1b54b5963a..d38975357b 100644 --- a/src/main/kotlin/app/revanced/patches/soundcloud/ad/fingerprints/InterceptFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/soundcloud/ad/fingerprints/InterceptFingerprint.kt @@ -9,12 +9,13 @@ internal object InterceptFingerprint : MethodFingerprint( accessFlags = AccessFlags.PUBLIC.value, parameters = listOf("L"), opcodes = listOf( - Opcode.INVOKE_INTERFACE, Opcode.MOVE_RESULT_OBJECT, - Opcode.CONST_4 + Opcode.INVOKE_INTERFACE, + Opcode.MOVE_RESULT_OBJECT ), strings = listOf("SC-Mob-UserPlan", "Configuration"), customFingerprint = { _, classDef -> + classDef.sourceFile == "ApiUserPlanInterceptor.java" || classDef.sourceFile == "ApiUserPlanInterceptor.kt" }, )