mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-20 08:17:17 +02:00
refactor: Hide info panels
setting now removes information panels in Shorts player
This commit is contained in:
parent
245460d4d7
commit
59a4befe17
@ -5,10 +5,11 @@ import app.revanced.patcher.annotation.Version
|
|||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.instruction
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.shared.annotation.YouTubeCompatibility
|
import app.revanced.shared.annotation.YouTubeCompatibility
|
||||||
import app.revanced.shared.extensions.findMutableMethodOf
|
import app.revanced.shared.extensions.findMutableMethodOf
|
||||||
import app.revanced.shared.extensions.injectHideCall
|
import app.revanced.shared.extensions.injectHideCall
|
||||||
@ -28,7 +29,8 @@ class GeneralAdsSecondaryBytecodePatch : BytecodePatch() {
|
|||||||
"layout" to "horizontal_card_list",
|
"layout" to "horizontal_card_list",
|
||||||
"layout" to "album_card",
|
"layout" to "album_card",
|
||||||
"id" to "reel_player_badge",
|
"id" to "reel_player_badge",
|
||||||
"id" to "reel_player_badge2"
|
"id" to "reel_player_badge2",
|
||||||
|
"id" to "reel_player_info_panel"
|
||||||
).map { (type, name) ->
|
).map { (type, name) ->
|
||||||
ResourceMappingPatch
|
ResourceMappingPatch
|
||||||
.resourceMappings
|
.resourceMappings
|
||||||
@ -89,18 +91,25 @@ class GeneralAdsSecondaryBytecodePatch : BytecodePatch() {
|
|||||||
val dummyRegister = (instructions.elementAt(index) as Instruction31i).registerA
|
val dummyRegister = (instructions.elementAt(index) as Instruction31i).registerA
|
||||||
val viewRegister = (invokeInstruction as Instruction21c).registerA
|
val viewRegister = (invokeInstruction as Instruction21c).registerA
|
||||||
|
|
||||||
mutableMethod.addInstructions(
|
mutableMethod.addInjectCall(insertIndex, dummyRegister, viewRegister, "hidePaidContentBanner")
|
||||||
insertIndex + 1, """
|
|
||||||
invoke-static {}, $ADS_PATH/GeneralAdsPatch;->hidePaidContentBanner()Z
|
|
||||||
move-result v$dummyRegister
|
|
||||||
if-eqz v$dummyRegister, :shown
|
|
||||||
const v$viewRegister, 0x0
|
|
||||||
""", listOf(ExternalLabel("shown", mutableMethod.instruction(insertIndex + 1)))
|
|
||||||
)
|
|
||||||
|
|
||||||
patchSuccessArray[3] = true;
|
patchSuccessArray[3] = true;
|
||||||
patchSuccessArray[4] = true;
|
patchSuccessArray[4] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resourceIds[5] -> { // info panel
|
||||||
|
val insertIndex = index + 3
|
||||||
|
val invokeInstruction = instructions.elementAt(insertIndex)
|
||||||
|
if (invokeInstruction.opcode != Opcode.CHECK_CAST) return@forEachIndexed
|
||||||
|
|
||||||
|
val mutableMethod = context.proxy(classDef).mutableClass.findMutableMethodOf(method)
|
||||||
|
val dummyRegister = (instructions.elementAt(index) as Instruction31i).registerA
|
||||||
|
val viewRegister = (invokeInstruction as Instruction21c).registerA
|
||||||
|
|
||||||
|
mutableMethod.addInjectCall(insertIndex + 7, dummyRegister, viewRegister, "hideInfoPanel")
|
||||||
|
|
||||||
|
patchSuccessArray[5] = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> return@forEachIndexed
|
else -> return@forEachIndexed
|
||||||
@ -111,4 +120,20 @@ class GeneralAdsSecondaryBytecodePatch : BytecodePatch() {
|
|||||||
}
|
}
|
||||||
return toResult(patchSuccessArray.indexOf(false))
|
return toResult(patchSuccessArray.indexOf(false))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun MutableMethod.addInjectCall(
|
||||||
|
index: Int,
|
||||||
|
dummyRegister: Int,
|
||||||
|
viewRegister: Int,
|
||||||
|
method: String
|
||||||
|
) {
|
||||||
|
addInstructions(
|
||||||
|
index + 1, """
|
||||||
|
invoke-static {}, $ADS_PATH/GeneralAdsPatch;->$method()Z
|
||||||
|
move-result v$dummyRegister
|
||||||
|
if-eqz v$dummyRegister, :shown
|
||||||
|
const v$viewRegister, 0x0
|
||||||
|
""", listOf(ExternalLabel("shown", this.instruction(index + 1)))
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user