Fixed: Wrong driver version in Ryzom Configurator
Fixed: Typo in "width"
This commit is contained in:
parent
d4ca2673cb
commit
da67ac8517
3 changed files with 57 additions and 63 deletions
|
@ -70,7 +70,7 @@ void CDisplaySettingsWidget::load()
|
|||
|
||||
|
||||
CVideoMode mode;
|
||||
mode.widht = s.config.getInt( "Width" );
|
||||
mode.width = s.config.getInt( "Width" );
|
||||
mode.height = s.config.getInt( "Height" );
|
||||
mode.depth = s.config.getInt( "Depth" );
|
||||
mode.frequency = s.config.getInt( "Frequency" );
|
||||
|
@ -85,7 +85,7 @@ void CDisplaySettingsWidget::load()
|
|||
windowedRadioButton->setChecked( true );
|
||||
}
|
||||
|
||||
widthLineEdit->setText( QString( "%1" ).arg( mode.widht ) );
|
||||
widthLineEdit->setText( QString( "%1" ).arg( mode.width ) );
|
||||
heightLineEdit->setText( QString( "%1" ).arg( mode.height ) );
|
||||
xpositionLineEdit->setText( QString( "%1" ).arg( s.config.getInt( "PositionX" ) ) );
|
||||
ypositionLineEdit->setText( QString( "%1" ).arg( s.config.getInt( "PositionY" ) ) );
|
||||
|
@ -116,7 +116,7 @@ void CDisplaySettingsWidget::save()
|
|||
else
|
||||
mode = s.openglInfo.modes[ index ];
|
||||
|
||||
s.config.setInt( "Width", mode.widht );
|
||||
s.config.setInt( "Width", mode.width );
|
||||
s.config.setInt( "Height", mode.height );
|
||||
s.config.setInt( "Depth", mode.depth );
|
||||
s.config.setInt( "Frequency", mode.frequency );
|
||||
|
|
|
@ -16,17 +16,15 @@
|
|||
|
||||
#include "stdpch.h"
|
||||
#include "system.h"
|
||||
#include <sstream>
|
||||
|
||||
#include <nel/3d/driver.h>
|
||||
#include <nel/3d/dru.h>
|
||||
#include <QtOpenGL/QGLWidget>
|
||||
|
||||
CSystem *CSystem::instance = NULL;
|
||||
|
||||
CSystem::CSystem()
|
||||
{
|
||||
GatherSysInfo();
|
||||
#ifdef WIN32
|
||||
#ifdef Q_OS_WIN32
|
||||
GatherD3DInfo();
|
||||
#endif
|
||||
GatherOpenGLInfo();
|
||||
|
@ -34,9 +32,32 @@ CSystem::CSystem()
|
|||
|
||||
CSystem::~CSystem()
|
||||
{
|
||||
instance = 0;
|
||||
}
|
||||
|
||||
bool CSystem::parseDriverVersion(const std::string &device, uint64 driver, std::string &version)
|
||||
{
|
||||
// file version
|
||||
uint32 version1 = driver >> 48;
|
||||
uint32 version2 = (driver >> 32) & 0xffff;
|
||||
uint32 version3 = (driver >> 16) & 0xffff;
|
||||
uint32 version4 = driver & 0xffff;
|
||||
|
||||
if (device.find("NVIDIA") != std::string::npos)
|
||||
{
|
||||
// nvidia should be something like 9.18.13.2018 and 9.18.13.1422
|
||||
// which respectively corresponds to drivers 320.18 and 314.22
|
||||
uint32 nvVersionMajor = (version3 % 10) * 100 + (version4 / 100);
|
||||
uint32 nvVersionMinor = version4 % 100;
|
||||
|
||||
version = NLMISC::toString("%u.%u", nvVersionMajor, nvVersionMinor);
|
||||
}
|
||||
else
|
||||
{
|
||||
version = NLMISC::toString("%u.%u.%u.%u", version1, version2, version3, version4);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CSystem::GatherSysInfo()
|
||||
{
|
||||
|
@ -47,24 +68,7 @@ void CSystem::GatherSysInfo()
|
|||
{
|
||||
sysInfo.videoDevice = device;
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// FIXME
|
||||
// This is taken from the original configuration tool, and
|
||||
// it generates the same *wrong* version number
|
||||
//////////////////////////////////////////////////////////////
|
||||
uint32 version = static_cast< uint32 >( driver & 0xffff );
|
||||
std::stringstream ss;
|
||||
|
||||
ss << ( version / 1000 % 10 );
|
||||
ss << ".";
|
||||
ss << ( version / 100 % 10 );
|
||||
ss << ".";
|
||||
ss << ( version / 10 % 10 );
|
||||
ss << ".";
|
||||
ss << ( version % 10 );
|
||||
|
||||
sysInfo.videoDriverVersion = ss.str();
|
||||
//////////////////////////////////////////////////////////////
|
||||
CSystem::parseDriverVersion(device, driver, sysInfo.videoDriverVersion);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -78,7 +82,7 @@ void CSystem::GatherSysInfo()
|
|||
sysInfo.totalRAM /= ( 1024 * 1024 );
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef Q_OS_WIN32
|
||||
void CSystem::GatherD3DInfo()
|
||||
{
|
||||
NL3D::IDriver *driver = NULL;
|
||||
|
@ -93,16 +97,7 @@ void CSystem::GatherD3DInfo()
|
|||
d3dInfo.device = adapter.Description;
|
||||
d3dInfo.driver = adapter.Driver;
|
||||
|
||||
sint64 ver = adapter.DriverVersion;
|
||||
std::stringstream ss;
|
||||
ss << static_cast< uint16 >( ver >> 48 );
|
||||
ss << ".";
|
||||
ss << static_cast< uint16 >( ver >> 32 );
|
||||
ss << ".";
|
||||
ss << static_cast< uint16 >( ver >> 16 );
|
||||
ss << ".";
|
||||
ss << static_cast< uint16 >( ver & 0xFFFF );
|
||||
d3dInfo.driverVersion = ss.str();
|
||||
CSystem::parseDriverVersion(d3dInfo.device, adapter.DriverVersion, d3dInfo.driverVersion);
|
||||
}
|
||||
|
||||
GetVideoModes( d3dInfo.modes, driver );
|
||||
|
@ -110,7 +105,7 @@ void CSystem::GatherD3DInfo()
|
|||
driver->release();
|
||||
}
|
||||
|
||||
catch( NLMISC::Exception &e )
|
||||
catch(const NLMISC::Exception &e)
|
||||
{
|
||||
nlwarning( e.what() );
|
||||
}
|
||||
|
@ -147,15 +142,13 @@ void CSystem::GatherOpenGLInfo()
|
|||
|
||||
delete gl;
|
||||
|
||||
NL3D::IDriver *driver = NULL;
|
||||
try
|
||||
{
|
||||
driver = NL3D::CDRU::createGlDriver();
|
||||
NL3D::IDriver *driver = NL3D::CDRU::createGlDriver();
|
||||
GetVideoModes( openglInfo.modes, driver );
|
||||
driver->release();
|
||||
}
|
||||
|
||||
catch( NLMISC::Exception &e )
|
||||
catch(const NLMISC::Exception &e)
|
||||
{
|
||||
nlwarning( e.what() );
|
||||
}
|
||||
|
@ -172,7 +165,7 @@ void CSystem::GetVideoModes( std::vector< CVideoMode > &dst, NL3D::IDriver *driv
|
|||
{
|
||||
CVideoMode mode;
|
||||
mode.depth = itr->Depth;
|
||||
mode.widht = itr->Width;
|
||||
mode.width = itr->Width;
|
||||
mode.height = itr->Height;
|
||||
mode.frequency = itr->Frequency;
|
||||
|
||||
|
|
|
@ -27,22 +27,22 @@ class IDriver;
|
|||
|
||||
struct CVideoMode
|
||||
{
|
||||
unsigned int widht;
|
||||
unsigned int height;
|
||||
unsigned int depth;
|
||||
unsigned int frequency;
|
||||
uint16 width;
|
||||
uint16 height;
|
||||
uint8 depth;
|
||||
uint8 frequency;
|
||||
|
||||
CVideoMode()
|
||||
{
|
||||
widht = 0;
|
||||
width = 0;
|
||||
height = 0;
|
||||
depth = 0;
|
||||
frequency = 0;
|
||||
}
|
||||
|
||||
bool operator==( CVideoMode &o )
|
||||
bool operator== (const CVideoMode &o)
|
||||
{
|
||||
if( ( o.widht == widht ) && ( o.height == height ) && ( o.depth == depth ) && ( o.frequency == frequency ) )
|
||||
if ((o.width == width) && (o.height == height) && (o.depth == depth) && (o.frequency == frequency))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
@ -60,11 +60,8 @@ public:
|
|||
|
||||
static CSystem &GetInstance()
|
||||
{
|
||||
if( instance == 0 )
|
||||
{
|
||||
instance = new CSystem;
|
||||
}
|
||||
return *instance;
|
||||
static CSystem sInstance;
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
struct CSysInfo
|
||||
|
@ -74,16 +71,18 @@ public:
|
|||
std::string osName;
|
||||
std::string cpuName;
|
||||
uint64 totalRAM;
|
||||
} sysInfo;
|
||||
}
|
||||
sysInfo;
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef Q_OS_WIN32
|
||||
struct CD3DInfo
|
||||
{
|
||||
std::string device;
|
||||
std::string driver;
|
||||
std::string driverVersion;
|
||||
std::vector< CVideoMode > modes;
|
||||
} d3dInfo;
|
||||
}
|
||||
d3dInfo;
|
||||
#endif
|
||||
|
||||
struct COpenGLInfo
|
||||
|
@ -93,20 +92,22 @@ public:
|
|||
std::string driverVersion;
|
||||
std::string extensions;
|
||||
std::vector< CVideoMode > modes;
|
||||
} openglInfo;
|
||||
}
|
||||
openglInfo;
|
||||
|
||||
CConfig config;
|
||||
|
||||
private:
|
||||
void GatherSysInfo();
|
||||
#ifdef WIN32
|
||||
#ifdef Q_OS_WIN32
|
||||
void GatherD3DInfo();
|
||||
#endif
|
||||
void GatherOpenGLInfo();
|
||||
|
||||
void GetVideoModes( std::vector< CVideoMode > &dst, NL3D::IDriver *driver ) const;
|
||||
void GetVideoModes(std::vector<CVideoMode> &dst, NL3D::IDriver *driver) const;
|
||||
|
||||
static CSystem *instance;
|
||||
static bool parseDriverVersion(const std::string &device, uint64 driver, std::string &version);
|
||||
};
|
||||
|
||||
#endif // SYSTEM_H
|
||||
|
||||
|
|
Loading…
Reference in a new issue