From 50d8e753c525f8f00a67678c56351eccf72aa1f4 Mon Sep 17 00:00:00 2001 From: Narr the Reg Date: Thu, 25 Nov 2021 20:36:44 -0600 Subject: core/pdm: Stub QueryPlayStatisticsByApplicationIdAndUserAccountId Used in checkpoint homebrew --- src/core/hle/service/ns/pdm_qry.cpp | 69 +++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 src/core/hle/service/ns/pdm_qry.cpp (limited to 'src/core/hle/service/ns/pdm_qry.cpp') 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 + +#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(); + rp.Pop(); // Padding + const auto application_id = rp.Pop(); + const auto user_account_uid = rp.PopRaw(); + + // 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 -- cgit v1.2.3