Skip to content

Commit

Permalink
Fixed DLCs and some other stuffs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rat43 committed Oct 10, 2019
1 parent 4adc957 commit 0c10947
Show file tree
Hide file tree
Showing 15 changed files with 57 additions and 63 deletions.
28 changes: 11 additions & 17 deletions src/ColdManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions src/InterfacesEmulation/SteamRemoteStorage001.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/InterfacesEmulation/SteamRemoteStorage002.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/InterfacesEmulation/SteamRemoteStorage003.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/InterfacesEmulation/SteamRemoteStorage004.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/InterfacesEmulation/SteamRemoteStorage005.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/InterfacesEmulation/SteamRemoteStorage006.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/InterfacesEmulation/SteamRemoteStorage007.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/InterfacesEmulation/SteamRemoteStorage008.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/InterfacesEmulation/SteamRemoteStorage009.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/InterfacesEmulation/SteamRemoteStorage010.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/InterfacesEmulation/SteamRemoteStorage011.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/InterfacesEmulation/SteamRemoteStorage012.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/InterfacesEmulation/SteamRemoteStorage013.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/InterfacesEmulation/SteamRemoteStorage014.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0c10947

Please sign in to comment.