void bootmgr_clear(void) { bootmgr_set_lines_count(0); bootmgr_set_fills_count(0); bootmgr_set_imgs_count(0); bootmgr_set_touches_count(0); }
void tetris_init() { tetris_set_defaults(); pieces = (tetris_piece***)malloc(sizeof(tetris_piece*)*TETRIS_W); uint16_t y, z; for(y = 0; y < TETRIS_W; ++y) { pieces[y] = (tetris_piece**)malloc(sizeof(tetris_piece*)*TETRIS_H); for(z = 0; z < TETRIS_H; ++z) pieces[y][z] = NULL; } pthread_mutex_init(tetris_draw_mutex, NULL); t_tetris = (pthread_t*)malloc(sizeof(pthread_t)); pthread_create(t_tetris, NULL, tetris_thread, NULL); bootmgr_display->bg_img = 0; bootmgr_set_lines_count(0); bootmgr_set_fills_count(0); bootmgr_print_fill(9, 29, TETRIS_W*BLOCK_SIZE+1, 1, WHITE, TETRIS_BORDER_TOP); bootmgr_print_fill(9, 29, 1, TETRIS_H*BLOCK_SIZE+1, WHITE, TETRIS_BORDER_LEFT); bootmgr_print_fill(TETRIS_W*BLOCK_SIZE+10, 29, 1, TETRIS_H*BLOCK_SIZE+1, WHITE, TETRIS_BORDER_RIGHT); bootmgr_print_fill(9, 470, TETRIS_W*BLOCK_SIZE+1, 1, WHITE, TETRIS_BORDER_BOTTOM); tetris_print_score(); tetris_print_batt(); bootmgr_printf(243, 1, WHITE, "Next"); bootmgr_printf(243, 2, WHITE, "piece:"); bootmgr_printf(10+((220 - 21*8)/2), 15, WHITE, "Press \"Home\" to start"); bootmgr_draw(); }
int bootmgr_touch_sd_exit(void) { selected = -1; bootmgr_set_lines_count(0); bootmgr_set_fills_count(0); bootmgr_display->bg_img = 1; bootmgr_phase = BOOTMGR_MAIN; bootmgr_draw(); bootmgr_set_time_thread(1); return TCALL_NONE; }
uint8_t bootmgr_boot_sd(void) { bootmgr_set_lines_count(0); bootmgr_set_fills_count(0); char *path = (char*)malloc(200); if(selected == 2) { bootmgr_printf(-1, 20, WHITE, "Booting from SD-card..."); sprintf(path, "/sdroot/multirom/rom"); } else { sprintf(path, "/sdroot/multirom/backup/%s", backups[selected-5]); bootmgr_printf(-1, 20, WHITE, "Booting \"%s\"...", backups[selected-5]); } selected = -1; bootmgr_draw(); char *p = (char*)malloc(200); char *s = (char*)malloc(50); sprintf(p, "%s/boot", path); bootmgr_import_boot(p); char * mount_args[] = { NULL, "ext4", p, s, "bind" }; // /system sprintf(p, "%s/system", path); strcpy(s, "/system"); if(do_mount(5, mount_args) < 0) { bootmgr_printf(-1, 20, WHITE, "Mount %s failed", mount_args[2]); bootmgr_draw(); return 0; } // /data sprintf(p, "%s/data", path); strcpy(s, "/data"); do_mount(5, mount_args); // /cache sprintf(p, "%s/cache", path); strcpy(s, "/cache"); do_mount(5, mount_args); free(p); free(s); free(path); return 1; }
void tetris_exit() { run_thread = 0; pthread_join(t_tetris, NULL); free(t_tetris); pthread_mutex_destroy(tetris_draw_mutex); tetris_clear(1); bootmgr_display->bg_img = 1; bootmgr_set_lines_count(0); bootmgr_set_fills_count(0); bootmgr_phase = BOOTMGR_MAIN; bootmgr_draw(); }