From 85df6c253faad8120de0c1da998c6a4ee380deee Mon Sep 17 00:00:00 2001 From: counter185 <33550839+counter185@users.noreply.github.com> Date: Sat, 25 Feb 2023 15:15:02 +0100 Subject: [PATCH 1/3] apps interface check if parts of the game are installed --- src/client/steam/interfaces/apps.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/client/steam/interfaces/apps.cpp b/src/client/steam/interfaces/apps.cpp index e017bf73..f9066f23 100644 --- a/src/client/steam/interfaces/apps.cpp +++ b/src/client/steam/interfaces/apps.cpp @@ -33,14 +33,18 @@ namespace steam return "english"; } + // This is used for checking DLC too. bool apps::BIsSubscribedApp(unsigned int appID) { - return true; + return appID == 366842 ? std::filesystem::exists("zone/zm_common.xpak") //zombies + : appID == 366841 ? std::filesystem::exists("zone/mp_common.xpak") //multiplayer + : appID == 366840 ? std::filesystem::exists("zone/cp_common.xpak") //campaign + : true; } bool apps::BIsDlcInstalled(unsigned int appID) { - return true; + return BIsSubscribedApp(appID); //to not repeat the same code here } unsigned int apps::GetEarliestPurchaseUnixTime(unsigned int nAppID) From 55fea07feff22bfc2905db5df84ba31baedd6cdd Mon Sep 17 00:00:00 2001 From: counter185 <33550839+counter185@users.noreply.github.com> Date: Sun, 26 Feb 2023 07:54:30 +0100 Subject: [PATCH 2/3] do the requested changes --- src/client/steam/interfaces/apps.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/client/steam/interfaces/apps.cpp b/src/client/steam/interfaces/apps.cpp index f9066f23..99c42e9b 100644 --- a/src/client/steam/interfaces/apps.cpp +++ b/src/client/steam/interfaces/apps.cpp @@ -1,4 +1,7 @@ #include + +#include + #include "../steam.hpp" namespace steam @@ -33,18 +36,20 @@ namespace steam return "english"; } - // This is used for checking DLC too. bool apps::BIsSubscribedApp(unsigned int appID) { - return appID == 366842 ? std::filesystem::exists("zone/zm_common.xpak") //zombies - : appID == 366841 ? std::filesystem::exists("zone/mp_common.xpak") //multiplayer - : appID == 366840 ? std::filesystem::exists("zone/cp_common.xpak") //campaign + static const auto has_campaign = std::filesystem::exists(::utils::nt::library{}.get_path() / "zone/cp_common.xpak"); + static const auto has_multiplayer = std::filesystem::exists(::utils::nt::library{}.get_path() / "zone/mp_common.xpak"); + static const auto has_zombies = std::filesystem::exists(::utils::nt::library{}.get_path() / "zone/zm_common.xpak"); + return appID == 366840 ? has_campaign + : appID == 366841 ? has_multiplayer + : appID == 366842 ? has_zombies : true; } bool apps::BIsDlcInstalled(unsigned int appID) { - return BIsSubscribedApp(appID); //to not repeat the same code here + return BIsSubscribedApp(appID); } unsigned int apps::GetEarliestPurchaseUnixTime(unsigned int nAppID) From 285f11c272b08fbf522169925f8125647335b071 Mon Sep 17 00:00:00 2001 From: counter185 <33550839+counter185@users.noreply.github.com> Date: Sun, 26 Feb 2023 08:01:59 +0100 Subject: [PATCH 3/3] change get_path to get_folder --- src/client/steam/interfaces/apps.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/steam/interfaces/apps.cpp b/src/client/steam/interfaces/apps.cpp index 99c42e9b..a44527b3 100644 --- a/src/client/steam/interfaces/apps.cpp +++ b/src/client/steam/interfaces/apps.cpp @@ -38,9 +38,9 @@ namespace steam bool apps::BIsSubscribedApp(unsigned int appID) { - static const auto has_campaign = std::filesystem::exists(::utils::nt::library{}.get_path() / "zone/cp_common.xpak"); - static const auto has_multiplayer = std::filesystem::exists(::utils::nt::library{}.get_path() / "zone/mp_common.xpak"); - static const auto has_zombies = std::filesystem::exists(::utils::nt::library{}.get_path() / "zone/zm_common.xpak"); + static const auto has_campaign = std::filesystem::exists(::utils::nt::library{}.get_folder() / "zone/cp_common.xpak"); + static const auto has_multiplayer = std::filesystem::exists(::utils::nt::library{}.get_folder() / "zone/mp_common.xpak"); + static const auto has_zombies = std::filesystem::exists(::utils::nt::library{}.get_folder() / "zone/zm_common.xpak"); return appID == 366840 ? has_campaign : appID == 366841 ? has_multiplayer : appID == 366842 ? has_zombies