From 30c5b4eaa03145fcca4ed105e073c091eaaf23d9 Mon Sep 17 00:00:00 2001 From: otavepto Date: Tue, 19 Dec 2023 04:19:16 +0200 Subject: [PATCH] a simple implementation for GetEarliestPurchaseUnixTime() --- dll/steam_apps.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dll/steam_apps.cpp b/dll/steam_apps.cpp index 5a1fb931..8729605e 100644 --- a/dll/steam_apps.cpp +++ b/dll/steam_apps.cpp @@ -100,8 +100,19 @@ bool Steam_Apps::BIsDlcInstalled( AppId_t appID ) uint32 Steam_Apps::GetEarliestPurchaseUnixTime( AppId_t nAppID ) { PRINT_DEBUG("GetEarliestPurchaseUnixTime\n"); + std::lock_guard lock(global_mutex); + if (nAppID == 0) return 0; //TODO is this correct? + if (nAppID == UINT32_MAX) return 0; // check Steam_Apps::BIsAppInstalled() TODO is this correct? + if (nAppID == settings->get_local_game_id().AppID() || settings->hasDLC(nAppID)) { + auto t = + std::chrono::system_clock::now() + - std::chrono::hours(24 * 4); // 4 days ago + auto duration = std::chrono::duration_cast(t.time_since_epoch()); + return (uint32)duration.count(); + } + //TODO ? - return 1; + return 0; }