@@ -13,7 +13,6 @@ import app.revanced.patcher.util.smali.ExternalLabel
13
13
import app.revanced.patches.shared.litho.LithoFilterPatch
14
14
import app.revanced.patches.youtube.shorts.components.fingerprints.ShortsButtonFingerprint
15
15
import app.revanced.patches.youtube.shorts.components.fingerprints.ShortsPaidPromotionFingerprint
16
- import app.revanced.patches.youtube.shorts.components.fingerprints.ShortsPivotFingerprint
17
16
import app.revanced.patches.youtube.shorts.components.fingerprints.ShortsPivotLegacyFingerprint
18
17
import app.revanced.patches.youtube.shorts.components.fingerprints.ShortsSubscriptionsTabletFingerprint
19
18
import app.revanced.patches.youtube.shorts.components.fingerprints.ShortsSubscriptionsTabletParentFingerprint
@@ -27,25 +26,26 @@ import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
27
26
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelDynRemix
28
27
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelDynShare
29
28
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelForcedMuteButton
30
- import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelPivotButton
31
29
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelPlayerFooter
30
+ import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelPlayerRightPivotV2Size
32
31
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelRightDislikeIcon
33
32
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelRightLikeIcon
34
33
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.RightComment
35
34
import app.revanced.patches.youtube.utils.settings.SettingsPatch
36
35
import app.revanced.patches.youtube.video.information.VideoInformationPatch
36
+ import app.revanced.util.REGISTER_TEMPLATE_REPLACEMENT
37
37
import app.revanced.util.getTargetIndexOrThrow
38
38
import app.revanced.util.getTargetIndexReversedOrThrow
39
39
import app.revanced.util.getTargetIndexWithReferenceOrThrow
40
40
import app.revanced.util.getWideLiteralInstructionIndex
41
+ import app.revanced.util.literalInstructionHook
41
42
import app.revanced.util.patch.BaseBytecodePatch
42
43
import app.revanced.util.resultOrThrow
43
44
import com.android.tools.smali.dexlib2.Opcode
44
45
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
45
46
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
46
47
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
47
48
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
48
- import com.android.tools.smali.dexlib2.iface.instruction.WideLiteralInstruction
49
49
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
50
50
51
51
@Suppress(" unused" )
@@ -65,7 +65,6 @@ object ShortsComponentPatch : BaseBytecodePatch(
65
65
fingerprints = setOf(
66
66
ShortsButtonFingerprint ,
67
67
ShortsPaidPromotionFingerprint ,
68
- ShortsPivotFingerprint ,
69
68
ShortsPivotLegacyFingerprint ,
70
69
ShortsSubscriptionsTabletParentFingerprint ,
71
70
TextComponentSpecFingerprint
@@ -134,8 +133,11 @@ object ShortsComponentPatch : BaseBytecodePatch(
134
133
135
134
// region patch for hide sound button
136
135
137
- ShortsPivotLegacyFingerprint .result?.let {
138
- it.mutableMethod.apply {
136
+ val shortsPivotLegacyFingerprintResult = ShortsPivotLegacyFingerprint .result
137
+
138
+ if (shortsPivotLegacyFingerprintResult != null ) {
139
+ // Legacy method.
140
+ shortsPivotLegacyFingerprintResult.mutableMethod.apply {
139
141
val targetIndex = getWideLiteralInstructionIndex(ReelForcedMuteButton )
140
142
val targetRegister = getInstruction<OneRegisterInstruction >(targetIndex).registerA
141
143
@@ -150,23 +152,19 @@ object ShortsComponentPatch : BaseBytecodePatch(
150
152
""" , ExternalLabel (" hide" , getInstruction(jumpIndex))
151
153
)
152
154
}
153
- } ? : ShortsPivotFingerprint .resultOrThrow().let {
154
- it.mutableMethod.apply {
155
- val constCalls = implementation!! .instructions.withIndex()
156
- .filter { instruction ->
157
- (instruction.value as ? WideLiteralInstruction )?.wideLiteral == ReelPivotButton
158
- }
159
- val targetIndex = constCalls.elementAt(constCalls.size - 1 ).index
160
- val insertIndex =
161
- getTargetIndexReversedOrThrow(targetIndex, Opcode .INVOKE_STATIC ) + 1
162
- if (insertIndex == 0 )
163
- throw PatchException (" insert index not found" )
155
+ } else if (ReelPlayerRightPivotV2Size != - 1L ) {
156
+ // Invoke Sound button dimen into integrations.
157
+ val smaliInstruction = """
158
+ invoke-static {v$REGISTER_TEMPLATE_REPLACEMENT }, $SHORTS_CLASS_DESCRIPTOR ->getShortsSoundButtonDimenId(I)I
159
+ move-result v$REGISTER_TEMPLATE_REPLACEMENT
160
+ """
164
161
165
- hideButtons(
166
- insertIndex,
167
- " hideShortsSoundButton(Ljava/lang/Object;)Ljava/lang/Object;"
168
- )
169
- }
162
+ context.literalInstructionHook(
163
+ ReelPlayerRightPivotV2Size ,
164
+ smaliInstruction
165
+ )
166
+ } else {
167
+ throw PatchException (" ReelPlayerRightPivotV2Size is not found" )
170
168
}
171
169
172
170
// endregion
0 commit comments