1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-28 05:06:08 +00:00

stratosphere: remove trailing whitespace

This commit is contained in:
Michael Scire 2019-06-20 13:00:32 -07:00
parent 8d9336f561
commit d3d6c552b7
32 changed files with 98 additions and 98 deletions

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
enum MitmModuleId : u32 { enum MitmModuleId : u32 {
@ -21,7 +21,7 @@ enum MitmModuleId : u32 {
MitmModuleId_SetMitm = 1, MitmModuleId_SetMitm = 1,
MitmModuleId_BpcMitm = 2, MitmModuleId_BpcMitm = 2,
MitmModuleId_NsMitm = 3, MitmModuleId_NsMitm = 3,
/* Always keep this at the end. */ /* Always keep this at the end. */
MitmModuleId_Count, MitmModuleId_Count,
}; };

View file

@ -24,9 +24,9 @@ Result BpcAtmosphereService::RebootToFatalError(InBuffer<AtmosphereFatalErrorCon
if (ctx.buffer == nullptr || ctx.num_elements != 1) { if (ctx.buffer == nullptr || ctx.num_elements != 1) {
return ResultKernelConnectionClosed; return ResultKernelConnectionClosed;
} }
/* Reboot to fusee with the input context. */ /* Reboot to fusee with the input context. */
BpcRebootManager::RebootForFatalError(ctx.buffer); BpcRebootManager::RebootForFatalError(ctx.buffer);
return ResultSuccess; return ResultSuccess;
} }

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>
@ -30,7 +30,7 @@ class BpcMitmService : public IMitmServiceObject {
BpcMitmService(std::shared_ptr<Service> s, u64 pid) : IMitmServiceObject(s, pid) { BpcMitmService(std::shared_ptr<Service> s, u64 pid) : IMitmServiceObject(s, pid) {
/* ... */ /* ... */
} }
static bool ShouldMitm(u64 pid, u64 tid) { static bool ShouldMitm(u64 pid, u64 tid) {
/* We will mitm: /* We will mitm:
* - am, to intercept the Reboot/Power buttons in the overlay menu. * - am, to intercept the Reboot/Power buttons in the overlay menu.
@ -39,9 +39,9 @@ class BpcMitmService : public IMitmServiceObject {
*/ */
return tid == TitleId_Am || tid == TitleId_Fatal || TitleIdIsApplication(tid) || Utils::IsHblTid(tid); return tid == TitleId_Am || tid == TitleId_Fatal || TitleIdIsApplication(tid) || Utils::IsHblTid(tid);
} }
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx); static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
protected: protected:
/* Overridden commands. */ /* Overridden commands. */
Result ShutdownSystem(); Result ShutdownSystem();

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <cstdlib> #include <cstdlib>
#include <cstdint> #include <cstdint>
#include <cstring> #include <cstring>
@ -33,13 +33,13 @@
void BpcMitmMain(void *arg) { void BpcMitmMain(void *arg) {
/* Wait for initialization to occur */ /* Wait for initialization to occur */
Utils::WaitSdInitialized(); Utils::WaitSdInitialized();
/* Load a payload off of the SD */ /* Load a payload off of the SD */
BpcRebootManager::Initialize(); BpcRebootManager::Initialize();
/* Create server manager */ /* Create server manager */
auto server_manager = new WaitableManager(2); auto server_manager = new WaitableManager(2);
/* Create bpc mitm. */ /* Create bpc mitm. */
const char *service_name = "bpc"; const char *service_name = "bpc";
if (GetRuntimeFirmwareVersion() < FirmwareVersion_200) { if (GetRuntimeFirmwareVersion() < FirmwareVersion_200) {
@ -53,8 +53,8 @@ void BpcMitmMain(void *arg) {
/* Loop forever, servicing our services. */ /* Loop forever, servicing our services. */
server_manager->Process(); server_manager->Process();
delete server_manager; delete server_manager;
} }

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>
#include <strings.h> #include <strings.h>
@ -33,16 +33,16 @@ void BpcRebootManager::Initialize() {
return; return;
} }
ON_SCOPE_EXIT { fsFileClose(&payload_file); }; ON_SCOPE_EXIT { fsFileClose(&payload_file); };
/* Clear payload buffer */ /* Clear payload buffer */
std::memset(g_reboot_payload, 0xFF, sizeof(g_reboot_payload)); std::memset(g_reboot_payload, 0xFF, sizeof(g_reboot_payload));
/* Read payload file. */ /* Read payload file. */
size_t actual_size; size_t actual_size;
fsFileRead(&payload_file, 0, g_reboot_payload, IRAM_PAYLOAD_MAX_SIZE, FS_READOPTION_NONE, &actual_size); fsFileRead(&payload_file, 0, g_reboot_payload, IRAM_PAYLOAD_MAX_SIZE, FS_READOPTION_NONE, &actual_size);
g_payload_loaded = true; g_payload_loaded = true;
/* Figure out what kind of reboot we're gonna be doing. */ /* Figure out what kind of reboot we're gonna be doing. */
{ {
char reboot_type[0x40] = {0}; char reboot_type[0x40] = {0};
@ -62,7 +62,7 @@ void BpcRebootManager::Initialize() {
static void ClearIram() { static void ClearIram() {
/* Make page FFs. */ /* Make page FFs. */
memset(g_work_page, 0xFF, sizeof(g_work_page)); memset(g_work_page, 0xFF, sizeof(g_work_page));
/* Overwrite all of IRAM with FFs. */ /* Overwrite all of IRAM with FFs. */
for (size_t ofs = 0; ofs < IRAM_SIZE; ofs += sizeof(g_work_page)) { for (size_t ofs = 0; ofs < IRAM_SIZE; ofs += sizeof(g_work_page)) {
CopyToIram(IRAM_BASE + ofs, g_work_page, sizeof(g_work_page)); CopyToIram(IRAM_BASE + ofs, g_work_page, sizeof(g_work_page));
@ -74,15 +74,15 @@ static void DoRebootToPayload() {
if (!g_payload_loaded) { if (!g_payload_loaded) {
RebootToRcm(); RebootToRcm();
} }
/* Ensure clean IRAM state. */ /* Ensure clean IRAM state. */
ClearIram(); ClearIram();
/* Copy in payload. */ /* Copy in payload. */
for (size_t ofs = 0; ofs < sizeof(g_reboot_payload); ofs += 0x1000) { for (size_t ofs = 0; ofs < sizeof(g_reboot_payload); ofs += 0x1000) {
CopyToIram(IRAM_PAYLOAD_BASE + ofs, &g_reboot_payload[ofs], 0x1000); CopyToIram(IRAM_PAYLOAD_BASE + ofs, &g_reboot_payload[ofs], 0x1000);
} }
RebootToIramPayload(); RebootToIramPayload();
} }
@ -103,16 +103,16 @@ Result BpcRebootManager::PerformReboot() {
void BpcRebootManager::RebootForFatalError(AtmosphereFatalErrorContext *ctx) { void BpcRebootManager::RebootForFatalError(AtmosphereFatalErrorContext *ctx) {
/* Ensure clean IRAM state. */ /* Ensure clean IRAM state. */
ClearIram(); ClearIram();
/* Copy in payload. */ /* Copy in payload. */
for (size_t ofs = 0; ofs < sizeof(g_reboot_payload); ofs += 0x1000) { for (size_t ofs = 0; ofs < sizeof(g_reboot_payload); ofs += 0x1000) {
CopyToIram(IRAM_PAYLOAD_BASE + ofs, &g_reboot_payload[ofs], 0x1000); CopyToIram(IRAM_PAYLOAD_BASE + ofs, &g_reboot_payload[ofs], 0x1000);
} }
memcpy(g_work_page, ctx, sizeof(*ctx)); memcpy(g_work_page, ctx, sizeof(*ctx));
CopyToIram(IRAM_PAYLOAD_BASE + IRAM_PAYLOAD_MAX_SIZE, g_work_page, sizeof(g_work_page)); CopyToIram(IRAM_PAYLOAD_BASE + IRAM_PAYLOAD_MAX_SIZE, g_work_page, sizeof(g_work_page));
/* If we don't actually have a payload loaded, just go to RCM. */ /* If we don't actually have a payload loaded, just go to RCM. */
if (!g_payload_loaded) { if (!g_payload_loaded) {
RebootToRcm(); RebootToRcm();

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>
#include <cstring> #include <cstring>

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
void Reboot(); void Reboot();

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>

View file

@ -15,12 +15,12 @@
*/ */
#pragma once #pragma once
enum OpenMode { enum OpenMode {
OpenMode_Read = (1 << 0), OpenMode_Read = (1 << 0),
OpenMode_Write = (1 << 1), OpenMode_Write = (1 << 1),
OpenMode_Append = (1 << 2), OpenMode_Append = (1 << 2),
OpenMode_ReadWrite = OpenMode_Read | OpenMode_Write, OpenMode_ReadWrite = OpenMode_Read | OpenMode_Write,
OpenMode_All = OpenMode_ReadWrite | OpenMode_Append, OpenMode_All = OpenMode_ReadWrite | OpenMode_Append,
}; };
@ -28,7 +28,7 @@ enum OpenMode {
enum DirectoryOpenMode { enum DirectoryOpenMode {
DirectoryOpenMode_Directories = (1 << 0), DirectoryOpenMode_Directories = (1 << 0),
DirectoryOpenMode_Files = (1 << 1), DirectoryOpenMode_Files = (1 << 1),
DirectoryOpenMode_All = (DirectoryOpenMode_Directories | DirectoryOpenMode_Files), DirectoryOpenMode_All = (DirectoryOpenMode_Directories | DirectoryOpenMode_Files),
}; };

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>
@ -57,7 +57,7 @@ class IStorageInterface : public IServiceObject {
~IStorageInterface() { ~IStorageInterface() {
delete base_storage; delete base_storage;
}; };
private: private:
/* Actual command API. */ /* Actual command API. */
virtual Result Read(OutBuffer<u8, BufferType_Type1> buffer, u64 offset, u64 size) final { virtual Result Read(OutBuffer<u8, BufferType_Type1> buffer, u64 offset, u64 size) final {
@ -86,7 +86,7 @@ class IStorageInterface : public IServiceObject {
MakeServiceCommandMeta<FsIStorageCmd_Flush, &IStorageInterface::Flush>(), MakeServiceCommandMeta<FsIStorageCmd_Flush, &IStorageInterface::Flush>(),
MakeServiceCommandMeta<FsIStorageCmd_SetSize, &IStorageInterface::SetSize>(), MakeServiceCommandMeta<FsIStorageCmd_SetSize, &IStorageInterface::SetSize>(),
MakeServiceCommandMeta<FsIStorageCmd_GetSize, &IStorageInterface::GetSize>(), MakeServiceCommandMeta<FsIStorageCmd_GetSize, &IStorageInterface::GetSize>(),
/* 4.0.0- */ /* 4.0.0- */
MakeServiceCommandMeta<FsIStorageCmd_OperateRange, &IStorageInterface::OperateRange, FirmwareVersion_400>(), MakeServiceCommandMeta<FsIStorageCmd_OperateRange, &IStorageInterface::OperateRange, FirmwareVersion_400>(),
}; };

View file

@ -49,22 +49,22 @@ class FsPathUtils {
public: public:
static Result VerifyPath(const char *path, size_t max_path_len, size_t max_name_len); static Result VerifyPath(const char *path, size_t max_path_len, size_t max_name_len);
static Result ConvertPathForServiceObject(FsPath *out, const char *path); static Result ConvertPathForServiceObject(FsPath *out, const char *path);
static Result IsNormalized(bool *out, const char *path); static Result IsNormalized(bool *out, const char *path);
static Result Normalize(char *out, size_t max_out_size, const char *src, size_t *out_size); static Result Normalize(char *out, size_t max_out_size, const char *src, size_t *out_size);
static bool IsWindowsDriveLetter(const char c) { static bool IsWindowsDriveLetter(const char c) {
return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'); return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
} }
static bool IsCurrentDirectory(const char *path) { static bool IsCurrentDirectory(const char *path) {
return path[0] == '.' && (path[1] == 0 || path[1] == '/'); return path[0] == '.' && (path[1] == 0 || path[1] == '/');
} }
static bool IsParentDirectory(const char *path) { static bool IsParentDirectory(const char *path) {
return path[0] == '.' && path[1] == '.' && (path[2] == 0 || path[2] == '/'); return path[0] == '.' && path[1] == '.' && (path[2] == 0 || path[2] == '/');
} }
static bool IsWindowsAbsolutePath(const char *path) { static bool IsWindowsAbsolutePath(const char *path) {
/* Nintendo uses this in path comparisons... */ /* Nintendo uses this in path comparisons... */
return IsWindowsDriveLetter(path[0]) && path[1] == ':'; return IsWindowsDriveLetter(path[0]) && path[1] == ':';

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <switch.h> #include <switch.h>
#include <string.h> #include <string.h>
#include "fs_shim.h" #include "fs_shim.h"
@ -79,7 +79,7 @@ Result fsOpenDataStorageByCurrentProcessFwd(Service* s, FsStorage* out) {
u64 magic; u64 magic;
u64 result; u64 result;
} *resp; } *resp;
serviceIpcParse(s, &r, sizeof(*resp)); serviceIpcParse(s, &r, sizeof(*resp));
resp = r.Raw; resp = r.Raw;
@ -119,7 +119,7 @@ Result fsOpenDataStorageByDataIdFwd(Service* s, FsStorageId storage_id, u64 data
u64 magic; u64 magic;
u64 result; u64 result;
} *resp; } *resp;
serviceIpcParse(s, &r, sizeof(*resp)); serviceIpcParse(s, &r, sizeof(*resp));
resp = r.Raw; resp = r.Raw;

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>
@ -32,11 +32,11 @@ class LayeredRomFS : public IROStorage {
/* Information about the merged RomFS. */ /* Information about the merged RomFS. */
u64 title_id; u64 title_id;
std::shared_ptr<std::vector<RomFSSourceInfo>> p_source_infos; std::shared_ptr<std::vector<RomFSSourceInfo>> p_source_infos;
public: public:
LayeredRomFS(std::shared_ptr<IROStorage> s_r, std::shared_ptr<IROStorage> f_r, u64 tid); LayeredRomFS(std::shared_ptr<IROStorage> s_r, std::shared_ptr<IROStorage> f_r, u64 tid);
virtual ~LayeredRomFS() = default; virtual ~LayeredRomFS() = default;
virtual Result Read(void *buffer, size_t size, u64 offset) override; virtual Result Read(void *buffer, size_t size, u64 offset) override;
virtual Result GetSize(u64 *out_size) override; virtual Result GetSize(u64 *out_size) override;
virtual Result OperateRange(FsOperationId operation_type, u64 offset, u64 size, FsRangeInfo *out_range_info) override; virtual Result OperateRange(FsOperationId operation_type, u64 offset, u64 size, FsRangeInfo *out_range_info) override;

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <cstdlib> #include <cstdlib>
#include <cstdint> #include <cstdint>
#include <cstring> #include <cstring>
@ -35,16 +35,16 @@ struct FsMitmManagerOptions {
}; };
using FsMitmManager = WaitableManager<FsMitmManagerOptions>; using FsMitmManager = WaitableManager<FsMitmManagerOptions>;
void FsMitmMain(void *arg) { void FsMitmMain(void *arg) {
/* Create server manager. */ /* Create server manager. */
auto server_manager = new FsMitmManager(5); auto server_manager = new FsMitmManager(5);
/* Create fsp-srv mitm. */ /* Create fsp-srv mitm. */
AddMitmServerToManager<FsMitmService>(server_manager, "fsp-srv", 61); AddMitmServerToManager<FsMitmService>(server_manager, "fsp-srv", 61);
/* Loop forever, servicing our services. */ /* Loop forever, servicing our services. */
server_manager->Process(); server_manager->Process();
delete server_manager; delete server_manager;
} }

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <cstdlib> #include <cstdlib>
#include <cstdint> #include <cstdint>
#include <cstring> #include <cstring>

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#include <cstdlib> #include <cstdlib>
#include <switch.h> #include <switch.h>
@ -67,7 +67,7 @@ struct RomFSSourceInfo {
RomFSMetaDataSourceInfo metadata_source_info; RomFSMetaDataSourceInfo metadata_source_info;
}; };
RomFSDataSource type; RomFSDataSource type;
RomFSSourceInfo(u64 v_o, u64 s, u64 offset, RomFSDataSource t) : virtual_offset(v_o), size(s), type(t) { RomFSSourceInfo(u64 v_o, u64 s, u64 offset, RomFSDataSource t) : virtual_offset(v_o), size(s), type(t) {
switch (this->type) { switch (this->type) {
case RomFSDataSource::BaseRomFS: case RomFSDataSource::BaseRomFS:
@ -85,7 +85,7 @@ struct RomFSSourceInfo {
break; break;
} }
} }
RomFSSourceInfo(u64 v_o, u64 s, const void *arg, RomFSDataSource t) : virtual_offset(v_o), size(s), type(t) { RomFSSourceInfo(u64 v_o, u64 s, const void *arg, RomFSDataSource t) : virtual_offset(v_o), size(s), type(t) {
switch (this->type) { switch (this->type) {
case RomFSDataSource::LooseFile: case RomFSDataSource::LooseFile:
@ -103,7 +103,7 @@ struct RomFSSourceInfo {
break; break;
} }
} }
RomFSSourceInfo(u64 v_o, u64 s, RomFSDataSource t) : virtual_offset(v_o), size(s), type(t) { RomFSSourceInfo(u64 v_o, u64 s, RomFSDataSource t) : virtual_offset(v_o), size(s), type(t) {
switch (this->type) { switch (this->type) {
case RomFSDataSource::MetaData: case RomFSDataSource::MetaData:
@ -118,7 +118,7 @@ struct RomFSSourceInfo {
break; break;
} }
} }
void Cleanup() { void Cleanup() {
switch (this->type) { switch (this->type) {
case RomFSDataSource::BaseRomFS: case RomFSDataSource::BaseRomFS:
@ -137,7 +137,7 @@ struct RomFSSourceInfo {
break; break;
} }
} }
static bool Compare(RomFSSourceInfo *a, RomFSSourceInfo *b) { static bool Compare(RomFSSourceInfo *a, RomFSSourceInfo *b) {
return (a->virtual_offset < b->virtual_offset); return (a->virtual_offset < b->virtual_offset);
} }
@ -229,13 +229,13 @@ class RomFSBuildContext {
u64 dir_hash_table_size = 0; u64 dir_hash_table_size = 0;
u64 file_hash_table_size = 0; u64 file_hash_table_size = 0;
u64 file_partition_size = 0; u64 file_partition_size = 0;
FsDirectoryEntry dir_entry; FsDirectoryEntry dir_entry;
RomFSDataSource cur_source_type; RomFSDataSource cur_source_type;
void VisitDirectory(FsFileSystem *filesys, RomFSBuildDirectoryContext *parent); void VisitDirectory(FsFileSystem *filesys, RomFSBuildDirectoryContext *parent);
void VisitDirectory(RomFSBuildDirectoryContext *parent, u32 parent_offset, void *dir_table, size_t dir_table_size, void *file_table, size_t file_table_size); void VisitDirectory(RomFSBuildDirectoryContext *parent, u32 parent_offset, void *dir_table, size_t dir_table_size, void *file_table, size_t file_table_size);
bool AddDirectory(RomFSBuildDirectoryContext *parent_dir_ctx, RomFSBuildDirectoryContext *dir_ctx, RomFSBuildDirectoryContext **out_dir_ctx); bool AddDirectory(RomFSBuildDirectoryContext *parent_dir_ctx, RomFSBuildDirectoryContext *dir_ctx, RomFSBuildDirectoryContext **out_dir_ctx);
bool AddFile(RomFSBuildDirectoryContext *parent_dir_ctx, RomFSBuildFileContext *file_ctx); bool AddFile(RomFSBuildDirectoryContext *parent_dir_ctx, RomFSBuildFileContext *file_ctx);
public: public:
@ -247,10 +247,10 @@ class RomFSBuildContext {
this->num_dirs = 1; this->num_dirs = 1;
this->dir_table_size = 0x18; this->dir_table_size = 0x18;
} }
void MergeSdFiles(); void MergeSdFiles();
void MergeRomStorage(IROStorage *storage, RomFSDataSource source); void MergeRomStorage(IROStorage *storage, RomFSDataSource source);
/* This finalizes the context. */ /* This finalizes the context. */
void Build(std::vector<RomFSSourceInfo> *out_infos); void Build(std::vector<RomFSSourceInfo> *out_infos);
}; };
@ -270,7 +270,7 @@ static inline uint32_t romfs_calc_path_hash(uint32_t parent, const unsigned char
hash = (hash >> 5) | (hash << 27); hash = (hash >> 5) | (hash << 27);
hash ^= path[start + i]; hash ^= path[start + i];
} }
return hash; return hash;
} }

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>
@ -22,21 +22,21 @@
#include "nsmitm_service_common.hpp" #include "nsmitm_service_common.hpp"
class NsAmMitmService : public IMitmServiceObject { class NsAmMitmService : public IMitmServiceObject {
public: public:
NsAmMitmService(std::shared_ptr<Service> s, u64 pid) : IMitmServiceObject(s, pid) { NsAmMitmService(std::shared_ptr<Service> s, u64 pid) : IMitmServiceObject(s, pid) {
/* ... */ /* ... */
} }
static bool ShouldMitm(u64 pid, u64 tid) { static bool ShouldMitm(u64 pid, u64 tid) {
/* We will mitm: /* We will mitm:
* - web applets, to facilitate hbl web browser launching. * - web applets, to facilitate hbl web browser launching.
*/ */
return Utils::IsWebAppletTid(tid); return Utils::IsWebAppletTid(tid);
} }
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx); static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
protected: protected:
/* Overridden commands. */ /* Overridden commands. */
Result GetApplicationContentPath(OutBuffer<u8> out_path, u64 app_id, u8 storage_type); Result GetApplicationContentPath(OutBuffer<u8> out_path, u64 app_id, u8 storage_type);

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <cstdlib> #include <cstdlib>
#include <cstdint> #include <cstdint>
#include <cstring> #include <cstring>

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>
@ -56,21 +56,21 @@ class NsDocumentService : public IServiceObject {
}; };
}; };
class NsWebMitmService : public IMitmServiceObject { class NsWebMitmService : public IMitmServiceObject {
public: public:
NsWebMitmService(std::shared_ptr<Service> s, u64 pid) : IMitmServiceObject(s, pid) { NsWebMitmService(std::shared_ptr<Service> s, u64 pid) : IMitmServiceObject(s, pid) {
/* ... */ /* ... */
} }
static bool ShouldMitm(u64 pid, u64 tid) { static bool ShouldMitm(u64 pid, u64 tid) {
/* We will mitm: /* We will mitm:
* - web applets, to facilitate hbl web browser launching. * - web applets, to facilitate hbl web browser launching.
*/ */
return Utils::IsWebAppletTid(tid); return Utils::IsWebAppletTid(tid);
} }
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx); static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
protected: protected:
/* Overridden commands. */ /* Overridden commands. */
Result GetDocumentInterface(Out<std::shared_ptr<NsDocumentService>> out_intf); Result GetDocumentInterface(Out<std::shared_ptr<NsDocumentService>> out_intf);

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <cstdlib> #include <cstdlib>
#include <cstdint> #include <cstdint>
#include <cstring> #include <cstring>

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>
@ -25,32 +25,32 @@ enum SetSysCmd : u32 {
SetSysCmd_GetFirmwareVersion2 = 4, SetSysCmd_GetFirmwareVersion2 = 4,
SetSysCmd_GetSettingsItemValueSize = 37, SetSysCmd_GetSettingsItemValueSize = 37,
SetSysCmd_GetSettingsItemValue = 38, SetSysCmd_GetSettingsItemValue = 38,
/* Commands for which set:sys *must* act as a passthrough. */ /* Commands for which set:sys *must* act as a passthrough. */
/* TODO: Solve the relevant IPC detection problem. */ /* TODO: Solve the relevant IPC detection problem. */
SetSysCmd_GetEdid = 41, SetSysCmd_GetEdid = 41,
}; };
class SetSysMitmService : public IMitmServiceObject { class SetSysMitmService : public IMitmServiceObject {
public: public:
SetSysMitmService(std::shared_ptr<Service> s, u64 pid) : IMitmServiceObject(s, pid) { SetSysMitmService(std::shared_ptr<Service> s, u64 pid) : IMitmServiceObject(s, pid) {
/* ... */ /* ... */
} }
static bool ShouldMitm(u64 pid, u64 tid) { static bool ShouldMitm(u64 pid, u64 tid) {
/* Mitm everything. */ /* Mitm everything. */
return true; return true;
} }
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx); static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
protected: protected:
/* Overridden commands. */ /* Overridden commands. */
Result GetFirmwareVersion(OutPointerWithServerSize<SetSysFirmwareVersion, 0x1> out); Result GetFirmwareVersion(OutPointerWithServerSize<SetSysFirmwareVersion, 0x1> out);
Result GetFirmwareVersion2(OutPointerWithServerSize<SetSysFirmwareVersion, 0x1> out); Result GetFirmwareVersion2(OutPointerWithServerSize<SetSysFirmwareVersion, 0x1> out);
Result GetSettingsItemValueSize(Out<u64> out_size, InPointer<char> name, InPointer<char> key); Result GetSettingsItemValueSize(Out<u64> out_size, InPointer<char> name, InPointer<char> key);
Result GetSettingsItemValue(Out<u64> out_size, OutBuffer<u8> out_value, InPointer<char> name, InPointer<char> key); Result GetSettingsItemValue(Out<u64> out_size, OutBuffer<u8> out_value, InPointer<char> name, InPointer<char> key);
/* Forced passthrough commands. */ /* Forced passthrough commands. */
Result GetEdid(OutPointerWithServerSize<SetSysEdid, 0x1> out); Result GetEdid(OutPointerWithServerSize<SetSysEdid, 0x1> out);
public: public:
@ -59,7 +59,7 @@ class SetSysMitmService : public IMitmServiceObject {
MakeServiceCommandMeta<SetSysCmd_GetFirmwareVersion2, &SetSysMitmService::GetFirmwareVersion2>(), MakeServiceCommandMeta<SetSysCmd_GetFirmwareVersion2, &SetSysMitmService::GetFirmwareVersion2>(),
MakeServiceCommandMeta<SetSysCmd_GetSettingsItemValueSize, &SetSysMitmService::GetSettingsItemValueSize>(), MakeServiceCommandMeta<SetSysCmd_GetSettingsItemValueSize, &SetSysMitmService::GetSettingsItemValueSize>(),
MakeServiceCommandMeta<SetSysCmd_GetSettingsItemValue, &SetSysMitmService::GetSettingsItemValue>(), MakeServiceCommandMeta<SetSysCmd_GetSettingsItemValue, &SetSysMitmService::GetSettingsItemValue>(),
MakeServiceCommandMeta<SetSysCmd_GetEdid, &SetSysMitmService::GetEdid>(), MakeServiceCommandMeta<SetSysCmd_GetEdid, &SetSysMitmService::GetEdid>(),
}; };
}; };

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>
@ -21,12 +21,12 @@
class SettingsItemManager { class SettingsItemManager {
public: public:
static constexpr size_t MaxNameLength = 64; static constexpr size_t MaxNameLength = 64;
static constexpr size_t MaxKeyLength = 64; static constexpr size_t MaxKeyLength = 64;
public: public:
static Result ValidateName(const char *name, size_t max_size); static Result ValidateName(const char *name, size_t max_size);
static Result ValidateName(const char *name); static Result ValidateName(const char *name);
static Result ValidateKey(const char *key, size_t max_size); static Result ValidateKey(const char *key, size_t max_size);
static Result ValidateKey(const char *key); static Result ValidateKey(const char *key);

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <cstdlib> #include <cstdlib>
#include <cstdint> #include <cstdint>
#include <cstring> #include <cstring>
@ -31,7 +31,7 @@ extern "C" {
#define INNER_HEAP_SIZE 0x8000 #define INNER_HEAP_SIZE 0x8000
size_t nx_inner_heap_size = INNER_HEAP_SIZE; size_t nx_inner_heap_size = INNER_HEAP_SIZE;
char nx_inner_heap[INNER_HEAP_SIZE]; char nx_inner_heap[INNER_HEAP_SIZE];
void __libnx_initheap(void); void __libnx_initheap(void);
void __appInit(void); void __appInit(void);
void __appExit(void); void __appExit(void);

@ -1 +1 @@
Subproject commit 4a120c3c1697683df839e0a510d86107866be188 Subproject commit 59b49c0e0c64f896ce36180bb7d00f54f70300e9

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <switch.h> #include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>
#include <climits> #include <climits>

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#include <switch.h> #include <switch.h>

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#pragma once #pragma once
#include <switch.h> #include <switch.h>

View file

@ -103,7 +103,7 @@ static const auto MakeDeprecatedService = []() { return std::make_shared<Deprec
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
consoleDebugInit(debugDevice_SVC); consoleDebugInit(debugDevice_SVC);
/* Initialize global context. */ /* Initialize global context. */
SecureMonitorWrapper::Initialize(); SecureMonitorWrapper::Initialize();
@ -124,7 +124,7 @@ int main(int argc, char **argv)
} else { } else {
s_server_manager.AddWaitable(new ServiceServer<DeprecatedService, +MakeDeprecatedService>("spl:", 12)); s_server_manager.AddWaitable(new ServiceServer<DeprecatedService, +MakeDeprecatedService>("spl:", 12));
} }
/* Loop forever, servicing our services. */ /* Loop forever, servicing our services. */
s_server_manager.Process(); s_server_manager.Process();