mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
hsG3DDeviceSelector => plString
This commit is contained in:
@ -66,12 +66,12 @@ HRESULT hsGDirect3DTnLEnumerate::SelectFromDevMode(const hsG3DDeviceRecord* devR
|
|||||||
int i;
|
int i;
|
||||||
for( i = 0; i < GetNumDrivers(); i++ )
|
for( i = 0; i < GetNumDrivers(); i++ )
|
||||||
{
|
{
|
||||||
if( !stricmp(GetDriver(i)->fAdapterInfo.Description, devRec->GetDriverDesc()) )
|
if (devRec->GetDriverDesc().CompareI(GetDriver(i)->fAdapterInfo.Description) == 0)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
for( j = 0; j < GetDriver(i)->fDevices.GetCount(); j++ )
|
for( j = 0; j < GetDriver(i)->fDevices.GetCount(); j++ )
|
||||||
{
|
{
|
||||||
if( !stricmp(GetDriver(i)->fDevices[j].fStrName, devRec->GetDeviceDesc()) )
|
if (devRec->GetDeviceDesc().CompareI(GetDriver(i)->fDevices[j].fStrName) == 0)
|
||||||
{
|
{
|
||||||
SetCurrentDriver(GetDriver(i));
|
SetCurrentDriver(GetDriver(i));
|
||||||
SetCurrentDevice(&GetDriver(i)->fDevices[j]);
|
SetCurrentDevice(&GetDriver(i)->fDevices[j]);
|
||||||
@ -87,11 +87,11 @@ HRESULT hsGDirect3DTnLEnumerate::SelectFromDevMode(const hsG3DDeviceRecord* devR
|
|||||||
char errStr[256];
|
char errStr[256];
|
||||||
|
|
||||||
sprintf(errStr, "Can't find requested device - %s:%s:%s:%s:%s",
|
sprintf(errStr, "Can't find requested device - %s:%s:%s:%s:%s",
|
||||||
devRec->GetG3DDeviceTypeName(),
|
devRec->GetG3DDeviceTypeName(),
|
||||||
devRec->GetDriverDesc(),
|
devRec->GetDriverDesc().c_str(),
|
||||||
devRec->GetDriverName(),
|
devRec->GetDriverName().c_str(),
|
||||||
devRec->GetDriverVersion(),
|
devRec->GetDriverVersion().c_str(),
|
||||||
devRec->GetDeviceDesc());
|
devRec->GetDeviceDesc().c_str());
|
||||||
|
|
||||||
DWORD enumFlags = 0;
|
DWORD enumFlags = 0;
|
||||||
int width = devMode->GetWidth();
|
int width = devMode->GetWidth();
|
||||||
|
@ -97,7 +97,6 @@ void hsG3DDeviceMode::Clear()
|
|||||||
hsG3DDeviceRecord::hsG3DDeviceRecord()
|
hsG3DDeviceRecord::hsG3DDeviceRecord()
|
||||||
: fFlags(kNone),
|
: fFlags(kNone),
|
||||||
fG3DDeviceType(hsG3DDeviceSelector::kDevTypeUnknown),
|
fG3DDeviceType(hsG3DDeviceSelector::kDevTypeUnknown),
|
||||||
fG3DDriverDesc(nil), fG3DDriverName(nil), fG3DDriverVersion(nil), fG3DDeviceDesc(nil),
|
|
||||||
fLayersAtOnce(0), fMemoryBytes(0),
|
fLayersAtOnce(0), fMemoryBytes(0),
|
||||||
fG3DHALorHEL(hsG3DDeviceSelector::kHHTypeUnknown),
|
fG3DHALorHEL(hsG3DDeviceSelector::kHHTypeUnknown),
|
||||||
fZBiasRating( 0 ), fLODBiasRating( 0 ),
|
fZBiasRating( 0 ), fLODBiasRating( 0 ),
|
||||||
@ -115,7 +114,6 @@ hsG3DDeviceRecord::~hsG3DDeviceRecord()
|
|||||||
hsG3DDeviceRecord::hsG3DDeviceRecord(const hsG3DDeviceRecord& src)
|
hsG3DDeviceRecord::hsG3DDeviceRecord(const hsG3DDeviceRecord& src)
|
||||||
: fFlags(kNone),
|
: fFlags(kNone),
|
||||||
fG3DDeviceType(hsG3DDeviceSelector::kDevTypeUnknown),
|
fG3DDeviceType(hsG3DDeviceSelector::kDevTypeUnknown),
|
||||||
fG3DDriverDesc(nil), fG3DDriverName(nil), fG3DDriverVersion(nil), fG3DDeviceDesc(nil),
|
|
||||||
fG3DHALorHEL(hsG3DDeviceSelector::kHHTypeUnknown),
|
fG3DHALorHEL(hsG3DDeviceSelector::kHHTypeUnknown),
|
||||||
fZBiasRating( src.fZBiasRating ), fLODBiasRating( 0 ),
|
fZBiasRating( src.fZBiasRating ), fLODBiasRating( 0 ),
|
||||||
fFogExpApproxStart( src.fFogExpApproxStart ), fFogExp2ApproxStart( src.fFogExp2ApproxStart ),
|
fFogExpApproxStart( src.fFogExpApproxStart ), fFogExp2ApproxStart( src.fFogExp2ApproxStart ),
|
||||||
@ -162,30 +160,6 @@ hsG3DDeviceRecord& hsG3DDeviceRecord::operator=(const hsG3DDeviceRecord& src)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hsG3DDeviceRecord::SetDriverDesc( const char *s )
|
|
||||||
{
|
|
||||||
delete [] fG3DDriverDesc;
|
|
||||||
fG3DDriverDesc = s ? hsStrcpy(s) : nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
void hsG3DDeviceRecord::SetDriverName( const char *s )
|
|
||||||
{
|
|
||||||
delete [] fG3DDriverName;
|
|
||||||
fG3DDriverName = s ? hsStrcpy(s) : nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
void hsG3DDeviceRecord::SetDriverVersion( const char *s )
|
|
||||||
{
|
|
||||||
delete [] fG3DDriverVersion;
|
|
||||||
fG3DDriverVersion = s ? hsStrcpy(s) : nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
void hsG3DDeviceRecord::SetDeviceDesc( const char *s )
|
|
||||||
{
|
|
||||||
delete [] fG3DDeviceDesc;
|
|
||||||
fG3DDeviceDesc = s ? hsStrcpy(s) : nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* hsG3DDeviceRecord::GetG3DDeviceTypeName() const
|
const char* hsG3DDeviceRecord::GetG3DDeviceTypeName() const
|
||||||
{
|
{
|
||||||
static const char* deviceNames[hsG3DDeviceSelector::kNumDevTypes] = {
|
static const char* deviceNames[hsG3DDeviceSelector::kNumDevTypes] = {
|
||||||
@ -230,17 +204,10 @@ void hsG3DDeviceRecord::Clear()
|
|||||||
{
|
{
|
||||||
fFlags = kNone;
|
fFlags = kNone;
|
||||||
|
|
||||||
delete [] fG3DDriverDesc;
|
fG3DDriverDesc = plString::Null;
|
||||||
fG3DDriverDesc = nil;
|
fG3DDriverName = plString::Null;
|
||||||
|
fG3DDriverVersion = plString::Null;
|
||||||
delete [] fG3DDriverName;
|
fG3DDeviceDesc = plString::Null;
|
||||||
fG3DDriverName = nil;
|
|
||||||
|
|
||||||
delete [] fG3DDriverVersion;
|
|
||||||
fG3DDriverVersion = nil;
|
|
||||||
|
|
||||||
delete [] fG3DDeviceDesc;
|
|
||||||
fG3DDeviceDesc = nil;
|
|
||||||
|
|
||||||
fCaps.Clear();
|
fCaps.Clear();
|
||||||
fLayersAtOnce = 0;
|
fLayersAtOnce = 0;
|
||||||
@ -268,14 +235,6 @@ hsG3DDeviceModeRecord::hsG3DDeviceModeRecord(const hsG3DDeviceRecord& devRec, co
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
hsG3DDeviceModeRecord::hsG3DDeviceModeRecord()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
hsG3DDeviceModeRecord::~hsG3DDeviceModeRecord()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
hsG3DDeviceModeRecord::hsG3DDeviceModeRecord(const hsG3DDeviceModeRecord& src)
|
hsG3DDeviceModeRecord::hsG3DDeviceModeRecord(const hsG3DDeviceModeRecord& src)
|
||||||
{
|
{
|
||||||
*this = src;
|
*this = src;
|
||||||
@ -291,10 +250,6 @@ hsG3DDeviceModeRecord& hsG3DDeviceModeRecord::operator=(const hsG3DDeviceModeRec
|
|||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
|
|
||||||
hsG3DDeviceSelector::hsG3DDeviceSelector()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
hsG3DDeviceSelector::~hsG3DDeviceSelector()
|
hsG3DDeviceSelector::~hsG3DDeviceSelector()
|
||||||
{
|
{
|
||||||
IClear();
|
IClear();
|
||||||
@ -629,7 +584,6 @@ void hsG3DDeviceSelector::IFudgeDirectXDevice( hsG3DDeviceRecord &record,
|
|||||||
D3DEnum_DriverInfo *driverInfo,
|
D3DEnum_DriverInfo *driverInfo,
|
||||||
D3DEnum_DeviceInfo *deviceInfo )
|
D3DEnum_DeviceInfo *deviceInfo )
|
||||||
{
|
{
|
||||||
char desc[ 512 ]; // Can't rely on D3D constant, since that's in another file now
|
|
||||||
uint32_t vendorID, deviceID;
|
uint32_t vendorID, deviceID;
|
||||||
char *szDriver, *szDesc;
|
char *szDriver, *szDesc;
|
||||||
|
|
||||||
@ -649,21 +603,18 @@ void hsG3DDeviceSelector::IFudgeDirectXDevice( hsG3DDeviceRecord &record,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// So capitalization won't matter in our tests
|
/// So capitalization won't matter in our tests
|
||||||
hsAssert( strlen( szDesc ) < sizeof( desc ), "D3D device description longer than expected!" );
|
plString desc = plString::FromIso8859_1(szDesc).ToLower();
|
||||||
hsStrcpy( desc, szDesc );
|
|
||||||
hsStrLower( desc );
|
|
||||||
|
|
||||||
/// Detect ATI Radeon chipset
|
/// Detect ATI Radeon chipset
|
||||||
// We will probably need to differentiate between different Radeons at some point in
|
// We will probably need to differentiate between different Radeons at some point in
|
||||||
// the future, but not now.
|
// the future, but not now.
|
||||||
if (stricmp(szDriver, "ati2dvag.dll") == 0 || strstr(desc, "radeon") != nullptr)
|
ssize_t radeon = desc.Find("radeon");
|
||||||
|
if (stricmp(szDriver, "ati2dvag.dll") == 0 || radeon >= 0)
|
||||||
{
|
{
|
||||||
int series = 0;
|
int series = 0;
|
||||||
const char* str = strstr(desc, "radeon");
|
if (radeon >= 0)
|
||||||
if( str )
|
|
||||||
str += strlen("radeon");
|
|
||||||
if( str )
|
|
||||||
{
|
{
|
||||||
|
const char* str = desc.c_str() + radeon + strlen("radeon");
|
||||||
if( 1 == sscanf(str, "%d", &series) )
|
if( 1 == sscanf(str, "%d", &series) )
|
||||||
{
|
{
|
||||||
if( (series >= 8000) && (series < 9000) )
|
if( (series >= 8000) && (series < 9000) )
|
||||||
@ -693,13 +644,13 @@ void hsG3DDeviceSelector::IFudgeDirectXDevice( hsG3DDeviceRecord &record,
|
|||||||
/// Detect Intel i810 chipset
|
/// Detect Intel i810 chipset
|
||||||
else if( deviceID == 0x00007125 &&
|
else if( deviceID == 0x00007125 &&
|
||||||
( stricmp( szDriver, "i81xdd.dll" ) == 0
|
( stricmp( szDriver, "i81xdd.dll" ) == 0
|
||||||
|| ( strstr( desc, "intel" ) != nil && strstr( desc, "810" ) != nil ) ) )
|
|| ( desc.Find("intel") >= 0 && desc.Find("810") >= 0 ) ) )
|
||||||
{
|
{
|
||||||
hsStatusMessage( "== Using fudge factors for an Intel i810 chipset ==\n" );
|
hsStatusMessage( "== Using fudge factors for an Intel i810 chipset ==\n" );
|
||||||
ISetFudgeFactors( kIntelI810Chipset, record );
|
ISetFudgeFactors( kIntelI810Chipset, record );
|
||||||
}
|
}
|
||||||
/// Detect for a GeForc FX card. We only need to nerf the really low end one.
|
/// Detect for a GeForc FX card. We only need to nerf the really low end one.
|
||||||
else if( strstr( desc, "nvidia" ) != nil && strstr( desc, "geforce fx 5200" ) != nil )
|
else if( desc.Find("nvidia") >= 0 && desc.Find("geforce fx 5200") >= 0 )
|
||||||
{
|
{
|
||||||
hsStatusMessage( "== Using fudge factors for an NVidia GeForceFX-based chipset ==\n" );
|
hsStatusMessage( "== Using fudge factors for an NVidia GeForceFX-based chipset ==\n" );
|
||||||
ISetFudgeFactors( kNVidiaGeForceFXChipset, record );
|
ISetFudgeFactors( kNVidiaGeForceFXChipset, record );
|
||||||
|
@ -59,6 +59,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
|
|
||||||
#include "hsTemplates.h"
|
#include "hsTemplates.h"
|
||||||
#include "hsBitVector.h"
|
#include "hsBitVector.h"
|
||||||
|
#include "plString.h"
|
||||||
|
|
||||||
#ifdef HS_BUILD_FOR_WIN32
|
#ifdef HS_BUILD_FOR_WIN32
|
||||||
#define HS_SELECT_DIRECT3D // not supported on the Mac.
|
#define HS_SELECT_DIRECT3D // not supported on the Mac.
|
||||||
@ -143,20 +144,20 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
uint32_t fFlags;
|
uint32_t fFlags;
|
||||||
|
|
||||||
uint32_t fG3DDeviceType;
|
uint32_t fG3DDeviceType;
|
||||||
uint32_t fG3DHALorHEL;
|
uint32_t fG3DHALorHEL;
|
||||||
|
|
||||||
|
|
||||||
char* fG3DDriverDesc;
|
plString fG3DDriverDesc;
|
||||||
char* fG3DDriverName;
|
plString fG3DDriverName;
|
||||||
char* fG3DDriverVersion;
|
plString fG3DDriverVersion;
|
||||||
char* fG3DDeviceDesc;
|
plString fG3DDeviceDesc;
|
||||||
|
|
||||||
hsBitVector fCaps;
|
hsBitVector fCaps;
|
||||||
uint32_t fLayersAtOnce;
|
uint32_t fLayersAtOnce;
|
||||||
uint32_t fMemoryBytes;
|
uint32_t fMemoryBytes;
|
||||||
|
|
||||||
hsTArray<hsG3DDeviceMode> fModes;
|
hsTArray<hsG3DDeviceMode> fModes;
|
||||||
|
|
||||||
@ -188,19 +189,19 @@ public:
|
|||||||
|
|
||||||
uint32_t GetMemoryBytes() const { return fMemoryBytes; }
|
uint32_t GetMemoryBytes() const { return fMemoryBytes; }
|
||||||
|
|
||||||
const char* GetDriverDesc() const { return fG3DDriverDesc; }
|
plString GetDriverDesc() const { return fG3DDriverDesc; }
|
||||||
const char* GetDriverName() const { return fG3DDriverName; }
|
plString GetDriverName() const { return fG3DDriverName; }
|
||||||
const char* GetDriverVersion() const { return fG3DDriverVersion; }
|
plString GetDriverVersion() const { return fG3DDriverVersion; }
|
||||||
const char* GetDeviceDesc() const { return fG3DDeviceDesc; }
|
plString GetDeviceDesc() const { return fG3DDeviceDesc; }
|
||||||
|
|
||||||
void SetG3DDeviceType(uint32_t t) { fG3DDeviceType = t; }
|
void SetG3DDeviceType(uint32_t t) { fG3DDeviceType = t; }
|
||||||
void SetG3DHALorHEL(uint32_t h) { fG3DHALorHEL = h; }
|
void SetG3DHALorHEL(uint32_t h) { fG3DHALorHEL = h; }
|
||||||
void SetMemoryBytes(uint32_t b) { fMemoryBytes = b; }
|
void SetMemoryBytes(uint32_t b) { fMemoryBytes = b; }
|
||||||
|
|
||||||
void SetDriverDesc(const char* s);
|
void SetDriverDesc(const plString& s) { fG3DDriverDesc = s; }
|
||||||
void SetDriverName(const char* s);
|
void SetDriverName(const plString& s) { fG3DDriverName = s; }
|
||||||
void SetDriverVersion(const char* s);
|
void SetDriverVersion(const plString& s) { fG3DDriverVersion = s; }
|
||||||
void SetDeviceDesc(const char* s);
|
void SetDeviceDesc(const plString& s) { fG3DDeviceDesc = s; }
|
||||||
|
|
||||||
bool GetCap(uint32_t cap) const { return fCaps.IsBitSet(cap); }
|
bool GetCap(uint32_t cap) const { return fCaps.IsBitSet(cap); }
|
||||||
void SetCap(uint32_t cap, bool on=true) { fCaps.SetBit(cap, on); }
|
void SetCap(uint32_t cap, bool on=true) { fCaps.SetBit(cap, on); }
|
||||||
@ -252,9 +253,8 @@ protected:
|
|||||||
hsG3DDeviceRecord fDevice;
|
hsG3DDeviceRecord fDevice;
|
||||||
hsG3DDeviceMode fMode;
|
hsG3DDeviceMode fMode;
|
||||||
public:
|
public:
|
||||||
hsG3DDeviceModeRecord();
|
hsG3DDeviceModeRecord() { }
|
||||||
hsG3DDeviceModeRecord(const hsG3DDeviceRecord& devRec, const hsG3DDeviceMode& devMode);
|
hsG3DDeviceModeRecord(const hsG3DDeviceRecord& devRec, const hsG3DDeviceMode& devMode);
|
||||||
~hsG3DDeviceModeRecord();
|
|
||||||
|
|
||||||
hsG3DDeviceModeRecord(const hsG3DDeviceModeRecord& src);
|
hsG3DDeviceModeRecord(const hsG3DDeviceModeRecord& src);
|
||||||
hsG3DDeviceModeRecord& operator=(const hsG3DDeviceModeRecord& src);
|
hsG3DDeviceModeRecord& operator=(const hsG3DDeviceModeRecord& src);
|
||||||
@ -343,7 +343,7 @@ protected:
|
|||||||
void ISetFudgeFactors( uint8_t chipsetID, hsG3DDeviceRecord &record );
|
void ISetFudgeFactors( uint8_t chipsetID, hsG3DDeviceRecord &record );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
hsG3DDeviceSelector();
|
hsG3DDeviceSelector() { }
|
||||||
virtual ~hsG3DDeviceSelector();
|
virtual ~hsG3DDeviceSelector();
|
||||||
|
|
||||||
void RemoveUnusableDevModes(bool bTough); // Removes modes and devices not allowed supported in release
|
void RemoveUnusableDevModes(bool bTough); // Removes modes and devices not allowed supported in release
|
||||||
|
Reference in New Issue
Block a user