-
Notifications
You must be signed in to change notification settings - Fork 1
/
LaunchBank1_200_v1.pbp
54 lines (50 loc) · 1.42 KB
/
LaunchBank1_200_v1.pbp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
; This patch changes behaviour of the Back button
; in watchfaces:
; When you press it from any watchface,
; it will launch app installed in bank 0 (the first bank).
; You may choose which app is installed in bank0
; by uninstalling and reinstalling apps in desired order.
;
; This version works with 2.0.0, any HW version.
#ver 200
; just a simple mask to find named proc
08 4b 10 b5 04 46 18 68 08 e0 {
proc app_manager_get_bank_info
}
1f b5 04 46 20 b9 09 48 {
proc app_manager_launch
}
; This matches the end of watchface_button_handler proc.
; We replace its POP {R3-R5,LR} with jump.
;
; About mask: '?n' means "skip n bytes"
; (which may have different values in different builds).
; n defaults to 1 if omitted.
; '@' means position to which this mask will resolve
; (defaults to first byte).
; Here we want to match the end of proc
; and replace only its last instruction (with alignment NOP).
; Note that B.W takes 4 bytes, not 2.
00 2c 0c bf 05 20 06 20 BD E8 38 40 ?4 @ 38 BD 00 BF {
B.W my_code
}
; And this is a cmdAppRemove proc
; (from serial console, thus unused in normal scenario)
; which we replace with our continuation to previous proc.
08 B5 ?4 43 1c 0d d0 c0 b2 ?4
20 B1 00 21 ?4 03 48 00 e0 03 48 BD E8
08 40 ?4 08 BD ?8
{
proc my_code
CMP R3,5
BEQ ret
CMP R0,0
BNE ret
MOV R0,0 ; bank_id
BL app_manager_get_bank_info
CBZ R0, ret
LDR R0, [R0,0xC]
BL app_manager_launch
ret:
db 38 BD ; POP {R3-R5,PC}
}