mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-23 13:01:50 +01:00
Refactor filesystem services
Use the new service naming convention.
This commit is contained in:
parent
524cd26649
commit
644cfbe332
@ -66,7 +66,8 @@ add_library(skyline SHARED
|
|||||||
${source_DIR}/skyline/services/timesrv/IStaticService.cpp
|
${source_DIR}/skyline/services/timesrv/IStaticService.cpp
|
||||||
${source_DIR}/skyline/services/timesrv/ISystemClock.cpp
|
${source_DIR}/skyline/services/timesrv/ISystemClock.cpp
|
||||||
${source_DIR}/skyline/services/timesrv/ITimeZoneService.cpp
|
${source_DIR}/skyline/services/timesrv/ITimeZoneService.cpp
|
||||||
${source_DIR}/skyline/services/fs/fs.cpp
|
${source_DIR}/skyline/services/fssrv/IFileSystemProxy.cpp
|
||||||
|
${source_DIR}/skyline/services/fssrv/IFileSystem.cpp
|
||||||
${source_DIR}/skyline/services/nvdrv/nvdrv.cpp
|
${source_DIR}/skyline/services/nvdrv/nvdrv.cpp
|
||||||
${source_DIR}/skyline/services/nvnflinger/dispdrv.cpp
|
${source_DIR}/skyline/services/nvnflinger/dispdrv.cpp
|
||||||
${source_DIR}/skyline/services/vi/vi_m.cpp
|
${source_DIR}/skyline/services/vi/vi_m.cpp
|
||||||
|
@ -47,8 +47,8 @@ namespace skyline::service {
|
|||||||
timesrv_IStaticService,
|
timesrv_IStaticService,
|
||||||
timesrv_ISystemClock,
|
timesrv_ISystemClock,
|
||||||
timesrv_ITimeZoneService,
|
timesrv_ITimeZoneService,
|
||||||
fs_fsp,
|
fssrv_IFileSystemProxy,
|
||||||
fs_IFileSystem,
|
fssrv_IFileSystem,
|
||||||
nvdrv,
|
nvdrv,
|
||||||
vi_m,
|
vi_m,
|
||||||
vi_IApplicationDisplayService,
|
vi_IApplicationDisplayService,
|
||||||
@ -72,7 +72,7 @@ namespace skyline::service {
|
|||||||
{"time:s", Service::timesrv_IStaticService},
|
{"time:s", Service::timesrv_IStaticService},
|
||||||
{"time:a", Service::timesrv_IStaticService},
|
{"time:a", Service::timesrv_IStaticService},
|
||||||
{"time:u", Service::timesrv_IStaticService},
|
{"time:u", Service::timesrv_IStaticService},
|
||||||
{"fsp-srv", Service::fs_fsp},
|
{"fsp-srv", Service::fssrv_IFileSystemProxy},
|
||||||
{"nvdrv", Service::nvdrv},
|
{"nvdrv", Service::nvdrv},
|
||||||
{"nvdrv:a", Service::nvdrv},
|
{"nvdrv:a", Service::nvdrv},
|
||||||
{"nvdrv:s", Service::nvdrv},
|
{"nvdrv:s", Service::nvdrv},
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
#include "fs.h"
|
|
||||||
|
|
||||||
namespace skyline::service::fs {
|
|
||||||
fsp::fsp(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::fs_fsp, "fs:fsp", {
|
|
||||||
{0x1, SFUNC(fsp::SetCurrentProcess)},
|
|
||||||
{0x12, SFUNC(fsp::OpenSdCardFileSystem)}
|
|
||||||
}) {}
|
|
||||||
|
|
||||||
void fsp::SetCurrentProcess(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
process = *reinterpret_cast<pid_t *>(request.cmdArg);
|
|
||||||
}
|
|
||||||
|
|
||||||
void fsp::OpenSdCardFileSystem(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
manager.RegisterService(std::make_shared<IFileSystem>(FsType::SdCard, state, manager), session, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
IFileSystem::IFileSystem(FsType type, const DeviceState &state, ServiceManager &manager) : type(type), BaseService(state, manager, Service::fs_IFileSystem, "fs:IFileSystem", {}) {}
|
|
||||||
}
|
|
5
app/src/main/cpp/skyline/services/fssrv/IFileSystem.cpp
Normal file
5
app/src/main/cpp/skyline/services/fssrv/IFileSystem.cpp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#include "IFileSystem.h"
|
||||||
|
|
||||||
|
namespace skyline::service::fssrv {
|
||||||
|
IFileSystem::IFileSystem(const FsType type, const DeviceState &state, ServiceManager &manager) : type(type), BaseService(state, manager, Service::fssrv_IFileSystem, "fssrv:IFileSystem", {}) {}
|
||||||
|
}
|
25
app/src/main/cpp/skyline/services/fssrv/IFileSystem.h
Normal file
25
app/src/main/cpp/skyline/services/fssrv/IFileSystem.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <services/base_service.h>
|
||||||
|
#include <services/serviceman.h>
|
||||||
|
|
||||||
|
namespace skyline::service::fssrv {
|
||||||
|
/**
|
||||||
|
* @brief These are the possible types of the filesystem
|
||||||
|
*/
|
||||||
|
enum class FsType {
|
||||||
|
Nand,
|
||||||
|
SdCard,
|
||||||
|
GameCard
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief IFileSystem is used to interact with a filesystem (https://switchbrew.org/wiki/Filesystem_services#IFileSystem)
|
||||||
|
*/
|
||||||
|
class IFileSystem : public BaseService {
|
||||||
|
public:
|
||||||
|
const FsType type;
|
||||||
|
|
||||||
|
IFileSystem(FsType type, const DeviceState &state, ServiceManager &manager);
|
||||||
|
};
|
||||||
|
}
|
16
app/src/main/cpp/skyline/services/fssrv/IFileSystemProxy.cpp
Normal file
16
app/src/main/cpp/skyline/services/fssrv/IFileSystemProxy.cpp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#include "IFileSystemProxy.h"
|
||||||
|
|
||||||
|
namespace skyline::service::fssrv {
|
||||||
|
IFileSystemProxy::IFileSystemProxy(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::fssrv_IFileSystemProxy, "fssrv:IFileSystemProxy", {
|
||||||
|
{0x1, SFUNC(IFileSystemProxy::SetCurrentProcess)},
|
||||||
|
{0x12, SFUNC(IFileSystemProxy::OpenSdCardFileSystem)}
|
||||||
|
}) {}
|
||||||
|
|
||||||
|
void IFileSystemProxy::SetCurrentProcess(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
process = *reinterpret_cast<pid_t *>(request.cmdArg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IFileSystemProxy::OpenSdCardFileSystem(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
manager.RegisterService(std::make_shared<IFileSystem>(FsType::SdCard, state, manager), session, response);
|
||||||
|
}
|
||||||
|
}
|
@ -2,25 +2,17 @@
|
|||||||
|
|
||||||
#include <services/base_service.h>
|
#include <services/base_service.h>
|
||||||
#include <services/serviceman.h>
|
#include <services/serviceman.h>
|
||||||
|
#include "IFileSystem.h"
|
||||||
|
|
||||||
namespace skyline::service::fs {
|
namespace skyline::service::fssrv {
|
||||||
/**
|
/**
|
||||||
* @brief These are the possible types of the filesystem
|
* @brief IFileSystemProxy or fsp-srv is responsible for providing handles to file systems (https://switchbrew.org/wiki/Filesystem_services#fsp-srv)
|
||||||
*/
|
*/
|
||||||
enum class FsType {
|
class IFileSystemProxy : public BaseService {
|
||||||
Nand,
|
|
||||||
SdCard,
|
|
||||||
GameCard
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief fsp-srv or IFileSystemProxy is responsible for providing handles to file systems (https://switchbrew.org/wiki/Filesystem_services#fsp-srv)
|
|
||||||
*/
|
|
||||||
class fsp : public BaseService {
|
|
||||||
public:
|
public:
|
||||||
pid_t process{}; //!< This holds the PID set by SetCurrentProcess
|
pid_t process{}; //!< This holds the PID set by SetCurrentProcess
|
||||||
|
|
||||||
fsp(const DeviceState &state, ServiceManager &manager);
|
IFileSystemProxy(const DeviceState &state, ServiceManager &manager);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This sets the PID of the process using FS currently (https://switchbrew.org/wiki/Filesystem_services#SetCurrentProcess)
|
* @brief This sets the PID of the process using FS currently (https://switchbrew.org/wiki/Filesystem_services#SetCurrentProcess)
|
||||||
@ -32,14 +24,4 @@ namespace skyline::service::fs {
|
|||||||
*/
|
*/
|
||||||
void OpenSdCardFileSystem(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
void OpenSdCardFileSystem(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief IFileSystem is used to interact with a filesystem (https://switchbrew.org/wiki/Filesystem_services#IFileSystem)
|
|
||||||
*/
|
|
||||||
class IFileSystem : public BaseService {
|
|
||||||
public:
|
|
||||||
FsType type;
|
|
||||||
|
|
||||||
IFileSystem(FsType type, const DeviceState &state, ServiceManager &manager);
|
|
||||||
};
|
|
||||||
}
|
}
|
@ -9,7 +9,7 @@
|
|||||||
#include "fatal/fatal.h"
|
#include "fatal/fatal.h"
|
||||||
#include "hid/IHidServer.h"
|
#include "hid/IHidServer.h"
|
||||||
#include "timesrv/IStaticService.h"
|
#include "timesrv/IStaticService.h"
|
||||||
#include "fs/fs.h"
|
#include "fssrv/IFileSystemProxy.h"
|
||||||
#include "nvdrv/nvdrv.h"
|
#include "nvdrv/nvdrv.h"
|
||||||
#include "vi/vi_m.h"
|
#include "vi/vi_m.h"
|
||||||
#include "serviceman.h"
|
#include "serviceman.h"
|
||||||
@ -53,8 +53,8 @@ namespace skyline::service {
|
|||||||
case Service::timesrv_IStaticService:
|
case Service::timesrv_IStaticService:
|
||||||
serviceObj = std::make_shared<timesrv::IStaticService>(state, *this);
|
serviceObj = std::make_shared<timesrv::IStaticService>(state, *this);
|
||||||
break;
|
break;
|
||||||
case Service::fs_fsp:
|
case Service::fssrv_IFileSystemProxy:
|
||||||
serviceObj = std::make_shared<fs::fsp>(state, *this);
|
serviceObj = std::make_shared<fssrv::IFileSystemProxy>(state, *this);
|
||||||
break;
|
break;
|
||||||
case Service::nvdrv:
|
case Service::nvdrv:
|
||||||
serviceObj = std::make_shared<nvdrv::nvdrv>(state, *this);
|
serviceObj = std::make_shared<nvdrv::nvdrv>(state, *this);
|
||||||
|
Loading…
Reference in New Issue
Block a user