From 0c1094797fb70d3739ac5f56413a9e3d3ab932d7 Mon Sep 17 00:00:00 2001 From: Rat43 <> Date: Thu, 10 Oct 2019 20:29:56 +0200 Subject: [PATCH] Fixed DLCs and some other stuffs. --- src/ColdManager.cpp | 28 ++++++++----------- .../SteamRemoteStorage001.h | 4 +-- .../SteamRemoteStorage002.h | 4 +-- .../SteamRemoteStorage003.h | 4 +-- .../SteamRemoteStorage004.h | 4 +-- .../SteamRemoteStorage005.h | 4 +-- .../SteamRemoteStorage006.h | 8 +++--- .../SteamRemoteStorage007.h | 8 +++--- .../SteamRemoteStorage008.h | 8 +++--- .../SteamRemoteStorage009.h | 8 +++--- .../SteamRemoteStorage010.h | 8 +++--- .../SteamRemoteStorage011.h | 8 +++--- .../SteamRemoteStorage012.h | 8 +++--- .../SteamRemoteStorage013.h | 8 +++--- .../SteamRemoteStorage014.h | 8 +++--- 15 files changed, 57 insertions(+), 63 deletions(-) diff --git a/src/ColdManager.cpp b/src/ColdManager.cpp index 3cfafee..bc49e19 100644 --- a/src/ColdManager.cpp +++ b/src/ColdManager.cpp @@ -39,30 +39,24 @@ namespace ColdAPI_DLC { bool GetDLCByIndex(int iDLC, unsigned int* pAppID, bool* pbAvailable, char* pchName, int cchNameBufferSize) { - if (iDLC < ColdDLC_Config::DLCsCount) + if (iDLC < ColdDLC_Config::DLCsCount && !Steam_Config::UnlockAllDLCS && ColdDLC_Config::DLCsCount > 0) { - if (!Steam_Config::UnlockAllDLCS) - { - if (ColdDLC_Config::DLCsCount > 0) - { - if(pAppID != NULL && pAppID > NULL) - *pAppID = ColdDLC_Config::DLCsAPPID.at(iDLC); - if(pbAvailable != NULL && pbAvailable > NULL) - *pbAvailable = true; - std::string Name = ColdDLC_Config::DLCsNames.at(iDLC); - if(pchName != NULL && pchName > NULL && cchNameBufferSize >= NULL) - std::memcpy(pchName, Name.c_str(), cchNameBufferSize); - return true; - } - } + if (pAppID != NULL && pAppID > NULL) + * pAppID = ColdDLC_Config::DLCsAPPID.at(iDLC); + if (pbAvailable != NULL && pbAvailable > NULL) + * pbAvailable = true; + std::string Name = ColdDLC_Config::DLCsNames.at(iDLC); + if (pchName != NULL && pchName > NULL && cchNameBufferSize >= NULL) + std::memcpy(pchName, Name.c_str(), cchNameBufferSize); + return true; } return false; } bool IsDLCAvailable(uint32_t Appid) { - // Check if the requested AppId is not the same as the game setted one. + // Check if the requested AppId is not 0 or the same as the game setted one. - if (Appid != 0 || Steam_Config::AppId) + if (Appid != 0 && Appid != Steam_Config::AppId) { if (!Steam_Config::UnlockAllDLCS) { diff --git a/src/InterfacesEmulation/SteamRemoteStorage001.h b/src/InterfacesEmulation/SteamRemoteStorage001.h index 51f1cda..c12d0b5 100644 --- a/src/InterfacesEmulation/SteamRemoteStorage001.h +++ b/src/InterfacesEmulation/SteamRemoteStorage001.h @@ -121,9 +121,9 @@ class SteamRemoteStorageIn001 : public ISteamRemoteStorage001 bool GetQuota(int* current, int* maximum) { - if (current == NULL || current < NULL) + if (current <= NULL) return false; - if (maximum == NULL || maximum < NULL) + if (maximum <= NULL) return false; *current = NULL; *maximum = INT_MAX; diff --git a/src/InterfacesEmulation/SteamRemoteStorage002.h b/src/InterfacesEmulation/SteamRemoteStorage002.h index c00624b..5968ed8 100644 --- a/src/InterfacesEmulation/SteamRemoteStorage002.h +++ b/src/InterfacesEmulation/SteamRemoteStorage002.h @@ -110,9 +110,9 @@ class SteamRemoteStorageIn002 : public ISteamRemoteStorage002 bool GetQuota(int32* pnTotalBytes, int32* puAvailableBytes) { - if (pnTotalBytes == NULL || pnTotalBytes < NULL) + if (pnTotalBytes <= NULL) return false; - if (puAvailableBytes == NULL || puAvailableBytes < NULL) + if (puAvailableBytes <= NULL) return false; *pnTotalBytes = NULL; *puAvailableBytes = INT_MAX; diff --git a/src/InterfacesEmulation/SteamRemoteStorage003.h b/src/InterfacesEmulation/SteamRemoteStorage003.h index fd8723e..eddf088 100644 --- a/src/InterfacesEmulation/SteamRemoteStorage003.h +++ b/src/InterfacesEmulation/SteamRemoteStorage003.h @@ -140,9 +140,9 @@ class SteamRemoteStorageIn003 : public ISteamRemoteStorage003 bool GetQuota(int32* pnTotalBytes, int32* puAvailableBytes) { - if (pnTotalBytes == NULL || pnTotalBytes < NULL) + if (pnTotalBytes <= NULL) return false; - if (puAvailableBytes == NULL || puAvailableBytes < NULL) + if (puAvailableBytes <= NULL) return false; *pnTotalBytes = NULL; *puAvailableBytes = INT_MAX; diff --git a/src/InterfacesEmulation/SteamRemoteStorage004.h b/src/InterfacesEmulation/SteamRemoteStorage004.h index d2c7746..d82618f 100644 --- a/src/InterfacesEmulation/SteamRemoteStorage004.h +++ b/src/InterfacesEmulation/SteamRemoteStorage004.h @@ -146,9 +146,9 @@ class SteamRemoteStorageIn004 : public ISteamRemoteStorage004 bool GetQuota(int32* pnTotalBytes, int32* puAvailableBytes) { - if (pnTotalBytes == NULL || pnTotalBytes < NULL) + if (pnTotalBytes <= NULL) return false; - if (puAvailableBytes == NULL || puAvailableBytes < NULL) + if (puAvailableBytes <= NULL) return false; *pnTotalBytes = NULL; *puAvailableBytes = INT_MAX; diff --git a/src/InterfacesEmulation/SteamRemoteStorage005.h b/src/InterfacesEmulation/SteamRemoteStorage005.h index 649a29c..7784c41 100644 --- a/src/InterfacesEmulation/SteamRemoteStorage005.h +++ b/src/InterfacesEmulation/SteamRemoteStorage005.h @@ -146,9 +146,9 @@ class SteamRemoteStorageIn005 : public ISteamRemoteStorage005 bool GetQuota(int32* pnTotalBytes, int32* puAvailableBytes) { - if (pnTotalBytes == NULL || pnTotalBytes < NULL) + if (pnTotalBytes <= NULL) return false; - if (puAvailableBytes == NULL || puAvailableBytes < NULL) + if (puAvailableBytes <= NULL) return false; *pnTotalBytes = NULL; *puAvailableBytes = INT_MAX; diff --git a/src/InterfacesEmulation/SteamRemoteStorage006.h b/src/InterfacesEmulation/SteamRemoteStorage006.h index 10d87dc..715de7e 100644 --- a/src/InterfacesEmulation/SteamRemoteStorage006.h +++ b/src/InterfacesEmulation/SteamRemoteStorage006.h @@ -147,9 +147,9 @@ class SteamRemoteStorageIn006 : public ISteamRemoteStorage006 bool GetQuota(int32* pnTotalBytes, int32* puAvailableBytes) { - if (pnTotalBytes == NULL || pnTotalBytes < NULL) + if (pnTotalBytes <= NULL) return false; - if (puAvailableBytes == NULL || puAvailableBytes < NULL) + if (puAvailableBytes <= NULL) return false; *pnTotalBytes = NULL; *puAvailableBytes = INT_MAX; @@ -203,9 +203,9 @@ class SteamRemoteStorageIn006 : public ISteamRemoteStorage006 } bool GetUGCDownloadProgress(UGCHandle_t hContent, int32* pnBytesDownloaded, int32* pnBytesExpected) { - if (pnBytesDownloaded == NULL || pnBytesDownloaded < NULL) + if (pnBytesDownloaded <= NULL) return false; - if (pnBytesExpected == NULL || pnBytesExpected < NULL) + if (pnBytesExpected <= NULL) return false; *pnBytesDownloaded = 10; diff --git a/src/InterfacesEmulation/SteamRemoteStorage007.h b/src/InterfacesEmulation/SteamRemoteStorage007.h index aa60dd5..dd1705f 100644 --- a/src/InterfacesEmulation/SteamRemoteStorage007.h +++ b/src/InterfacesEmulation/SteamRemoteStorage007.h @@ -146,9 +146,9 @@ class SteamRemoteStorageIn007 : public ISteamRemoteStorage007 bool GetQuota(int32* pnTotalBytes, int32* puAvailableBytes) { - if (pnTotalBytes == NULL || pnTotalBytes < NULL) + if (pnTotalBytes <= NULL) return false; - if (puAvailableBytes == NULL || puAvailableBytes < NULL) + if (puAvailableBytes <= NULL) return false; *pnTotalBytes = NULL; *puAvailableBytes = INT_MAX; @@ -202,9 +202,9 @@ class SteamRemoteStorageIn007 : public ISteamRemoteStorage007 } bool GetUGCDownloadProgress(UGCHandle_t hContent, uint32* puDownloadedBytes, uint32* puTotalBytes) { - if (puDownloadedBytes == NULL || puDownloadedBytes < NULL) + if (puDownloadedBytes <= NULL) return false; - if (puTotalBytes == NULL || puTotalBytes < NULL) + if (puTotalBytes <= NULL) return false; *puDownloadedBytes = 10; diff --git a/src/InterfacesEmulation/SteamRemoteStorage008.h b/src/InterfacesEmulation/SteamRemoteStorage008.h index 9d3ab28..59b8878 100644 --- a/src/InterfacesEmulation/SteamRemoteStorage008.h +++ b/src/InterfacesEmulation/SteamRemoteStorage008.h @@ -164,9 +164,9 @@ class SteamRemoteStorageIn008 : public ISteamRemoteStorage008 bool GetQuota(int32* pnTotalBytes, int32* puAvailableBytes) { - if (pnTotalBytes == NULL || pnTotalBytes < NULL) + if (pnTotalBytes <= NULL) return false; - if (puAvailableBytes == NULL || puAvailableBytes < NULL) + if (puAvailableBytes <= NULL) return false; *pnTotalBytes = NULL; *puAvailableBytes = INT_MAX; @@ -220,9 +220,9 @@ class SteamRemoteStorageIn008 : public ISteamRemoteStorage008 } bool GetUGCDownloadProgress(UGCHandle_t hContent, int32* pnBytesDownloaded, int32* pnBytesExpected) { - if (pnBytesDownloaded == NULL || pnBytesDownloaded < NULL) + if (pnBytesDownloaded <= NULL) return false; - if (pnBytesExpected == NULL || pnBytesExpected < NULL) + if (pnBytesExpected <= NULL) return false; *pnBytesDownloaded = 10; diff --git a/src/InterfacesEmulation/SteamRemoteStorage009.h b/src/InterfacesEmulation/SteamRemoteStorage009.h index c8257b8..db0fc99 100644 --- a/src/InterfacesEmulation/SteamRemoteStorage009.h +++ b/src/InterfacesEmulation/SteamRemoteStorage009.h @@ -163,9 +163,9 @@ class SteamRemoteStorageIn009 : public ISteamRemoteStorage009 bool GetQuota(int32* pnTotalBytes, int32* puAvailableBytes) { - if (pnTotalBytes == NULL || pnTotalBytes < NULL) + if (pnTotalBytes <= NULL) return false; - if (puAvailableBytes == NULL || puAvailableBytes < NULL) + if (puAvailableBytes <= NULL) return false; *pnTotalBytes = NULL; *puAvailableBytes = INT_MAX; @@ -219,9 +219,9 @@ class SteamRemoteStorageIn009 : public ISteamRemoteStorage009 } bool GetUGCDownloadProgress(UGCHandle_t hContent, uint32* puDownloadedBytes, uint32* puTotalBytes) { - if (puDownloadedBytes == NULL || puDownloadedBytes < NULL) + if (puDownloadedBytes <= NULL) return false; - if (puTotalBytes == NULL || puTotalBytes < NULL) + if (puTotalBytes <= NULL) return false; *puDownloadedBytes = 10; *puTotalBytes = 10; diff --git a/src/InterfacesEmulation/SteamRemoteStorage010.h b/src/InterfacesEmulation/SteamRemoteStorage010.h index 013a5e1..4a4fba7 100644 --- a/src/InterfacesEmulation/SteamRemoteStorage010.h +++ b/src/InterfacesEmulation/SteamRemoteStorage010.h @@ -164,9 +164,9 @@ class SteamRemoteStorageIn010 : public ISteamRemoteStorage010 bool GetQuota(int32* pnTotalBytes, int32* puAvailableBytes) { - if (pnTotalBytes == NULL || pnTotalBytes < NULL) + if (pnTotalBytes <= NULL) return false; - if (puAvailableBytes == NULL || puAvailableBytes < NULL) + if (puAvailableBytes <= NULL) return false; *pnTotalBytes = NULL; *puAvailableBytes = INT_MAX; @@ -220,9 +220,9 @@ class SteamRemoteStorageIn010 : public ISteamRemoteStorage010 } bool GetUGCDownloadProgress(UGCHandle_t hContent, int32* pnBytesDownloaded, int32* pnBytesExpected) { - if (pnBytesDownloaded == NULL || pnBytesDownloaded < NULL) + if (pnBytesDownloaded <= NULL) return false; - if (pnBytesExpected == NULL || pnBytesExpected < NULL) + if (pnBytesExpected <= NULL) return false; *pnBytesDownloaded = 10; *pnBytesExpected = 10; diff --git a/src/InterfacesEmulation/SteamRemoteStorage011.h b/src/InterfacesEmulation/SteamRemoteStorage011.h index 5af0ed5..15ca1ab 100644 --- a/src/InterfacesEmulation/SteamRemoteStorage011.h +++ b/src/InterfacesEmulation/SteamRemoteStorage011.h @@ -163,9 +163,9 @@ class SteamRemoteStorageIn011 : public ISteamRemoteStorage011 bool GetQuota(int32* pnTotalBytes, int32* puAvailableBytes) { - if (pnTotalBytes == NULL || pnTotalBytes < NULL) + if (pnTotalBytes <= NULL) return false; - if (puAvailableBytes == NULL || puAvailableBytes < NULL) + if (puAvailableBytes <= NULL) return false; *pnTotalBytes = NULL; *puAvailableBytes = INT_MAX; @@ -219,9 +219,9 @@ class SteamRemoteStorageIn011 : public ISteamRemoteStorage011 } bool GetUGCDownloadProgress(UGCHandle_t hContent, int32* pnBytesDownloaded, int32* pnBytesExpected) { - if (pnBytesDownloaded == NULL || pnBytesDownloaded < NULL) + if (pnBytesDownloaded <= NULL) return false; - if (pnBytesExpected == NULL || pnBytesExpected < NULL) + if (pnBytesExpected <= NULL) return false; *pnBytesDownloaded = 10; *pnBytesExpected = 10; diff --git a/src/InterfacesEmulation/SteamRemoteStorage012.h b/src/InterfacesEmulation/SteamRemoteStorage012.h index dbf2177..de18cfa 100644 --- a/src/InterfacesEmulation/SteamRemoteStorage012.h +++ b/src/InterfacesEmulation/SteamRemoteStorage012.h @@ -163,9 +163,9 @@ class SteamRemoteStorageIn012 : public ISteamRemoteStorage012 bool GetQuota(int32* pnTotalBytes, int32* puAvailableBytes) { - if (pnTotalBytes == NULL || pnTotalBytes < NULL) + if (pnTotalBytes <= NULL) return false; - if (puAvailableBytes == NULL || puAvailableBytes < NULL) + if (puAvailableBytes <= NULL) return false; *pnTotalBytes = NULL; *puAvailableBytes = INT_MAX; @@ -219,9 +219,9 @@ class SteamRemoteStorageIn012 : public ISteamRemoteStorage012 } bool GetUGCDownloadProgress(UGCHandle_t hContent, uint32* puDownloadedBytes, uint32* puTotalBytes) { - if (puDownloadedBytes == NULL || puDownloadedBytes < NULL) + if (puDownloadedBytes <= NULL) return false; - if (puTotalBytes == NULL || puTotalBytes < NULL) + if (puTotalBytes <= NULL) return false; *puDownloadedBytes = 10; *puTotalBytes = 10; diff --git a/src/InterfacesEmulation/SteamRemoteStorage013.h b/src/InterfacesEmulation/SteamRemoteStorage013.h index 9656ef3..5221e5a 100644 --- a/src/InterfacesEmulation/SteamRemoteStorage013.h +++ b/src/InterfacesEmulation/SteamRemoteStorage013.h @@ -177,9 +177,9 @@ class SteamRemoteStorageIn013 : public ISteamRemoteStorage013 bool GetQuota(int32* pnTotalBytes, int32* puAvailableBytes) { - if (pnTotalBytes == NULL || pnTotalBytes < NULL) + if (pnTotalBytes <= NULL) return false; - if (puAvailableBytes == NULL || puAvailableBytes < NULL) + if (puAvailableBytes <= NULL) return false; *pnTotalBytes = NULL; *puAvailableBytes = INT_MAX; @@ -233,9 +233,9 @@ class SteamRemoteStorageIn013 : public ISteamRemoteStorage013 } bool GetUGCDownloadProgress(UGCHandle_t hContent, uint32* puDownloadedBytes, uint32* puTotalBytes) { - if (puDownloadedBytes == NULL || puDownloadedBytes < NULL) + if (puDownloadedBytes <= NULL) return false; - if (puTotalBytes == NULL || puTotalBytes < NULL) + if (puTotalBytes <= NULL) return false; *puDownloadedBytes = 10; *puTotalBytes = 10; diff --git a/src/InterfacesEmulation/SteamRemoteStorage014.h b/src/InterfacesEmulation/SteamRemoteStorage014.h index d54ddec..2f42ef5 100644 --- a/src/InterfacesEmulation/SteamRemoteStorage014.h +++ b/src/InterfacesEmulation/SteamRemoteStorage014.h @@ -183,9 +183,9 @@ class SteamRemoteStorageIn014 : public ISteamRemoteStorage014 bool GetQuota(uint64* pnTotalBytes, uint64* puAvailableBytes) { - if (pnTotalBytes == NULL || pnTotalBytes < NULL) + if (pnTotalBytes <= NULL) return false; - if (puAvailableBytes == NULL || puAvailableBytes < NULL) + if (puAvailableBytes <= NULL) return false; *pnTotalBytes = NULL; *puAvailableBytes = INT_MAX; @@ -240,9 +240,9 @@ class SteamRemoteStorageIn014 : public ISteamRemoteStorage014 bool GetUGCDownloadProgress(UGCHandle_t hContent, int32* pnBytesDownloaded, int32* pnBytesExpected) { - if (pnBytesDownloaded == NULL || pnBytesDownloaded < NULL) + if (pnBytesDownloaded <= NULL) return false; - if (pnBytesExpected == NULL || pnBytesExpected < NULL) + if (pnBytesExpected <= NULL) return false; *pnBytesDownloaded = 10; *pnBytesExpected = 10;