Skip to content

Commit

Permalink
affinity option for blacklist
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirteenAG committed Oct 27, 2024
1 parent 4cf3a06 commit d733f17
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ DisableNightVisionFlash = 1 // Disables the white flash when acti
DisablePerfectionistChecks = 1 // M&E UI, radar
DefaultMissionFilter = 1 // 0: All missions | 1: Active missions | 2: Campaign missions | 3: 4E missions
SMIMapDisableStartupAnimation = 1
ForceCPUAffinityToAllCores = 1

[UNLOCKS]
UnlockDLC = 1 // Unlocks all DLC content that is not possible to obtain after server shutdown
Expand Down
23 changes: 23 additions & 0 deletions source/SplinterCellBlacklist.FusionMod/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@
#include <LEDEffects.h>
#include <random>

SafetyHookInline shSetProcessAffinityMask{};
BOOL WINAPI SetProcessAffinityMaskHook(HANDLE hProcess, DWORD_PTR dwProcessAffinityMask)
{
if (hProcess == GetCurrentProcess())
{
DWORD_PTR processAffinityMask;
DWORD_PTR systemAffinityMask;

if (GetProcessAffinityMask(GetCurrentProcess(), &processAffinityMask, &systemAffinityMask))
{
return shSetProcessAffinityMask.stdcall<BOOL>(hProcess, systemAffinityMask);
}
}

return shSetProcessAffinityMask.stdcall<BOOL>(hProcess, dwProcessAffinityMask);
}

HWND WindowHandle;

enum eGameMode
Expand Down Expand Up @@ -208,6 +225,7 @@ void Init()
auto bDisablePerfectionistChecks = iniReader.ReadInteger("MAIN", "DisablePerfectionistChecks", 1) != 0;
auto nDefaultMissionFilter = std::clamp(iniReader.ReadInteger("MAIN", "DefaultMissionFilter", 1), 0, 3);
auto bSMIMapDisableStartupAnimation = iniReader.ReadInteger("MAIN", "SMIMapDisableStartupAnimation", 1) != 0;
auto bForceCPUAffinityToAllCores = iniReader.ReadInteger("MAIN", "ForceCPUAffinityToAllCores", 1) != 0;

sExtractionWaveConfigs = iniReader.ReadString("EXTRACTION", "ExtractionWaveConfigs", "Default");
nExtractionWaveEnemyMultiplier = std::clamp(iniReader.ReadInteger("EXTRACTION", "ExtractionWaveEnemyMultiplier", 1), 1, 9999);
Expand Down Expand Up @@ -919,6 +937,11 @@ void Init()
pattern = hook::pattern("0F 8E ? ? ? ? 8D 8E ? ? ? ? E8 ? ? ? ? 80 BE");
injector::WriteMemory<uint16_t>(pattern.count(2).get(1).get<void>(), 0xE990, true); //jle -> jmp
}

if (bForceCPUAffinityToAllCores)
{
shSetProcessAffinityMask = safetyhook::create_inline(SetProcessAffinityMask, SetProcessAffinityMaskHook);
}
}

std::string currentGogglesLight = "LightGreen";
Expand Down

0 comments on commit d733f17

Please sign in to comment.