parent
54584b5f73
commit
65248326c1
@ -755,17 +755,6 @@ namespace arxan
|
|||||||
{
|
{
|
||||||
search_and_patch_integrity_checks();
|
search_and_patch_integrity_checks();
|
||||||
//restore_debug_functions();
|
//restore_debug_functions();
|
||||||
|
|
||||||
scheduler::once([]
|
|
||||||
{
|
|
||||||
SetProcessAffinityMask(GetCurrentProcess(), 2 << (std::min(std::thread::hardware_concurrency(), 4U)));
|
|
||||||
|
|
||||||
scheduler::once([] {
|
|
||||||
DWORD_PTR affinity_proc, affinity_sys;
|
|
||||||
GetProcessAffinityMask(GetCurrentProcess(), &affinity_proc, &affinity_sys);
|
|
||||||
SetProcessAffinityMask(GetCurrentProcess(), affinity_sys);
|
|
||||||
}, scheduler::pipeline::main, 1s);
|
|
||||||
}, scheduler::pipeline::main);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
component_priority priority() const override
|
component_priority priority() const override
|
||||||
|
43
src/client/component/client_patches.cpp
Normal file
43
src/client/component/client_patches.cpp
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#include <std_include.hpp>
|
||||||
|
#include "loader/component_loader.hpp"
|
||||||
|
|
||||||
|
#include "scheduler.hpp"
|
||||||
|
|
||||||
|
namespace client_patches
|
||||||
|
{
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
void reduce_process_affinity()
|
||||||
|
{
|
||||||
|
const DWORD_PTR affinity = (2ULL << (std::min(std::thread::hardware_concurrency(), 4U))) - 1;
|
||||||
|
SetProcessAffinityMask(GetCurrentProcess(), affinity);
|
||||||
|
}
|
||||||
|
|
||||||
|
void reset_process_affinity()
|
||||||
|
{
|
||||||
|
DWORD_PTR affinity_proc, affinity_sys;
|
||||||
|
GetProcessAffinityMask(GetCurrentProcess(), &affinity_proc, &affinity_sys);
|
||||||
|
SetProcessAffinityMask(GetCurrentProcess(), affinity_sys);
|
||||||
|
}
|
||||||
|
|
||||||
|
void fix_amd_cpu_stuttering()
|
||||||
|
{
|
||||||
|
scheduler::once([]
|
||||||
|
{
|
||||||
|
reduce_process_affinity();
|
||||||
|
scheduler::once(reset_process_affinity, scheduler::pipeline::main, 1s);
|
||||||
|
}, scheduler::pipeline::main);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class component final : public client_component
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void post_unpack() override
|
||||||
|
{
|
||||||
|
fix_amd_cpu_stuttering();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
REGISTER_COMPONENT(client_patches::component)
|
Loading…
Reference in New Issue
Block a user