mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-07-04 16:42:14 +02:00
fs.mitm: Use enum class some more
This commit is contained in:
parent
4d2096d685
commit
0b41d57b0c
@ -5,13 +5,13 @@
|
||||
|
||||
#include "debug.hpp"
|
||||
|
||||
enum FsIStorageCmd {
|
||||
FsIStorage_Cmd_Read = 0,
|
||||
FsIStorage_Cmd_Write = 1,
|
||||
FsIStorage_Cmd_Flush = 2,
|
||||
FsIStorage_Cmd_SetSize = 3,
|
||||
FsIStorage_Cmd_GetSize = 4,
|
||||
FsIStorage_Cmd_OperateRange = 5,
|
||||
enum class FsIStorageCmd {
|
||||
Read = 0,
|
||||
Write = 1,
|
||||
Flush = 2,
|
||||
SetSize = 3,
|
||||
GetSize = 4,
|
||||
OperateRange = 5,
|
||||
};
|
||||
|
||||
class IStorage {
|
||||
@ -49,22 +49,22 @@ class IStorageInterface : public IServiceObject {
|
||||
Result dispatch(IpcParsedCommand &r, IpcCommand &out_c, u64 cmd_id, u8 *pointer_buffer, size_t pointer_buffer_size) final {
|
||||
Result rc = 0xF601;
|
||||
switch ((FsIStorageCmd)cmd_id) {
|
||||
case FsIStorage_Cmd_Read:
|
||||
case FsIStorageCmd::Read:
|
||||
rc = WrapIpcCommandImpl<&IStorageInterface::read>(this, r, out_c, pointer_buffer, pointer_buffer_size);
|
||||
break;
|
||||
case FsIStorage_Cmd_Write:
|
||||
case FsIStorageCmd::Write:
|
||||
rc = WrapIpcCommandImpl<&IStorageInterface::write>(this, r, out_c, pointer_buffer, pointer_buffer_size);
|
||||
break;
|
||||
case FsIStorage_Cmd_Flush:
|
||||
case FsIStorageCmd::Flush:
|
||||
rc = WrapIpcCommandImpl<&IStorageInterface::flush>(this, r, out_c, pointer_buffer, pointer_buffer_size);
|
||||
break;
|
||||
case FsIStorage_Cmd_SetSize:
|
||||
case FsIStorageCmd::SetSize:
|
||||
rc = WrapIpcCommandImpl<&IStorageInterface::set_size>(this, r, out_c, pointer_buffer, pointer_buffer_size);
|
||||
break;
|
||||
case FsIStorage_Cmd_GetSize:
|
||||
case FsIStorageCmd::GetSize:
|
||||
rc = WrapIpcCommandImpl<&IStorageInterface::get_size>(this, r, out_c, pointer_buffer, pointer_buffer_size);
|
||||
break;
|
||||
case FsIStorage_Cmd_OperateRange:
|
||||
case FsIStorageCmd::OperateRange:
|
||||
if (kernelAbove400()) {
|
||||
rc = WrapIpcCommandImpl<&IStorageInterface::operate_range>(this, r, out_c, pointer_buffer, pointer_buffer_size);
|
||||
}
|
||||
|
@ -13,16 +13,18 @@
|
||||
Result FsMitMService::dispatch(IpcParsedCommand &r, IpcCommand &out_c, u64 cmd_id, u8 *pointer_buffer, size_t pointer_buffer_size) {
|
||||
Result rc = 0xF601;
|
||||
if (this->has_initialized) {
|
||||
switch (cmd_id) {
|
||||
case FspSrv_Cmd_OpenDataStorageByCurrentProcess:
|
||||
switch (static_cast<FspSrvCmd>(cmd_id)) {
|
||||
case FspSrvCmd::OpenDataStorageByCurrentProcess:
|
||||
rc = WrapIpcCommandImpl<&FsMitMService::open_data_storage_by_current_process>(this, r, out_c, pointer_buffer, pointer_buffer_size);
|
||||
break;
|
||||
case FspSrv_Cmd_OpenDataStorageByDataId:
|
||||
case FspSrvCmd::OpenDataStorageByDataId:
|
||||
rc = WrapIpcCommandImpl<&FsMitMService::open_data_storage_by_data_id>(this, r, out_c, pointer_buffer, pointer_buffer_size);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (cmd_id == FspSrv_Cmd_SetCurrentProcess) {
|
||||
if (static_cast<FspSrvCmd>(cmd_id) == FspSrvCmd::SetCurrentProcess) {
|
||||
if (r.HasPid) {
|
||||
this->init_pid = r.Pid;
|
||||
}
|
||||
@ -44,8 +46,8 @@ void FsMitMService::postprocess(IpcParsedCommand &r, IpcCommand &out_c, u64 cmd_
|
||||
}
|
||||
|
||||
Result rc = (Result)resp->result;
|
||||
switch (cmd_id) {
|
||||
case FspSrv_Cmd_SetCurrentProcess:
|
||||
switch (static_cast<FspSrvCmd>(cmd_id)) {
|
||||
case FspSrvCmd::SetCurrentProcess:
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
this->has_initialized = true;
|
||||
}
|
||||
@ -58,6 +60,8 @@ void FsMitMService::postprocess(IpcParsedCommand &r, IpcCommand &out_c, u64 cmd_
|
||||
tls[i] = backup_tls[i];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
resp->result = rc;
|
||||
}
|
||||
|
@ -4,10 +4,10 @@
|
||||
#include "imitmserviceobject.hpp"
|
||||
#include "fs_istorage.hpp"
|
||||
|
||||
enum FspSrvCmd {
|
||||
FspSrv_Cmd_SetCurrentProcess = 1,
|
||||
FspSrv_Cmd_OpenDataStorageByCurrentProcess = 200,
|
||||
FspSrv_Cmd_OpenDataStorageByDataId = 202,
|
||||
enum class FspSrvCmd {
|
||||
SetCurrentProcess = 1,
|
||||
OpenDataStorageByCurrentProcess = 200,
|
||||
OpenDataStorageByDataId = 202,
|
||||
};
|
||||
|
||||
class FsMitMService : public IMitMServiceObject {
|
||||
@ -43,4 +43,4 @@ class FsMitMService : public IMitMServiceObject {
|
||||
/* Overridden commands. */
|
||||
std::tuple<Result, OutSession<IStorageInterface>> open_data_storage_by_current_process();
|
||||
std::tuple<Result, OutSession<IStorageInterface>> open_data_storage_by_data_id(u64 storage_id, u64 data_id);
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user