Stub nim services used for eShop communication

We obviously don't need to implement these so add a simple set of stubs to satify games using them (mainly demos such as DQXII)
This commit is contained in:
Billy Laws 2022-05-31 22:07:01 +01:00
parent ff12dc9c10
commit 22695c4feb
10 changed files with 142 additions and 0 deletions

View File

@ -322,6 +322,10 @@ add_library(skyline SHARED
${source_DIR}/skyline/services/nifm/IGeneralService.cpp
${source_DIR}/skyline/services/nifm/IScanRequest.cpp
${source_DIR}/skyline/services/nifm/IRequest.cpp
${source_DIR}/skyline/services/nim/IShopServiceAccessor.cpp
${source_DIR}/skyline/services/nim/IShopServiceAccessServer.cpp
${source_DIR}/skyline/services/nim/IShopServiceAccessServerInterface.cpp
${source_DIR}/skyline/services/nim/IShopServiceAsync.cpp
${source_DIR}/skyline/services/socket/bsd/IClient.cpp
${source_DIR}/skyline/services/spl/IRandomInterface.cpp
${source_DIR}/skyline/services/ssl/ISslService.cpp

View File

@ -0,0 +1,14 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/)
#include "IShopServiceAccessor.h"
#include "IShopServiceAccessServer.h"
namespace skyline::service::nim {
IShopServiceAccessServer::IShopServiceAccessServer(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
Result IShopServiceAccessServer::CreateAccessorInterface(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
manager.RegisterService(SRVREG(IShopServiceAccessor), session, response);
return {};
}
}

View File

@ -0,0 +1,23 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/)
#pragma once
#include <services/base_service.h>
namespace skyline::service::nim {
/**
* @brief IShopServiceAccessServer is used by applications to interface with the Nintendo eShop
* @url https://switchbrew.org/wiki/NIM_services#IShopServiceAccessServer
*/
class IShopServiceAccessServer : public BaseService {
public:
IShopServiceAccessServer(const DeviceState &state, ServiceManager &manager);
Result CreateAccessorInterface(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
SERVICE_DECL(
SFUNC(0x0, IShopServiceAccessServer, CreateAccessorInterface),
)
};
}

View File

@ -0,0 +1,14 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/)
#include "IShopServiceAccessServer.h"
#include "IShopServiceAccessServerInterface.h"
namespace skyline::service::nim {
IShopServiceAccessServerInterface::IShopServiceAccessServerInterface(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
Result IShopServiceAccessServerInterface::CreateServerInterface(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
manager.RegisterService(SRVREG(IShopServiceAccessServer), session, response);
return {};
}
}

View File

@ -0,0 +1,23 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/)
#pragma once
#include <services/serviceman.h>
namespace skyline::service::nim {
/**
* @brief IShopServiceAccessServerInterface or nim:eca is used by applications to open a channel to communicate with the Nintendo eShop
* @url https://switchbrew.org/wiki/NIM_services#nim:eca
*/
class IShopServiceAccessServerInterface : public BaseService {
public:
IShopServiceAccessServerInterface(const DeviceState &state, ServiceManager &manager);
Result CreateServerInterface(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
SERVICE_DECL(
SFUNC(0x0, IShopServiceAccessServerInterface, CreateServerInterface)
)
};
}

View File

@ -0,0 +1,14 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/)
#include "IShopServiceAsync.h"
#include "IShopServiceAccessor.h"
namespace skyline::service::nim {
IShopServiceAccessor::IShopServiceAccessor(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
Result IShopServiceAccessor::CreateAsyncInterface(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
manager.RegisterService(SRVREG(IShopServiceAsync), session, response);
return {};
}
}

View File

@ -0,0 +1,23 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/)
#pragma once
#include <services/serviceman.h>
namespace skyline::service::nim {
/**
* @brief IShopServiceAccessor is used by applications to communicate with the Nintendo eShop
* @url https://switchbrew.org/wiki/NIM_services#IShopServiceAccessor
*/
class IShopServiceAccessor : public BaseService {
public:
IShopServiceAccessor(const DeviceState &state, ServiceManager &manager);
Result CreateAsyncInterface(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
SERVICE_DECL(
SFUNC(0x0, IShopServiceAccessor, CreateAsyncInterface)
)
};
}

View File

@ -0,0 +1,8 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/)
#include "IShopServiceAsync.h"
namespace skyline::service::nim {
IShopServiceAsync::IShopServiceAsync(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
}

View File

@ -0,0 +1,17 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/)
#pragma once
#include <services/serviceman.h>
namespace skyline::service::nim {
/**
* @brief IShopServiceAsync is used by applications to directly communicate with the Nintendo eShop
* @url https://switchbrew.org/wiki/NIM_services#IShopServiceAsync
*/
class IShopServiceAsync : public BaseService {
public:
IShopServiceAsync(const DeviceState &state, ServiceManager &manager);
};
}

View File

@ -37,6 +37,7 @@
#include "friends/IServiceCreator.h"
#include "nfp/IUserManager.h"
#include "nifm/IStaticService.h"
#include "nim/IShopServiceAccessServerInterface.h"
#include "socket/bsd/IClient.h"
#include "spl/IRandomInterface.h"
#include "ssl/ISslService.h"
@ -115,6 +116,7 @@ namespace skyline::service {
SERVICE_CASE(bcat::IServiceCreator, "bcat:u")
SERVICE_CASE(bt::IBluetoothUser, "bt")
SERVICE_CASE(btm::IBtmUser, "btm:u")
SERVICE_CASE(nim::IShopServiceAccessServerInterface, "nim:eca")
default:
std::string_view nameString(span(reinterpret_cast<char *>(&name), sizeof(name)).as_string(true));
throw std::out_of_range(fmt::format("CreateService called with an unknown service name: {}", nameString));