Skip to content

Commit 979f854

Browse files
committed
found out what it needed to be done correctly
1 parent 9d11916 commit 979f854

4 files changed

Lines changed: 72 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ build64/
33
build/
44
.vs/
55
/relbuild
6+
/debbuild

dllmain.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,15 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
350350
SteamStub_Init();
351351
}
352352
}
353+
else if (dwReason == DLL_PROCESS_DETACH)
354+
{
355+
UCOLOG("[UCOnline2] DllMain -> DLL_PROCESS_DETACH");
356+
if (g_bSteamStubEnabled)
357+
{
358+
MH_DisableHook(reinterpret_cast<LPVOID*>(GetTickCount));
359+
MH_Uninitialize();
360+
}
361+
}
353362

354363
return TRUE;
355364
}

include/globals.h

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,57 @@ class CSteamAPIContext
248248

249249
};
250250

251+
extern CSteamAPIContext g_ClientCtx;
252+
253+
class CSteamAppsStub : public ISteamApps
254+
{
255+
public:
256+
virtual bool BIsSubscribed() override { return true; }
257+
virtual bool BIsLowViolence() override { return true; }
258+
virtual bool BIsCybercafe() override { return false; }
259+
virtual bool BIsVACBanned() override { return false; }
260+
virtual const char *GetCurrentGameLanguage() override { return "english"; }
261+
virtual const char *GetAvailableGameLanguages() override { return "english"; }
262+
virtual bool BIsSubscribedApp(AppId_t appID) override { return true; }
263+
virtual bool BIsDlcInstalled(AppId_t appID) override { return true; }
264+
virtual uint32 GetEarliestPurchaseUnixTime(AppId_t nAppID) override { return 0; }
265+
virtual bool BIsSubscribedFromFreeWeekend() override { return false; }
266+
virtual int GetDLCCount() override { return 0; }
267+
virtual bool BGetDLCDataByIndex(int iDLC, AppId_t *pAppID, bool *pbAvailable, char *pchName, int cchNameBufferSize) override { return false; }
268+
virtual void InstallDLC(AppId_t nAppID) override {}
269+
virtual void UninstallDLC(AppId_t nAppID) override {}
270+
virtual void RequestAppProofOfPurchaseKey(AppId_t nAppID) override {}
271+
virtual bool GetCurrentBetaName(char *pchName, int cchNameBufferSize) override { return false; }
272+
virtual bool MarkContentCorrupt(bool bMissingFilesOnly) override { return false; }
273+
virtual uint32 GetInstalledDepots(AppId_t appID, DepotId_t *pvecDepots, uint32 cMaxDepots) override { return 0; }
274+
virtual uint32 GetAppInstallDir(AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize) override { return 0; }
275+
virtual bool BIsAppInstalled(AppId_t appID) override { return true; }
276+
277+
virtual CSteamID GetAppOwner() override {
278+
if (g_ClientCtx.SteamUser())
279+
return g_ClientCtx.SteamUser()->GetSteamID();
280+
return k_steamIDNil;
281+
}
282+
283+
virtual const char *GetLaunchQueryParam(const char *pchKey) override { return ""; }
284+
virtual bool GetDlcDownloadProgress(AppId_t nAppID, uint64 *punBytesDownloaded, uint64 *punBytesTotal) override { return false; }
285+
virtual int GetAppBuildId() override { return 0; }
286+
virtual void RequestAllProofOfPurchaseKeys() override {}
287+
virtual SteamAPICall_t GetFileDetails(const char* pszFileName) override { return k_uAPICallInvalid; }
288+
virtual int GetLaunchCommandLine(char *pszCommandLine, int cubCommandLine) override { return 0; }
289+
virtual bool BIsSubscribedFromFamilySharing() override { return false; }
290+
virtual bool BIsTimedTrial(uint32* punSecondsAllowed, uint32* punSecondsPlayed) override { return false; }
291+
virtual bool SetDlcContext(AppId_t nAppID) override { return false; }
292+
virtual int GetNumBetas(int* pnAvailable, int* pnPrivate) override { return 0; }
293+
virtual bool GetBetaInfo(int iBetaIndex, uint32 *punFlags, uint32 *punBuildID, char *pchBetaName, int cchBetaName, char *pchDescription, int cchDescription) override { return false; }
294+
virtual bool SetActiveBeta(const char *pchBetaName) override { return false; }
295+
296+
private:
297+
static CSteamAppsStub s_AppsStub;
298+
};
299+
300+
CSteamAppsStub s_AppsStub;
301+
251302
class CSteamGameServerAPIContext
252303
{
253304
public:
@@ -308,7 +359,6 @@ extern ISteamClient* g_pSteamClientSafe;
308359
extern ISteamUtils* g_pUtilsForCallbacks;
309360
extern ISteamController* g_pControllerForCallbacks;
310361
extern ISteamInput* g_pInputForCallbacks;
311-
extern CSteamAPIContext g_ClientCtx;
312362
extern bool g_bClientReady;
313363
extern SRWLOCK g_CtxLock;
314364

include/uc_loader.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,17 @@ class CDLLLoader
8989
return (_stricmp(buf, "true") == 0 || _stricmp(buf, "1") == 0 || _stricmp(buf, "yes") == 0);
9090
}
9191

92+
// This does not need to be set!! It will automatically run as true!!
93+
bool GetForceOwnership()
94+
{
95+
if (m_IniPath[0] == '\0')
96+
return true;
97+
98+
char buf[8] = { 0 };
99+
GetPrivateProfileStringA("Settings", "ForceOwnership", "true", buf, sizeof(buf), m_IniPath);
100+
return (_stricmp(buf, "true") == 0);
101+
}
102+
92103
void LoadPlugins()
93104
{
94105
if (m_IniPath[0] == '\0')

0 commit comments

Comments
 (0)