static void drawPluginProgress(const Common::String &filename) { ta_sync(); void *mark = ta_txmark(); const char *fn = filename.c_str(); Label lab1, lab2, lab3; char buf[32]; unsigned memleft = 0x8cf00000-((unsigned)sbrk(0)); float ffree = memleft*(1.0/(16<<20)); int fcol = (memleft < (1<<20)? 0xffff0000: (memleft < (4<<20)? 0xffffff00: 0xff00ff00)); snprintf(buf, sizeof(buf), "%dK free memory", memleft>>10); if (fn[0] == '/') fn++; lab1.create_texture("Loading plugins, please wait..."); lab2.create_texture(fn); lab3.create_texture(buf); ta_begin_frame(); draw_solid_quad(80.0, 270.0, 560.0, 300.0, 0xff808080, 0xff808080, 0xff808080, 0xff808080); draw_solid_quad(85.0, 275.0, 555.0, 295.0, 0xff202020, 0xff202020, 0xff202020, 0xff202020); draw_solid_quad(85.0, 275.0, 85.0+470.0*ffree, 295.0, fcol, fcol, fcol, fcol); ta_commit_end(); lab1.draw(100.0, 150.0, 0xffffffff); lab2.draw(100.0, 190.0, 0xffaaffaa); lab3.draw(100.0, 230.0, 0xffffffff); ta_commit_frame(); ta_sync(); ta_txrelease(mark); }
bool selectGame(char *&ret, char *&dir_ret, Common::Language &lang_ret, Common::Platform &plf_ret, Icon &icon) { Game *games = new Game[MAX_GAMES]; int selected, num_games; ta_sync(); void *mark = ta_txmark(); for (;;) { num_games = findGames(games, MAX_GAMES); for (int i=0; i<num_games; i++) { games[i].icon.create_texture(); games[i].label.create_texture(games[i].text); } selected = gameMenu(games, num_games); ta_sync(); ta_txrelease(mark); if (selected == -1) waitForDisk(); else break; } if (selected >= num_games) selected = -1; if (selected >= 0) the_game = games[selected]; delete games; if (selected>=0) { #if 0 chdir(the_game.dir); #else chdir("/"); dir_ret = the_game.dir; #endif ret = the_game.filename_base; lang_ret = the_game.language; plf_ret = the_game.platform; icon = the_game.icon; return true; } else return false; }
void waitForDisk() { Label lab; int wasopen = 0; ta_sync(); void *mark = ta_txmark(); lab.create_texture("Please insert game CD."); //printf("waitForDisk, cdstate = %d\n", getCdState()); for (;;) { int s = getCdState(); if (s >= 6) wasopen = 1; if (s > 0 && s < 6 && wasopen) { cdfs_reinit(); chdir("/"); chdir("/"); ta_sync(); ta_txrelease(mark); return; } ta_begin_frame(); drawBackground(); ta_commit_end(); lab.draw(166.0, 200.0, 0xffff2020); ta_commit_frame(); int mousex = 0, mousey = 0; byte shiftFlags; int mask = getimask(); setimask(15); handleInput(locked_get_pads(), mousex, mousey, shiftFlags); setimask(mask); } }