Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions launcher/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@

#ifdef Q_OS_WINDOWS
#include <QStyleFactory>

#define WIN32_LEAN_AND_MEAN
#include <windows.h>

#include "umbra_log.h"
#endif

#include "umbra-version.h"
Expand All @@ -24,6 +29,22 @@ using namespace Qt::StringLiterals;

int main(int argc, char *argv[])
{
// Restrict to first 14 threads on Windows as the game will crash when running on 16 or more threads.
// This is handled via taskset on Linux, but on Windows that doesn't exist. If we set our own affinity, that's then passed to our children.
#if defined(Q_OS_WIN)
HANDLE hProcess = GetCurrentProcess();

unsigned long lProcessAffinityMask = 0;
unsigned long lSystemAffinityMask = 0;
GetProcessAffinityMask(hProcess, reinterpret_cast<PDWORD_PTR>(&lProcessAffinityMask), reinterpret_cast<PDWORD_PTR>(&lSystemAffinityMask));

lProcessAffinityMask &= 0x3FFF;

if (!SetProcessAffinityMask(hProcess, lProcessAffinityMask)) {
qCWarning(UMBRA_LOG) << "Could not set process affinity, the game will NOT launch correctly on certain systems!";
}
#endif

KIconTheme::initTheme(); // TODO: KirigamiApp doesn't call this before app construction so it doesn't work on Windows

KirigamiApp::App app(argc, argv);
Expand Down
Loading