diff options
| author | 2021-11-25 20:36:44 -0600 | |
|---|---|---|
| committer | 2021-11-27 20:30:16 -0600 | |
| commit | 50d8e753c525f8f00a67678c56351eccf72aa1f4 (patch) | |
| tree | 886dbf7164afab883cc989a4e116953bd1e0ea39 /src/core | |
| parent | core/hid: Stub GetUniquePadsFromNpad (diff) | |
| download | yuzu-50d8e753c525f8f00a67678c56351eccf72aa1f4.tar.gz yuzu-50d8e753c525f8f00a67678c56351eccf72aa1f4.tar.xz yuzu-50d8e753c525f8f00a67678c56351eccf72aa1f4.zip | |
core/pdm: Stub QueryPlayStatisticsByApplicationIdAndUserAccountId
Used in checkpoint homebrew
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/core/hle/service/ns/ns.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/service/ns/pdm_qry.cpp | 69 | ||||
| -rw-r--r-- | src/core/hle/service/ns/pdm_qry.h | 33 |
4 files changed, 107 insertions, 0 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 582c15f7e..eee8e2ccd 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -479,6 +479,8 @@ add_library(core STATIC | |||
| 479 | hle/service/ns/language.h | 479 | hle/service/ns/language.h |
| 480 | hle/service/ns/ns.cpp | 480 | hle/service/ns/ns.cpp |
| 481 | hle/service/ns/ns.h | 481 | hle/service/ns/ns.h |
| 482 | hle/service/ns/pdm_qry.cpp | ||
| 483 | hle/service/ns/pdm_qry.h | ||
| 482 | hle/service/ns/pl_u.cpp | 484 | hle/service/ns/pl_u.cpp |
| 483 | hle/service/ns/pl_u.h | 485 | hle/service/ns/pl_u.h |
| 484 | hle/service/nvdrv/devices/nvdevice.h | 486 | hle/service/nvdrv/devices/nvdevice.h |
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index 64ffc8572..0d6fab746 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include "core/hle/service/ns/errors.h" | 12 | #include "core/hle/service/ns/errors.h" |
| 13 | #include "core/hle/service/ns/language.h" | 13 | #include "core/hle/service/ns/language.h" |
| 14 | #include "core/hle/service/ns/ns.h" | 14 | #include "core/hle/service/ns/ns.h" |
| 15 | #include "core/hle/service/ns/pdm_qry.h" | ||
| 15 | #include "core/hle/service/ns/pl_u.h" | 16 | #include "core/hle/service/ns/pl_u.h" |
| 16 | #include "core/hle/service/set/set.h" | 17 | #include "core/hle/service/set/set.h" |
| 17 | 18 | ||
| @@ -738,6 +739,8 @@ void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system | |||
| 738 | std::make_shared<NS_SU>(system)->InstallAsService(service_manager); | 739 | std::make_shared<NS_SU>(system)->InstallAsService(service_manager); |
| 739 | std::make_shared<NS_VM>(system)->InstallAsService(service_manager); | 740 | std::make_shared<NS_VM>(system)->InstallAsService(service_manager); |
| 740 | 741 | ||
| 742 | std::make_shared<PDM_QRY>(system)->InstallAsService(service_manager); | ||
| 743 | |||
| 741 | std::make_shared<PL_U>(system)->InstallAsService(service_manager); | 744 | std::make_shared<PL_U>(system)->InstallAsService(service_manager); |
| 742 | } | 745 | } |
| 743 | 746 | ||
diff --git a/src/core/hle/service/ns/pdm_qry.cpp b/src/core/hle/service/ns/pdm_qry.cpp new file mode 100644 index 000000000..e2fab5c3f --- /dev/null +++ b/src/core/hle/service/ns/pdm_qry.cpp | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | // Copyright 2021 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included | ||
| 4 | |||
| 5 | #include <memory> | ||
| 6 | |||
| 7 | #include "common/logging/log.h" | ||
| 8 | #include "common/uuid.h" | ||
| 9 | #include "core/hle/ipc_helpers.h" | ||
| 10 | #include "core/hle/service/ns/pdm_qry.h" | ||
| 11 | #include "core/hle/service/service.h" | ||
| 12 | #include "core/hle/service/sm/sm.h" | ||
| 13 | |||
| 14 | namespace Service::NS { | ||
| 15 | |||
| 16 | PDM_QRY::PDM_QRY(Core::System& system_) : ServiceFramework{system_, "pdm:qry"} { | ||
| 17 | // clang-format off | ||
| 18 | static const FunctionInfo functions[] = { | ||
| 19 | {0, nullptr, "QueryAppletEvent"}, | ||
| 20 | {1, nullptr, "QueryPlayStatistics"}, | ||
| 21 | {2, nullptr, "QueryPlayStatisticsByUserAccountId"}, | ||
| 22 | {3, nullptr, "QueryPlayStatisticsByNetworkServiceAccountId"}, | ||
| 23 | {4, nullptr, "QueryPlayStatisticsByApplicationId"}, | ||
| 24 | {5, &PDM_QRY::QueryPlayStatisticsByApplicationIdAndUserAccountId, "QueryPlayStatisticsByApplicationIdAndUserAccountId"}, | ||
| 25 | {6, nullptr, "QueryPlayStatisticsByApplicationIdAndNetworkServiceAccountId"}, | ||
| 26 | {7, nullptr, "QueryLastPlayTimeV0"}, | ||
| 27 | {8, nullptr, "QueryPlayEvent"}, | ||
| 28 | {9, nullptr, "GetAvailablePlayEventRange"}, | ||
| 29 | {10, nullptr, "QueryAccountEvent"}, | ||
| 30 | {11, nullptr, "QueryAccountPlayEvent"}, | ||
| 31 | {12, nullptr, "GetAvailableAccountPlayEventRange"}, | ||
| 32 | {13, nullptr, "QueryApplicationPlayStatisticsForSystemV0"}, | ||
| 33 | {14, nullptr, "QueryRecentlyPlayedApplication"}, | ||
| 34 | {15, nullptr, "GetRecentlyPlayedApplicationUpdateEvent"}, | ||
| 35 | {16, nullptr, "QueryApplicationPlayStatisticsByUserAccountIdForSystemV0"}, | ||
| 36 | {17, nullptr, "QueryLastPlayTime"}, | ||
| 37 | {18, nullptr, "QueryApplicationPlayStatisticsForSystem"}, | ||
| 38 | {19, nullptr, "QueryApplicationPlayStatisticsByUserAccountIdForSystem"}, | ||
| 39 | }; | ||
| 40 | // clang-format on | ||
| 41 | |||
| 42 | RegisterHandlers(functions); | ||
| 43 | } | ||
| 44 | |||
| 45 | PDM_QRY::~PDM_QRY() = default; | ||
| 46 | |||
| 47 | void PDM_QRY::QueryPlayStatisticsByApplicationIdAndUserAccountId(Kernel::HLERequestContext& ctx) { | ||
| 48 | IPC::RequestParser rp{ctx}; | ||
| 49 | const auto unknown = rp.Pop<bool>(); | ||
| 50 | rp.Pop<u8>(); // Padding | ||
| 51 | const auto application_id = rp.Pop<u64>(); | ||
| 52 | const auto user_account_uid = rp.PopRaw<Common::UUID>(); | ||
| 53 | |||
| 54 | // TODO(German77): Read statistics of the game | ||
| 55 | PlayStatistics statistics{ | ||
| 56 | .application_id = application_id, | ||
| 57 | .total_launches = 1, | ||
| 58 | }; | ||
| 59 | |||
| 60 | LOG_WARNING(Service_NS, | ||
| 61 | "(STUBBED) called. unknown={}. application_id=0x{:016X}, user_account_uid=0x{}", | ||
| 62 | unknown, application_id, user_account_uid.Format()); | ||
| 63 | |||
| 64 | IPC::ResponseBuilder rb{ctx, 12}; | ||
| 65 | rb.Push(ResultSuccess); | ||
| 66 | rb.PushRaw(statistics); | ||
| 67 | } | ||
| 68 | |||
| 69 | } // namespace Service::NS | ||
diff --git a/src/core/hle/service/ns/pdm_qry.h b/src/core/hle/service/ns/pdm_qry.h new file mode 100644 index 000000000..516136314 --- /dev/null +++ b/src/core/hle/service/ns/pdm_qry.h | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | // Copyright 2021 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "core/hle/service/service.h" | ||
| 8 | |||
| 9 | namespace Service::NS { | ||
| 10 | |||
| 11 | struct PlayStatistics { | ||
| 12 | u64 application_id{}; | ||
| 13 | u32 first_entry_index{}; | ||
| 14 | u32 first_timestamp_user{}; | ||
| 15 | u32 first_timestamp_network{}; | ||
| 16 | u32 last_entry_index{}; | ||
| 17 | u32 last_timestamp_user{}; | ||
| 18 | u32 last_timestamp_network{}; | ||
| 19 | u32 play_time_in_minutes{}; | ||
| 20 | u32 total_launches{}; | ||
| 21 | }; | ||
| 22 | static_assert(sizeof(PlayStatistics) == 0x28, "PlayStatistics is an invalid size"); | ||
| 23 | |||
| 24 | class PDM_QRY final : public ServiceFramework<PDM_QRY> { | ||
| 25 | public: | ||
| 26 | explicit PDM_QRY(Core::System& system_); | ||
| 27 | ~PDM_QRY() override; | ||
| 28 | |||
| 29 | private: | ||
| 30 | void QueryPlayStatisticsByApplicationIdAndUserAccountId(Kernel::HLERequestContext& ctx); | ||
| 31 | }; | ||
| 32 | |||
| 33 | } // namespace Service::NS | ||