Skip to content

Commit 12450e8

Browse files
committed
Merge branch 'dev'
2 parents 5ea5333 + 56c1d7a commit 12450e8

29 files changed

Lines changed: 1056 additions & 171 deletions

Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,14 @@ install:
4545

4646
zips: rebuild
4747
@mkdir -p zips
48-
7z a -mx9 -m9=lzma2 "zips/SLSsteam $(DATE).7z" "bin/SLSsteam.so" "setup.sh"
49-
#Maybe should be somewhere else, but who cares. Does anyone even use this besides me?
50-
7z a -mx9 -m9=lzma2 "zips/SLSsteam - SLSConfig $(DATE).7z" "$(HOME)/.config/SLSsteam/config.yaml"
51-
48+
7z a -mx9 -m9=lzma2 "zips/SLSsteam $(DATE).7z" "bin/SLSsteam.so" "setup.sh" "tools/SLScheevo"
5249
#Compatibility for Github issues
53-
7z a -mx9 -m9=lzma "zips/SLSsteam $(DATE).zip" "bin/SLSsteam.so" "setup.sh"
50+
7z a -mx9 -m9=lzma "zips/SLSsteam $(DATE).zip" "bin/SLSsteam.so" "setup.sh" "tools/SLScheevo"
51+
52+
zips-config:
5453
7z a -mx9 -m9=lzma "zips/SLSsteam - SLSConfig $(DATE).zip" "$(HOME)/.config/SLSsteam/config.yaml"
54+
#Compatibility for Github issues
55+
7z a -mx9 -m9=lzma2 "zips/SLSsteam - SLSConfig $(DATE).7z" "$(HOME)/.config/SLSsteam/config.yaml"
5556

5657
build: bin/SLSsteam.so
5758
rebuild: clean build

pkg/slssteam-git/PKGBUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ optdepends=("steam-native"
1616
"ccache")
1717

1818
provides=("slssteam")
19+
conflicts=("slssteam")
1920

2021

2122
source=("git+$url#branch=dev")

