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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
enum MitmModuleId : u32 {
@ -21,7 +21,7 @@ enum MitmModuleId : u32 {
MitmModuleId_SetMitm = 1,
MitmModuleId_BpcMitm = 2,
MitmModuleId_NsMitm = 3,
/* Always keep this at the end. */
MitmModuleId_Count,
};

View file

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

View file

@ -13,7 +13,7 @@
* 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>

View file

@ -13,7 +13,7 @@
* 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>
@ -30,7 +30,7 @@ class BpcMitmService : public IMitmServiceObject {
BpcMitmService(std::shared_ptr<Service> s, u64 pid) : IMitmServiceObject(s, pid) {
/* ... */
}
static bool ShouldMitm(u64 pid, u64 tid) {
/* We will mitm:
* - 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);
}
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
protected:
/* Overridden commands. */
Result ShutdownSystem();

View file

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

View file

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

View file

@ -13,7 +13,7 @@
* 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>

View file

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

View file

@ -13,7 +13,7 @@
* 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
void Reboot();

View file

@ -13,7 +13,7 @@
* 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>

View file

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

View file

@ -13,7 +13,7 @@
* 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>
@ -57,7 +57,7 @@ class IStorageInterface : public IServiceObject {
~IStorageInterface() {
delete base_storage;
};
private:
/* Actual command API. */
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_SetSize, &IStorageInterface::SetSize>(),
MakeServiceCommandMeta<FsIStorageCmd_GetSize, &IStorageInterface::GetSize>(),
/* 4.0.0- */
MakeServiceCommandMeta<FsIStorageCmd_OperateRange, &IStorageInterface::OperateRange, FirmwareVersion_400>(),
};

View file

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

View file

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

View file

@ -13,7 +13,7 @@
* 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>
@ -32,11 +32,11 @@ class LayeredRomFS : public IROStorage {
/* Information about the merged RomFS. */
u64 title_id;
std::shared_ptr<std::vector<RomFSSourceInfo>> p_source_infos;
public:
LayeredRomFS(std::shared_ptr<IROStorage> s_r, std::shared_ptr<IROStorage> f_r, u64 tid);
virtual ~LayeredRomFS() = default;
virtual Result Read(void *buffer, size_t size, u64 offset) override;
virtual Result GetSize(u64 *out_size) 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <cstdlib>
#include <cstdint>
#include <cstring>
@ -35,16 +35,16 @@ struct FsMitmManagerOptions {
};
using FsMitmManager = WaitableManager<FsMitmManagerOptions>;
void FsMitmMain(void *arg) {
void FsMitmMain(void *arg) {
/* Create server manager. */
auto server_manager = new FsMitmManager(5);
/* Create fsp-srv mitm. */
AddMitmServerToManager<FsMitmService>(server_manager, "fsp-srv", 61);
/* Loop forever, servicing our services. */
server_manager->Process();
delete server_manager;
}

View file

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

View file

@ -13,7 +13,7 @@
* 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 <cstdlib>
#include <switch.h>
@ -67,7 +67,7 @@ struct RomFSSourceInfo {
RomFSMetaDataSourceInfo metadata_source_info;
};
RomFSDataSource type;
RomFSSourceInfo(u64 v_o, u64 s, u64 offset, RomFSDataSource t) : virtual_offset(v_o), size(s), type(t) {
switch (this->type) {
case RomFSDataSource::BaseRomFS:
@ -85,7 +85,7 @@ struct RomFSSourceInfo {
break;
}
}
RomFSSourceInfo(u64 v_o, u64 s, const void *arg, RomFSDataSource t) : virtual_offset(v_o), size(s), type(t) {
switch (this->type) {
case RomFSDataSource::LooseFile:
@ -103,7 +103,7 @@ struct RomFSSourceInfo {
break;
}
}
RomFSSourceInfo(u64 v_o, u64 s, RomFSDataSource t) : virtual_offset(v_o), size(s), type(t) {
switch (this->type) {
case RomFSDataSource::MetaData:
@ -118,7 +118,7 @@ struct RomFSSourceInfo {
break;
}
}
void Cleanup() {
switch (this->type) {
case RomFSDataSource::BaseRomFS:
@ -137,7 +137,7 @@ struct RomFSSourceInfo {
break;
}
}
static bool Compare(RomFSSourceInfo *a, RomFSSourceInfo *b) {
return (a->virtual_offset < b->virtual_offset);
}
@ -229,13 +229,13 @@ class RomFSBuildContext {
u64 dir_hash_table_size = 0;
u64 file_hash_table_size = 0;
u64 file_partition_size = 0;
FsDirectoryEntry dir_entry;
RomFSDataSource cur_source_type;
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);
bool AddDirectory(RomFSBuildDirectoryContext *parent_dir_ctx, RomFSBuildDirectoryContext *dir_ctx, RomFSBuildDirectoryContext **out_dir_ctx);
bool AddFile(RomFSBuildDirectoryContext *parent_dir_ctx, RomFSBuildFileContext *file_ctx);
public:
@ -247,10 +247,10 @@ class RomFSBuildContext {
this->num_dirs = 1;
this->dir_table_size = 0x18;
}
void MergeSdFiles();
void MergeRomStorage(IROStorage *storage, RomFSDataSource source);
/* This finalizes the context. */
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 ^= path[start + i];
}
return hash;
}

View file

@ -13,7 +13,7 @@
* 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>
@ -22,21 +22,21 @@
#include "nsmitm_service_common.hpp"
class NsAmMitmService : public IMitmServiceObject {
class NsAmMitmService : public IMitmServiceObject {
public:
NsAmMitmService(std::shared_ptr<Service> s, u64 pid) : IMitmServiceObject(s, pid) {
/* ... */
}
static bool ShouldMitm(u64 pid, u64 tid) {
/* We will mitm:
* - web applets, to facilitate hbl web browser launching.
*/
return Utils::IsWebAppletTid(tid);
}
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
protected:
/* Overridden commands. */
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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <cstdlib>
#include <cstdint>
#include <cstring>

View file

@ -13,7 +13,7 @@
* 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>

View file

@ -13,7 +13,7 @@
* 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>
@ -56,21 +56,21 @@ class NsDocumentService : public IServiceObject {
};
};
class NsWebMitmService : public IMitmServiceObject {
class NsWebMitmService : public IMitmServiceObject {
public:
NsWebMitmService(std::shared_ptr<Service> s, u64 pid) : IMitmServiceObject(s, pid) {
/* ... */
}
static bool ShouldMitm(u64 pid, u64 tid) {
/* We will mitm:
* - web applets, to facilitate hbl web browser launching.
*/
return Utils::IsWebAppletTid(tid);
}
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
protected:
/* Overridden commands. */
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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <cstdlib>
#include <cstdint>
#include <cstring>

View file

@ -13,7 +13,7 @@
* 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>

View file

@ -13,7 +13,7 @@
* 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>
@ -25,32 +25,32 @@ enum SetSysCmd : u32 {
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 {
class SetSysMitmService : public IMitmServiceObject {
public:
SetSysMitmService(std::shared_ptr<Service> s, u64 pid) : IMitmServiceObject(s, pid) {
/* ... */
}
static bool ShouldMitm(u64 pid, u64 tid) {
/* Mitm everything. */
return true;
}
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
protected:
/* Overridden commands. */
Result GetFirmwareVersion(OutPointerWithServerSize<SetSysFirmwareVersion, 0x1> out);
Result GetFirmwareVersion2(OutPointerWithServerSize<SetSysFirmwareVersion, 0x1> out);
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);
/* Forced passthrough commands. */
Result GetEdid(OutPointerWithServerSize<SetSysEdid, 0x1> out);
public:
@ -59,7 +59,7 @@ class SetSysMitmService : public IMitmServiceObject {
MakeServiceCommandMeta<SetSysCmd_GetFirmwareVersion2, &SetSysMitmService::GetFirmwareVersion2>(),
MakeServiceCommandMeta<SetSysCmd_GetSettingsItemValueSize, &SetSysMitmService::GetSettingsItemValueSize>(),
MakeServiceCommandMeta<SetSysCmd_GetSettingsItemValue, &SetSysMitmService::GetSettingsItemValue>(),
MakeServiceCommandMeta<SetSysCmd_GetEdid, &SetSysMitmService::GetEdid>(),
};
};

View file

@ -13,7 +13,7 @@
* 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>
@ -21,12 +21,12 @@
class SettingsItemManager {
public:
static constexpr size_t MaxNameLength = 64;
static constexpr size_t MaxNameLength = 64;
static constexpr size_t MaxKeyLength = 64;
public:
static Result ValidateName(const char *name, size_t max_size);
static Result ValidateName(const char *name);
static Result ValidateKey(const char *key, size_t max_size);
static Result ValidateKey(const char *key);

View file

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

View file

@ -13,7 +13,7 @@
* 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>

View file

@ -13,7 +13,7 @@
* 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>

View file

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