diff options
| -rw-r--r-- | src/core/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.cpp | 14 | ||||
| -rw-r--r-- | src/core/hle/service/ns/ns.cpp | 23 | ||||
| -rw-r--r-- | src/core/hle/service/ns/ns.h | 7 | ||||
| -rw-r--r-- | src/core/hle/service/ns/pdm_qry.cpp | 69 | ||||
| -rw-r--r-- | src/core/hle/service/ns/pdm_qry.h | 33 |
6 files changed, 146 insertions, 2 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/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 95fc07325..b36689552 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -1883,7 +1883,7 @@ public: | |||
| 1883 | {317, nullptr, "GetNpadLeftRightInterfaceType"}, | 1883 | {317, nullptr, "GetNpadLeftRightInterfaceType"}, |
| 1884 | {318, nullptr, "HasBattery"}, | 1884 | {318, nullptr, "HasBattery"}, |
| 1885 | {319, nullptr, "HasLeftRightBattery"}, | 1885 | {319, nullptr, "HasLeftRightBattery"}, |
| 1886 | {321, nullptr, "GetUniquePadsFromNpad"}, | 1886 | {321, &HidSys::GetUniquePadsFromNpad, "GetUniquePadsFromNpad"}, |
| 1887 | {322, nullptr, "GetIrSensorState"}, | 1887 | {322, nullptr, "GetIrSensorState"}, |
| 1888 | {323, nullptr, "GetXcdHandleForNpadWithIrSensor"}, | 1888 | {323, nullptr, "GetXcdHandleForNpadWithIrSensor"}, |
| 1889 | {324, nullptr, "GetUniquePadButtonSet"}, | 1889 | {324, nullptr, "GetUniquePadButtonSet"}, |
| @@ -2054,6 +2054,18 @@ private: | |||
| 2054 | IPC::ResponseBuilder rb{ctx, 2}; | 2054 | IPC::ResponseBuilder rb{ctx, 2}; |
| 2055 | rb.Push(ResultSuccess); | 2055 | rb.Push(ResultSuccess); |
| 2056 | } | 2056 | } |
| 2057 | |||
| 2058 | void GetUniquePadsFromNpad(Kernel::HLERequestContext& ctx) { | ||
| 2059 | IPC::RequestParser rp{ctx}; | ||
| 2060 | const auto npad_id_type{rp.PopEnum<Core::HID::NpadIdType>()}; | ||
| 2061 | |||
| 2062 | const s64 total_entries = 0; | ||
| 2063 | LOG_WARNING(Service_HID, "(STUBBED) called, npad_id_type={}", npad_id_type); | ||
| 2064 | |||
| 2065 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 2066 | rb.Push(ResultSuccess); | ||
| 2067 | rb.Push(total_entries); | ||
| 2068 | } | ||
| 2057 | }; | 2069 | }; |
| 2058 | 2070 | ||
| 2059 | class HidTmp final : public ServiceFramework<HidTmp> { | 2071 | class HidTmp final : public ServiceFramework<HidTmp> { |
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index 64ffc8572..382ddcae5 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 | ||
| @@ -570,11 +571,29 @@ IFactoryResetInterface::IFactoryResetInterface(Core::System& system_) | |||
| 570 | 571 | ||
| 571 | IFactoryResetInterface::~IFactoryResetInterface() = default; | 572 | IFactoryResetInterface::~IFactoryResetInterface() = default; |
| 572 | 573 | ||
| 574 | IReadOnlyApplicationControlDataInterface::IReadOnlyApplicationControlDataInterface( | ||
| 575 | Core::System& system_) | ||
| 576 | : ServiceFramework{system_, "IReadOnlyApplicationControlDataInterface"} { | ||
| 577 | // clang-format off | ||
| 578 | static const FunctionInfo functions[] = { | ||
| 579 | {0, nullptr, "GetApplicationControlData"}, | ||
| 580 | {1, nullptr, "GetApplicationDesiredLanguage"}, | ||
| 581 | {2, nullptr, "ConvertApplicationLanguageToLanguageCode"}, | ||
| 582 | {3, nullptr, "ConvertLanguageCodeToApplicationLanguage"}, | ||
| 583 | {4, nullptr, "SelectApplicationDesiredLanguage"}, | ||
| 584 | }; | ||
| 585 | // clang-format on | ||
| 586 | |||
| 587 | RegisterHandlers(functions); | ||
| 588 | } | ||
| 589 | |||
| 590 | IReadOnlyApplicationControlDataInterface::~IReadOnlyApplicationControlDataInterface() = default; | ||
| 591 | |||
| 573 | NS::NS(const char* name, Core::System& system_) : ServiceFramework{system_, name} { | 592 | NS::NS(const char* name, Core::System& system_) : ServiceFramework{system_, name} { |
| 574 | // clang-format off | 593 | // clang-format off |
| 575 | static const FunctionInfo functions[] = { | 594 | static const FunctionInfo functions[] = { |
| 576 | {7988, nullptr, "GetDynamicRightsInterface"}, | 595 | {7988, nullptr, "GetDynamicRightsInterface"}, |
| 577 | {7989, nullptr, "GetReadOnlyApplicationControlDataInterface"}, | 596 | {7989, &NS::PushInterface<IReadOnlyApplicationControlDataInterface>, "GetReadOnlyApplicationControlDataInterface"}, |
| 578 | {7991, nullptr, "GetReadOnlyApplicationRecordInterface"}, | 597 | {7991, nullptr, "GetReadOnlyApplicationRecordInterface"}, |
| 579 | {7992, &NS::PushInterface<IECommerceInterface>, "GetECommerceInterface"}, | 598 | {7992, &NS::PushInterface<IECommerceInterface>, "GetECommerceInterface"}, |
| 580 | {7993, &NS::PushInterface<IApplicationVersionInterface>, "GetApplicationVersionInterface"}, | 599 | {7993, &NS::PushInterface<IApplicationVersionInterface>, "GetApplicationVersionInterface"}, |
| @@ -738,6 +757,8 @@ void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system | |||
| 738 | std::make_shared<NS_SU>(system)->InstallAsService(service_manager); | 757 | std::make_shared<NS_SU>(system)->InstallAsService(service_manager); |
| 739 | std::make_shared<NS_VM>(system)->InstallAsService(service_manager); | 758 | std::make_shared<NS_VM>(system)->InstallAsService(service_manager); |
| 740 | 759 | ||
| 760 | std::make_shared<PDM_QRY>(system)->InstallAsService(service_manager); | ||
| 761 | |||
| 741 | std::make_shared<PL_U>(system)->InstallAsService(service_manager); | 762 | std::make_shared<PL_U>(system)->InstallAsService(service_manager); |
| 742 | } | 763 | } |
| 743 | 764 | ||
diff --git a/src/core/hle/service/ns/ns.h b/src/core/hle/service/ns/ns.h index 218eec3ec..43540b0fb 100644 --- a/src/core/hle/service/ns/ns.h +++ b/src/core/hle/service/ns/ns.h | |||
| @@ -74,6 +74,13 @@ public: | |||
| 74 | ~IFactoryResetInterface() override; | 74 | ~IFactoryResetInterface() override; |
| 75 | }; | 75 | }; |
| 76 | 76 | ||
| 77 | class IReadOnlyApplicationControlDataInterface final | ||
| 78 | : public ServiceFramework<IReadOnlyApplicationControlDataInterface> { | ||
| 79 | public: | ||
| 80 | explicit IReadOnlyApplicationControlDataInterface(Core::System& system_); | ||
| 81 | ~IReadOnlyApplicationControlDataInterface() override; | ||
| 82 | }; | ||
| 83 | |||
| 77 | class NS final : public ServiceFramework<NS> { | 84 | class NS final : public ServiceFramework<NS> { |
| 78 | public: | 85 | public: |
| 79 | explicit NS(const char* name, Core::System& system_); | 86 | explicit NS(const char* name, Core::System& system_); |
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 | ||