static void psp_display_screen_cheat_list(void) { char buffer[512]; int color = 0; int cheat_line = 0; int index = 0; int x = 0; int y = 0; int y_step = 0; psp_sdl_blit_help(); x = 5; y = 0; y_step = 10; cheat_line = psp_cheat_top; index = 0; while ((index < CHEAT_LINE_BY_PAGE) && (cheat_line < psp_cheat_size)) { strcpy(buffer, psp_cheat[cheat_line]); string_fill_with_space(buffer, CHEAT_CHAR_BY_LINE); if (cheat_line == psp_cheat_current) color = PSP_MENU_SEL2_COLOR; else color = PSP_MENU_TEXT_COLOR; psp_sdl_back2_print(x, y, buffer, color); y += y_step; index++; cheat_line++; } if (index != CHEAT_LINE_BY_PAGE) { buffer[0]=0; string_fill_with_space(buffer, CHEAT_CHAR_BY_LINE); while (index < CHEAT_LINE_BY_PAGE) { if (cheat_line == psp_cheat_current) color = PSP_MENU_SEL2_COLOR; else color = PSP_MENU_TEXT_COLOR; psp_sdl_back2_print(x, y, buffer, color); y += y_step; index++; } } }
static void psp_display_screen_disk(void) { char buffer[64]; int index = 0; int color = 0; int x = 0; int y = 0; int y_step = 0; //if (psp_menu_dirty) { psp_sdl_blit_background(); } x = 10; y = 5; y_step = 10; int name_line = cur_name_top; index = 0; while ((index < DISK_LINE_BY_PAGE) && (name_line < cpc_dsk_num_entry)) { color = PSP_MENU_TEXT_COLOR; if (cur_name_id == name_line) color = PSP_MENU_SEL_COLOR; strcpy(buffer, cpc_dsk_dirent[name_line]); string_fill_with_space(buffer, 32); psp_sdl_back2_print(x, y, buffer, color); y += y_step; index++; name_line++; } if (index != DISK_LINE_BY_PAGE) { buffer[0]=0; string_fill_with_space(buffer, DISK_CHAR_BY_LINE); while (index < DISK_LINE_BY_PAGE) { psp_sdl_back2_print(x, y, buffer, PSP_MENU_SEL_COLOR); y += y_step; index++; } } }
static void psp_display_screen_help(void) { char buffer[512]; int help_line = 0; int index = 0; int x = 0; int y = 0; int y_step = 0; psp_sdl_blit_help(); x = 5; y = 0; y_step = 10; help_line = psp_help_current; index = 0; while ((index < HELP_LINE_BY_PAGE) && (help_line < psp_help_size)) { strcpy(buffer, psp_help[help_line]); string_fill_with_space(buffer, HELP_CHAR_BY_LINE); psp_sdl_back2_print(x, y, buffer, PSP_MENU_SEL_COLOR); y += y_step; index++; help_line++; } if (index != HELP_LINE_BY_PAGE) { buffer[0]=0; string_fill_with_space(buffer, HELP_CHAR_BY_LINE); while (index < HELP_LINE_BY_PAGE) { psp_sdl_back2_print(x, y, buffer, PSP_MENU_SEL_COLOR); y += y_step; index++; } } }
void psp_display_screen_menu(void) { char buffer[64]; int menu_id = 0; int slot_id = 0; int color = 0; int x = 0; int y = 0; int y_step = 0; psp_sdl_blit_background(); x = 10; y = 5; y_step = 10; for (menu_id = 0; menu_id < MAX_MENU_ITEM; menu_id++) { color = PSP_MENU_TEXT_COLOR; if (cur_menu_id == menu_id) color = PSP_MENU_SEL_COLOR; else if (menu_id == MENU_EXIT) color = PSP_MENU_WARNING_COLOR; else if (menu_id == MENU_HELP) color = PSP_MENU_GREEN_COLOR; if (menu_id == MENU_EDITOR) { if (ATARI.comment_present) { psp_sdl_back2_print(x, y, "View comment", color); } else { psp_sdl_back2_print(x, y, "New comment", color); } } else { psp_sdl_back2_print(x, y, menu_list[menu_id].title, color); } if (menu_id == MENU_SCREENSHOT) { sprintf(buffer,"%d", ATARI.psp_screenshot_id); string_fill_with_space(buffer, 4); psp_sdl_back2_print(120, y, buffer, color); #if defined(GCW0_MODE) y += y_step; #endif; } else #if !defined(GCW0_MODE) if (menu_id == MENU_VOLUME) { sprintf(buffer,"%d", gp2xGetSoundVolume()); string_fill_with_space(buffer, 4); psp_sdl_back2_print(120, y, buffer, color); y += y_step; } else #endif if (menu_id == MENU_DEL_SLOT) { y += y_step; } else if (menu_id == MENU_SETTINGS) { y += y_step; } else if (menu_id == MENU_BACK) { y += y_step; } else if (menu_id == MENU_LOAD_ROM) { y += y_step; } else if (menu_id == MENU_CHEATS) { } else if (menu_id == MENU_HELP) { y += y_step; } y += y_step; } y_step = 10; y = 20; for (slot_id = 0; slot_id < ATARI_MAX_SAVE_STATE; slot_id++) { if (slot_id == cur_slot) color = PSP_MENU_SEL2_COLOR; else color = PSP_MENU_TEXT_COLOR; if (ATARI.atari_save_state[slot_id].used) { # if defined(LINUX_MODE) || defined(WIZ_MODE) struct tm *my_date = localtime(& ATARI.atari_save_state[slot_id].date); sprintf(buffer, "- %02d/%02d %02d:%02d:%02d", my_date->tm_mday, my_date->tm_mon, my_date->tm_hour, my_date->tm_min, my_date->tm_sec ); # else sprintf(buffer, "- used"); # endif } else { sprintf(buffer, "- empty"); } string_fill_with_space(buffer, 32); psp_sdl_back2_print(100, y, buffer, color); y += y_step; } if (ATARI.atari_save_state[cur_slot].thumb) { psp_sdl_blit_thumb(170,125, ATARI.atari_save_state[cur_slot].surface); } else { psp_sdl_blit_thumb(170,125, thumb_surface); } psp_menu_display_save_name(); }
static void psp_display_screen_settings_menu(void) { char buffer[64]; int menu_id = 0; int color = 0; int x = 0; int y = 0; int y_step = 0; psp_sdl_blit_help(); x = 10; y = 5; y_step = 10; for (menu_id = 0; menu_id < MAX_MENU_SET_ITEM; menu_id++) { color = PSP_MENU_TEXT_COLOR; if (cur_menu_id == menu_id) color = PSP_MENU_SEL_COLOR; psp_sdl_back2_print(x, y, menu_list[menu_id].title, color); if (menu_id == MENU_SET_SOUND) { if (atari_snd_enable) strcpy(buffer,"yes"); else strcpy(buffer,"no "); string_fill_with_space(buffer, 4); psp_sdl_back2_print(140, y, buffer, color); } else if (menu_id == MENU_SET_VIEW_FPS) { if (atari_view_fps) strcpy(buffer,"yes"); else strcpy(buffer,"no "); string_fill_with_space(buffer, 4); psp_sdl_back2_print(140, y, buffer, color); } else if (menu_id == MENU_SET_SKIP_FPS) { sprintf(buffer,"%d", atari_skip_fps); string_fill_with_space(buffer, 4); psp_sdl_back2_print(140, y, buffer, color); } else if (menu_id == MENU_SET_SPEED_LIMIT) { if (atari_speed_limiter == 0) strcpy(buffer,"no"); else sprintf(buffer, "%d fps", atari_speed_limiter); string_fill_with_space(buffer, 10); psp_sdl_back2_print(140, y, buffer, color); } else if (menu_id == MENU_SET_RENDER) { /* if (atari_render_mode == ATARI_RENDER_NORMAL) */ strcpy(buffer, "normal"); string_fill_with_space(buffer, 13); psp_sdl_back2_print(140, y, buffer, color); } else if (menu_id == MENU_SET_FLICKER_MODE) { if (atari_flicker_mode == ATARI_FLICKER_NONE) strcpy(buffer, "none"); else if (atari_flicker_mode == ATARI_FLICKER_SIMPLE) strcpy(buffer, "simple"); else if (atari_flicker_mode == ATARI_FLICKER_PHOSPHOR) strcpy(buffer, "phosphor"); else strcpy(buffer, "average"); string_fill_with_space(buffer, 13); psp_sdl_back2_print(140, y, buffer, color); #if defined(GCW0_MODE) y += y_step; #endif } else #if !defined(GCW0_MODE) if (menu_id == MENU_SET_CLOCK) { sprintf(buffer,"%d", psp_cpu_clock); string_fill_with_space(buffer, 4); psp_sdl_back2_print(140, y, buffer, color); y += y_step; } else #endif if (menu_id == MENU_SET_RESET) { y += y_step; } y += y_step; } psp_menu_display_save_name(); }
void psp_display_screen_menu(void) { char buffer[64]; int menu_id = 0; int slot_id = 0; int color = 0; int x = 0; int y = 0; int y_step = 0; psp_sdl_blit_background(); x = 10; y = 5; y_step = 10; for (menu_id = 0; menu_id < MAX_MENU_ITEM; menu_id++) { color = PSP_MENU_TEXT_COLOR; if (cur_menu_id == menu_id) color = PSP_MENU_SEL_COLOR; else if (menu_id == MENU_EXIT) color = PSP_MENU_WARNING_COLOR; else if (menu_id == MENU_HELP) color = PSP_MENU_GREEN_COLOR; if (menu_id == MENU_COMMAND) { strcpy(buffer, menu_list[menu_id].title); strcat(buffer, command_name[cur_command]); string_fill_with_space(buffer, 25); psp_sdl_back2_print(x, y, buffer, color); } else if (menu_id == MENU_EDITOR) { if (CPC.comment_present) { psp_sdl_back2_print(x, y, "View comment", color); } else { psp_sdl_back2_print(x, y, "New comment", color); } } else { psp_sdl_back2_print(x, y, menu_list[menu_id].title, color); } if (menu_id == MENU_SCREENSHOT) { sprintf(buffer,"%d", CPC.psp_screenshot_id); string_fill_with_space(buffer, 4); psp_sdl_back2_print(120, y, buffer, color); y += y_step; } else if (menu_id == MENU_DEL_SLOT) { //y += y_step; } else if (menu_id == MENU_LOAD_DSKB) { y += y_step; } else if (menu_id == MENU_COMMAND) { //y += y_step; } else if (menu_id == MENU_SETTINGS) { //y += y_step; } else if (menu_id == MENU_BACK) { y += y_step; } else if (menu_id == MENU_HELP) { y += y_step; } y += y_step; } y_step = 10; y = 25; for (slot_id = 0; slot_id < CPC_MAX_SAVE_STATE; slot_id++) { if (slot_id == cur_slot) color = PSP_MENU_SEL2_COLOR; else color = PSP_MENU_TEXT_COLOR; if (CPC.cpc_save_state[slot_id].used) { # if defined(LINUX_MODE) || defined(WIZ_MODE) struct tm *my_date = localtime(& CPC.cpc_save_state[slot_id].date); sprintf(buffer, "- %02d/%02d %02d:%02d:%02d", my_date->tm_mday, my_date->tm_mon, my_date->tm_hour, my_date->tm_min, my_date->tm_sec ); # else sprintf(buffer, "- used"); # endif } else { sprintf(buffer, "- empty"); } string_fill_with_space(buffer, 32); psp_sdl_back2_print(105, y, buffer, color); y += y_step; } if (CPC.cpc_save_state[cur_slot].thumb) { psp_sdl_blit_thumb(180, 135, CPC.cpc_save_state[cur_slot].surface); } else { psp_sdl_blit_thumb(180, 135, thumb_surface); } psp_menu_display_save_name(); }
static void psp_display_screen_settings_menu(void) { char buffer[64]; int menu_id = 0; int color = 0; int x = 0; int y = 0; int y_step = 0; psp_sdl_blit_help(); x = 10; y = 5; y_step = 10; for (menu_id = 0; menu_id < MAX_MENU_SET_ITEM; menu_id++) { color = PSP_MENU_TEXT_COLOR; if (cur_menu_id == menu_id) color = PSP_MENU_SEL_COLOR; psp_sdl_back2_print(x, y, menu_list[menu_id].title, color); if (menu_id == MENU_SET_SOUND) { if (hugo_snd_enable) strcpy(buffer,"yes"); else strcpy(buffer,"no "); string_fill_with_space(buffer, 4); psp_sdl_back2_print(140, y, buffer, color); } else if (menu_id == MENU_SET_FREQ) { if (hugo_snd_freq == SND_MONO_22K) strcpy(buffer, "22k mono"); else if (hugo_snd_freq == SND_MONO_44K) strcpy(buffer, "44k mono"); else if (hugo_snd_freq == SND_STEREO_22K) strcpy(buffer, "22k stereo"); else if (hugo_snd_freq == SND_STEREO_44K) strcpy(buffer, "44k stereo"); string_fill_with_space(buffer, 12); psp_sdl_back2_print(140, y, buffer, color); } else if (menu_id == MENU_SET_VOLUME) { sprintf(buffer,"%d", hugo_snd_volume); string_fill_with_space(buffer, 7); psp_sdl_back2_print(140, y, buffer, color); } else if (menu_id == MENU_SET_VIEW_FPS) { if (hugo_view_fps) strcpy(buffer,"on "); else strcpy(buffer,"off"); string_fill_with_space(buffer, 4); psp_sdl_back2_print(140, y, buffer, color); } else if (menu_id == MENU_SET_OVERCLOCK) { sprintf(buffer,"%d", hugo_overclock); string_fill_with_space(buffer, 7); psp_sdl_back2_print(140, y, buffer, color); } else if (menu_id == MENU_SET_SKIP_FPS) { sprintf(buffer,"%d", hugo_skip_fps); string_fill_with_space(buffer, 4); psp_sdl_back2_print(140, y, buffer, color); } else if (menu_id == MENU_SET_SPEED_LIMIT) { if (hugo_speed_limiter == 0) strcpy(buffer,"no"); else sprintf(buffer, "%d fps", hugo_speed_limiter); string_fill_with_space(buffer, 10); psp_sdl_back2_print(140, y, buffer, color); } else if (menu_id == MENU_SET_VSYNC) { if (hugo_vsync) strcpy(buffer,"yes"); else strcpy(buffer,"no "); string_fill_with_space(buffer, 4); psp_sdl_back2_print(140, y, buffer, color); } else if (menu_id == MENU_SET_RENDER) { if (hugo_render_mode == HUGO_RENDER_FAST ) strcpy(buffer , "fast"); else if (hugo_render_mode == HUGO_RENDER_FAST_MAX) strcpy(buffer , "fast max"); else strcpy(buffer, "fit"); string_fill_with_space(buffer, 13); psp_sdl_back2_print(140, y, buffer, color); } else if (menu_id == MENU_SET_CLOCK) { sprintf(buffer,"%d", psp_cpu_clock); string_fill_with_space(buffer, 4); psp_sdl_back2_print(140, y, buffer, color); y += y_step; } else if (menu_id == MENU_SET_RESET) { y += y_step; } y += y_step; } psp_menu_display_save_name(); }
static void psp_display_screen_kbd_menu(void) { char buffer[32]; char *scan; int menu_id = 0; int kbd_id = 0; int hugo_key = 0; int color = 0; int x = 0; int y = 0; int y_step = 0; psp_sdl_blit_help(); x = 5; y = 5; y_step = 10; for (menu_id = 0; menu_id < MAX_MENU_KBD_ITEM; menu_id++) { if (cur_menu_id == menu_id) color = PSP_MENU_SEL_COLOR; else if (menu_id == MENU_KBD_KBD_SELECT) color = PSP_MENU_NOTE_COLOR; else color = PSP_MENU_TEXT_COLOR; psp_sdl_back2_print(x, y, menu_list[menu_id].title, color); if (menu_id == MENU_KBD_SKIN) { snprintf(buffer, 30, psp_kbd_skin_dir[psp_kbd_skin]); scan = strchr(buffer, '/'); if (scan) *scan = 0; psp_sdl_back2_print(70, y, buffer, color); } else if (menu_id == MENU_KBD_KBD_SELECT) { if (menu_kbd_selected == -1) sprintf(buffer, "standard"); else if (menu_kbd_selected == KBD_LTRIGGER_MAPPING) sprintf(buffer, "left"); else if (menu_kbd_selected == KBD_RTRIGGER_MAPPING) sprintf(buffer, "right"); string_fill_with_space(buffer, 20); psp_sdl_back2_print(70, y, buffer, color); } else if ((menu_id >= MENU_KBD_UP ) && (menu_id <= MENU_KBD_JOY_RIGHT)) { kbd_id = psp_kbd_menu_id_to_key_id(menu_id); if (menu_kbd_selected == KBD_NORMAL_MAPPING ) hugo_key = loc_kbd_mapping[kbd_id]; else if (menu_kbd_selected == KBD_LTRIGGER_MAPPING) hugo_key = loc_kbd_mapping_L[kbd_id]; else if (menu_kbd_selected == KBD_RTRIGGER_MAPPING) hugo_key = loc_kbd_mapping_R[kbd_id]; if ((hugo_key >= 0) && (hugo_key < HUGO_MAX_KEY)) { strcpy(buffer, psp_hugo_key_to_name[hugo_key].name); } else if (hugo_key == KBD_UNASSIGNED) { sprintf(buffer, "UNASSIGNED"); } else if (hugo_key == KBD_LTRIGGER_MAPPING) { sprintf(buffer, "L MAPPING"); } else if (hugo_key == KBD_RTRIGGER_MAPPING) { sprintf(buffer, "R MAPPING"); } else { sprintf(buffer, "KEY %d", hugo_key); } string_fill_with_space(buffer, 12); psp_sdl_back2_print(70, y, buffer, color); if (menu_id == MENU_KBD_JOY_RIGHT) { y += y_step; } } y += y_step; } psp_menu_display_save_name(); }
int psp_file_request(char *out, char *pszStartPath) { static int sel=0; gp2xCtrlData c; int display_screen; int last_time; int tmp; long color; int top, rows=20, x, y, i, up=0; char path[PSP_FMGR_MAX_PATH]; char oldDir[PSP_FMGR_MAX_NAME]; char buffer[PSP_FMGR_MAX_NAME]; char *p; long new_pad; long old_pad; int file_selected; memset(files, 0x00, sizeof(struct dirent) * PSP_FMGR_MAX_ENTRY); memset(sortfiles, 0x00, sizeof(struct dirent *) * PSP_FMGR_MAX_ENTRY); nfiles = 0; strcpy(path, pszStartPath); getDir(path); display_screen = 1; last_time = 0; old_pad = 0; top = 0; file_selected = 0; for(;;) { x = 0; y = 15; if (display_screen) { psp_display_screen_fmgr(); psp_sdl_back2_rectangle(x, y, 190, rows * 10); } for(i=0; i<rows; i++){ if(top+i >= nfiles) break; if(top+i == sel) color = PSP_MENU_SEL_COLOR; else color = PSP_MENU_TEXT_COLOR; strncpy(buffer, sortfiles[top+i]->d_name, 28); string_fill_with_space(buffer, 28); psp_sdl_back2_print(x, y, buffer, color); y += 10; } psp_sdl_flip(); gp2xCtrlReadBufferPositive(&c, 1); c.Buttons &= PSP_ALL_BUTTON_MASK; new_pad = c.Buttons; if ((old_pad != new_pad) || ((c.TimeStamp - last_time) > PSP_FMGR_MIN_TIME)) { last_time = c.TimeStamp; old_pad = new_pad; } else continue; if ((new_pad & GP2X_CTRL_CROSS) || (new_pad & GP2X_CTRL_CIRCLE)) { if (sortfiles[sel]->d_type == DT_DIR) { if(!strcmp(sortfiles[sel]->d_name,"..")){ up=1; } else { strcat(path,sortfiles[sel]->d_name); display_screen = 1; getDir(path); sel=0; } }else{ strcpy(out, path); strcat(out, sortfiles[sel]->d_name); strcpy(pszStartPath,path); file_selected = 1; break; } } else if(new_pad & GP2X_CTRL_TRIANGLE){ up=1; } else if((new_pad & GP2X_CTRL_SQUARE) || (new_pad & GP2X_CTRL_SELECT)) { /* Cancel */ file_selected = 0; break; } else if(new_pad & GP2X_CTRL_UP){ sel--; } else if(new_pad & GP2X_CTRL_DOWN){ sel++; } else if(new_pad & GP2X_CTRL_LEFT){ sel-=10; } else if(new_pad & GP2X_CTRL_RIGHT){ sel+=10; } else if(new_pad & GP2X_CTRL_RTRIGGER){ if (sortfiles[sel]->d_type != DT_DIR) { display_screen = 1; strcpy(out, path); strcat(out, sortfiles[sel]->d_name); strcpy(pszStartPath,path); if (psp_fmgr_ask_confirm()) { for (tmp = sel; tmp < (nfiles - 1); tmp++) { sortfiles[tmp] = sortfiles[tmp + 1]; } nfiles--; remove(out); } } } if(up) { display_screen = 1; if(strcmp(path,"ms0:/")){ p=strrchr(path,'/'); *p=0; p=strrchr(path,'/'); p++; strcpy(oldDir,p); strcat(oldDir,"/"); *p=0; getDir(path); sel=0; for(i=0; i<nfiles; i++) { if(!strcmp(oldDir, sortfiles[i]->d_name)) { sel=i; top=sel-3; break; } } } up=0; } if(top > nfiles-rows) top=nfiles-rows; if(top < 0) top=0; if(sel >= nfiles) sel=nfiles-1; if(sel < 0) sel=0; if(sel >= top+rows) top=sel-rows+1; if(sel < top) top=sel; } return file_selected; }
static void psp_display_screen_joystick_menu(void) { char buffer[64]; int menu_id = 0; int color = 0; int x = 0; int y = 0; int y_step = 0; psp_sdl_blit_help(); x = 10; y = 5; y_step = 10; for (menu_id = 0; menu_id < MAX_MENU_JOY_ITEM; menu_id++) { color = PSP_MENU_TEXT_COLOR; if (cur_menu_id == menu_id) color = PSP_MENU_SEL_COLOR; psp_sdl_back2_print(x, y, menu_list[menu_id].title, color); if (menu_id == MENU_JOY_ANALOG) { if (psp_reverse_analog) strcpy(buffer,"yes"); else strcpy(buffer,"no "); string_fill_with_space(buffer, 4); psp_sdl_back2_print(140, y, buffer, color); } else if (menu_id == MENU_JOY_AUTOFIRE_T) { sprintf(buffer,"%d", atari_auto_fire_period+1); string_fill_with_space(buffer, 7); psp_sdl_back2_print(140, y, buffer, color); } else if (menu_id == MENU_JOY_AUTOFIRE_M) { if (atari_auto_fire_mode) strcpy(buffer,"yes"); else strcpy(buffer,"no "); string_fill_with_space(buffer, 4); psp_sdl_back2_print(140, y, buffer, color); } else if (menu_id == MENU_JOY_JOYSTICK) { if (psp_active_joystick) strcpy(buffer,"player 2"); else strcpy(buffer,"player 1 "); string_fill_with_space(buffer, 10); psp_sdl_back2_print(140, y, buffer, color); } else if (menu_id == MENU_JOY_PADDLE) { if (atari_paddle_enable) strcpy(buffer,"yes"); else strcpy(buffer,"no "); string_fill_with_space(buffer, 4); psp_sdl_back2_print(140, y, buffer, color); } else if (menu_id == MENU_JOY_PADDLE_SPEED) { sprintf(buffer, "%d", atari_paddle_speed); string_fill_with_space(buffer, 10); psp_sdl_back2_print(140, y, buffer, color); y += y_step; } else if (menu_id == MENU_JOY_RESET) { y += y_step; } y += y_step; } psp_menu_display_save_name(); }
static void psp_display_screen_cheat_menu(void) { char buffer[128]; int menu_id = 0; int color = 0; int cheat_id = 0; int addr_id = 0; int x = 0; int y = 0; int y_step = 0; int sav_y = 0; int first = 0; char* scan = 0; psp_sdl_blit_help(); x = 10; y = 5; y_step = 10; for (menu_id = 0; menu_id < MAX_MENU_CHEAT_ITEM; menu_id++) { color = PSP_MENU_TEXT_COLOR; if (menu_id == MENU_CHEAT_DEL) color = PSP_MENU_NOTE_COLOR; if (cur_menu_id == menu_id) color = PSP_MENU_SEL_COLOR; psp_sdl_back2_print(x, y, menu_list[menu_id].title, color); if (menu_id == MENU_CHEAT_OLD_VAL) { sprintf(buffer,"%02X", scan_old_value); string_fill_with_space(buffer, 4); psp_sdl_back2_print( 90, y, buffer, color); } else if (menu_id == MENU_CHEAT_NEW_VAL) { sprintf(buffer,"%02X", scan_new_value); string_fill_with_space(buffer, 4); psp_sdl_back2_print( 90, y, buffer, color); } else if (menu_id == MENU_CHEAT_POKE) { sprintf(buffer,"%02X", scan_poke_value); string_fill_with_space(buffer, 4); psp_sdl_back2_print( 90, y, buffer, color); } else if (menu_id == MENU_CHEAT_ADD) { if (scan_addr_found) { scan = buffer; buffer[0] = 0; first = 1; sav_y = y; for (addr_id = 0; addr_id < scan_addr_found; addr_id++) { if (addr_id >= MAX_SCAN_ADDR) break; if (first) { sprintf(scan, "%04X", scan_addr[addr_id]); first = 0; scan += 4; } else { sprintf(scan, ",%04X", scan_addr[addr_id]); scan += 5; if (addr_id == 4) { string_fill_with_space(buffer, 38); psp_sdl_back2_print( 90, y, buffer, color); scan = buffer; buffer[0] = 0; first = 1; y += y_step; } } } if (scan_addr_found >= MAX_SCAN_ADDR) { sprintf(scan," ... (%d)", scan_addr_found ); } string_fill_with_space(buffer, 38); psp_sdl_back2_print( 90, y, buffer, color); y = sav_y; } else { sprintf(buffer,"No match"); string_fill_with_space(buffer, 38); psp_sdl_back2_print( 90, y, buffer, color); } //y += y_step; } else if (menu_id == MENU_CHEAT_RAM) { y += y_step; } else if (menu_id == MENU_CHEAT_EDIT) { y += y_step; } else if (menu_id == MENU_CHEAT_DEL) { y += (CPC_MAX_CHEAT - 6) * y_step; } else if (menu_id == MENU_CHEAT_RESET) { y += y_step; } y += y_step; } y_step = 10; y = 65; for (cheat_id = 0; cheat_id < CPC_MAX_CHEAT; cheat_id++) { if (cheat_id == cur_cheat) color = PSP_MENU_SEL2_COLOR; else color = PSP_MENU_TEXT_COLOR; CPC_cheat_t* a_cheat = &CPC.cpc_cheat[cheat_id]; if (a_cheat->type != CPC_CHEAT_NONE) { char enable = (a_cheat->type == CPC_CHEAT_ENABLE) ? 'X' : ' '; sprintf(buffer, "[%c] %04X-%02X %s", enable, a_cheat->addr, a_cheat->value, a_cheat->comment); } else { sprintf(buffer, "[ ] - Empty"); } string_fill_with_space(buffer, 36); psp_sdl_back2_print(90, y, buffer, color); y += y_step; } psp_menu_display_save_name(); }
int psp_file_request(char *out, char *pszStartPath) { static int sel=0; gp2xCtrlData c; int last_time; int tmp; long color; int top, rows=20, x, y, i, up=0; char path[PSP_FMGR_MAX_PATH]; char oldDir[PSP_FMGR_MAX_NAME]; char buffer[PSP_FMGR_MAX_NAME]; char *p; long new_pad; long old_pad; int file_selected; int check_last; int danzeff_mode; int danzeff_key; danzeff_key = 0; danzeff_mode = 0; memset(files, 0x00, sizeof(struct dirent) * PSP_FMGR_MAX_ENTRY); memset(sortfiles, 0x00, sizeof(struct dirent *) * PSP_FMGR_MAX_ENTRY); nfiles = 0; strcpy(path, pszStartPath); getDir(path); last_time = 0; old_pad = 0; top = 0; file_selected = 0; if (sel >= nfiles) sel = 0; check_last = 0; for(;;) { x = 0; y = 15; psp_display_screen_fmgr(); for(i=0; i<rows; i++){ if(top+i >= nfiles) break; if(top+i == sel) color = PSP_MENU_SEL_COLOR; else color = PSP_MENU_TEXT_COLOR; strncpy(buffer, sortfiles[top+i]->d_name, 28); string_fill_with_space(buffer, 28); psp_sdl_back2_print(x, y, buffer, color); y += 10; } if (danzeff_mode) { danzeff_moveTo(0, -90); danzeff_render(); } psp_sdl_flip(); while (1) { gp2xCtrlPeekBufferPositive(&c, 1); c.Buttons &= PSP_ALL_BUTTON_MASK; new_pad = c.Buttons; if ((old_pad != new_pad) || ((c.TimeStamp - last_time) > GP2X_FMGR_MIN_TIME)) { last_time = c.TimeStamp; old_pad = new_pad; break; } } if (danzeff_mode) { danzeff_key = danzeff_readInput(c); if (danzeff_key > DANZEFF_START) { if (danzeff_key > ' ') { int new_sel = psp_file_find_first(danzeff_key, check_last); check_last = 1; if (new_sel >= 0) { sel = new_sel; goto lab_end; } } } else if ((danzeff_key == DANZEFF_START ) || (danzeff_key == DANZEFF_SELECT)) { danzeff_mode = 0; old_pad = new_pad = 0; psp_kbd_wait_no_button(); } if (danzeff_key == ' ') { new_pad |= GP2X_CTRL_CROSS; } else if (danzeff_key >= -1) { continue; } } if (new_pad & GP2X_CTRL_START) { danzeff_mode = 1; } else if ((new_pad & GP2X_CTRL_CROSS) || (new_pad & GP2X_CTRL_CIRCLE)) { if (sortfiles[sel]->d_type == DT_DIR) { check_last = 0; if(!strcmp(sortfiles[sel]->d_name,"..")){ up=1; } else { strcat(path,sortfiles[sel]->d_name); getDir(path); sel=0; } }else{ strcpy(out, path); strcat(out, sortfiles[sel]->d_name); strcpy(pszStartPath,path); file_selected = 1; break; } } else if(new_pad & GP2X_CTRL_TRIANGLE){ check_last = 0; up=1; } else if((new_pad & GP2X_CTRL_SQUARE) || (new_pad & GP2X_CTRL_SELECT)) { /* Cancel */ file_selected = 0; break; } else if(new_pad & GP2X_CTRL_UP){ sel--; check_last = 0; } else if(new_pad & GP2X_CTRL_DOWN){ sel++; check_last = 0; } else if(new_pad == GP2X_CTRL_LEFT){ sel-=10; check_last = 0; } else if(new_pad == GP2X_CTRL_RIGHT){ sel+=10; check_last = 0; } else if(new_pad & GP2X_CTRL_RTRIGGER){ if (sortfiles[sel]->d_type != DT_DIR) { strcpy(out, path); strcat(out, sortfiles[sel]->d_name); strcpy(pszStartPath,path); if (psp_fmgr_ask_confirm()) { for (tmp = sel; tmp < (nfiles - 1); tmp++) { sortfiles[tmp] = sortfiles[tmp + 1]; } nfiles--; remove(out); } check_last = 0; } } if(up) { check_last = 0; if(strcmp(path,"./")){ p=strrchr(path,'/'); *p=0; p=strrchr(path,'/'); p++; strcpy(oldDir,p); strcat(oldDir,"/"); *p=0; getDir(path); sel=0; for(i=0; i<nfiles; i++) { if(!strcmp(oldDir, sortfiles[i]->d_name)) { sel=i; top=sel-3; break; } } } up=0; } lab_end: if(top > nfiles-rows) top=nfiles-rows; if(top < 0) top=0; if(sel >= nfiles) sel=nfiles-1; if(sel < 0) sel=0; if(sel >= top+rows) top=sel-rows+1; if(sel < top) top=sel; } return file_selected; }