[glide64] remove vram.cpp (from Fix build under MinGW)

3b8d826964
This commit is contained in:
zilmar 2015-10-09 15:50:44 +11:00
parent e5c6fa245b
commit 8d1381b42a
3 changed files with 0 additions and 123 deletions

View File

@ -160,10 +160,6 @@
RelativePath=".\OGLtextures.cpp"
>
</File>
<File
RelativePath=".\vram.cpp"
>
</File>
</Filter>
</Files>
<Globals>

View File

@ -2759,11 +2759,6 @@ FX_ENTRY void FX_CALL grConfigWrapperExt(FxI32 resolution, FxI32 vram, FxBool fb
config.vram_size = vram;
config.fbo = fbo;
config.anisofilter = aniso;
#ifdef _WIN32
int getVRAMSize();
if (config.vram_size == 0)
config.vram_size = getVRAMSize();
#endif // _WIN32
}
// unused by glide64

View File

@ -1,114 +0,0 @@
#include <stdio.h>
#ifdef _WIN32 //Windows, duh!
#include <objbase.h>
#include <InitGuid.h>
#include "dxdiag.h"
#include "main.h"
#pragma comment(lib, "ole32.lib")
#define SAFE_RELEASE(x) { if (x != NULL) { x->Release(); x = NULL; } }
IDxDiagProvider* Provider;
IDxDiagContainer* RootContainer;
bool ComInitialized;
static void InitCom()
{
try
{
Provider = NULL;
RootContainer = NULL;
// Init COM
ComInitialized = SUCCEEDED(CoInitialize(NULL));
// Create a provider interface
if (FAILED(CoCreateInstance(CLSID_DxDiagProvider, NULL, CLSCTX_INPROC_SERVER, IID_IDxDiagProvider, (void**)&Provider)))
throw "Unable to create provider instance";
// Initialize the provider
DXDIAG_INIT_PARAMS initParams;
ZeroMemory(&initParams, sizeof(DXDIAG_INIT_PARAMS));
initParams.dwSize = sizeof(DXDIAG_INIT_PARAMS);
initParams.dwDxDiagHeaderVersion = DXDIAG_DX9_SDK_VERSION;
if (FAILED(Provider->Initialize(&initParams)))
throw "Unable to initialize provider";
// Get the root container
if (FAILED(Provider->GetRootContainer(&RootContainer)))
throw "Unable to get root container";
}
catch (const char* msg)
{
LOG("\nDxDiag Error: %s", msg);
}
}
static IDxDiagContainer* GetContainer(IDxDiagContainer* parent, const WCHAR* name)
{
IDxDiagContainer* container;
if (SUCCEEDED(parent->GetChildContainer(name, &container)))
return container;
return NULL;
}
static void GetPropertyValue(IDxDiagContainer* container, const WCHAR* name, WCHAR* value, int maxValueLen)
{
VARIANT var;
VariantInit(&var);
if (SUCCEEDED(container->GetProp(name, &var)))
{
// Assuming an integer or bstring value here
// @@ Handle all the VT_* types properly...
if (var.vt != VT_BSTR)
wsprintf((LPSTR)value, "%i", var.iVal);
else
wcsncpy(value, var.bstrVal, maxValueLen - 1);
value[maxValueLen - 1] = 0;
VariantClear(&var);
}
else
{
value[0] = 0;
}
}
static int GetTotalVideoMemory()
{
if (RootContainer != NULL)
{
// Get device container
IDxDiagContainer* container = GetContainer(RootContainer, L"DxDiag_DisplayDevices");
if (container != NULL)
{
// Get device name
container = GetContainer(container, L"0");
if (container != NULL)
{
const int bufferLength = 256;
WCHAR buffer[bufferLength];
GetPropertyValue(container, L"szDisplayMemoryLocalized", buffer, bufferLength);
// Value in MB is first token in string
return _wtoi(buffer);
}
}
}
// No good!
return -1;
}
int getVRAMSize()
{
static int mem;
if (!mem) {
InitCom();
mem = GetTotalVideoMemory();
}
return mem * 1024 * 1024;
}
#endif