void bootmgr_setup_touch()
{
    if(!settings.touch_ui)
        return;

    bootmgr_set_touches_count(0);
    switch(bootmgr_phase)
    {
        case BOOTMGR_MAIN:
            bootmgr_add_touch(40,  125, 160, 245, bootmgr_touch_int,    1);
            bootmgr_add_touch(160, 125, 280, 245, bootmgr_touch_sd,     2);
            bootmgr_add_touch(40,  245, 160, 365, bootmgr_touch_ums,    3);
            bootmgr_add_touch(160, 245, 280, 365, bootmgr_touch_tetris, 4);
            break;
        case BOOTMGR_UMS:
            bootmgr_add_touch(80, 370, 240, 410, bootmgr_touch_exit_ums, 1);
            bootmgr_print_fill(80, 370, 160, 40, WHITE, 24);
            bootmgr_printf(-1, 24, BLACK, "Exit");
            break;
        case BOOTMGR_SD_SEL:
        {
            bootmgr_add_touch(0,   430, 78,  480, bootmgr_touch_sd_up,     1);
            bootmgr_add_touch(80,  430, 158, 480, bootmgr_touch_sd_down,   2);
            bootmgr_add_touch(160, 430, 238, 480, bootmgr_touch_sd_select, 3);
            bootmgr_add_touch(240, 430, 320, 480, bootmgr_touch_sd_exit,   4);
            bootmgr_printf(31, 28, BLACK, "Up       Down     Select     Exit");
            bootmgr_print_fill(0,   430, 78, 49, WHITE, 28);
            bootmgr_print_fill(80,  430, 78, 49, WHITE, 29);
            bootmgr_print_fill(160, 430, 78, 49, WHITE, 30);
            bootmgr_print_fill(240, 430, 78, 49, WHITE, 31);
            break;
        }
    }
}
void bootmgr_setup_touch(void)
{
    if(!settings.touch_ui)
        return;

    bootmgr_set_touches_count(0);
    switch(bootmgr_phase)
    {
        case BOOTMGR_MAIN:
            bootmgr_add_touch(40,  125, 160, 245, bootmgr_touch_int,    1);
            bootmgr_add_touch(160, 125, 280, 245, bootmgr_touch_sd,     2);
            bootmgr_add_touch(40,  245, 160, 365, bootmgr_touch_ums,    3);
            bootmgr_add_touch(160, 245, 280, 365, bootmgr_touch_misc,   4);
            break;
        case BOOTMGR_UMS:
            bootmgr_add_touch(80, 370, 240, 410, bootmgr_touch_exit_ums, 1);
            bootmgr_print_fill(80, 370, 160, 40, WHITE, 24);
            bootmgr_printf(-1, 24, BLACK, "Exit");
            break;
        case BOOTMGR_SD_SEL:
        {
            bootmgr_add_touch(0,   430, 78,  480, bootmgr_touch_sd_up,     1);
            bootmgr_add_touch(80,  430, 158, 480, bootmgr_touch_sd_down,   2);
            bootmgr_add_touch(160, 430, 238, 480, bootmgr_touch_sd_select, 3);
            bootmgr_add_touch(240, 430, 320, 480, bootmgr_touch_sd_exit,   4);
            bootmgr_printf(31, 28, BLACK, "Up       Down     Select     Exit");
            bootmgr_print_fill(0,   430, 78, 49, WHITE, 28);
            bootmgr_print_fill(80,  430, 78, 49, WHITE, 29);
            bootmgr_print_fill(160, 430, 78, 49, WHITE, 30);
            bootmgr_print_fill(240, 430, 78, 49, WHITE, 31);
            break;
        }
        case BOOTMGR_CHARGER:
        {
            bootmgr_add_touch(80, 370, 240, 410, bootmgr_touch_exit_charger, 1);
            bootmgr_print_fill(80, 370, 160, 40, WHITE, 24);
            bootmgr_printf(-1, 24, BLACK, "Back to main menu");
            break;
        }
        case BOOTMGR_MISC:
        {
            int itr = 0;
            for(; misc_callbacks[itr] != NULL; ++itr)
                bootmgr_add_touch(0, itr*ISO_CHAR_HEIGHT*3, BOOTMGR_DIS_W, (itr+1)*ISO_CHAR_HEIGHT*3, misc_callbacks[itr], itr);

            bootmgr_add_touch(80, 370, 240, 410, bootmgr_touch_exit_misc, itr);
            bootmgr_print_fill(80, 370, 160, 40, WHITE, 24);
            bootmgr_printf(-1, 24, BLACK, "Back to main menu");
            break;
        }
    }
}