From 68253fe99545ea19da4fb50f948c10f07704ece3 Mon Sep 17 00:00:00 2001 From: Dima Date: Wed, 30 Nov 2022 19:57:52 +0300 Subject: [PATCH] Stub mii:e/mii:u Needed for SSBU --- app/CMakeLists.txt | 2 + .../skyline/services/mii/IDatabaseService.cpp | 37 +++++++++++++++++ .../skyline/services/mii/IDatabaseService.h | 40 +++++++++++++++++++ .../skyline/services/mii/IStaticService.cpp | 14 +++++++ .../cpp/skyline/services/mii/IStaticService.h | 22 ++++++++++ .../main/cpp/skyline/services/serviceman.cpp | 3 ++ 6 files changed, 118 insertions(+) create mode 100644 app/src/main/cpp/skyline/services/mii/IDatabaseService.cpp create mode 100644 app/src/main/cpp/skyline/services/mii/IDatabaseService.h create mode 100644 app/src/main/cpp/skyline/services/mii/IStaticService.cpp create mode 100644 app/src/main/cpp/skyline/services/mii/IStaticService.h diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index d1b343e1..431851d7 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -379,6 +379,8 @@ add_library(skyline SHARED ${source_DIR}/skyline/services/ssl/ISslContext.cpp ${source_DIR}/skyline/services/prepo/IPrepoService.cpp ${source_DIR}/skyline/services/mmnv/IRequest.cpp + ${source_DIR}/skyline/services/mii/IStaticService.cpp + ${source_DIR}/skyline/services/mii/IDatabaseService.cpp ) target_include_directories(skyline PRIVATE ${source_DIR}/skyline) # target_precompile_headers(skyline PRIVATE ${source_DIR}/skyline/common.h) # PCH will currently break Intellisense diff --git a/app/src/main/cpp/skyline/services/mii/IDatabaseService.cpp b/app/src/main/cpp/skyline/services/mii/IDatabaseService.cpp new file mode 100644 index 00000000..fdd6fd83 --- /dev/null +++ b/app/src/main/cpp/skyline/services/mii/IDatabaseService.cpp @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#include "IDatabaseService.h" + +namespace skyline::service::mii { + IDatabaseService::IDatabaseService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} + + Result IDatabaseService::IsUpdated(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + response.Push(0); + return {}; + } + + Result IDatabaseService::Get(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + return {}; + } + + Result IDatabaseService::Get1(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + return {}; + } + + Result IDatabaseService::BuildRandom(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + return {}; + } + + Result IDatabaseService::BuildDefault(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + return {}; + } + + Result IDatabaseService::SetInterfaceVersion(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + return {}; + } + + Result IDatabaseService::DeleteFile(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + return {}; + } +} diff --git a/app/src/main/cpp/skyline/services/mii/IDatabaseService.h b/app/src/main/cpp/skyline/services/mii/IDatabaseService.h new file mode 100644 index 00000000..1a59abce --- /dev/null +++ b/app/src/main/cpp/skyline/services/mii/IDatabaseService.h @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#pragma once + +#include + +namespace skyline::service::mii { + /** + * @url https://switchbrew.org/wiki/Shared_Database_services#IDatabaseService + */ + class IDatabaseService : public BaseService { + public: + IDatabaseService(const DeviceState &state, ServiceManager &manager); + + Result IsUpdated(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + Result Get(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + Result Get1(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + Result BuildRandom(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + Result BuildDefault(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + Result SetInterfaceVersion(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + Result DeleteFile(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IDatabaseService, IsUpdated), + SFUNC(0x3, IDatabaseService, Get), + SFUNC(0x4, IDatabaseService, Get1), + SFUNC(0x6, IDatabaseService, BuildRandom), + SFUNC(0x7, IDatabaseService, BuildDefault), + SFUNC(0x16, IDatabaseService, SetInterfaceVersion), + SFUNC(0x17, IDatabaseService, DeleteFile) + ) + }; +} diff --git a/app/src/main/cpp/skyline/services/mii/IStaticService.cpp b/app/src/main/cpp/skyline/services/mii/IStaticService.cpp new file mode 100644 index 00000000..4402e02f --- /dev/null +++ b/app/src/main/cpp/skyline/services/mii/IStaticService.cpp @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#include "IStaticService.h" +#include "IDatabaseService.h" + +namespace skyline::service::mii { + IStaticService::IStaticService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} + + Result IStaticService::GetDatabaseService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + manager.RegisterService(SRVREG(IDatabaseService), session, response); + return {}; + } +} diff --git a/app/src/main/cpp/skyline/services/mii/IStaticService.h b/app/src/main/cpp/skyline/services/mii/IStaticService.h new file mode 100644 index 00000000..92b0d236 --- /dev/null +++ b/app/src/main/cpp/skyline/services/mii/IStaticService.h @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#pragma once + +#include + +namespace skyline::service::mii { + /** + * @url https://switchbrew.org/wiki/Shared_Database_services#mii:u.2C_mii:e + */ + class IStaticService : public BaseService { + public: + IStaticService(const DeviceState &state, ServiceManager &manager); + + Result GetDatabaseService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IStaticService, GetDatabaseService) + ) + }; +} diff --git a/app/src/main/cpp/skyline/services/serviceman.cpp b/app/src/main/cpp/skyline/services/serviceman.cpp index 4a321dae..843903db 100644 --- a/app/src/main/cpp/skyline/services/serviceman.cpp +++ b/app/src/main/cpp/skyline/services/serviceman.cpp @@ -54,6 +54,7 @@ #include "capsrv/IAlbumApplicationService.h" #include "capsrv/IScreenShotApplicationService.h" #include "ro/IRoInterface.h" +#include "mii/IStaticService.h" #include "serviceman.h" #define SERVICE_CASE(class, name, ...) \ @@ -137,6 +138,8 @@ namespace skyline::service { SERVICE_CASE(capsrv::IScreenShotApplicationService, "caps:su") SERVICE_CASE(nim::IShopServiceAccessServerInterface, "nim:eca") SERVICE_CASE(ro::IRoInterface, "ldr:ro") + SERVICE_CASE(mii::IStaticService, "mii:e") + SERVICE_CASE(mii::IStaticService, "mii:u") default: std::string_view nameString(span(reinterpret_cast(&name), sizeof(name)).as_string(true)); throw std::out_of_range(fmt::format("CreateService called with an unknown service name: {}", nameString));