diff options
| author | 2024-02-17 12:09:07 -0500 | |
|---|---|---|
| committer | 2024-02-18 10:32:21 -0500 | |
| commit | bb59940b038e9f089646727f720111b216c9886b (patch) | |
| tree | db359d2957f2c5a1bf381cb725207fb36da0ed14 /src | |
| parent | ns: rewrite IContentManagementInterface (diff) | |
| download | yuzu-bb59940b038e9f089646727f720111b216c9886b.tar.gz yuzu-bb59940b038e9f089646727f720111b216c9886b.tar.xz yuzu-bb59940b038e9f089646727f720111b216c9886b.zip | |
ns: rewrite IDocumentInterface
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/core/hle/service/ns/document_interface.cpp | 38 | ||||
| -rw-r--r-- | src/core/hle/service/ns/document_interface.h | 22 | ||||
| -rw-r--r-- | src/core/hle/service/ns/ns.cpp | 42 | ||||
| -rw-r--r-- | src/core/hle/service/ns/ns.h | 10 | ||||
| -rw-r--r-- | src/core/hle/service/ns/ns_types.h | 5 |
6 files changed, 68 insertions, 51 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index d5206eeae..29e29f659 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -745,6 +745,8 @@ add_library(core STATIC | |||
| 745 | hle/service/ns/application_version_interface.h | 745 | hle/service/ns/application_version_interface.h |
| 746 | hle/service/ns/content_management_interface.cpp | 746 | hle/service/ns/content_management_interface.cpp |
| 747 | hle/service/ns/content_management_interface.h | 747 | hle/service/ns/content_management_interface.h |
| 748 | hle/service/ns/document_interface.cpp | ||
| 749 | hle/service/ns/document_interface.h | ||
| 748 | hle/service/ns/ecommerce_interface.cpp | 750 | hle/service/ns/ecommerce_interface.cpp |
| 749 | hle/service/ns/ecommerce_interface.h | 751 | hle/service/ns/ecommerce_interface.h |
| 750 | hle/service/ns/factory_reset_interface.cpp | 752 | hle/service/ns/factory_reset_interface.cpp |
diff --git a/src/core/hle/service/ns/document_interface.cpp b/src/core/hle/service/ns/document_interface.cpp new file mode 100644 index 000000000..51a1e46c0 --- /dev/null +++ b/src/core/hle/service/ns/document_interface.cpp | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include "core/core.h" | ||
| 5 | #include "core/hle/service/cmif_serialization.h" | ||
| 6 | #include "core/hle/service/ns/document_interface.h" | ||
| 7 | |||
| 8 | namespace Service::NS { | ||
| 9 | |||
| 10 | IDocumentInterface::IDocumentInterface(Core::System& system_) | ||
| 11 | : ServiceFramework{system_, "IDocumentInterface"} { | ||
| 12 | // clang-format off | ||
| 13 | static const FunctionInfo functions[] = { | ||
| 14 | {21, nullptr, "GetApplicationContentPath"}, | ||
| 15 | {23, D<&IDocumentInterface::ResolveApplicationContentPath>, "ResolveApplicationContentPath"}, | ||
| 16 | {92, D<&IDocumentInterface::GetRunningApplicationProgramId>, "GetRunningApplicationProgramId"}, | ||
| 17 | }; | ||
| 18 | // clang-format on | ||
| 19 | |||
| 20 | RegisterHandlers(functions); | ||
| 21 | } | ||
| 22 | |||
| 23 | IDocumentInterface::~IDocumentInterface() = default; | ||
| 24 | |||
| 25 | Result IDocumentInterface::ResolveApplicationContentPath(ContentPath content_path) { | ||
| 26 | LOG_WARNING(Service_NS, "(STUBBED) called, file_system_proxy_type={}, program_id={:016X}", | ||
| 27 | content_path.file_system_proxy_type, content_path.program_id); | ||
| 28 | R_SUCCEED(); | ||
| 29 | } | ||
| 30 | |||
| 31 | Result IDocumentInterface::GetRunningApplicationProgramId(Out<u64> out_program_id, | ||
| 32 | u64 caller_program_id) { | ||
| 33 | LOG_WARNING(Service_NS, "(STUBBED) called, caller_program_id={:016X}", caller_program_id); | ||
| 34 | *out_program_id = system.GetApplicationProcessProgramID(); | ||
| 35 | R_SUCCEED(); | ||
| 36 | } | ||
| 37 | |||
| 38 | } // namespace Service::NS | ||
diff --git a/src/core/hle/service/ns/document_interface.h b/src/core/hle/service/ns/document_interface.h new file mode 100644 index 000000000..cd461652c --- /dev/null +++ b/src/core/hle/service/ns/document_interface.h | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include "core/hle/service/cmif_types.h" | ||
| 7 | #include "core/hle/service/ns/ns_types.h" | ||
| 8 | #include "core/hle/service/service.h" | ||
| 9 | |||
| 10 | namespace Service::NS { | ||
| 11 | |||
| 12 | class IDocumentInterface final : public ServiceFramework<IDocumentInterface> { | ||
| 13 | public: | ||
| 14 | explicit IDocumentInterface(Core::System& system_); | ||
| 15 | ~IDocumentInterface() override; | ||
| 16 | |||
| 17 | private: | ||
| 18 | Result ResolveApplicationContentPath(ContentPath content_path); | ||
| 19 | Result GetRunningApplicationProgramId(Out<u64> out_program_id, u64 caller_program_id); | ||
| 20 | }; | ||
| 21 | |||
| 22 | } // namespace Service::NS | ||
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index e8b13213d..b98fa2c96 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include "core/hle/service/ns/account_proxy_interface.h" | 14 | #include "core/hle/service/ns/account_proxy_interface.h" |
| 15 | #include "core/hle/service/ns/application_version_interface.h" | 15 | #include "core/hle/service/ns/application_version_interface.h" |
| 16 | #include "core/hle/service/ns/content_management_interface.h" | 16 | #include "core/hle/service/ns/content_management_interface.h" |
| 17 | #include "core/hle/service/ns/document_interface.h" | ||
| 17 | #include "core/hle/service/ns/ecommerce_interface.h" | 18 | #include "core/hle/service/ns/ecommerce_interface.h" |
| 18 | #include "core/hle/service/ns/factory_reset_interface.h" | 19 | #include "core/hle/service/ns/factory_reset_interface.h" |
| 19 | #include "core/hle/service/ns/language.h" | 20 | #include "core/hle/service/ns/language.h" |
| @@ -465,47 +466,6 @@ Result IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode( | |||
| 465 | return ResultSuccess; | 466 | return ResultSuccess; |
| 466 | } | 467 | } |
| 467 | 468 | ||
| 468 | IDocumentInterface::IDocumentInterface(Core::System& system_) | ||
| 469 | : ServiceFramework{system_, "IDocumentInterface"} { | ||
| 470 | // clang-format off | ||
| 471 | static const FunctionInfo functions[] = { | ||
| 472 | {21, nullptr, "GetApplicationContentPath"}, | ||
| 473 | {23, &IDocumentInterface::ResolveApplicationContentPath, "ResolveApplicationContentPath"}, | ||
| 474 | {92, &IDocumentInterface::GetRunningApplicationProgramId, "GetRunningApplicationProgramId"}, | ||
| 475 | }; | ||
| 476 | // clang-format on | ||
| 477 | |||
| 478 | RegisterHandlers(functions); | ||
| 479 | } | ||
| 480 | |||
| 481 | IDocumentInterface::~IDocumentInterface() = default; | ||
| 482 | |||
| 483 | void IDocumentInterface::ResolveApplicationContentPath(HLERequestContext& ctx) { | ||
| 484 | struct ContentPath { | ||
| 485 | u8 file_system_proxy_type; | ||
| 486 | u64 program_id; | ||
| 487 | }; | ||
| 488 | static_assert(sizeof(ContentPath) == 0x10, "ContentPath has wrong size"); | ||
| 489 | |||
| 490 | IPC::RequestParser rp{ctx}; | ||
| 491 | auto content_path = rp.PopRaw<ContentPath>(); | ||
| 492 | LOG_WARNING(Service_NS, "(STUBBED) called, file_system_proxy_type={}, program_id={:016X}", | ||
| 493 | content_path.file_system_proxy_type, content_path.program_id); | ||
| 494 | |||
| 495 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 496 | rb.Push(ResultSuccess); | ||
| 497 | } | ||
| 498 | |||
| 499 | void IDocumentInterface::GetRunningApplicationProgramId(HLERequestContext& ctx) { | ||
| 500 | IPC::RequestParser rp{ctx}; | ||
| 501 | const auto caller_program_id = rp.PopRaw<u64>(); | ||
| 502 | LOG_WARNING(Service_NS, "(STUBBED) called, caller_program_id={:016X}", caller_program_id); | ||
| 503 | |||
| 504 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 505 | rb.Push(ResultSuccess); | ||
| 506 | rb.Push<u64>(system.GetApplicationProcessProgramID()); | ||
| 507 | } | ||
| 508 | |||
| 509 | IDownloadTaskInterface::IDownloadTaskInterface(Core::System& system_) | 469 | IDownloadTaskInterface::IDownloadTaskInterface(Core::System& system_) |
| 510 | : ServiceFramework{system_, "IDownloadTaskInterface"} { | 470 | : ServiceFramework{system_, "IDownloadTaskInterface"} { |
| 511 | // clang-format off | 471 | // clang-format off |
diff --git a/src/core/hle/service/ns/ns.h b/src/core/hle/service/ns/ns.h index 27ccda38d..3e838373c 100644 --- a/src/core/hle/service/ns/ns.h +++ b/src/core/hle/service/ns/ns.h | |||
| @@ -32,16 +32,6 @@ private: | |||
| 32 | void ConvertApplicationLanguageToLanguageCode(HLERequestContext& ctx); | 32 | void ConvertApplicationLanguageToLanguageCode(HLERequestContext& ctx); |
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| 35 | class IDocumentInterface final : public ServiceFramework<IDocumentInterface> { | ||
| 36 | public: | ||
| 37 | explicit IDocumentInterface(Core::System& system_); | ||
| 38 | ~IDocumentInterface() override; | ||
| 39 | |||
| 40 | private: | ||
| 41 | void ResolveApplicationContentPath(HLERequestContext& ctx); | ||
| 42 | void GetRunningApplicationProgramId(HLERequestContext& ctx); | ||
| 43 | }; | ||
| 44 | |||
| 45 | class IDownloadTaskInterface final : public ServiceFramework<IDownloadTaskInterface> { | 35 | class IDownloadTaskInterface final : public ServiceFramework<IDownloadTaskInterface> { |
| 46 | public: | 36 | public: |
| 47 | explicit IDownloadTaskInterface(Core::System& system_); | 37 | explicit IDownloadTaskInterface(Core::System& system_); |
diff --git a/src/core/hle/service/ns/ns_types.h b/src/core/hle/service/ns/ns_types.h index b39181856..d7c16eac0 100644 --- a/src/core/hle/service/ns/ns_types.h +++ b/src/core/hle/service/ns/ns_types.h | |||
| @@ -73,4 +73,9 @@ struct ApplicationOccupiedSize { | |||
| 73 | std::array<ApplicationOccupiedSizeEntity, 4> entities; | 73 | std::array<ApplicationOccupiedSizeEntity, 4> entities; |
| 74 | }; | 74 | }; |
| 75 | 75 | ||
| 76 | struct ContentPath { | ||
| 77 | u8 file_system_proxy_type; | ||
| 78 | u64 program_id; | ||
| 79 | }; | ||
| 80 | |||
| 76 | } // namespace Service::NS | 81 | } // namespace Service::NS |