stratosphere: all in on enum class CommandId
This commit is contained in:
@@ -20,15 +20,14 @@
|
||||
|
||||
#include "../utils.hpp"
|
||||
|
||||
enum BpcAtmosphereCmd : u32 {
|
||||
BpcAtmosphereCmd_RebootToFatalError = 65000,
|
||||
};
|
||||
|
||||
class BpcAtmosphereService : public IServiceObject {
|
||||
enum class CommandId {
|
||||
RebootToFatalError = 65000,
|
||||
};
|
||||
private:
|
||||
Result RebootToFatalError(InBuffer<AtmosphereFatalErrorContext> ctx);
|
||||
public:
|
||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||
MakeServiceCommandMeta<BpcAtmosphereCmd_RebootToFatalError, &BpcAtmosphereService::RebootToFatalError>(),
|
||||
MAKE_SERVICE_COMMAND_META(BpcAtmosphereService, RebootToFatalError),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
|
||||
#include "../utils.hpp"
|
||||
|
||||
enum BpcCmd : u32 {
|
||||
BpcCmd_ShutdownSystem = 0,
|
||||
BpcCmd_RebootSystem = 1,
|
||||
};
|
||||
|
||||
class BpcMitmService : public IMitmServiceObject {
|
||||
private:
|
||||
enum class CommandId {
|
||||
ShutdownSystem = 0,
|
||||
RebootSystem = 1,
|
||||
};
|
||||
public:
|
||||
BpcMitmService(std::shared_ptr<Service> s, u64 pid) : IMitmServiceObject(s, pid) {
|
||||
/* ... */
|
||||
@@ -48,7 +48,7 @@ class BpcMitmService : public IMitmServiceObject {
|
||||
Result RebootSystem();
|
||||
public:
|
||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||
MakeServiceCommandMeta<BpcCmd_ShutdownSystem, &BpcMitmService::ShutdownSystem>(),
|
||||
MakeServiceCommandMeta<BpcCmd_RebootSystem, &BpcMitmService::RebootSystem>(),
|
||||
MAKE_SERVICE_COMMAND_META(BpcMitmService, ShutdownSystem),
|
||||
MAKE_SERVICE_COMMAND_META(BpcMitmService, RebootSystem),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -18,11 +18,6 @@
|
||||
#include <switch.h>
|
||||
#include <stratosphere.hpp>
|
||||
|
||||
enum FsIDirectoryCmd : u32 {
|
||||
FsIDirectoryCmd_Read = 0,
|
||||
FsIDirectoryCmd_GetEntryCount = 1,
|
||||
};
|
||||
|
||||
class IDirectory {
|
||||
public:
|
||||
virtual ~IDirectory() {}
|
||||
@@ -56,6 +51,11 @@ class IDirectory {
|
||||
};
|
||||
|
||||
class IDirectoryInterface : public IServiceObject {
|
||||
private:
|
||||
enum class CommandId {
|
||||
Read = 0,
|
||||
GetEntryCount = 1,
|
||||
};
|
||||
private:
|
||||
std::unique_ptr<IDirectory> base_dir;
|
||||
public:
|
||||
@@ -77,8 +77,8 @@ class IDirectoryInterface : public IServiceObject {
|
||||
public:
|
||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||
/* 1.0.0- */
|
||||
MakeServiceCommandMeta<FsIDirectoryCmd_Read, &IDirectoryInterface::Read>(),
|
||||
MakeServiceCommandMeta<FsIDirectoryCmd_GetEntryCount, &IDirectoryInterface::GetEntryCount>(),
|
||||
MAKE_SERVICE_COMMAND_META(IDirectoryInterface, Read),
|
||||
MAKE_SERVICE_COMMAND_META(IDirectoryInterface, GetEntryCount),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -20,15 +20,6 @@
|
||||
|
||||
#include "fs_shim.h"
|
||||
|
||||
enum FsIFileCmd : u32 {
|
||||
FsIFileCmd_Read = 0,
|
||||
FsIFileCmd_Write = 1,
|
||||
FsIFileCmd_Flush = 2,
|
||||
FsIFileCmd_SetSize = 3,
|
||||
FsIFileCmd_GetSize = 4,
|
||||
FsIFileCmd_OperateRange = 5,
|
||||
};
|
||||
|
||||
class IFile {
|
||||
public:
|
||||
virtual ~IFile() {}
|
||||
@@ -106,6 +97,15 @@ class IFile {
|
||||
};
|
||||
|
||||
class IFileInterface : public IServiceObject {
|
||||
private:
|
||||
enum class CommandId {
|
||||
Read = 0,
|
||||
Write = 1,
|
||||
Flush = 2,
|
||||
SetSize = 3,
|
||||
GetSize = 4,
|
||||
OperateRange = 5,
|
||||
};
|
||||
private:
|
||||
std::unique_ptr<IFile> base_file;
|
||||
public:
|
||||
@@ -139,14 +139,14 @@ class IFileInterface : public IServiceObject {
|
||||
public:
|
||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||
/* 1.0.0- */
|
||||
MakeServiceCommandMeta<FsIFileCmd_Read, &IFileInterface::Read>(),
|
||||
MakeServiceCommandMeta<FsIFileCmd_Write, &IFileInterface::Write>(),
|
||||
MakeServiceCommandMeta<FsIFileCmd_Flush, &IFileInterface::Flush>(),
|
||||
MakeServiceCommandMeta<FsIFileCmd_SetSize, &IFileInterface::SetSize>(),
|
||||
MakeServiceCommandMeta<FsIFileCmd_GetSize, &IFileInterface::GetSize>(),
|
||||
MAKE_SERVICE_COMMAND_META(IFileInterface, Read),
|
||||
MAKE_SERVICE_COMMAND_META(IFileInterface, Write),
|
||||
MAKE_SERVICE_COMMAND_META(IFileInterface, Flush),
|
||||
MAKE_SERVICE_COMMAND_META(IFileInterface, SetSize),
|
||||
MAKE_SERVICE_COMMAND_META(IFileInterface, GetSize),
|
||||
|
||||
/* 4.0.0- */
|
||||
MakeServiceCommandMeta<FsIFileCmd_OperateRange, &IFileInterface::OperateRange, FirmwareVersion_400>(),
|
||||
MAKE_SERVICE_COMMAND_META(IFileInterface, OperateRange, FirmwareVersion_400),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -26,30 +26,6 @@
|
||||
#include "fs_ifile.hpp"
|
||||
#include "fs_idirectory.hpp"
|
||||
|
||||
enum FsIFileSystemCmd : u32 {
|
||||
/* 1.0.0+ */
|
||||
FsIFileSystemCmd_CreateFile = 0,
|
||||
FsIFileSystemCmd_DeleteFile = 1,
|
||||
FsIFileSystemCmd_CreateDirectory = 2,
|
||||
FsIFileSystemCmd_DeleteDirectory = 3,
|
||||
FsIFileSystemCmd_DeleteDirectoryRecursively = 4,
|
||||
FsIFileSystemCmd_RenameFile = 5,
|
||||
FsIFileSystemCmd_RenameDirectory = 6,
|
||||
FsIFileSystemCmd_GetEntryType = 7,
|
||||
FsIFileSystemCmd_OpenFile = 8,
|
||||
FsIFileSystemCmd_OpenDirectory = 9,
|
||||
FsIFileSystemCmd_Commit = 10,
|
||||
FsIFileSystemCmd_GetFreeSpaceSize = 11,
|
||||
FsIFileSystemCmd_GetTotalSpaceSize = 12,
|
||||
|
||||
/* 3.0.0+ */
|
||||
FsIFileSystemCmd_CleanDirectoryRecursively = 13,
|
||||
FsIFileSystemCmd_GetFileTimeStampRaw = 14,
|
||||
|
||||
/* 4.0.0+ */
|
||||
FsIFileSystemCmd_QueryEntry = 15,
|
||||
};
|
||||
|
||||
class IFile;
|
||||
class IDirectory;
|
||||
|
||||
@@ -197,6 +173,30 @@ class IFileSystem {
|
||||
};
|
||||
|
||||
class IFileSystemInterface : public IServiceObject {
|
||||
private:
|
||||
enum class CommandId {
|
||||
/* 1.0.0+ */
|
||||
CreateFile = 0,
|
||||
DeleteFile = 1,
|
||||
CreateDirectory = 2,
|
||||
DeleteDirectory = 3,
|
||||
DeleteDirectoryRecursively = 4,
|
||||
RenameFile = 5,
|
||||
RenameDirectory = 6,
|
||||
GetEntryType = 7,
|
||||
OpenFile = 8,
|
||||
OpenDirectory = 9,
|
||||
Commit = 10,
|
||||
GetFreeSpaceSize = 11,
|
||||
GetTotalSpaceSize = 12,
|
||||
|
||||
/* 3.0.0+ */
|
||||
CleanDirectoryRecursively = 13,
|
||||
GetFileTimeStampRaw = 14,
|
||||
|
||||
/* 4.0.0+ */
|
||||
QueryEntry = 15,
|
||||
};
|
||||
private:
|
||||
std::unique_ptr<IFileSystem> unique_fs;
|
||||
std::shared_ptr<IFileSystem> shared_fs;
|
||||
@@ -342,26 +342,26 @@ class IFileSystemInterface : public IServiceObject {
|
||||
public:
|
||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||
/* 1.0.0- */
|
||||
MakeServiceCommandMeta<FsIFileSystemCmd_CreateFile, &IFileSystemInterface::CreateFile>(),
|
||||
MakeServiceCommandMeta<FsIFileSystemCmd_DeleteFile, &IFileSystemInterface::DeleteFile>(),
|
||||
MakeServiceCommandMeta<FsIFileSystemCmd_CreateDirectory, &IFileSystemInterface::CreateDirectory>(),
|
||||
MakeServiceCommandMeta<FsIFileSystemCmd_DeleteDirectory, &IFileSystemInterface::DeleteDirectory>(),
|
||||
MakeServiceCommandMeta<FsIFileSystemCmd_DeleteDirectoryRecursively, &IFileSystemInterface::DeleteDirectoryRecursively>(),
|
||||
MakeServiceCommandMeta<FsIFileSystemCmd_RenameFile, &IFileSystemInterface::RenameFile>(),
|
||||
MakeServiceCommandMeta<FsIFileSystemCmd_RenameDirectory, &IFileSystemInterface::RenameDirectory>(),
|
||||
MakeServiceCommandMeta<FsIFileSystemCmd_GetEntryType, &IFileSystemInterface::GetEntryType>(),
|
||||
MakeServiceCommandMeta<FsIFileSystemCmd_OpenFile, &IFileSystemInterface::OpenFile>(),
|
||||
MakeServiceCommandMeta<FsIFileSystemCmd_OpenDirectory, &IFileSystemInterface::OpenDirectory>(),
|
||||
MakeServiceCommandMeta<FsIFileSystemCmd_Commit, &IFileSystemInterface::Commit>(),
|
||||
MakeServiceCommandMeta<FsIFileSystemCmd_GetFreeSpaceSize, &IFileSystemInterface::GetFreeSpaceSize>(),
|
||||
MakeServiceCommandMeta<FsIFileSystemCmd_GetTotalSpaceSize, &IFileSystemInterface::GetTotalSpaceSize>(),
|
||||
MAKE_SERVICE_COMMAND_META(IFileSystemInterface, CreateFile),
|
||||
MAKE_SERVICE_COMMAND_META(IFileSystemInterface, DeleteFile),
|
||||
MAKE_SERVICE_COMMAND_META(IFileSystemInterface, CreateDirectory),
|
||||
MAKE_SERVICE_COMMAND_META(IFileSystemInterface, DeleteDirectory),
|
||||
MAKE_SERVICE_COMMAND_META(IFileSystemInterface, DeleteDirectoryRecursively),
|
||||
MAKE_SERVICE_COMMAND_META(IFileSystemInterface, RenameFile),
|
||||
MAKE_SERVICE_COMMAND_META(IFileSystemInterface, RenameDirectory),
|
||||
MAKE_SERVICE_COMMAND_META(IFileSystemInterface, GetEntryType),
|
||||
MAKE_SERVICE_COMMAND_META(IFileSystemInterface, OpenFile),
|
||||
MAKE_SERVICE_COMMAND_META(IFileSystemInterface, OpenDirectory),
|
||||
MAKE_SERVICE_COMMAND_META(IFileSystemInterface, Commit),
|
||||
MAKE_SERVICE_COMMAND_META(IFileSystemInterface, GetFreeSpaceSize),
|
||||
MAKE_SERVICE_COMMAND_META(IFileSystemInterface, GetTotalSpaceSize),
|
||||
|
||||
/* 3.0.0- */
|
||||
MakeServiceCommandMeta<FsIFileSystemCmd_CleanDirectoryRecursively, &IFileSystemInterface::CleanDirectoryRecursively, FirmwareVersion_300>(),
|
||||
MakeServiceCommandMeta<FsIFileSystemCmd_GetFileTimeStampRaw, &IFileSystemInterface::GetFileTimeStampRaw, FirmwareVersion_300>(),
|
||||
MAKE_SERVICE_COMMAND_META(IFileSystemInterface, CleanDirectoryRecursively, FirmwareVersion_300),
|
||||
MAKE_SERVICE_COMMAND_META(IFileSystemInterface, GetFileTimeStampRaw, FirmwareVersion_300),
|
||||
|
||||
/* 4.0.0- */
|
||||
MakeServiceCommandMeta<FsIFileSystemCmd_QueryEntry, &IFileSystemInterface::QueryEntry, FirmwareVersion_400>(),
|
||||
MAKE_SERVICE_COMMAND_META(IFileSystemInterface, QueryEntry, FirmwareVersion_400),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -21,15 +21,6 @@
|
||||
|
||||
#include "../debug.hpp"
|
||||
|
||||
enum FsIStorageCmd : u32 {
|
||||
FsIStorageCmd_Read = 0,
|
||||
FsIStorageCmd_Write = 1,
|
||||
FsIStorageCmd_Flush = 2,
|
||||
FsIStorageCmd_SetSize = 3,
|
||||
FsIStorageCmd_GetSize = 4,
|
||||
FsIStorageCmd_OperateRange = 5,
|
||||
};
|
||||
|
||||
class IStorage {
|
||||
public:
|
||||
virtual ~IStorage();
|
||||
@@ -47,6 +38,15 @@ class IStorage {
|
||||
};
|
||||
|
||||
class IStorageInterface : public IServiceObject {
|
||||
private:
|
||||
enum class CommandId {
|
||||
Read = 0,
|
||||
Write = 1,
|
||||
Flush = 2,
|
||||
SetSize = 3,
|
||||
GetSize = 4,
|
||||
OperateRange = 5,
|
||||
};
|
||||
private:
|
||||
IStorage *base_storage;
|
||||
public:
|
||||
@@ -81,14 +81,14 @@ class IStorageInterface : public IServiceObject {
|
||||
public:
|
||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||
/* 1.0.0- */
|
||||
MakeServiceCommandMeta<FsIStorageCmd_Read, &IStorageInterface::Read>(),
|
||||
MakeServiceCommandMeta<FsIStorageCmd_Write, &IStorageInterface::Write>(),
|
||||
MakeServiceCommandMeta<FsIStorageCmd_Flush, &IStorageInterface::Flush>(),
|
||||
MakeServiceCommandMeta<FsIStorageCmd_SetSize, &IStorageInterface::SetSize>(),
|
||||
MakeServiceCommandMeta<FsIStorageCmd_GetSize, &IStorageInterface::GetSize>(),
|
||||
MAKE_SERVICE_COMMAND_META(IStorageInterface, Read),
|
||||
MAKE_SERVICE_COMMAND_META(IStorageInterface, Write),
|
||||
MAKE_SERVICE_COMMAND_META(IStorageInterface, Flush),
|
||||
MAKE_SERVICE_COMMAND_META(IStorageInterface, SetSize),
|
||||
MAKE_SERVICE_COMMAND_META(IStorageInterface, GetSize),
|
||||
|
||||
/* 4.0.0- */
|
||||
MakeServiceCommandMeta<FsIStorageCmd_OperateRange, &IStorageInterface::OperateRange, FirmwareVersion_400>(),
|
||||
MAKE_SERVICE_COMMAND_META(IStorageInterface, OperateRange, FirmwareVersion_400),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -69,8 +69,8 @@ static void StorageCacheSetEntry(u64 title_id, std::shared_ptr<IStorageInterface
|
||||
|
||||
void FsMitmService::PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx) {
|
||||
auto this_ptr = static_cast<FsMitmService *>(obj);
|
||||
switch ((FspSrvCmd)ctx->cmd_id) {
|
||||
case FspSrvCmd_SetCurrentProcess:
|
||||
switch (static_cast<CommandId>(ctx->cmd_id)) {
|
||||
case CommandId::SetCurrentProcess:
|
||||
if (R_SUCCEEDED(ctx->rc)) {
|
||||
this_ptr->has_initialized = true;
|
||||
this_ptr->process_id = ctx->request.Pid;
|
||||
|
||||
@@ -21,24 +21,23 @@
|
||||
#include "fs_ifilesystem.hpp"
|
||||
#include "../utils.hpp"
|
||||
|
||||
enum FspSrvCmd : u32 {
|
||||
FspSrvCmd_OpenFileSystemDeprecated = 0,
|
||||
|
||||
FspSrvCmd_SetCurrentProcess = 1,
|
||||
|
||||
FspSrvCmd_OpenFileSystemWithPatch = 7,
|
||||
FspSrvCmd_OpenFileSystemWithId = 8,
|
||||
|
||||
FspSrvCmd_OpenSdCardFileSystem = 18,
|
||||
|
||||
FspSrvCmd_OpenSaveDataFileSystem = 51,
|
||||
|
||||
FspSrvCmd_OpenBisStorage = 12,
|
||||
FspSrvCmd_OpenDataStorageByCurrentProcess = 200,
|
||||
FspSrvCmd_OpenDataStorageByDataId = 202,
|
||||
};
|
||||
|
||||
class FsMitmService : public IMitmServiceObject {
|
||||
private:
|
||||
enum class CommandId {
|
||||
OpenFileSystemDeprecated = 0,
|
||||
|
||||
SetCurrentProcess = 1,
|
||||
OpenFileSystemWithPatch = 7,
|
||||
OpenFileSystemWithId = 8,
|
||||
|
||||
OpenSdCardFileSystem = 18,
|
||||
|
||||
OpenSaveDataFileSystem = 51,
|
||||
|
||||
OpenBisStorage = 12,
|
||||
OpenDataStorageByCurrentProcess = 200,
|
||||
OpenDataStorageByDataId = 202,
|
||||
};
|
||||
private:
|
||||
static constexpr const char *AtmosphereHblWebContentDir = "/atmosphere/hbl_html";
|
||||
private:
|
||||
@@ -84,13 +83,13 @@ class FsMitmService : public IMitmServiceObject {
|
||||
Result OpenDataStorageByDataId(Out<std::shared_ptr<IStorageInterface>> out, u64 data_id, u8 storage_id);
|
||||
public:
|
||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||
/* TODO MakeServiceCommandMeta<FspSrvCmd_OpenFileSystemDeprecated, &FsMitmService::OpenFileSystemDeprecated>(), */
|
||||
MakeServiceCommandMeta<FspSrvCmd_OpenFileSystemWithPatch, &FsMitmService::OpenFileSystemWithPatch, FirmwareVersion_200>(),
|
||||
MakeServiceCommandMeta<FspSrvCmd_OpenFileSystemWithId, &FsMitmService::OpenFileSystemWithId, FirmwareVersion_200>(),
|
||||
MakeServiceCommandMeta<FspSrvCmd_OpenSdCardFileSystem, &FsMitmService::OpenSdCardFileSystem>(),
|
||||
MakeServiceCommandMeta<FspSrvCmd_OpenSaveDataFileSystem, &FsMitmService::OpenSaveDataFileSystem>(),
|
||||
MakeServiceCommandMeta<FspSrvCmd_OpenBisStorage, &FsMitmService::OpenBisStorage>(),
|
||||
MakeServiceCommandMeta<FspSrvCmd_OpenDataStorageByCurrentProcess, &FsMitmService::OpenDataStorageByCurrentProcess>(),
|
||||
MakeServiceCommandMeta<FspSrvCmd_OpenDataStorageByDataId, &FsMitmService::OpenDataStorageByDataId>(),
|
||||
/* TODO MAKE_SERVICE_COMMAND_META(FsMitmService, OpenFileSystemDeprecated), */
|
||||
MAKE_SERVICE_COMMAND_META(FsMitmService, OpenFileSystemWithPatch, FirmwareVersion_200),
|
||||
MAKE_SERVICE_COMMAND_META(FsMitmService, OpenFileSystemWithId, FirmwareVersion_200),
|
||||
MAKE_SERVICE_COMMAND_META(FsMitmService, OpenSdCardFileSystem),
|
||||
MAKE_SERVICE_COMMAND_META(FsMitmService, OpenSaveDataFileSystem),
|
||||
MAKE_SERVICE_COMMAND_META(FsMitmService, OpenBisStorage),
|
||||
MAKE_SERVICE_COMMAND_META(FsMitmService, OpenDataStorageByCurrentProcess),
|
||||
MAKE_SERVICE_COMMAND_META(FsMitmService, OpenDataStorageByDataId),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -20,9 +20,13 @@
|
||||
|
||||
#include "../utils.hpp"
|
||||
|
||||
#include "nsmitm_service_common.hpp"
|
||||
|
||||
class NsAmMitmService : public IMitmServiceObject {
|
||||
private:
|
||||
enum class CommandId {
|
||||
GetApplicationContentPath = 21,
|
||||
ResolveApplicationContentPath = 23,
|
||||
GetRunningApplicationProgramId = 92,
|
||||
};
|
||||
public:
|
||||
NsAmMitmService(std::shared_ptr<Service> s, u64 pid) : IMitmServiceObject(s, pid) {
|
||||
/* ... */
|
||||
@@ -44,8 +48,8 @@ class NsAmMitmService : public IMitmServiceObject {
|
||||
Result GetRunningApplicationProgramId(Out<u64> out_tid, u64 app_id);
|
||||
public:
|
||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||
MakeServiceCommandMeta<NsSrvCmd_GetApplicationContentPath, &NsAmMitmService::GetApplicationContentPath>(),
|
||||
MakeServiceCommandMeta<NsSrvCmd_ResolveApplicationContentPath, &NsAmMitmService::ResolveApplicationContentPath>(),
|
||||
MakeServiceCommandMeta<NsSrvCmd_GetRunningApplicationProgramId, &NsAmMitmService::GetRunningApplicationProgramId, FirmwareVersion_600>(),
|
||||
MAKE_SERVICE_COMMAND_META(NsAmMitmService, GetApplicationContentPath),
|
||||
MAKE_SERVICE_COMMAND_META(NsAmMitmService, ResolveApplicationContentPath),
|
||||
MAKE_SERVICE_COMMAND_META(NsAmMitmService, GetRunningApplicationProgramId, FirmwareVersion_600),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <switch.h>
|
||||
#include <stratosphere.hpp>
|
||||
|
||||
#include "../utils.hpp"
|
||||
|
||||
enum NsGetterCmd : u32 {
|
||||
NsGetterCmd_GetDocumentInterface = 7999,
|
||||
};
|
||||
|
||||
enum NsSrvCmd : u32 {
|
||||
NsSrvCmd_GetApplicationContentPath = 21,
|
||||
NsSrvCmd_ResolveApplicationContentPath = 23,
|
||||
NsSrvCmd_GetRunningApplicationProgramId = 92,
|
||||
};
|
||||
@@ -20,10 +20,15 @@
|
||||
|
||||
#include "../utils.hpp"
|
||||
|
||||
#include "nsmitm_service_common.hpp"
|
||||
#include "ns_shim.h"
|
||||
|
||||
class NsDocumentService : public IServiceObject {
|
||||
private:
|
||||
enum class CommandId {
|
||||
GetApplicationContentPath = 21,
|
||||
ResolveApplicationContentPath = 23,
|
||||
GetRunningApplicationProgramId = 92,
|
||||
};
|
||||
private:
|
||||
u64 title_id;
|
||||
std::unique_ptr<NsDocumentInterface> srv;
|
||||
@@ -50,13 +55,17 @@ class NsDocumentService : public IServiceObject {
|
||||
Result GetRunningApplicationProgramId(Out<u64> out_tid, u64 app_id);
|
||||
public:
|
||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||
MakeServiceCommandMeta<NsSrvCmd_GetApplicationContentPath, &NsDocumentService::GetApplicationContentPath>(),
|
||||
MakeServiceCommandMeta<NsSrvCmd_ResolveApplicationContentPath, &NsDocumentService::ResolveApplicationContentPath>(),
|
||||
MakeServiceCommandMeta<NsSrvCmd_GetRunningApplicationProgramId, &NsDocumentService::GetRunningApplicationProgramId, FirmwareVersion_600>(),
|
||||
MAKE_SERVICE_COMMAND_META(NsDocumentService, GetApplicationContentPath),
|
||||
MAKE_SERVICE_COMMAND_META(NsDocumentService, ResolveApplicationContentPath),
|
||||
MAKE_SERVICE_COMMAND_META(NsDocumentService, GetRunningApplicationProgramId, FirmwareVersion_600),
|
||||
};
|
||||
};
|
||||
|
||||
class NsWebMitmService : public IMitmServiceObject {
|
||||
private:
|
||||
enum class CommandId {
|
||||
GetDocumentInterface = 7999,
|
||||
};
|
||||
public:
|
||||
NsWebMitmService(std::shared_ptr<Service> s, u64 pid) : IMitmServiceObject(s, pid) {
|
||||
/* ... */
|
||||
@@ -76,6 +85,6 @@ class NsWebMitmService : public IMitmServiceObject {
|
||||
Result GetDocumentInterface(Out<std::shared_ptr<NsDocumentService>> out_intf);
|
||||
public:
|
||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||
MakeServiceCommandMeta<NsGetterCmd_GetDocumentInterface, &NsWebMitmService::GetDocumentInterface, FirmwareVersion_300>(),
|
||||
MAKE_SERVICE_COMMAND_META(NsWebMitmService, GetDocumentInterface, FirmwareVersion_300),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -20,16 +20,16 @@
|
||||
|
||||
#include "../utils.hpp"
|
||||
|
||||
enum SetCmd : u32 {
|
||||
SetCmd_GetLanguageCode = 0,
|
||||
SetCmd_GetRegionCode = 4,
|
||||
|
||||
/* Commands for which set:sys *must* act as a passthrough. */
|
||||
/* TODO: Solve the relevant IPC detection problem. */
|
||||
SetCmd_GetAvailableLanguageCodes = 1,
|
||||
};
|
||||
|
||||
class SetMitmService : public IMitmServiceObject {
|
||||
private:
|
||||
enum class CommandId {
|
||||
GetLanguageCode = 0,
|
||||
GetRegionCode = 4,
|
||||
|
||||
/* Commands for which set:sys *must* act as a passthrough. */
|
||||
/* TODO: Solve the relevant IPC detection problem. */
|
||||
GetAvailableLanguageCodes = 1,
|
||||
};
|
||||
private:
|
||||
HosMutex lock;
|
||||
OverrideLocale locale;
|
||||
@@ -60,9 +60,9 @@ class SetMitmService : public IMitmServiceObject {
|
||||
Result GetAvailableLanguageCodes(OutPointerWithClientSize<u64> out_language_codes, Out<s32> out_count);
|
||||
public:
|
||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||
MakeServiceCommandMeta<SetCmd_GetLanguageCode, &SetMitmService::GetLanguageCode>(),
|
||||
MakeServiceCommandMeta<SetCmd_GetRegionCode, &SetMitmService::GetRegionCode>(),
|
||||
MAKE_SERVICE_COMMAND_META(SetMitmService, GetLanguageCode),
|
||||
MAKE_SERVICE_COMMAND_META(SetMitmService, GetRegionCode),
|
||||
|
||||
MakeServiceCommandMeta<SetCmd_GetAvailableLanguageCodes, &SetMitmService::GetAvailableLanguageCodes>(),
|
||||
MAKE_SERVICE_COMMAND_META(SetMitmService, GetAvailableLanguageCodes),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -20,18 +20,18 @@
|
||||
|
||||
#include "setsys_shim.h"
|
||||
|
||||
enum SetSysCmd : u32 {
|
||||
SetSysCmd_GetFirmwareVersion = 3,
|
||||
SetSysCmd_GetFirmwareVersion2 = 4,
|
||||
SetSysCmd_GetSettingsItemValueSize = 37,
|
||||
SetSysCmd_GetSettingsItemValue = 38,
|
||||
|
||||
/* Commands for which set:sys *must* act as a passthrough. */
|
||||
/* TODO: Solve the relevant IPC detection problem. */
|
||||
SetSysCmd_GetEdid = 41,
|
||||
};
|
||||
|
||||
class SetSysMitmService : public IMitmServiceObject {
|
||||
private:
|
||||
enum class CommandId {
|
||||
GetFirmwareVersion = 3,
|
||||
GetFirmwareVersion2 = 4,
|
||||
GetSettingsItemValueSize = 37,
|
||||
GetSettingsItemValue = 38,
|
||||
|
||||
/* Commands for which set:sys *must* act as a passthrough. */
|
||||
/* TODO: Solve the relevant IPC detection problem. */
|
||||
GetEdid = 41,
|
||||
};
|
||||
public:
|
||||
SetSysMitmService(std::shared_ptr<Service> s, u64 pid) : IMitmServiceObject(s, pid) {
|
||||
/* ... */
|
||||
@@ -55,11 +55,11 @@ class SetSysMitmService : public IMitmServiceObject {
|
||||
Result GetEdid(OutPointerWithServerSize<SetSysEdid, 0x1> out);
|
||||
public:
|
||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||
MakeServiceCommandMeta<SetSysCmd_GetFirmwareVersion, &SetSysMitmService::GetFirmwareVersion>(),
|
||||
MakeServiceCommandMeta<SetSysCmd_GetFirmwareVersion2, &SetSysMitmService::GetFirmwareVersion2>(),
|
||||
MakeServiceCommandMeta<SetSysCmd_GetSettingsItemValueSize, &SetSysMitmService::GetSettingsItemValueSize>(),
|
||||
MakeServiceCommandMeta<SetSysCmd_GetSettingsItemValue, &SetSysMitmService::GetSettingsItemValue>(),
|
||||
MAKE_SERVICE_COMMAND_META(SetSysMitmService, GetFirmwareVersion),
|
||||
MAKE_SERVICE_COMMAND_META(SetSysMitmService, GetFirmwareVersion2),
|
||||
MAKE_SERVICE_COMMAND_META(SetSysMitmService, GetSettingsItemValueSize),
|
||||
MAKE_SERVICE_COMMAND_META(SetSysMitmService, GetSettingsItemValue),
|
||||
|
||||
MakeServiceCommandMeta<SetSysCmd_GetEdid, &SetSysMitmService::GetEdid>(),
|
||||
MAKE_SERVICE_COMMAND_META(SetSysMitmService, GetEdid),
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user