mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-14 22:03:27 +01:00
#295 add workaround for Win11 steam RA2 crash
This commit is contained in:
parent
f2d1e9e3e6
commit
82571fe8db
@ -20,6 +20,8 @@ typedef struct CNCDDRAWCONFIG
|
||||
char dll_file_ext[MAX_PATH];
|
||||
INIFILE ini;
|
||||
BOOL is_wine;
|
||||
BOOL d3d9on12;
|
||||
BOOL opengl_core;
|
||||
|
||||
/* Optional settings */
|
||||
|
||||
|
2
inc/dd.h
2
inc/dd.h
@ -143,8 +143,6 @@ typedef struct CNCDDRAW
|
||||
DWORD minfps_tick_len;
|
||||
DWORD gui_thread_id;
|
||||
BOOL show_driver_warning;
|
||||
BOOL d3d9on12;
|
||||
BOOL opengl_core;
|
||||
|
||||
} CNCDDRAW;
|
||||
|
||||
|
4
src/dd.c
4
src/dd.c
@ -1466,11 +1466,11 @@ HRESULT dd_CreateEx(GUID* lpGuid, LPVOID* lplpDD, REFIID iid, IUnknown* pUnkOute
|
||||
|
||||
if (_strcmpi(g_config.renderer, "direct3d9on12") == 0)
|
||||
{
|
||||
g_ddraw->d3d9on12 = TRUE;
|
||||
g_config.d3d9on12 = TRUE;
|
||||
}
|
||||
else if (_strcmpi(g_config.renderer, "openglcore") == 0)
|
||||
{
|
||||
g_ddraw->opengl_core = TRUE;
|
||||
g_config.opengl_core = TRUE;
|
||||
}
|
||||
|
||||
if (tolower(g_config.renderer[0]) == 'd') /* direct3d9 or direct3d9on12*/
|
||||
|
@ -52,6 +52,12 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
||||
|
||||
while (s)
|
||||
{
|
||||
/* Workaround for bug in Windows 11 (Steam RA2 crash) */
|
||||
if (_strcmpi(s, "Win7RTM") == 0)
|
||||
{
|
||||
g_config.d3d9on12 = TRUE;
|
||||
}
|
||||
|
||||
if (_strcmpi(s, "WIN95") == 0 || _strcmpi(s, "WIN98") == 0 || _strcmpi(s, "NT4SP5") == 0)
|
||||
{
|
||||
char mes[128] = { 0 };
|
||||
|
@ -218,7 +218,7 @@ void oglu_init()
|
||||
wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)xwglGetProcAddress("wglCreateContextAttribsARB");
|
||||
}
|
||||
|
||||
if (g_ddraw->opengl_core)
|
||||
if (g_config.opengl_core)
|
||||
{
|
||||
wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)xwglGetProcAddress("wglCreateContextAttribsARB");
|
||||
}
|
||||
|
@ -27,11 +27,27 @@ BOOL d3d9_is_available()
|
||||
|
||||
if ((g_d3d9.hmodule = real_LoadLibraryA("d3d9.dll")))
|
||||
{
|
||||
IDirect3D9* (WINAPI * d3d_create9)(UINT) =
|
||||
(IDirect3D9 * (WINAPI*)(UINT))real_GetProcAddress(g_d3d9.hmodule, "Direct3DCreate9");
|
||||
if (g_config.d3d9on12)
|
||||
{
|
||||
D3D9ON12_ARGS args;
|
||||
memset(&args, 0, sizeof(args));
|
||||
args.Enable9On12 = TRUE;
|
||||
|
||||
if (d3d_create9 && (d3d9 = d3d_create9(D3D_SDK_VERSION)))
|
||||
IDirect3D9_Release(d3d9);
|
||||
IDirect3D9* (WINAPI * d3d_create9on12)(INT, D3D9ON12_ARGS*, UINT) =
|
||||
(void*)real_GetProcAddress(g_d3d9.hmodule, "Direct3DCreate9On12");
|
||||
|
||||
if (d3d_create9on12 && (d3d9 = d3d_create9on12(D3D_SDK_VERSION, &args, 1)))
|
||||
IDirect3D9_Release(d3d9);
|
||||
}
|
||||
|
||||
if (!d3d9)
|
||||
{
|
||||
IDirect3D9* (WINAPI * d3d_create9)(UINT) =
|
||||
(IDirect3D9 * (WINAPI*)(UINT))real_GetProcAddress(g_d3d9.hmodule, "Direct3DCreate9");
|
||||
|
||||
if (d3d_create9 && (d3d9 = d3d_create9(D3D_SDK_VERSION)))
|
||||
IDirect3D9_Release(d3d9);
|
||||
}
|
||||
}
|
||||
|
||||
return d3d9 != NULL;
|
||||
@ -59,7 +75,7 @@ BOOL d3d9_create()
|
||||
IDirect3D9* (WINAPI * d3d_create9on12)(INT, D3D9ON12_ARGS*, UINT) = NULL;
|
||||
IDirect3D9* (WINAPI * d3d_create9)(UINT) = (void*)real_GetProcAddress(g_d3d9.hmodule, "Direct3DCreate9");
|
||||
|
||||
if (g_ddraw->d3d9on12)
|
||||
if (g_config.d3d9on12)
|
||||
{
|
||||
d3d_create9on12 = (void*)real_GetProcAddress(g_d3d9.hmodule, "Direct3DCreate9On12");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user