forked from Tasssadar/multirom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
multirom_ui.c
684 lines (550 loc) · 18.6 KB
/
multirom_ui.c
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
/*
* This file is part of MultiROM.
*
* MultiROM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MultiROM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MultiROM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <unistd.h>
#include <stdio.h>
#include <assert.h>
#include <pthread.h>
#include <dirent.h>
#include <errno.h>
#include <string.h>
#include "multirom_ui.h"
#include "framebuffer.h"
#include "input.h"
#include "log.h"
#include "listview.h"
#include "util.h"
#include "button.h"
#include "checkbox.h"
#include "version.h"
#include "pong.h"
#include "progressdots.h"
#include "multirom_ui_themes.h"
static struct multirom_status *mrom_status = NULL;
static struct multirom_rom *selected_rom = NULL;
static volatile int exit_ui_code = -1;
static fb_msgbox *active_msgbox = NULL;
static volatile int loop_act = 0;
static multirom_themes_info *themes_info = NULL;
static multirom_theme *cur_theme = NULL;
static pthread_mutex_t exit_code_mutex = PTHREAD_MUTEX_INITIALIZER;
uint32_t CLR_PRIMARY = LBLUE;
uint32_t CLR_SECONDARY = LBLUE2;
#define LOOP_UPDATE_USB 0x01
#define LOOP_START_PONG 0x02
#define LOOP_CHANGE_CLR 0x04
static void list_block(char *path, int rec)
{
ERROR("Listing %s", path);
DIR *d = opendir(path);
if(!d)
{
ERROR("Failed to open %s", path);
return;
}
struct dirent *dr;
struct stat info;
while((dr = readdir(d)))
{
if(dr->d_name[0] == '.')
continue;
ERROR("%s/%s (%d)", path, dr->d_name, dr->d_type);
if(dr->d_type == 4 && rec)
{
char name[256];
sprintf(name, "%s/%s", path, dr->d_name);
list_block(name, 1);
}
}
closedir(d);
}
int multirom_ui(struct multirom_status *s, struct multirom_rom **to_boot)
{
if(multirom_init_fb(s->rotation) < 0)
return UI_EXIT_BOOT_ROM;
fb_freeze(1);
mrom_status = s;
exit_ui_code = -1;
selected_rom = NULL;
active_msgbox = NULL;
multirom_ui_setup_colors(s->colors, &CLR_PRIMARY, &CLR_SECONDARY);
themes_info = multirom_ui_init_themes();
if((cur_theme = multirom_ui_select_theme(themes_info, fb_width, fb_height)) == NULL)
{
fb_freeze(0);
ERROR("Couldn't find theme for resolution %dx%d!\n", fb_width, fb_height);
fb_add_text(0, 0, WHITE, SIZE_SMALL, "Couldn't find theme for resolution %dx%d!\nPress POWER to reboot.", fb_width, fb_height);
fb_draw();
fb_clear();
fb_close();
start_input_thread();
while(wait_for_key() != KEY_POWER);
stop_input_thread();
return UI_EXIT_REBOOT;
}
multirom_ui_init_header();
multirom_ui_switch(TAB_INTERNAL);
add_touch_handler(&multirom_ui_touch_handler, NULL);
start_input_thread();
multirom_set_brightness(s->brightness);
fb_freeze(0);
if(s->auto_boot_rom && s->auto_boot_seconds > 0)
multirom_ui_auto_boot();
else
fb_draw();
while(1)
{
pthread_mutex_lock(&exit_code_mutex);
if(exit_ui_code != -1)
{
pthread_mutex_unlock(&exit_code_mutex);
break;
}
if(loop_act & LOOP_UPDATE_USB)
{
multirom_find_usb_roms(mrom_status);
if(themes_info->data->selected_tab == TAB_USB)
multirom_ui_tab_rom_update_usb(themes_info->data->tab_data);
loop_act &= ~(LOOP_UPDATE_USB);
}
if(loop_act & LOOP_START_PONG)
{
loop_act &= ~(LOOP_START_PONG);
input_push_context();
fb_push_context();
pong();
fb_pop_context();
input_pop_context();
}
if(loop_act & LOOP_CHANGE_CLR)
{
fb_freeze(1);
multirom_ui_setup_colors(s->colors, &CLR_PRIMARY, &CLR_SECONDARY);
// force redraw tab
int tab = themes_info->data->selected_tab;
themes_info->data->selected_tab = -1;
multirom_ui_destroy_tab(tab);
multirom_ui_switch(tab);
fb_freeze(0);
fb_draw();
loop_act &= ~(LOOP_CHANGE_CLR);
}
pthread_mutex_unlock(&exit_code_mutex);
usleep(100000);
}
rm_touch_handler(&multirom_ui_touch_handler, NULL);
fb_create_msgbox(500*DPI_MUL, 250*DPI_MUL, CLR_PRIMARY);
switch(exit_ui_code)
{
case UI_EXIT_BOOT_ROM:
*to_boot = selected_rom;
fb_msgbox_add_text(-1, 40*DPI_MUL, SIZE_BIG, "Booting ROM...");
fb_msgbox_add_text(-1, -1, SIZE_NORMAL, selected_rom->name);
break;
case UI_EXIT_REBOOT:
case UI_EXIT_REBOOT_RECOVERY:
case UI_EXIT_REBOOT_BOOTLOADER:
fb_msgbox_add_text(-1, -1, SIZE_BIG, "Rebooting...");
break;
case UI_EXIT_SHUTDOWN:
fb_msgbox_add_text(-1, -1, SIZE_BIG, "Shutting down...");
break;
}
fb_draw();
fb_freeze(1);
cur_theme->destroy(themes_info->data);
int i;
for(i = 0; i < TAB_COUNT; ++i)
{
button_destroy(themes_info->data->tab_btns[i]);
themes_info->data->tab_btns[i] = NULL;
}
stop_input_thread();
multirom_ui_destroy_tab(themes_info->data->selected_tab);
multirom_ui_free_themes(themes_info);
themes_info = NULL;
fb_clear();
fb_close();
return exit_ui_code;
}
void multirom_ui_setup_colors(int clr, uint32_t *primary, uint32_t *secondary)
{
static const int clrs[][2] = {
// Primary, Secondary - OxAAGGBBRR
{ LBLUE, LBLUE2 }, // CLRS_BLUE
{ 0xFFCC66AA, 0xFFCC89B6 }, // CLRS_PURPLE
{ 0xFF00BD8A, 0xFF51F2C9 }, // CLRS_GREEN
{ 0xFF008AFF, 0xFF51AEFF }, // CLRS_ORANGE
{ 0xFF0000CC, 0xFF6363FF }, // CLRS_RED
{ 0xFF2F5EB8, 0xFF689CFF }, // CLRS_BROWN
};
if(clr < 0 || clr >= (int)ARRAY_SIZE(clrs))
clr = 0;
*primary = clrs[clr][0];
*secondary = clrs[clr][1];
}
void multirom_ui_init_header(void)
{
cur_theme->init_header(themes_info->data);
}
void multirom_ui_header_select(int tab)
{
cur_theme->header_select(themes_info->data, tab);
}
void multirom_ui_destroy_tab(int tab)
{
switch(tab)
{
case -1:
break;
case TAB_USB:
case TAB_INTERNAL:
multirom_ui_tab_rom_destroy(themes_info->data->tab_data);
break;
case TAB_MISC:
multirom_ui_tab_misc_destroy(themes_info->data->tab_data);
break;
default:
assert(0);
break;
}
themes_info->data->tab_data = NULL;
}
void multirom_ui_switch(int tab)
{
if(tab == themes_info->data->selected_tab)
return;
fb_freeze(1);
multirom_ui_header_select(tab);
// destroy old tab
multirom_ui_destroy_tab(themes_info->data->selected_tab);
// init new tab
switch(tab)
{
case TAB_USB:
case TAB_INTERNAL:
themes_info->data->tab_data = multirom_ui_tab_rom_init(tab);
break;
case TAB_MISC:
themes_info->data->tab_data = multirom_ui_tab_misc_init();
break;
}
themes_info->data->selected_tab = tab;
fb_freeze(0);
fb_draw();
}
void multirom_ui_fill_rom_list(listview *view, int mask)
{
int i;
struct multirom_rom *rom;
void *data;
listview_item *it;
char part_desc[64];
for(i = 0; mrom_status->roms && mrom_status->roms[i]; ++i)
{
rom = mrom_status->roms[i];
if(!(M(rom->type) & mask))
continue;
if(rom->partition)
sprintf(part_desc, "%s (%s)", rom->partition->name, rom->partition->fs);
if(rom->type == ROM_DEFAULT && mrom_status->hide_internal)
continue;
data = rom_item_create(rom->name, rom->partition ? part_desc : NULL);
it = listview_add_item(view, rom->id, data);
if ((mrom_status->auto_boot_rom && rom == mrom_status->auto_boot_rom) ||
(!mrom_status->auto_boot_rom && rom == mrom_status->current_rom))
{
listview_select_item(view, it);
}
}
if(view->items != NULL && view->selected == NULL)
listview_select_item(view, view->items[0]);
}
int multirom_ui_touch_handler(touch_event *ev, void *data)
{
static int touch_count = 0;
if(ev->changed & TCHNG_ADDED)
{
if(++touch_count == 4)
{
multirom_take_screenshot();
touch_count = 0;
}
if(active_msgbox)
{
pthread_mutex_lock(&exit_code_mutex);
fb_destroy_msgbox();
fb_freeze(0);
fb_draw();
active_msgbox = NULL;
set_touch_handlers_mode(HANDLERS_FIRST);
pthread_mutex_unlock(&exit_code_mutex);
}
}
if((ev->changed & TCHNG_REMOVED) && touch_count > 0)
--touch_count;
return -1;
}
void multirom_ui_auto_boot(void)
{
int seconds = mrom_status->auto_boot_seconds*1000;
active_msgbox = fb_create_msgbox(500*DPI_MUL, 300*DPI_MUL, CLR_PRIMARY);
fb_msgbox_add_text(-1, 40*DPI_MUL, SIZE_BIG, "Auto-boot");
fb_msgbox_add_text(-1, active_msgbox->h-100*DPI_MUL, SIZE_NORMAL, "ROM: %s", mrom_status->auto_boot_rom->name);
fb_msgbox_add_text(-1, active_msgbox->h-60*DPI_MUL, SIZE_NORMAL, "Touch anywhere to cancel");
fb_text *sec_text = fb_msgbox_add_text(-1, -1, SIZE_BIG, "%d", seconds/1000);
fb_draw();
fb_freeze(1);
set_touch_handlers_mode(HANDLERS_ALL);
while(1)
{
pthread_mutex_lock(&exit_code_mutex);
if(!active_msgbox)
{
pthread_mutex_unlock(&exit_code_mutex);
break;
}
pthread_mutex_unlock(&exit_code_mutex);
seconds -= 50;
if(seconds <= 0)
{
pthread_mutex_lock(&exit_code_mutex);
selected_rom = mrom_status->auto_boot_rom;
active_msgbox = NULL;
exit_ui_code = UI_EXIT_BOOT_ROM;
pthread_mutex_unlock(&exit_code_mutex);
fb_destroy_msgbox();
fb_freeze(0);
break;
}
else if((seconds+50)/1000 != seconds/1000)
{
sprintf(sec_text->text, "%d", seconds/1000);
fb_freeze(0);
fb_draw();
fb_freeze(1);
}
usleep(50000);
}
set_touch_handlers_mode(HANDLERS_FIRST);
}
void multirom_ui_refresh_usb_handler(void)
{
pthread_mutex_lock(&exit_code_mutex);
loop_act |= LOOP_UPDATE_USB;
pthread_mutex_unlock(&exit_code_mutex);
}
void multirom_ui_start_pong(int action)
{
pthread_mutex_lock(&exit_code_mutex);
loop_act |= LOOP_START_PONG;
pthread_mutex_unlock(&exit_code_mutex);
}
void *multirom_ui_tab_rom_init(int tab_type)
{
tab_data_roms *t = mzalloc(sizeof(tab_data_roms));
themes_info->data->tab_data = t;
t->list = mzalloc(sizeof(listview));
t->list->item_draw = &rom_item_draw;
t->list->item_hide = &rom_item_hide;
t->list->item_height = &rom_item_height;
t->list->item_destroy = &rom_item_destroy;
t->list->item_selected = &multirom_ui_tab_rom_selected;
t->boot_btn = mzalloc(sizeof(button));
list_add(t->boot_btn, &t->buttons);
cur_theme->tab_rom_init(themes_info->data, t, tab_type);
listview_init_ui(t->list);
if(tab_type == TAB_INTERNAL)
multirom_ui_fill_rom_list(t->list, MASK_INTERNAL);
listview_update_ui(t->list);
int has_roms = (int)(t->list->items == NULL);
multirom_ui_tab_rom_set_empty((void*)t, has_roms);
t->boot_btn->clicked = &multirom_ui_tab_rom_boot_btn;
button_init_ui(t->boot_btn, "Boot", SIZE_BIG);
button_enable(t->boot_btn, !has_roms);
if(tab_type == TAB_USB)
{
multirom_set_usb_refresh_handler(&multirom_ui_refresh_usb_handler);
multirom_set_usb_refresh_thread(mrom_status, 1);
}
return t;
}
void multirom_ui_tab_rom_destroy(void *data)
{
multirom_set_usb_refresh_thread(mrom_status, 0);
tab_data_roms *t = (tab_data_roms*)data;
list_clear(&t->buttons, &button_destroy);
list_clear(&t->ui_elements, &fb_remove_item);
listview_destroy(t->list);
fb_rm_text(t->rom_name);
if(t->usb_prog)
progdots_destroy(t->usb_prog);
free(t);
}
void multirom_ui_tab_rom_selected(listview_item *prev, listview_item *now)
{
struct multirom_rom *rom = multirom_get_rom_by_id(mrom_status, now->id);
if(!rom || !themes_info->data->tab_data)
return;
tab_data_roms *t = (tab_data_roms*)themes_info->data->tab_data;
free(t->rom_name->text);
t->rom_name->text = malloc(strlen(rom->name)+1);
strcpy(t->rom_name->text, rom->name);
cur_theme->center_rom_name(t, rom->name);
fb_draw();
}
void multirom_ui_tab_rom_boot_btn(int action)
{
if(!themes_info->data->tab_data)
return;
tab_data_roms *t = (tab_data_roms*)themes_info->data->tab_data;
if(!t->list->selected)
return;
struct multirom_rom *rom = multirom_get_rom_by_id(mrom_status, t->list->selected->id);
if(!rom)
return;
int m = M(rom->type);
if(m & MASK_UNSUPPORTED)
{
active_msgbox = fb_create_msgbox(550*DPI_MUL, 360*DPI_MUL, DRED);
fb_msgbox_add_text(-1, 30*DPI_MUL, SIZE_BIG, "Error");
fb_msgbox_add_text(-1, 90*DPI_MUL, SIZE_NORMAL, "Unsupported ROM type.");
fb_msgbox_add_text(-1, 180*DPI_MUL, SIZE_NORMAL, "See XDA thread for more info.");
fb_msgbox_add_text(-1, active_msgbox->h-60*DPI_MUL, SIZE_NORMAL, "Touch anywhere to close");
fb_draw();
fb_freeze(1);
set_touch_handlers_mode(HANDLERS_ALL);
return;
}
if (((m & MASK_KEXEC) || ((m & MASK_ANDROID) && rom->has_bootimg)) &&
multirom_has_kexec() != 0)
{
active_msgbox = fb_create_msgbox(550*DPI_MUL, 360*DPI_MUL, DRED);
fb_msgbox_add_text(-1, 30*DPI_MUL, SIZE_BIG, "Error");
fb_msgbox_add_text(-1, 90*DPI_MUL, SIZE_NORMAL, "Kexec-hardboot support");
fb_msgbox_add_text(-1, 125*DPI_MUL, SIZE_NORMAL, "required to boot this ROM.");
fb_msgbox_add_text(-1, 180*DPI_MUL, SIZE_NORMAL, "Use kernel with");
fb_msgbox_add_text(-1, 215*DPI_MUL, SIZE_NORMAL, "kexec-hardboot support.");
fb_msgbox_add_text(-1, active_msgbox->h-60*DPI_MUL, SIZE_NORMAL, "Touch anywhere to close");
fb_draw();
fb_freeze(1);
set_touch_handlers_mode(HANDLERS_ALL);
return;
}
if((m & MASK_KEXEC) && strchr(rom->name, ' '))
{
active_msgbox = fb_create_msgbox(550*DPI_MUL, 360*DPI_MUL, DRED);
fb_msgbox_add_text(-1, 30*DPI_MUL, SIZE_BIG, "Error");
fb_msgbox_add_text(-1, 90*DPI_MUL, SIZE_NORMAL, "ROM's name contains spaces");
fb_msgbox_add_text(-1, 180*DPI_MUL, SIZE_NORMAL, "Remove spaces from ROM's name");
fb_msgbox_add_text(-1, active_msgbox->h-60*DPI_MUL, SIZE_NORMAL, "Touch anywhere to close");
fb_draw();
fb_freeze(1);
set_touch_handlers_mode(HANDLERS_ALL);
return;
}
pthread_mutex_lock(&exit_code_mutex);
selected_rom = rom;
exit_ui_code = UI_EXIT_BOOT_ROM;
pthread_mutex_unlock(&exit_code_mutex);
}
void multirom_ui_tab_rom_update_usb(void *data)
{
tab_data_roms *t = (tab_data_roms*)themes_info->data->tab_data;
listview_clear(t->list);
t->rom_name->text = realloc(t->rom_name->text, 1);
t->rom_name->text[0] = 0;
multirom_ui_fill_rom_list(t->list, MASK_USB_ROMS);
listview_update_ui(t->list);
multirom_ui_tab_rom_set_empty(data, (int)(t->list->items == NULL));
fb_draw();
}
void multirom_ui_tab_rom_refresh_usb(int action)
{
multirom_update_partitions(mrom_status);
}
void multirom_ui_tab_rom_set_empty(void *data, int empty)
{
assert(empty == 0 || empty == 1);
tab_data_roms *t = (tab_data_roms*)data;
int width = cur_theme->get_tab_width(themes_info->data);
static const char *str[] = { "Select ROM to boot:", "No ROMs in this location!" };
t->title_text->head.x = center_x(t->list->x, width, SIZE_BIG, str[empty]);
t->title_text->text = realloc(t->title_text->text, strlen(str[empty])+1);
strcpy(t->title_text->text, str[empty]);
if(t->boot_btn)
button_enable(t->boot_btn, !empty);
if(empty && !t->usb_text)
{
const int line_len = 37;
static const char *txt = "This list is refreshed automagically,\njust plug in the USB drive and wait.";
int x = t->list->x + (width/2 - (line_len*ISO_CHAR_WIDTH*SIZE_NORMAL)/2);
int y = center_y(t->list->y, t->list->h, SIZE_NORMAL);
t->usb_text = fb_add_text(x, y, WHITE, SIZE_NORMAL, txt);
list_add(t->usb_text, &t->ui_elements);
x = t->list->x + ((width/2) - (PROGDOTS_W/2));
t->usb_prog = progdots_create(x, y+100*DPI_MUL);
}
else if(!empty && t->usb_text)
{
progdots_destroy(t->usb_prog);
t->usb_prog = NULL;
list_rm(t->usb_text, &t->ui_elements, &fb_remove_item);
t->usb_text = NULL;
}
}
void *multirom_ui_tab_misc_init(void)
{
tab_data_misc *t = mzalloc(sizeof(tab_data_misc));
cur_theme->tab_misc_init(themes_info->data, t, mrom_status->colors);
return t;
}
void multirom_ui_tab_misc_destroy(void *data)
{
tab_data_misc *t = (tab_data_misc*)data;
list_clear(&t->ui_elements, &fb_remove_item);
list_clear(&t->buttons, &button_destroy);
free(t);
}
void multirom_ui_tab_misc_change_clr(int clr)
{
if((loop_act & LOOP_CHANGE_CLR) || mrom_status->colors == clr)
return;
pthread_mutex_lock(&exit_code_mutex);
mrom_status->colors = clr;
loop_act |= LOOP_CHANGE_CLR;
pthread_mutex_unlock(&exit_code_mutex);
}
void multirom_ui_reboot_btn(int action)
{
pthread_mutex_lock(&exit_code_mutex);
exit_ui_code = action;
pthread_mutex_unlock(&exit_code_mutex);
}
void multirom_ui_tab_misc_copy_log(int action)
{
multirom_dump_status(mrom_status);
int res = multirom_copy_log(NULL);
static const char *text[] = { "Failed to copy log to sdcard!", "Successfully copied error log!" };
active_msgbox = fb_create_msgbox(550*DPI_MUL, 260*DPI_MUL, res ? DRED : CLR_PRIMARY);
fb_msgbox_add_text(-1, 50*DPI_MUL, SIZE_NORMAL, (char*)text[res+1]);
if(res == 0)
fb_msgbox_add_text(-1, -1, SIZE_NORMAL, "/sdcard/multirom/error.txt");
fb_msgbox_add_text(-1, active_msgbox->h-60*DPI_MUL, SIZE_NORMAL, "Touch anywhere to close");
fb_draw();
fb_freeze(1);
set_touch_handlers_mode(HANDLERS_ALL);
}