-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEmoji_200_v1.pbp
100 lines (92 loc) · 2.14 KB
/
Emoji_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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
; This patch makes it possible to support
; Emoji characters in custom fonts.
; It remaps Emoji range (0x1F6xx) to Letter-like symbols (0x21xx).
;
; This version is buggy and doesn't work.
#ver 200
;!internal
; inject call to our code into
; text_resources_try_load_glyph_metadata proc
2D E9 F0 41 0D 0C 2D 04 04 46 0F 46 16 46
@ 00 2D 3E D1
{
; was:
; CMP R5,0
; BNE ret0
; At this point R1&R7 contain character code to load,
; and R5 is its hiword.
; R0,R3 - unused
; B.W my_code1
global continue1
; here R7 must have charcode
; and R5 must be 0
}
; also inject call into
; text_resources_try_load_glyph_bitmap proc
34 0c 24 04 @ 00 2c 41 d1 {
; was:
; CMP R4, 0
; BNE ret0
; At this point:
; R6 (and R1) is codep
; R4 is its hiword (should be 0 to continue)
; R0,R3 - unused
; B.W my_code2
global continue2
}
; and place our code instead of
; cmdAppList:
70 b5 a0 b0 01 24 02 ad 60 1e c0 b2 ? ? ? ?
80 b1 86 68 29 46 30 46 ? ? ? ? 30 46 ? ?
? ? 50 21 8d e8 21 00 08 4a 0c a8 23 46 ? ?
; cmdWindowDump:
;10 b5 ?4 04 46 58 b1 ?4 08 b1
;?4 20 46 ?4 bd e8 10 40 ?4 10 bd
{
proc my_code1
MOV R0, 1
; prepare registers...
MOV R3, R5 ; hiword
MOV R5, 0 ; for continuation: set R5 to 0, as it will be expected by original code
B.W begin
global my_code2
MOV R0, 2
; prepare...
MOV R3, R4 ; hiword
MOV R4, 0 ; for continuation
begin:
; here R3 is hiword,
; R1 is codep
CMP R3, 0 ; hiword is 0?
BEQ cont ;just continue - this is not our case (as we have valid lower character)
LDR R3, diff ; R3 is still unused in proc, so we can use it
SUB R1, R3 ; now R1 may be valid emoji
LDR R3, base
CMP R3, R1
BHI ret ; if base > char -> char was < than emoji range
ADD R3, 0x4F ; max emoji char
CMP R1, R3
BHI ret ; if > max emoji
cont:
CMP R0, 1
BNE cont2
MOV R7, R1 ; update R7 with new codepoint value, if changed
B.W continue1
cont2:
MOV R6, R1 ; update R6
B.W continue2
ret:
CMP R0, 1
BNE ret2
MOV R0, 0
db BD E8 F0 81 ; POP.W R4-R8,PC
ret2:
MOV R0, 0
db BD E8 FE 83 ; POP.W R1-R9,PC
; data block:
ALIGN 4
;diff: DCD 0x1d500 ; emoji_start - new_base
;base: DCD 0x2100
diff: DCD 0x1f5d8 ;0x1F600-0x28
base: DCD 0x28
}