diff --git a/patches/src/main/kotlin/app/revanced/patches/cricbuzz/ads/DisableAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/cricbuzz/ads/DisableAdsPatch.kt new file mode 100644 index 0000000000..4d6f49440f --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/cricbuzz/ads/DisableAdsPatch.kt @@ -0,0 +1,27 @@ +package app.revanced.patches.cricbuzz.ads + +import app.revanced.patcher.extensions.InstructionExtensions.addInstruction +import app.revanced.patcher.extensions.InstructionExtensions.getInstruction +import app.revanced.patcher.patch.bytecodePatch +import app.revanced.util.indexOfFirstInstructionOrThrow +import com.android.tools.smali.dexlib2.Opcode +import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction + +@Suppress("unused") +val disableAdsPatch = bytecodePatch ( + name = "Hide ads", +) { + compatibleWith("com.cricbuzz.android"("6.23.02")) + + execute { + userStateSwitchFingerprint.method.apply { + val opcodeIndex = indexOfFirstInstructionOrThrow(Opcode.MOVE_RESULT_OBJECT) + val register = getInstruction(opcodeIndex).registerA + + addInstruction( + opcodeIndex + 1, + "const-string v$register, \"ACTIVE\"" + ) + } + } +} diff --git a/patches/src/main/kotlin/app/revanced/patches/cricbuzz/ads/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/cricbuzz/ads/Fingerprints.kt new file mode 100644 index 0000000000..eabee77114 --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/cricbuzz/ads/Fingerprints.kt @@ -0,0 +1,9 @@ +package app.revanced.patches.cricbuzz.ads + +import app.revanced.patcher.fingerprint +import com.android.tools.smali.dexlib2.Opcode + +internal val userStateSwitchFingerprint = fingerprint { + strings("key.user.state", "NA") + opcodes(Opcode.SPARSE_SWITCH) +}