mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 04:41:23 +00:00
remove cpuaffinity code from SDL
still exists in DD (while it exists) but no longer saves. No reason whatsoever for affinity to be settable by the game itself.
This commit is contained in:
parent
700c9c2e70
commit
b258b9b503
2 changed files with 3 additions and 52 deletions
|
@ -45,9 +45,6 @@ typedef DWORD (WINAPI *p_timeGetTime) (void);
|
||||||
typedef UINT (WINAPI *p_timeEndPeriod) (UINT);
|
typedef UINT (WINAPI *p_timeEndPeriod) (UINT);
|
||||||
typedef HANDLE (WINAPI *p_OpenFileMappingA) (DWORD, BOOL, LPCSTR);
|
typedef HANDLE (WINAPI *p_OpenFileMappingA) (DWORD, BOOL, LPCSTR);
|
||||||
typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
|
typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
|
||||||
typedef HANDLE (WINAPI *p_GetCurrentProcess) (VOID);
|
|
||||||
typedef BOOL (WINAPI *p_GetProcessAffinityMask) (HANDLE, PDWORD_PTR, PDWORD_PTR);
|
|
||||||
typedef BOOL (WINAPI *p_SetProcessAffinityMask) (HANDLE, DWORD_PTR);
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -3070,52 +3067,6 @@ const CPUInfoFlags *I_CPUInfo(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
|
// note CPUAFFINITY code used to reside here
|
||||||
static void CPUAffinity_OnChange(void);
|
void I_RegisterSysCommands(void) {}
|
||||||
static consvar_t cv_cpuaffinity = {"cpuaffinity", "-1", CV_SAVE | CV_CALL, NULL, CPUAffinity_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
|
|
||||||
static p_GetCurrentProcess pfnGetCurrentProcess = NULL;
|
|
||||||
static p_GetProcessAffinityMask pfnGetProcessAffinityMask = NULL;
|
|
||||||
static p_SetProcessAffinityMask pfnSetProcessAffinityMask = NULL;
|
|
||||||
|
|
||||||
static inline VOID GetAffinityFuncs(VOID)
|
|
||||||
{
|
|
||||||
HMODULE h = GetModuleHandleA("kernel32.dll");
|
|
||||||
pfnGetCurrentProcess = (p_GetCurrentProcess)GetProcAddress(h, "GetCurrentProcess");
|
|
||||||
pfnGetProcessAffinityMask = (p_GetProcessAffinityMask)GetProcAddress(h, "GetProcessAffinityMask");
|
|
||||||
pfnSetProcessAffinityMask = (p_SetProcessAffinityMask)GetProcAddress(h, "SetProcessAffinityMask");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void CPUAffinity_OnChange(void)
|
|
||||||
{
|
|
||||||
DWORD_PTR dwProcMask, dwSysMask;
|
|
||||||
HANDLE selfpid;
|
|
||||||
|
|
||||||
if (!pfnGetCurrentProcess || !pfnGetProcessAffinityMask || !pfnSetProcessAffinityMask)
|
|
||||||
return;
|
|
||||||
else
|
|
||||||
selfpid = pfnGetCurrentProcess();
|
|
||||||
|
|
||||||
pfnGetProcessAffinityMask(selfpid, &dwProcMask, &dwSysMask);
|
|
||||||
|
|
||||||
/* If resulting mask is zero, don't change anything and fall back to
|
|
||||||
* actual mask.
|
|
||||||
*/
|
|
||||||
if(dwSysMask & cv_cpuaffinity.value)
|
|
||||||
{
|
|
||||||
pfnSetProcessAffinityMask(selfpid, dwSysMask & cv_cpuaffinity.value);
|
|
||||||
CV_StealthSetValue(&cv_cpuaffinity, (INT32)(dwSysMask & cv_cpuaffinity.value));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
CV_StealthSetValue(&cv_cpuaffinity, (INT32)dwProcMask);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void I_RegisterSysCommands(void)
|
|
||||||
{
|
|
||||||
#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
|
|
||||||
GetAffinityFuncs();
|
|
||||||
CV_RegisterVar(&cv_cpuaffinity);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3656,7 +3656,7 @@ const CPUInfoFlags *I_CPUInfo(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CPUAffinity_OnChange(void);
|
static void CPUAffinity_OnChange(void);
|
||||||
static consvar_t cv_cpuaffinity = {"cpuaffinity", "1", CV_SAVE | CV_CALL, NULL, CPUAffinity_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
static consvar_t cv_cpuaffinity = {"cpuaffinity", "-1", CV_CALL, NULL, CPUAffinity_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
typedef HANDLE (WINAPI *p_GetCurrentProcess) (VOID);
|
typedef HANDLE (WINAPI *p_GetCurrentProcess) (VOID);
|
||||||
static p_GetCurrentProcess pfnGetCurrentProcess = NULL;
|
static p_GetCurrentProcess pfnGetCurrentProcess = NULL;
|
||||||
|
|
Loading…
Reference in a new issue