diff options
author | Liam <byteslice@airmail.cc> | 2024-02-17 18:09:07 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2024-02-18 16:32:21 +0100 |
commit | bb59940b038e9f089646727f720111b216c9886b (patch) | |
tree | db359d2957f2c5a1bf381cb725207fb36da0ed14 /src/core | |
parent | ns: rewrite IContentManagementInterface (diff) | |
download | yuzu-bb59940b038e9f089646727f720111b216c9886b.tar yuzu-bb59940b038e9f089646727f720111b216c9886b.tar.gz yuzu-bb59940b038e9f089646727f720111b216c9886b.tar.bz2 yuzu-bb59940b038e9f089646727f720111b216c9886b.tar.lz yuzu-bb59940b038e9f089646727f720111b216c9886b.tar.xz yuzu-bb59940b038e9f089646727f720111b216c9886b.tar.zst yuzu-bb59940b038e9f089646727f720111b216c9886b.zip |
Diffstat (limited to '')
-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 hle/service/ns/application_version_interface.h hle/service/ns/content_management_interface.cpp hle/service/ns/content_management_interface.h + hle/service/ns/document_interface.cpp + hle/service/ns/document_interface.h hle/service/ns/ecommerce_interface.cpp hle/service/ns/ecommerce_interface.h 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 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "core/core.h" +#include "core/hle/service/cmif_serialization.h" +#include "core/hle/service/ns/document_interface.h" + +namespace Service::NS { + +IDocumentInterface::IDocumentInterface(Core::System& system_) + : ServiceFramework{system_, "IDocumentInterface"} { + // clang-format off + static const FunctionInfo functions[] = { + {21, nullptr, "GetApplicationContentPath"}, + {23, D<&IDocumentInterface::ResolveApplicationContentPath>, "ResolveApplicationContentPath"}, + {92, D<&IDocumentInterface::GetRunningApplicationProgramId>, "GetRunningApplicationProgramId"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +IDocumentInterface::~IDocumentInterface() = default; + +Result IDocumentInterface::ResolveApplicationContentPath(ContentPath content_path) { + LOG_WARNING(Service_NS, "(STUBBED) called, file_system_proxy_type={}, program_id={:016X}", + content_path.file_system_proxy_type, content_path.program_id); + R_SUCCEED(); +} + +Result IDocumentInterface::GetRunningApplicationProgramId(Out<u64> out_program_id, + u64 caller_program_id) { + LOG_WARNING(Service_NS, "(STUBBED) called, caller_program_id={:016X}", caller_program_id); + *out_program_id = system.GetApplicationProcessProgramID(); + R_SUCCEED(); +} + +} // 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 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/ns/ns_types.h" +#include "core/hle/service/service.h" + +namespace Service::NS { + +class IDocumentInterface final : public ServiceFramework<IDocumentInterface> { +public: + explicit IDocumentInterface(Core::System& system_); + ~IDocumentInterface() override; + +private: + Result ResolveApplicationContentPath(ContentPath content_path); + Result GetRunningApplicationProgramId(Out<u64> out_program_id, u64 caller_program_id); +}; + +} // 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 @@ #include "core/hle/service/ns/account_proxy_interface.h" #include "core/hle/service/ns/application_version_interface.h" #include "core/hle/service/ns/content_management_interface.h" +#include "core/hle/service/ns/document_interface.h" #include "core/hle/service/ns/ecommerce_interface.h" #include "core/hle/service/ns/factory_reset_interface.h" #include "core/hle/service/ns/language.h" @@ -465,47 +466,6 @@ Result IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode( return ResultSuccess; } -IDocumentInterface::IDocumentInterface(Core::System& system_) - : ServiceFramework{system_, "IDocumentInterface"} { - // clang-format off - static const FunctionInfo functions[] = { - {21, nullptr, "GetApplicationContentPath"}, - {23, &IDocumentInterface::ResolveApplicationContentPath, "ResolveApplicationContentPath"}, - {92, &IDocumentInterface::GetRunningApplicationProgramId, "GetRunningApplicationProgramId"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -IDocumentInterface::~IDocumentInterface() = default; - -void IDocumentInterface::ResolveApplicationContentPath(HLERequestContext& ctx) { - struct ContentPath { - u8 file_system_proxy_type; - u64 program_id; - }; - static_assert(sizeof(ContentPath) == 0x10, "ContentPath has wrong size"); - - IPC::RequestParser rp{ctx}; - auto content_path = rp.PopRaw<ContentPath>(); - LOG_WARNING(Service_NS, "(STUBBED) called, file_system_proxy_type={}, program_id={:016X}", - content_path.file_system_proxy_type, content_path.program_id); - - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); -} - -void IDocumentInterface::GetRunningApplicationProgramId(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - const auto caller_program_id = rp.PopRaw<u64>(); - LOG_WARNING(Service_NS, "(STUBBED) called, caller_program_id={:016X}", caller_program_id); - - IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(ResultSuccess); - rb.Push<u64>(system.GetApplicationProcessProgramID()); -} - IDownloadTaskInterface::IDownloadTaskInterface(Core::System& system_) : ServiceFramework{system_, "IDownloadTaskInterface"} { // 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: void ConvertApplicationLanguageToLanguageCode(HLERequestContext& ctx); }; -class IDocumentInterface final : public ServiceFramework<IDocumentInterface> { -public: - explicit IDocumentInterface(Core::System& system_); - ~IDocumentInterface() override; - -private: - void ResolveApplicationContentPath(HLERequestContext& ctx); - void GetRunningApplicationProgramId(HLERequestContext& ctx); -}; - class IDownloadTaskInterface final : public ServiceFramework<IDownloadTaskInterface> { public: 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 { std::array<ApplicationOccupiedSizeEntity, 4> entities; }; +struct ContentPath { + u8 file_system_proxy_type; + u64 program_id; +}; + } // namespace Service::NS |