- Joined
- Jun 12, 2008
- Messages
- 623
- Reaction score
- 583
Hello,
I was trying to start my test server on PC with i7 processor with 12 logical cores and some of the muserver apps were crashing (eg. JoinServer, Gameserver). I did some research and implemented a workaround for this issue.
The idea is to limit max number of cores to 8. That's necessary because of the limitation of 16 threads in GS and JS.
Use DLib Attacher and attach MaxCpuLimit.dll to JoinServer and GameServer files.
I was trying to start my test server on PC with i7 processor with 12 logical cores and some of the muserver apps were crashing (eg. JoinServer, Gameserver). I did some research and implemented a workaround for this issue.
C++:
// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
#include "detours.h"
#pragma comment( lib, "detours.lib" )
void (WINAPI *_getSystemInfo)(LPSYSTEM_INFO) = GetSystemInfo;
void WINAPI _GetSystemInfo(__out LPSYSTEM_INFO lpSystemInfo) {
_getSystemInfo(lpSystemInfo);
if (lpSystemInfo->dwNumberOfProcessors > 8) {
lpSystemInfo->dwNumberOfProcessors = 8;
}
}
bool APIENTRY DllMain(HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved)
{
switch(dwReason)
{
case DLL_PROCESS_ATTACH:
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&(PVOID&)_getSystemInfo, _GetSystemInfo);
DetourTransactionCommit();
break;
case DLL_PROCESS_DETACH:
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourDetach(&(PVOID&)_getSystemInfo, _GetSystemInfo);
DetourTransactionCommit();
break;
}
return true;
}
The idea is to limit max number of cores to 8. That's necessary because of the limitation of 16 threads in GS and JS.
Use DLib Attacher and attach MaxCpuLimit.dll to JoinServer and GameServer files.