1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

Add singlecpu ini var for CPU0 affinity forcing

This commit is contained in:
Toni Spets 2011-09-27 20:09:12 +03:00
parent 3c79b4aa4b
commit c6dfae327e

9
main.c
View File

@ -690,6 +690,8 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk
"vhack=false\n"
"; switch between OpenGL (opengl) and software (gdi) renderers, latter supports less features but might be faster depending on the GPU\n"
"renderer=gdi\n"
"; force CPU0 affinity, avoids crashes with RA, *might* have a performance impact\n"
"singlecpu=true\n"
, fh);
fclose(fh);
}
@ -819,6 +821,13 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk
This->renderer = render_main;
}
GetPrivateProfileStringA("ddraw", "singlecpu", "true", tmp, sizeof(tmp), ini_path);
if (tolower(tmp[0]) == 'y' || tolower(tmp[0]) == 't' || tolower(tmp[0]) == 'e' || tmp[0] == '1')
{
printf("DirectDrawCreate: Setting CPU0 affinity\n");
SetProcessAffinityMask(GetCurrentProcess(), 1);
}
/* last minute check for cnc-plugin */
if (GetEnvironmentVariable("DDRAW_WINDOW", tmp, sizeof(tmp)) > 0)
{