summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorNarr the Reg <juangerman-13@hotmail.com>2021-11-26 03:36:44 +0100
committerNarr the Reg <juangerman-13@hotmail.com>2021-11-28 03:30:16 +0100
commit50d8e753c525f8f00a67678c56351eccf72aa1f4 (patch)
tree886dbf7164afab883cc989a4e116953bd1e0ea39 /src/core/hle
parentcore/hid: Stub GetUniquePadsFromNpad (diff)
downloadyuzu-50d8e753c525f8f00a67678c56351eccf72aa1f4.tar
yuzu-50d8e753c525f8f00a67678c56351eccf72aa1f4.tar.gz
yuzu-50d8e753c525f8f00a67678c56351eccf72aa1f4.tar.bz2
yuzu-50d8e753c525f8f00a67678c56351eccf72aa1f4.tar.lz
yuzu-50d8e753c525f8f00a67678c56351eccf72aa1f4.tar.xz
yuzu-50d8e753c525f8f00a67678c56351eccf72aa1f4.tar.zst
yuzu-50d8e753c525f8f00a67678c56351eccf72aa1f4.zip
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/service/ns/ns.cpp3
-rw-r--r--src/core/hle/service/ns/pdm_qry.cpp69
-rw-r--r--src/core/hle/service/ns/pdm_qry.h33
3 files changed, 105 insertions, 0 deletions
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 @@
#include "core/hle/service/ns/errors.h"
#include "core/hle/service/ns/language.h"
#include "core/hle/service/ns/ns.h"
+#include "core/hle/service/ns/pdm_qry.h"
#include "core/hle/service/ns/pl_u.h"
#include "core/hle/service/set/set.h"
@@ -738,6 +739,8 @@ void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system
std::make_shared<NS_SU>(system)->InstallAsService(service_manager);
std::make_shared<NS_VM>(system)->InstallAsService(service_manager);
+ std::make_shared<PDM_QRY>(system)->InstallAsService(service_manager);
+
std::make_shared<PL_U>(system)->InstallAsService(service_manager);
}
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 @@
+// Copyright 2021 yuzu Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included
+
+#include <memory>
+
+#include "common/logging/log.h"
+#include "common/uuid.h"
+#include "core/hle/ipc_helpers.h"
+#include "core/hle/service/ns/pdm_qry.h"
+#include "core/hle/service/service.h"
+#include "core/hle/service/sm/sm.h"
+
+namespace Service::NS {
+
+PDM_QRY::PDM_QRY(Core::System& system_) : ServiceFramework{system_, "pdm:qry"} {
+ // clang-format off
+ static const FunctionInfo functions[] = {
+ {0, nullptr, "QueryAppletEvent"},
+ {1, nullptr, "QueryPlayStatistics"},
+ {2, nullptr, "QueryPlayStatisticsByUserAccountId"},
+ {3, nullptr, "QueryPlayStatisticsByNetworkServiceAccountId"},
+ {4, nullptr, "QueryPlayStatisticsByApplicationId"},
+ {5, &PDM_QRY::QueryPlayStatisticsByApplicationIdAndUserAccountId, "QueryPlayStatisticsByApplicationIdAndUserAccountId"},
+ {6, nullptr, "QueryPlayStatisticsByApplicationIdAndNetworkServiceAccountId"},
+ {7, nullptr, "QueryLastPlayTimeV0"},
+ {8, nullptr, "QueryPlayEvent"},
+ {9, nullptr, "GetAvailablePlayEventRange"},
+ {10, nullptr, "QueryAccountEvent"},
+ {11, nullptr, "QueryAccountPlayEvent"},
+ {12, nullptr, "GetAvailableAccountPlayEventRange"},
+ {13, nullptr, "QueryApplicationPlayStatisticsForSystemV0"},
+ {14, nullptr, "QueryRecentlyPlayedApplication"},
+ {15, nullptr, "GetRecentlyPlayedApplicationUpdateEvent"},
+ {16, nullptr, "QueryApplicationPlayStatisticsByUserAccountIdForSystemV0"},
+ {17, nullptr, "QueryLastPlayTime"},
+ {18, nullptr, "QueryApplicationPlayStatisticsForSystem"},
+ {19, nullptr, "QueryApplicationPlayStatisticsByUserAccountIdForSystem"},
+ };
+ // clang-format on
+
+ RegisterHandlers(functions);
+}
+
+PDM_QRY::~PDM_QRY() = default;
+
+void PDM_QRY::QueryPlayStatisticsByApplicationIdAndUserAccountId(Kernel::HLERequestContext& ctx) {
+ IPC::RequestParser rp{ctx};
+ const auto unknown = rp.Pop<bool>();
+ rp.Pop<u8>(); // Padding
+ const auto application_id = rp.Pop<u64>();
+ const auto user_account_uid = rp.PopRaw<Common::UUID>();
+
+ // TODO(German77): Read statistics of the game
+ PlayStatistics statistics{
+ .application_id = application_id,
+ .total_launches = 1,
+ };
+
+ LOG_WARNING(Service_NS,
+ "(STUBBED) called. unknown={}. application_id=0x{:016X}, user_account_uid=0x{}",
+ unknown, application_id, user_account_uid.Format());
+
+ IPC::ResponseBuilder rb{ctx, 12};
+ rb.Push(ResultSuccess);
+ rb.PushRaw(statistics);
+}
+
+} // 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 @@
+// Copyright 2021 yuzu Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included
+
+#pragma once
+
+#include "core/hle/service/service.h"
+
+namespace Service::NS {
+
+struct PlayStatistics {
+ u64 application_id{};
+ u32 first_entry_index{};
+ u32 first_timestamp_user{};
+ u32 first_timestamp_network{};
+ u32 last_entry_index{};
+ u32 last_timestamp_user{};
+ u32 last_timestamp_network{};
+ u32 play_time_in_minutes{};
+ u32 total_launches{};
+};
+static_assert(sizeof(PlayStatistics) == 0x28, "PlayStatistics is an invalid size");
+
+class PDM_QRY final : public ServiceFramework<PDM_QRY> {
+public:
+ explicit PDM_QRY(Core::System& system_);
+ ~PDM_QRY() override;
+
+private:
+ void QueryPlayStatisticsByApplicationIdAndUserAccountId(Kernel::HLERequestContext& ctx);
+};
+
+} // namespace Service::NS