mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-23 03:11:51 +01:00
Refactor fatal services
Use the new service naming convention.
This commit is contained in:
parent
644cfbe332
commit
2e0ac9bdd5
@ -51,7 +51,7 @@ add_library(skyline SHARED
|
||||
${source_DIR}/skyline/kernel/types/KPrivateMemory.cpp
|
||||
${source_DIR}/skyline/services/serviceman.cpp
|
||||
${source_DIR}/skyline/services/sm/IUserInterface.cpp
|
||||
${source_DIR}/skyline/services/fatal/fatal.cpp
|
||||
${source_DIR}/skyline/services/fatalsrv/IService.cpp
|
||||
${source_DIR}/skyline/services/audout/audout.cpp
|
||||
${source_DIR}/skyline/services/audren/IAudioRendererManager.cpp
|
||||
${source_DIR}/skyline/services/audren/IAudioRenderer.cpp
|
||||
|
@ -19,7 +19,7 @@ namespace skyline::service {
|
||||
*/
|
||||
enum class Service {
|
||||
sm_IUserInterface,
|
||||
fatal_u,
|
||||
fatalsrv_IService,
|
||||
settings_ISystemSettingsServer,
|
||||
apm,
|
||||
apm_ISession,
|
||||
@ -61,7 +61,7 @@ namespace skyline::service {
|
||||
* @brief A map from every service's name as a std::string to the corresponding serviceEnum
|
||||
*/
|
||||
const static std::unordered_map<std::string, Service> ServiceString{
|
||||
{"fatal:u", Service::fatal_u},
|
||||
{"fatal:u", Service::fatalsrv_IService},
|
||||
{"set:sys", Service::settings_ISystemSettingsServer},
|
||||
{"apm", Service::apm},
|
||||
{"appletOE", Service::am_appletOE},
|
||||
|
@ -1,13 +0,0 @@
|
||||
#include "fatal.h"
|
||||
|
||||
namespace skyline::service::fatal {
|
||||
fatalU::fatalU(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::fatal_u, "fatal:u", {
|
||||
{0x0, SFUNC(fatalU::ThrowFatal)},
|
||||
{0x1, SFUNC(fatalU::ThrowFatal)},
|
||||
{0x2, SFUNC(fatalU::ThrowFatal)}
|
||||
}) {}
|
||||
|
||||
void fatalU::ThrowFatal(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
throw exception("A fatal error with code: 0x{:X} has caused emulation to stop", *reinterpret_cast<u32 *>(request.cmdArg));
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <services/base_service.h>
|
||||
#include <services/serviceman.h>
|
||||
|
||||
namespace skyline::service::fatal {
|
||||
/**
|
||||
* @brief fatal_u is used by applications to throw errors (https://switchbrew.org/wiki/Fatal_services#fatal:u)
|
||||
*/
|
||||
class fatalU : public BaseService {
|
||||
public:
|
||||
fatalU(const DeviceState &state, ServiceManager &manager);
|
||||
|
||||
/**
|
||||
* @brief This throws an exception so that emulation will quit
|
||||
*/
|
||||
void ThrowFatal(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
};
|
||||
}
|
13
app/src/main/cpp/skyline/services/fatalsrv/IService.cpp
Normal file
13
app/src/main/cpp/skyline/services/fatalsrv/IService.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include "IService.h"
|
||||
|
||||
namespace skyline::service::fatalsrv {
|
||||
IService::IService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::fatalsrv_IService, "fatalsrv:IService", {
|
||||
{0x0, SFUNC(IService::ThrowFatal)},
|
||||
{0x1, SFUNC(IService::ThrowFatal)},
|
||||
{0x2, SFUNC(IService::ThrowFatal)}
|
||||
}) {}
|
||||
|
||||
void IService::ThrowFatal(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
throw exception("A fatal error with code: 0x{:X} has caused emulation to stop", *reinterpret_cast<u32 *>(request.cmdArg));
|
||||
}
|
||||
}
|
19
app/src/main/cpp/skyline/services/fatalsrv/IService.h
Normal file
19
app/src/main/cpp/skyline/services/fatalsrv/IService.h
Normal file
@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <services/base_service.h>
|
||||
#include <services/serviceman.h>
|
||||
|
||||
namespace skyline::service::fatalsrv {
|
||||
/**
|
||||
* @brief IService or fatal:u is used by applications to throw errors (https://switchbrew.org/wiki/Fatal_services#fatal:u)
|
||||
*/
|
||||
class IService : public BaseService {
|
||||
public:
|
||||
IService(const DeviceState &state, ServiceManager &manager);
|
||||
|
||||
/**
|
||||
* @brief This throws an exception that causes emulation to quit
|
||||
*/
|
||||
void ThrowFatal(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
};
|
||||
}
|
@ -6,7 +6,7 @@
|
||||
#include "am/applet.h"
|
||||
#include "am/appletController.h"
|
||||
#include "audout/audout.h"
|
||||
#include "fatal/fatal.h"
|
||||
#include "fatalsrv/IService.h"
|
||||
#include "hid/IHidServer.h"
|
||||
#include "timesrv/IStaticService.h"
|
||||
#include "fssrv/IFileSystemProxy.h"
|
||||
@ -26,8 +26,8 @@ namespace skyline::service {
|
||||
case Service::sm_IUserInterface:
|
||||
serviceObj = std::make_shared<sm::IUserInterface>(state, *this);
|
||||
break;
|
||||
case Service::fatal_u:
|
||||
serviceObj = std::make_shared<fatal::fatalU>(state, *this);
|
||||
case Service::fatalsrv_IService:
|
||||
serviceObj = std::make_shared<fatalsrv::IService>(state, *this);
|
||||
break;
|
||||
case Service::settings_ISystemSettingsServer:
|
||||
serviceObj = std::make_shared<settings::ISystemSettingsServer>(state, *this);
|
||||
|
Loading…
Reference in New Issue
Block a user