+ fixed the implementation of BIsAppInstalled(), it must lock the global mutex since it is thread-safe, otherwise it will cause starvation and the current thread wion't yield, which triggers some games

+ even more accurate behavior for BIsAppInstalled(), reject app ID if it was in the DLC list and isUnlockAllDlc was false

+ citing the source for app id 0
This commit is contained in:
otavepto 2023-12-18 15:03:14 +02:00
parent 5c8a57e7af
commit 8289ec81a7
3 changed files with 16 additions and 1 deletions

View File

@ -251,6 +251,11 @@ bool Settings::getDLC(unsigned int index, AppId_t &appID, bool &available, std::
return true;
}
bool Settings::allDLCUnlocked() const
{
return this->unlockAllDLCs;
}
void Settings::setAppInstallPath(AppId_t appID, std::string path)
{
app_paths[appID] = path;

View File

@ -167,6 +167,7 @@ public:
unsigned int DLCCount();
bool hasDLC(AppId_t appID);
bool getDLC(unsigned int index, AppId_t &appID, bool &available, std::string &name);
bool allDLCUnlocked() const;
//Depots
std::vector<DepotId_t> depots;

View File

@ -245,12 +245,21 @@ uint32 Steam_Apps::GetAppInstallDir( AppId_t appID, char *pchFolder, uint32 cchF
bool Steam_Apps::BIsAppInstalled( AppId_t appID )
{
PRINT_DEBUG("BIsAppInstalled %u\n", appID);
// is this true? it seems to indicate a non-steam game
std::lock_guard<std::recursive_mutex> lock(global_mutex);
// "0 Base Goldsource Shared Binaries"
// https://developer.valvesoftware.com/wiki/Steam_Application_IDs
if (appID == 0) return true;
// game LEGO® 2K Drive (app id 1451810) checks for a proper steam behavior by sending uint32_max and expects false in return
if (appID == UINT32_MAX) return false;
if (appID == settings->get_local_game_id().AppID()) return true;
// only check for DLC if the the list is limited/bounded,
// calling hasDLC() wehn unlockAllDLCs is true will always satisfy the below condition
if (!settings->allDLCUnlocked() && settings->hasDLC(appID)) {
return false;
}
return settings->appIsInstalled(appID);
}