Skip to content

Commit

Permalink
Added option to disable Steam DLC unlocking
Browse files Browse the repository at this point in the history
  • Loading branch information
acidicoala committed Mar 30, 2021
1 parent d2c87b7 commit f824d5f
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 31 deletions.
3 changes: 3 additions & 0 deletions Common/Common.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
</ClCompile>
<ClCompile Include="src\util.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
Expand Down
3 changes: 3 additions & 0 deletions Common/Common.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,7 @@
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions Common/cpp.hint
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Hint files help the Visual Studio IDE interpret Visual C++ identifiers
// such as names of functions and macros.
// For more information see https://go.microsoft.com/fwlink/?linkid=865984
#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, __VA_ARGS__) inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }
1 change: 1 addition & 0 deletions Common/src/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ void from_json(const json& j, SteamPlatform& p)
{
from_json(j, (Platform&) p);
j["unlock_shared_library"].get_to(p.unlock_shared_library);
j["unlock_dlc"].get_to(p.unlock_dlc);
}

NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Platforms, Steam, EpicGames, Origin, UplayR1)
Expand Down
3 changes: 2 additions & 1 deletion Common/src/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ struct Platform

struct SteamPlatform : Platform
{
bool unlock_shared_library = true;
bool unlock_dlc = true;
bool unlock_shared_library = false;
};

struct Platforms
Expand Down
2 changes: 1 addition & 1 deletion Common/src/constants.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

constexpr auto VERSION = "1.2.2";
constexpr auto VERSION = "1.3.0";

constexpr auto INTEGRATION_64 = L"Integration64.dll";
constexpr auto INTEGRATION_32 = L"Integration32.dll";
Expand Down
29 changes: 15 additions & 14 deletions Config.jsonc
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
{
"config_version": 3, // DO NOT EDIT THIS VALUE
"config_version": 4, // DO NOT EDIT THIS VALUE
"log_level": "info",
"platforms": {
"Steam": {
"enabled": true,
"process": "steam.exe",
"replicate": false,
"unlock_dlc": true,
"unlock_shared_library": false,
"blacklist": [ // Get App ID from SteamDB
"22618", // Alien Breed: Impact - PL Check [Do not force polish language]
"67379" // Darkness II Low Violence [Do not censor violence]
],
"ignore": [
"x86launcher.exe",
"x64launcher.exe",
Expand All @@ -17,45 +22,41 @@
"gldriverquery64.exe",
"vulkandriverquery.exe",
"vulkandriverquery64.exe"
],
"blacklist": [ // Get App ID from SteamDB
"22618", // Alien Breed: Impact - PL Check [Do not force polish language]
"67379" // Darkness II Low Violence [Do not censor violence]
]
},
"EpicGames": {
"enabled": true,
"process": "EpicGamesLauncher.exe",
"replicate": true,
"blacklist": [ // Get DLC ID from ScreamDB
"ffffffffffffffffffffffffffffffff" // A Total War Sage: TROY [It actually asks this ID...]
],
"ignore": [
"EpicWebHelper.exe",
"EpicOnlineServicesHost.exe",
"EpicOnlineServicesUserHelper.exe",
"UnrealCEFSubProcess.exe"
],
"blacklist": [ // Get DLC ID from ScreamDB
"ffffffffffffffffffffffffffffffff" // A Total War Sage: TROY [It actually asks this ID...]
]
},
"Origin": {
"enabled": true,
"process": "Origin.exe",
"replicate": false,
"ignore": [],
"blacklist": [ // Use ItemId from Unlocker32.Origin.log
// "SIMS4.OFF.SOLP.0x0000000000030553" // Sims 4: Get Famous [Better stay anonymous]
]

],
"ignore": []
},
"UplayR1": {
"enabled": true,
"process": "upc.exe",
"replicate": true,
"blacklist": [ // Use aUplayId from the generated log file

],
"ignore": [
"UplayService.exe",
"UplayWebCore.exe"
],
"blacklist": [ // Use aUplayId from the generated log file

]
}
},
Expand Down
27 changes: 19 additions & 8 deletions Unlocker/src/ProcessHooker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,24 +140,35 @@ void injectIfNecessary(wstring cmdLine, LPPROCESS_INFORMATION lpProcessInformati
{
for(const auto& ignoredProcess : platform.ignore)
{
if(stringsAreEqual(newProcName, ignoredProcess))
if(stringsAreEqual(newProcName, ignoredProcess, true))
{
// Do not inject since the process is ignored for this platforms
logger->debug("Skipping injection since the new process is ignored for this platform");
return;
}
}
// Special case of Steam->Uplay integration
if(contains(wtos(cmdLine), "uplay_steam_mode"))

// Special Steam checks
if(stringsAreEqual(config->platformRefs.Steam.process, platform.process, true))
{
if(!config->platformRefs.UplayR1.replicate)
// Steam->Uplay integration
if(contains(wtos(cmdLine), "uplay_steam_mode"))
{
logger->debug("Skipping injection since Uplay replication is disabled");
return;
if(!config->platformRefs.UplayR1.replicate)
{
logger->debug("Skipping injection since Uplay replication is disabled");
return;
}
else
{
break;
}
}
else

if(!config->platformRefs.Steam.unlock_dlc)
{
break;
logger->debug("Skipping injection since DLC unlocking in Steam is disabled");
return;
}
}

Expand Down
2 changes: 1 addition & 1 deletion Unlocker/src/UpdateChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void UpdateChecker::checkForUpdates()
{
logger->warn(
"A new Koalageddon version {} has been released. Get it from: {} ",
currentVersionTag, latest_release_url
tagName, latest_release_url
);
}
}).detach();
Expand Down
11 changes: 7 additions & 4 deletions Unlocker/src/platforms/steam/Steam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@

void Steam::platformInit()
{
HOOK(SteamInternal_FindOrCreateUserInterface);
HOOK(SteamInternal_CreateInterface);
HOOK(SteamApps);
HOOK(SteamClient);
if(config->platformRefs.Steam.unlock_dlc)
{
HOOK(SteamInternal_FindOrCreateUserInterface);
HOOK(SteamInternal_CreateInterface);
HOOK(SteamApps);
HOOK(SteamClient);
}
}

string Steam::getPlatformName()
Expand Down
2 changes: 1 addition & 1 deletion Unlocker/src/platforms/steam_client/SteamClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void SteamClient::installHooks()
HOOK(SharedLibraryLockStatus);
HOOK(SharedLibraryStopPlaying);
}
if(!config->platformRefs.Steam.replicate)
if(config->platformRefs.Steam.unlock_dlc && !config->platformRefs.Steam.replicate)
{
HOOK(IsAppDLCEnabled);
HOOK(IsSubscribedApp);
Expand Down
2 changes: 1 addition & 1 deletion inno_setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Koalageddon"
#define MyAppVersion "1.2.2"
#define MyAppVersion "1.3.0"
#define MyAppPublisher "acidicoala"
#define MyAppURL "https://github.com/acidicoala/Koalageddon"
#define MyAppExeName "IntegrationWizard32.exe"
Expand Down

0 comments on commit f824d5f

Please sign in to comment.