Refactor settings services

Use the new service naming convention.
This commit is contained in:
Billy Laws 2020-02-16 19:25:18 +00:00 committed by ◱ PixelyIon
parent c8846ca07b
commit f4620dd992
6 changed files with 24 additions and 24 deletions

View File

@ -57,7 +57,7 @@ add_library(skyline SHARED
${source_DIR}/skyline/services/audren/IAudioRenderer.cpp
${source_DIR}/skyline/services/audren/voice.cpp
${source_DIR}/skyline/services/audren/memoryPool.cpp
${source_DIR}/skyline/services/set/sys.cpp
${source_DIR}/skyline/services/settings/ISystemSettingsServer.cpp
${source_DIR}/skyline/services/apm/apm.cpp
${source_DIR}/skyline/services/am/applet.cpp
${source_DIR}/skyline/services/am/appletController.cpp

View File

@ -20,7 +20,7 @@ namespace skyline::service {
enum class Service {
sm_IUserInterface,
fatal_u,
set_sys,
settings_ISystemSettingsServer,
apm,
apm_ISession,
am_appletOE,
@ -62,7 +62,7 @@ namespace skyline::service {
*/
const static std::unordered_map<std::string, Service> ServiceString{
{"fatal:u", Service::fatal_u},
{"set:sys", Service::set_sys},
{"set:sys", Service::settings_ISystemSettingsServer},
{"apm", Service::apm},
{"appletOE", Service::am_appletOE},
{"appletAE", Service::am_appletAE},

View File

@ -1,7 +1,7 @@
#include <kernel/types/KProcess.h>
#include <services/audren/IAudioRendererManager.h>
#include "sm/IUserInterface.h"
#include "set/sys.h"
#include "settings/ISystemSettingsServer.h"
#include "apm/apm.h"
#include "am/applet.h"
#include "am/appletController.h"
@ -29,8 +29,8 @@ namespace skyline::service {
case Service::fatal_u:
serviceObj = std::make_shared<fatal::fatalU>(state, *this);
break;
case Service::set_sys:
serviceObj = std::make_shared<set::sys>(state, *this);
case Service::settings_ISystemSettingsServer:
serviceObj = std::make_shared<settings::ISystemSettingsServer>(state, *this);
break;
case Service::apm:
serviceObj = std::make_shared<apm::apm>(state, *this);

View File

@ -1,12 +0,0 @@
#include "sys.h"
#include <kernel/types/KProcess.h>
namespace skyline::service::set {
sys::sys(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::set_sys, "set:sys", {
{0x3, SFUNC(sys::GetFirmwareVersion)}}) {}
void sys::GetFirmwareVersion(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
SysVerTitle title{.minor=9, .major=0, .micro=0, .revMajor=4, .platform="NX", .verHash="4de65c071fd0869695b7629f75eb97b2551dbf2f", .dispVer="9.0.0", .dispTitle="NintendoSDK Firmware for NX 9.0.0-4.0"};
state.process->WriteMemory(title, request.outputBuf.at(0).address);
}
}

View File

@ -0,0 +1,12 @@
#include <kernel/types/KProcess.h>
#include "ISystemSettingsServer.h"
namespace skyline::service::settings {
ISystemSettingsServer::ISystemSettingsServer(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::settings_ISystemSettingsServer, "settings:ISystemSettingsServer", {
{0x3, SFUNC(ISystemSettingsServer::GetFirmwareVersion)}}) {}
void ISystemSettingsServer::GetFirmwareVersion(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
SysVerTitle title{.minor=9, .major=0, .micro=0, .revMajor=4, .platform="NX", .verHash="4de65c071fd0869695b7629f75eb97b2551dbf2f", .dispVer="9.0.0", .dispTitle="NintendoSDK Firmware for NX 9.0.0-4.0"};
state.process->WriteMemory(title, request.outputBuf.at(0).address);
}
}

View File

@ -3,11 +3,11 @@
#include <services/base_service.h>
#include <services/serviceman.h>
namespace skyline::service::set {
namespace skyline::service::settings {
/**
* @brief set:sys or System Settings service provides access to system settings
* @brief ISystemSettingsServer or set:sys service provides access to system settings
*/
class sys : public BaseService {
class ISystemSettingsServer : public BaseService {
private:
/**
* @brief Encapsulates the system version, this is sent to the application in GetFirmwareVersion (https://switchbrew.org/wiki/System_Version_Title)
@ -16,10 +16,10 @@ namespace skyline::service::set {
u8 major; //!< The major version
u8 minor; //!< The minor vision
u8 micro; //!< The micro vision
u8 : 8;
u8 _pad0_;
u8 revMajor; //!< The major revision
u8 revMinor; //!< The major revision
u16 : 16;
u16 _pad1_;
u8 platform[0x20]; //!< "NX"
u8 verHash[0x40]; //!< This is the hash of the version string
u8 dispVer[0x18]; //!< The version number string
@ -28,7 +28,7 @@ namespace skyline::service::set {
static_assert(sizeof(SysVerTitle) == 0x100);
public:
sys(const DeviceState &state, ServiceManager &manager);
ISystemSettingsServer(const DeviceState &state, ServiceManager &manager);
/**
* @brief Writes the Firmware version to a 0xA buffer (https://switchbrew.org/wiki/Settings_services#GetFirmwareVersion)