mirror of
https://bitbucket.org/theswgsource/client-tools-1.2.git
synced 2026-01-16 23:04:40 -05:00
usability and memory detection improvements, memory and cleanups
This commit is contained in:
@@ -50,7 +50,7 @@ static bool SetUserSelectedMemoryManagerTarget()
|
||||
static void SetDefaultMemoryManagerTargetSize()
|
||||
{
|
||||
int megabytes = 0;
|
||||
MEMORYSTATUSEX memoryStatus;
|
||||
MEMORYSTATUSEX memoryStatus = { sizeof memoryStatus };
|
||||
megabytes = memoryStatus.ullTotalPhys / 1048576;
|
||||
|
||||
// clamp it between 250 and 2048MB
|
||||
|
||||
@@ -232,4 +232,9 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties RESOURCE_FILE="..\..\src\win32\SwgClientSetup.rc" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
|
||||
@@ -214,13 +214,9 @@ void ClientMachine::install ()
|
||||
{
|
||||
//-- detect memory
|
||||
{
|
||||
MEMORYSTATUS memoryStatus;
|
||||
GlobalMemoryStatus (&memoryStatus);
|
||||
ms_physicalMemorySize = memoryStatus.dwTotalPhys / (1024 * 1024);
|
||||
|
||||
#if defined(_DEBUG) && DEBUGGING_OPTIONS
|
||||
ms_physicalMemorySize = ms_debugPhysicalMemorySize;
|
||||
#endif
|
||||
MEMORYSTATUSEX memoryStatus = { sizeof memoryStatus };
|
||||
GlobalMemoryStatusEx(&memoryStatus);
|
||||
ms_physicalMemorySize = (memoryStatus.ullTotalPhys / 1048576);
|
||||
}
|
||||
|
||||
//-- detect cpu
|
||||
@@ -352,7 +348,7 @@ void ClientMachine::install ()
|
||||
memset (&caps, 0, sizeof (DDCAPS));
|
||||
caps.dwSize = sizeof (DDCAPS);
|
||||
if (SUCCEEDED (directDraw->GetCaps (&caps, 0)))
|
||||
ms_videoMemorySize = caps.dwVidMemTotal / (1024 * 1024);
|
||||
ms_videoMemorySize = caps.dwVidMemTotal / 1048576;
|
||||
|
||||
directDraw->Release ();
|
||||
directDraw = 0;
|
||||
@@ -410,20 +406,10 @@ void ClientMachine::install ()
|
||||
for (int i = 0; i < numberOfDisplayModes; ++i)
|
||||
{
|
||||
hresult = direct3d->EnumAdapterModes (D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8, i, &displayMode);
|
||||
#ifdef _DEBUG
|
||||
temp.Format (_T("D3DDISPLAYMODE: width=%d height=%d refresh=%d format=%d\n"), displayMode.Width, displayMode.Height, displayMode.RefreshRate, displayMode.Format);
|
||||
OutputDebugString (temp);
|
||||
#endif
|
||||
|
||||
//Disable modes above 1280x1024 with 64MB, and modes above 1024x768 with 32MB
|
||||
if ((ms_videoMemorySize < 32) && ((displayMode.Width > 1024) || (displayMode.Height > 768)))
|
||||
continue;
|
||||
|
||||
if ((ms_videoMemorySize < 64) && ((displayMode.Width > 1280) || (displayMode.Height > 1024)))
|
||||
continue;
|
||||
|
||||
if (displayMode.Width >= 1024 && displayMode.Height >= 720 && displayMode.RefreshRate >= 57 && displayMode.RefreshRate <= 75)
|
||||
ms_displayModeList.push_back (displayMode);
|
||||
if (displayMode.Width >= 1024 && displayMode.Height >= 720 && displayMode.RefreshRate >= 57) {
|
||||
ms_displayModeList.push_back(displayMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -451,76 +437,6 @@ void ClientMachine::install ()
|
||||
query3dProviders (ms_soundProviderList);
|
||||
}
|
||||
|
||||
//-- detect cd / dvd
|
||||
{
|
||||
// get all the drive letters in the system
|
||||
wchar_t drives[4096];
|
||||
int drivesWritten = GetLogicalDriveStrings(sizeof(drives), drives);
|
||||
if (drivesWritten > 0 && drivesWritten <= sizeof(drives))
|
||||
{
|
||||
// iterate over all the drives in the system
|
||||
for (wchar_t const * currentDrive = drives; *currentDrive; currentDrive += wcslen(currentDrive) + 1)
|
||||
{
|
||||
// see if the drive is CD or DVD based
|
||||
if (GetDriveType(currentDrive) == DRIVE_CDROM)
|
||||
{
|
||||
// Get a handle to the device
|
||||
wchar_t createFileBuffer[256];
|
||||
_stprintf(createFileBuffer, _T("\\\\.\\%c:"), currentDrive[0]);
|
||||
HANDLE handle = CreateFile(createFileBuffer, 0, 0, NULL, OPEN_EXISTING, 0, 0);
|
||||
if (handle != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
// Check its media types
|
||||
wchar_t buffer[32 * 1024];
|
||||
DWORD written = 0;
|
||||
if (DeviceIoControl(handle, IOCTL_STORAGE_GET_MEDIA_TYPES_EX, NULL, 0, buffer, sizeof(buffer), &written, 0) && written > 0 && written <= sizeof(buffer))
|
||||
{
|
||||
GET_MEDIA_TYPES const * const mediaTypes = reinterpret_cast<GET_MEDIA_TYPES const *>(buffer);
|
||||
|
||||
if (mediaTypes->DeviceType == FILE_DEVICE_CD_ROM)
|
||||
{
|
||||
++ms_numberOfCdDrives;
|
||||
}
|
||||
else if (mediaTypes->DeviceType == FILE_DEVICE_DVD)
|
||||
{
|
||||
++ms_numberOfDvdDrives;
|
||||
}
|
||||
}
|
||||
|
||||
CloseHandle(handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
CRegKey regKey;
|
||||
if (regKey.Open (HKEY_LOCAL_MACHINE, _T("Software\\microsoft\\windows\\currentversion\\app paths\\StarWarsGalaxies")) == ERROR_SUCCESS)
|
||||
{
|
||||
DWORD value = 0;
|
||||
if (regKey.QueryValue (value, _T("SoeBits")) == ERROR_SUCCESS)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 0:
|
||||
ms_bitsStatus = _T("unavailable");
|
||||
break;
|
||||
case 1:
|
||||
ms_bitsStatus = _T("enabled");
|
||||
break;
|
||||
case 2:
|
||||
ms_bitsStatus = _T("disabled");
|
||||
break;
|
||||
default:
|
||||
ms_bitsStatus = _T("invalid");
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-- detect .NET framework
|
||||
{
|
||||
HRESULT const hr = DirectInput8Create(AfxGetInstanceHandle(), DIRECTINPUT_VERSION, IID_IDirectInput8W, reinterpret_cast<void **>(&ms_directInput), 0);
|
||||
@@ -982,7 +898,7 @@ CString const ClientMachine::getHardwareInformationString ()
|
||||
result += getDeviceDriverVersionText ();
|
||||
result += '\n';
|
||||
|
||||
buffer.Format (_T("Video Memory Size: %i MB"), getVideoMemorySize ());
|
||||
buffer.Format (_T("Video Memory Size: %i GB"), getVideoMemorySize ());
|
||||
buffer += '\n';
|
||||
result += buffer;
|
||||
|
||||
|
||||
@@ -21,25 +21,6 @@ static char THIS_FILE[] = __FILE__;
|
||||
|
||||
// ======================================================================
|
||||
|
||||
static int DetermineMemoryManagerSize ()
|
||||
{
|
||||
MEMORYSTATUS memoryStatus;
|
||||
GlobalMemoryStatus (&memoryStatus);
|
||||
|
||||
//-- memory status returns bytes
|
||||
const int numberOfMegabytes = (memoryStatus.dwTotalPhys / 4) * 3;
|
||||
|
||||
if (numberOfMegabytes > 2000 * 1024 * 1024)
|
||||
return 2000 * 1024 * 1024;
|
||||
|
||||
if (numberOfMegabytes < 250 * 1024 * 1024)
|
||||
return 250 * 1024 * 1024;
|
||||
|
||||
return numberOfMegabytes;
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
IMPLEMENT_DYNCREATE(PageAdvanced, CPropertyPage)
|
||||
|
||||
PageAdvanced::PageAdvanced() : CPropertyPage(PageAdvanced::IDD)
|
||||
@@ -48,7 +29,6 @@ PageAdvanced::PageAdvanced() : CPropertyPage(PageAdvanced::IDD)
|
||||
m_disableWorldPreloading = FALSE;
|
||||
m_skipL0Characters = FALSE;
|
||||
m_skipL0Meshes = FALSE;
|
||||
m_gameMemorySize = _T("");
|
||||
m_disableTextureBaking = FALSE;
|
||||
m_disableFileCaching = FALSE;
|
||||
m_disableAsynchronousLoader = FALSE;
|
||||
@@ -60,8 +40,6 @@ PageAdvanced::PageAdvanced() : CPropertyPage(PageAdvanced::IDD)
|
||||
m_lblDisableTextureBaking = _T("");
|
||||
m_lblDisableFileCaching = _T("");
|
||||
m_lblDisableAsynchronousLoader = _T("");
|
||||
m_lblGameMemorySize = _T("");
|
||||
m_lblGameMemoryInfo = _T("");
|
||||
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
@@ -78,7 +56,6 @@ void PageAdvanced::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Check(pDX, IDC_CHECK_DISABLEWORLDPRELOADING, m_disableWorldPreloading);
|
||||
DDX_Check(pDX, IDC_CHECK_SKIPL0CHARACTERS, m_skipL0Characters);
|
||||
DDX_Check(pDX, IDC_CHECK_SKIPL0MESHES, m_skipL0Meshes);
|
||||
DDX_Text(pDX, IDC_STATIC_GAMEMEMORY, m_gameMemorySize);
|
||||
DDX_Check(pDX, IDC_CHECK_DISABLETEXTUREBAKING, m_disableTextureBaking);
|
||||
DDX_Check(pDX, IDC_CHECK_DISABLEFILECACHING, m_disableFileCaching);
|
||||
DDX_Check(pDX, IDC_CHECK_DISABLEASYNCHRONOUSLOADER, m_disableAsynchronousLoader);
|
||||
@@ -90,8 +67,6 @@ void PageAdvanced::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Text(pDX, IDC_CHECK_DISABLETEXTUREBAKING, m_lblDisableTextureBaking);
|
||||
DDX_Text(pDX, IDC_CHECK_DISABLEFILECACHING, m_lblDisableFileCaching);
|
||||
DDX_Text(pDX, IDC_CHECK_DISABLEASYNCHRONOUSLOADER, m_lblDisableAsynchronousLoader);
|
||||
DDX_Text(pDX, IDC_LBL_ADVANCED_GAME_MEMORY_SIZE, m_lblGameMemorySize);
|
||||
DDX_Text(pDX, IDC_LBL_ADVANCED_GAME_MEMORY_INFO, m_lblGameMemoryInfo);
|
||||
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
@@ -119,8 +94,6 @@ void PageAdvanced::initializeDialog()
|
||||
VERIFY(m_lblDisableTextureBaking.LoadString(IDS_ADVANCED_DISABLE_TEXTURE_BAKING));
|
||||
VERIFY(m_lblDisableFileCaching.LoadString(IDS_ADVANCED_DISABLE_FILE_CACHING));
|
||||
VERIFY(m_lblDisableAsynchronousLoader.LoadString(IDS_ADVANCED_DISABLE_ASYNCHRONOUS_LOADER));
|
||||
VERIFY(m_lblGameMemorySize.LoadString(IDS_ADVANCED_GAME_MEMORY_SIZE));
|
||||
VERIFY(m_lblGameMemoryInfo.LoadString(IDS_ADVANCED_GAME_MEMORY_INFO));
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
m_disableWorldPreloading = Options::getDisableWorldPreloading ();
|
||||
@@ -130,9 +103,6 @@ void PageAdvanced::initializeDialog()
|
||||
m_disableFileCaching = Options::getDisableFileCaching ();
|
||||
m_disableAsynchronousLoader = Options::getDisableAsynchronousLoader ();
|
||||
|
||||
const int size = DetermineMemoryManagerSize ();
|
||||
m_gameMemorySize.Format (_T("%i MB"), size / (1024 * 1024));
|
||||
|
||||
if (ClientMachine::getPhysicalMemorySize() < 260)
|
||||
{
|
||||
//Set low detail meshes to true, and disable that control
|
||||
|
||||
@@ -181,13 +181,16 @@ VERIFY(m_lblNumProcessors.LoadString(IDS_INFO_NUM_PROCESSORS));
|
||||
CString MB;
|
||||
VERIFY(MB.LoadString(IDS_MB));
|
||||
|
||||
CString GB;
|
||||
VERIFY(GB.LoadString(IDS_GB));
|
||||
|
||||
CString Mhz;
|
||||
VERIFY(Mhz.LoadString(IDS_Mhz));
|
||||
|
||||
CString Unknown;
|
||||
VERIFY(Unknown.LoadString(IDS_UNKNOWN));
|
||||
|
||||
m_physicalMemorySize.Format (_T("%i %s"), ClientMachine::getPhysicalMemorySize(), MB);
|
||||
m_physicalMemorySize.Format (_T("%i %s"), (ClientMachine::getPhysicalMemorySize()/1024+1), GB);
|
||||
|
||||
m_numberOfProcessors.Format (_T("%i physical, %i logical"), ClientMachine::getNumberOfPhysicalProcessors (), ClientMachine::getNumberOfLogicalProcessors ());
|
||||
|
||||
@@ -208,7 +211,7 @@ VERIFY(m_lblNumProcessors.LoadString(IDS_INFO_NUM_PROCESSORS));
|
||||
|
||||
m_videoDriverVersion = ClientMachine::getDeviceDriverVersionText ();
|
||||
|
||||
m_videoMemorySize.Format (_T("%i %s"), ClientMachine::getVideoMemorySize (), MB);
|
||||
m_videoMemorySize.Format (_T("%i %s"), (ClientMachine::getVideoMemorySize ()/1024+1), GB);
|
||||
|
||||
if (ClientMachine::getVertexShaderMajorVersion () != 0)
|
||||
m_vertexShaderVersion.Format (_T("%i.%i"), ClientMachine::getVertexShaderMajorVersion (), ClientMachine::getVertexShaderMinorVersion ());
|
||||
|
||||
@@ -75,6 +75,8 @@ protected:
|
||||
|
||||
private:
|
||||
void initializeDialog();
|
||||
public:
|
||||
afx_msg void OnStnClickedStaticPhysical();
|
||||
};
|
||||
|
||||
// ======================================================================
|
||||
|
||||
@@ -359,10 +359,10 @@ BEGIN
|
||||
LTEXT "x",IDC_SOUNDVERSION,68,27,117,8
|
||||
END
|
||||
|
||||
IDD_PROPPAGE_ADVANCED DIALOG 0, 0, 199, 178
|
||||
IDD_PROPPAGE_ADVANCED DIALOGEX 0, 0, 199, 178
|
||||
STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||
CAPTION "Advanced"
|
||||
FONT 8, "MS Sans Serif"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
CONTROL "Disable World Preloading",IDC_CHECK_DISABLEWORLDPRELOADING,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,29,95,10
|
||||
@@ -376,9 +376,6 @@ BEGIN
|
||||
CONTROL "Disable Asynchronous Loader",IDC_CHECK_DISABLEASYNCHRONOUSLOADER,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,94,110,10
|
||||
LTEXT "These are debugging and/or troubleshooting options only.",IDC_LBL_ADVANCED_HEADER,7,7,185,22
|
||||
LTEXT "Game Memory Size",IDC_LBL_ADVANCED_GAME_MEMORY_SIZE,18,113,62,8
|
||||
LTEXT "MB",IDC_STATIC_GAMEMEMORY,85,113,95,8
|
||||
LTEXT "This value should be 75% of your total system RAM up to 1 GB (reserving memory for Direct3D and the OS).",IDC_LBL_ADVANCED_GAME_MEMORY_INFO,85,125,107,34
|
||||
END
|
||||
|
||||
IDD_PROPPAGE_DEBUG DIALOG 0, 0, 212, 183
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by SwgClientSetup.rc
|
||||
//
|
||||
#define IDS_STRING1 10
|
||||
|
||||
Reference in New Issue
Block a user