mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-14 00:56:35 +00:00
namespace sts -> namespace ams
namespace sts::ams -> ams::exosphere, ams::. This is to facilitate future use of ams:: namespace code in mesosphere, as we'll want to include ams::util, ams::result, ams::svc...
This commit is contained in:
parent
4059dc6187
commit
8cb77ac136
397 changed files with 968 additions and 926 deletions
|
@ -46,7 +46,7 @@ extern "C" {
|
||||||
void __libstratosphere_exception_handler(AtmosphereFatalErrorContext *ctx);
|
void __libstratosphere_exception_handler(AtmosphereFatalErrorContext *ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
sts::ncm::TitleId __stratosphere_title_id = sts::ncm::TitleId::AtmosphereMitm;
|
ams::ncm::TitleId __stratosphere_title_id = ams::ncm::TitleId::AtmosphereMitm;
|
||||||
|
|
||||||
void __libnx_exception_handler(ThreadExceptionDump *ctx) {
|
void __libnx_exception_handler(ThreadExceptionDump *ctx) {
|
||||||
StratosphereCrashHandler(ctx);
|
StratosphereCrashHandler(ctx);
|
||||||
|
@ -93,7 +93,7 @@ void __appExit(void) {
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
consoleDebugInit(debugDevice_SVC);
|
consoleDebugInit(debugDevice_SVC);
|
||||||
sts::os::Thread initializer_thread;
|
ams::os::Thread initializer_thread;
|
||||||
|
|
||||||
LaunchAllMitmModules();
|
LaunchAllMitmModules();
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "ns_mitm/nsmitm_main.hpp"
|
#include "ns_mitm/nsmitm_main.hpp"
|
||||||
#include "hid_mitm/hidmitm_main.hpp"
|
#include "hid_mitm/hidmitm_main.hpp"
|
||||||
|
|
||||||
static sts::os::Thread g_module_threads[MitmModuleId_Count];
|
static ams::os::Thread g_module_threads[MitmModuleId_Count];
|
||||||
|
|
||||||
static const struct {
|
static const struct {
|
||||||
ThreadFunc main;
|
ThreadFunc main;
|
||||||
|
|
|
@ -27,17 +27,17 @@ class BpcMitmService : public IMitmServiceObject {
|
||||||
RebootSystem = 1,
|
RebootSystem = 1,
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
BpcMitmService(std::shared_ptr<Service> s, u64 pid, sts::ncm::TitleId tid) : IMitmServiceObject(s, pid, tid) {
|
BpcMitmService(std::shared_ptr<Service> s, u64 pid, ams::ncm::TitleId tid) : IMitmServiceObject(s, pid, tid) {
|
||||||
/* ... */
|
/* ... */
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ShouldMitm(u64 pid, sts::ncm::TitleId tid) {
|
static bool ShouldMitm(u64 pid, ams::ncm::TitleId 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.
|
||||||
* - fatal, to simplify payload reboot logic significantly
|
* - fatal, to simplify payload reboot logic significantly
|
||||||
* - applications, to allow homebrew to take advantage of the feature.
|
* - applications, to allow homebrew to take advantage of the feature.
|
||||||
*/
|
*/
|
||||||
return tid == sts::ncm::TitleId::Am || tid == sts::ncm::TitleId::Fatal || sts::ncm::IsApplicationTitleId(tid) || Utils::IsHblTid(static_cast<u64>(tid));
|
return tid == ams::ncm::TitleId::Am || tid == ams::ncm::TitleId::Fatal || ams::ncm::IsApplicationTitleId(tid) || Utils::IsHblTid(static_cast<u64>(tid));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
|
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
|
||||||
|
|
|
@ -32,7 +32,7 @@ Result FsDirUtils::CopyFile(IFileSystem *dst_fs, IFileSystem *src_fs, const FsPa
|
||||||
{
|
{
|
||||||
FsPath dst_path;
|
FsPath dst_path;
|
||||||
/* TODO: Error code? N aborts here. */
|
/* TODO: Error code? N aborts here. */
|
||||||
STS_ASSERT(static_cast<size_t>(snprintf(dst_path.str, sizeof(dst_path.str), "%s%s", dst_parent_path.str, dir_ent->name)) < sizeof(dst_path));
|
AMS_ASSERT(static_cast<size_t>(snprintf(dst_path.str, sizeof(dst_path.str), "%s%s", dst_parent_path.str, dir_ent->name)) < sizeof(dst_path));
|
||||||
|
|
||||||
R_TRY(dst_fs->CreateFile(dst_path, file_size));
|
R_TRY(dst_fs->CreateFile(dst_path, file_size));
|
||||||
R_TRY(dst_fs->OpenFile(dst_file, dst_path, OpenMode_Write));
|
R_TRY(dst_fs->OpenFile(dst_file, dst_path, OpenMode_Write));
|
||||||
|
|
|
@ -30,14 +30,14 @@ static char *GetNormalizedDirectory(const char *dir_prefix) {
|
||||||
|
|
||||||
/* Ensure terminating '/' */
|
/* Ensure terminating '/' */
|
||||||
if (normal_path[normal_path_len-1] != '/') {
|
if (normal_path[normal_path_len-1] != '/') {
|
||||||
STS_ASSERT(normal_path_len + 2 <= sizeof(normal_path));
|
AMS_ASSERT(normal_path_len + 2 <= sizeof(normal_path));
|
||||||
strncat(normal_path, "/", 2);
|
strncat(normal_path, "/", 2);
|
||||||
normal_path[sizeof(normal_path)-1] = 0;
|
normal_path[sizeof(normal_path)-1] = 0;
|
||||||
normal_path_len++;
|
normal_path_len++;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *output = static_cast<char *>(std::malloc(normal_path_len + 1));
|
char *output = static_cast<char *>(std::malloc(normal_path_len + 1));
|
||||||
STS_ASSERT(output != nullptr);
|
AMS_ASSERT(output != nullptr);
|
||||||
|
|
||||||
std::strncpy(output, normal_path, normal_path_len + 1);
|
std::strncpy(output, normal_path, normal_path_len + 1);
|
||||||
output[normal_path_len] = 0;
|
output[normal_path_len] = 0;
|
||||||
|
|
|
@ -119,7 +119,7 @@ Result DirectorySaveDataFileSystem::AllocateWorkBuffer(void **out_buf, size_t *o
|
||||||
|
|
||||||
/* Divide size by two. */
|
/* Divide size by two. */
|
||||||
try_size >>= 1;
|
try_size >>= 1;
|
||||||
STS_ASSERT(try_size > 0x200);
|
AMS_ASSERT(try_size > 0x200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Return a result here? Nintendo does not, but they have other allocation failed results. */
|
/* TODO: Return a result here? Nintendo does not, but they have other allocation failed results. */
|
||||||
|
|
|
@ -37,7 +37,7 @@ class DirectorySaveDataFileSystem : public IFileSystem {
|
||||||
std::unique_ptr<IFileSystem> unique_fs;
|
std::unique_ptr<IFileSystem> unique_fs;
|
||||||
std::unique_ptr<IFileSystem> proxy_save_fs;
|
std::unique_ptr<IFileSystem> proxy_save_fs;
|
||||||
IFileSystem *fs;
|
IFileSystem *fs;
|
||||||
sts::os::Mutex lock;
|
ams::os::Mutex lock;
|
||||||
size_t open_writable_files = 0;
|
size_t open_writable_files = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -261,7 +261,7 @@ Result FsPathUtils::Normalize(char *out, size_t max_out_size, const char *src, s
|
||||||
/* Assert normalized. */
|
/* Assert normalized. */
|
||||||
bool normalized = false;
|
bool normalized = false;
|
||||||
R_ASSERT(FsPathUtils::IsNormalized(&normalized, out));
|
R_ASSERT(FsPathUtils::IsNormalized(&normalized, out));
|
||||||
STS_ASSERT(normalized);
|
AMS_ASSERT(normalized);
|
||||||
|
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ Result SubDirectoryFileSystem::Initialize(const char *bp) {
|
||||||
|
|
||||||
/* Ensure terminating '/' */
|
/* Ensure terminating '/' */
|
||||||
if (normal_path[normal_path_len-1] != '/') {
|
if (normal_path[normal_path_len-1] != '/') {
|
||||||
STS_ASSERT(normal_path_len + 2 <= sizeof(normal_path));
|
AMS_ASSERT(normal_path_len + 2 <= sizeof(normal_path));
|
||||||
|
|
||||||
strncat(normal_path, "/", 2);
|
strncat(normal_path, "/", 2);
|
||||||
normal_path[sizeof(normal_path)-1] = 0;
|
normal_path[sizeof(normal_path)-1] = 0;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include "fsmitm_boot0storage.hpp"
|
#include "fsmitm_boot0storage.hpp"
|
||||||
|
|
||||||
static sts::os::Mutex g_boot0_mutex;
|
static ams::os::Mutex g_boot0_mutex;
|
||||||
static u8 g_boot0_bct_buffer[Boot0Storage::BctEndOffset];
|
static u8 g_boot0_bct_buffer[Boot0Storage::BctEndOffset];
|
||||||
|
|
||||||
bool Boot0Storage::CanModifyBctPubks() {
|
bool Boot0Storage::CanModifyBctPubks() {
|
||||||
|
@ -28,11 +28,11 @@ bool Boot0Storage::CanModifyBctPubks() {
|
||||||
/* RCM bug patched. */
|
/* RCM bug patched. */
|
||||||
/* Only allow NS to update the BCT pubks. */
|
/* Only allow NS to update the BCT pubks. */
|
||||||
/* AutoRCM on a patched unit will cause a brick, so homebrew should NOT be allowed to write. */
|
/* AutoRCM on a patched unit will cause a brick, so homebrew should NOT be allowed to write. */
|
||||||
return this->title_id == sts::ncm::TitleId::Ns;
|
return this->title_id == ams::ncm::TitleId::Ns;
|
||||||
} else {
|
} else {
|
||||||
/* RCM bug unpatched. */
|
/* RCM bug unpatched. */
|
||||||
/* Allow homebrew but not NS to update the BCT pubks. */
|
/* Allow homebrew but not NS to update the BCT pubks. */
|
||||||
return this->title_id != sts::ncm::TitleId::Ns;
|
return this->title_id != ams::ncm::TitleId::Ns;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,12 +131,12 @@ class Boot0Storage : public SectoredProxyStorage<0x200> {
|
||||||
static constexpr u64 EksSize = 0x4000;
|
static constexpr u64 EksSize = 0x4000;
|
||||||
static constexpr u64 EksEnd = EksStart + EksSize;
|
static constexpr u64 EksEnd = EksStart + EksSize;
|
||||||
private:
|
private:
|
||||||
sts::ncm::TitleId title_id;
|
ams::ncm::TitleId title_id;
|
||||||
private:
|
private:
|
||||||
bool CanModifyBctPubks();
|
bool CanModifyBctPubks();
|
||||||
public:
|
public:
|
||||||
Boot0Storage(FsStorage *s, sts::ncm::TitleId t) : Base(s), title_id(t) { }
|
Boot0Storage(FsStorage *s, ams::ncm::TitleId t) : Base(s), title_id(t) { }
|
||||||
Boot0Storage(FsStorage s, sts::ncm::TitleId t) : Base(s), title_id(t) { }
|
Boot0Storage(FsStorage s, ams::ncm::TitleId t) : Base(s), title_id(t) { }
|
||||||
public:
|
public:
|
||||||
virtual Result Read(void *_buffer, size_t size, u64 offset) override;
|
virtual Result Read(void *_buffer, size_t size, u64 offset) override;
|
||||||
virtual Result Write(void *_buffer, size_t size, u64 offset) override;
|
virtual Result Write(void *_buffer, size_t size, u64 offset) override;
|
||||||
|
|
|
@ -93,7 +93,7 @@ Result LayeredRomFS::Read(void *buffer, size_t size, u64 offset) {
|
||||||
R_ASSERT(Utils::OpenSdFileForAtmosphere(this->title_id, ROMFS_METADATA_FILE_PATH, FS_OPEN_READ, &file));
|
R_ASSERT(Utils::OpenSdFileForAtmosphere(this->title_id, ROMFS_METADATA_FILE_PATH, FS_OPEN_READ, &file));
|
||||||
size_t out_read;
|
size_t out_read;
|
||||||
R_ASSERT(fsFileRead(&file, (offset - cur_source->virtual_offset), (void *)((uintptr_t)buffer + read_so_far), cur_read_size, FS_READOPTION_NONE, &out_read));
|
R_ASSERT(fsFileRead(&file, (offset - cur_source->virtual_offset), (void *)((uintptr_t)buffer + read_so_far), cur_read_size, FS_READOPTION_NONE, &out_read));
|
||||||
STS_ASSERT(out_read == cur_read_size);
|
AMS_ASSERT(out_read == cur_read_size);
|
||||||
fsFileClose(&file);
|
fsFileClose(&file);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -103,7 +103,7 @@ Result LayeredRomFS::Read(void *buffer, size_t size, u64 offset) {
|
||||||
R_ASSERT(Utils::OpenRomFSSdFile(this->title_id, cur_source->loose_source_info.path, FS_OPEN_READ, &file));
|
R_ASSERT(Utils::OpenRomFSSdFile(this->title_id, cur_source->loose_source_info.path, FS_OPEN_READ, &file));
|
||||||
size_t out_read;
|
size_t out_read;
|
||||||
R_ASSERT(fsFileRead(&file, (offset - cur_source->virtual_offset), (void *)((uintptr_t)buffer + read_so_far), cur_read_size, FS_READOPTION_NONE, &out_read));
|
R_ASSERT(fsFileRead(&file, (offset - cur_source->virtual_offset), (void *)((uintptr_t)buffer + read_so_far), cur_read_size, FS_READOPTION_NONE, &out_read));
|
||||||
STS_ASSERT(out_read == cur_read_size);
|
AMS_ASSERT(out_read == cur_read_size);
|
||||||
fsFileClose(&file);
|
fsFileClose(&file);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -122,7 +122,7 @@ Result LayeredRomFS::Read(void *buffer, size_t size, u64 offset) {
|
||||||
R_ASSERT(this->file_romfs->Read((void *)((uintptr_t)buffer + read_so_far), cur_read_size, cur_source->base_source_info.offset + (offset - cur_source->virtual_offset)));
|
R_ASSERT(this->file_romfs->Read((void *)((uintptr_t)buffer + read_so_far), cur_read_size, cur_source->base_source_info.offset + (offset - cur_source->virtual_offset)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
STS_UNREACHABLE_DEFAULT_CASE();
|
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||||
}
|
}
|
||||||
read_so_far += cur_read_size;
|
read_so_far += cur_read_size;
|
||||||
offset += cur_read_size;
|
offset += cur_read_size;
|
||||||
|
|
|
@ -39,7 +39,7 @@ void RomFSBuildContext::VisitDirectory(FsFileSystem *filesys, RomFSBuildDirector
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
STS_ASSERT(this->dir_entry.type == ENTRYTYPE_DIR || this->dir_entry.type == ENTRYTYPE_FILE);
|
AMS_ASSERT(this->dir_entry.type == ENTRYTYPE_DIR || this->dir_entry.type == ENTRYTYPE_FILE);
|
||||||
if (this->dir_entry.type == ENTRYTYPE_DIR) {
|
if (this->dir_entry.type == ENTRYTYPE_DIR) {
|
||||||
RomFSBuildDirectoryContext *child = new RomFSBuildDirectoryContext({0});
|
RomFSBuildDirectoryContext *child = new RomFSBuildDirectoryContext({0});
|
||||||
/* Set child's path. */
|
/* Set child's path. */
|
||||||
|
@ -179,7 +179,7 @@ void RomFSBuildContext::VisitDirectory(RomFSBuildDirectoryContext *parent, u32 p
|
||||||
void RomFSBuildContext::MergeRomStorage(IROStorage *storage, RomFSDataSource source) {
|
void RomFSBuildContext::MergeRomStorage(IROStorage *storage, RomFSDataSource source) {
|
||||||
RomFSHeader header;
|
RomFSHeader header;
|
||||||
R_ASSERT(storage->Read(&header, sizeof(header), 0));
|
R_ASSERT(storage->Read(&header, sizeof(header), 0));
|
||||||
STS_ASSERT(header.header_size == sizeof(header));
|
AMS_ASSERT(header.header_size == sizeof(header));
|
||||||
|
|
||||||
/* Read tables. */
|
/* Read tables. */
|
||||||
auto dir_table = std::make_unique<u8[]>(header.dir_table_size);
|
auto dir_table = std::make_unique<u8[]>(header.dir_table_size);
|
||||||
|
|
|
@ -36,10 +36,10 @@
|
||||||
|
|
||||||
#include "../debug.hpp"
|
#include "../debug.hpp"
|
||||||
|
|
||||||
static sts::os::Mutex g_StorageCacheLock;
|
static ams::os::Mutex g_StorageCacheLock;
|
||||||
static std::unordered_map<u64, std::weak_ptr<IStorageInterface>> g_StorageCache;
|
static std::unordered_map<u64, std::weak_ptr<IStorageInterface>> g_StorageCache;
|
||||||
|
|
||||||
static bool StorageCacheGetEntry(sts::ncm::TitleId title_id, std::shared_ptr<IStorageInterface> *out) {
|
static bool StorageCacheGetEntry(ams::ncm::TitleId title_id, std::shared_ptr<IStorageInterface> *out) {
|
||||||
std::scoped_lock lock(g_StorageCacheLock);
|
std::scoped_lock lock(g_StorageCacheLock);
|
||||||
if (g_StorageCache.find(static_cast<u64>(title_id)) == g_StorageCache.end()) {
|
if (g_StorageCache.find(static_cast<u64>(title_id)) == g_StorageCache.end()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -53,7 +53,7 @@ static bool StorageCacheGetEntry(sts::ncm::TitleId title_id, std::shared_ptr<ISt
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void StorageCacheSetEntry(sts::ncm::TitleId title_id, std::shared_ptr<IStorageInterface> *ptr) {
|
static void StorageCacheSetEntry(ams::ncm::TitleId title_id, std::shared_ptr<IStorageInterface> *ptr) {
|
||||||
std::scoped_lock lock(g_StorageCacheLock);
|
std::scoped_lock lock(g_StorageCacheLock);
|
||||||
|
|
||||||
/* Ensure we always use the cached copy if present. */
|
/* Ensure we always use the cached copy if present. */
|
||||||
|
@ -145,7 +145,7 @@ Result FsMitmService::OpenFileSystemWithId(Out<std::shared_ptr<IFileSystemInterf
|
||||||
|
|
||||||
Result FsMitmService::OpenSdCardFileSystem(Out<std::shared_ptr<IFileSystemInterface>> out_fs) {
|
Result FsMitmService::OpenSdCardFileSystem(Out<std::shared_ptr<IFileSystemInterface>> out_fs) {
|
||||||
/* We only care about redirecting this for NS/Emummc. */
|
/* We only care about redirecting this for NS/Emummc. */
|
||||||
if (this->title_id != sts::ncm::TitleId::Ns) {
|
if (this->title_id != ams::ncm::TitleId::Ns) {
|
||||||
return ResultAtmosphereMitmShouldForwardToSession;
|
return ResultAtmosphereMitmShouldForwardToSession;
|
||||||
}
|
}
|
||||||
if (!IsEmummc()) {
|
if (!IsEmummc()) {
|
||||||
|
@ -234,7 +234,7 @@ Result FsMitmService::OpenBisStorage(Out<std::shared_ptr<IStorageInterface>> out
|
||||||
FsStorage bis_storage;
|
FsStorage bis_storage;
|
||||||
R_TRY(fsOpenBisStorageFwd(this->forward_service.get(), &bis_storage, bis_partition_id));
|
R_TRY(fsOpenBisStorageFwd(this->forward_service.get(), &bis_storage, bis_partition_id));
|
||||||
|
|
||||||
const bool is_sysmodule = sts::ncm::IsSystemTitleId(this->title_id);
|
const bool is_sysmodule = ams::ncm::IsSystemTitleId(this->title_id);
|
||||||
const bool has_bis_write_flag = Utils::HasFlag(static_cast<u64>(this->title_id), "bis_write");
|
const bool has_bis_write_flag = Utils::HasFlag(static_cast<u64>(this->title_id), "bis_write");
|
||||||
const bool has_cal0_read_flag = Utils::HasFlag(static_cast<u64>(this->title_id), "cal_read");
|
const bool has_cal0_read_flag = Utils::HasFlag(static_cast<u64>(this->title_id), "cal_read");
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ Result FsMitmService::OpenDataStorageByDataId(Out<std::shared_ptr<IStorageInterf
|
||||||
/* Try to get from the cache. */
|
/* Try to get from the cache. */
|
||||||
{
|
{
|
||||||
std::shared_ptr<IStorageInterface> cached_storage = nullptr;
|
std::shared_ptr<IStorageInterface> cached_storage = nullptr;
|
||||||
bool has_cache = StorageCacheGetEntry(sts::ncm::TitleId{data_id}, &cached_storage);
|
bool has_cache = StorageCacheGetEntry(ams::ncm::TitleId{data_id}, &cached_storage);
|
||||||
|
|
||||||
if (has_cache) {
|
if (has_cache) {
|
||||||
if (out_storage.IsDomain()) {
|
if (out_storage.IsDomain()) {
|
||||||
|
@ -374,7 +374,7 @@ Result FsMitmService::OpenDataStorageByDataId(Out<std::shared_ptr<IStorageInterf
|
||||||
storage_to_cache = std::make_shared<IStorageInterface>(new LayeredRomFS(std::make_shared<ReadOnlyStorageAdapter>(new ProxyStorage(data_storage)), nullptr, data_id));
|
storage_to_cache = std::make_shared<IStorageInterface>(new LayeredRomFS(std::make_shared<ReadOnlyStorageAdapter>(new ProxyStorage(data_storage)), nullptr, data_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
StorageCacheSetEntry(sts::ncm::TitleId{data_id}, &storage_to_cache);
|
StorageCacheSetEntry(ams::ncm::TitleId{data_id}, &storage_to_cache);
|
||||||
|
|
||||||
out_storage.SetValue(std::move(storage_to_cache));
|
out_storage.SetValue(std::move(storage_to_cache));
|
||||||
if (out_storage.IsDomain()) {
|
if (out_storage.IsDomain()) {
|
||||||
|
|
|
@ -44,15 +44,15 @@ class FsMitmService : public IMitmServiceObject {
|
||||||
bool has_initialized = false;
|
bool has_initialized = false;
|
||||||
bool should_override_contents;
|
bool should_override_contents;
|
||||||
public:
|
public:
|
||||||
FsMitmService(std::shared_ptr<Service> s, u64 pid, sts::ncm::TitleId tid) : IMitmServiceObject(s, pid, tid) {
|
FsMitmService(std::shared_ptr<Service> s, u64 pid, ams::ncm::TitleId tid) : IMitmServiceObject(s, pid, tid) {
|
||||||
if (Utils::HasSdDisableMitMFlag(static_cast<u64>(this->title_id))) {
|
if (Utils::HasSdDisableMitMFlag(static_cast<u64>(this->title_id))) {
|
||||||
this->should_override_contents = false;
|
this->should_override_contents = false;
|
||||||
} else {
|
} else {
|
||||||
this->should_override_contents = (this->title_id >= sts::ncm::TitleId::ApplicationStart || Utils::HasSdMitMFlag(static_cast<u64>(this->title_id))) && Utils::HasOverrideButton(static_cast<u64>(this->title_id));
|
this->should_override_contents = (this->title_id >= ams::ncm::TitleId::ApplicationStart || Utils::HasSdMitMFlag(static_cast<u64>(this->title_id))) && Utils::HasOverrideButton(static_cast<u64>(this->title_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ShouldMitm(u64 pid, sts::ncm::TitleId tid) {
|
static bool ShouldMitm(u64 pid, ams::ncm::TitleId tid) {
|
||||||
/* Don't Mitm KIPs */
|
/* Don't Mitm KIPs */
|
||||||
if (pid < 0x50) {
|
if (pid < 0x50) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -62,11 +62,11 @@ class FsMitmService : public IMitmServiceObject {
|
||||||
|
|
||||||
/* TODO: intercepting everything seems to cause issues with sleep mode, for some reason. */
|
/* TODO: intercepting everything seems to cause issues with sleep mode, for some reason. */
|
||||||
/* Figure out why, and address it. */
|
/* Figure out why, and address it. */
|
||||||
if (tid == sts::ncm::TitleId::AppletQlaunch || tid == sts::ncm::TitleId::AppletMaintenanceMenu) {
|
if (tid == ams::ncm::TitleId::AppletQlaunch || tid == ams::ncm::TitleId::AppletMaintenanceMenu) {
|
||||||
has_launched_qlaunch = true;
|
has_launched_qlaunch = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return has_launched_qlaunch || tid == sts::ncm::TitleId::Ns || tid >= sts::ncm::TitleId::ApplicationStart || Utils::HasSdMitMFlag(static_cast<u64>(tid));
|
return has_launched_qlaunch || tid == ams::ncm::TitleId::Ns || tid >= ams::ncm::TitleId::ApplicationStart || Utils::HasSdMitMFlag(static_cast<u64>(tid));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
|
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
|
||||||
|
|
|
@ -28,13 +28,13 @@ class HidMitmService : public IMitmServiceObject {
|
||||||
private:
|
private:
|
||||||
bool should_set_system_ext = false;
|
bool should_set_system_ext = false;
|
||||||
public:
|
public:
|
||||||
HidMitmService(std::shared_ptr<Service> s, u64 pid, sts::ncm::TitleId tid) : IMitmServiceObject(s, pid, tid) {
|
HidMitmService(std::shared_ptr<Service> s, u64 pid, ams::ncm::TitleId tid) : IMitmServiceObject(s, pid, tid) {
|
||||||
/* ... */
|
/* ... */
|
||||||
}
|
}
|
||||||
|
|
||||||
~HidMitmService();
|
~HidMitmService();
|
||||||
|
|
||||||
static bool ShouldMitm(u64 pid, sts::ncm::TitleId tid) {
|
static bool ShouldMitm(u64 pid, ams::ncm::TitleId tid) {
|
||||||
/* TODO: Consider removing in Atmosphere 0.10.0/1.0.0. */
|
/* TODO: Consider removing in Atmosphere 0.10.0/1.0.0. */
|
||||||
/* We will mitm:
|
/* We will mitm:
|
||||||
* - hbl, to help homebrew not need to be recompiled.
|
* - hbl, to help homebrew not need to be recompiled.
|
||||||
|
|
|
@ -28,11 +28,11 @@ class NsAmMitmService : public IMitmServiceObject {
|
||||||
GetRunningApplicationProgramId = 92,
|
GetRunningApplicationProgramId = 92,
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
NsAmMitmService(std::shared_ptr<Service> s, u64 pid, sts::ncm::TitleId tid) : IMitmServiceObject(s, pid, tid) {
|
NsAmMitmService(std::shared_ptr<Service> s, u64 pid, ams::ncm::TitleId tid) : IMitmServiceObject(s, pid, tid) {
|
||||||
/* ... */
|
/* ... */
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ShouldMitm(u64 pid, sts::ncm::TitleId tid) {
|
static bool ShouldMitm(u64 pid, ams::ncm::TitleId tid) {
|
||||||
/* We will mitm:
|
/* We will mitm:
|
||||||
* - web applets, to facilitate hbl web browser launching.
|
* - web applets, to facilitate hbl web browser launching.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -67,11 +67,11 @@ class NsWebMitmService : public IMitmServiceObject {
|
||||||
GetDocumentInterface = 7999,
|
GetDocumentInterface = 7999,
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
NsWebMitmService(std::shared_ptr<Service> s, u64 pid, sts::ncm::TitleId tid) : IMitmServiceObject(s, pid, tid) {
|
NsWebMitmService(std::shared_ptr<Service> s, u64 pid, ams::ncm::TitleId tid) : IMitmServiceObject(s, pid, tid) {
|
||||||
/* ... */
|
/* ... */
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ShouldMitm(u64 pid, sts::ncm::TitleId tid) {
|
static bool ShouldMitm(u64 pid, ams::ncm::TitleId tid) {
|
||||||
/* We will mitm:
|
/* We will mitm:
|
||||||
* - web applets, to facilitate hbl web browser launching.
|
* - web applets, to facilitate hbl web browser launching.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -43,7 +43,7 @@ bool SetMitmService::IsValidLanguageCode(u64 lang_code) {
|
||||||
LanguageCode_SimplifiedChinese,
|
LanguageCode_SimplifiedChinese,
|
||||||
LanguageCode_TraditionalChinese,
|
LanguageCode_TraditionalChinese,
|
||||||
};
|
};
|
||||||
size_t num_language_codes = sts::util::size(s_valid_language_codes);
|
size_t num_language_codes = ams::util::size(s_valid_language_codes);
|
||||||
if (GetRuntimeFirmwareVersion() < FirmwareVersion_400) {
|
if (GetRuntimeFirmwareVersion() < FirmwareVersion_400) {
|
||||||
/* 4.0.0 added simplified and traditional chinese. */
|
/* 4.0.0 added simplified and traditional chinese. */
|
||||||
num_language_codes -= 2;
|
num_language_codes -= 2;
|
||||||
|
@ -67,7 +67,7 @@ Result SetMitmService::EnsureLocale() {
|
||||||
|
|
||||||
if (!this->got_locale) {
|
if (!this->got_locale) {
|
||||||
std::memset(&this->locale, 0xCC, sizeof(this->locale));
|
std::memset(&this->locale, 0xCC, sizeof(this->locale));
|
||||||
if (this->title_id == sts::ncm::TitleId::Ns) {
|
if (this->title_id == ams::ncm::TitleId::Ns) {
|
||||||
u64 app_pid = 0;
|
u64 app_pid = 0;
|
||||||
u64 app_tid = 0;
|
u64 app_tid = 0;
|
||||||
R_TRY(pmdmntGetApplicationPid(&app_pid));
|
R_TRY(pmdmntGetApplicationPid(&app_pid));
|
||||||
|
|
|
@ -27,17 +27,17 @@ class SetMitmService : public IMitmServiceObject {
|
||||||
GetRegionCode = 4,
|
GetRegionCode = 4,
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
sts::os::Mutex lock;
|
ams::os::Mutex lock;
|
||||||
OverrideLocale locale;
|
OverrideLocale locale;
|
||||||
bool got_locale;
|
bool got_locale;
|
||||||
public:
|
public:
|
||||||
SetMitmService(std::shared_ptr<Service> s, u64 pid, sts::ncm::TitleId tid) : IMitmServiceObject(s, pid, tid) {
|
SetMitmService(std::shared_ptr<Service> s, u64 pid, ams::ncm::TitleId tid) : IMitmServiceObject(s, pid, tid) {
|
||||||
this->got_locale = false;
|
this->got_locale = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ShouldMitm(u64 pid, sts::ncm::TitleId tid) {
|
static bool ShouldMitm(u64 pid, ams::ncm::TitleId tid) {
|
||||||
/* Mitm all applications. */
|
/* Mitm all applications. */
|
||||||
return tid == sts::ncm::TitleId::Ns || sts::ncm::IsApplicationTitleId(tid);
|
return tid == ams::ncm::TitleId::Ns || ams::ncm::IsApplicationTitleId(tid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
|
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include "setsys_firmware_version.hpp"
|
#include "setsys_firmware_version.hpp"
|
||||||
|
|
||||||
static sts::os::Mutex g_version_mutex;
|
static ams::os::Mutex g_version_mutex;
|
||||||
static bool g_got_version = false;
|
static bool g_got_version = false;
|
||||||
static SetSysFirmwareVersion g_ams_fw_version = {0};
|
static SetSysFirmwareVersion g_ams_fw_version = {0};
|
||||||
static SetSysFirmwareVersion g_fw_version = {0};
|
static SetSysFirmwareVersion g_fw_version = {0};
|
||||||
|
@ -32,7 +32,7 @@ void VersionManager::Initialize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mount firmware version data archive. */
|
/* Mount firmware version data archive. */
|
||||||
R_ASSERT(romfsMountFromDataArchive(static_cast<u64>(sts::ncm::TitleId::ArchiveSystemVersion), FsStorageId_NandSystem, "sysver"));
|
R_ASSERT(romfsMountFromDataArchive(static_cast<u64>(ams::ncm::TitleId::ArchiveSystemVersion), FsStorageId_NandSystem, "sysver"));
|
||||||
{
|
{
|
||||||
ON_SCOPE_EXIT { romfsUnmount("sysver"); };
|
ON_SCOPE_EXIT { romfsUnmount("sysver"); };
|
||||||
|
|
||||||
|
@ -40,11 +40,11 @@ void VersionManager::Initialize() {
|
||||||
|
|
||||||
/* Firmware version file must exist. */
|
/* Firmware version file must exist. */
|
||||||
FILE *f = fopen("sysver:/file", "rb");
|
FILE *f = fopen("sysver:/file", "rb");
|
||||||
STS_ASSERT(f != NULL);
|
AMS_ASSERT(f != NULL);
|
||||||
ON_SCOPE_EXIT { fclose(f); };
|
ON_SCOPE_EXIT { fclose(f); };
|
||||||
|
|
||||||
/* Must be possible to read firmware version from file. */
|
/* Must be possible to read firmware version from file. */
|
||||||
STS_ASSERT(fread(&fw_ver, sizeof(fw_ver), 1, f) == 1);
|
AMS_ASSERT(fread(&fw_ver, sizeof(fw_ver), 1, f) == 1);
|
||||||
|
|
||||||
g_fw_version = fw_ver;
|
g_fw_version = fw_ver;
|
||||||
g_ams_fw_version = fw_ver;
|
g_ams_fw_version = fw_ver;
|
||||||
|
@ -65,11 +65,11 @@ void VersionManager::Initialize() {
|
||||||
g_got_version = true;
|
g_got_version = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result VersionManager::GetFirmwareVersion(sts::ncm::TitleId title_id, SetSysFirmwareVersion *out) {
|
Result VersionManager::GetFirmwareVersion(ams::ncm::TitleId title_id, SetSysFirmwareVersion *out) {
|
||||||
VersionManager::Initialize();
|
VersionManager::Initialize();
|
||||||
|
|
||||||
/* Report atmosphere string to qlaunch, maintenance and nothing else. */
|
/* Report atmosphere string to qlaunch, maintenance and nothing else. */
|
||||||
if (title_id == sts::ncm::TitleId::AppletQlaunch || title_id == sts::ncm::TitleId::AppletMaintenanceMenu) {
|
if (title_id == ams::ncm::TitleId::AppletQlaunch || title_id == ams::ncm::TitleId::AppletMaintenanceMenu) {
|
||||||
*out = g_ams_fw_version;
|
*out = g_ams_fw_version;
|
||||||
} else {
|
} else {
|
||||||
*out = g_fw_version;
|
*out = g_fw_version;
|
||||||
|
|
|
@ -21,5 +21,5 @@
|
||||||
class VersionManager {
|
class VersionManager {
|
||||||
public:
|
public:
|
||||||
static void Initialize();
|
static void Initialize();
|
||||||
static Result GetFirmwareVersion(sts::ncm::TitleId title_id, SetSysFirmwareVersion *out);
|
static Result GetFirmwareVersion(ams::ncm::TitleId title_id, SetSysFirmwareVersion *out);
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,11 +29,11 @@ class SetSysMitmService : public IMitmServiceObject {
|
||||||
GetSettingsItemValue = 38,
|
GetSettingsItemValue = 38,
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
SetSysMitmService(std::shared_ptr<Service> s, u64 pid, sts::ncm::TitleId tid) : IMitmServiceObject(s, pid, tid) {
|
SetSysMitmService(std::shared_ptr<Service> s, u64 pid, ams::ncm::TitleId tid) : IMitmServiceObject(s, pid, tid) {
|
||||||
/* ... */
|
/* ... */
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ShouldMitm(u64 pid, sts::ncm::TitleId tid) {
|
static bool ShouldMitm(u64 pid, ams::ncm::TitleId tid) {
|
||||||
/* Mitm everything. */
|
/* Mitm everything. */
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ struct SettingsItemValue {
|
||||||
std::map<std::string, SettingsItemValue> g_settings_items;
|
std::map<std::string, SettingsItemValue> g_settings_items;
|
||||||
|
|
||||||
static bool g_threw_fatal = false;
|
static bool g_threw_fatal = false;
|
||||||
static sts::os::Thread g_fatal_thread;
|
static ams::os::Thread g_fatal_thread;
|
||||||
|
|
||||||
static void FatalThreadFunc(void *arg) {
|
static void FatalThreadFunc(void *arg) {
|
||||||
svcSleepThread(5000000000ULL);
|
svcSleepThread(5000000000ULL);
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
static FsFileSystem g_sd_filesystem = {0};
|
static FsFileSystem g_sd_filesystem = {0};
|
||||||
|
|
||||||
/* Non-autoclear events for SD/HID init. */
|
/* Non-autoclear events for SD/HID init. */
|
||||||
static sts::os::Event g_sd_event(false), g_hid_event(false);
|
static ams::os::Event g_sd_event(false), g_hid_event(false);
|
||||||
|
|
||||||
static std::vector<u64> g_mitm_flagged_tids;
|
static std::vector<u64> g_mitm_flagged_tids;
|
||||||
static std::vector<u64> g_disable_mitm_flagged_tids;
|
static std::vector<u64> g_disable_mitm_flagged_tids;
|
||||||
|
@ -55,7 +55,7 @@ static HblOverrideConfig g_hbl_override_config = {
|
||||||
.key_combination = KEY_R,
|
.key_combination = KEY_R,
|
||||||
.override_by_default = false
|
.override_by_default = false
|
||||||
},
|
},
|
||||||
.title_id = static_cast<u64>(sts::ncm::TitleId::AppletPhotoViewer),
|
.title_id = static_cast<u64>(ams::ncm::TitleId::AppletPhotoViewer),
|
||||||
.override_any_app = true
|
.override_any_app = true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ void Utils::InitializeThreadFunc(void *args) {
|
||||||
DoWithSmSession([&]() {
|
DoWithSmSession([&]() {
|
||||||
Handle tmp_hnd = 0;
|
Handle tmp_hnd = 0;
|
||||||
static const char * const required_active_services[] = {"pcv", "gpio", "pinmux", "psc:m"};
|
static const char * const required_active_services[] = {"pcv", "gpio", "pinmux", "psc:m"};
|
||||||
for (unsigned int i = 0; i < sts::util::size(required_active_services); i++) {
|
for (unsigned int i = 0; i < ams::util::size(required_active_services); i++) {
|
||||||
R_ASSERT(smGetServiceOriginal(&tmp_hnd, smEncodeName(required_active_services[i])));
|
R_ASSERT(smGetServiceOriginal(&tmp_hnd, smEncodeName(required_active_services[i])));
|
||||||
svcCloseHandle(tmp_hnd);
|
svcCloseHandle(tmp_hnd);
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ void Utils::InitializeThreadFunc(void *args) {
|
||||||
0x34, 0xC1, 0xA0, 0xC4, 0x82, 0x58, 0xF8, 0xB4, 0xFA, 0x9E, 0x5E, 0x6A, 0xDA, 0xFC, 0x7E, 0x4F,
|
0x34, 0xC1, 0xA0, 0xC4, 0x82, 0x58, 0xF8, 0xB4, 0xFA, 0x9E, 0x5E, 0x6A, 0xDA, 0xFC, 0x7E, 0x4F,
|
||||||
};
|
};
|
||||||
|
|
||||||
const u32 option = (partition == 3 && sts::spl::IsRecoveryBoot()) ? 0x4 : 0x1;
|
const u32 option = (partition == 3 && ams::spl::IsRecoveryBoot()) ? 0x4 : 0x1;
|
||||||
|
|
||||||
u8 access_key[0x10];
|
u8 access_key[0x10];
|
||||||
R_ASSERT(splCryptoGenerateAesKek(BisKekSource, key_generation, option, access_key));
|
R_ASSERT(splCryptoGenerateAesKek(BisKekSource, key_generation, option, access_key));
|
||||||
|
@ -455,13 +455,13 @@ Result Utils::SaveSdFileForAtmosphere(u64 title_id, const char *fn, void *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Utils::IsHblTid(u64 _tid) {
|
bool Utils::IsHblTid(u64 _tid) {
|
||||||
const sts::ncm::TitleId tid{_tid};
|
const ams::ncm::TitleId tid{_tid};
|
||||||
return (g_hbl_override_config.override_any_app && sts::ncm::IsApplicationTitleId(tid)) || (_tid == g_hbl_override_config.title_id);
|
return (g_hbl_override_config.override_any_app && ams::ncm::IsApplicationTitleId(tid)) || (_tid == g_hbl_override_config.title_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Utils::IsWebAppletTid(u64 _tid) {
|
bool Utils::IsWebAppletTid(u64 _tid) {
|
||||||
const sts::ncm::TitleId tid{_tid};
|
const ams::ncm::TitleId tid{_tid};
|
||||||
return tid == sts::ncm::TitleId::AppletWeb || tid == sts::ncm::TitleId::AppletOfflineWeb || tid == sts::ncm::TitleId::AppletLoginShare || tid == sts::ncm::TitleId::AppletWifiWebAuth;
|
return tid == ams::ncm::TitleId::AppletWeb || tid == ams::ncm::TitleId::AppletOfflineWeb || tid == ams::ncm::TitleId::AppletLoginShare || tid == ams::ncm::TitleId::AppletWifiWebAuth;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Utils::HasTitleFlag(u64 tid, const char *flag) {
|
bool Utils::HasTitleFlag(u64 tid, const char *flag) {
|
||||||
|
@ -550,7 +550,7 @@ static bool HasOverrideKey(OverrideKey *cfg) {
|
||||||
|
|
||||||
|
|
||||||
bool Utils::HasOverrideButton(u64 tid) {
|
bool Utils::HasOverrideButton(u64 tid) {
|
||||||
if ((!sts::ncm::IsApplicationTitleId(sts::ncm::TitleId{tid})) || (!IsSdInitialized())) {
|
if ((!ams::ncm::IsApplicationTitleId(ams::ncm::TitleId{tid})) || (!IsSdInitialized())) {
|
||||||
/* Disable button override disable for non-applications. */
|
/* Disable button override disable for non-applications. */
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "boot_calibration.hpp"
|
#include "boot_calibration.hpp"
|
||||||
#include "boot_i2c_utils.hpp"
|
#include "boot_i2c_utils.hpp"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
/* Include configuration into anonymous namespace. */
|
/* Include configuration into anonymous namespace. */
|
||||||
namespace {
|
namespace {
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include "i2c/driver/i2c_api.hpp"
|
#include "i2c/driver/i2c_api.hpp"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
class BatteryDriver {
|
class BatteryDriver {
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "boot_battery_icons.hpp"
|
#include "boot_battery_icons.hpp"
|
||||||
#include "boot_display.hpp"
|
#include "boot_display.hpp"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
/* Battery Display utilities. */
|
/* Battery Display utilities. */
|
||||||
void ShowLowBatteryIcon();
|
void ShowLowBatteryIcon();
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "boot_pmic_driver.hpp"
|
#include "boot_pmic_driver.hpp"
|
||||||
#include "boot_rtc_driver.hpp"
|
#include "boot_rtc_driver.hpp"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ namespace sts::boot {
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 GetBootReason() {
|
u32 GetBootReason() {
|
||||||
STS_ASSERT(g_detected_boot_reason);
|
AMS_ASSERT(g_detected_boot_reason);
|
||||||
return g_boot_reason;
|
return g_boot_reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
/* Boot Reason utilities. */
|
/* Boot Reason utilities. */
|
||||||
void DetectBootReason();
|
void DetectBootReason();
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace sts::boot::bq24193 {
|
namespace ams::boot::bq24193 {
|
||||||
|
|
||||||
constexpr u8 InputSourceControl = 0x00;
|
constexpr u8 InputSourceControl = 0x00;
|
||||||
constexpr u8 PowerOnConfiguration = 0x01;
|
constexpr u8 PowerOnConfiguration = 0x01;
|
||||||
|
@ -38,8 +38,8 @@ namespace sts::boot::bq24193 {
|
||||||
constexpr u32 ChargeVoltageLimitMax = 4208;
|
constexpr u32 ChargeVoltageLimitMax = 4208;
|
||||||
|
|
||||||
inline u8 EncodeChargeVoltageLimit(u32 voltage) {
|
inline u8 EncodeChargeVoltageLimit(u32 voltage) {
|
||||||
STS_ASSERT(voltage >= ChargeVoltageLimitMin);
|
AMS_ASSERT(voltage >= ChargeVoltageLimitMin);
|
||||||
STS_ASSERT(voltage <= ChargeVoltageLimitMax);
|
AMS_ASSERT(voltage <= ChargeVoltageLimitMax);
|
||||||
|
|
||||||
voltage -= ChargeVoltageLimitMin;
|
voltage -= ChargeVoltageLimitMin;
|
||||||
voltage >>= 4;
|
voltage >>= 4;
|
||||||
|
@ -54,8 +54,8 @@ namespace sts::boot::bq24193 {
|
||||||
constexpr u32 FastChargeCurrentLimitMax = 4544;
|
constexpr u32 FastChargeCurrentLimitMax = 4544;
|
||||||
|
|
||||||
inline u8 EncodeFastChargeCurrentLimit(u32 current) {
|
inline u8 EncodeFastChargeCurrentLimit(u32 current) {
|
||||||
STS_ASSERT(current >= FastChargeCurrentLimitMin);
|
AMS_ASSERT(current >= FastChargeCurrentLimitMin);
|
||||||
STS_ASSERT(current <= FastChargeCurrentLimitMax);
|
AMS_ASSERT(current <= FastChargeCurrentLimitMax);
|
||||||
|
|
||||||
current -= FastChargeCurrentLimitMin;
|
current -= FastChargeCurrentLimitMin;
|
||||||
current >>= 6;
|
current >>= 6;
|
||||||
|
@ -81,8 +81,8 @@ namespace sts::boot::bq24193 {
|
||||||
constexpr u32 PreChargeCurrentLimitMax = 2048;
|
constexpr u32 PreChargeCurrentLimitMax = 2048;
|
||||||
|
|
||||||
inline u8 EncodePreChargeCurrentLimit(u32 current) {
|
inline u8 EncodePreChargeCurrentLimit(u32 current) {
|
||||||
STS_ASSERT(current >= PreChargeCurrentLimitMin);
|
AMS_ASSERT(current >= PreChargeCurrentLimitMin);
|
||||||
STS_ASSERT(current <= PreChargeCurrentLimitMax);
|
AMS_ASSERT(current <= PreChargeCurrentLimitMax);
|
||||||
|
|
||||||
current -= PreChargeCurrentLimitMin;
|
current -= PreChargeCurrentLimitMin;
|
||||||
current >>= 7;
|
current >>= 7;
|
||||||
|
@ -97,8 +97,8 @@ namespace sts::boot::bq24193 {
|
||||||
constexpr u32 TerminationCurrentLimitMax = 2048;
|
constexpr u32 TerminationCurrentLimitMax = 2048;
|
||||||
|
|
||||||
inline u8 EncodeTerminationCurrentLimit(u32 current) {
|
inline u8 EncodeTerminationCurrentLimit(u32 current) {
|
||||||
STS_ASSERT(current >= TerminationCurrentLimitMin);
|
AMS_ASSERT(current >= TerminationCurrentLimitMin);
|
||||||
STS_ASSERT(current <= TerminationCurrentLimitMax);
|
AMS_ASSERT(current <= TerminationCurrentLimitMax);
|
||||||
|
|
||||||
current -= TerminationCurrentLimitMin;
|
current -= TerminationCurrentLimitMin;
|
||||||
current >>= 7;
|
current >>= 7;
|
||||||
|
@ -113,8 +113,8 @@ namespace sts::boot::bq24193 {
|
||||||
constexpr u32 MinimumSystemVoltageLimitMax = 3700;
|
constexpr u32 MinimumSystemVoltageLimitMax = 3700;
|
||||||
|
|
||||||
inline u8 EncodeMinimumSystemVoltageLimit(u32 voltage) {
|
inline u8 EncodeMinimumSystemVoltageLimit(u32 voltage) {
|
||||||
STS_ASSERT(voltage >= MinimumSystemVoltageLimitMin);
|
AMS_ASSERT(voltage >= MinimumSystemVoltageLimitMin);
|
||||||
STS_ASSERT(voltage <= MinimumSystemVoltageLimitMax);
|
AMS_ASSERT(voltage <= MinimumSystemVoltageLimitMax);
|
||||||
|
|
||||||
voltage -= MinimumSystemVoltageLimitMin;
|
voltage -= MinimumSystemVoltageLimitMin;
|
||||||
voltage /= 100;
|
voltage /= 100;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include "boot_calibration.hpp"
|
#include "boot_calibration.hpp"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ namespace sts::boot {
|
||||||
0xA001, 0x6C00, 0x7800, 0xB401, 0x5000, 0x9C01, 0x8801, 0x4400
|
0xA001, 0x6C00, 0x7800, 0xB401, 0x5000, 0x9C01, 0x8801, 0x4400
|
||||||
};
|
};
|
||||||
|
|
||||||
STS_ASSERT(data != nullptr);
|
AMS_ASSERT(data != nullptr);
|
||||||
|
|
||||||
u16 crc16 = 0x55AA;
|
u16 crc16 = 0x55AA;
|
||||||
const u8 *data_u8 = reinterpret_cast<const u8 *>(data);
|
const u8 *data_u8 = reinterpret_cast<const u8 *>(data);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
/* Calibration utilities. */
|
/* Calibration utilities. */
|
||||||
u32 GetBatteryVersion();
|
u32 GetBatteryVersion();
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "boot_change_voltage.hpp"
|
#include "boot_change_voltage.hpp"
|
||||||
#include "boot_pmc_wrapper.hpp"
|
#include "boot_pmc_wrapper.hpp"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
void ChangeGpioVoltageTo1_8v();;
|
void ChangeGpioVoltageTo1_8v();;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include "boot_charger_driver.hpp"
|
#include "boot_charger_driver.hpp"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
Result ChargerDriver::Read(u8 addr, u8 *out) {
|
Result ChargerDriver::Read(u8 addr, u8 *out) {
|
||||||
return ReadI2cRegister(this->i2c_session, reinterpret_cast<u8 *>(out), sizeof(*out), &addr, sizeof(addr));
|
return ReadI2cRegister(this->i2c_session, reinterpret_cast<u8 *>(out), sizeof(*out), &addr, sizeof(addr));
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include "gpio/gpio_utils.hpp"
|
#include "gpio/gpio_utils.hpp"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
class ChargerDriver {
|
class ChargerDriver {
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include "boot_pmic_driver.hpp"
|
#include "boot_pmic_driver.hpp"
|
||||||
#include "boot_power_utils.hpp"
|
#include "boot_power_utils.hpp"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ namespace sts::boot {
|
||||||
return &BatteryChargeParameters1;
|
return &BatteryChargeParameters1;
|
||||||
case 2:
|
case 2:
|
||||||
return &BatteryChargeParameters2;
|
return &BatteryChargeParameters2;
|
||||||
STS_UNREACHABLE_DEFAULT_CASE();
|
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ namespace sts::boot {
|
||||||
case CheckBatteryResult::Reboot:
|
case CheckBatteryResult::Reboot:
|
||||||
RebootSystem();
|
RebootSystem();
|
||||||
break;
|
break;
|
||||||
STS_UNREACHABLE_DEFAULT_CASE();
|
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
void CheckBatteryCharge();
|
void CheckBatteryCharge();
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "boot_check_clock.hpp"
|
#include "boot_check_clock.hpp"
|
||||||
#include "boot_power_utils.hpp"
|
#include "boot_power_utils.hpp"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
void CheckClock();
|
void CheckClock();
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "boot_pmc_wrapper.hpp"
|
#include "boot_pmc_wrapper.hpp"
|
||||||
#include "boot_registers_pmc.hpp"
|
#include "boot_registers_pmc.hpp"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
void SetInitialClockConfiguration();
|
void SetInitialClockConfiguration();
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include "boot_registers_pinmux.hpp"
|
#include "boot_registers_pinmux.hpp"
|
||||||
#include "boot_registers_pmc.hpp"
|
#include "boot_registers_pmc.hpp"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
/* Display configuration included into anonymous namespace. */
|
/* Display configuration included into anonymous namespace. */
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -110,7 +110,7 @@ namespace sts::boot {
|
||||||
case DsiSleepOrRegisterWriteKind_Sleep:
|
case DsiSleepOrRegisterWriteKind_Sleep:
|
||||||
svcSleepThread(1'000'000ul * u64(reg_writes[i].offset));
|
svcSleepThread(1'000'000ul * u64(reg_writes[i].offset));
|
||||||
break;
|
break;
|
||||||
STS_UNREACHABLE_DEFAULT_CASE();
|
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
/* Splash Screen/Display utilities. */
|
/* Splash Screen/Display utilities. */
|
||||||
void InitializeDisplay();
|
void InitializeDisplay();
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include "gpio/gpio_utils.hpp"
|
#include "gpio/gpio_utils.hpp"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
void SetFanEnabled();
|
void SetFanEnabled();
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include "boot_i2c_utils.hpp"
|
#include "boot_i2c_utils.hpp"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ namespace sts::boot {
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ReadI2cRegister(i2c::driver::Session &session, u8 *dst, size_t dst_size, const u8 *cmd, size_t cmd_size) {
|
Result ReadI2cRegister(i2c::driver::Session &session, u8 *dst, size_t dst_size, const u8 *cmd, size_t cmd_size) {
|
||||||
STS_ASSERT(dst != nullptr && dst_size > 0);
|
AMS_ASSERT(dst != nullptr && dst_size > 0);
|
||||||
STS_ASSERT(cmd != nullptr && cmd_size > 0);
|
AMS_ASSERT(cmd != nullptr && cmd_size > 0);
|
||||||
|
|
||||||
u8 cmd_list[i2c::CommandListFormatter::MaxCommandListSize];
|
u8 cmd_list[i2c::CommandListFormatter::MaxCommandListSize];
|
||||||
|
|
||||||
|
@ -56,8 +56,8 @@ namespace sts::boot {
|
||||||
}
|
}
|
||||||
|
|
||||||
Result WriteI2cRegister(i2c::driver::Session &session, const u8 *src, size_t src_size, const u8 *cmd, size_t cmd_size) {
|
Result WriteI2cRegister(i2c::driver::Session &session, const u8 *src, size_t src_size, const u8 *cmd, size_t cmd_size) {
|
||||||
STS_ASSERT(src != nullptr && src_size > 0);
|
AMS_ASSERT(src != nullptr && src_size > 0);
|
||||||
STS_ASSERT(cmd != nullptr && cmd_size > 0);
|
AMS_ASSERT(cmd != nullptr && cmd_size > 0);
|
||||||
|
|
||||||
u8 cmd_list[0x20];
|
u8 cmd_list[0x20];
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include "i2c/driver/i2c_api.hpp"
|
#include "i2c/driver/i2c_api.hpp"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
/* I2C Utilities. */
|
/* I2C Utilities. */
|
||||||
Result ReadI2cRegister(i2c::driver::Session &session, u8 *dst, size_t dst_size, const u8 *cmd, size_t cmd_size);
|
Result ReadI2cRegister(i2c::driver::Session &session, u8 *dst, size_t dst_size, const u8 *cmd, size_t cmd_size);
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
#include "boot_power_utils.hpp"
|
#include "boot_power_utils.hpp"
|
||||||
|
|
||||||
using namespace sts;
|
using namespace ams;
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
extern u32 __start__;
|
extern u32 __start__;
|
||||||
|
@ -61,24 +61,24 @@ extern "C" {
|
||||||
void __libnx_exception_handler(ThreadExceptionDump *ctx);
|
void __libnx_exception_handler(ThreadExceptionDump *ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace sts::ams {
|
namespace ams {
|
||||||
|
|
||||||
ncm::TitleId StratosphereTitleId = ncm::TitleId::Boot;
|
ncm::TitleId CurrentTitleId = ncm::TitleId::Boot;
|
||||||
|
|
||||||
void ExceptionHandler(FatalErrorContext *ctx) {
|
void ExceptionHandler(FatalErrorContext *ctx) {
|
||||||
/* We're boot sysmodule, so manually reboot to fatal error. */
|
/* We're boot sysmodule, so manually reboot to fatal error. */
|
||||||
boot::RebootForFatalError(ctx);
|
boot::RebootForFatalError(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
namespace result {
|
||||||
|
|
||||||
namespace sts::result {
|
bool CallFatalOnResultAssertion = false;
|
||||||
|
|
||||||
bool CallFatalOnResultAssertion = false;
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using namespace sts;
|
using namespace ams;
|
||||||
|
|
||||||
void __libnx_exception_handler(ThreadExceptionDump *ctx) {
|
void __libnx_exception_handler(ThreadExceptionDump *ctx) {
|
||||||
ams::CrashHandler(ctx);
|
ams::CrashHandler(ctx);
|
||||||
|
|
|
@ -21,9 +21,9 @@
|
||||||
#include "i2c/driver/impl/i2c_pcv.hpp"
|
#include "i2c/driver/impl/i2c_pcv.hpp"
|
||||||
#include "i2c/driver/impl/i2c_registers.hpp"
|
#include "i2c/driver/impl/i2c_registers.hpp"
|
||||||
|
|
||||||
using namespace sts::i2c::driver::impl;
|
using namespace ams::i2c::driver::impl;
|
||||||
|
|
||||||
namespace sts::pcv {
|
namespace ams::pcv {
|
||||||
|
|
||||||
void Initialize() {
|
void Initialize() {
|
||||||
/* Don't do anything. */
|
/* Don't do anything. */
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include <stratosphere/spl/smc/spl_smc.hpp>
|
#include <stratosphere/spl/smc/spl_smc.hpp>
|
||||||
#include "boot_pmc_wrapper.hpp"
|
#include "boot_pmc_wrapper.hpp"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -41,12 +41,12 @@ namespace sts::boot {
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 ReadPmcRegister(u32 phys_addr) {
|
u32 ReadPmcRegister(u32 phys_addr) {
|
||||||
STS_ASSERT(IsValidPmcAddress(phys_addr));
|
AMS_ASSERT(IsValidPmcAddress(phys_addr));
|
||||||
return ReadWriteRegisterImpl(phys_addr, 0, 0);
|
return ReadWriteRegisterImpl(phys_addr, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WritePmcRegister(u32 phys_addr, u32 value, u32 mask) {
|
void WritePmcRegister(u32 phys_addr, u32 value, u32 mask) {
|
||||||
STS_ASSERT(IsValidPmcAddress(phys_addr));
|
AMS_ASSERT(IsValidPmcAddress(phys_addr));
|
||||||
ReadWriteRegisterImpl(phys_addr, value, mask);
|
ReadWriteRegisterImpl(phys_addr, value, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
/* PMC Access Utilities. */
|
/* PMC Access Utilities. */
|
||||||
u32 ReadPmcRegister(u32 phys_addr);
|
u32 ReadPmcRegister(u32 phys_addr);
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "boot_i2c_utils.hpp"
|
#include "boot_i2c_utils.hpp"
|
||||||
#include "boot_pmic_driver.hpp"
|
#include "boot_pmic_driver.hpp"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
void PmicDriver::ShutdownSystem() {
|
void PmicDriver::ShutdownSystem() {
|
||||||
R_ASSERT(this->ShutdownSystem(false));
|
R_ASSERT(this->ShutdownSystem(false));
|
||||||
|
@ -89,7 +89,7 @@ namespace sts::boot {
|
||||||
|
|
||||||
/* Allow up to 5 seconds for shutdown/reboot to take place. */
|
/* Allow up to 5 seconds for shutdown/reboot to take place. */
|
||||||
svcSleepThread(5'000'000'000ul);
|
svcSleepThread(5'000'000'000ul);
|
||||||
STS_ASSERT(false);
|
AMS_ASSERT(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PmicDriver::FinalizeBattery(BatteryDriver *battery_driver) {
|
void PmicDriver::FinalizeBattery(BatteryDriver *battery_driver) {
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include "boot_battery_driver.hpp"
|
#include "boot_battery_driver.hpp"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
/* Driver object. */
|
/* Driver object. */
|
||||||
class PmicDriver {
|
class PmicDriver {
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "boot_power_utils.hpp"
|
#include "boot_power_utils.hpp"
|
||||||
#include "fusee-primary_bin.h"
|
#include "fusee-primary_bin.h"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ namespace sts::boot {
|
||||||
|
|
||||||
/* Overwrite all of IRAM with FFs. */
|
/* Overwrite all of IRAM with FFs. */
|
||||||
for (size_t ofs = 0; ofs < IramSize; ofs += sizeof(g_work_page)) {
|
for (size_t ofs = 0; ofs < IramSize; ofs += sizeof(g_work_page)) {
|
||||||
ams::CopyToIram(IramBase + ofs, g_work_page, sizeof(g_work_page));
|
exosphere::CopyToIram(IramBase + ofs, g_work_page, sizeof(g_work_page));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ namespace sts::boot {
|
||||||
/* Copy in payload. */
|
/* Copy in payload. */
|
||||||
for (size_t ofs = 0; ofs < fusee_primary_bin_size; ofs += 0x1000) {
|
for (size_t ofs = 0; ofs < fusee_primary_bin_size; ofs += 0x1000) {
|
||||||
std::memcpy(g_work_page, &fusee_primary_bin[ofs], std::min(static_cast<size_t>(fusee_primary_bin_size - ofs), size_t(0x1000)));
|
std::memcpy(g_work_page, &fusee_primary_bin[ofs], std::min(static_cast<size_t>(fusee_primary_bin_size - ofs), size_t(0x1000)));
|
||||||
ams::CopyToIram(IramPayloadBase + ofs, g_work_page, 0x1000);
|
exosphere::CopyToIram(IramPayloadBase + ofs, g_work_page, 0x1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,10 +60,10 @@ namespace sts::boot {
|
||||||
if (ctx != nullptr) {
|
if (ctx != nullptr) {
|
||||||
std::memset(g_work_page, 0xCC, sizeof(g_work_page));
|
std::memset(g_work_page, 0xCC, sizeof(g_work_page));
|
||||||
std::memcpy(g_work_page, ctx, sizeof(*ctx));
|
std::memcpy(g_work_page, ctx, sizeof(*ctx));
|
||||||
ams::CopyToIram(IramPayloadBase + IramPayloadMaxSize, g_work_page, sizeof(g_work_page));
|
exosphere::CopyToIram(IramPayloadBase + IramPayloadMaxSize, g_work_page, sizeof(g_work_page));
|
||||||
}
|
}
|
||||||
|
|
||||||
ams::ForceRebootToIramPayload();
|
exosphere::ForceRebootToIramPayload();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
/* Power utilities. */
|
/* Power utilities. */
|
||||||
void RebootSystem();
|
void RebootSystem();
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "boot_power_utils.hpp"
|
#include "boot_power_utils.hpp"
|
||||||
#include "boot_repair_boot_images.hpp"
|
#include "boot_repair_boot_images.hpp"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
void CheckAndRepairBootImages();
|
void CheckAndRepairBootImages();
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include "boot_rtc_driver.hpp"
|
#include "boot_rtc_driver.hpp"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
Result RtcDriver::ReadRtcRegister(u8 *out, u8 address) {
|
Result RtcDriver::ReadRtcRegister(u8 *out, u8 address) {
|
||||||
const u8 update_addr = 0x04;
|
const u8 update_addr = 0x04;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include "boot_i2c_utils.hpp"
|
#include "boot_i2c_utils.hpp"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
class RtcDriver {
|
class RtcDriver {
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "boot_display.hpp"
|
#include "boot_display.hpp"
|
||||||
#include "boot_splash_screen.hpp"
|
#include "boot_splash_screen.hpp"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
void ShowSplashScreen();
|
void ShowSplashScreen();
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include "boot_registers_pmc.hpp"
|
#include "boot_registers_pmc.hpp"
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
/* Include configuration into anonymous namespace. */
|
/* Include configuration into anonymous namespace. */
|
||||||
namespace {
|
namespace {
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
namespace sts::boot {
|
namespace ams::boot {
|
||||||
|
|
||||||
void SetInitialWakePinConfiguration();
|
void SetInitialWakePinConfiguration();
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include "gpio_initial_configuration.hpp"
|
#include "gpio_initial_configuration.hpp"
|
||||||
#include "gpio_utils.hpp"
|
#include "gpio_utils.hpp"
|
||||||
|
|
||||||
namespace sts::gpio {
|
namespace ams::gpio {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ namespace sts::gpio {
|
||||||
num_configs = NumInitialConfigsIowa;
|
num_configs = NumInitialConfigsIowa;
|
||||||
break;
|
break;
|
||||||
/* Unknown hardware type, we can't proceed. */
|
/* Unknown hardware type, we can't proceed. */
|
||||||
STS_UNREACHABLE_DEFAULT_CASE();
|
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Until 2.0.0, the GPIO map for Icosa was used for all hardware types. */
|
/* Until 2.0.0, the GPIO map for Icosa was used for all hardware types. */
|
||||||
|
@ -79,7 +79,7 @@ namespace sts::gpio {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure we found an appropriate config. */
|
/* Ensure we found an appropriate config. */
|
||||||
STS_ASSERT(configs != nullptr);
|
AMS_ASSERT(configs != nullptr);
|
||||||
|
|
||||||
for (size_t i = 0; i < num_configs; i++) {
|
for (size_t i = 0; i < num_configs; i++) {
|
||||||
/* Configure the GPIO. */
|
/* Configure the GPIO. */
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
namespace sts::gpio {
|
namespace ams::gpio {
|
||||||
|
|
||||||
void SetInitialConfiguration();
|
void SetInitialConfiguration();
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
#include "gpio_utils.hpp"
|
#include "gpio_utils.hpp"
|
||||||
|
|
||||||
namespace sts::gpio {
|
namespace ams::gpio {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ namespace sts::gpio {
|
||||||
|
|
||||||
/* Helpers. */
|
/* Helpers. */
|
||||||
inline u32 GetPadDescriptor(u32 gpio_pad_name) {
|
inline u32 GetPadDescriptor(u32 gpio_pad_name) {
|
||||||
STS_ASSERT(gpio_pad_name < PadNameMax);
|
AMS_ASSERT(gpio_pad_name < PadNameMax);
|
||||||
return Map[gpio_pad_name];
|
return Map[gpio_pad_name];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
namespace sts::gpio {
|
namespace ams::gpio {
|
||||||
|
|
||||||
/* GPIO Utilities. */
|
/* GPIO Utilities. */
|
||||||
u32 Configure(u32 gpio_pad_name);
|
u32 Configure(u32 gpio_pad_name);
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "i2c_api.hpp"
|
#include "i2c_api.hpp"
|
||||||
#include "impl/i2c_resource_manager.hpp"
|
#include "impl/i2c_resource_manager.hpp"
|
||||||
|
|
||||||
namespace sts::i2c::driver {
|
namespace ams::i2c::driver {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ namespace sts::i2c::driver {
|
||||||
svcSleepThread(us * 1'000ul);
|
svcSleepThread(us * 1'000ul);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
STS_UNREACHABLE_DEFAULT_CASE();
|
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||||
}
|
}
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ namespace sts::i2c::driver {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void CheckInitialized() {
|
inline void CheckInitialized() {
|
||||||
STS_ASSERT(GetResourceManager().IsInitialized());
|
AMS_ASSERT(GetResourceManager().IsInitialized());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ namespace sts::i2c::driver {
|
||||||
/* Session management. */
|
/* Session management. */
|
||||||
void OpenSession(Session *out_session, I2cDevice device) {
|
void OpenSession(Session *out_session, I2cDevice device) {
|
||||||
CheckInitialized();
|
CheckInitialized();
|
||||||
STS_ASSERT(impl::IsDeviceSupported(device));
|
AMS_ASSERT(impl::IsDeviceSupported(device));
|
||||||
|
|
||||||
const auto bus = impl::GetDeviceBus(device);
|
const auto bus = impl::GetDeviceBus(device);
|
||||||
const auto slave_address = impl::GetDeviceSlaveAddress(device);
|
const auto slave_address = impl::GetDeviceSlaveAddress(device);
|
||||||
|
@ -123,8 +123,8 @@ namespace sts::i2c::driver {
|
||||||
/* Communication. */
|
/* Communication. */
|
||||||
Result Send(Session &session, const void *src, size_t size, I2cTransactionOption option) {
|
Result Send(Session &session, const void *src, size_t size, I2cTransactionOption option) {
|
||||||
CheckInitialized();
|
CheckInitialized();
|
||||||
STS_ASSERT(src != nullptr);
|
AMS_ASSERT(src != nullptr);
|
||||||
STS_ASSERT(size > 0);
|
AMS_ASSERT(size > 0);
|
||||||
|
|
||||||
std::scoped_lock<os::Mutex &> lk(GetResourceManager().GetTransactionMutex(impl::ConvertFromIndex(session.bus_idx)));
|
std::scoped_lock<os::Mutex &> lk(GetResourceManager().GetTransactionMutex(impl::ConvertFromIndex(session.bus_idx)));
|
||||||
return GetResourceManager().GetSession(session.session_id).DoTransactionWithRetry(nullptr, src, size, option, impl::Command::Send);
|
return GetResourceManager().GetSession(session.session_id).DoTransactionWithRetry(nullptr, src, size, option, impl::Command::Send);
|
||||||
|
@ -132,8 +132,8 @@ namespace sts::i2c::driver {
|
||||||
|
|
||||||
Result Receive(Session &session, void *dst, size_t size, I2cTransactionOption option) {
|
Result Receive(Session &session, void *dst, size_t size, I2cTransactionOption option) {
|
||||||
CheckInitialized();
|
CheckInitialized();
|
||||||
STS_ASSERT(dst != nullptr);
|
AMS_ASSERT(dst != nullptr);
|
||||||
STS_ASSERT(size > 0);
|
AMS_ASSERT(size > 0);
|
||||||
|
|
||||||
std::scoped_lock<os::Mutex &> lk(GetResourceManager().GetTransactionMutex(impl::ConvertFromIndex(session.bus_idx)));
|
std::scoped_lock<os::Mutex &> lk(GetResourceManager().GetTransactionMutex(impl::ConvertFromIndex(session.bus_idx)));
|
||||||
return GetResourceManager().GetSession(session.session_id).DoTransactionWithRetry(dst, nullptr, size, option, impl::Command::Receive);
|
return GetResourceManager().GetSession(session.session_id).DoTransactionWithRetry(dst, nullptr, size, option, impl::Command::Receive);
|
||||||
|
@ -141,8 +141,8 @@ namespace sts::i2c::driver {
|
||||||
|
|
||||||
Result ExecuteCommandList(Session &session, void *dst, size_t size, const void *cmd_list, size_t cmd_list_size) {
|
Result ExecuteCommandList(Session &session, void *dst, size_t size, const void *cmd_list, size_t cmd_list_size) {
|
||||||
CheckInitialized();
|
CheckInitialized();
|
||||||
STS_ASSERT(dst != nullptr && size > 0);
|
AMS_ASSERT(dst != nullptr && size > 0);
|
||||||
STS_ASSERT(cmd_list != nullptr && cmd_list_size > 0);
|
AMS_ASSERT(cmd_list != nullptr && cmd_list_size > 0);
|
||||||
|
|
||||||
u8 *cur_dst = static_cast<u8 *>(dst);
|
u8 *cur_dst = static_cast<u8 *>(dst);
|
||||||
const u8 *cur_cmd = static_cast<const u8 *>(cmd_list);
|
const u8 *cur_cmd = static_cast<const u8 *>(cmd_list);
|
||||||
|
@ -150,7 +150,7 @@ namespace sts::i2c::driver {
|
||||||
|
|
||||||
while (cur_cmd < cmd_list_end) {
|
while (cur_cmd < cmd_list_end) {
|
||||||
Command cmd = static_cast<Command>((*cur_cmd) & 3);
|
Command cmd = static_cast<Command>((*cur_cmd) & 3);
|
||||||
STS_ASSERT(cmd < Command::Count);
|
AMS_ASSERT(cmd < Command::Count);
|
||||||
|
|
||||||
R_TRY(g_cmd_handlers[static_cast<size_t>(cmd)](&cur_cmd, &cur_dst, session));
|
R_TRY(g_cmd_handlers[static_cast<size_t>(cmd)](&cur_cmd, &cur_dst, session));
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "../i2c_types.hpp"
|
#include "../i2c_types.hpp"
|
||||||
#include "../i2c_command_list.hpp"
|
#include "../i2c_command_list.hpp"
|
||||||
|
|
||||||
namespace sts::i2c::driver {
|
namespace ams::i2c::driver {
|
||||||
|
|
||||||
struct Session {
|
struct Session {
|
||||||
size_t bus_idx;
|
size_t bus_idx;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "i2c_pcv.hpp"
|
#include "i2c_pcv.hpp"
|
||||||
#include "i2c_bus_accessor.hpp"
|
#include "i2c_bus_accessor.hpp"
|
||||||
|
|
||||||
namespace sts::i2c::driver::impl {
|
namespace ams::i2c::driver::impl {
|
||||||
|
|
||||||
void BusAccessor::Open(Bus bus, SpeedMode speed_mode) {
|
void BusAccessor::Open(Bus bus, SpeedMode speed_mode) {
|
||||||
std::scoped_lock lk(this->open_mutex);
|
std::scoped_lock lk(this->open_mutex);
|
||||||
|
@ -29,7 +29,7 @@ namespace sts::i2c::driver::impl {
|
||||||
|
|
||||||
/* Ensure we're good if this isn't our first session. */
|
/* Ensure we're good if this isn't our first session. */
|
||||||
if (this->open_sessions > 1) {
|
if (this->open_sessions > 1) {
|
||||||
STS_ASSERT(this->speed_mode == speed_mode);
|
AMS_ASSERT(this->speed_mode == speed_mode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ namespace sts::i2c::driver::impl {
|
||||||
0x46, 0x74, 0x7C, 0x98, 0x55, 0x5F
|
0x46, 0x74, 0x7C, 0x98, 0x55, 0x5F
|
||||||
};
|
};
|
||||||
const auto index = ConvertToIndex(bus);
|
const auto index = ConvertToIndex(bus);
|
||||||
STS_ASSERT(index < util::size(s_interrupts));
|
AMS_ASSERT(index < util::size(s_interrupts));
|
||||||
R_ASSERT(this->interrupt_event.Initialize(s_interrupts[index], false));
|
R_ASSERT(this->interrupt_event.Initialize(s_interrupts[index], false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ namespace sts::i2c::driver::impl {
|
||||||
src_div = 0x02;
|
src_div = 0x02;
|
||||||
debounce = 0;
|
debounce = 0;
|
||||||
break;
|
break;
|
||||||
STS_UNREACHABLE_DEFAULT_CASE();
|
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (speed_mode == SpeedMode::HighSpeed) {
|
if (speed_mode == SpeedMode::HighSpeed) {
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "i2c_driver_types.hpp"
|
#include "i2c_driver_types.hpp"
|
||||||
#include "i2c_registers.hpp"
|
#include "i2c_registers.hpp"
|
||||||
|
|
||||||
namespace sts::i2c::driver::impl {
|
namespace ams::i2c::driver::impl {
|
||||||
|
|
||||||
class BusAccessor {
|
class BusAccessor {
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include "i2c_driver_types.hpp"
|
#include "i2c_driver_types.hpp"
|
||||||
|
|
||||||
namespace sts::i2c::driver::impl {
|
namespace ams::i2c::driver::impl {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -88,37 +88,37 @@ namespace sts::i2c::driver::impl {
|
||||||
|
|
||||||
Bus GetDeviceBus(I2cDevice dev) {
|
Bus GetDeviceBus(I2cDevice dev) {
|
||||||
const size_t dev_idx = GetDeviceIndex(dev);
|
const size_t dev_idx = GetDeviceIndex(dev);
|
||||||
STS_ASSERT(dev_idx != DeviceInvalidIndex);
|
AMS_ASSERT(dev_idx != DeviceInvalidIndex);
|
||||||
return g_device_configs[dev_idx].bus;
|
return g_device_configs[dev_idx].bus;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 GetDeviceSlaveAddress(I2cDevice dev) {
|
u32 GetDeviceSlaveAddress(I2cDevice dev) {
|
||||||
const size_t dev_idx = GetDeviceIndex(dev);
|
const size_t dev_idx = GetDeviceIndex(dev);
|
||||||
STS_ASSERT(dev_idx != DeviceInvalidIndex);
|
AMS_ASSERT(dev_idx != DeviceInvalidIndex);
|
||||||
return g_device_configs[dev_idx].slave_address;
|
return g_device_configs[dev_idx].slave_address;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddressingMode GetDeviceAddressingMode(I2cDevice dev) {
|
AddressingMode GetDeviceAddressingMode(I2cDevice dev) {
|
||||||
const size_t dev_idx = GetDeviceIndex(dev);
|
const size_t dev_idx = GetDeviceIndex(dev);
|
||||||
STS_ASSERT(dev_idx != DeviceInvalidIndex);
|
AMS_ASSERT(dev_idx != DeviceInvalidIndex);
|
||||||
return g_device_configs[dev_idx].addressing_mode;
|
return g_device_configs[dev_idx].addressing_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpeedMode GetDeviceSpeedMode(I2cDevice dev) {
|
SpeedMode GetDeviceSpeedMode(I2cDevice dev) {
|
||||||
const size_t dev_idx = GetDeviceIndex(dev);
|
const size_t dev_idx = GetDeviceIndex(dev);
|
||||||
STS_ASSERT(dev_idx != DeviceInvalidIndex);
|
AMS_ASSERT(dev_idx != DeviceInvalidIndex);
|
||||||
return g_device_configs[dev_idx].speed_mode;
|
return g_device_configs[dev_idx].speed_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 GetDeviceMaxRetries(I2cDevice dev) {
|
u32 GetDeviceMaxRetries(I2cDevice dev) {
|
||||||
const size_t dev_idx = GetDeviceIndex(dev);
|
const size_t dev_idx = GetDeviceIndex(dev);
|
||||||
STS_ASSERT(dev_idx != DeviceInvalidIndex);
|
AMS_ASSERT(dev_idx != DeviceInvalidIndex);
|
||||||
return g_device_configs[dev_idx].max_retries;
|
return g_device_configs[dev_idx].max_retries;
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 GetDeviceRetryWaitTime(I2cDevice dev) {
|
u64 GetDeviceRetryWaitTime(I2cDevice dev) {
|
||||||
const size_t dev_idx = GetDeviceIndex(dev);
|
const size_t dev_idx = GetDeviceIndex(dev);
|
||||||
STS_ASSERT(dev_idx != DeviceInvalidIndex);
|
AMS_ASSERT(dev_idx != DeviceInvalidIndex);
|
||||||
return g_device_configs[dev_idx].retry_wait_time;
|
return g_device_configs[dev_idx].retry_wait_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include "../../i2c_types.hpp"
|
#include "../../i2c_types.hpp"
|
||||||
|
|
||||||
namespace sts::i2c::driver::impl {
|
namespace ams::i2c::driver::impl {
|
||||||
|
|
||||||
enum class Command {
|
enum class Command {
|
||||||
Send = 0,
|
Send = 0,
|
||||||
|
@ -43,7 +43,7 @@ namespace sts::i2c::driver::impl {
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr inline Bus ConvertFromIndex(size_t idx) {
|
constexpr inline Bus ConvertFromIndex(size_t idx) {
|
||||||
STS_ASSERT(idx < static_cast<size_t>(Bus::Count));
|
AMS_ASSERT(idx < static_cast<size_t>(Bus::Count));
|
||||||
return static_cast<Bus>(idx);
|
return static_cast<Bus>(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ namespace sts::i2c::driver::impl {
|
||||||
return PcvModule_I2C5;
|
return PcvModule_I2C5;
|
||||||
case Bus::I2C6:
|
case Bus::I2C6:
|
||||||
return PcvModule_I2C6;
|
return PcvModule_I2C6;
|
||||||
STS_UNREACHABLE_DEFAULT_CASE();
|
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ namespace sts::i2c::driver::impl {
|
||||||
return Bus::I2C5;
|
return Bus::I2C5;
|
||||||
case PcvModule_I2C6:
|
case PcvModule_I2C6:
|
||||||
return Bus::I2C6;
|
return Bus::I2C6;
|
||||||
STS_UNREACHABLE_DEFAULT_CASE();
|
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
/* This forward declares the functionality from pcv that i2c::driver uses. */
|
/* This forward declares the functionality from pcv that i2c::driver uses. */
|
||||||
/* This allows for overriding at compile-time (e.g., for boot sysmodule). */
|
/* This allows for overriding at compile-time (e.g., for boot sysmodule). */
|
||||||
namespace sts::pcv {
|
namespace ams::pcv {
|
||||||
|
|
||||||
void Initialize();
|
void Initialize();
|
||||||
void Finalize();
|
void Finalize();
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include "i2c_driver_types.hpp"
|
#include "i2c_driver_types.hpp"
|
||||||
|
|
||||||
namespace sts::i2c::driver::impl {
|
namespace ams::i2c::driver::impl {
|
||||||
|
|
||||||
struct Registers {
|
struct Registers {
|
||||||
volatile u32 I2C_I2C_CNFG_0;
|
volatile u32 I2C_I2C_CNFG_0;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "i2c_pcv.hpp"
|
#include "i2c_pcv.hpp"
|
||||||
#include "i2c_resource_manager.hpp"
|
#include "i2c_resource_manager.hpp"
|
||||||
|
|
||||||
namespace sts::i2c::driver::impl {
|
namespace ams::i2c::driver::impl {
|
||||||
|
|
||||||
void ResourceManager::Initialize() {
|
void ResourceManager::Initialize() {
|
||||||
std::scoped_lock lk(this->initialize_mutex);
|
std::scoped_lock lk(this->initialize_mutex);
|
||||||
|
@ -29,7 +29,7 @@ namespace sts::i2c::driver::impl {
|
||||||
|
|
||||||
void ResourceManager::Finalize() {
|
void ResourceManager::Finalize() {
|
||||||
std::scoped_lock lk(this->initialize_mutex);
|
std::scoped_lock lk(this->initialize_mutex);
|
||||||
STS_ASSERT(this->ref_cnt > 0);
|
AMS_ASSERT(this->ref_cnt > 0);
|
||||||
this->ref_cnt--;
|
this->ref_cnt--;
|
||||||
if (this->ref_cnt > 0) {
|
if (this->ref_cnt > 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -59,11 +59,11 @@ namespace sts::i2c::driver::impl {
|
||||||
/* Get, open session. */
|
/* Get, open session. */
|
||||||
{
|
{
|
||||||
std::scoped_lock lk(this->session_open_mutex);
|
std::scoped_lock lk(this->session_open_mutex);
|
||||||
STS_ASSERT(out_session != nullptr);
|
AMS_ASSERT(out_session != nullptr);
|
||||||
STS_ASSERT(bus < Bus::Count);
|
AMS_ASSERT(bus < Bus::Count);
|
||||||
|
|
||||||
session_id = GetFreeSessionId();
|
session_id = GetFreeSessionId();
|
||||||
STS_ASSERT(session_id != InvalidSessionId);
|
AMS_ASSERT(session_id != InvalidSessionId);
|
||||||
|
|
||||||
|
|
||||||
if ((bus == Bus::I2C2 || bus == Bus::I2C3) && (this->bus_accessors[ConvertToIndex(Bus::I2C2)].GetOpenSessions() == 0 && this->bus_accessors[ConvertToIndex(Bus::I2C3)].GetOpenSessions() == 0)) {
|
if ((bus == Bus::I2C2 || bus == Bus::I2C3) && (this->bus_accessors[ConvertToIndex(Bus::I2C2)].GetOpenSessions() == 0 && this->bus_accessors[ConvertToIndex(Bus::I2C3)].GetOpenSessions() == 0)) {
|
||||||
|
@ -90,7 +90,7 @@ namespace sts::i2c::driver::impl {
|
||||||
/* Get, open session. */
|
/* Get, open session. */
|
||||||
{
|
{
|
||||||
std::scoped_lock lk(this->session_open_mutex);
|
std::scoped_lock lk(this->session_open_mutex);
|
||||||
STS_ASSERT(this->sessions[session.session_id].IsOpen());
|
AMS_ASSERT(this->sessions[session.session_id].IsOpen());
|
||||||
|
|
||||||
this->sessions[session.session_id].Close();
|
this->sessions[session.session_id].Close();
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ namespace sts::i2c::driver::impl {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourceManager::SuspendBuses() {
|
void ResourceManager::SuspendBuses() {
|
||||||
STS_ASSERT(this->ref_cnt > 0);
|
AMS_ASSERT(this->ref_cnt > 0);
|
||||||
|
|
||||||
if (!this->suspended) {
|
if (!this->suspended) {
|
||||||
{
|
{
|
||||||
|
@ -128,7 +128,7 @@ namespace sts::i2c::driver::impl {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourceManager::ResumeBuses() {
|
void ResourceManager::ResumeBuses() {
|
||||||
STS_ASSERT(this->ref_cnt > 0);
|
AMS_ASSERT(this->ref_cnt > 0);
|
||||||
|
|
||||||
if (this->suspended) {
|
if (this->suspended) {
|
||||||
if (this->bus_accessors[ConvertToIndex(Bus::I2C2)].GetOpenSessions() > 0 || this->bus_accessors[ConvertToIndex(Bus::I2C3)].GetOpenSessions() > 0) {
|
if (this->bus_accessors[ConvertToIndex(Bus::I2C2)].GetOpenSessions() > 0 || this->bus_accessors[ConvertToIndex(Bus::I2C3)].GetOpenSessions() > 0) {
|
||||||
|
@ -151,7 +151,7 @@ namespace sts::i2c::driver::impl {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourceManager::SuspendPowerBus() {
|
void ResourceManager::SuspendPowerBus() {
|
||||||
STS_ASSERT(this->ref_cnt > 0);
|
AMS_ASSERT(this->ref_cnt > 0);
|
||||||
std::scoped_lock lk(this->session_open_mutex);
|
std::scoped_lock lk(this->session_open_mutex);
|
||||||
|
|
||||||
if (!this->power_bus_suspended) {
|
if (!this->power_bus_suspended) {
|
||||||
|
@ -163,7 +163,7 @@ namespace sts::i2c::driver::impl {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourceManager::ResumePowerBus() {
|
void ResourceManager::ResumePowerBus() {
|
||||||
STS_ASSERT(this->ref_cnt > 0);
|
AMS_ASSERT(this->ref_cnt > 0);
|
||||||
std::scoped_lock lk(this->session_open_mutex);
|
std::scoped_lock lk(this->session_open_mutex);
|
||||||
|
|
||||||
if (this->power_bus_suspended) {
|
if (this->power_bus_suspended) {
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include "i2c_bus_accessor.hpp"
|
#include "i2c_bus_accessor.hpp"
|
||||||
#include "i2c_session.hpp"
|
#include "i2c_session.hpp"
|
||||||
|
|
||||||
namespace sts::i2c::driver::impl {
|
namespace ams::i2c::driver::impl {
|
||||||
|
|
||||||
class ResourceManager {
|
class ResourceManager {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include "i2c_session.hpp"
|
#include "i2c_session.hpp"
|
||||||
|
|
||||||
namespace sts::i2c::driver::impl {
|
namespace ams::i2c::driver::impl {
|
||||||
|
|
||||||
void Session::Open(Bus bus, u32 slave_address, AddressingMode addr_mode, SpeedMode speed_mode, BusAccessor *bus_accessor, u32 max_retries, u64 retry_wait_time) {
|
void Session::Open(Bus bus, u32 slave_address, AddressingMode addr_mode, SpeedMode speed_mode, BusAccessor *bus_accessor, u32 max_retries, u64 retry_wait_time) {
|
||||||
std::scoped_lock lk(this->bus_accessor_mutex);
|
std::scoped_lock lk(this->bus_accessor_mutex);
|
||||||
|
@ -74,7 +74,7 @@ namespace sts::i2c::driver::impl {
|
||||||
case Command::Receive:
|
case Command::Receive:
|
||||||
R_TRY(this->bus_accessor->Receive(reinterpret_cast<u8 *>(dst), num_bytes, option, this->addressing_mode, this->slave_address));
|
R_TRY(this->bus_accessor->Receive(reinterpret_cast<u8 *>(dst), num_bytes, option, this->addressing_mode, this->slave_address));
|
||||||
break;
|
break;
|
||||||
STS_UNREACHABLE_DEFAULT_CASE();
|
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "i2c_driver_types.hpp"
|
#include "i2c_driver_types.hpp"
|
||||||
#include "i2c_bus_accessor.hpp"
|
#include "i2c_bus_accessor.hpp"
|
||||||
|
|
||||||
namespace sts::i2c::driver::impl {
|
namespace ams::i2c::driver::impl {
|
||||||
|
|
||||||
class Session {
|
class Session {
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "i2c_types.hpp"
|
#include "i2c_types.hpp"
|
||||||
#include "i2c_command_list.hpp"
|
#include "i2c_command_list.hpp"
|
||||||
|
|
||||||
namespace sts::i2c {
|
namespace ams::i2c {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include "i2c_types.hpp"
|
#include "i2c_types.hpp"
|
||||||
|
|
||||||
namespace sts::i2c {
|
namespace ams::i2c {
|
||||||
|
|
||||||
enum class Command {
|
enum class Command {
|
||||||
Send = 0,
|
Send = 0,
|
||||||
|
@ -43,7 +43,7 @@ namespace sts::i2c {
|
||||||
size_t cur_index = 0;
|
size_t cur_index = 0;
|
||||||
public:
|
public:
|
||||||
CommandListFormatter(void *cmd_list, size_t cmd_list_size) : cmd_list(static_cast<u8 *>(cmd_list)), cmd_list_size(cmd_list_size) {
|
CommandListFormatter(void *cmd_list, size_t cmd_list_size) : cmd_list(static_cast<u8 *>(cmd_list)), cmd_list_size(cmd_list_size) {
|
||||||
STS_ASSERT(cmd_list_size <= MaxCommandListSize);
|
AMS_ASSERT(cmd_list_size <= MaxCommandListSize);
|
||||||
}
|
}
|
||||||
~CommandListFormatter() {
|
~CommandListFormatter() {
|
||||||
this->cmd_list = nullptr;
|
this->cmd_list = nullptr;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
namespace sts::i2c {
|
namespace ams::i2c {
|
||||||
|
|
||||||
enum class AddressingMode {
|
enum class AddressingMode {
|
||||||
SevenBit = 0,
|
SevenBit = 0,
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include "pinmux_initial_configuration.hpp"
|
#include "pinmux_initial_configuration.hpp"
|
||||||
#include "pinmux_utils.hpp"
|
#include "pinmux_utils.hpp"
|
||||||
|
|
||||||
namespace sts::pinmux {
|
namespace ams::pinmux {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -61,11 +61,11 @@ namespace sts::pinmux {
|
||||||
num_configs = NumInitialConfigsIowa;
|
num_configs = NumInitialConfigsIowa;
|
||||||
break;
|
break;
|
||||||
/* Unknown hardware type, we can't proceed. */
|
/* Unknown hardware type, we can't proceed. */
|
||||||
STS_UNREACHABLE_DEFAULT_CASE();
|
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure we found an appropriate config. */
|
/* Ensure we found an appropriate config. */
|
||||||
STS_ASSERT(configs != nullptr);
|
AMS_ASSERT(configs != nullptr);
|
||||||
|
|
||||||
for (size_t i = 0; i < num_configs; i++) {
|
for (size_t i = 0; i < num_configs; i++) {
|
||||||
UpdatePad(configs[i].name, configs[i].val, configs[i].mask);
|
UpdatePad(configs[i].name, configs[i].val, configs[i].mask);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
namespace sts::pinmux {
|
namespace ams::pinmux {
|
||||||
|
|
||||||
void SetInitialConfiguration();
|
void SetInitialConfiguration();
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
#include "pinmux_utils.hpp"
|
#include "pinmux_utils.hpp"
|
||||||
|
|
||||||
namespace sts::pinmux {
|
namespace ams::pinmux {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -33,12 +33,12 @@ namespace sts::pinmux {
|
||||||
|
|
||||||
/* Helpers. */
|
/* Helpers. */
|
||||||
inline const Definition *GetDefinition(u32 pinmux_name) {
|
inline const Definition *GetDefinition(u32 pinmux_name) {
|
||||||
STS_ASSERT(pinmux_name < PadNameMax);
|
AMS_ASSERT(pinmux_name < PadNameMax);
|
||||||
return &Map[pinmux_name];
|
return &Map[pinmux_name];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const DrivePadDefinition *GetDrivePadDefinition(u32 drivepad_name) {
|
inline const DrivePadDefinition *GetDrivePadDefinition(u32 drivepad_name) {
|
||||||
STS_ASSERT(drivepad_name < DrivePadNameMax);
|
AMS_ASSERT(drivepad_name < DrivePadNameMax);
|
||||||
return &DrivePadMap[drivepad_name];
|
return &DrivePadMap[drivepad_name];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ namespace sts::pinmux {
|
||||||
u32 pinmux_val = reg::Read(pinmux_reg);
|
u32 pinmux_val = reg::Read(pinmux_reg);
|
||||||
|
|
||||||
/* This PINMUX register is locked */
|
/* This PINMUX register is locked */
|
||||||
STS_ASSERT((pinmux_val & 0x80) == 0);
|
AMS_ASSERT((pinmux_val & 0x80) == 0);
|
||||||
|
|
||||||
u32 pm_val = (pinmux_config_val & 0x07);
|
u32 pm_val = (pinmux_config_val & 0x07);
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
namespace sts::pinmux {
|
namespace ams::pinmux {
|
||||||
|
|
||||||
/* Pinmux Utilities. */
|
/* Pinmux Utilities. */
|
||||||
u32 UpdatePark(u32 pinmux_name);
|
u32 UpdatePark(u32 pinmux_name);
|
||||||
|
|
|
@ -40,19 +40,19 @@ extern "C" {
|
||||||
void __libnx_exception_handler(ThreadExceptionDump *ctx);
|
void __libnx_exception_handler(ThreadExceptionDump *ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace sts::ams {
|
namespace ams {
|
||||||
|
|
||||||
ncm::TitleId StratosphereTitleId = ncm::TitleId::Boot2;
|
ncm::TitleId CurrentTitleId = ncm::TitleId::Boot2;
|
||||||
|
|
||||||
|
namespace result {
|
||||||
|
|
||||||
|
bool CallFatalOnResultAssertion = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace sts::result {
|
using namespace ams;
|
||||||
|
|
||||||
bool CallFatalOnResultAssertion = false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
using namespace sts;
|
|
||||||
|
|
||||||
void __libnx_exception_handler(ThreadExceptionDump *ctx) {
|
void __libnx_exception_handler(ThreadExceptionDump *ctx) {
|
||||||
ams::CrashHandler(ctx);
|
ams::CrashHandler(ctx);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "creport_crash_report.hpp"
|
#include "creport_crash_report.hpp"
|
||||||
#include "creport_utils.hpp"
|
#include "creport_utils.hpp"
|
||||||
|
|
||||||
namespace sts::creport {
|
namespace ams::creport {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -116,8 +116,8 @@ namespace sts::creport {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CrashReport::GetFatalContext(FatalContext *_out) const {
|
void CrashReport::GetFatalContext(FatalContext *_out) const {
|
||||||
static_assert(sizeof(*_out) == sizeof(sts::fatal::CpuContext));
|
static_assert(sizeof(*_out) == sizeof(ams::fatal::CpuContext));
|
||||||
sts::fatal::CpuContext *out = reinterpret_cast<sts::fatal::CpuContext *>(_out);
|
ams::fatal::CpuContext *out = reinterpret_cast<ams::fatal::CpuContext *>(_out);
|
||||||
std::memset(out, 0, sizeof(*out));
|
std::memset(out, 0, sizeof(*out));
|
||||||
|
|
||||||
/* TODO: Support generating 32-bit fatal contexts? */
|
/* TODO: Support generating 32-bit fatal contexts? */
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "creport_threads.hpp"
|
#include "creport_threads.hpp"
|
||||||
#include "creport_modules.hpp"
|
#include "creport_modules.hpp"
|
||||||
|
|
||||||
namespace sts::creport {
|
namespace ams::creport {
|
||||||
|
|
||||||
class CrashReport {
|
class CrashReport {
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -46,19 +46,19 @@ extern "C" {
|
||||||
void __libnx_exception_handler(ThreadExceptionDump *ctx);
|
void __libnx_exception_handler(ThreadExceptionDump *ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace sts::ams {
|
namespace ams {
|
||||||
|
|
||||||
ncm::TitleId StratosphereTitleId = ncm::TitleId::Creport;
|
ncm::TitleId CurrentTitleId = ncm::TitleId::Creport;
|
||||||
|
|
||||||
|
namespace result {
|
||||||
|
|
||||||
|
bool CallFatalOnResultAssertion = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace sts::result {
|
using namespace ams;
|
||||||
|
|
||||||
bool CallFatalOnResultAssertion = true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
using namespace sts;
|
|
||||||
|
|
||||||
void __libnx_exception_handler(ThreadExceptionDump *ctx) {
|
void __libnx_exception_handler(ThreadExceptionDump *ctx) {
|
||||||
ams::CrashHandler(ctx);
|
ams::CrashHandler(ctx);
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "creport_modules.hpp"
|
#include "creport_modules.hpp"
|
||||||
#include "creport_utils.hpp"
|
#include "creport_utils.hpp"
|
||||||
|
|
||||||
namespace sts::creport {
|
namespace ams::creport {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
#include "creport_threads.hpp"
|
#include "creport_threads.hpp"
|
||||||
|
|
||||||
namespace sts::creport {
|
namespace ams::creport {
|
||||||
|
|
||||||
class ModuleList {
|
class ModuleList {
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "creport_threads.hpp"
|
#include "creport_threads.hpp"
|
||||||
#include "creport_modules.hpp"
|
#include "creport_modules.hpp"
|
||||||
|
|
||||||
namespace sts::creport {
|
namespace ams::creport {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
namespace sts::creport {
|
namespace ams::creport {
|
||||||
|
|
||||||
/* Forward declare ModuleList class. */
|
/* Forward declare ModuleList class. */
|
||||||
class ModuleList;
|
class ModuleList;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include "creport_utils.hpp"
|
#include "creport_utils.hpp"
|
||||||
|
|
||||||
namespace sts::creport {
|
namespace ams::creport {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
namespace sts::creport {
|
namespace ams::creport {
|
||||||
|
|
||||||
/* Utility functions. */
|
/* Utility functions. */
|
||||||
void DumpMemoryHexToFile(FILE *f, const char *prefix, const void *data, size_t size);
|
void DumpMemoryHexToFile(FILE *f, const char *prefix, const void *data, size_t size);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "dmnt_cheat_service.hpp"
|
#include "dmnt_cheat_service.hpp"
|
||||||
#include "impl/dmnt_cheat_api.hpp"
|
#include "impl/dmnt_cheat_api.hpp"
|
||||||
|
|
||||||
namespace sts::dmnt::cheat {
|
namespace ams::dmnt::cheat {
|
||||||
|
|
||||||
/* ========================================================================================= */
|
/* ========================================================================================= */
|
||||||
/* ==================================== Meta Commands ==================================== */
|
/* ==================================== Meta Commands ==================================== */
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue