Skip to content

Commit 83ccfa8

Browse files
feat(Cricbuzz): Add Hide ads patch (#4998)
1 parent 8bed421 commit 83ccfa8

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package app.revanced.patches.cricbuzz.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.util.indexOfFirstInstructionOrThrow
7+
import com.android.tools.smali.dexlib2.Opcode
8+
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
9+
10+
@Suppress("unused")
11+
val disableAdsPatch = bytecodePatch (
12+
name = "Hide ads",
13+
) {
14+
compatibleWith("com.cricbuzz.android"("6.23.02"))
15+
16+
execute {
17+
userStateSwitchFingerprint.method.apply {
18+
val opcodeIndex = indexOfFirstInstructionOrThrow(Opcode.MOVE_RESULT_OBJECT)
19+
val register = getInstruction<OneRegisterInstruction>(opcodeIndex).registerA
20+
21+
addInstruction(
22+
opcodeIndex + 1,
23+
"const-string v$register, \"ACTIVE\""
24+
)
25+
}
26+
}
27+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package app.revanced.patches.cricbuzz.ads
2+
3+
import app.revanced.patcher.fingerprint
4+
import com.android.tools.smali.dexlib2.Opcode
5+
6+
internal val userStateSwitchFingerprint = fingerprint {
7+
strings("key.user.state", "NA")
8+
opcodes(Opcode.SPARSE_SWITCH)
9+
}

0 commit comments

Comments
 (0)