Exemplo n.º 1
0
static void goMenu(void)
{

   int exitmode=0;
   int autosave=mainMenu_autosave;
   if (quit_program != 0)
	    return;
#ifdef PROFILER_UAE4ALL
   uae4all_prof_show();
#endif
#ifdef DEBUG_FRAMERATE
   uae4all_show_time();
#endif
   emulating=1;
   vkbd_quit();
   init_text(0);
   pause_sound();

   menu_raise();
   exitmode=run_mainMenu();
   notice_screen_contents_lost();
   resume_sound();
   if ((!(strcmp(prefs_df[0],uae4all_image_file0))) || ((!(strcmp(prefs_df[1],uae4all_image_file1)))))
	   menu_unraise();
   quit_text();
   vkbd_init();
#ifdef DREAMCAST
   SDL_DC_EmulateKeyboard(SDL_FALSE);
#endif
    getChanges();
	vkbd_init_button2();
    if (exitmode==1 || exitmode==2)
    {
    	    extern char *savestate_filename;
    	    extern int saveMenu_n_savestate;
	    for(int i=0;i<mainMenu_drives;i++)
	    {
		if (i==0 && strcmp(changed_df[0],uae4all_image_file0)) {
		    strcpy(changed_df[0],uae4all_image_file0);
		    real_changed_df[0]=1;
		}
		else if (i==1 && strcmp(changed_df[1],uae4all_image_file1)) {
		    strcpy(changed_df[1],uae4all_image_file1);
		    real_changed_df[1]=1;
		}
		else if (i==2 && strcmp(changed_df[2],uae4all_image_file2)) {
		    strcpy(changed_df[2],uae4all_image_file2);
		    real_changed_df[2]=1;
		}
		else if (i==3 && strcmp(changed_df[3],uae4all_image_file3)) {
		    strcpy(changed_df[3],uae4all_image_file3);
		    real_changed_df[3]=1;
		}
	    }
    	    strcpy(savestate_filename,uae4all_image_file0);
	    switch(saveMenu_n_savestate)
    	    {
	    	case 1:
    			strcat(savestate_filename,"-1.asf"); break;
	    	case 2:
    			strcat(savestate_filename,"-2.asf"); break;
	    	case 3:
    			strcat(savestate_filename,"-3.asf"); break;
	    	default:
    	   		strcat(savestate_filename,".asf");
    	    }
    }
    if (exitmode==3)
    {
    	    extern char *savestate_filename;
    	    extern int saveMenu_n_savestate;
	    for(int i=0;i<mainMenu_drives;i++)
	    {
		changed_df[i][0]=0;
		if (i==0) {
		    uae4all_image_file0[0]=0;
		    if (strcmp(changed_df[0],uae4all_image_file0))
		    {
			strcpy(changed_df[0],uae4all_image_file0);
			real_changed_df[0]=1;
		    }
		}
		else if (i==1) {
		    uae4all_image_file1[0]=0;
		    if (strcmp(changed_df[1],uae4all_image_file1))
		    {
			strcpy(changed_df[1],uae4all_image_file1);
			real_changed_df[1]=1;
		    }
		}
		else if (i==2) {
		    uae4all_image_file2[0]=0;
		    if (strcmp(changed_df[2],uae4all_image_file2))
		    {
			strcpy(changed_df[2],uae4all_image_file2);
			real_changed_df[2]=1;
		    }
		}
		else if (i==3) {
		    uae4all_image_file3[0]=0;
		    if (strcmp(changed_df[3],uae4all_image_file3))
		    {
			strcpy(changed_df[3],uae4all_image_file3);
			real_changed_df[3]=1;
		    }
		}
		disk_eject(i);
	    }
    	    strcpy(savestate_filename,uae4all_image_file0);
    	    switch(saveMenu_n_savestate)
    	    {
	   	case 1:
    			strcat(savestate_filename,"-1.asf"); break;
	    	case 2:
    			strcat(savestate_filename,"-2.asf"); break;
	    	case 3:
    			strcat(savestate_filename,"-3.asf"); break;
	    	default:
    	  	 	strcat(savestate_filename,".asf");
    	    }
    }
    if (exitmode==2)
    {
	    if (autosave!=mainMenu_autosave)
	    {
	    	prefs_df[0][0]=0;
	   		prefs_df[1][0]=0;
			prefs_df[2][0]=0;
	   		prefs_df[3][0]=0;
	    }
		if(gp2xButtonRemappingOn)
			togglemouse();
		int gp2xMouseEmuOn=0;
		int gp2xButtonRemappingOn=0;
	    uae_reset ();
    }
    check_all_prefs();
    gui_purge_events();
    notice_screen_contents_lost();
#ifdef DEBUG_FRAMERATE
    uae4all_update_time();
#endif
#ifdef PROFILER_UAE4ALL
    uae4all_prof_init();
#endif

}
Exemplo n.º 2
0
void init_text(int splash)
{
	SDL_Event ev;
	int toexit=0;
	SDL_Surface *sur;
	SDL_Rect r;
	int i,j;


	if (!text_screen)
	{

//		text_screen=SDL_ConvertSurface(screen,screen->format,0);
		text_screen=SDL_CreateRGBSurface(screen->flags,screen->w,screen->h,screen->format->BitsPerPixel,screen->format->Rmask,screen->format->Gmask,screen->format->Bmask,screen->format->Amask);
//		text_screen=SDL_DisplayFormat(screen);
		if (!text_screen)
		{
#ifdef STDOUTPUT
			puts("Unable to make a SDL_Surface (text_screen)");
#endif
			exit(-1);

		}
	}

#ifdef DREAMCAST
        __sdl_dc_emulate_keyboard=1;
#endif
	if (!splash)
	{
		menu_raise();
		return;
	}

	text_image2=load_img_0(MENU_FILE_TEXT2);
	font_inv.Surface=text_image2;
	SFont_InitFontInfo(&font_inv);

	text_image=load_img_0(MENU_FILE_TEXT);
	SFont_InitFont(text_image);

	text_win_uleft=load_img_255(MENU_FILE_WIN_ULEFT);
	text_win_uright=load_img_255(MENU_FILE_WIN_URIGHT);
	text_win_upper=load_img_255(MENU_FILE_WIN_UPPER);
	text_win_left=load_img_255(MENU_FILE_WIN_LEFT);
	text_win_right=load_img_255(MENU_FILE_WIN_RIGHT);
	text_win_bright=load_img_255(MENU_FILE_WIN_BRIGHT);
	text_win_bleft=load_img_255(MENU_FILE_WIN_BLEFT);
	text_win_bottom=load_img_255(MENU_FILE_WIN_BOTTOM);
	text_cdrom=menu_IMG_Load(MENU_FILE_LOADING);

	init_background();

	obten_colores();
	sound_play_menu_music();
#ifndef AUTO_EVENTS
	sur=menu_IMG_Load(MENU_FILE_SPLASH);
	r.x=(text_screen->w - sur->w)/2;
	r.y=(text_screen->h - sur->h)/2;
	r.h=sur->w;
	r.w=sur->h;
	SDL_FillRect(text_screen,NULL,0); //0xFFFFFFFF);
	while(SDL_PollEvent(&ev)) SDL_Delay(50);
	for (i=128;(i>-8)&&(!toexit);i-=8)
	{
#ifdef DREAMCAST
		vid_waitvbl();
#else
		SDL_Delay(50);
#endif
		SDL_FillRect(text_screen,NULL,0); //0xFFFFFFFF);
		SDL_BlitSurface(sur,NULL,text_screen,&r);
		fade16(text_screen,i);
		text_flip();
		while(SDL_PollEvent(&ev)) toexit=1;
	}
	for(i=0;(i<23)&&(!toexit);i++)
	{
		while(SDL_PollEvent(&ev)) toexit=1;
		SDL_Delay(100);
	}
	for(i=0;(i<128)&&(!toexit);i+=16)
	{
#ifdef DREAMCAST
		vid_waitvbl();
#else
		SDL_Delay(50);
#endif
		SDL_FillRect(text_screen,NULL,0); //0xFFFFFFFF);
		SDL_BlitSurface(sur,NULL,text_screen,&r);
		fade16(text_screen,i);
		text_flip();
		while(SDL_PollEvent(&ev)) toexit=1;
	}
	for(i=128;(i>-8)&&(!toexit);i-=8)
	{
#ifdef DREAMCAST
		vid_waitvbl();
#else
		SDL_Delay(50);
#endif
		text_draw_background();
		fade16(text_screen,i);
		text_flip();
		while(SDL_PollEvent(&ev)) toexit=1;
	}
	SDL_FreeSurface(sur);
#else
#ifndef DREAMCAST
	chdir(ROM_PREFIX);
#else
//	fs_chdir(ROM_PREFIX);
	fs_chdir("/");//ROM_PREFIX);
#endif
#endif
//	menu_msg_time=SDL_GetTicks();
}