Example #1
0
int assess_graphic_device_resolutions ( void )
{

	int
		low_water_mark,
		high_water_mark,
		count;

	//
	// Go through all the physically available graphics modes, validating them
	//
	//	NB - this should only be used for FULLSCREEN running
	//

	number_of_graphics_resolution_modes_available = 0;

	switch ( ddraw.application_display_depth )
	{

		case 16:
		{

			high_water_mark = 16;

			low_water_mark = 12;

			break;
		}

		case 32:
		{

			high_water_mark = 22;

			low_water_mark = 32;

			break;
		}
	}

display_modes[0].palette = FALSE;
		display_modes[0].bpp_palette = 0;
		display_modes[0].bpp_red = 8;
		display_modes[0].bpp_green = 8;
		display_modes[0].bpp_blue = 8;
		display_modes[0].ddsd.dwWidth = 1024;
		display_modes[0].ddsd.dwHeight = 768;
		graphics_resolution_modes_available[0].width = 1024;
        graphics_resolution_modes_available[0].height = 768;
		graphics_resolution_modes_available[0].compressed_texture_mode = FALSE;
number_of_graphics_resolution_modes_available = 1;
number_display_modes=1;
return;

	if ( number_display_modes )
	{

		unsigned long
			dwStyle;

		//
		// Set the cooperative mode settings.
		//

		ddraw_set_cooperative_level ( COOPERATIVE_LEVEL_EXCLUSIVE );

		//
		// Setup the window style for a fullscreen application
		//
#ifdef _WIN32
		dwStyle = GetWindowStyle ( application_window );

		dwStyle &= ~( WS_OVERLAPPED | WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX );

		dwStyle |= WS_POPUP;

		SetWindowLong ( application_window, GWL_STYLE, dwStyle );
#endif
		//
		// Go through all the graphics modes
		//

		for ( count = 0; count < number_display_modes; count++ )
		{

			if ( !display_modes[count].palette )
			{

				int
					depth;

				depth = ( display_modes[count].bpp_red + display_modes[count].bpp_green + display_modes[count].bpp_blue );

				if (1)//รถ ( depth >= low_water_mark ) && ( depth <= high_water_mark ) )
				{

					int
						width,
						height;

					width = display_modes[count].ddsd.dwWidth;

					height = display_modes[count].ddsd.dwHeight;

					if ( supported_resolution ( width, height ) )
					{

						if ( test_video_resolution ( width, height, ddraw.application_display_depth ) )
						{

							debug_log ( "Graphics mode: %d x %d enabled", width, height );

							graphics_resolution_modes_available[number_of_graphics_resolution_modes_available].width = width;
							graphics_resolution_modes_available[number_of_graphics_resolution_modes_available].height = height;
							graphics_resolution_modes_available[number_of_graphics_resolution_modes_available].compressed_texture_mode = FALSE;

							number_of_graphics_resolution_modes_available++;
/*
							//
							// Create the d3d device & set its abilities
							//

							if ( create_test_d3d_device ( width, height ) )
							{

								//
								// Now check for available texture memory
								//

								initialise_system_texture_formats ();

								compress_system_textures = FALSE;

								{

									//
									// We can go into this mode
									//

									debug_log ( "Graphics mode: %d x %d enabled", width, height );

									graphics_resolution_modes_available[number_of_graphics_resolution_modes_available].width = width;
									graphics_resolution_modes_available[number_of_graphics_resolution_modes_available].height = height;
									graphics_resolution_modes_available[number_of_graphics_resolution_modes_available].compressed_texture_mode = FALSE;

									number_of_graphics_resolution_modes_available++;
								}
							}

							//
							// Release the d3d device
							//

							release_test_d3d_device ();
							*/
						}
					}
				}
			}
		}

		//
		// Reset the cooperative mode settings
		//

		ddraw_set_cooperative_level ( COOPERATIVE_LEVEL_NORMAL );

		//
		// Release any surface pointers
		//

		release_ddraw_surface_pointers ();
	}

	return ( TRUE );
}
Example #2
0
int assess_graphic_device_resolutions ( void )
{
	int
		low_water_mark,
		high_water_mark,
		count;

	//
	// Go through all the physically available graphics modes, validating them
	//
	//	NB - this should only be used for FULLSCREEN running
	//

	number_of_graphics_resolution_modes_available = 0;

	switch ( command_line_display_bpp )
	{
		case 16:
		{
			high_water_mark = 16;
			low_water_mark = 12;
			break;
		}

		case 32:
		{
			high_water_mark = 32;
			low_water_mark = 24;
			break;
		}

		default:
			ASSERT ( FALSE );
	}

	if ( number_display_modes )
	{
		DWORD
			dwStyle;
	
		//
		// Set the cooperative mode settings.
		//
		ddraw_set_cooperative_level ( COOPERATIVE_LEVEL_EXCLUSIVE );
	
		//
		// Setup the window style for a fullscreen application
		//
		dwStyle = GetWindowStyle ( application_window );
		dwStyle &= ~( WS_OVERLAPPED | WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX );
		dwStyle |= WS_POPUP;
		SetWindowLong ( application_window, GWL_STYLE, dwStyle );

		//
		// Go through all the graphics modes
		//
		for ( count = 0; count < number_display_modes; count++ )
		{
			if ( !display_modes[count].palette )
			{
				int
					depth;
				depth = ( display_modes[count].bpp_red + display_modes[count].bpp_green + display_modes[count].bpp_blue );
				if ( ( depth >= low_water_mark ) && ( depth <= high_water_mark ) )
				{
					int
						width,
						height;
					width = display_modes[count].ddsd.dwWidth;
					height = display_modes[count].ddsd.dwHeight;
					if ( supported_resolution ( width, height ) )
					{
						if ( f3d_test_video_resolution ( width, height, command_line_display_bpp ) )
						{
							debug_log ( "Graphics mode: %d x %d enabled", width, height );
							graphics_resolution_modes_available[number_of_graphics_resolution_modes_available].width = width;
							graphics_resolution_modes_available[number_of_graphics_resolution_modes_available].height = height;
							graphics_resolution_modes_available[number_of_graphics_resolution_modes_available].compressed_texture_mode = FALSE;

							number_of_graphics_resolution_modes_available++;
/*
							//
							// Create the d3d device & set its abilities
							//
							if ( create_test_d3d_device ( width, height ) )
							{
								//
								// Now check for available texture memory
								//
								initialise_system_texture_formats ();
								compress_system_textures = FALSE;
								{
									//
									// We can go into this mode
									//
									debug_log ( "Graphics mode: %d x %d enabled", width, height );
									graphics_resolution_modes_available[number_of_graphics_resolution_modes_available].width = width;
									graphics_resolution_modes_available[number_of_graphics_resolution_modes_available].height = height;
									graphics_resolution_modes_available[number_of_graphics_resolution_modes_available].compressed_texture_mode = FALSE;
		
									number_of_graphics_resolution_modes_available++;
								}
							}

							//
							// Release the d3d device
							//
							release_test_d3d_device ();
							*/
						}
						else
							debug_log ( "%d x %d failed video resolution test!", width, height );
					}
					else
						debug_log ( "%d x %d is below minimum resolution dimensions 640x480!", width, height );
				}
			}
		}

		//
		// Reset the cooperative mode settings
		//
		ddraw_set_cooperative_level ( COOPERATIVE_LEVEL_NORMAL );
	}

	return ( TRUE );
}