Exemplo n.º 1
0
// Build the array of renderers
void CMenuDisplay::BuildRendererArray()
{
	// Clear the current renderer arrays
	unsigned int i;
	for (i=0; i < m_rendererArray.GetSize(); i++)
	{
		m_rendererArray[i].m_resolutionArray.SetSize(0);
	}
	m_rendererArray.SetSize(0);

	// Build the list of render modes
	RMode *pRenderModes=m_pClientDE->GetRenderModes();

	// Iterate through the list of render modes adding each one to the array
	RMode *pCurrentMode=pRenderModes;
	while (pCurrentMode != DNULL)
	{		
		// Get the index for this renderer
		int nRenderIndex=GetRendererIndex(pCurrentMode);

		// Check to see if we need to add this renderer
		if (nRenderIndex == -1)
		{
			MenuDisplayRenderer renderer;

			renderer.m_bHardware=pCurrentMode->m_bHardware;
			_mbscpy((unsigned char*)renderer.m_renderDll, (const unsigned char*)pCurrentMode->m_RenderDLL);
			_mbscpy((unsigned char*)renderer.m_description, (const unsigned char*)pCurrentMode->m_Description);
			_mbscpy((unsigned char*)renderer.m_internalName, (const unsigned char*)pCurrentMode->m_InternalName);

			m_rendererArray.Add(renderer);
			nRenderIndex=m_rendererArray.GetSize()-1;
		}

		// Add the display resolutions for this renderer
		MenuDisplayResolution resolution;
		resolution.m_dwWidth=pCurrentMode->m_Width;
		resolution.m_dwHeight=pCurrentMode->m_Height;
		resolution.m_dwBitDepth=pCurrentMode->m_BitDepth;

		m_rendererArray[nRenderIndex].m_resolutionArray.Add(resolution);

		// Go to the next render mode
		pCurrentMode=pCurrentMode->m_pNext;
	}

	// Free the linked list of render modes
	m_pClientDE->RelinquishRenderModes(pRenderModes);

	// Sort the render resolution based on screen width and height
	for (i=0; i < m_rendererArray.GetSize(); i++)
	{
		SortRenderModes(i);
	}
}
Exemplo n.º 2
0
// Build the array of renderers
void CScreenDisplay::GetRendererData()
{
	m_rendererData.m_description[0] = '\0';
	m_rendererData.m_internalName[0] = '\0';

	// Build the list of render modes
    RMode *pRenderModes=g_pLTClient->GetRenderModes();

	bool bHWTnL = true;

	RMode currentMode;
	if (g_pGameClientShell->IsRendererInitted() && g_pLTClient->GetRenderMode(&currentMode) == LT_OK)
	{
		bHWTnL = currentMode.m_bHWTnL;
	}


	// Iterate through the list of render modes adding each one to the array
	RMode *pCurrentMode=pRenderModes;
    while (pCurrentMode != LTNULL)
	{
		if (pCurrentMode->m_Width >= 640 && pCurrentMode->m_Height >= 480 && pCurrentMode->m_BitDepth == 32)
		{
			// disallow non-standard aspect ratios
			uint32 testWidth = (pCurrentMode->m_Height * 4 / 3);
			if (pCurrentMode->m_Width != testWidth)
			{
			
				// Go to the next render mode
				pCurrentMode=pCurrentMode->m_pNext;
				continue;
			}

			//disallow any that aren't hardware TnL
			if(bHWTnL && !pCurrentMode->m_bHWTnL)
			{
				pCurrentMode=pCurrentMode->m_pNext;
				continue;
			}

			// Check to see if we need to add this renderer
			if (!m_rendererData.m_description[0])
			{
				m_rendererData.m_bHWTnL = pCurrentMode->m_bHWTnL;
				SAFE_STRCPY(m_rendererData.m_description, pCurrentMode->m_Description);
				SAFE_STRCPY(m_rendererData.m_internalName, pCurrentMode->m_InternalName);

			}

			// Add the display resolutions for this renderer
			ScreenDisplayResolution resolution;
			resolution.m_dwWidth=pCurrentMode->m_Width;
			resolution.m_dwHeight=pCurrentMode->m_Height;
			resolution.m_dwBitDepth=pCurrentMode->m_BitDepth;

			LTBOOL bFound = LTFALSE;
			uint32 i = 0;
			while (!bFound && i < m_rendererData.m_resolutionArray.GetSize())
			{
				bFound = (ScreenDisplayCompare(&(m_rendererData.m_resolutionArray[i]), &resolution) == 0);
				++i;
			}
			if (!bFound)
				m_rendererData.m_resolutionArray.Add(resolution);
		}

		// Go to the next render mode
		pCurrentMode=pCurrentMode->m_pNext;
	}

	// Free the linked list of render modes
    g_pLTClient->RelinquishRenderModes(pRenderModes);

	// Sort the render resolution based on screen width and height
	SortRenderModes();
}