mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-08-09 00:49:29 +02: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
15def4ef63
commit
528215f443
2
Makefile
2
Makefile
@ -16,7 +16,7 @@ include $(DEVKITPRO)/libnx/switch_rules
|
|||||||
# INCLUDES is a list of directories containing header files
|
# INCLUDES is a list of directories containing header files
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
TARGET := $(notdir $(CURDIR))
|
TARGET := $(notdir $(CURDIR))
|
||||||
SOURCES := source source/ams source/result source/os source/os/impl source/dd source/sf source/sf/cmif source/sf/hipc source/dmnt source/spl source/spl/smc source/updater source/patcher source/map source/rnd source/util source/sm source/cfg source/pm source/hid source/ldr source/kvdb source/boot2
|
SOURCES := source source/ams source/hos source/result source/os source/os/impl source/dd source/sf source/sf/cmif source/sf/hipc source/dmnt source/spl source/spl/smc source/updater source/patcher source/map source/rnd source/util source/sm source/cfg source/pm source/hid source/ldr source/kvdb source/boot2
|
||||||
DATA := data
|
DATA := data
|
||||||
INCLUDES := include
|
INCLUDES := include
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ams/ams_types.hpp"
|
#include "ams/ams_types.hpp"
|
||||||
#include "ams/ams_hos_version_api.hpp"
|
|
||||||
#include "ams/ams_exosphere_api.hpp"
|
#include "ams/ams_exosphere_api.hpp"
|
||||||
#include "ams/ams_emummc_api.hpp"
|
#include "ams/ams_emummc_api.hpp"
|
||||||
#include "ams/ams_environment.hpp"
|
#include "ams/ams_environment.hpp"
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "ams_types.hpp"
|
#include "ams_types.hpp"
|
||||||
|
|
||||||
namespace sts::ams::emummc {
|
namespace ams::emummc {
|
||||||
|
|
||||||
/* Get whether emummc is active. */
|
/* Get whether emummc is active. */
|
||||||
bool IsActive();
|
bool IsActive();
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "ams_types.hpp"
|
#include "ams_types.hpp"
|
||||||
|
|
||||||
namespace sts::ams {
|
namespace ams {
|
||||||
|
|
||||||
/* Will be called by libstratosphere on crash. */
|
/* Will be called by libstratosphere on crash. */
|
||||||
void CrashHandler(ThreadExceptionDump *ctx);
|
void CrashHandler(ThreadExceptionDump *ctx);
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "ams_types.hpp"
|
#include "ams_types.hpp"
|
||||||
|
|
||||||
namespace sts::ams {
|
namespace ams::exosphere {
|
||||||
|
|
||||||
ApiInfo GetApiInfo();
|
ApiInfo GetApiInfo();
|
||||||
|
|
||||||
@ -30,32 +30,24 @@ namespace sts::ams {
|
|||||||
void CopyToIram(uintptr_t iram_dst, const void *dram_src, size_t size);
|
void CopyToIram(uintptr_t iram_dst, const void *dram_src, size_t size);
|
||||||
void CopyFromIram(void *dram_dst, uintptr_t iram_src, size_t size);
|
void CopyFromIram(void *dram_dst, uintptr_t iram_src, size_t size);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace ams {
|
||||||
|
|
||||||
/* Version checking utility. */
|
/* Version checking utility. */
|
||||||
#ifdef ATMOSPHERE_RELEASE_VERSION_MAJOR
|
#ifdef ATMOSPHERE_RELEASE_VERSION_MAJOR
|
||||||
|
|
||||||
#define ATMOSPHERE_RELEASE_VERSION ATMOSPHERE_RELEASE_VERSION_MAJOR, ATMOSPHERE_RELEASE_VERSION_MINOR, ATMOSPHERE_RELEASE_VERSION_MICRO
|
#define ATMOSPHERE_RELEASE_VERSION ATMOSPHERE_RELEASE_VERSION_MAJOR, ATMOSPHERE_RELEASE_VERSION_MINOR, ATMOSPHERE_RELEASE_VERSION_MICRO
|
||||||
|
|
||||||
inline void CheckApiVersion() {
|
inline void CheckApiVersion() {
|
||||||
const u32 runtime_version = GetApiInfo().GetVersion();
|
const u32 runtime_version = exosphere::GetApiInfo().GetVersion();
|
||||||
const u32 build_version = GetVersion(ATMOSPHERE_RELEASE_VERSION);
|
const u32 build_version = exosphere::GetVersion(ATMOSPHERE_RELEASE_VERSION);
|
||||||
|
|
||||||
if (runtime_version < build_version) {
|
if (runtime_version < build_version) {
|
||||||
R_ASSERT(ams::ResultVersionMismatch());
|
R_ASSERT(exosphere::ResultVersionMismatch());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ATMOSPHERE_GIT_BRANCH
|
|
||||||
NX_CONSTEXPR const char *GetGitBranch() {
|
|
||||||
return ATMOSPHERE_GIT_BRANCH;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ATMOSPHERE_GIT_REV
|
|
||||||
NX_CONSTEXPR const char *GetGitRevision() {
|
|
||||||
return ATMOSPHERE_GIT_REV;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,37 +15,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <switch.h>
|
|
||||||
#include "../defines.hpp"
|
#include "../defines.hpp"
|
||||||
#include "../results.hpp"
|
#include "../results.hpp"
|
||||||
#include "../sf/sf_buffer_tags.hpp"
|
#include "../sf/sf_buffer_tags.hpp"
|
||||||
|
#include "../hos.hpp"
|
||||||
|
|
||||||
/* Define firmware version in global namespace, for convenience. */
|
namespace ams::exosphere {
|
||||||
namespace sts {
|
|
||||||
|
|
||||||
namespace hos {
|
|
||||||
|
|
||||||
enum Version : u16 {
|
|
||||||
Version_Min = 0,
|
|
||||||
Version_100 = Version_Min,
|
|
||||||
Version_200 = 1,
|
|
||||||
Version_300 = 2,
|
|
||||||
Version_400 = 3,
|
|
||||||
Version_500 = 4,
|
|
||||||
Version_600 = 5,
|
|
||||||
Version_700 = 6,
|
|
||||||
Version_800 = 7,
|
|
||||||
Version_810 = 8,
|
|
||||||
Version_900 = 9,
|
|
||||||
Version_Current = Version_900,
|
|
||||||
Version_Max = 32,
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace sts::ams {
|
|
||||||
|
|
||||||
enum TargetFirmware : u32 {
|
enum TargetFirmware : u32 {
|
||||||
TargetFirmware_100 = 1,
|
TargetFirmware_100 = 1,
|
||||||
@ -73,7 +48,7 @@ namespace sts::ams {
|
|||||||
u32 master_key_revision;
|
u32 master_key_revision;
|
||||||
|
|
||||||
constexpr u32 GetVersion() const {
|
constexpr u32 GetVersion() const {
|
||||||
return ::sts::ams::GetVersion(this->major_version, this->minor_version, this->micro_version);
|
return ::ams::exosphere::GetVersion(this->major_version, this->minor_version, this->micro_version);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr TargetFirmware GetTargetFirmware() const {
|
constexpr TargetFirmware GetTargetFirmware() const {
|
||||||
@ -85,6 +60,10 @@ namespace sts::ams {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace ams {
|
||||||
|
|
||||||
struct FatalErrorContext : sf::LargeData, sf::PrefersMapAliasTransferMode {
|
struct FatalErrorContext : sf::LargeData, sf::PrefersMapAliasTransferMode {
|
||||||
static constexpr size_t MaxStackTrace = 0x20;
|
static constexpr size_t MaxStackTrace = 0x20;
|
||||||
static constexpr size_t MaxStackDumpSize = 0x100;
|
static constexpr size_t MaxStackDumpSize = 0x100;
|
||||||
@ -124,4 +103,16 @@ namespace sts::ams {
|
|||||||
static_assert(sizeof(FatalErrorContext) == 0x350, "sizeof(FatalErrorContext)");
|
static_assert(sizeof(FatalErrorContext) == 0x350, "sizeof(FatalErrorContext)");
|
||||||
static_assert(std::is_pod<FatalErrorContext>::value, "FatalErrorContext");
|
static_assert(std::is_pod<FatalErrorContext>::value, "FatalErrorContext");
|
||||||
|
|
||||||
|
#ifdef ATMOSPHERE_GIT_BRANCH
|
||||||
|
NX_CONSTEXPR const char *GetGitBranch() {
|
||||||
|
return ATMOSPHERE_GIT_BRANCH;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ATMOSPHERE_GIT_REV
|
||||||
|
NX_CONSTEXPR const char *GetGitRevision() {
|
||||||
|
return ATMOSPHERE_GIT_REV;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
namespace sts::boot2 {
|
namespace ams::boot2 {
|
||||||
|
|
||||||
/* Boot2 API. */
|
/* Boot2 API. */
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "../os/os_common_types.hpp"
|
#include "../os/os_common_types.hpp"
|
||||||
#include "../ncm/ncm_types.hpp"
|
#include "../ncm/ncm_types.hpp"
|
||||||
|
|
||||||
namespace sts::cfg {
|
namespace ams::cfg {
|
||||||
|
|
||||||
/* Privileged Process configuration. */
|
/* Privileged Process configuration. */
|
||||||
bool IsInitialProcess();
|
bool IsInitialProcess();
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include "../defines.hpp"
|
#include "../defines.hpp"
|
||||||
|
|
||||||
namespace sts::dd {
|
namespace ams::dd {
|
||||||
|
|
||||||
uintptr_t QueryIoMapping(uintptr_t phys_addr, size_t size);
|
uintptr_t QueryIoMapping(uintptr_t phys_addr, size_t size);
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ namespace sts::dd {
|
|||||||
|
|
||||||
inline uintptr_t GetIoMapping(uintptr_t phys_addr, size_t size) {
|
inline uintptr_t GetIoMapping(uintptr_t phys_addr, size_t size) {
|
||||||
const uintptr_t io_mapping = QueryIoMapping(phys_addr, size);
|
const uintptr_t io_mapping = QueryIoMapping(phys_addr, size);
|
||||||
STS_ASSERT(io_mapping);
|
AMS_ASSERT(io_mapping);
|
||||||
return io_mapping;
|
return io_mapping;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
|
|
||||||
/* Any broadly useful language defines should go here. */
|
/* Any broadly useful language defines should go here. */
|
||||||
|
|
||||||
#define STS_ASSERT(expr) do { if (!(expr)) { std::abort(); } } while (0)
|
#define AMS_ASSERT(expr) do { if (!(expr)) { std::abort(); } } while (0)
|
||||||
|
|
||||||
#define STS_UNREACHABLE_DEFAULT_CASE() default: std::abort()
|
#define AMS_UNREACHABLE_DEFAULT_CASE() default: std::abort()
|
||||||
|
|
||||||
#define NON_COPYABLE(cls) \
|
#define NON_COPYABLE(cls) \
|
||||||
cls(const cls&) = delete; \
|
cls(const cls&) = delete; \
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "../ncm/ncm_types.hpp"
|
#include "../ncm/ncm_types.hpp"
|
||||||
#include "../sf/sf_buffer_tags.hpp"
|
#include "../sf/sf_buffer_tags.hpp"
|
||||||
|
|
||||||
namespace sts::dmnt::cheat {
|
namespace ams::dmnt::cheat {
|
||||||
|
|
||||||
struct CheatProcessMetadata {
|
struct CheatProcessMetadata {
|
||||||
struct MemoryRegionExtents {
|
struct MemoryRegionExtents {
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "../ncm/ncm_types.hpp"
|
#include "../ncm/ncm_types.hpp"
|
||||||
#include "../sf/sf_buffer_tags.hpp"
|
#include "../sf/sf_buffer_tags.hpp"
|
||||||
|
|
||||||
namespace sts::fatal {
|
namespace ams::fatal {
|
||||||
|
|
||||||
namespace aarch64 {
|
namespace aarch64 {
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace sts::hid {
|
namespace ams::hid {
|
||||||
|
|
||||||
/* Key API. */
|
/* Key API. */
|
||||||
Result GetKeysHeld(u64 *out);
|
Result GetKeysHeld(u64 *out);
|
||||||
|
20
include/stratosphere/hos.hpp
Normal file
20
include/stratosphere/hos.hpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2019 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "hos/hos_types.hpp"
|
||||||
|
#include "hos/hos_version_api.hpp"
|
40
include/stratosphere/hos/hos_types.hpp
Normal file
40
include/stratosphere/hos/hos_types.hpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2019 Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <switch.h>
|
||||||
|
#include "../defines.hpp"
|
||||||
|
#include "../results.hpp"
|
||||||
|
|
||||||
|
namespace ams::hos {
|
||||||
|
|
||||||
|
enum Version : u16 {
|
||||||
|
Version_Min = 0,
|
||||||
|
Version_100 = Version_Min,
|
||||||
|
Version_200 = 1,
|
||||||
|
Version_300 = 2,
|
||||||
|
Version_400 = 3,
|
||||||
|
Version_500 = 4,
|
||||||
|
Version_600 = 5,
|
||||||
|
Version_700 = 6,
|
||||||
|
Version_800 = 7,
|
||||||
|
Version_810 = 8,
|
||||||
|
Version_900 = 9,
|
||||||
|
Version_Current = Version_900,
|
||||||
|
Version_Max = 32,
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
@ -15,11 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "ams_types.hpp"
|
#include "hos_types.hpp"
|
||||||
|
|
||||||
namespace sts::hos {
|
namespace ams::hos {
|
||||||
|
|
||||||
sts::hos::Version GetVersion();
|
::ams::hos::Version GetVersion();
|
||||||
void SetVersionForLibnx();
|
void SetVersionForLibnx();
|
||||||
|
|
||||||
}
|
}
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "kvdb_auto_buffer.hpp"
|
#include "kvdb_auto_buffer.hpp"
|
||||||
|
|
||||||
namespace sts::kvdb {
|
namespace ams::kvdb {
|
||||||
|
|
||||||
/* Functionality for parsing/generating a key value archive. */
|
/* Functionality for parsing/generating a key value archive. */
|
||||||
class ArchiveReader {
|
class ArchiveReader {
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "../defines.hpp"
|
#include "../defines.hpp"
|
||||||
#include "../results.hpp"
|
#include "../results.hpp"
|
||||||
|
|
||||||
namespace sts::kvdb {
|
namespace ams::kvdb {
|
||||||
|
|
||||||
class AutoBuffer {
|
class AutoBuffer {
|
||||||
NON_COPYABLE(AutoBuffer);
|
NON_COPYABLE(AutoBuffer);
|
||||||
@ -68,7 +68,7 @@ namespace sts::kvdb {
|
|||||||
|
|
||||||
Result Initialize(size_t size) {
|
Result Initialize(size_t size) {
|
||||||
/* Check that we're not already initialized. */
|
/* Check that we're not already initialized. */
|
||||||
STS_ASSERT(this->buffer == nullptr);
|
AMS_ASSERT(this->buffer == nullptr);
|
||||||
|
|
||||||
/* Allocate a buffer. */
|
/* Allocate a buffer. */
|
||||||
this->buffer = static_cast<u8 *>(std::malloc(size));
|
this->buffer = static_cast<u8 *>(std::malloc(size));
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "../defines.hpp"
|
#include "../defines.hpp"
|
||||||
#include "../results.hpp"
|
#include "../results.hpp"
|
||||||
|
|
||||||
namespace sts::kvdb {
|
namespace ams::kvdb {
|
||||||
|
|
||||||
/* Represents a string with a backing buffer of N bytes. */
|
/* Represents a string with a backing buffer of N bytes. */
|
||||||
template<size_t N>
|
template<size_t N>
|
||||||
@ -32,7 +32,7 @@ namespace sts::kvdb {
|
|||||||
private:
|
private:
|
||||||
/* Utility. */
|
/* Utility. */
|
||||||
static inline void CheckLength(size_t len) {
|
static inline void CheckLength(size_t len) {
|
||||||
STS_ASSERT(len < N);
|
AMS_ASSERT(len < N);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
/* Constructors. */
|
/* Constructors. */
|
||||||
@ -113,8 +113,8 @@ namespace sts::kvdb {
|
|||||||
/* Substring utilities. */
|
/* Substring utilities. */
|
||||||
void GetSubstring(char *dst, size_t dst_size, size_t offset, size_t length) const {
|
void GetSubstring(char *dst, size_t dst_size, size_t offset, size_t length) const {
|
||||||
/* Make sure output buffer can hold the substring. */
|
/* Make sure output buffer can hold the substring. */
|
||||||
STS_ASSERT(offset + length <= GetLength());
|
AMS_ASSERT(offset + length <= GetLength());
|
||||||
STS_ASSERT(dst_size > length);
|
AMS_ASSERT(dst_size > length);
|
||||||
/* Copy substring to dst. */
|
/* Copy substring to dst. */
|
||||||
std::strncpy(dst, this->buffer + offset, length);
|
std::strncpy(dst, this->buffer + offset, length);
|
||||||
dst[length] = 0;
|
dst[length] = 0;
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "kvdb_bounded_string.hpp"
|
#include "kvdb_bounded_string.hpp"
|
||||||
#include "kvdb_file_key_value_store.hpp"
|
#include "kvdb_file_key_value_store.hpp"
|
||||||
|
|
||||||
namespace sts::kvdb {
|
namespace ams::kvdb {
|
||||||
|
|
||||||
namespace impl {
|
namespace impl {
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ namespace sts::kvdb {
|
|||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
void RemoveIndex(size_t i) {
|
void RemoveIndex(size_t i) {
|
||||||
STS_ASSERT(i < this->GetCount());
|
AMS_ASSERT(i < this->GetCount());
|
||||||
std::memmove(this->keys + i, this->keys + i + 1, sizeof(*this->keys) * (this->GetCount() - (i + 1)));
|
std::memmove(this->keys + i, this->keys + i + 1, sizeof(*this->keys) * (this->GetCount() - (i + 1)));
|
||||||
this->DecrementCount();
|
this->DecrementCount();
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ namespace sts::kvdb {
|
|||||||
|
|
||||||
Result Initialize(const char *path, void *buf, size_t size) {
|
Result Initialize(const char *path, void *buf, size_t size) {
|
||||||
/* Only initialize once, and ensure we have sufficient memory. */
|
/* Only initialize once, and ensure we have sufficient memory. */
|
||||||
STS_ASSERT(this->keys == nullptr);
|
AMS_ASSERT(this->keys == nullptr);
|
||||||
SSS_ASSERT(size >= BufferSize);
|
SSS_ASSERT(size >= BufferSize);
|
||||||
|
|
||||||
/* Setup member variables. */
|
/* Setup member variables. */
|
||||||
@ -145,23 +145,23 @@ namespace sts::kvdb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Key Get(size_t i) const {
|
Key Get(size_t i) const {
|
||||||
STS_ASSERT(i < this->GetCount());
|
AMS_ASSERT(i < this->GetCount());
|
||||||
return this->keys[i];
|
return this->keys[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
Key Peek() const {
|
Key Peek() const {
|
||||||
STS_ASSERT(!this->IsEmpty());
|
AMS_ASSERT(!this->IsEmpty());
|
||||||
return this->Get(0);
|
return this->Get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Push(const Key &key) {
|
void Push(const Key &key) {
|
||||||
STS_ASSERT(!this->IsFull());
|
AMS_ASSERT(!this->IsFull());
|
||||||
this->keys[this->GetCount()] = key;
|
this->keys[this->GetCount()] = key;
|
||||||
this->IncrementCount();
|
this->IncrementCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
Key Pop() {
|
Key Pop() {
|
||||||
STS_ASSERT(!this->IsEmpty());
|
AMS_ASSERT(!this->IsEmpty());
|
||||||
this->RemoveIndex(0);
|
this->RemoveIndex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "kvdb_bounded_string.hpp"
|
#include "kvdb_bounded_string.hpp"
|
||||||
|
|
||||||
namespace sts::kvdb {
|
namespace ams::kvdb {
|
||||||
|
|
||||||
class FileKeyValueStore {
|
class FileKeyValueStore {
|
||||||
NON_COPYABLE(FileKeyValueStore);
|
NON_COPYABLE(FileKeyValueStore);
|
||||||
@ -96,7 +96,7 @@ namespace sts::kvdb {
|
|||||||
static_assert(std::is_pod<Value>::value && !std::is_pointer<Value>::value, "Invalid FileKeyValueStore Value!");
|
static_assert(std::is_pod<Value>::value && !std::is_pointer<Value>::value, "Invalid FileKeyValueStore Value!");
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
R_TRY(this->Get(&size, out_value, sizeof(Value), key));
|
R_TRY(this->Get(&size, out_value, sizeof(Value), key));
|
||||||
STS_ASSERT(size >= sizeof(Value));
|
AMS_ASSERT(size >= sizeof(Value));
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include "kvdb_archive.hpp"
|
#include "kvdb_archive.hpp"
|
||||||
#include "kvdb_bounded_string.hpp"
|
#include "kvdb_bounded_string.hpp"
|
||||||
|
|
||||||
namespace sts::kvdb {
|
namespace ams::kvdb {
|
||||||
|
|
||||||
template<class Key>
|
template<class Key>
|
||||||
class MemoryKeyValueStore {
|
class MemoryKeyValueStore {
|
||||||
@ -50,7 +50,7 @@ namespace sts::kvdb {
|
|||||||
Value *GetValuePointer() {
|
Value *GetValuePointer() {
|
||||||
/* Size check. Note: Nintendo does not size check. */
|
/* Size check. Note: Nintendo does not size check. */
|
||||||
if constexpr (!std::is_same<Value, void>::value) {
|
if constexpr (!std::is_same<Value, void>::value) {
|
||||||
STS_ASSERT(sizeof(Value) <= this->value_size);
|
AMS_ASSERT(sizeof(Value) <= this->value_size);
|
||||||
/* Ensure we only get pod. */
|
/* Ensure we only get pod. */
|
||||||
static_assert(std::is_pod<Value>::value, "KeyValueStore Values must be pod");
|
static_assert(std::is_pod<Value>::value, "KeyValueStore Values must be pod");
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ namespace sts::kvdb {
|
|||||||
const Value *GetValuePointer() const {
|
const Value *GetValuePointer() const {
|
||||||
/* Size check. Note: Nintendo does not size check. */
|
/* Size check. Note: Nintendo does not size check. */
|
||||||
if constexpr (!std::is_same<Value, void>::value) {
|
if constexpr (!std::is_same<Value, void>::value) {
|
||||||
STS_ASSERT(sizeof(Value) <= this->value_size);
|
AMS_ASSERT(sizeof(Value) <= this->value_size);
|
||||||
/* Ensure we only get pod. */
|
/* Ensure we only get pod. */
|
||||||
static_assert(std::is_pod<Value>::value, "KeyValueStore Values must be pod");
|
static_assert(std::is_pod<Value>::value, "KeyValueStore Values must be pod");
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include "ldr_types.hpp"
|
#include "ldr_types.hpp"
|
||||||
|
|
||||||
namespace sts::ldr::pm {
|
namespace ams::ldr::pm {
|
||||||
|
|
||||||
/* Process Manager API. */
|
/* Process Manager API. */
|
||||||
Result CreateProcess(Handle *out, PinId pin_id, u32 flags, Handle reslimit);
|
Result CreateProcess(Handle *out, PinId pin_id, u32 flags, Handle reslimit);
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "../ncm/ncm_types.hpp"
|
#include "../ncm/ncm_types.hpp"
|
||||||
#include "../sf/sf_buffer_tags.hpp"
|
#include "../sf/sf_buffer_tags.hpp"
|
||||||
|
|
||||||
namespace sts::ldr {
|
namespace ams::ldr {
|
||||||
|
|
||||||
/* General types. */
|
/* General types. */
|
||||||
struct ProgramInfo : sf::LargeData {
|
struct ProgramInfo : sf::LargeData {
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include "map_types.hpp"
|
#include "map_types.hpp"
|
||||||
|
|
||||||
namespace sts::map {
|
namespace ams::map {
|
||||||
|
|
||||||
/* Public API. */
|
/* Public API. */
|
||||||
Result GetProcessAddressSpaceInfo(AddressSpaceInfo *out, Handle process_h);
|
Result GetProcessAddressSpaceInfo(AddressSpaceInfo *out, Handle process_h);
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include "../results.hpp"
|
#include "../results.hpp"
|
||||||
|
|
||||||
namespace sts::map {
|
namespace ams::map {
|
||||||
|
|
||||||
/* Types. */
|
/* Types. */
|
||||||
struct AddressSpaceInfo {
|
struct AddressSpaceInfo {
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
namespace sts::ncm {
|
namespace ams::ncm {
|
||||||
|
|
||||||
/* Storage IDs. */
|
/* Storage IDs. */
|
||||||
enum class StorageId : u8 {
|
enum class StorageId : u8 {
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "../results.hpp"
|
#include "../results.hpp"
|
||||||
#include "../util.hpp"
|
#include "../util.hpp"
|
||||||
|
|
||||||
namespace sts::os {
|
namespace ams::os {
|
||||||
|
|
||||||
enum class TriBool {
|
enum class TriBool {
|
||||||
False = 0,
|
False = 0,
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "os_mutex.hpp"
|
#include "os_mutex.hpp"
|
||||||
|
|
||||||
namespace sts::os {
|
namespace ams::os {
|
||||||
|
|
||||||
class ConditionVariable {
|
class ConditionVariable {
|
||||||
NON_COPYABLE(ConditionVariable);
|
NON_COPYABLE(ConditionVariable);
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "os_condvar.hpp"
|
#include "os_condvar.hpp"
|
||||||
#include "os_timeout_helper.hpp"
|
#include "os_timeout_helper.hpp"
|
||||||
|
|
||||||
namespace sts::os {
|
namespace ams::os {
|
||||||
|
|
||||||
namespace impl {
|
namespace impl {
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "os_common_types.hpp"
|
#include "os_common_types.hpp"
|
||||||
#include "os_managed_handle.hpp"
|
#include "os_managed_handle.hpp"
|
||||||
|
|
||||||
namespace sts::os {
|
namespace ams::os {
|
||||||
|
|
||||||
namespace impl {
|
namespace impl {
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "../defines.hpp"
|
#include "../defines.hpp"
|
||||||
#include "../results.hpp"
|
#include "../results.hpp"
|
||||||
|
|
||||||
namespace sts::os {
|
namespace ams::os {
|
||||||
|
|
||||||
class ManagedHandle {
|
class ManagedHandle {
|
||||||
NON_COPYABLE(ManagedHandle);
|
NON_COPYABLE(ManagedHandle);
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "os_mutex.hpp"
|
#include "os_mutex.hpp"
|
||||||
#include "os_condvar.hpp"
|
#include "os_condvar.hpp"
|
||||||
|
|
||||||
namespace sts::os {
|
namespace ams::os {
|
||||||
|
|
||||||
namespace impl {
|
namespace impl {
|
||||||
|
|
||||||
|
@ -19,14 +19,14 @@
|
|||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include "../util.hpp"
|
#include "../util.hpp"
|
||||||
|
|
||||||
namespace sts::os {
|
namespace ams::os {
|
||||||
|
|
||||||
class ConditionVariable;
|
class ConditionVariable;
|
||||||
|
|
||||||
class Mutex {
|
class Mutex {
|
||||||
NON_COPYABLE(Mutex);
|
NON_COPYABLE(Mutex);
|
||||||
NON_MOVEABLE(Mutex);
|
NON_MOVEABLE(Mutex);
|
||||||
friend class sts::os::ConditionVariable;
|
friend class ams::os::ConditionVariable;
|
||||||
private:
|
private:
|
||||||
::Mutex m;
|
::Mutex m;
|
||||||
private:
|
private:
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
|
|
||||||
namespace sts::os {
|
namespace ams::os {
|
||||||
|
|
||||||
class Semaphore {
|
class Semaphore {
|
||||||
NON_COPYABLE(Semaphore);
|
NON_COPYABLE(Semaphore);
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "os_common_types.hpp"
|
#include "os_common_types.hpp"
|
||||||
#include "os_event.hpp"
|
#include "os_event.hpp"
|
||||||
|
|
||||||
namespace sts::os {
|
namespace ams::os {
|
||||||
|
|
||||||
class WaitableHolder;
|
class WaitableHolder;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
|
|
||||||
namespace sts::os {
|
namespace ams::os {
|
||||||
|
|
||||||
class Thread {
|
class Thread {
|
||||||
NON_COPYABLE(Thread);
|
NON_COPYABLE(Thread);
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
|
|
||||||
namespace sts::os {
|
namespace ams::os {
|
||||||
|
|
||||||
class TimeoutHelper {
|
class TimeoutHelper {
|
||||||
private:
|
private:
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#include "../util.hpp"
|
#include "../util.hpp"
|
||||||
#include "os_common_types.hpp"
|
#include "os_common_types.hpp"
|
||||||
|
|
||||||
namespace sts::os {
|
namespace ams::os {
|
||||||
|
|
||||||
class WaitableManager;
|
class WaitableManager;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "os_common_types.hpp"
|
#include "os_common_types.hpp"
|
||||||
#include "os_mutex.hpp"
|
#include "os_mutex.hpp"
|
||||||
|
|
||||||
namespace sts::os {
|
namespace ams::os {
|
||||||
|
|
||||||
class WaitableHolder;
|
class WaitableHolder;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include "../ro/ro_types.hpp"
|
#include "../ro/ro_types.hpp"
|
||||||
|
|
||||||
namespace sts::patcher {
|
namespace ams::patcher {
|
||||||
|
|
||||||
/* Helper for applying to code binaries. */
|
/* Helper for applying to code binaries. */
|
||||||
void LocateAndApplyIpsPatchesToModule(const char *patch_dir, size_t protected_size, size_t offset, const ro::ModuleId *module_id, u8 *mapped_module, size_t mapped_size);
|
void LocateAndApplyIpsPatchesToModule(const char *patch_dir, size_t protected_size, size_t offset, const ro::ModuleId *module_id, u8 *mapped_module, size_t mapped_size);
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include "pm_types.hpp"
|
#include "pm_types.hpp"
|
||||||
|
|
||||||
namespace sts::pm::bm {
|
namespace ams::pm::bm {
|
||||||
|
|
||||||
/* Boot Mode API. */
|
/* Boot Mode API. */
|
||||||
BootMode GetBootMode();
|
BootMode GetBootMode();
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "../ldr.hpp"
|
#include "../ldr.hpp"
|
||||||
#include "pm_types.hpp"
|
#include "pm_types.hpp"
|
||||||
|
|
||||||
namespace sts::pm::dmnt {
|
namespace ams::pm::dmnt {
|
||||||
|
|
||||||
/* Debug Monitor API. */
|
/* Debug Monitor API. */
|
||||||
Result StartProcess(os::ProcessId process_id);
|
Result StartProcess(os::ProcessId process_id);
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "pm_types.hpp"
|
#include "pm_types.hpp"
|
||||||
#include "../ncm/ncm_types.hpp"
|
#include "../ncm/ncm_types.hpp"
|
||||||
|
|
||||||
namespace sts::pm::info {
|
namespace ams::pm::info {
|
||||||
|
|
||||||
/* Information API. */
|
/* Information API. */
|
||||||
Result GetTitleId(ncm::TitleId *out_title_id, os::ProcessId process_id);
|
Result GetTitleId(ncm::TitleId *out_title_id, os::ProcessId process_id);
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "../ldr.hpp"
|
#include "../ldr.hpp"
|
||||||
#include "pm_types.hpp"
|
#include "pm_types.hpp"
|
||||||
|
|
||||||
namespace sts::pm::shell {
|
namespace ams::pm::shell {
|
||||||
|
|
||||||
/* Shell API. */
|
/* Shell API. */
|
||||||
Result LaunchTitle(os::ProcessId *out_process_id, const ncm::TitleLocation &loc, u32 launch_flags);
|
Result LaunchTitle(os::ProcessId *out_process_id, const ncm::TitleLocation &loc, u32 launch_flags);
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include "../os/os_common_types.hpp"
|
#include "../os/os_common_types.hpp"
|
||||||
|
|
||||||
namespace sts::pm {
|
namespace ams::pm {
|
||||||
|
|
||||||
enum class BootMode {
|
enum class BootMode {
|
||||||
Normal = 0,
|
Normal = 0,
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
|
|
||||||
namespace sts::reg {
|
namespace ams::reg {
|
||||||
|
|
||||||
inline void Write(volatile u32 *reg, u32 val) {
|
inline void Write(volatile u32 *reg, u32 val) {
|
||||||
*reg = val;
|
*reg = val;
|
||||||
|
@ -45,4 +45,4 @@
|
|||||||
#include "results/vi_results.hpp"
|
#include "results/vi_results.hpp"
|
||||||
|
|
||||||
/* Unofficial. */
|
/* Unofficial. */
|
||||||
#include "results/ams_results.hpp"
|
#include "results/exosphere_results.hpp"
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::cal {
|
namespace ams::cal {
|
||||||
|
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(198);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(198);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::creport {
|
namespace ams::creport {
|
||||||
|
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(168);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(168);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::dbg {
|
namespace ams::dbg {
|
||||||
|
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(183);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(183);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::dmnt {
|
namespace ams::dmnt {
|
||||||
|
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(13);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(13);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::err {
|
namespace ams::err {
|
||||||
|
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(162);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(162);
|
||||||
|
|
||||||
|
@ -17,22 +17,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::ams {
|
namespace ams::exosphere {
|
||||||
|
|
||||||
/* Please note: These results are all custom, and not official. */
|
/* Please note: These results are all custom, and not official. */
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(444);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(444);
|
||||||
|
|
||||||
|
|
||||||
/* Result 1-1000 reserved for Atmosphere. */
|
/* Result 1-1000 reserved for Atmosphere. */
|
||||||
R_DEFINE_ERROR_RESULT(ExosphereNotPresent, 1);
|
R_DEFINE_ERROR_RESULT(NotPresent, 1);
|
||||||
R_DEFINE_ERROR_RESULT(VersionMismatch, 2);
|
R_DEFINE_ERROR_RESULT(VersionMismatch, 2);
|
||||||
|
|
||||||
/* Results 1000-2000 reserved for Atmosphere Mitm. */
|
|
||||||
namespace mitm {
|
|
||||||
|
|
||||||
R_DEFINE_ERROR_RESULT(ShouldForwardToSession, 1000);
|
|
||||||
R_DEFINE_ERROR_RESULT(ProcessNotAssociated, 1100);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::fatal {
|
namespace ams::fatal {
|
||||||
|
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(163);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(163);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::fs {
|
namespace ams::fs {
|
||||||
|
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(2);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(2);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::sf::hipc {
|
namespace ams::sf::hipc {
|
||||||
|
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(11);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(11);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::i2c {
|
namespace ams::i2c {
|
||||||
|
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(101);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(101);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::kvdb {
|
namespace ams::kvdb {
|
||||||
|
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(20);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(20);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::ldr {
|
namespace ams::ldr {
|
||||||
|
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(9);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(9);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::lr {
|
namespace ams::lr {
|
||||||
|
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(8);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(8);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::ncm {
|
namespace ams::ncm {
|
||||||
|
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(5);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(5);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::os {
|
namespace ams::os {
|
||||||
|
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(3);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(3);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::pm {
|
namespace ams::pm {
|
||||||
|
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(15);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(15);
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include <climits>
|
#include <climits>
|
||||||
#include "../defines.hpp"
|
#include "../defines.hpp"
|
||||||
|
|
||||||
namespace sts {
|
namespace ams {
|
||||||
|
|
||||||
namespace result::impl {
|
namespace result::impl {
|
||||||
|
|
||||||
@ -179,17 +179,17 @@ namespace sts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Macros for defining new results. */
|
/* Macros for defining new results. */
|
||||||
#define R_DEFINE_NAMESPACE_RESULT_MODULE(value) namespace impl::result { static constexpr inline ::sts::result::impl::ResultTraits::BaseType ResultModuleId = value; }
|
#define R_DEFINE_NAMESPACE_RESULT_MODULE(value) namespace impl::result { static constexpr inline ::ams::result::impl::ResultTraits::BaseType ResultModuleId = value; }
|
||||||
#define R_CURRENT_NAMESPACE_RESULT_MODULE impl::result::ResultModuleId
|
#define R_CURRENT_NAMESPACE_RESULT_MODULE impl::result::ResultModuleId
|
||||||
#define R_NAMESPACE_MODULE_ID(nmspc) nmspc::R_CURRENT_NAMESPACE_RESULT_MODULE
|
#define R_NAMESPACE_MODULE_ID(nmspc) nmspc::R_CURRENT_NAMESPACE_RESULT_MODULE
|
||||||
|
|
||||||
#define R_MAKE_NAMESPACE_RESULT(nmspc, desc) static_cast<::sts::Result>(::sts::result::impl::ResultTraits::MakeValue(R_NAMESPACE_MODULE_ID(nmspc), desc))
|
#define R_MAKE_NAMESPACE_RESULT(nmspc, desc) static_cast<::ams::Result>(::ams::result::impl::ResultTraits::MakeValue(R_NAMESPACE_MODULE_ID(nmspc), desc))
|
||||||
|
|
||||||
#define R_DEFINE_ERROR_RESULT_IMPL(name, desc_start, desc_end) \
|
#define R_DEFINE_ERROR_RESULT_IMPL(name, desc_start, desc_end) \
|
||||||
class Result##name final : public ::sts::result::impl::ResultErrorBase<R_CURRENT_NAMESPACE_RESULT_MODULE, desc_start>, public ::sts::result::impl::ResultErrorRangeBase<R_CURRENT_NAMESPACE_RESULT_MODULE, desc_start, desc_end> {}
|
class Result##name final : public ::ams::result::impl::ResultErrorBase<R_CURRENT_NAMESPACE_RESULT_MODULE, desc_start>, public ::ams::result::impl::ResultErrorRangeBase<R_CURRENT_NAMESPACE_RESULT_MODULE, desc_start, desc_end> {}
|
||||||
|
|
||||||
#define R_DEFINE_ABSTRACT_ERROR_RESULT_IMPL(name, desc_start, desc_end) \
|
#define R_DEFINE_ABSTRACT_ERROR_RESULT_IMPL(name, desc_start, desc_end) \
|
||||||
class Result##name final : public ::sts::result::impl::ResultErrorRangeBase<R_CURRENT_NAMESPACE_RESULT_MODULE, desc_start, desc_end> {}
|
class Result##name final : public ::ams::result::impl::ResultErrorRangeBase<R_CURRENT_NAMESPACE_RESULT_MODULE, desc_start, desc_end> {}
|
||||||
|
|
||||||
|
|
||||||
#define R_DEFINE_ERROR_RESULT(name, desc) R_DEFINE_ERROR_RESULT_IMPL(name, desc, desc)
|
#define R_DEFINE_ERROR_RESULT(name, desc) R_DEFINE_ERROR_RESULT_IMPL(name, desc, desc)
|
||||||
@ -211,8 +211,8 @@ namespace sts {
|
|||||||
|
|
||||||
#undef R_FAILED
|
#undef R_FAILED
|
||||||
|
|
||||||
#define R_SUCCEEDED(res) (static_cast<::sts::Result>(res).IsSuccess())
|
#define R_SUCCEEDED(res) (static_cast<::ams::Result>(res).IsSuccess())
|
||||||
#define R_FAILED(res) (static_cast<::sts::Result>(res).IsFailure())
|
#define R_FAILED(res) (static_cast<::ams::Result>(res).IsFailure())
|
||||||
|
|
||||||
|
|
||||||
/// Evaluates an expression that returns a result, and returns the result if it would fail.
|
/// Evaluates an expression that returns a result, and returns the result if it would fail.
|
||||||
@ -229,7 +229,7 @@ namespace sts {
|
|||||||
({ \
|
({ \
|
||||||
const auto _tmp_r_assert_rc = res_expr; \
|
const auto _tmp_r_assert_rc = res_expr; \
|
||||||
if (R_FAILED(_tmp_r_assert_rc)) { \
|
if (R_FAILED(_tmp_r_assert_rc)) { \
|
||||||
::sts::result::impl::OnResultAssertion(_tmp_r_assert_rc); \
|
::ams::result::impl::OnResultAssertion(_tmp_r_assert_rc); \
|
||||||
} \
|
} \
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ namespace sts {
|
|||||||
#define R_UNLESS(expr, res) \
|
#define R_UNLESS(expr, res) \
|
||||||
({ \
|
({ \
|
||||||
if (!(expr)) { \
|
if (!(expr)) { \
|
||||||
return static_cast<::sts::Result>(res); \
|
return static_cast<::ams::Result>(res); \
|
||||||
} \
|
} \
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -250,7 +250,7 @@ namespace sts {
|
|||||||
if (R_FAILED(R_CURRENT_RESULT)) { \
|
if (R_FAILED(R_CURRENT_RESULT)) { \
|
||||||
if (false)
|
if (false)
|
||||||
|
|
||||||
namespace sts::result::impl {
|
namespace ams::result::impl {
|
||||||
|
|
||||||
template<typename... Rs>
|
template<typename... Rs>
|
||||||
NX_CONSTEXPR bool AnyIncludes(Result result) {
|
NX_CONSTEXPR bool AnyIncludes(Result result) {
|
||||||
@ -260,18 +260,18 @@ namespace sts::result::impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define R_CATCH(...) \
|
#define R_CATCH(...) \
|
||||||
} else if (::sts::result::impl::AnyIncludes<__VA_ARGS__>(R_CURRENT_RESULT)) { \
|
} else if (::ams::result::impl::AnyIncludes<__VA_ARGS__>(R_CURRENT_RESULT)) { \
|
||||||
if (true)
|
if (true)
|
||||||
|
|
||||||
#define R_CONVERT(catch_type, convert_type) \
|
#define R_CONVERT(catch_type, convert_type) \
|
||||||
R_CATCH(catch_type) { return static_cast<::sts::Result>(convert_type); }
|
R_CATCH(catch_type) { return static_cast<::ams::Result>(convert_type); }
|
||||||
|
|
||||||
#define R_CATCH_ALL() \
|
#define R_CATCH_ALL() \
|
||||||
} else if (R_FAILED(R_CURRENT_RESULT)) { \
|
} else if (R_FAILED(R_CURRENT_RESULT)) { \
|
||||||
if (true)
|
if (true)
|
||||||
|
|
||||||
#define R_CONVERT_ALL(convert_type) \
|
#define R_CONVERT_ALL(convert_type) \
|
||||||
R_CATCH_ALL() { return static_cast<::sts::Result>(convert_type); }
|
R_CATCH_ALL() { return static_cast<::ams::Result>(convert_type); }
|
||||||
|
|
||||||
#define R_END_TRY_CATCH \
|
#define R_END_TRY_CATCH \
|
||||||
else if (R_FAILED(R_CURRENT_RESULT)) { \
|
else if (R_FAILED(R_CURRENT_RESULT)) { \
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::ro {
|
namespace ams::ro {
|
||||||
|
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(22);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(22);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::settings {
|
namespace ams::settings {
|
||||||
|
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(105);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(105);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::sf {
|
namespace ams::sf {
|
||||||
|
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(10);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(10);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::sm {
|
namespace ams::sm {
|
||||||
|
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(21);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(21);
|
||||||
|
|
||||||
@ -31,4 +31,12 @@ namespace sts::sm {
|
|||||||
R_DEFINE_ERROR_RESULT(NotAllowed, 8);
|
R_DEFINE_ERROR_RESULT(NotAllowed, 8);
|
||||||
R_DEFINE_ERROR_RESULT(TooLargeAccessControl, 9);
|
R_DEFINE_ERROR_RESULT(TooLargeAccessControl, 9);
|
||||||
|
|
||||||
|
/* Results 1000-2000 used as extension for Atmosphere Mitm. */
|
||||||
|
namespace mitm {
|
||||||
|
|
||||||
|
R_DEFINE_ERROR_RESULT(ShouldForwardToSession, 1000);
|
||||||
|
R_DEFINE_ERROR_RESULT(ProcessNotAssociated, 1100);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::spl {
|
namespace ams::spl {
|
||||||
|
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(26);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(26);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::svc {
|
namespace ams::svc {
|
||||||
|
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(1);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(1);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::updater {
|
namespace ams::updater {
|
||||||
|
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(158);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(158);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "results_common.hpp"
|
#include "results_common.hpp"
|
||||||
|
|
||||||
namespace sts::vi {
|
namespace ams::vi {
|
||||||
|
|
||||||
R_DEFINE_NAMESPACE_RESULT_MODULE(114);
|
R_DEFINE_NAMESPACE_RESULT_MODULE(114);
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include <limits>
|
#include <limits>
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
|
|
||||||
namespace sts::rnd {
|
namespace ams::rnd {
|
||||||
|
|
||||||
/* Random utilities. */
|
/* Random utilities. */
|
||||||
void GenerateRandomBytes(void* out, size_t size);
|
void GenerateRandomBytes(void* out, size_t size);
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "../defines.hpp"
|
#include "../defines.hpp"
|
||||||
#include "../ncm.hpp"
|
#include "../ncm.hpp"
|
||||||
|
|
||||||
namespace sts::ro {
|
namespace ams::ro {
|
||||||
|
|
||||||
enum class ModuleType : u8 {
|
enum class ModuleType : u8 {
|
||||||
ForSelf = 0,
|
ForSelf = 0,
|
||||||
@ -63,7 +63,7 @@ namespace sts::ro {
|
|||||||
|
|
||||||
ModuleType GetType() const {
|
ModuleType GetType() const {
|
||||||
const ModuleType type = static_cast<ModuleType>(this->type);
|
const ModuleType type = static_cast<ModuleType>(this->type);
|
||||||
STS_ASSERT(type < ModuleType::Count);
|
AMS_ASSERT(type < ModuleType::Count);
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "../sf_common.hpp"
|
#include "../sf_common.hpp"
|
||||||
#include "sf_cmif_service_object_holder.hpp"
|
#include "sf_cmif_service_object_holder.hpp"
|
||||||
|
|
||||||
namespace sts::sf::cmif {
|
namespace ams::sf::cmif {
|
||||||
|
|
||||||
struct DomainObjectId {
|
struct DomainObjectId {
|
||||||
u32 value;
|
u32 value;
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "sf_cmif_domain_api.hpp"
|
#include "sf_cmif_domain_api.hpp"
|
||||||
#include "sf_cmif_domain_service_object.hpp"
|
#include "sf_cmif_domain_service_object.hpp"
|
||||||
|
|
||||||
namespace sts::sf::cmif {
|
namespace ams::sf::cmif {
|
||||||
|
|
||||||
class ServerDomainManager {
|
class ServerDomainManager {
|
||||||
NON_COPYABLE(ServerDomainManager);
|
NON_COPYABLE(ServerDomainManager);
|
||||||
@ -85,7 +85,7 @@ namespace sts::sf::cmif {
|
|||||||
|
|
||||||
inline DomainObjectId GetId(Entry *e) {
|
inline DomainObjectId GetId(Entry *e) {
|
||||||
const size_t index = e - this->entries;
|
const size_t index = e - this->entries;
|
||||||
STS_ASSERT(index < this->num_entries);
|
AMS_ASSERT(index < this->num_entries);
|
||||||
return DomainObjectId{ u32(index + 1) };
|
return DomainObjectId{ u32(index + 1) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "sf_cmif_domain_api.hpp"
|
#include "sf_cmif_domain_api.hpp"
|
||||||
#include "sf_cmif_server_message_processor.hpp"
|
#include "sf_cmif_server_message_processor.hpp"
|
||||||
|
|
||||||
namespace sts::sf::cmif {
|
namespace ams::sf::cmif {
|
||||||
|
|
||||||
class DomainServiceObjectDispatchTable : public impl::ServiceDispatchTableBase {
|
class DomainServiceObjectDispatchTable : public impl::ServiceDispatchTableBase {
|
||||||
private:
|
private:
|
||||||
@ -41,8 +41,8 @@ namespace sts::sf::cmif {
|
|||||||
ServerMessageRuntimeMetadata impl_metadata;
|
ServerMessageRuntimeMetadata impl_metadata;
|
||||||
public:
|
public:
|
||||||
DomainServiceObjectProcessor(ServerDomainBase *d, DomainObjectId *in_obj_ids, size_t num_in_objs) : domain(d), in_object_ids(in_obj_ids), num_in_objects(num_in_objs) {
|
DomainServiceObjectProcessor(ServerDomainBase *d, DomainObjectId *in_obj_ids, size_t num_in_objs) : domain(d), in_object_ids(in_obj_ids), num_in_objects(num_in_objs) {
|
||||||
STS_ASSERT(this->domain != nullptr);
|
AMS_ASSERT(this->domain != nullptr);
|
||||||
STS_ASSERT(this->in_object_ids != nullptr);
|
AMS_ASSERT(this->in_object_ids != nullptr);
|
||||||
this->impl_processor = nullptr;
|
this->impl_processor = nullptr;
|
||||||
this->out_object_ids = nullptr;
|
this->out_object_ids = nullptr;
|
||||||
this->impl_metadata = {};
|
this->impl_metadata = {};
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "../sf_common.hpp"
|
#include "../sf_common.hpp"
|
||||||
|
|
||||||
namespace sts::sf::cmif {
|
namespace ams::sf::cmif {
|
||||||
|
|
||||||
class PointerAndSize {
|
class PointerAndSize {
|
||||||
private:
|
private:
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "../sf_service_object.hpp"
|
#include "../sf_service_object.hpp"
|
||||||
#include "sf_cmif_pointer_and_size.hpp"
|
#include "sf_cmif_pointer_and_size.hpp"
|
||||||
|
|
||||||
namespace sts::sf::cmif {
|
namespace ams::sf::cmif {
|
||||||
|
|
||||||
/* Forward declare ServiceDispatchContext, ServiceObjectHolder. */
|
/* Forward declare ServiceDispatchContext, ServiceObjectHolder. */
|
||||||
struct ServiceDispatchContext;
|
struct ServiceDispatchContext;
|
||||||
|
@ -19,14 +19,14 @@
|
|||||||
#include "sf_cmif_pointer_and_size.hpp"
|
#include "sf_cmif_pointer_and_size.hpp"
|
||||||
#include "sf_cmif_server_message_processor.hpp"
|
#include "sf_cmif_server_message_processor.hpp"
|
||||||
|
|
||||||
namespace sts::sf::hipc {
|
namespace ams::sf::hipc {
|
||||||
|
|
||||||
class ServerSessionManager;
|
class ServerSessionManager;
|
||||||
class ServerSession;
|
class ServerSession;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace sts::sf::cmif {
|
namespace ams::sf::cmif {
|
||||||
|
|
||||||
class ServerMessageProcessor;
|
class ServerMessageProcessor;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "../sf_service_object.hpp"
|
#include "../sf_service_object.hpp"
|
||||||
#include "sf_cmif_service_dispatch.hpp"
|
#include "sf_cmif_service_dispatch.hpp"
|
||||||
|
|
||||||
namespace sts::sf::cmif {
|
namespace ams::sf::cmif {
|
||||||
|
|
||||||
class ServiceObjectHolder {
|
class ServiceObjectHolder {
|
||||||
private:
|
private:
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "../sf_common.hpp"
|
#include "../sf_common.hpp"
|
||||||
#include "../cmif/sf_cmif_pointer_and_size.hpp"
|
#include "../cmif/sf_cmif_pointer_and_size.hpp"
|
||||||
|
|
||||||
namespace sts::sf::hipc {
|
namespace ams::sf::hipc {
|
||||||
|
|
||||||
constexpr size_t TlsMessageBufferSize = 0x100;
|
constexpr size_t TlsMessageBufferSize = 0x100;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "sf_hipc_server_session_manager.hpp"
|
#include "sf_hipc_server_session_manager.hpp"
|
||||||
#include "../cmif/sf_cmif_domain_manager.hpp"
|
#include "../cmif/sf_cmif_domain_manager.hpp"
|
||||||
|
|
||||||
namespace sts::sf::hipc {
|
namespace ams::sf::hipc {
|
||||||
|
|
||||||
class ServerDomainSessionManager : public ServerSessionManager, private cmif::ServerDomainManager {
|
class ServerDomainSessionManager : public ServerSessionManager, private cmif::ServerDomainManager {
|
||||||
protected:
|
protected:
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "sf_hipc_server_domain_session_manager.hpp"
|
#include "sf_hipc_server_domain_session_manager.hpp"
|
||||||
|
|
||||||
namespace sts::sf::hipc {
|
namespace ams::sf::hipc {
|
||||||
|
|
||||||
struct DefaultServerManagerOptions {
|
struct DefaultServerManagerOptions {
|
||||||
static constexpr size_t PointerBufferSize = 0;
|
static constexpr size_t PointerBufferSize = 0;
|
||||||
@ -148,7 +148,7 @@ namespace sts::sf::hipc {
|
|||||||
void RegisterServerImpl(Handle port_handle, sm::ServiceName service_name, bool managed, cmif::ServiceObjectHolder &&static_holder) {
|
void RegisterServerImpl(Handle port_handle, sm::ServiceName service_name, bool managed, cmif::ServiceObjectHolder &&static_holder) {
|
||||||
/* Allocate server memory. */
|
/* Allocate server memory. */
|
||||||
auto *server = this->AllocateServer();
|
auto *server = this->AllocateServer();
|
||||||
STS_ASSERT(server != nullptr);
|
AMS_ASSERT(server != nullptr);
|
||||||
new (server) Server<ServiceImpl, MakeShared>(port_handle, service_name, managed, std::forward<cmif::ServiceObjectHolder>(static_holder));
|
new (server) Server<ServiceImpl, MakeShared>(port_handle, service_name, managed, std::forward<cmif::ServiceObjectHolder>(static_holder));
|
||||||
|
|
||||||
if constexpr (!ServiceObjectTraits<ServiceImpl>::IsMitmServiceObject) {
|
if constexpr (!ServiceObjectTraits<ServiceImpl>::IsMitmServiceObject) {
|
||||||
@ -253,13 +253,13 @@ namespace sts::sf::hipc {
|
|||||||
private:
|
private:
|
||||||
constexpr inline size_t GetServerIndex(const ServerBase *server) const {
|
constexpr inline size_t GetServerIndex(const ServerBase *server) const {
|
||||||
const size_t i = server - GetPointer(this->server_storages[0]);
|
const size_t i = server - GetPointer(this->server_storages[0]);
|
||||||
STS_ASSERT(i < MaxServers);
|
AMS_ASSERT(i < MaxServers);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr inline size_t GetSessionIndex(const ServerSession *session) const {
|
constexpr inline size_t GetSessionIndex(const ServerSession *session) const {
|
||||||
const size_t i = session - GetPointer(this->session_storages[0]);
|
const size_t i = session - GetPointer(this->session_storages[0]);
|
||||||
STS_ASSERT(i < MaxSessions);
|
AMS_ASSERT(i < MaxSessions);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,7 +281,7 @@ namespace sts::sf::hipc {
|
|||||||
virtual void FreeSession(ServerSession *session) override final {
|
virtual void FreeSession(ServerSession *session) override final {
|
||||||
std::scoped_lock lk(this->resource_mutex);
|
std::scoped_lock lk(this->resource_mutex);
|
||||||
const size_t index = this->GetSessionIndex(session);
|
const size_t index = this->GetSessionIndex(session);
|
||||||
STS_ASSERT(this->session_allocated[index]);
|
AMS_ASSERT(this->session_allocated[index]);
|
||||||
this->session_allocated[index] = false;
|
this->session_allocated[index] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,7 +299,7 @@ namespace sts::sf::hipc {
|
|||||||
virtual void DestroyServer(ServerBase *server) override final {
|
virtual void DestroyServer(ServerBase *server) override final {
|
||||||
std::scoped_lock lk(this->resource_mutex);
|
std::scoped_lock lk(this->resource_mutex);
|
||||||
const size_t index = this->GetServerIndex(server);
|
const size_t index = this->GetServerIndex(server);
|
||||||
STS_ASSERT(this->server_allocated[index]);
|
AMS_ASSERT(this->server_allocated[index]);
|
||||||
server->~ServerBase();
|
server->~ServerBase();
|
||||||
this->server_allocated[index] = false;
|
this->server_allocated[index] = false;
|
||||||
}
|
}
|
||||||
@ -319,8 +319,8 @@ namespace sts::sf::hipc {
|
|||||||
std::scoped_lock lk(this->resource_mutex);
|
std::scoped_lock lk(this->resource_mutex);
|
||||||
DomainStorage *ptr = static_cast<DomainStorage *>(domain);
|
DomainStorage *ptr = static_cast<DomainStorage *>(domain);
|
||||||
const size_t index = ptr - this->domain_storages;
|
const size_t index = ptr - this->domain_storages;
|
||||||
STS_ASSERT(index < ManagerOptions::MaxDomains);
|
AMS_ASSERT(index < ManagerOptions::MaxDomains);
|
||||||
STS_ASSERT(this->domain_allocated[index]);
|
AMS_ASSERT(this->domain_allocated[index]);
|
||||||
this->domain_allocated[index] = false;
|
this->domain_allocated[index] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,13 +21,13 @@
|
|||||||
#include "../cmif/sf_cmif_service_object_holder.hpp"
|
#include "../cmif/sf_cmif_service_object_holder.hpp"
|
||||||
#include "sf_hipc_api.hpp"
|
#include "sf_hipc_api.hpp"
|
||||||
|
|
||||||
namespace sts::sf::cmif {
|
namespace ams::sf::cmif {
|
||||||
|
|
||||||
struct ServiceDispatchContext;
|
struct ServiceDispatchContext;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace sts::sf::hipc {
|
namespace ams::sf::hipc {
|
||||||
|
|
||||||
class ServerSessionManager;
|
class ServerSessionManager;
|
||||||
class ServerManagerBase;
|
class ServerManagerBase;
|
||||||
@ -58,14 +58,14 @@ namespace sts::sf::hipc {
|
|||||||
this->is_closed = false;
|
this->is_closed = false;
|
||||||
this->has_received = false;
|
this->has_received = false;
|
||||||
this->forward_service = nullptr;
|
this->forward_service = nullptr;
|
||||||
STS_ASSERT(!this->IsMitmSession());
|
AMS_ASSERT(!this->IsMitmSession());
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerSession(Handle h, cmif::ServiceObjectHolder &&obj, std::shared_ptr<::Service> &&fsrv) : WaitableHolder(h), srv_obj_holder(std::move(obj)), session_handle(h) {
|
ServerSession(Handle h, cmif::ServiceObjectHolder &&obj, std::shared_ptr<::Service> &&fsrv) : WaitableHolder(h), srv_obj_holder(std::move(obj)), session_handle(h) {
|
||||||
this->is_closed = false;
|
this->is_closed = false;
|
||||||
this->has_received = false;
|
this->has_received = false;
|
||||||
this->forward_service = std::move(fsrv);
|
this->forward_service = std::move(fsrv);
|
||||||
STS_ASSERT(this->IsMitmSession());
|
AMS_ASSERT(this->IsMitmSession());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsMitmSession() const {
|
bool IsMitmSession() const {
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include "../hipc/sf_hipc_server_session_manager.hpp"
|
#include "../hipc/sf_hipc_server_session_manager.hpp"
|
||||||
|
|
||||||
/* Serialization classes. */
|
/* Serialization classes. */
|
||||||
namespace sts::sf {
|
namespace ams::sf {
|
||||||
|
|
||||||
namespace impl {
|
namespace impl {
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ namespace sts::sf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace sts::sf::impl {
|
namespace ams::sf::impl {
|
||||||
|
|
||||||
/* Machinery for filtering type lists. */
|
/* Machinery for filtering type lists. */
|
||||||
template<class, class>
|
template<class, class>
|
||||||
@ -167,7 +167,7 @@ namespace sts::sf::impl {
|
|||||||
return ArgumentType::OutData;
|
return ArgumentType::OutData;
|
||||||
} else if constexpr (std::is_trivial<T>::value && !std::is_pointer<T>::value) {
|
} else if constexpr (std::is_trivial<T>::value && !std::is_pointer<T>::value) {
|
||||||
return ArgumentType::InData;
|
return ArgumentType::InData;
|
||||||
} else if constexpr (std::is_same<T, ::sts::Result>::value) {
|
} else if constexpr (std::is_same<T, ::ams::Result>::value) {
|
||||||
return ArgumentType::InData;
|
return ArgumentType::InData;
|
||||||
} else {
|
} else {
|
||||||
static_assert(!std::is_same<T, T>::value, "Invalid ArgumentType<T>");
|
static_assert(!std::is_same<T, T>::value, "Invalid ArgumentType<T>");
|
||||||
@ -1020,7 +1020,7 @@ namespace sts::sf::impl {
|
|||||||
/* Fake buffer. This is either InData or OutData, but serializing over buffers. */
|
/* Fake buffer. This is either InData or OutData, but serializing over buffers. */
|
||||||
constexpr auto Attributes = CommandMeta::BufferAttributes[Info.buffer_index];
|
constexpr auto Attributes = CommandMeta::BufferAttributes[Info.buffer_index];
|
||||||
if constexpr (Attributes & SfBufferAttr_In) {
|
if constexpr (Attributes & SfBufferAttr_In) {
|
||||||
/* TODO: STS_ASSERT()? N does not bother. */
|
/* TODO: AMS_ASSERT()? N does not bother. */
|
||||||
return *reinterpret_cast<const T *>(buffers[Info.buffer_index].GetAddress());
|
return *reinterpret_cast<const T *>(buffers[Info.buffer_index].GetAddress());
|
||||||
} else if constexpr (Attributes & SfBufferAttr_Out) {
|
} else if constexpr (Attributes & SfBufferAttr_Out) {
|
||||||
return T(buffers[Info.buffer_index]);
|
return T(buffers[Info.buffer_index]);
|
||||||
@ -1139,7 +1139,7 @@ namespace sts::sf::impl {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace sts::sf {
|
namespace ams::sf {
|
||||||
|
|
||||||
template <auto CommandId, auto CommandImpl, hos::Version Low = hos::Version_Min, hos::Version High = hos::Version_Max>
|
template <auto CommandId, auto CommandImpl, hos::Version Low = hos::Version_Min, hos::Version High = hos::Version_Max>
|
||||||
inline static constexpr cmif::ServiceCommandMeta MakeServiceCommandMeta() {
|
inline static constexpr cmif::ServiceCommandMeta MakeServiceCommandMeta() {
|
||||||
@ -1147,10 +1147,10 @@ namespace sts::sf {
|
|||||||
.hosver_low = Low,
|
.hosver_low = Low,
|
||||||
.hosver_high = High,
|
.hosver_high = High,
|
||||||
.cmd_id = static_cast<u32>(CommandId),
|
.cmd_id = static_cast<u32>(CommandId),
|
||||||
.handler = ::sts::sf::impl::InvokeServiceCommandImpl<CommandImpl>,
|
.handler = ::ams::sf::impl::InvokeServiceCommandImpl<CommandImpl>,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAKE_SERVICE_COMMAND_META(Name, ...) ::sts::sf::MakeServiceCommandMeta<ServiceImpl::CommandId::Name, &ServiceImpl::Name, ##__VA_ARGS__>()
|
#define MAKE_SERVICE_COMMAND_META(Name, ...) ::ams::sf::MakeServiceCommandMeta<ServiceImpl::CommandId::Name, &ServiceImpl::Name, ##__VA_ARGS__>()
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace sts::sf {
|
namespace ams::sf {
|
||||||
|
|
||||||
/* Helper structs for serialization of buffers. */
|
/* Helper structs for serialization of buffers. */
|
||||||
struct LargeData{};
|
struct LargeData{};
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "cmif/sf_cmif_pointer_and_size.hpp"
|
#include "cmif/sf_cmif_pointer_and_size.hpp"
|
||||||
#include "sf_buffer_tags.hpp"
|
#include "sf_buffer_tags.hpp"
|
||||||
|
|
||||||
namespace sts::sf {
|
namespace ams::sf {
|
||||||
|
|
||||||
enum class BufferTransferMode {
|
enum class BufferTransferMode {
|
||||||
MapAlias,
|
MapAlias,
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "sf_out.hpp"
|
#include "sf_out.hpp"
|
||||||
#include "cmif/sf_cmif_pointer_and_size.hpp"
|
#include "cmif/sf_cmif_pointer_and_size.hpp"
|
||||||
|
|
||||||
namespace sts::sf {
|
namespace ams::sf {
|
||||||
|
|
||||||
namespace impl {
|
namespace impl {
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "sf_common.hpp"
|
#include "sf_common.hpp"
|
||||||
#include "cmif/sf_cmif_pointer_and_size.hpp"
|
#include "cmif/sf_cmif_pointer_and_size.hpp"
|
||||||
|
|
||||||
namespace sts::sf {
|
namespace ams::sf {
|
||||||
|
|
||||||
namespace impl {
|
namespace impl {
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ namespace sts::sf {
|
|||||||
struct IsOutForceEnabled : public std::false_type{};
|
struct IsOutForceEnabled : public std::false_type{};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct IsOutForceEnabled<::sts::Result> : public std::true_type{};
|
struct IsOutForceEnabled<::ams::Result> : public std::true_type{};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
using IsOutEnabled = typename std::enable_if<std::is_trivial<T>::value || IsOutForceEnabled<T>::value>::type;
|
using IsOutEnabled = typename std::enable_if<std::is_trivial<T>::value || IsOutForceEnabled<T>::value>::type;
|
||||||
@ -44,7 +44,7 @@ namespace sts::sf {
|
|||||||
public:
|
public:
|
||||||
constexpr Out(uintptr_t p) : ptr(reinterpret_cast<T *>(p)) { /* ... */ }
|
constexpr Out(uintptr_t p) : ptr(reinterpret_cast<T *>(p)) { /* ... */ }
|
||||||
constexpr Out(T *p) : ptr(p) { /* ... */ }
|
constexpr Out(T *p) : ptr(p) { /* ... */ }
|
||||||
constexpr Out(const cmif::PointerAndSize &pas) : ptr(reinterpret_cast<T *>(pas.GetAddress())) { /* TODO: Is STS_ASSERT(pas.GetSize() >= sizeof(T)); necessary? */ }
|
constexpr Out(const cmif::PointerAndSize &pas) : ptr(reinterpret_cast<T *>(pas.GetAddress())) { /* TODO: Is AMS_ASSERT(pas.GetSize() >= sizeof(T)); necessary? */ }
|
||||||
|
|
||||||
void SetValue(const T& value) const {
|
void SetValue(const T& value) const {
|
||||||
*this->ptr = value;
|
*this->ptr = value;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "sf_common.hpp"
|
#include "sf_common.hpp"
|
||||||
#include "sf_out.hpp"
|
#include "sf_out.hpp"
|
||||||
|
|
||||||
namespace sts::sf {
|
namespace ams::sf {
|
||||||
|
|
||||||
class IServiceObject{};
|
class IServiceObject{};
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ namespace sts::sf {
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct ServiceObjectTraits {
|
struct ServiceObjectTraits {
|
||||||
static_assert(std::is_base_of<sts::sf::IServiceObject, T>::value, "ServiceObjectTraits requires ServiceObject");
|
static_assert(std::is_base_of<ams::sf::IServiceObject, T>::value, "ServiceObjectTraits requires ServiceObject");
|
||||||
|
|
||||||
static constexpr bool IsMitmServiceObject = std::is_base_of<IMitmServiceObject, T>::value;
|
static constexpr bool IsMitmServiceObject = std::is_base_of<IMitmServiceObject, T>::value;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include "sm_types.hpp"
|
#include "sm_types.hpp"
|
||||||
|
|
||||||
namespace sts::sm {
|
namespace ams::sm {
|
||||||
|
|
||||||
/* Ordinary SM API. */
|
/* Ordinary SM API. */
|
||||||
Result GetService(Service *out, ServiceName name);
|
Result GetService(Service *out, ServiceName name);
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "../ncm/ncm_types.hpp"
|
#include "../ncm/ncm_types.hpp"
|
||||||
#include "../os/os_common_types.hpp"
|
#include "../os/os_common_types.hpp"
|
||||||
|
|
||||||
namespace sts::sm::manager {
|
namespace ams::sm::manager {
|
||||||
|
|
||||||
/* Manager API. */
|
/* Manager API. */
|
||||||
Result RegisterProcess(os::ProcessId process_id, ncm::TitleId title_id, const void *acid, size_t acid_size, const void *aci, size_t aci_size);
|
Result RegisterProcess(os::ProcessId process_id, ncm::TitleId title_id, const void *acid, size_t acid_size, const void *aci, size_t aci_size);
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "sm_types.hpp"
|
#include "sm_types.hpp"
|
||||||
#include "../ncm/ncm_types.hpp"
|
#include "../ncm/ncm_types.hpp"
|
||||||
|
|
||||||
namespace sts::sm::mitm {
|
namespace ams::sm::mitm {
|
||||||
|
|
||||||
/* Mitm API. */
|
/* Mitm API. */
|
||||||
Result InstallMitm(Handle *out_port, Handle *out_query, ServiceName name);
|
Result InstallMitm(Handle *out_port, Handle *out_query, ServiceName name);
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include "sm_api.hpp"
|
#include "sm_api.hpp"
|
||||||
|
|
||||||
namespace sts::sm {
|
namespace ams::sm {
|
||||||
|
|
||||||
/* Utility, for scoped access to libnx services. */
|
/* Utility, for scoped access to libnx services. */
|
||||||
template<auto Initializer(), void Finalizer()>
|
template<auto Initializer(), void Finalizer()>
|
||||||
@ -62,7 +62,7 @@ namespace sts::sm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result Initialize() {
|
Result Initialize() {
|
||||||
STS_ASSERT(!this->has_initialized);
|
AMS_ASSERT(!this->has_initialized);
|
||||||
|
|
||||||
sm::DoWithSession([&]() {
|
sm::DoWithSession([&]() {
|
||||||
this->result = Initializer();
|
this->result = Initializer();
|
||||||
@ -73,7 +73,7 @@ namespace sts::sm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Finalize() {
|
void Finalize() {
|
||||||
STS_ASSERT(this->has_initialized);
|
AMS_ASSERT(this->has_initialized);
|
||||||
Finalizer();
|
Finalizer();
|
||||||
this->has_initialized = false;
|
this->has_initialized = false;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "../results.hpp"
|
#include "../results.hpp"
|
||||||
#include "../os.hpp"
|
#include "../os.hpp"
|
||||||
|
|
||||||
namespace sts::sm {
|
namespace ams::sm {
|
||||||
|
|
||||||
struct ServiceName {
|
struct ServiceName {
|
||||||
static constexpr size_t MaxLength = 8;
|
static constexpr size_t MaxLength = 8;
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "../spl_types.hpp"
|
#include "../spl_types.hpp"
|
||||||
|
|
||||||
namespace sts::spl::smc {
|
namespace ams::spl::smc {
|
||||||
|
|
||||||
/* Helpers for converting arguments. */
|
/* Helpers for converting arguments. */
|
||||||
inline u32 GetCryptAesMode(CipherMode mode, u32 keyslot) {
|
inline u32 GetCryptAesMode(CipherMode mode, u32 keyslot) {
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include "spl_types.hpp"
|
#include "spl_types.hpp"
|
||||||
|
|
||||||
namespace sts::spl {
|
namespace ams::spl {
|
||||||
|
|
||||||
HardwareType GetHardwareType();
|
HardwareType GetHardwareType();
|
||||||
MemoryArrangement GetMemoryArrangement();
|
MemoryArrangement GetMemoryArrangement();
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include "../results.hpp"
|
#include "../results.hpp"
|
||||||
|
|
||||||
namespace sts::spl {
|
namespace ams::spl {
|
||||||
|
|
||||||
namespace smc {
|
namespace smc {
|
||||||
|
|
||||||
@ -64,12 +64,12 @@ namespace sts::spl {
|
|||||||
NotPermitted = 6,
|
NotPermitted = 6,
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr inline ::sts::Result ConvertResult(Result smc_result) {
|
constexpr inline ::ams::Result ConvertResult(Result smc_result) {
|
||||||
/* smc::Result::Success becomes ResultSuccess() directly. */
|
/* smc::Result::Success becomes ResultSuccess() directly. */
|
||||||
R_UNLESS(smc_result != Result::Success, ResultSuccess());
|
R_UNLESS(smc_result != Result::Success, ResultSuccess());
|
||||||
|
|
||||||
/* Convert to the list of known SecureMonitorErrors. */
|
/* Convert to the list of known SecureMonitorErrors. */
|
||||||
const auto converted = R_MAKE_NAMESPACE_RESULT(::sts::spl, static_cast<u32>(smc_result));
|
const auto converted = R_MAKE_NAMESPACE_RESULT(::ams::spl, static_cast<u32>(smc_result));
|
||||||
if (spl::ResultSecureMonitorError::Includes(converted)) {
|
if (spl::ResultSecureMonitorError::Includes(converted)) {
|
||||||
return converted;
|
return converted;
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user