pkg/slssteam/PKGBUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ depends=("steam"
1515
optdepends=("steam-native")
1616

1717
provides=("slssteam")
18+
conflicts=("slssteam-git")
1819

1920
source=("https://github.com/AceSLS/SLSsteam/archive/refs/tags/$pkgver.tar.gz")
2021
makedepends=("gcc")

src/config.cpp

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ static const char* defaultConfig =
4747
"DenuvoGames:\n\n"
4848
"#Spoof Denuvo Games owner instead of blocking them\n"
4949
"DenuvoSpoof: no\n\n"
50+
"#Pretends Steam never received an Encrypted AppTicket, so it\n"
51+
"#only gets saved to the cache instead of \"being used up\"\n"
52+
"BlockEncryptedAppTickets: no\n\n"
5053
"#Automatically disable SLSsteam when steamclient.so does not match a predefined file hash that is known to work\n"
5154
"#You should enable this if you're planing to use SLSsteam with Steam Deck's gamemode\n"
5255
"SafeMode: no\n\n"
@@ -57,6 +60,15 @@ static const char* defaultConfig =
5760
"WarnHashMissmatch: no\n\n"
5861
"#Notify when SLSsteam is done initializing\n"
5962
"NotifyInit: yes\n\n"
63+
"#Log levels:\n"
64+
"#Once = 0\n"
65+
"#Debug = 1\n"
66+
"#Info = 2\n"
67+
"#NotifyShort = 3\n"
68+
"#NotifyLong = 4\n"
69+
"#Warn = 5\n"
70+
"#None = 6\n"
71+
"LogLevel: 2\n\n"
6072
"#Logs all calls to Steamworks (this makes the logfile huge! Only useful for debugging/analyzing\n"
6173
"ExtendedLogging: no";
6274

@@ -147,6 +159,8 @@ bool CConfig::loadSettings()
147159
warnHashMissmatch = getSetting<bool>(node, "WarnHashMissmatch", false);
148160
notifyInit = getSetting<bool>(node, "NotifyInit", true);
149161
extendedLogging = getSetting<bool>(node, "ExtendedLogging", false);
162+
logLevel = getSetting<unsigned int>(node, "LogLevel", 2);
163+
blockEncryptedAppTickets = getSetting<bool>(node, "BlockEncryptedAppTickets", false);
150164
denuvoSpoof = getSetting<bool>(node, "DenuvoSpoof", false);
151165

152166
//TODO: Create smart logging function to log them automatically via getSetting
@@ -159,7 +173,9 @@ bool CConfig::loadSettings()
159173
g_pLog->info("WarnHashMissmatch: %i\n", warnHashMissmatch);
160174
g_pLog->info("NotifyInit: %i\n", notifyInit);
161175
g_pLog->info("ExtendedLogging: %i\n", extendedLogging);
176+
g_pLog->info("LogLevel: %i\n", logLevel);
162177
g_pLog->info("DenuvoSpoof: %i\n", denuvoSpoof);
178+
g_pLog->info("BlockEncryptedAppTickets: %i\n", blockEncryptedAppTickets);
163179

164180
//TODO: Create function to parse these kinda nodes, instead of c+p them
165181
const auto appIdsNode = node["AppIds"];
@@ -217,7 +233,7 @@ bool CConfig::loadSettings()
217233

218234
CDlcData data;
219235
data.parentId = parentId;
220-
g_pLog->debug("Adding DlcData for %u\n", parentId);
236+
g_pLog->info("Adding DlcData for %u\n", parentId);
221237

222238
for(auto& dlc : app.second)
223239
{
@@ -226,7 +242,7 @@ bool CConfig::loadSettings()
226242
const std::string dlcName = dlc.second.as<std::string>();
227243

228244
data.dlcIds[dlcId] = dlcName;
229-
g_pLog->debug("DlcId %u -> %s\n", dlcId, dlcName.c_str());
245+
g_pLog->info("DlcId %u -> %s\n", dlcId, dlcName.c_str());
230246
}
231247

232248
dlcData[parentId] = data;
@@ -259,7 +275,7 @@ bool CConfig::loadSettings()
259275
denuvoGames[steamId].emplace(appId);
260276

261277
//Again, not loggin SteamId because of privacy
262-
g_pLog->debug("Added DenuvoGame %u\n", appId);
278+
g_pLog->info("Added DenuvoGame %u\n", appId);
263279
}
264280
}
265281
catch (...)

