?? .#gui.c.1.58
字號:
// Apparently it is not defined in freebsd... // Currently only accept 320x240 if((SX!=320)||(SY!=240)) return -1; // Set Mode X as the base mode if(display_cfg.triple_buffer) ret = set_gfx_mode(GFX_MODEX,SX,SY,SX,SY*3); else ret = set_gfx_mode(GFX_MODEX,SX,SY,SX,SY); // Apply hacks for arcade monitor rates if(!ret){ arcade_monitor_mode( display_cfg.arcade_h_timing, display_cfg.arcade_v_timing, display_cfg.arcade_center_x, display_cfg.arcade_center_y ); }#endif return ret;}#endifstatic int raine_set_gfx_mode(int SType,int SX,int SY){ int ret;#ifdef RAINE_DEBUG print_debug("raine_gfx_mode bpp %d\n",display_cfg.bpp);#endif set_color_depth(display_cfg.bpp);#ifndef RAINE_WIN32#ifdef RAINE_UNIX if (!x_display) {#endif if((SX==256)&&(SY==240)) return Stretch256x240(SType); if((SX==320)&&(SY==256)) return Set320x256(SType); if((SX==400)&&(SY==150)) return SetDarkForceMode(SType,SX,300,SY); if((SX==640)&&(SY==100)) return SetDarkForceMode(SType,SX,400,SY); if((SX==640)&&(SY==150)) return SetDarkForceMode(SType,SX,400,SY); if((SX==640)&&(SY==200)) return SetDarkForceMode(SType,SX,400,SY); if((SX==640)&&(SY==120)) return SetDarkForceMode(SType,SX,480,SY); if((SX==640)&&(SY==160)) return SetDarkForceMode(SType,SX,480,SY); if((SX==640)&&(SY==240)) return SetDarkForceMode(SType,SX,480,SY); if((SX==800)&&(SY==150)) return SetDarkForceMode(SType,SX,600,SY); if((SX==800)&&(SY==200)) return SetDarkForceMode(SType,SX,600,SY); if((SX==800)&&(SY==300)) return SetDarkForceMode(SType,SX,600,SY); if((SX==1024)&&(SY==192)) return SetDarkForceMode(SType,SX,768,SY); if((SX==1024)&&(SY==256)) return SetDarkForceMode(SType,SX,768,SY); if((SX==1024)&&(SY==384)) return SetDarkForceMode(SType,SX,768,SY); #ifdef GFX_DRIVER_MODEX if(SType==GFX_ARCMON) return set_arcade_mode(SType,SX,SY);#endif #ifdef RAINE_UNIX }#endif#endif if(display_cfg.triple_buffer) ret= set_gfx_mode(SType,SX,SY,SX,SY*3); else ret= set_gfx_mode(SType,SX,SY,SX,SY);#ifdef RAINE_DEBUG print_debug("raine_gfx_mode result %d\n",ret);#endif return ret;} static int new_set_gfx_mode(int SType,int SX,int SY,int SLines){ int ta,tb,bpp; screen_valid=0; if(SLines==0){ // Set a Normal Mode ta=raine_set_gfx_mode(SType,SX,SY); if(!ta){ screen->w=SX; screen->h=SY; screen->cr=screen->w; screen->cb=screen->h; gfx_driver->w=screen->w; gfx_driver->h=screen->h; centre_all_dialogs(); } bpp = desktop_color_depth(); return ta; } else {#ifdef RAINE_UNIX // Disable scanlines in xwindows (windowed mode) // They are useless in this mode, and they don't work... if (display_cfg.screen_type != GFX_XWINDOWS#ifdef GFX_XWINDOWS_FULLSCREEN && display_cfg.screen_type != GFX_XWINDOWS_FULLSCREEN#endif )#endif { // Set a Mode with Scanlines Hack ta=raine_set_gfx_mode(SType,SX,SY<<1); if(!ta){ screen->w=SX; screen->h=SY; screen->cr=screen->w; screen->cb=screen->h; gfx_driver->w=screen->w; gfx_driver->h=screen->h; if(display_cfg.triple_buffer){ for(tb=0;tb<SY*3;tb++){ screen->line[tb]=screen->line[tb+tb]; } } else{ for(tb=0;tb<SY;tb++){ screen->line[tb]=screen->line[tb+tb]; } } centre_all_dialogs(); } return ta; } } return -1; // Error : can't set mode}// for any mapped bitmap including mouse and logos in the dialogs...BITMAP *make_mapped_bitmap(BITMAP *src, int *start, PALETTE *src_pal, UINT32 cols){ BITMAP *dest; UINT8 *line,*line_2; int ta,x,y; dest = create_bitmap_ex(8, src->w, src->h); ta = allocate_pens(cols); if(ta>0){ for(y = 0; y < src->h; y++){ line = src->line[y]; line_2 = dest->line[y]; for(x = 0; x < src->w; x++){ if(line[x]) line_2[x] = line[x] + ta; else line_2[x] = GUI_BOX_COL_MIDDLE; } } memcpy(&gui_pal[ta], src_pal, cols*4); set_palette_range(gui_pal, ta, ta+cols-1, 0); } else{ ta = 0; } *start = ta; return dest;}BITMAP *make_mapped_bitmap_2(BITMAP *src, int *start, PALETTE *src_pal, UINT32 cols){ BITMAP *dest; UINT8 *line,*line_2; int ta,x,y; dest = create_bitmap_ex(8, src->w, src->h); ta = allocate_pens(cols); if(ta>0){ for(y=0;y<src->h;y++){ line = src->line[y]; line_2 = dest->line[y]; for(x=0;x<src->w;x++){ if(line[x]==0) line_2[x] = 0; else line_2[x] = line[x]+ta; } } memcpy(&gui_pal[ta], src_pal, cols*4); set_palette_range(gui_pal, ta, ta+cols-1, 0); } else{ ta = 0; } *start = ta; return dest; // Without breaking the palette in 16bpp. But I don't need this now !}void destroy_mapped_bitmap(BITMAP *dest, UINT32 cols){ free_pens(cols); destroy_bitmap(dest);}void ScreenChange(void){ show_mouse(NULL); if(display_cfg.scanlines==2) display_cfg.screen_y >>= 1; if(new_set_gfx_mode(display_cfg.screen_type,display_cfg.screen_x,display_cfg.screen_y,display_cfg.scanlines)){ // Didn't work: memcpy(&display_cfg, &prev_display_cfg, sizeof(DISPLAY_CFG)); new_set_gfx_mode(display_cfg.screen_type,display_cfg.screen_x,display_cfg.screen_y,display_cfg.scanlines); // Revert to old mode } else{ ReClipScreen(); if (prev_display_cfg.bpp != display_cfg.bpp) { if (current_colour_mapper){ set_colour_mapper(current_colour_mapper); ResetPalette(); } } } set_palette_range(gui_pal,0,255,0); sprintf(screenname, raine_translate_text("%s %dx%d %dbpp; %s"), raine_translate_text("Screen:"), display_cfg.screen_x, display_cfg.screen_y, display_cfg.bpp, gfx_card_name(display_cfg.screen_type)); show_mouse(screen);}// screen_select_proc():// Display then process Screen Select dialogint screen_select_proc(int msg, DIALOG *d, int c){ int ret = x_raine_button_proc(msg, d, c); if(ret==D_CLOSE){ Unselect_Button(d); FadeGUI(); memcpy(&prev_display_cfg, &display_cfg, sizeof(DISPLAY_CFG)); ret = raine_gfx_mode_select(); if(ret){ WantScreen=1; return D_EXIT; } else{ memcpy(&display_cfg, &prev_display_cfg, sizeof(DISPLAY_CFG)); return D_REDRAW; } } return ret;}// Data for game list and available/missing games static int *GameAvail = NULL;static UINT32 GameAvailCount = 0;static int *GameMissing = NULL;static UINT32 GameMissingCount = 0;static int gtype = 0,gcompany=0; // Default valuesstatic int my_game_count;static struct GAME_MAIN **my_game_list;static char *game_type[] ={ "All", "Breakout", "Shoot'em up", "Beat'em up", "Puzzle", "Platform", "Misc", "Sport", "Adult", "Race", "Quizz",};static int nb_game_type;static UINT8 ssound, syear, sstatus;void build_game_avail_list(); // further...static void update_game_list();int res_radio_proc(int msg, DIALOG *d, int c){ wants_switch_res = game_select[GAME_SWITCH_RES+1].flags&D_SELECTED; return x_raine_radio_proc(msg, d, c);}int sound_radio_proc(int msg, DIALOG *d, int c){ int i; int ret=x_raine_radio_proc(msg, d, c); if((msg==MSG_KEY)||(msg==MSG_CLICK)){ // Get selected List Mode // ---------------------- // I hate these constants, but see no easy way to do it better for now if((game_select_opts[2].flags)&D_SELECTED) i = 0; else if((game_select_opts[3].flags)&D_SELECTED) i = 1; else if((game_select_opts[4].flags)&D_SELECTED) i = 2; else i = 0; if (i != ssound) { ssound = i; update_game_list(); } } return ret;}int status_radio_proc(int msg, DIALOG *d, int c){ int i; int ret=x_raine_radio_proc(msg, d, c); if((msg==MSG_KEY)||(msg==MSG_CLICK)){ if((game_select_opts[6].flags)&D_SELECTED) i = 0; else if((game_select_opts[7].flags)&D_SELECTED) i = 1; else if((game_select_opts[8].flags)&D_SELECTED) i = 2; else i = 0; if (i != sstatus) { sstatus = i; update_game_list(); } } return ret;}int year_radio_proc(int msg, DIALOG *d, int c){ int i; int ret=x_raine_radio_proc(msg, d, c); if((msg==MSG_KEY)||(msg==MSG_CLICK)){ if((game_select_opts[10].flags)&D_SELECTED) i = 0; else if((game_select_opts[11].flags)&D_SELECTED) i = 1; else if((game_select_opts[12].flags)&D_SELECTED) i = 2; else i = 0; if (i != syear) { syear = i; update_game_list(); } } return ret;}static void build_game_list(){ int n; struct GAME_MAIN *game; nb_game_type = sizeof(game_type)/sizeof(char*); if (my_game_list) free(my_game_list); my_game_count = 0; my_game_list = malloc(game_count * sizeof(GAME_MAIN*)); for (n=0; n<game_count; n++) { game = game_list[n]; if (#ifndef PRIVATE (!(game->flags & GAME_PRIVATE)) &&#endif (((!sstatus) && !(game->flags & (GAME_NOT_WORKING | GAME_PARTIALLY_WORKING))) || (sstatus==1 && (game->flags & GAME_PARTIALLY_WORKING)) || (sstatus==2 && (game->flags & GAME_NOT_WORKING)))) { if (!ssound || (ssound==1 && game->sound_list) || // sound (ssound==2 && !game->sound_list)) { // no sound if (!syear || (syear==1 && (game->year >= 1990)) || (syear==2 && (game->year < 1990))) { if (!gtype || (game->flags & (1<<(gtype-1)))) { if (!gcompany || game->company_id==gcompany) my_game_list[my_game_count++] = game_list[n]; } } } } }}void build_game_avail_list(); // further...void set_game_list_mode(int i);static void update_game_list(){ build_game_avail_list(); set_game_list_mode(rgui_cfg.game_list_mode);}char *game_type_getter(int index, int *list_size){ if (index == -1){ // Nb of indexes *list_size = nb_game_type; } else if (index == -4) { // clic ! gtype = *list_size; update_game_list(); } else if (index >= 0 && index < nb_game_type) { return game_type[index]; } return NULL;}char *game_company_getter(int index, int *list_size){ if (index == -1){ // Nb of indexes *list_size = nb_companies; } else if (index == -4) { // clic ! gcompany = *list_size; update_game_list(); } else if (index > 0 && index < nb_companies) { return game_company_name(index); } else if (index == 0) return "Any"; return NULL;}// build_game_avail_list():// Updates available and missing game lists, called// before doing game select dialog.void set_game_list_mode(int i){ int ta, tb; switch(rgui_cfg.game_list_mode){ case 0x00: tb = game_select[GAME_LIST].d1; break; case 0x01: tb = GameAvail[game_select[GAME_LIST].d1]; break; case 0x02: tb = GameMissing[game_select[GAME_LIST].d1]; break; // When none of the options above match (which should be never) // Default to option 0; default: tb = game_select[GAME_LIST].d1; break; } rgui_cfg.game_list_mode = i; switch(rgui_cfg.game_list_mode){ case 0x00: if (my_game_count<10) sprintf(game_select[9].dp,"%d/%d Games Listed ", my_game_count, my_game_count); else sprintf(game_select[9].dp,"%d/%d Games Listed ", my_game_count, my_game_count); game_select[GAME_LIST].d1 = tb; break; case 0x01: if (my_game_count<10) sprintf(game_select[9].dp,"%d/%d Games Listed ", GameAvailCount, my_game_count); else sprintf(game_select[9].dp,"%d/%d Games Listed ", GameAvailCount, my_game_count); game_select[GAME_LIST].d1 = 0; for(ta = 0; (UINT32)ta < GameAvailCount; ta++) if(GameAvail[ta] == tb) game_select[GAME_LIST].d1 = ta; break; case 0x02: if (my_game_count<10) sprintf(game_select[9].dp,"%d/%d Games Listed ", GameMissingCount, my_game_count); else sprintf(game_select[9].dp,"%d/%d Games Listed ", GameMissingCount, my_game_count); game_select[GAME_LIST].d1 = 0; for(ta = 0; (UINT32)ta < GameMissingCount; ta++) if(GameMissing[ta] == tb) game_select[GAME_LIST].d1 = ta; break; }}int game_exists(int num){ DIR_INFO *dir_list; UINT8 str[256]; UINT32 ta; dir_list = my_game_list[num]->dir_list; while( (dir_list->maindir) ){ if((dir_list->maindir[0] != '#')&&(dir_list->maindir[0] != '$')){ for(ta = 0; ta < 4; ta ++){ if(dir_cfg.rom_dir[ta][0]){ sprintf(str,"%s%s.zip", dir_cfg.rom_dir[ta], dir_list->maindir); if((file_exists(str,255,NULL))) return 1; sprintf(str,"%s%s", dir_cfg.rom_dir[ta], dir_list->maindir); if((file_exists(str,255,NULL))) return 1; } } } dir_list++; } return 0;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -