示例#1
0
文件: vid_so.c 项目: AJenbo/Quake-2
/*
============
VID_CheckChanges

This function gets called once just before drawing each frame, and it's sole purpose in life
is to check to see if any of the video mode parameters have changed, and if they have to 
update the rendering DLL and/or video mode to match.
============
*/
void VID_CheckChanges (void)
{
	char name[100];
	cvar_t *sw_mode;

	if ( vid_ref->modified )
	{
		S_StopAllSounds();
	}

	while (vid_ref->modified)
	{
		/*
		** refresh has changed
		*/
		vid_ref->modified = false;
		vid_fullscreen->modified = true;
		cl.refresh_prepped = false;
		cls.disable_screen = true;

		sprintf( name, "ref_%s.so", vid_ref->string );
		if ( !VID_LoadRefresh( name ) )
		{
			if ( strcmp (vid_ref->string, "soft") == 0 ||
				strcmp (vid_ref->string, "softx") == 0 ) {
Com_Printf("Refresh failed\n");
				sw_mode = Cvar_Get( "sw_mode", "0", 0 );
				if (sw_mode->value != 0) {
Com_Printf("Trying mode 0\n");
					Cvar_SetValue("sw_mode", 0);
					if ( !VID_LoadRefresh( name ) )
						Com_Error (ERR_FATAL, "Couldn't fall back to software refresh!");
				} else
					Com_Error (ERR_FATAL, "Couldn't fall back to software refresh!");
			}

			/* prefer to fall back on X if active */
			if (getenv("DISPLAY"))
				Cvar_Set( "vid_ref", "softx" );
			else
				Cvar_Set( "vid_ref", "soft" );

			/*
			** drop the console if we fail to load a refresh
			*/
			if ( cls.key_dest != key_console )
			{
				Con_ToggleConsole_f();
			}
		}
		cls.disable_screen = false;
	}

}
示例#2
0
文件: vid.c 项目: Nekrofage/Quake2RPi
/*
 * This function gets called once just before drawing each frame, and
 * it's sole purpose in life is to check to see if any of the video mode
 * parameters have changed, and if they have to update the rendering DLL
 * and/or video mode to match.
 */
void
VID_CheckChanges ( void )
{
	char name [ 100 ];

	if ( vid_ref->modified )
	{
		S_StopAllSounds();
	}

	while ( vid_ref->modified )
	{
		/* refresh has changed */
		vid_ref->modified = false;
		vid_fullscreen->modified = true;
		cl.refresh_prepped = false;
		cls.disable_screen = true;

		sprintf( name, "ref_%s.so", vid_ref->string );

		if ( !VID_LoadRefresh( name ) )
		{
			Cvar_Set( "vid_ref", "gl" );
		}

		cls.disable_screen = false;
	}
}
示例#3
0
文件: vid_dll.c 项目: mattx86/myq2
/*
============
VID_CheckChanges

This function gets called once just before drawing each frame, and it's sole purpose in life
is to check to see if any of the video mode parameters have changed, and if they have to 
update the rendering DLL and/or video mode to match.
============
*/
void VID_CheckChanges (void)
{
	if ( win_noalttab->modified )
	{
		if ( win_noalttab->value )
		{
			WIN_DisableAltTab();
		}
		else
		{
			WIN_EnableAltTab();
		}
		win_noalttab->modified = false;
	}

	if ( vid_ref_modified /*vid_ref->modified*/ )
	{
		cl.force_refdef = true;		// can't use a paused refdef
		S_StopAllSounds();
	}
	while ( vid_ref_modified /*vid_ref->modified*/ )
	{
		/*
		** refresh has changed
		*/
		vid_ref_modified = false;
		/*vid_ref->modified = false;*/
		vid_fullscreen->modified = true;
		cl.refresh_prepped = false;
		cls.disable_screen = true;

		if ( !VID_LoadRefresh() )
		{
			/*
			** drop the console if we fail to load a refresh
			*/
			if ( cls.key_dest != key_console )
			{
				Con_ToggleConsole_f();
			}
		}
		cls.disable_screen = false;
	}

	/*
	** update our window position
	*/
	if ( vid_xpos->modified || vid_ypos->modified )
	{
		if (!vid_fullscreen->value)
			VID_UpdateWindowPosAndSize( vid_xpos->value, vid_ypos->value );

		vid_xpos->modified = false;
		vid_ypos->modified = false;
	}
}
示例#4
0
void VID_CheckChanges (void)
{
    char name[100];

    if (vid_ref->modified)
    {
        S_StopAllSounds();
    }

    while (vid_ref->modified)
    {
        // refresh has changed
        vid_ref->modified = false;
        vid_fullscreen->modified = true;
        cl.refresh_prepped = false;
        cls.disable_screen = true;

        sprintf(name, "ref_%s.so", vid_ref->string );

        if (!VID_LoadRefresh(name))
        {
            if (strcmp (vid_ref->string, "pbgl") == 0 ||
                    strcmp (vid_ref->string, "pbsdl") == 0 ) {
                Com_Error (ERR_FATAL, "Couldn't load gl refresh!");
            }

            if (getenv("DISPLAY"))
                Cvar_Set( "vid_ref", "pbgl" );
            else
                Cvar_Set( "vid_ref", "pbsdl" );

            // drop the console if we fail to load a refresh
            if (cls.key_dest != key_console)
            {
                Con_ToggleConsole_f();
            }
        }

        if (!vid_ref->modified)
        {
            cls.disable_screen = false;
            CL_InitImages();
            M_ReloadMenu(); // jitmenu
        }
    }
}
示例#5
0
/*
 * This function gets called once just before drawing each frame, and
 * it's sole purpose in life is to check to see if any of the video mode
 * parameters have changed, and if they have to update the refresh
 * and/or video mode to match.
 */
