Skip to content

Commit 0cf7a4c

Browse files
hoo-dlesNuckyz
andauthored
feat(Pandora): Add Disable audio ads and Unlimited skips patch (#4841)
Co-authored-by: Nuckyz <[email protected]>
1 parent 00aa200 commit 0cf7a4c

File tree

4 files changed

+76
-0
lines changed

4 files changed

+76
-0
lines changed

patches/api/patches.api

+8
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,14 @@ public final class app/revanced/patches/openinghours/misc/fix/crash/FixCrashPatc
380380
public static final fun getFixCrashPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
381381
}
382382

383+
public final class app/revanced/patches/pandora/ads/DisableAudioAdsPatchKt {
384+
public static final fun getDisableAudioAdsPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
385+
}
386+
387+
public final class app/revanced/patches/pandora/misc/EnableUnlimitedSkipsPatchKt {
388+
public static final fun getEnableUnlimitedSkipsPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
389+
}
390+
383391
public final class app/revanced/patches/photomath/detection/deviceid/SpoofDeviceIdPatchKt {
384392
public static final fun getGetDeviceIdPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
385393
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package app.revanced.patches.pandora.ads
2+
3+
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
4+
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
5+
import app.revanced.patcher.patch.bytecodePatch
6+
import app.revanced.patches.pandora.shared.constructUserDataFingerprint
7+
import app.revanced.util.indexOfFirstInstructionOrThrow
8+
import com.android.tools.smali.dexlib2.Opcode
9+
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
10+
11+
@Suppress("unused")
12+
val disableAudioAdsPatch = bytecodePatch(
13+
name = "Disable audio ads",
14+
) {
15+
compatibleWith("com.pandora.android")
16+
17+
execute {
18+
constructUserDataFingerprint.method.apply {
19+
// First match is "hasAudioAds".
20+
val hasAudioAdsStringIndex = constructUserDataFingerprint.stringMatches!!.first().index
21+
val moveResultIndex = indexOfFirstInstructionOrThrow(hasAudioAdsStringIndex, Opcode.MOVE_RESULT)
22+
val hasAudioAdsRegister = getInstruction<OneRegisterInstruction>(moveResultIndex).registerA
23+
24+
addInstruction(
25+
moveResultIndex + 1,
26+
"const/4 v$hasAudioAdsRegister, 0"
27+
)
28+
}
29+
}
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package app.revanced.patches.pandora.misc
2+
3+
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
4+
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
5+
import app.revanced.patcher.patch.bytecodePatch
6+
import app.revanced.patches.pandora.shared.constructUserDataFingerprint
7+
import app.revanced.util.indexOfFirstInstructionOrThrow
8+
import com.android.tools.smali.dexlib2.Opcode
9+
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
10+
11+
@Suppress("unused")
12+
val enableUnlimitedSkipsPatch = bytecodePatch(
13+
name = "Enable unlimited skips",
14+
) {
15+
compatibleWith("com.pandora.android")
16+
17+
execute {
18+
constructUserDataFingerprint.method.apply {
19+
// Last match is "skipLimitBehavior".
20+
val skipLimitBehaviorStringIndex = constructUserDataFingerprint.stringMatches!!.last().index
21+
val moveResultObjectIndex =
22+
indexOfFirstInstructionOrThrow(skipLimitBehaviorStringIndex, Opcode.MOVE_RESULT_OBJECT)
23+
val skipLimitBehaviorRegister = getInstruction<OneRegisterInstruction>(moveResultObjectIndex).registerA
24+
25+
addInstruction(
26+
moveResultObjectIndex + 1,
27+
"const-string v$skipLimitBehaviorRegister, \"unlimited\""
28+
)
29+
}
30+
}
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package app.revanced.patches.pandora.shared
2+
3+
import app.revanced.patcher.fingerprint
4+
5+
internal val constructUserDataFingerprint = fingerprint {
6+
strings("hasAudioAds", "skipLimitBehavior")
7+
}

0 commit comments

Comments
 (0)