1
1
package app.revanced.patches.reddit.customclients.syncforreddit.fix.video
2
2
3
- import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
4
- import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
5
3
import app.revanced.patcher.patch.bytecodePatch
6
- import app.revanced.patches.reddit.customclients.sync.syncforreddit.extension.sharedExtensionPatch
7
- import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
8
-
9
- private const val EXTENSION_CLASS_DESCRIPTOR =
10
- " Lapp/revanced/extension/syncforreddit/FixRedditVideoDownloadPatch;"
11
- private const val GET_LINKS_METHOD = " getLinks([B)[Ljava/lang/String;"
12
4
5
+ @Deprecated(
6
+ message = " Patch was move to a different package" ,
7
+ ReplaceWith (" app.revanced.patches.reddit.customclients.sync.syncforreddit.fix.video.fixVideoDownloadsPatch" )
8
+ )
13
9
@Suppress(" unused" )
14
- val fixVideoDownloadsPatch = bytecodePatch(
15
- name = " Fix video downloads" ,
16
- description = " Fixes a bug in Sync's MPD parser resulting in only the audio-track being saved." ,
17
- ) {
18
- dependsOn(sharedExtensionPatch)
10
+ val fixVideoDownloadsPatch = bytecodePatch {
11
+ dependsOn(app.revanced.patches.reddit.customclients.sync.syncforreddit.fix.video.fixVideoDownloadsPatch)
19
12
20
13
compatibleWith(
21
14
" com.laurencedawson.reddit_sync" ,
22
15
" com.laurencedawson.reddit_sync.pro" ,
23
16
" com.laurencedawson.reddit_sync.dev" ,
24
17
)
25
-
26
- execute {
27
- val scanResult = parseRedditVideoNetworkResponseFingerprint.patternMatch!!
28
- val newInstanceIndex = scanResult.startIndex
29
- val invokeDirectIndex = scanResult.endIndex - 1
30
-
31
- val buildResponseInstruction =
32
- parseRedditVideoNetworkResponseFingerprint.method.getInstruction<Instruction35c >(invokeDirectIndex)
33
-
34
- parseRedditVideoNetworkResponseFingerprint.method.addInstructions(
35
- newInstanceIndex + 1 ,
36
- """
37
- # Get byte array from response.
38
- iget-object v2, p1, Lcom/android/volley/NetworkResponse;->data:[B
39
-
40
- # Parse the videoUrl and audioUrl from the byte array.
41
- invoke-static { v2 }, $EXTENSION_CLASS_DESCRIPTOR ->$GET_LINKS_METHOD
42
- move-result-object v2
43
-
44
- # Get videoUrl (Index 0).
45
- const/4 v5, 0x0
46
- aget-object v${buildResponseInstruction.registerE} , v2, v5
47
-
48
- # Get audioUrl (Index 1).
49
- const/4 v6, 0x1
50
- aget-object v${buildResponseInstruction.registerF} , v2, v6
51
-
52
- # Register E and F are used to build the response.
53
- """ ,
54
- )
55
- }
56
- }
18
+ }
0 commit comments