@@ -3,24 +3,38 @@ package app.revanced.patches.cricbuzz.ads
33import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
44import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
55import app.revanced.patcher.patch.bytecodePatch
6+ import app.revanced.patches.cricbuzz.misc.extension.sharedExtensionPatch
7+ import app.revanced.util.getReference
68import app.revanced.util.indexOfFirstInstructionOrThrow
9+ import app.revanced.util.returnEarly
710import com.android.tools.smali.dexlib2.Opcode
8- import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
11+ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
12+ import com.android.tools.smali.dexlib2.iface.reference.FieldReference
13+
14+ private const val EXTENSION_CLASS_DESCRIPTOR =
15+ " Lapp/revanced/extension/cricbuzz/ads/HideAdsPatch;"
916
1017@Suppress(" unused" )
1118val disableAdsPatch = bytecodePatch (
1219 name = " Hide ads" ,
1320) {
14- compatibleWith(" com.cricbuzz.android" (" 6.23.02" ))
21+ compatibleWith(" com.cricbuzz.android" (" 6.24.01" ))
22+
23+ dependsOn(sharedExtensionPatch)
1524
1625 execute {
17- userStateSwitchFingerprint.method.apply {
18- val opcodeIndex = indexOfFirstInstructionOrThrow(Opcode .MOVE_RESULT_OBJECT )
19- val register = getInstruction<OneRegisterInstruction >(opcodeIndex).registerA
26+ userStateSwitchFingerprint.method.returnEarly(true )
27+
28+ // Remove region-specific Cricbuzz11 elements.
29+ cb11ConstructorFingerprint.method.addInstruction(0 , " const/4 p7, 0x0" )
30+ getBottomBarFingerprint.method.apply {
31+ val getIndex = indexOfFirstInstructionOrThrow() {
32+ opcode == Opcode .IGET_OBJECT && getReference<FieldReference >()?.name == " bottomBar"
33+ }
34+ val getRegister = getInstruction<TwoRegisterInstruction >(getIndex).registerA
2035
21- addInstruction(
22- opcodeIndex + 1 ,
23- " const-string v$register , \" ACTIVE\" "
36+ addInstruction(getIndex + 1 ,
37+ " invoke-static { v$getRegister }, $EXTENSION_CLASS_DESCRIPTOR ->filterCb11(Ljava/util/List;)V"
2438 )
2539 }
2640 }
0 commit comments