[Release] MuServer multicore processor fix

Damian

Team Member
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.
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.
 

Attachments

  • MaxCpuLimit.rar
    8.1 KB · Views: 75
  • DLib Attacher v1.3a.rar
    677.1 KB · Views: 59
I will try it today, thanks for this fix, since a lot of people are getting CPU's with 8+ cores nowadays. (Please, let's not make the distinction between threads/real cores/logical cores, etc)...


Edit: Tried, worked like a charm, thank you! Cool release, easy to use!
 
Last edited:
  • Like
Reactions: Damian
Hey m8
First of all thanks for release!!
Can you help me a bit
In Procedure name: what i put? (dlibattacher)

thanks in advance
 
Thank you for the great tool (DLL)

I tried to attach it to Joinserver and it worked perfectly, but when I try to attach it to Gameserver it's not working.

01.png

02.png
 
Last edited:
I am using 13600KF with 14 cores and 20 threads. How can I increase the limit to 20 threads