diff options
author | Liam <byteslice@airmail.cc> | 2024-02-17 20:49:47 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2024-02-18 16:35:39 +0100 |
commit | 4cdf18095d8f049d9bf19d22e8915032c6b4d738 (patch) | |
tree | 9be4ad9772d06cb767085d9b1e65344307bd5d66 /src | |
parent | ns: rewrite IServiceGetterInterface (diff) | |
download | yuzu-4cdf18095d8f049d9bf19d22e8915032c6b4d738.tar yuzu-4cdf18095d8f049d9bf19d22e8915032c6b4d738.tar.gz yuzu-4cdf18095d8f049d9bf19d22e8915032c6b4d738.tar.bz2 yuzu-4cdf18095d8f049d9bf19d22e8915032c6b4d738.tar.lz yuzu-4cdf18095d8f049d9bf19d22e8915032c6b4d738.tar.xz yuzu-4cdf18095d8f049d9bf19d22e8915032c6b4d738.tar.zst yuzu-4cdf18095d8f049d9bf19d22e8915032c6b4d738.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/core/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/core/hle/service/ns/ns.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/service/ns/pdm_qry.cpp | 67 | ||||
-rw-r--r-- | src/core/hle/service/ns/query_service.cpp | 57 | ||||
-rw-r--r-- | src/core/hle/service/ns/query_service.h (renamed from src/core/hle/service/ns/pdm_qry.h) | 12 |
5 files changed, 69 insertions, 75 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 1339cb182..7949e056c 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -765,10 +765,10 @@ add_library(core STATIC hle/service/ns/ns_types.h hle/service/ns/ns.cpp hle/service/ns/ns.h - hle/service/ns/pdm_qry.cpp - hle/service/ns/pdm_qry.h hle/service/ns/platform_service_manager.cpp hle/service/ns/platform_service_manager.h + hle/service/ns/query_service.cpp + hle/service/ns/query_service.h hle/service/ns/read_only_application_control_data_interface.cpp hle/service/ns/read_only_application_control_data_interface.h hle/service/ns/read_only_application_record_interface.cpp diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index 96fa221b0..8402e83cb 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp @@ -3,8 +3,8 @@ #include "core/hle/service/ns/develop_interface.h" #include "core/hle/service/ns/ns.h" -#include "core/hle/service/ns/pdm_qry.h" #include "core/hle/service/ns/platform_service_manager.h" +#include "core/hle/service/ns/query_service.h" #include "core/hle/service/ns/service_getter_interface.h" #include "core/hle/service/ns/system_update_interface.h" #include "core/hle/service/ns/vulnerability_manager_interface.h" @@ -32,7 +32,7 @@ void LoopProcess(Core::System& system) { server_manager->RegisterNamedService("ns:su", std::make_shared<ISystemUpdateInterface>(system)); server_manager->RegisterNamedService("ns:vm", std::make_shared<IVulnerabilityManagerInterface>(system)); - server_manager->RegisterNamedService("pdm:qry", std::make_shared<PDM_QRY>(system)); + server_manager->RegisterNamedService("pdm:qry", std::make_shared<IQueryService>(system)); server_manager->RegisterNamedService("pl:s", std::make_shared<IPlatformServiceManager>(system, "pl:s")); diff --git a/src/core/hle/service/ns/pdm_qry.cpp b/src/core/hle/service/ns/pdm_qry.cpp deleted file mode 100644 index ce0ee30e0..000000000 --- a/src/core/hle/service/ns/pdm_qry.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include <memory> - -#include "common/logging/log.h" -#include "common/uuid.h" -#include "core/hle/service/ipc_helpers.h" -#include "core/hle/service/ns/pdm_qry.h" -#include "core/hle/service/service.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(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.RawString()); - - IPC::ResponseBuilder rb{ctx, 12}; - rb.Push(ResultSuccess); - rb.PushRaw(statistics); -} - -} // namespace Service::NS diff --git a/src/core/hle/service/ns/query_service.cpp b/src/core/hle/service/ns/query_service.cpp new file mode 100644 index 000000000..946b7fa23 --- /dev/null +++ b/src/core/hle/service/ns/query_service.cpp @@ -0,0 +1,57 @@ +// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "common/logging/log.h" +#include "common/uuid.h" +#include "core/hle/service/cmif_serialization.h" +#include "core/hle/service/ns/query_service.h" +#include "core/hle/service/service.h" + +namespace Service::NS { + +IQueryService::IQueryService(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, D<&IQueryService::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); +} + +IQueryService::~IQueryService() = default; + +Result IQueryService::QueryPlayStatisticsByApplicationIdAndUserAccountId( + Out<PlayStatistics> out_play_statistics, bool unknown, Common::UUID account_id, + u64 application_id) { + // TODO(German77): Read statistics of the game + *out_play_statistics = { + .application_id = application_id, + .total_launches = 1, + }; + + LOG_WARNING(Service_NS, "(STUBBED) called. unknown={}. application_id={:016X}, account_id={}", + unknown, application_id, account_id.FormattedString()); + R_SUCCEED(); +} + +} // namespace Service::NS diff --git a/src/core/hle/service/ns/pdm_qry.h b/src/core/hle/service/ns/query_service.h index c98e01660..6cdbfa277 100644 --- a/src/core/hle/service/ns/pdm_qry.h +++ b/src/core/hle/service/ns/query_service.h @@ -3,6 +3,8 @@ #pragma once +#include "common/uuid.h" +#include "core/hle/service/cmif_types.h" #include "core/hle/service/service.h" namespace Service::NS { @@ -20,13 +22,15 @@ struct PlayStatistics { }; static_assert(sizeof(PlayStatistics) == 0x28, "PlayStatistics is an invalid size"); -class PDM_QRY final : public ServiceFramework<PDM_QRY> { +class IQueryService final : public ServiceFramework<IQueryService> { public: - explicit PDM_QRY(Core::System& system_); - ~PDM_QRY() override; + explicit IQueryService(Core::System& system_); + ~IQueryService() override; private: - void QueryPlayStatisticsByApplicationIdAndUserAccountId(HLERequestContext& ctx); + Result QueryPlayStatisticsByApplicationIdAndUserAccountId( + Out<PlayStatistics> out_play_statistics, bool unknown, Common::UUID account_id, + u64 application_id); }; } // namespace Service::NS |