[MISC] Allow user to override process priority class
This commit is contained in:
committed by
Radosław Gliński
parent
82cb261140
commit
cf0ee05da6
@@ -7,6 +7,7 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include <map>
|
||||
#include "xenia/base/platform_win.h"
|
||||
#include "xenia/base/string.h"
|
||||
#include "xenia/base/system.h"
|
||||
@@ -48,4 +49,19 @@ void ShowSimpleMessageBox(SimpleMessageBoxType type,
|
||||
type_flags);
|
||||
}
|
||||
|
||||
static std::map<const uint32_t, DWORD> xeniaToWindowsPriorityClassMapping = {
|
||||
{0, NORMAL_PRIORITY_CLASS},
|
||||
{1, ABOVE_NORMAL_PRIORITY_CLASS},
|
||||
{2, HIGH_PRIORITY_CLASS},
|
||||
{3, REALTIME_PRIORITY_CLASS}};
|
||||
|
||||
bool SetProcessPriorityClass(const uint32_t priority_class) {
|
||||
if (!xeniaToWindowsPriorityClassMapping.count(priority_class)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return SetPriorityClass(GetCurrentProcess(),
|
||||
xeniaToWindowsPriorityClassMapping[priority_class]);
|
||||
}
|
||||
|
||||
} // namespace xe
|
||||
|
||||
Reference in New Issue
Block a user