Example #1
0
void CDX8Disp::UpdateResList(
	unsigned int requested_width, unsigned int requested_height, int requested_cdepth)
{
	
	int selected_sel = -1;

 	m_res_list.ResetContent();
 	if(d3d_interface == NULL) return;

	int selected_adapter  = m_adapter_list.GetCurSel();
	int num_modes		  = d3d_interface->GetAdapterModeCount(selected_adapter);
//num_modes = 2;
	// Only list different resolutions and bit type NOT different refresh rates
	int index_count = 0;
	for(int i = num_modes - 1; i >= 0; i--)
	{
		D3DDISPLAYMODE mode;
		if(FAILED(d3d_interface->EnumAdapterModes(selected_adapter, i, &mode)))
		{
			MessageBox("Failed EnumAdapterModes", "Error", MB_ICONERROR);
			return;
		}

		bool non_standard_match = 
			(mode.Width == requested_width && 
			 mode.Height == requested_height &&
			d3d_get_mode_bit(mode.Format) == requested_cdepth);

		// ignore invalid modes unless we have an exact match (user picked non standard mode last time)
		if(m_allow_only_standard_modes && !non_standard_match)
		{
			// Just the standard modes
			if(/*	!(mode.Width == 1280 && mode.Height == 1024) &&*/
				!(mode.Width == 1024 && mode.Height == 768) &&
				!(mode.Width == 640 && mode.Height == 480))
			{
				DBUGFILE_OUTPUT_0("Chuck this mode its not standard");
				continue;
			}
		}
	/*	else
		{
			// Anything above the minimum
			if(	!(mode.Width == 640 && mode.Height == 480) &&
				(mode.Width < 800 || mode.Height < 600))
			{
				DBUGFILE_OUTPUT_0("Chuck this mode its too low");
		  		continue;
			}
		}*/

		// Lets look ahead and get the lowest refresh rate
		// Cant assume there will be at least 60 or 0
		while(i > 0)
		{
			D3DDISPLAYMODE next_mode;
			if(FAILED(d3d_interface->EnumAdapterModes(selected_adapter, i-1, &next_mode)))
			{
				MessageBox("Failed EnumAdapterModes", "Fatal Error", MB_ICONERROR);
				return;
			}

			// Modes are the same execpt refresh rate
			if( mode.Width == next_mode.Width && 
				mode.Height == next_mode.Height && 
				d3d_get_mode_bit(mode.Format) == d3d_get_mode_bit(next_mode.Format)) 
			{
				DBUGFILE_OUTPUT_2("Changing stored mode from %d to %d", i, i-1);
				i--;
			}
			else
			{
				DBUGFILE_OUTPUT_0("Not the same, next!");
				break;
			}
		}

		char mode_string[20];
		sprintf(mode_string, "%dx%dx%d", mode.Width, mode.Height, d3d_get_mode_bit(mode.Format));
		
		// stupid hack to get around 640x480 res getting displayed more then once
		if (m_res_list.FindString(1, mode_string) < 0) {
		
			int index = m_res_list.InsertString(index_count, mode_string);
			m_res_list.SetItemData(index, i);
			
			if( requested_width  == mode.Width &&
				requested_height == mode.Height &&
				requested_cdepth == d3d_get_mode_bit(mode.Format))

			{
	   			selected_sel = index_count;
			} 

			index_count++;
		}
	}

	if(selected_sel < 0) selected_sel = 0;

	m_res_list.SetCurSel(selected_sel);
 	UpdateAntialiasList();




}
Example #2
0
void CDX8Disp::UpdateAntialiasList(int select)
{
 	m_antialias_list.ResetContent();
	if(d3d_interface == NULL) 
	{
		DBUGFILE_OUTPUT_0("d3d_interface == NULL");
		return;
	}

	int selected_adapter  = m_adapter_list.GetCurSel();
	int selected_mode	  = m_res_list.GetItemData(m_res_list.GetCurSel());

	D3DDISPLAYMODE mode;
	if(FAILED(d3d_interface->EnumAdapterModes(selected_adapter, selected_mode, &mode))) 
	{
		MessageBox("Failed EnumAdapterModes in UpdateAntialiasList", "Fatal Error", MB_ICONERROR);
		return;
	}

	// Now fill the avaliable anti aliasing  for this mode
	typedef struct {
		int   type;
		char *text;
	} MultisampleInfo;

	const int MAX_MULTISAMPLE = 17;
	const MultisampleInfo multisample_info[MAX_MULTISAMPLE] =
	{
 		D3DMULTISAMPLE_NONE,     "D3DMULTISAMPLE_NONE",
		D3DMULTISAMPLE_2_SAMPLES,"D3DMULTISAMPLE_2_SAMPLES",
		D3DMULTISAMPLE_3_SAMPLES,"D3DMULTISAMPLE_3_SAMPLES",
		D3DMULTISAMPLE_4_SAMPLES,"D3DMULTISAMPLE_4_SAMPLES",
		D3DMULTISAMPLE_5_SAMPLES,"D3DMULTISAMPLE_5_SAMPLES",
		D3DMULTISAMPLE_6_SAMPLES,"D3DMULTISAMPLE_6_SAMPLES",
		D3DMULTISAMPLE_7_SAMPLES,"D3DMULTISAMPLE_7_SAMPLES",
		D3DMULTISAMPLE_8_SAMPLES,"D3DMULTISAMPLE_8_SAMPLES",
		D3DMULTISAMPLE_9_SAMPLES,"D3DMULTISAMPLE_9_SAMPLES",
		D3DMULTISAMPLE_10_SAMPLES,"D3DMULTISAMPLE_10_SAMPLES",
		D3DMULTISAMPLE_11_SAMPLES,"D3DMULTISAMPLE_11_SAMPLES",
		D3DMULTISAMPLE_12_SAMPLES,"D3DMULTISAMPLE_12_SAMPLES",
		D3DMULTISAMPLE_13_SAMPLES,"D3DMULTISAMPLE_13_SAMPLES",
		D3DMULTISAMPLE_14_SAMPLES,"D3DMULTISAMPLE_14_SAMPLES",
		D3DMULTISAMPLE_15_SAMPLES,"D3DMULTISAMPLE_15_SAMPLES",
		D3DMULTISAMPLE_16_SAMPLES,"D3DMULTISAMPLE_16_SAMPLES"
	};


	for(int i = 0; i < MAX_MULTISAMPLE; i++) 
	{		
		if( FAILED( d3d_interface->CheckDeviceMultiSampleType( 
			selected_adapter, 
			D3DDEVTYPE_HAL , 
			mode.Format, FALSE, 
			(D3DMULTISAMPLE_TYPE) multisample_info[i].type ) ) ) {
			 break;
		}

		m_antialias_list.InsertString(i, multisample_info[i].text);
	}

	if(select > MAX_MULTISAMPLE)
		select = 0;


	m_antialias_list.SetCurSel(select);
}
Example #3
0
void CDX8Disp::UpdateAntialiasList(int select)
{
 	m_antialias_list.ResetContent();
	if(d3d_interface == NULL) 
	{
		DBUGFILE_OUTPUT_0("d3d_interface == NULL");
		return;
	}

	int selected_adapter  = m_adapter_list.GetCurSel();
	int selected_mode	  = m_res_list.GetItemData(m_res_list.GetCurSel());

	D3DDISPLAYMODE mode;
	if(FAILED(d3d_interface->EnumAdapterModes(selected_adapter, selected_mode, &mode))) 
	{
		MessageBox("Failed EnumAdapterModes in UpdateAntialiasList", "Fatal Error", MB_ICONERROR);
		return;
	}

	{
		// do a quick standard res check while we're here...

		// identify whether this is one of the standard video modes or not
		bool standard_match = ((mode.Width == 1024 && mode.Height == 768) ||
							(mode.Width == 640 && mode.Height == 480));

		// show or hide the non-standard video mode text if needed
		GetDlgItem(IDC_NSVM_TEXT)->ShowWindow( (standard_match) ? SW_HIDE : SW_SHOW );
	}


	// Now fill the avaliable anti aliasing  for this mode
	typedef struct {
		int   type;
		char *text;
	} MultisampleInfo;

	const int MAX_MULTISAMPLE = 16;
	const MultisampleInfo multisample_info[MAX_MULTISAMPLE] =
	{
 		D3DMULTISAMPLE_NONE,     "D3DMULTISAMPLE_NONE",
		D3DMULTISAMPLE_2_SAMPLES,"D3DMULTISAMPLE_2_SAMPLES",
		D3DMULTISAMPLE_3_SAMPLES,"D3DMULTISAMPLE_3_SAMPLES",
		D3DMULTISAMPLE_4_SAMPLES,"D3DMULTISAMPLE_4_SAMPLES",
		D3DMULTISAMPLE_5_SAMPLES,"D3DMULTISAMPLE_5_SAMPLES",
		D3DMULTISAMPLE_6_SAMPLES,"D3DMULTISAMPLE_6_SAMPLES",
		D3DMULTISAMPLE_7_SAMPLES,"D3DMULTISAMPLE_7_SAMPLES",
		D3DMULTISAMPLE_8_SAMPLES,"D3DMULTISAMPLE_8_SAMPLES",
		D3DMULTISAMPLE_9_SAMPLES,"D3DMULTISAMPLE_9_SAMPLES",
		D3DMULTISAMPLE_10_SAMPLES,"D3DMULTISAMPLE_10_SAMPLES",
		D3DMULTISAMPLE_11_SAMPLES,"D3DMULTISAMPLE_11_SAMPLES",
		D3DMULTISAMPLE_12_SAMPLES,"D3DMULTISAMPLE_12_SAMPLES",
		D3DMULTISAMPLE_13_SAMPLES,"D3DMULTISAMPLE_13_SAMPLES",
		D3DMULTISAMPLE_14_SAMPLES,"D3DMULTISAMPLE_14_SAMPLES",
		D3DMULTISAMPLE_15_SAMPLES,"D3DMULTISAMPLE_15_SAMPLES",
		D3DMULTISAMPLE_16_SAMPLES,"D3DMULTISAMPLE_16_SAMPLES"
	};


	for(int i = 0; i < MAX_MULTISAMPLE; i++) 
	{		
		if( FAILED( d3d_interface->CheckDeviceMultiSampleType( 
			selected_adapter, 
			D3DDEVTYPE_HAL , 
			mode.Format, FALSE, 
			(D3DMULTISAMPLE_TYPE) multisample_info[i].type ) ) ) {
			 break;
		}

		m_antialias_list.InsertString(i, multisample_info[i].text);
	}

	if(select > MAX_MULTISAMPLE)
		select = 0;


	m_antialias_list.SetCurSel(select);
}