void
VID_CheckChanges(void)
{
	if (vid_fullscreen->modified)
	{
		S_StopAllSounds();

		/* refresh has changed */
		vid_fullscreen->modified = true;
		cl.refresh_prepped = false;
		cl.cinematicpalette_active = false;
		cls.disable_screen = true;

		// Proceed to reboot the refresher
		VID_LoadRefresh();
		cls.disable_screen = false;
	}
}
示例#6
0
void	VID_CheckChanges (void)
{
	if ( vid_ref->modified )
	{
		S_StopAllSounds();
	}

	while (vid_ref->modified)
	{
		/*
		** refresh has changed
		*/
		vid_ref->modified = false;
		vid_fullscreen->modified = true;
		cl.refresh_prepped = false;
		cls.disable_screen = true;

		if ( !VID_LoadRefresh() )
		{
			Com_Error (ERR_FATAL, "Failed to load refresh.");
		}
		cls.disable_screen = false;
	}
}
示例#7
0
/*
============
VID_CheckChanges

This function gets called once just before drawing each frame, and it's sole purpose in life
is to check to see if any of the video mode parameters have changed, and if they have to 
update the rendering DLL and/or video mode to match.
============
*/
void VID_CheckChanges (void)
{
	char name[100];

	if ( win_noalttab->modified )
	{
		if ( win_noalttab->value )
		{
			WIN_DisableAltTab();
		}
		else
		{
			WIN_EnableAltTab();
		}
		win_noalttab->modified = 0;
	}

	if ( vid_ref->modified )
	{
		cl.force_refdef = 1;		// can't use a paused refdef
		S_StopAllSounds();
		Cam_Reset_f ();				// NeVo - reset the camera
	}
	while (vid_ref->modified)
	{
		/*
		** refresh has changed
		*/
		vid_ref->modified = 0;
		vid_fullscreen->modified = 1;
		cl.refresh_prepped = 0;
		cls.disable_screen = 1;

		Com_sprintf( name, sizeof(name), "ref_%s.dll", vid_ref->string );
		if ( !VID_LoadRefresh( name ) )
		{
			if ( strcmp (vid_ref->string, "soft") == 0 )
				Com_Error (ERR_FATAL, "Couldn't fall back to software refresh!");
			Cvar_Set( "vid_ref", "soft" );

			/*
			** drop the console if we fail to load a refresh
			*/
			if ( cls.key_dest != key_console )
			{
				Con_ToggleConsole_f();
			}
		}
		cls.disable_screen = 0;
	}

	/*
	** update our window position
	*/
	if ( vid_xpos->modified || vid_ypos->modified )
	{
		if (!vid_fullscreen->value)
			VID_UpdateWindowPosAndSize( vid_xpos->value, vid_ypos->value );

		vid_xpos->modified = 0;
		vid_ypos->modified = 0;
	}
}
示例#8
0
void VID_CheckChanges (void)
{
	char name[100];

	if (win_noalttab->modified)
	{
		if (win_noalttab->value)
			WIN_DisableAltTab();
		else
			WIN_EnableAltTab();

		win_noalttab->modified = false;
	}

	if (vid_ref->modified)
	{
		cl.force_refdef = true;		// can't use a paused refdef
		S_StopAllSounds();
	}

	while (vid_ref->modified)
	{
		char driverstring[32]; // jit
		cvar_t *gl_driver; // jit

		gl_driver = Cvar_Get("gl_driver", "opengl32", CVAR_ARCHIVE); // jit
		Com_sprintf(driverstring, sizeof(driverstring), "%s", gl_driver->string);
		Cvar_Get("gl_swapinterval", "0", CVAR_ARCHIVE)->modified = true; // jit

		/*
		** refresh has changed, jitodo, cheatcheck!
		*/
		vid_ref->modified = false;
		vid_fullscreen->modified = true;
		cl.refresh_prepped = false;
		cls.disable_screen = true;

		// jit -- only allow opengl32 or 3dfxgl:
		if (!Q_streq(gl_driver->string, "opengl32") && !Q_streq(gl_driver->string, "3dfxgl"))
			Cvar_Set("gl_driver", "opengl32");

//		Com_sprintf(name, sizeof(name), "ref_%s.dll", vid_ref->string );
		Com_sprintf(name, sizeof(name), "ref_pbgl.dll"); // jit

		if (!VID_LoadRefresh(name))
		{
			// jit3dfx - check if driver string changed:
			if (!Q_streq(gl_driver->string, driverstring)) 
			{
				vid_ref->modified = true;
				Q_strncpyz(driverstring, gl_driver->string, sizeof(driverstring));
			}

			if (!vid_ref->modified) // jit
				Com_Error(ERR_FATAL, "Unable to load OpenGL refresh!"); // jit

			// drop the console if we fail to load a refresh
			if (cls.key_dest != key_console)
				Con_ToggleConsole_f();
		}

		if (!vid_ref->modified) // jit3dfx
		{
			cls.disable_screen = false;
			CL_InitImages();
			M_ReloadMenu(); // jitmenu (need to do a full reload beacuse pic indexes can change)
		}
	}

	/*
	** update our window position
	*/
	if ( vid_xpos->modified || vid_ypos->modified )
	{
		if (!vid_fullscreen->value)
			VID_UpdateWindowPosAndSize( vid_xpos->value, vid_ypos->value );

		vid_xpos->modified = false;
		vid_ypos->modified = false;
	}
}
示例#9
0
/*
============
VID_CheckChanges

This function gets called once just before drawing each frame, and it's sole purpose in life
is to check to see if any of the video mode parameters have changed, and if they have to 
update the rendering DLL and/or video mode to match.
============
*/
void VID_CheckChanges (void)
{
	char name[128];
	//cvar_t *sw_mode;
	char reason[128];
	char *drive_try;
	int i;

	if ( vid_ref->modified )
	{
		S_StopAllSounds();
	}

	while (vid_ref->modified)
	{
		/*
		** refresh has changed
		*/
		vid_ref->modified = false;
		vid_fullscreen->modified = true;
		cl.refresh_prepped = false;
		cls.disable_screen = true;

		sprintf( name, "%s", Cvar_Get ("gl_driver", "libGL", CVAR_ARCHIVE)->string);

		for (i = -1; i < FALLBACK_DRIVER_COUNT; i++)
		{
			
			drive_try = (i<0)? name:opengl_drivers[i];

			Com_Printf("Attempted driver load: %s\n",drive_try);			
			gl_string=malloc(1+sizeof(char)*strlen(drive_try));
			if (!gl_string)
			    Com_Error (ERR_FATAL,"VID_CheckChanges: String Malloc fail\n");
			
			strcpy(gl_string,drive_try);
			Cvar_ForceSet("gl_driver",gl_string);
			
			
			if (VID_LoadRefresh(drive_try))
			{
			    Com_Printf("Loading driver: %s\n",drive_try);
			    break;
			}
			
		}
		
		Com_Printf("Set gl_driver to %s\n",drive_try);



		if (i >= FALLBACK_DRIVER_COUNT)
		{
		    Com_Error(ERR_FATAL, "VID_CheckChanges: No suitable GL driver\n");
		}


		gl_string=malloc(1+sizeof(char)*strlen(drive_try));
		if (!gl_string)
			Com_Error (ERR_FATAL,"VID_CheckChanges: String Malloc fail\n");

		strcpy(gl_string,drive_try);
		Cvar_ForceSet("gl_driver",gl_string);
		Com_Printf("Set gl_driver to %s\n",drive_try);
		
		/*
		if (!R_Init( 0, 0, reason) == -1)
		  {
		    R_Shutdown();
		    VID_FreeReflib();
		    Com_Error("Couldn't initialize renderer: %s",reason);
		  }
		*/
		cls.disable_screen = false;
	}




}