|
1 | 1 | package app.revanced.patches.komoot.premium |
2 | 2 |
|
3 | | -import app.revanced.patcher.extensions.InstructionExtensions.addInstructions |
| 3 | +import app.revanced.patcher.extensions.InstructionExtensions.addInstruction |
| 4 | +import app.revanced.patcher.extensions.InstructionExtensions.getInstruction |
4 | 5 | import app.revanced.patcher.patch.bytecodePatch |
| 6 | +import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod |
| 7 | +import app.revanced.util.addInstructionsAtControlFlowLabel |
| 8 | +import app.revanced.util.indexOfFirstInstructionReversed |
5 | 9 | import com.android.tools.smali.dexlib2.Opcode |
| 10 | +import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction |
6 | 11 |
|
7 | 12 | @Suppress("unused") |
8 | 13 | val unlockProPatch = bytecodePatch( |
9 | 14 | name = "Unlock Premium features", |
10 | 15 | description = "Unlock Premium features. Some features are not possible to patch (server sided), " + |
11 | 16 | "such as saving a multi-days hike." |
12 | 17 | ) { |
13 | | - compatibleWith("de.komoot.android"("2024.29.3")) |
| 18 | + compatibleWith("de.komoot.android"("2025.38.2")) |
14 | 19 |
|
15 | 20 | execute { |
16 | 21 | premiumConfigFingerprint.method.apply { |
17 | | - val index = implementation!!.instructions.indexOfLast{ |
18 | | - Opcode.MOVE_OBJECT_FROM16 == it.opcode |
19 | | - } |
20 | | - |
21 | | - addInstructions( |
22 | | - index, |
23 | | - """ |
24 | | - sget-object v1, Ljava/lang/Boolean;->TRUE:Ljava/lang/Boolean; |
25 | | - iput-object v1, v0, Lde/komoot/android/services/api/model/AppConfigV3;->v:Ljava/lang/Boolean; |
26 | | - """ |
| 22 | + addInstruction( |
| 23 | + 0, |
| 24 | + "sget-object p22, Ljava/lang/Boolean;->TRUE:Ljava/lang/Boolean;" |
27 | 25 | ) |
28 | 26 | } |
29 | 27 |
|
30 | | - displayPremiumFingerprint.method.apply { |
31 | | - val index = implementation!!.instructions.indexOfLast{ |
32 | | - Opcode.INVOKE_DIRECT_RANGE == it.opcode |
33 | | - } |
| 28 | + publicUserInitFingerprint.method.addInstruction( |
| 29 | + 0, |
| 30 | + "const/4 p5, 0x1" |
| 31 | + ) |
| 32 | + |
| 33 | + fun MutableMethod.grantRoutingPermission() { |
| 34 | + val index = indexOfFirstInstructionReversed(Opcode.IPUT_OBJECT) |
34 | 35 |
|
35 | | - addInstructions( |
| 36 | + val routingStatusRegister = getInstruction<TwoRegisterInstruction>(index).registerA |
| 37 | + |
| 38 | + addInstructionsAtControlFlowLabel( |
36 | 39 | index, |
37 | | - """ |
38 | | - const/4 v0, 0x1 |
39 | | - move v6, v0 |
40 | | - """ |
| 40 | + "sget-object v$routingStatusRegister, Lde/komoot/android/services/api/model/RoutingPermission\$StatusPermission;->GRANTED:Lde/komoot/android/services/api/model/RoutingPermission\$StatusPermission;", |
41 | 41 | ) |
42 | 42 | } |
43 | 43 |
|
44 | | - routingPermissionFingerprint.method.apply { |
45 | | - val index = implementation!!.instructions.indexOfLast{ |
46 | | - Opcode.MOVE_RESULT_OBJECT == it.opcode |
47 | | - } |
| 44 | + routingPermissionInitJsonFingerprint.method.grantRoutingPermission() |
48 | 45 |
|
49 | | - addInstructions( |
50 | | - index + 1, |
51 | | - "sget-object p1, Lde/komoot/android/services/api/model/RoutingPermission\$StatusPermission;->GRANTED:Lde/komoot/android/services/api/model/RoutingPermission\$StatusPermission;", |
52 | | - ) |
53 | | - } |
| 46 | + routingPermissionInitFingerprint.method.grantRoutingPermission() |
54 | 47 | } |
55 | 48 | } |
0 commit comments