mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-12-11 20:03:55 +01:00
Compare commits
3 Commits
v2.157.0-d
...
v2.157.0-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06a981a317 | ||
|
|
dd3a9a4f38 | ||
|
|
5228700317 |
@@ -1,3 +1,10 @@
|
|||||||
|
# [2.157.0-dev.4](https://github.com/revanced/revanced-patches/compare/v2.157.0-dev.3...v2.157.0-dev.4) (2023-01-28)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **youtube/return-youtube-dislike:** do not fetch voting stats when watching shorts ([#1532](https://github.com/revanced/revanced-patches/issues/1532)) ([f46fcad](https://github.com/revanced/revanced-patches/commit/f46fcadd855a13d9f8916f21980abcf5564e97d7))
|
||||||
|
|
||||||
# [2.157.0-dev.3](https://github.com/revanced/revanced-patches/compare/v2.157.0-dev.2...v2.157.0-dev.3) (2023-01-28)
|
# [2.157.0-dev.3](https://github.com/revanced/revanced-patches/compare/v2.157.0-dev.2...v2.157.0-dev.3) (2023-01-28)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.157.0-dev.3
|
version = 2.157.0-dev.4
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -19,17 +19,28 @@ import app.revanced.patches.youtube.layout.returnyoutubedislike.annotations.Retu
|
|||||||
import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.*
|
import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.*
|
||||||
import app.revanced.patches.youtube.layout.returnyoutubedislike.resource.patch.ReturnYouTubeDislikeResourcePatch
|
import app.revanced.patches.youtube.layout.returnyoutubedislike.resource.patch.ReturnYouTubeDislikeResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
|
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
||||||
import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch
|
import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@DependsOn([IntegrationsPatch::class, VideoIdPatch::class, ReturnYouTubeDislikeResourcePatch::class])
|
@DependsOn(
|
||||||
|
[
|
||||||
|
IntegrationsPatch::class,
|
||||||
|
VideoIdPatch::class,
|
||||||
|
ReturnYouTubeDislikeResourcePatch::class,
|
||||||
|
PlayerTypeHookPatch::class,
|
||||||
|
]
|
||||||
|
)
|
||||||
@Name("return-youtube-dislike")
|
@Name("return-youtube-dislike")
|
||||||
@Description("Shows the dislike count of videos using the Return YouTube Dislike API.")
|
@Description("Shows the dislike count of videos using the Return YouTube Dislike API.")
|
||||||
@ReturnYouTubeDislikeCompatibility
|
@ReturnYouTubeDislikeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class ReturnYouTubeDislikePatch : BytecodePatch(
|
class ReturnYouTubeDislikePatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
TextComponentSpecParentFingerprint, LikeFingerprint, DislikeFingerprint, RemoveLikeFingerprint
|
TextComponentSpecParentFingerprint,
|
||||||
|
LikeFingerprint,
|
||||||
|
DislikeFingerprint,
|
||||||
|
RemoveLikeFingerprint,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints
|
|
||||||
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
|
||||||
import org.jf.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
object RectangleFieldInvalidatorFingerprint : MethodFingerprint(
|
|
||||||
"V",
|
|
||||||
customFingerprint = custom@{ methodDef ->
|
|
||||||
val instructions = methodDef.implementation?.instructions!!
|
|
||||||
val instructionCount = instructions.count()
|
|
||||||
|
|
||||||
// the method has definitely more than 5 instructions
|
|
||||||
if (instructionCount < 5) return@custom false
|
|
||||||
|
|
||||||
val referenceInstruction = instructions.elementAt(instructionCount - 2) // the second to last instruction
|
|
||||||
val reference = ((referenceInstruction as? ReferenceInstruction)?.reference as? MethodReference)
|
|
||||||
|
|
||||||
reference?.parameterTypes?.size == 1 && reference.name == "invalidate" // the reference is the invalidate(..) method
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import app.revanced.patches.youtube.layout.sponsorblock.resource.patch.SponsorBlockResourcePatch
|
|
||||||
import org.jf.dexlib2.AccessFlags
|
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
|
|
||||||
@FuzzyPatternScanMethod(3)
|
|
||||||
object ShortsPlayerConstructorFingerprint : MethodFingerprint(
|
|
||||||
"V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
|
||||||
opcodes = listOf(
|
|
||||||
Opcode.MOVE_OBJECT_FROM16,
|
|
||||||
Opcode.MOVE_OBJECT_FROM16,
|
|
||||||
Opcode.MOVE_OBJECT_FROM16,
|
|
||||||
Opcode.INVOKE_DIRECT_RANGE,
|
|
||||||
Opcode.NEW_INSTANCE,
|
|
||||||
Opcode.INVOKE_DIRECT,
|
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.NEW_INSTANCE,
|
|
||||||
Opcode.INVOKE_DIRECT,
|
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.NEW_INSTANCE,
|
|
||||||
Opcode.INVOKE_DIRECT,
|
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.NEW_INSTANCE,
|
|
||||||
Opcode.INVOKE_DIRECT,
|
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.CONST_4
|
|
||||||
),
|
|
||||||
customFingerprint = { methodDef ->
|
|
||||||
methodDef.implementation?.instructions?.any { instruction ->
|
|
||||||
instruction.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(instruction as? WideLiteralInstruction)?.wideLiteral == SponsorBlockResourcePatch.reelButtonGroupResourceId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@@ -7,11 +7,9 @@ import app.revanced.patcher.data.BytecodeContext
|
|||||||
import app.revanced.patcher.data.toMethodWalker
|
import app.revanced.patcher.data.toMethodWalker
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||||
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.patch.PatchResultError
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
@@ -25,20 +23,20 @@ import app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints.*
|
|||||||
import app.revanced.patches.youtube.layout.sponsorblock.resource.patch.SponsorBlockResourcePatch
|
import app.revanced.patches.youtube.layout.sponsorblock.resource.patch.SponsorBlockResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch
|
import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch
|
||||||
|
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
||||||
import app.revanced.patches.youtube.misc.video.information.patch.VideoInformationPatch
|
import app.revanced.patches.youtube.misc.video.information.patch.VideoInformationPatch
|
||||||
import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch
|
import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.iface.instruction.*
|
import org.jf.dexlib2.iface.instruction.*
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
||||||
import org.jf.dexlib2.iface.reference.FieldReference
|
|
||||||
import org.jf.dexlib2.iface.reference.MethodReference
|
import org.jf.dexlib2.iface.reference.MethodReference
|
||||||
import org.jf.dexlib2.iface.reference.StringReference
|
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@DependsOn(
|
@DependsOn(
|
||||||
dependencies = [
|
dependencies = [
|
||||||
VideoInformationPatch::class, // updates video information and adds method to seek in video
|
VideoInformationPatch::class, // updates video information and adds method to seek in video
|
||||||
PlayerControlsBytecodePatch::class,
|
PlayerControlsBytecodePatch::class,
|
||||||
|
PlayerTypeHookPatch::class,
|
||||||
IntegrationsPatch::class,
|
IntegrationsPatch::class,
|
||||||
SponsorBlockResourcePatch::class,
|
SponsorBlockResourcePatch::class,
|
||||||
VideoIdPatch::class
|
VideoIdPatch::class
|
||||||
@@ -54,7 +52,6 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
NextGenWatchLayoutFingerprint,
|
NextGenWatchLayoutFingerprint,
|
||||||
AppendTimeFingerprint,
|
AppendTimeFingerprint,
|
||||||
PlayerOverlaysLayoutInitFingerprint,
|
PlayerOverlaysLayoutInitFingerprint,
|
||||||
ShortsPlayerConstructorFingerprint,
|
|
||||||
StartVideoInformerFingerprint
|
StartVideoInformerFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
@@ -236,56 +233,6 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
"invoke-static {p0}, Lapp/revanced/integrations/sponsorblock/player/ui/SponsorBlockView;->initialize(Ljava/lang/Object;)V"
|
"invoke-static {p0}, Lapp/revanced/integrations/sponsorblock/player/ui/SponsorBlockView;->initialize(Ljava/lang/Object;)V"
|
||||||
)
|
)
|
||||||
|
|
||||||
// get rectangle field name
|
|
||||||
RectangleFieldInvalidatorFingerprint.resolve(context, seekbarSignatureResult.classDef)
|
|
||||||
val rectangleFieldInvalidatorInstructions =
|
|
||||||
RectangleFieldInvalidatorFingerprint.result!!.method.implementation!!.instructions
|
|
||||||
val rectangleFieldName =
|
|
||||||
((rectangleFieldInvalidatorInstructions.elementAt(rectangleFieldInvalidatorInstructions.count() - 3) as ReferenceInstruction).reference as FieldReference).name
|
|
||||||
|
|
||||||
// replace the "replaceMeWith*" strings
|
|
||||||
context
|
|
||||||
.proxy(context.classes.first { it.type.endsWith("PlayerController;") })
|
|
||||||
.mutableClass
|
|
||||||
.methods
|
|
||||||
.find { it.name == "setSponsorBarRect" }
|
|
||||||
?.let { method ->
|
|
||||||
fun MutableMethod.replaceStringInstruction(index: Int, instruction: Instruction, with: String) {
|
|
||||||
val register = (instruction as OneRegisterInstruction).registerA
|
|
||||||
this.replaceInstruction(
|
|
||||||
index, "const-string v$register, \"$with\""
|
|
||||||
)
|
|
||||||
}
|
|
||||||
for ((index, it) in method.implementation!!.instructions.withIndex()) {
|
|
||||||
if (it.opcode.ordinal != Opcode.CONST_STRING.ordinal) continue
|
|
||||||
|
|
||||||
when (((it as ReferenceInstruction).reference as StringReference).string) {
|
|
||||||
"replaceMeWithsetSponsorBarRect" ->
|
|
||||||
method.replaceStringInstruction(index, it, rectangleFieldName)
|
|
||||||
|
|
||||||
"replaceMeWithsetMillisecondMethod" ->
|
|
||||||
method.replaceStringInstruction(index, it, "seekHelper")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} ?: return PatchResultError("Could not find the method which contains the replaceMeWith* strings")
|
|
||||||
|
|
||||||
val startVideoInformerMethod = StartVideoInformerFingerprint.result!!.mutableMethod
|
|
||||||
startVideoInformerMethod.addInstructions(
|
|
||||||
0, """
|
|
||||||
const/4 v0, 0x0
|
|
||||||
sput-boolean v0, $INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR->shorts_playing:Z
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
val shortsPlayerConstructorMethod = ShortsPlayerConstructorFingerprint.result!!.mutableMethod
|
|
||||||
|
|
||||||
shortsPlayerConstructorMethod.addInstructions(
|
|
||||||
0, """
|
|
||||||
const/4 v0, 0x1
|
|
||||||
sput-boolean v0, $INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR->shorts_playing:Z
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
// TODO: isSBChannelWhitelisting implementation
|
// TODO: isSBChannelWhitelisting implementation
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
|
|||||||
@@ -23,9 +23,6 @@ import app.revanced.util.resources.ResourceUtils.mergeStrings
|
|||||||
@DependsOn([FixLocaleConfigErrorPatch::class, SettingsPatch::class, ResourceMappingPatch::class])
|
@DependsOn([FixLocaleConfigErrorPatch::class, SettingsPatch::class, ResourceMappingPatch::class])
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class SponsorBlockResourcePatch : ResourcePatch {
|
class SponsorBlockResourcePatch : ResourcePatch {
|
||||||
companion object {
|
|
||||||
internal var reelButtonGroupResourceId: Long = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
val youtubePackage = "com.google.android.youtube"
|
val youtubePackage = "com.google.android.youtube"
|
||||||
@@ -107,10 +104,6 @@ class SponsorBlockResourcePatch : ResourcePatch {
|
|||||||
}
|
}
|
||||||
}.close() // close afterwards
|
}.close() // close afterwards
|
||||||
|
|
||||||
reelButtonGroupResourceId = ResourceMappingPatch.resourceMappings.single {
|
|
||||||
it.type == "id" && it.name == "reel_persistent_edu_button_group"
|
|
||||||
}.id
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user