@@ -31,40 +31,38 @@ val showSourceLabel =
3131 dependsOn(settingsPatch)
3232
3333 execute {
34- val method = sourceLabelFingerprint.method
34+ sourceLabelFingerprint.method. apply {
3535
36- val instructions = method.instructions
36+ val igetWide = instructions.first { it.opcode == Opcode .IGET_WIDE }
37+ val igetWideIns = igetWide as Instruction22c
38+ val idRef = igetWideIns.reference.extractDescriptors()[0 ]
39+ val idReg = igetWideIns.registerB
3740
38- val igetWide = instructions.first { it.opcode == Opcode . IGET_WIDE }
39- val igetWideIns = igetWide as Instruction22c
40- val idRef = igetWideIns.reference.extractDescriptors()[ 0 ]
41- val idReg = igetWideIns.registerB
41+ val igetWideIndex = igetWide.location.index
42+ val igetWideP1Ins = instructions[igetWideIndex + 1 ] as Instruction35c
43+ val dummyReg1 = igetWideP1Ins.registerC
44+ val dummyReg2 = igetWideP1Ins.registerD
4245
43- val igetWideIndex = igetWide.location.index
44- val igetWideP1Ins = instructions[igetWideIndex + 1 ] as Instruction35c
45- val dummyReg1 = igetWideP1Ins.registerC
46- val dummyReg2 = igetWideP1Ins.registerD
46+ val const4Ins = instructions[igetWideIndex - 1 ] as Instruction11n
47+ val const4Reg = const4Ins.registerA
4748
48- val const4 = instructions.filter { it.opcode == Opcode .CONST_4 }[1 ]
49- val const4Ins = const4 as Instruction11n
50- val const4Reg = const4Ins.registerA
49+ val apiMethod = " $PATCHES_DESCRIPTOR /tweet/TweetInfoAPI;"
50+ addInstructionsWithLabels(
51+ igetWideIndex,
52+ """
53+ sget-boolean v$dummyReg1 , $PREF_DESCRIPTOR ;->SHOW_SRC_LBL:Z
54+ if-eqz v$dummyReg1 , :piko
55+ invoke-virtual {v$idReg }, $idRef ->getId()J
56+ move-result-wide v$dummyReg1
57+
58+ invoke-static {v$dummyReg1 , v$dummyReg2 }, $apiMethod ->sendRequest(J)V
59+ invoke-static {v$dummyReg1 , v$dummyReg2 }, $apiMethod ->getTweetSource(J)Ljava/lang/String;
60+ move-result-object v$const4Reg
61+ """ .trimIndent(),
62+ ExternalLabel (" piko" , igetWide),
63+ )
5164
52- val apiMethod = " $PATCHES_DESCRIPTOR /tweet/TweetInfoAPI;"
53- method.addInstructionsWithLabels(
54- const4.location.index + 1 ,
55- """
56- sget-boolean v$dummyReg1 , $PREF_DESCRIPTOR ;->SHOW_SRC_LBL:Z
57- if-eqz v$dummyReg1 , :piko
58- invoke-virtual {v$idReg }, $idRef ->getId()J
59- move-result-wide v$dummyReg1
60-
61- invoke-static {v$dummyReg1 , v$dummyReg2 }, $apiMethod ->sendRequest(J)V
62- invoke-static {v$dummyReg1 , v$dummyReg2 }, $apiMethod ->getTweetSource(J)Ljava/lang/String;
63- move-result-object v$const4Reg
64- """ .trimIndent(),
65- ExternalLabel (" piko" , igetWide),
66- )
67-
68- settingsStatusLoadFingerprint.enableSettings(" showSourceLabel" )
65+ settingsStatusLoadFingerprint.enableSettings(" showSourceLabel" )
66+ }
6967 }
7068 }
0 commit comments