src/config.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class CConfig {
2828
std::unordered_map<uint32_t, CDlcData> dlcData;
2929
//SteamId, AppIds tuple
3030
std::unordered_map<uint32_t, std::unordered_set<uint32_t>> denuvoGames;
31+
bool blockEncryptedAppTickets;
3132
bool denuvoSpoof;
3233

3334
bool disableFamilyLock;
@@ -38,6 +39,7 @@ class CConfig {
3839
bool notifications;
3940
bool warnHashMissmatch;
4041
bool notifyInit;
42+
unsigned int logLevel;
4143
bool extendedLogging;
4244

4345
std::string getDir();

src/feats/apps.cpp

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
#include "apps.hpp"
2+
3+
#include "../sdk/IClientApps.hpp"
4+
5+
#include "../config.hpp"
6+
#include "../globals.hpp"
7+
8+
bool Apps::applistRequested;
9+
std::map<uint32_t, int> Apps::appIdOwnerOverride;
10+
11+
bool Apps::checkAppOwnership(uint32_t appId, CAppOwnershipInfo* pInfo)
12+
{
13+
//Wait Until GetSubscribedApps gets called once to let Steam request and populate legit data first.
14+
//Afterwards modifying should hopefully not affect false positives anymore
15+
if (!applistRequested || !pInfo || !g_currentSteamId)
16+
{
17+
return false;
18+
}
19+
20+
uint32_t ownerOverride = g_currentSteamId;
21+
const uint32_t denuvoOwner = g_config.getDenuvoGameOwner(appId);
22+
23+
//Do not modify Denuvo enabled Games
24+
if (denuvoOwner && denuvoOwner != g_currentSteamId)
25+
{
26+
if (g_config.denuvoSpoof)
27+
{
28+
ownerOverride = denuvoOwner;
29+
}
30+
else
31+
{
32+
//Would love to log the SteamId, but for users anonymity I won't
33+
g_pLog->once("Skipping %u because it's a Denuvo game from someone else\n", appId);
34+
return false;
35+
}
36+
}
37+
38+
//Doing that might be not worth it since this will most likely be easier to mantain
39+
//TODO: Backtrace those 4 calls and only patch the really necessary ones since this might be prone to breakage
40+
if (g_config.disableFamilyLock && appIdOwnerOverride.count(appId) && appIdOwnerOverride.at(appId) < 4)
41+
{
42+
ownerOverride = 1;
43+
appIdOwnerOverride[appId]++;
44+
}
45+
46+
if (!g_config.shouldExcludeAppId(appId) && (g_config.isAddedAppId(appId) || (g_config.playNotOwnedGames && !pInfo->purchased)))
47+
{
48+
//Changing the purchased field is enough, but just for nicety in the Steamclient UI we change the owner too
49+
pInfo->ownerSteamId = ownerOverride;
50+
pInfo->familyShared = ownerOverride != g_currentSteamId;
51+
52+
pInfo->purchased = true;
53+
//Unnessecary but whatever
54+
pInfo->permanent = !pInfo->familyShared;
55+
56+
//Found in backtrace
57+
pInfo->releaseState = 4;
58+
pInfo->field10_0x25 = 0;
59+
//Seems to do nothing in particular, some dlc have this as 1 so I uncomented this for now. Might be free stuff?
60+
//pOwnershipInfo->field27_0x36 = 1;
61+
62+
g_config.addAdditionalAppId(appId);
63+
}
64+
65+
//Returning false after we modify data shouldn't cause any problems because it should just get discarded
66+
67+
if (!g_pClientApps)
68+
return false;
69+
70+
auto type = g_pClientApps->getAppType(appId);
71+
if (type == APPTYPE_DLC) //Don't touch DLC here, otherwise downloads might break. Hopefully this won't decrease compatibility
72+
{
73+
return false;
74+
}
75+
76+
if (g_config.automaticFilter)
77+
{
78+
switch(type)
79+
{
80+
case APPTYPE_APPLICATION:
81+
case APPTYPE_GAME:
82+
break;
83+
84+
default:
85+
return false;
86+
}
87+
}
88+
89+
return true;
90+
}
91+
92+
void Apps::getSubscribedApps(uint32_t* appList, size_t size, uint32_t& count)
93+
{
94+
//Valve calls this function twice, once with size of 0 then again
95+
if (!size || !appList)
96+
{
97+
count = count + g_config.addedAppIds.size();
98+
return;
99+
}
100+
101+
//TODO: Maybe Add check if AppId already in list before blindly appending
102+
for(auto& appId : g_config.addedAppIds)
103+
{
104+
appList[count++] = appId;
105+
}
106+
107+
applistRequested = true;
108+
}
109+
110+
void Apps::launchApp(uint32_t appId)
111+
{
112+
appIdOwnerOverride[appId] = 0;
113+
}
114+
115+
bool Apps::shouldDisableCloud(uint32_t appId)
116+
{
117+
return g_config.isAddedAppId(appId);
118+
}
119+
120+
bool Apps::shouldDisableCDKey(uint32_t appId)
121+
{
122+
return g_config.isAddedAppId(appId);
123+
}
124+
125+
bool Apps::shouldDisableUpdates(uint32_t appId)
126+
{
127+
return g_config.isAddedAppId(appId);
128+
}

src/feats/apps.hpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#pragma once
2+
3+
#include "../sdk/CAppOwnershipInfo.hpp"
4+
5+
#include <cstddef>
6+
#include <cstdint>
7+
#include <map>
8+
9+
10+
namespace Apps
11+
{
12+
extern bool applistRequested;
13+
extern std::map<uint32_t, int> appIdOwnerOverride;
14+
15+
bool checkAppOwnership(uint32_t appId, CAppOwnershipInfo* info);
16+
void getSubscribedApps(uint32_t* appList, size_t size, uint32_t& count);
17+
void launchApp(uint32_t appId);
18+
19+
bool shouldDisableCloud(uint32_t appId);
20+
bool shouldDisableCDKey(uint32_t appId);
21+
bool shouldDisableUpdates(uint32_t appId);
22+
};

src/feats/dlc.cpp

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#include "dlc.hpp"
2+
3+
#include "../sdk/IClientAppManager.hpp"
4+
5+
#include "../config.hpp"
6+
7+
8+
bool DLC::isDlcEnabled(uint32_t appId)
9+
{
10+
//TODO: Add check for legit ownership to allow toggle on/off
11+
return !g_config.shouldExcludeAppId(appId);
12+
}
13+
14+
bool DLC::isSubscribed(uint32_t appId)
15+
{
16+
return !g_config.shouldExcludeAppId(appId);
17+
}
18+
19+
bool DLC::isAppDlcInstalled(uint32_t appId, uint32_t dlcId)
20+
{
21+
//Do not pretend things are installed while downloading Apps, otherwise downloads will break for some of them
22+
auto state = g_pClientAppManager->getAppInstallState(appId);
23+
if (state & APPSTATE_DOWNLOADING || state & APPSTATE_INSTALLING)
24+
{
25+
g_pLog->once("Skipping DlcId %u because AppId %u has AppState %i\n", dlcId, appId, state);
26+
return false;
27+
}
28+
29+
if (g_config.shouldExcludeAppId(dlcId))
30+
{
31+
return false;
32+
}
33+
34+
return true;
35+
}
36+
37+
bool DLC::userSubscribedInTicket(uint32_t appId)
38+
{
39+
//Might want to compare the steamId param to the g_currentSteamId in the future
40+
//Although not doing that might also work for Dedicated servers?
41+
return !g_config.shouldExcludeAppId(appId);
42+
}
43+
44+
uint32_t DLC::getDlcCount(uint32_t appId)
45+
{
46+
if (g_config.dlcData.contains(appId))
47+
{
48+
return g_config.dlcData[appId].dlcIds.size();
49+
}
50+
51+
return 0;
52+
}
53+
54+
bool DLC::getDlcDataByIndex(uint32_t appId, int index, uint32_t* dlcId, bool* available, char* dlcName, size_t& dlcNameLen)
55+
{
56+
if (!dlcId || !available || !dlcName)
57+
{
58+
return false;
59+
}
60+
61+
if (g_config.dlcData.contains(appId))
62+
{
63+
auto& data = g_config.dlcData[appId];
64+
auto dlc = std::next(data.dlcIds.begin(), index);
65+
66+
*dlcId = dlc->first;
67+
*available = true;
68+
69+
//No clue if we have to check for errors during printf since the devs hopefully didn't fuck
70+
//up the dlcNameLen. Who knows though
71+
snprintf(dlcName, dlcNameLen, "%s", dlc->second.c_str());
72+
73+
return true;
74+
}
75+
else if (!g_config.shouldExcludeAppId(*dlcId))
76+
{
77+
*available = true;
78+
}
79+
80+
return false;
81+
}

src/feats/dlc.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#pragma once
2+
3+
#include <cstddef>
4+
#include <cstdint>
5+
6+
7+
namespace DLC
8+
{
9+
bool isDlcEnabled(uint32_t appId);
10+
bool isSubscribed(uint32_t appId);
11+
bool isAppDlcInstalled(uint32_t appId, uint32_t dlcId);
12+
bool userSubscribedInTicket(uint32_t appId);
13+
14+
uint32_t getDlcCount(uint32_t appId);
15+
bool getDlcDataByIndex(uint32_t appId, int index, uint32_t* dlcId, bool* available, char* dlcName, size_t& dlcNameLen);
16+
}

0 commit comments

Comments
 (0)