Fixed: Wrong driver version in Ryzom Configurator

Fixed: Typo in "width"
This commit is contained in:
kervala 2013-09-29 13:46:43 +02:00
parent 8fff6423ae
commit 0bb5fc5536
3 changed files with 57 additions and 63 deletions

View file

@ -70,7 +70,7 @@ void CDisplaySettingsWidget::load()
CVideoMode mode; CVideoMode mode;
mode.widht = s.config.getInt( "Width" ); mode.width = s.config.getInt( "Width" );
mode.height = s.config.getInt( "Height" ); mode.height = s.config.getInt( "Height" );
mode.depth = s.config.getInt( "Depth" ); mode.depth = s.config.getInt( "Depth" );
mode.frequency = s.config.getInt( "Frequency" ); mode.frequency = s.config.getInt( "Frequency" );
@ -85,7 +85,7 @@ void CDisplaySettingsWidget::load()
windowedRadioButton->setChecked( true ); windowedRadioButton->setChecked( true );
} }
widthLineEdit->setText( QString( "%1" ).arg( mode.widht ) ); widthLineEdit->setText( QString( "%1" ).arg( mode.width ) );
heightLineEdit->setText( QString( "%1" ).arg( mode.height ) ); heightLineEdit->setText( QString( "%1" ).arg( mode.height ) );
xpositionLineEdit->setText( QString( "%1" ).arg( s.config.getInt( "PositionX" ) ) ); xpositionLineEdit->setText( QString( "%1" ).arg( s.config.getInt( "PositionX" ) ) );
ypositionLineEdit->setText( QString( "%1" ).arg( s.config.getInt( "PositionY" ) ) ); ypositionLineEdit->setText( QString( "%1" ).arg( s.config.getInt( "PositionY" ) ) );
@ -116,7 +116,7 @@ void CDisplaySettingsWidget::save()
else else
mode = s.openglInfo.modes[ index ]; 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( "Height", mode.height );
s.config.setInt( "Depth", mode.depth ); s.config.setInt( "Depth", mode.depth );
s.config.setInt( "Frequency", mode.frequency ); s.config.setInt( "Frequency", mode.frequency );

View file

@ -16,17 +16,15 @@
#include "stdpch.h" #include "stdpch.h"
#include "system.h" #include "system.h"
#include <sstream>
#include <nel/3d/driver.h> #include <nel/3d/driver.h>
#include <nel/3d/dru.h> #include <nel/3d/dru.h>
#include <QtOpenGL/QGLWidget> #include <QtOpenGL/QGLWidget>
CSystem *CSystem::instance = NULL;
CSystem::CSystem() CSystem::CSystem()
{ {
GatherSysInfo(); GatherSysInfo();
#ifdef WIN32 #ifdef Q_OS_WIN32
GatherD3DInfo(); GatherD3DInfo();
#endif #endif
GatherOpenGLInfo(); GatherOpenGLInfo();
@ -34,9 +32,32 @@ CSystem::CSystem()
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() void CSystem::GatherSysInfo()
{ {
@ -47,24 +68,7 @@ void CSystem::GatherSysInfo()
{ {
sysInfo.videoDevice = device; sysInfo.videoDevice = device;
////////////////////////////////////////////////////////////// CSystem::parseDriverVersion(device, driver, sysInfo.videoDriverVersion);
// 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();
//////////////////////////////////////////////////////////////
} }
else else
{ {
@ -78,7 +82,7 @@ void CSystem::GatherSysInfo()
sysInfo.totalRAM /= ( 1024 * 1024 ); sysInfo.totalRAM /= ( 1024 * 1024 );
} }
#ifdef WIN32 #ifdef Q_OS_WIN32
void CSystem::GatherD3DInfo() void CSystem::GatherD3DInfo()
{ {
NL3D::IDriver *driver = NULL; NL3D::IDriver *driver = NULL;
@ -93,16 +97,7 @@ void CSystem::GatherD3DInfo()
d3dInfo.device = adapter.Description; d3dInfo.device = adapter.Description;
d3dInfo.driver = adapter.Driver; d3dInfo.driver = adapter.Driver;
sint64 ver = adapter.DriverVersion; CSystem::parseDriverVersion(d3dInfo.device, adapter.DriverVersion, d3dInfo.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();
} }
GetVideoModes( d3dInfo.modes, driver ); GetVideoModes( d3dInfo.modes, driver );
@ -110,7 +105,7 @@ void CSystem::GatherD3DInfo()
driver->release(); driver->release();
} }
catch( NLMISC::Exception &e ) catch(const NLMISC::Exception &e)
{ {
nlwarning( e.what() ); nlwarning( e.what() );
} }
@ -147,15 +142,13 @@ void CSystem::GatherOpenGLInfo()
delete gl; delete gl;
NL3D::IDriver *driver = NULL;
try try
{ {
driver = NL3D::CDRU::createGlDriver(); NL3D::IDriver *driver = NL3D::CDRU::createGlDriver();
GetVideoModes( openglInfo.modes, driver ); GetVideoModes( openglInfo.modes, driver );
driver->release(); driver->release();
} }
catch(const NLMISC::Exception &e)
catch( NLMISC::Exception &e )
{ {
nlwarning( e.what() ); nlwarning( e.what() );
} }
@ -172,7 +165,7 @@ void CSystem::GetVideoModes( std::vector< CVideoMode > &dst, NL3D::IDriver *driv
{ {
CVideoMode mode; CVideoMode mode;
mode.depth = itr->Depth; mode.depth = itr->Depth;
mode.widht = itr->Width; mode.width = itr->Width;
mode.height = itr->Height; mode.height = itr->Height;
mode.frequency = itr->Frequency; mode.frequency = itr->Frequency;

View file

@ -27,22 +27,22 @@ class IDriver;
struct CVideoMode struct CVideoMode
{ {
unsigned int widht; uint16 width;
unsigned int height; uint16 height;
unsigned int depth; uint8 depth;
unsigned int frequency; uint8 frequency;
CVideoMode() CVideoMode()
{ {
widht = 0; width = 0;
height = 0; height = 0;
depth = 0; depth = 0;
frequency = 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; return true;
else else
return false; return false;
@ -60,11 +60,8 @@ public:
static CSystem &GetInstance() static CSystem &GetInstance()
{ {
if( instance == 0 ) static CSystem sInstance;
{ return sInstance;
instance = new CSystem;
}
return *instance;
} }
struct CSysInfo struct CSysInfo
@ -74,16 +71,18 @@ public:
std::string osName; std::string osName;
std::string cpuName; std::string cpuName;
uint64 totalRAM; uint64 totalRAM;
} sysInfo; }
sysInfo;
#ifdef WIN32 #ifdef Q_OS_WIN32
struct CD3DInfo struct CD3DInfo
{ {
std::string device; std::string device;
std::string driver; std::string driver;
std::string driverVersion; std::string driverVersion;
std::vector< CVideoMode > modes; std::vector< CVideoMode > modes;
} d3dInfo; }
d3dInfo;
#endif #endif
struct COpenGLInfo struct COpenGLInfo
@ -93,20 +92,22 @@ public:
std::string driverVersion; std::string driverVersion;
std::string extensions; std::string extensions;
std::vector< CVideoMode > modes; std::vector< CVideoMode > modes;
} openglInfo; }
openglInfo;
CConfig config; CConfig config;
private: private:
void GatherSysInfo(); void GatherSysInfo();
#ifdef WIN32 #ifdef Q_OS_WIN32
void GatherD3DInfo(); void GatherD3DInfo();
#endif #endif
void GatherOpenGLInfo(); 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 #endif // SYSTEM_H