Basic bcat:u implementation

A basic `bcat:u` implementation to prevent titles such as "Kirby and the Forgotten Land" dependent on BCAT support from crashing due to the lack of an implementation.
This commit is contained in:
shutterbug2000 2022-05-06 02:47:49 -05:00 committed by PixelyIon
parent 4fd64a53e0
commit 1c8d994161
6 changed files with 70 additions and 0 deletions

View File

@ -251,6 +251,8 @@ add_library(skyline SHARED
${source_DIR}/skyline/services/am/storage/IStorageAccessor.cpp ${source_DIR}/skyline/services/am/storage/IStorageAccessor.cpp
${source_DIR}/skyline/services/am/applet/ILibraryAppletAccessor.cpp ${source_DIR}/skyline/services/am/applet/ILibraryAppletAccessor.cpp
${source_DIR}/skyline/services/am/applet/IApplet.cpp ${source_DIR}/skyline/services/am/applet/IApplet.cpp
${source_DIR}/skyline/services/bcat/IServiceCreator.cpp
${source_DIR}/skyline/services/bcat/IBcatService.cpp
${source_DIR}/skyline/applet/applet_creator.cpp ${source_DIR}/skyline/applet/applet_creator.cpp
${source_DIR}/skyline/applet/controller_applet.cpp ${source_DIR}/skyline/applet/controller_applet.cpp
${source_DIR}/skyline/services/codec/IHardwareOpusDecoder.cpp ${source_DIR}/skyline/services/codec/IHardwareOpusDecoder.cpp

View File

@ -0,0 +1,8 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/)
#include "IBcatService.h"
namespace skyline::service::bcat {
IBcatService::IBcatService(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::bcat {
/**
* @brief IBcatService is used to interact with BCAT (Background Content Asymmetric synchronized delivery and Transmission)
* @url https://switchbrew.org/wiki/BCAT_services#IBcatService
*/
class IBcatService : public BaseService {
public:
IBcatService(const DeviceState &state, ServiceManager &manager);
};
}

View File

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

View File

@ -0,0 +1,28 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/)
#pragma once
#include <services/serviceman.h>
#include "IBcatService.h"
namespace skyline::service::bcat {
/**
* @brief IServiceCreator is used to create per-process/per-title service instances for BCAT
* @url https://switchbrew.org/wiki/BCAT_services#bcat:a.2C_bcat:m.2C_bcat:u.2C_bcat:s
*/
class IServiceCreator : public BaseService {
public:
IServiceCreator(const DeviceState &state, ServiceManager &manager);
/**
* @brief Takes an input u64 ProcessId, returns an #IBcatService
* @url https://switchbrew.org/wiki/BCAT_services#bcat:a.2C_bcat:m.2C_bcat:u.2C_bcat:s
*/
Result CreateBcatService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
SERVICE_DECL(
SFUNC(0x0, IServiceCreator, CreateBcatService)
)
};
}

View File

@ -11,6 +11,7 @@
#include "am/IAllSystemAppletProxiesService.h" #include "am/IAllSystemAppletProxiesService.h"
#include "audio/IAudioOutManager.h" #include "audio/IAudioOutManager.h"
#include "audio/IAudioRendererManager.h" #include "audio/IAudioRendererManager.h"
#include "bcat/IServiceCreator.h"
#include "codec/IHardwareOpusDecoderManager.h" #include "codec/IHardwareOpusDecoderManager.h"
#include "fatalsrv/IService.h" #include "fatalsrv/IService.h"
#include "hid/IHidServer.h" #include "hid/IHidServer.h"
@ -109,6 +110,7 @@ namespace skyline::service {
SERVICE_CASE(ssl::ISslService, "ssl") SERVICE_CASE(ssl::ISslService, "ssl")
SERVICE_CASE(prepo::IPrepoService, "prepo:u") SERVICE_CASE(prepo::IPrepoService, "prepo:u")
SERVICE_CASE(mmnv::IRequest, "mm:u") SERVICE_CASE(mmnv::IRequest, "mm:u")
SERVICE_CASE(bcat::IServiceCreator, "bcat:u")
default: default:
std::string_view nameString(span(reinterpret_cast<char *>(&name), sizeof(name)).as_string(true)); 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)); throw std::out_of_range(fmt::format("CreateService called with an unknown service name: {}", nameString));