char menu_loop(t_board *board, t_surfaces *surf) { SDL_Event event; char loop; SDL_Surface *current; loop = 42; current = surf->title; while (loop) { show_background(current, surf->screen); SDL_ShowCursor(1); SDL_WaitEvent(&event); if ((((event.type == SDL_KEYDOWN) && (event.key.keysym.sym == SDLK_ESCAPE)) || (event.type == SDL_QUIT)) && (current == surf->title)) loop = 0; // Écran de victoire if ((((event.type == SDL_KEYDOWN) && (event.key.keysym.sym == SDLK_ESCAPE)) || (event.type == SDL_QUIT)) && (current != surf->title)) { loop = 42; current = surf->title; } if (event.type == SDL_MOUSEBUTTONUP) { if (current == surf->title) { if ((event.motion.x > 180) && (event.motion.x < 480)) { if ((event.motion.y > 400) && (event.motion.y < 450)) loop = game_loop(board, surf, 1); if ((event.motion.y > 480) && (event.motion.y < 520)) loop = game_loop(board, surf, 0); if ((event.motion.y > 560) && (event.motion.y < 600)) loop = 0; if (loop == 1) current = surf->blackwin; else if (loop == 2) current = surf->whitewin; else show_background(surf->title, surf->screen); } } else { loop = 42; current = surf->title; } } SDL_Flip(surf->screen); } return (0); }
void OSPC_show_bg(u16 *menu_bg){ u16 *src,*dst; int i; static int cpt_lowbat=0; if (!((cpt_lowbat++)&63)) { int oldvalue=os9x_lowbat; os9x_lowbat=scePowerIsLowBattery(); if (oldvalue!=os9x_lowbat) { u16 *src,*dst; int i; dst=menu_bg; show_background(bg_img_mul,(os9x_lowbat?0x600000:0)); for (i=0;i<272;i++) { src = (u16*)pgGetVramAddr(0,i); memcpy(dst,src,480*2); dst+=480; } } } src=menu_bg; for (i=0;i<272;i++) { dst = (u16*)pgGetVramAddr(0,i); memcpy(dst,src,480*2); src+=480; } }
void show_fatal_error(void) { if (fatal_error) { int sx, sy, ex, ey; int width = uifont_get_string_width(fatal_error_message); int update = 1; sx = (SCR_WIDTH - width) >> 1; sy = (SCR_HEIGHT - FONTSIZE) >> 1; ex = sx + width; ey = sy + (FONTSIZE - 1); video_set_mode(32); load_background(WP_LOGO); while (Loop != LOOP_EXIT) { if (update) { show_background(); small_icon_shadow(6, 3, UI_COLOR(UI_PAL_TITLE), ICON_SYSTEM); uifont_print_shadow(32, 5, UI_COLOR(UI_PAL_TITLE), TEXT(FATAL_ERROR)); draw_dialog(sx - FONTSIZE/2, sy - FONTSIZE/2, ex + FONTSIZE/2, ey + FONTSIZE/2); uifont_print_shadow_center(sy, UI_COLOR(UI_PAL_SELECT), fatal_error_message); update = draw_battery_status(1); update |= draw_volume_status(1); video_flip_screen(1); } else { update = draw_battery_status(0); update |= draw_volume_status(0); video_wait_vsync(); } pad_update(); if (pad_pressed(PSP_CTRL_ANY)) break; } pad_wait_clear(); fatal_error = 0; } }
static void close_dmx(vout_display_t *vd) { vout_display_sys_t *sys = vd->sys; DISPMANX_UPDATE_HANDLE_T update = vc_dispmanx_update_start(10); struct dmx_region_t *dmx_region = sys->dmx_region; struct dmx_region_t *dmx_region_next; while(dmx_region) { dmx_region_next = dmx_region->next; dmx_region_delete(dmx_region, update); dmx_region = dmx_region_next; } vc_dispmanx_update_submit_sync(update); sys->dmx_region = NULL; show_background(vd, false); vc_dispmanx_display_close(sys->dmx_handle); sys->dmx_handle = DISPMANX_NO_HANDLE; }
char game_loop(t_board *board, t_surfaces *surf, char mode) { t_pos moveIA; t_pos moveHint; t_pos move; char rules; char hint; SDL_Rect pos; // Pour les placements dans la fenêtre SDL_Rect cor; // Pour les placements dans le board SDL_Event event; char current; current = BLACK; SDL_ShowCursor(0); init_board(board); rules = RULE3 | RULE5; cor.x = 0; cor.y = 0; hint = 0; SDL_WaitEvent(&event); printf("New Game\n"); while (current) { // Fuite if (((event.type == SDL_KEYDOWN) && (event.key.keysym.sym == SDLK_ESCAPE)) || (event.type == SDL_QUIT)) current = 0; // Background show_background(surf->background, surf->screen); // Click if (event.type == SDL_MOUSEBUTTONUP) { // Mouvements sur le board: position du curseur if ((cor.x >= 0) && (cor.x < 19) && (cor.y >= 0) && (cor.y < 19)) { move.x = cor.x; move.y = cor.y; current = pose(board, &move, current, rules); // IA if (mode && (current == WHITE)) { callIA(board, rules, &moveIA, current); current = pose(board, &moveIA, current, rules); } if (hint) hint = 2; } // Mouvements en bas du board: sélection des règles else if (event.motion.y > 632) { if (event.motion.x < 160) rules = rules ^ RULE3; else if (event.motion.x < 320) rules = rules ^ RULE5; else if (event.motion.x < 480) { hint = !hint; if (hint) hint++; } else if (event.motion.x < 640) return (42); } // Calcul du hint if ((hint > 1) && (current < 3)) { callIA(board, rules, &moveHint, current); /* printf("Hint at %i:%i\n", moveHint.x, moveHint.y); */ hint--; } } // Affichage de l'état des règles pos.w = 320; pos.h = 56; pos.y = 630; if (rules & RULE3) { pos.x = 1; SDL_BlitSurface(surf->rule3, NULL, surf->screen, &pos); } if (rules & RULE5) { pos.x = 161; SDL_BlitSurface(surf->rule5, NULL, surf->screen, &pos); } if (hint) { pos.x = 320; SDL_BlitSurface(surf->hint, NULL, surf->screen, &pos); } // Affichage du Hint if (hint) { pos.x = moveHint.x * 32 +16; pos.y = moveHint.y * 32 +16; pos.w = 32; pos.h = 32; SDL_BlitSurface(surf->cursor, NULL, surf->screen, &pos); } // Affichage des pions place_pawns(board, surf); // Move if ((event.type == SDL_MOUSEMOTION) || (event.type == SDL_MOUSEBUTTONUP)) { pos.w = 32; pos.h = 32; pos.x = (event.motion.x / 32) * 32 - 16; pos.y = (event.motion.y / 32) * 32 - 16; cor.x = event.motion.x / 32 - 1; cor.y = event.motion.y / 32 - 1; /* printf("x:%i y:%i\n", pos.x / 32, pos.y / 32); */ if ((cor.x >= 0) && (cor.x < 19) && (cor.y >= 0) && (cor.y < 19)) { if (get_board(board, cor.x, cor.y) == EMPTY) { if (!getprise(board, cor.x, cor.y, current) && (rules & RULE3) && (!rule3(board, cor.x, cor.y, current))) SDL_BlitSurface(surf->nopestone, NULL, surf->screen, &pos); else if (current == BLACK) { SDL_BlitSurface(surf->blackstone, NULL, surf->screen, &pos); SDL_BlitSurface(surf->cursor, NULL, surf->screen, &pos); } else { SDL_BlitSurface(surf->whitestone, NULL, surf->screen, &pos); SDL_BlitSurface(surf->cursor, NULL, surf->screen, &pos); } } else SDL_BlitSurface(surf->nopestone, NULL, surf->screen, &pos); SDL_ShowCursor(0); } else if (event.motion.y > 632) SDL_ShowCursor(1); } SDL_Flip(surf->screen); // Victoire par capture if (board->whites >= 5) { printf("Blacks wins with captures!\n"); current = BLACK + 10; } if (board->blacks >= 5) { printf("Whites wins with captures!\n"); current = WHITE + 10; } // Quit de victoire while (current > 10) { SDL_ShowCursor(1); show_background(surf->exit, surf->screen); place_pawns(board, surf); SDL_Flip(surf->screen); SDL_WaitEvent(&event); if (event.type == SDL_MOUSEBUTTONUP) return (current - 10); if (((event.type == SDL_KEYDOWN) && (event.key.keysym.sym == SDLK_ESCAPE)) || (event.type == SDL_QUIT)) { current -= 10; current = OPPOSITE(current); break; } } SDL_WaitEvent(&event); } return (42); }
static int configure_display(vout_display_t *vd, const vout_display_cfg_t *cfg, const video_format_t *fmt) { vout_display_sys_t *sys = vd->sys; vout_display_place_t place; MMAL_DISPLAYREGION_T display_region; MMAL_STATUS_T status; if (!cfg && !fmt) return -EINVAL; if (fmt) { sys->input->format->es->video.par.num = fmt->i_sar_num; sys->input->format->es->video.par.den = fmt->i_sar_den; status = mmal_port_format_commit(sys->input); if (status != MMAL_SUCCESS) { msg_Err(vd, "Failed to commit format for input port %s (status=%"PRIx32" %s)", sys->input->name, status, mmal_status_to_string(status)); return -EINVAL; } } else { fmt = &vd->source; } if (!cfg) cfg = vd->cfg; vout_display_PlacePicture(&place, fmt, cfg, false); display_region.hdr.id = MMAL_PARAMETER_DISPLAYREGION; display_region.hdr.size = sizeof(MMAL_DISPLAYREGION_T); display_region.fullscreen = MMAL_FALSE; display_region.src_rect.x = fmt->i_x_offset; display_region.src_rect.y = fmt->i_y_offset; display_region.src_rect.width = fmt->i_visible_width; display_region.src_rect.height = fmt->i_visible_height; display_region.dest_rect.x = place.x; display_region.dest_rect.y = place.y; display_region.dest_rect.width = place.width; display_region.dest_rect.height = place.height; display_region.layer = sys->layer; display_region.set = MMAL_DISPLAY_SET_FULLSCREEN | MMAL_DISPLAY_SET_SRC_RECT | MMAL_DISPLAY_SET_DEST_RECT | MMAL_DISPLAY_SET_LAYER; status = mmal_port_parameter_set(sys->input, &display_region.hdr); if (status != MMAL_SUCCESS) { msg_Err(vd, "Failed to set display region (status=%"PRIx32" %s)", status, mmal_status_to_string(status)); return -EINVAL; } show_background(vd, cfg->is_fullscreen); sys->adjust_refresh_rate = var_InheritBool(vd, MMAL_ADJUST_REFRESHRATE_NAME); sys->native_interlaced = var_InheritBool(vd, MMAL_NATIVE_INTERLACED); if (sys->adjust_refresh_rate) { adjust_refresh_rate(vd, fmt); set_latency_target(vd, true); } return 0; }
void moboot_init(const struct app_descriptor *app) { int rv, keys_pressed; unsigned act; menu_entry_t *real_entries[32]; char *ptr; int rc; char path[256]; char *newpath; char *newtitle; char *newname; unsigned xoff, yoff; unsigned ramdisk_mounted, ramdisk_start, ramdisk_size; unsigned i, j; unsigned default_menu_entry = 0; unsigned next_menu_entry = 0; char default_image[256]; char next_image[256]; unsigned default_timeout; unsigned counted_images; unsigned use_next; ssize_t splash_sz; void *splash_ptr = NULL; ssize_t background_sz; void *background_ptr; ssize_t tile_sz; void *tile_ptr; char splash_path[256]; unsigned boot_flags; ssize_t rdmsgsz; char *rdmsg; keys_pressed = 0; display_surface = NULL; entries = real_entries; gfx_trans = 0; gfxconsole_clear(); gfxconsole_setpos(0,0); ramdisk_mounted = 0; atags_get_ramdisk(&ramdisk_start, &ramdisk_size); if (ramdisk_size && ramdisk_start) { ramdisk_init((void*)ramdisk_start, ramdisk_size); if (fs_mount("/ramdisk", "/dev/ramdisk")) { printf("Ramdisk start=%08x size=%08x\n", ramdisk_start, ramdisk_size); printf("Unable to mount /ramdisk\n"); printf("Press SELECT to continue\n"); gpiokeys_wait_select(); } else { ramdisk_mounted = 1; } } if (fs_mount("/boot", "/dev/mmcblk0p13")) { printf("\nUnable to mount /boot, exiting.\n"); while (1) { thread_sleep(20); } } default_timeout = 5; if ((rv = fs_load_file("/boot/moboot.timeout", &default_image, 256)) > 0) { default_image[rv] = 0; if (default_image[rv - 1] == '\n') default_image[rv - 1] = 0; default_timeout = atoui(default_image); } default_image[0] = 0; rv = fs_load_file("/boot/moboot.default", &default_image, 256); if (rv > 0) { default_image[rv] = 0; if (default_image[rv - 1] == '\n') default_image[rv - 1] = 0; } use_next = 0; next_image[0] = 0; rv = fs_load_file("/boot/moboot.next", &next_image, 256); if (rv > 0) { next_image[rv] = 0; if (next_image[rv - 1] == '\n') next_image[rv - 1] = 0; } tile_sz = fs_load_file_mem("/boot/moboot.background.tga", &tile_ptr); background_surface = NULL; tile_surface = NULL; if (tile_sz > 0) { tile_surface = tga_decode(tile_ptr, tile_sz, GFX_FORMAT_RGB_x888); struct display_info disp_info; if (!display_surface) { display_get_info(&disp_info); display_surface = gfx_create_surface_from_display(&disp_info); } background_surface = gfx_create_surface(NULL, display_surface->width, display_surface->height, display_surface->stride, display_surface->format); for (i = 0; i < display_surface->width; i += tile_surface->width) { for (j = 0; j < display_surface->height; j += tile_surface->height) { gfx_surface_blend(background_surface, tile_surface, i, j); } } } num_menu_entries = 0; i = 0; counted_images = 0; while ((rc = fs_dirent("/boot", i, &ptr)) > 0) { sprintf(path, "/boot/%s", ptr); if (strncmp("uImage.", ptr, 7) == 0) { if (strncmp("uImage.moboot", ptr, 13) != 0) { newtitle = malloc(strlen(ptr) - 7 + 5 + 1); sprintf(newtitle, "boot %s", ptr + 7); newpath = malloc(strlen(ptr) + 6 + 1); sprintf(newpath, "/boot/%s", ptr); newname = malloc(strlen(ptr) - 7 + 1); sprintf(newname, "%s", ptr + 7); if (strcmp(default_image, ptr + 7) == 0) { default_menu_entry = num_menu_entries; } if (strcmp(next_image, ptr + 7) == 0) { next_menu_entry = num_menu_entries; use_next = 1; } set_menu_entry(newtitle, BOOT_FS, newpath, newname); counted_images++; } } free(ptr); i++; } if (rc < 0) { dprintf(SPEW, "/boot dirList ERROR rc = %d\n", rc); } i = 0; while ((rc = fs_dirent("/ramdisk/boot", i, &ptr)) > 0) { sprintf(path, "/ramdisk/boot/%s", ptr); if (strncmp("uImage.", ptr, 7) == 0) { if (strncmp("uImage.moboot", ptr, 13) != 0) { newtitle = malloc(strlen(ptr) - 7 + 5 + 1); sprintf(newtitle, "boot %s", ptr + 7); newpath = malloc(strlen(ptr) + 14 + 1); sprintf(newpath, "/ramdisk/boot/%s", ptr); newname = malloc(strlen(ptr) - 7 + 1); sprintf(newname, "%s", ptr + 7); if (strcmp(default_image, ptr + 7) == 0) { default_menu_entry = num_menu_entries; } if (strcmp(next_image, ptr + 7) == 0) { next_menu_entry = num_menu_entries; use_next = 1; } set_menu_entry(newtitle, BOOT_FS, newpath, newname); counted_images++; } } free(ptr); i++; } if (rc < 0) { dprintf(SPEW, "/ramdisk/boot dirList ERROR rc = %d\n", rc); } if (counted_images == 0) { set_menu_entry("boot", BOOT_FS, "/boot/uImage-2.6.35-palm-tenderloin", "default"); } if (gpiokeys_poll(KEY_ALL)) { keys_pressed = 1; printf("\nPlease release key(s)..."); while (1) { thread_sleep(20); if (!gpiokeys_poll(KEY_ALL)) { break; } } } gfx_trans = 0; if (tile_surface) { gfx_trans = 1; } set_menu_entry("boot webOS Recovery", BOOT_RECOVER, "", "recover"); set_menu_entry("reboot", BOOT_REBOOT, "", "reboot"); // set_menu_entry("DFU", BOOT_DFU, "", ""); set_menu_entry("shutdown", BOOT_SHUTDOWN, "", "shutdown"); xoff = (gfxconsole_getwidth() - 16 ) / 2; if (num_menu_entries < 10) { yoff = (gfxconsole_getheight() - 12) / 2; } else { yoff = (gfxconsole_getheight() - (num_menu_entries + 4)) / 2; } #if 0 tgasz = fs_load_file_mem("/boot/moboot.tga", &tgaptr); tga_surface = NULL; if (tgasz > 0) { tga_surface = tga_decode(tgaptr, tgasz, GFX_FORMAT_RGB_x888); struct display_info disp_info; if (!display_surface) { display_get_info(&disp_info); display_surface = gfx_create_surface_from_display(&disp_info); } } #endif while (1) { gfxconsole_clear(); show_background(); if (background_surface) { gfxconsole_setbackground(background_surface); } gfxconsole_settrans(gfx_trans); gfxconsole_setpos(xoff,yoff); if (gfx_trans) { gfxconsole_set_colors(0xffffffff, 0x00000000); printf("moboot %s", MOBOOT_VERSION); gfxconsole_setpos(xoff,yoff); gfxconsole_set_colors(0x00000000, 0x00000000); } else { gfxconsole_set_colors(0x00000000, 0xffffffff); printf("moboot %s", MOBOOT_VERSION); gfxconsole_set_colors(0x00000000, 0x000000ff); } if (!use_next || keys_pressed) { act = moboot_menu(xoff, yoff + 2, entries, default_menu_entry, num_menu_entries, keys_pressed ? 0 : default_timeout); } else { act = next_menu_entry; use_next = 0; } keys_pressed = 1; gfxconsole_setpos(xoff, yoff + 2 + num_menu_entries + 2); boot_flags = BOOTLINUX_NOFLAGS; switch (entries[act]->type) { case BOOT_RECOVER: reboot_device(RESTART_REASON_RECOVER); break; case BOOT_REBOOT: reboot_device(RESTART_REASON_REBOOT); break; case BOOT_DFU: reboot_device(RESTART_REASON_DFU); break; case BOOT_SHUTDOWN: reboot_device(RESTART_REASON_SHUTDOWN); break; case BOOT_FS: gfxconsole_clear(); gfxconsole_settrans(gfx_trans); show_background(); gfxconsole_setpos(0,0); if (gfx_trans) { gfxconsole_set_colors(0x00000000, 0x00000000); } else { gfxconsole_set_colors(0x00000000, 0x000000ff); } printf("Selected: '%s'\n\n", entries[act]->title); printf("Loading '%s'... ", entries[act]->arg); if ((rv = fs_load_file(entries[act]->arg, (void *)SCRATCH_ADDR, SCRATCH_SIZE * 1024 * 1024)) < 0) { printf("FAILED\n"); } else { printf("OK\n"); /* check for verbose boot */ sprintf(splash_path, "/boot/moboot.verbose.%s", entries[act]->name); splash_sz = fs_load_file_mem(splash_path, &splash_ptr); if (splash_sz > 0) { if (strncmp(splash_ptr, "yes", 3) == 0) { boot_flags |= BOOTLINUX_VERBOSE; } } /* check for sercon boot */ sprintf(splash_path, "/boot/moboot.sercon.%s", entries[act]->name); splash_sz = fs_load_file_mem(splash_path, &splash_ptr); if (splash_sz > 0) { if (strncmp(splash_ptr, "yes", 3) == 0) { boot_flags |= BOOTLINUX_SERCON; } } if (splash_ptr) free(splash_ptr); /* check for splash image */ sprintf(splash_path, "/boot/moboot.splash.%s.tga", entries[act]->name); splash_sz = fs_load_file_mem(splash_path, &splash_ptr); splash_surface = NULL; if (splash_sz > 0) { splash_surface = tga_decode(splash_ptr, splash_sz, GFX_FORMAT_RGB_x888); struct display_info disp_info; if (!display_surface) { display_get_info(&disp_info); display_surface = gfx_create_surface_from_display( &disp_info); } } /* do it to it! */ bootlinux_uimage_mem((void *)SCRATCH_ADDR, rv, boot_splash, boot_flags); } gfxconsole_set_colors(0x00000000, 0x00ff0000); printf("\n\nBOOT FAILED!\n\nPress SELECT to continue\n"); gfxconsole_set_colors(0x00000000, 0x000000ff); gpiokeys_wait_select(); break; } } }
void OSPC_Play(char *fname,int release,int vol) { u16 *menu_bg; u16 *dst,*src; int i,j,pollcpt; char str[256]; char *emulator[3]={"Unknown","Zsnes","Snes9x"}; uint8 *scr; OSPC_Init(); if (i=OSPC_Load(fname)) { sprintf(str,"Error at SPC loading, code : %d",i); msgBoxLines(str,60); //gp32_pause(); //GpAppExit(); return; } OSPC_id=OSPC_GetID666(spc_data); OSPC_sound_fd = sceAudioChReserve( -1, 1024, 0 ); OSPC_exit=0; OSPC_volume=vol; OSPC_thread = sceKernelCreateThread( "OSPC Thread", (SceKernelThreadEntry)OSPC_PlayThread, 0x8, 256*1024, 0, 0 ); if (OSPC_thread<0) { msgBoxLines("Cannot create OSPC playback thread",60); } else { //init start time scePowerSetClockFrequency(266,266,133); sceKernelLibcGettimeofday( &OSPC_start_time, 0 ); sceKernelStartThread( OSPC_thread, 0, 0 ); if (release) return; //init bg menu_bg=(u16*)malloc_64(480*272*2); dst=menu_bg; show_background(bg_img_mul,(os9x_lowbat?0x600000:0)); for (i=0;i<272;i++) { src = (u16*)pgGetVramAddr(0,i); memcpy(dst,src,480*2); dst+=480; } //init fx fx_init(); for (;;) { //show bg OSPC_show_bg(menu_bg); //show bg fx fx_main(pgGetVramAddr(0,0)); //batt infos show_batteryinfo(); //music info //draw frame pgDrawFrame(14,14,20+230+5+1,75+1,12|(12<<5)|(12<<10)); pgDrawFrame(13,13,20+230+5+2,75+2,30|(30<<5)|(30<<10)); pgDrawFrame(12,12,20+230+5+3,75+3,12|(12<<5)|(12<<10)); pgFillBoxHalfer(15,15,20+230+5,75); // if (strlen(OSPC_id->gametitle)) sprintf(str,"Game : %s",OSPC_id->gametitle); else sprintf(str,"Game : unknown"); mh_print(20,20,(char*)str,30|(30<<5)|(30<<10)); if (strlen(OSPC_id->songname)) sprintf(str,"Song : %s",OSPC_id->songname); else sprintf(str,"Song : unknown"); mh_print(20,30,(char*)str,30|(30<<5)|(30<<10)); if (strlen(OSPC_id->dumper)) sprintf(str,"Dumper : %s",OSPC_id->dumper); else sprintf(str,"Dumper : unknown"); mh_print(20,40,(char*)str,30|(30<<5)|(30<<10)); if (strlen(OSPC_id->comments)) sprintf(str,"Comments : %s",OSPC_id->comments); else sprintf(str,"Comments : unknown"); mh_print(20,50,(char*)str,30|(30<<5)|(30<<10)); if (strlen(OSPC_id->author)) sprintf(str,"Author : %s",OSPC_id->author); else sprintf(str,"Author : unknown"); mh_print(20,60,(char*)str,30|(30<<5)|(30<<10)); //time infos //draw frame //draw frame pgDrawFrame(14,94,20+65+5+1,116,8|(8<<5)|(16<<10)); pgDrawFrame(13,93,20+65+5+2,117,28|(28<<5)|(31<<10)); pgDrawFrame(12,92,20+65+5+3,118,8|(8<<5)|(16<<10)); pgFillBoxHalfer(15,95,20+65+5,115); sceKernelLibcGettimeofday( &OSPC_cur_time, 0 ); i=(OSPC_cur_time.tv_sec-OSPC_start_time.tv_sec)+(OSPC_cur_time.tv_usec-OSPC_start_time.tv_usec)/1000000; sprintf(str,"%2d%c%.2d / %2d:%.2d",i/60,((i&1)?':':' '),i%60,OSPC_id->playtime/60,OSPC_id->playtime%60); mh_print(20,100,(char*)str,(20)|(31<<5)|(18<<10)); if (get_pad()) break; pgScreenFlip(); } OSPC_exit=1; sceKernelWaitThreadEnd( OSPC_thread, NULL ); sceKernelDeleteThread( OSPC_thread ); OSPC_thread=-1; free(menu_bg); fx_close(); } sceAudioChRelease( OSPC_sound_fd ); OSPC_Stop(); OSPC_Close(); if (OSPC_id) free(OSPC_id); }
void bios_select(int flag) { int sel = 0, rows = 13, top = 0; int i, prev_sel, update = 1; int old_bios = neogeo_bios; if (!bios_check(flag)) return; if (neogeo_bios == -1) { sel = 0; while (sel < BIOS_MAX) { if (bios_exist[sel]) break; sel++; } } else sel = neogeo_bios; if (top > BIOS_MAX - rows) top = BIOS_MAX - rows; if (top < 0) top = 0; if (sel >= BIOS_MAX) sel = 0; if (sel < 0) sel = BIOS_MAX - 1; if (sel >= top + rows) top = sel - rows + 1; if (sel < top) top = sel; pad_wait_clear(); load_background(BG_DEFAULT); ui_popup_reset(); while (1) { if (update) { int width = uifont_get_string_width(TEXT(SELECT_BIOS_AND_PRESS_CIRCLE_BUTTON)); show_background(); small_icon(8, 3, UI_COLOR(UI_PAL_TITLE), ICON_SYSTEM); uifont_print(36, 5, UI_COLOR(UI_PAL_TITLE), TEXT(BIOS_SELECT_MENU)); uifont_print(477 - width, 271 - 16, UI_COLOR(UI_PAL_SELECT), TEXT(SELECT_BIOS_AND_PRESS_CIRCLE_BUTTON)); if (sel != 0) uifont_print(118, 24, UI_COLOR(UI_PAL_SELECT), FONT_UPTRIANGLE); for (i = 0; i < rows; i++) { if (top + i >= BIOS_MAX) break; if (top + i == sel) { uifont_print(12, 40 + i * 17, UI_COLOR(UI_PAL_SELECT), FONT_RIGHTTRIANGLE); uifont_print(32, 40 + i * 17, UI_COLOR(UI_PAL_SELECT), bios_name[top + i]); } else { if (bios_exist[top + i]) uifont_print(32, 40 + i * 17, UI_COLOR(UI_PAL_NORMAL), bios_name[top + i]); else uifont_print(32, 40 + i * 17, COLOR_DARKGRAY, bios_name[top + i]); } } if (sel + rows < BIOS_MAX) uifont_print(118, 260, UI_COLOR(UI_PAL_SELECT), FONT_DOWNTRIANGLE); update = draw_battery_status(1); update |= ui_show_popup(1); video_flip_screen(1); } else { update = draw_battery_status(0); update |= ui_show_popup(0); video_wait_vsync(); } prev_sel = sel; if (pad_pressed(PSP_CTRL_UP)) { if (sel > 0) { if (bios_exist[sel - 1]) { sel--; } else { for (i = sel - 2; i >= 0; i--) if (bios_exist[i]) break; if (i != -1) sel = i; } } } else if (pad_pressed(PSP_CTRL_DOWN)) { if (sel < BIOS_MAX - 1) { if (bios_exist[sel + 1]) { sel++; } else { for (i = sel + 2; i < BIOS_MAX; i++) if (bios_exist[i]) break; if (i != BIOS_MAX) sel = i; } } } else if (pad_pressed(PSP_CTRL_CIRCLE)) { neogeo_bios = sel; break; } if (top > BIOS_MAX - rows) top = BIOS_MAX - rows; if (top < 0) top = 0; if (sel >= BIOS_MAX) sel = 0; if (sel < 0) sel = BIOS_MAX - 1; if (sel >= top + rows) top = sel - rows + 1; if (sel < top) top = sel; if (prev_sel != sel) update = 1; pad_update(); if (Loop == LOOP_EXIT) break; } pad_wait_clear(); ui_popup_reset(); if (flag) load_background(WP_LOGO); else load_background(WP_FILER); #ifdef ADHOC if (flag != 2) #endif { if (old_bios != neogeo_bios) { if (!flag) ui_popup(TEXT(ALL_NVRAM_FILES_ARE_REMOVED)); delete_files("nvram", ".nv"); } } }