More accurate api behaviors

This commit is contained in:
universal963 2024-08-27 02:08:13 +08:00 committed by GitHub
parent b0d92a48c1
commit fd1af0d7ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -84,8 +84,12 @@ bool Steam_Apps::BIsSubscribedApp( AppId_t appID )
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(global_mutex);
if (appID == 0) return false; // steam returns false if (appID == 0) return false; // steam returns false
if (appID == UINT32_MAX) return true; // steam returns true if (appID == UINT32_MAX) return true; // steam returns true
if (appID == settings->get_local_game_id().AppID()) return true; // steam returns true if (appID == settings->get_local_game_id().AppID() || settings->hasDLC(appID)) return true; // steam returns true
return settings->hasDLC(appID); for (auto &d : settings->depots) {
if (d == appID)
return true;
}
return false;
} }
@ -112,14 +116,18 @@ uint32 Steam_Apps::GetEarliestPurchaseUnixTime( AppId_t nAppID )
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(global_mutex);
if (nAppID == 0) return 0; // steam returns 0 if (nAppID == 0) return 0; // steam returns 0
if (nAppID == UINT32_MAX) return 0; // steam returns 0 if (nAppID == UINT32_MAX) return 0; // steam returns 0
auto t =
// 4 days ago
startup_time
- std::chrono::hours(24 * 4);
auto duration = std::chrono::duration_cast<std::chrono::seconds>(t.time_since_epoch());
if (nAppID == settings->get_local_game_id().AppID() || settings->hasDLC(nAppID)) { if (nAppID == settings->get_local_game_id().AppID() || settings->hasDLC(nAppID)) {
auto t =
// 4 days ago
startup_time
- std::chrono::hours(24 * 4);
auto duration = std::chrono::duration_cast<std::chrono::seconds>(t.time_since_epoch());
return (uint32)duration.count(); return (uint32)duration.count();
} }
for (auto &d : settings->depots) {
if (d == nAppID)
return (uint32)duration.count();
}
//TODO ? //TODO ?
return 0; return 0;