-
Notifications
You must be signed in to change notification settings - Fork 1
/
LaunchBank1_210_v1.pbp
49 lines (45 loc) · 1.19 KB
/
LaunchBank1_210_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
; 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 210
; 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 append our code
{
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:
POP {R3-R5,PC}
}