diff --git a/Makefile b/Makefile index 81873295..ad13188b 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ include $(DEVKITPRO)/libnx/switch_rules # INCLUDES is a list of directories containing header files #--------------------------------------------------------------------------------- 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 INCLUDES := include diff --git a/include/stratosphere/ams.hpp b/include/stratosphere/ams.hpp index 666633bd..8abd9924 100644 --- a/include/stratosphere/ams.hpp +++ b/include/stratosphere/ams.hpp @@ -17,7 +17,6 @@ #pragma once #include "ams/ams_types.hpp" -#include "ams/ams_hos_version_api.hpp" #include "ams/ams_exosphere_api.hpp" #include "ams/ams_emummc_api.hpp" #include "ams/ams_environment.hpp" diff --git a/include/stratosphere/ams/ams_emummc_api.hpp b/include/stratosphere/ams/ams_emummc_api.hpp index 5a666140..e1d3d21e 100644 --- a/include/stratosphere/ams/ams_emummc_api.hpp +++ b/include/stratosphere/ams/ams_emummc_api.hpp @@ -17,7 +17,7 @@ #pragma once #include "ams_types.hpp" -namespace sts::ams::emummc { +namespace ams::emummc { /* Get whether emummc is active. */ bool IsActive(); diff --git a/include/stratosphere/ams/ams_environment.hpp b/include/stratosphere/ams/ams_environment.hpp index 55265ee3..d6138e1c 100644 --- a/include/stratosphere/ams/ams_environment.hpp +++ b/include/stratosphere/ams/ams_environment.hpp @@ -17,7 +17,7 @@ #pragma once #include "ams_types.hpp" -namespace sts::ams { +namespace ams { /* Will be called by libstratosphere on crash. */ void CrashHandler(ThreadExceptionDump *ctx); diff --git a/include/stratosphere/ams/ams_exosphere_api.hpp b/include/stratosphere/ams/ams_exosphere_api.hpp index 1c1dc7eb..9307ae7b 100644 --- a/include/stratosphere/ams/ams_exosphere_api.hpp +++ b/include/stratosphere/ams/ams_exosphere_api.hpp @@ -17,7 +17,7 @@ #pragma once #include "ams_types.hpp" -namespace sts::ams { +namespace ams::exosphere { ApiInfo GetApiInfo(); @@ -30,32 +30,24 @@ namespace sts::ams { 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); +} + +namespace ams { + /* Version checking utility. */ #ifdef ATMOSPHERE_RELEASE_VERSION_MAJOR #define ATMOSPHERE_RELEASE_VERSION ATMOSPHERE_RELEASE_VERSION_MAJOR, ATMOSPHERE_RELEASE_VERSION_MINOR, ATMOSPHERE_RELEASE_VERSION_MICRO inline void CheckApiVersion() { - const u32 runtime_version = GetApiInfo().GetVersion(); - const u32 build_version = GetVersion(ATMOSPHERE_RELEASE_VERSION); + const u32 runtime_version = exosphere::GetApiInfo().GetVersion(); + const u32 build_version = exosphere::GetVersion(ATMOSPHERE_RELEASE_VERSION); if (runtime_version < build_version) { - R_ASSERT(ams::ResultVersionMismatch()); + R_ASSERT(exosphere::ResultVersionMismatch()); } } #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 - } diff --git a/include/stratosphere/ams/ams_types.hpp b/include/stratosphere/ams/ams_types.hpp index 15e29808..661d940a 100644 --- a/include/stratosphere/ams/ams_types.hpp +++ b/include/stratosphere/ams/ams_types.hpp @@ -15,37 +15,12 @@ */ #pragma once -#include #include "../defines.hpp" #include "../results.hpp" #include "../sf/sf_buffer_tags.hpp" +#include "../hos.hpp" -/* Define firmware version in global namespace, for convenience. */ -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 { +namespace ams::exosphere { enum TargetFirmware : u32 { TargetFirmware_100 = 1, @@ -73,7 +48,7 @@ namespace sts::ams { u32 master_key_revision; 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 { @@ -85,6 +60,10 @@ namespace sts::ams { } }; +} + +namespace ams { + struct FatalErrorContext : sf::LargeData, sf::PrefersMapAliasTransferMode { static constexpr size_t MaxStackTrace = 0x20; static constexpr size_t MaxStackDumpSize = 0x100; @@ -124,4 +103,16 @@ namespace sts::ams { static_assert(sizeof(FatalErrorContext) == 0x350, "sizeof(FatalErrorContext)"); static_assert(std::is_pod::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 + } diff --git a/include/stratosphere/boot2/boot2_api.hpp b/include/stratosphere/boot2/boot2_api.hpp index 4dc788e0..468d8cdf 100644 --- a/include/stratosphere/boot2/boot2_api.hpp +++ b/include/stratosphere/boot2/boot2_api.hpp @@ -18,7 +18,7 @@ #include #include -namespace sts::boot2 { +namespace ams::boot2 { /* Boot2 API. */ diff --git a/include/stratosphere/cfg/cfg_api.hpp b/include/stratosphere/cfg/cfg_api.hpp index e00e0f79..292f18b0 100644 --- a/include/stratosphere/cfg/cfg_api.hpp +++ b/include/stratosphere/cfg/cfg_api.hpp @@ -19,7 +19,7 @@ #include "../os/os_common_types.hpp" #include "../ncm/ncm_types.hpp" -namespace sts::cfg { +namespace ams::cfg { /* Privileged Process configuration. */ bool IsInitialProcess(); diff --git a/include/stratosphere/dd/dd_io_mappings.hpp b/include/stratosphere/dd/dd_io_mappings.hpp index a0ba2fd9..c0d913f0 100644 --- a/include/stratosphere/dd/dd_io_mappings.hpp +++ b/include/stratosphere/dd/dd_io_mappings.hpp @@ -18,7 +18,7 @@ #include #include "../defines.hpp" -namespace sts::dd { +namespace ams::dd { 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) { const uintptr_t io_mapping = QueryIoMapping(phys_addr, size); - STS_ASSERT(io_mapping); + AMS_ASSERT(io_mapping); return io_mapping; } } diff --git a/include/stratosphere/defines.hpp b/include/stratosphere/defines.hpp index 79c7d7ec..d2dbd52d 100644 --- a/include/stratosphere/defines.hpp +++ b/include/stratosphere/defines.hpp @@ -20,9 +20,9 @@ /* 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) \ cls(const cls&) = delete; \ diff --git a/include/stratosphere/dmnt/dmnt_cheat_types.hpp b/include/stratosphere/dmnt/dmnt_cheat_types.hpp index 40413c30..3c5ed2da 100644 --- a/include/stratosphere/dmnt/dmnt_cheat_types.hpp +++ b/include/stratosphere/dmnt/dmnt_cheat_types.hpp @@ -20,7 +20,7 @@ #include "../ncm/ncm_types.hpp" #include "../sf/sf_buffer_tags.hpp" -namespace sts::dmnt::cheat { +namespace ams::dmnt::cheat { struct CheatProcessMetadata { struct MemoryRegionExtents { diff --git a/include/stratosphere/fatal/fatal_types.hpp b/include/stratosphere/fatal/fatal_types.hpp index c464a7b4..69996d37 100644 --- a/include/stratosphere/fatal/fatal_types.hpp +++ b/include/stratosphere/fatal/fatal_types.hpp @@ -21,7 +21,7 @@ #include "../ncm/ncm_types.hpp" #include "../sf/sf_buffer_tags.hpp" -namespace sts::fatal { +namespace ams::fatal { namespace aarch64 { diff --git a/include/stratosphere/hid/hid_api.hpp b/include/stratosphere/hid/hid_api.hpp index b1b97c63..b9cb8251 100644 --- a/include/stratosphere/hid/hid_api.hpp +++ b/include/stratosphere/hid/hid_api.hpp @@ -16,7 +16,7 @@ #pragma once -namespace sts::hid { +namespace ams::hid { /* Key API. */ Result GetKeysHeld(u64 *out); diff --git a/include/stratosphere/hos.hpp b/include/stratosphere/hos.hpp new file mode 100644 index 00000000..53098919 --- /dev/null +++ b/include/stratosphere/hos.hpp @@ -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 . + */ + +#pragma once + +#include "hos/hos_types.hpp" +#include "hos/hos_version_api.hpp" diff --git a/include/stratosphere/hos/hos_types.hpp b/include/stratosphere/hos/hos_types.hpp new file mode 100644 index 00000000..79b58a09 --- /dev/null +++ b/include/stratosphere/hos/hos_types.hpp @@ -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 . + */ + +#pragma once +#include +#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, + }; + +} diff --git a/include/stratosphere/ams/ams_hos_version_api.hpp b/include/stratosphere/hos/hos_version_api.hpp similarity index 89% rename from include/stratosphere/ams/ams_hos_version_api.hpp rename to include/stratosphere/hos/hos_version_api.hpp index 6197e489..3ccd99ac 100644 --- a/include/stratosphere/ams/ams_hos_version_api.hpp +++ b/include/stratosphere/hos/hos_version_api.hpp @@ -15,11 +15,11 @@ */ #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(); } diff --git a/include/stratosphere/kvdb/kvdb_archive.hpp b/include/stratosphere/kvdb/kvdb_archive.hpp index 64fe074d..5b7ab3e8 100644 --- a/include/stratosphere/kvdb/kvdb_archive.hpp +++ b/include/stratosphere/kvdb/kvdb_archive.hpp @@ -21,7 +21,7 @@ #include "kvdb_auto_buffer.hpp" -namespace sts::kvdb { +namespace ams::kvdb { /* Functionality for parsing/generating a key value archive. */ class ArchiveReader { diff --git a/include/stratosphere/kvdb/kvdb_auto_buffer.hpp b/include/stratosphere/kvdb/kvdb_auto_buffer.hpp index dd5df098..3b315e54 100644 --- a/include/stratosphere/kvdb/kvdb_auto_buffer.hpp +++ b/include/stratosphere/kvdb/kvdb_auto_buffer.hpp @@ -19,7 +19,7 @@ #include "../defines.hpp" #include "../results.hpp" -namespace sts::kvdb { +namespace ams::kvdb { class AutoBuffer { NON_COPYABLE(AutoBuffer); @@ -68,7 +68,7 @@ namespace sts::kvdb { Result Initialize(size_t size) { /* Check that we're not already initialized. */ - STS_ASSERT(this->buffer == nullptr); + AMS_ASSERT(this->buffer == nullptr); /* Allocate a buffer. */ this->buffer = static_cast(std::malloc(size)); diff --git a/include/stratosphere/kvdb/kvdb_bounded_string.hpp b/include/stratosphere/kvdb/kvdb_bounded_string.hpp index 8ab11dc8..f9aac8d5 100644 --- a/include/stratosphere/kvdb/kvdb_bounded_string.hpp +++ b/include/stratosphere/kvdb/kvdb_bounded_string.hpp @@ -21,7 +21,7 @@ #include "../defines.hpp" #include "../results.hpp" -namespace sts::kvdb { +namespace ams::kvdb { /* Represents a string with a backing buffer of N bytes. */ template @@ -32,7 +32,7 @@ namespace sts::kvdb { private: /* Utility. */ static inline void CheckLength(size_t len) { - STS_ASSERT(len < N); + AMS_ASSERT(len < N); } public: /* Constructors. */ @@ -113,8 +113,8 @@ namespace sts::kvdb { /* Substring utilities. */ void GetSubstring(char *dst, size_t dst_size, size_t offset, size_t length) const { /* Make sure output buffer can hold the substring. */ - STS_ASSERT(offset + length <= GetLength()); - STS_ASSERT(dst_size > length); + AMS_ASSERT(offset + length <= GetLength()); + AMS_ASSERT(dst_size > length); /* Copy substring to dst. */ std::strncpy(dst, this->buffer + offset, length); dst[length] = 0; diff --git a/include/stratosphere/kvdb/kvdb_file_key_value_cache.hpp b/include/stratosphere/kvdb/kvdb_file_key_value_cache.hpp index dc5a3f56..4c7b5b35 100644 --- a/include/stratosphere/kvdb/kvdb_file_key_value_cache.hpp +++ b/include/stratosphere/kvdb/kvdb_file_key_value_cache.hpp @@ -19,7 +19,7 @@ #include "kvdb_bounded_string.hpp" #include "kvdb_file_key_value_store.hpp" -namespace sts::kvdb { +namespace ams::kvdb { namespace impl { @@ -60,7 +60,7 @@ namespace sts::kvdb { } private: 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))); this->DecrementCount(); } @@ -77,7 +77,7 @@ namespace sts::kvdb { Result Initialize(const char *path, void *buf, size_t size) { /* Only initialize once, and ensure we have sufficient memory. */ - STS_ASSERT(this->keys == nullptr); + AMS_ASSERT(this->keys == nullptr); SSS_ASSERT(size >= BufferSize); /* Setup member variables. */ @@ -145,23 +145,23 @@ namespace sts::kvdb { } Key Get(size_t i) const { - STS_ASSERT(i < this->GetCount()); + AMS_ASSERT(i < this->GetCount()); return this->keys[i]; } Key Peek() const { - STS_ASSERT(!this->IsEmpty()); + AMS_ASSERT(!this->IsEmpty()); return this->Get(0); } void Push(const Key &key) { - STS_ASSERT(!this->IsFull()); + AMS_ASSERT(!this->IsFull()); this->keys[this->GetCount()] = key; this->IncrementCount(); } Key Pop() { - STS_ASSERT(!this->IsEmpty()); + AMS_ASSERT(!this->IsEmpty()); this->RemoveIndex(0); } diff --git a/include/stratosphere/kvdb/kvdb_file_key_value_store.hpp b/include/stratosphere/kvdb/kvdb_file_key_value_store.hpp index a58f89d4..83ce93be 100644 --- a/include/stratosphere/kvdb/kvdb_file_key_value_store.hpp +++ b/include/stratosphere/kvdb/kvdb_file_key_value_store.hpp @@ -21,7 +21,7 @@ #include "kvdb_bounded_string.hpp" -namespace sts::kvdb { +namespace ams::kvdb { class FileKeyValueStore { NON_COPYABLE(FileKeyValueStore); @@ -96,7 +96,7 @@ namespace sts::kvdb { static_assert(std::is_pod::value && !std::is_pointer::value, "Invalid FileKeyValueStore Value!"); size_t size = 0; R_TRY(this->Get(&size, out_value, sizeof(Value), key)); - STS_ASSERT(size >= sizeof(Value)); + AMS_ASSERT(size >= sizeof(Value)); return ResultSuccess(); } diff --git a/include/stratosphere/kvdb/kvdb_memory_key_value_store.hpp b/include/stratosphere/kvdb/kvdb_memory_key_value_store.hpp index dfdb5c67..e18a9a8c 100644 --- a/include/stratosphere/kvdb/kvdb_memory_key_value_store.hpp +++ b/include/stratosphere/kvdb/kvdb_memory_key_value_store.hpp @@ -25,7 +25,7 @@ #include "kvdb_archive.hpp" #include "kvdb_bounded_string.hpp" -namespace sts::kvdb { +namespace ams::kvdb { template class MemoryKeyValueStore { @@ -50,7 +50,7 @@ namespace sts::kvdb { Value *GetValuePointer() { /* Size check. Note: Nintendo does not size check. */ if constexpr (!std::is_same::value) { - STS_ASSERT(sizeof(Value) <= this->value_size); + AMS_ASSERT(sizeof(Value) <= this->value_size); /* Ensure we only get pod. */ static_assert(std::is_pod::value, "KeyValueStore Values must be pod"); } @@ -61,7 +61,7 @@ namespace sts::kvdb { const Value *GetValuePointer() const { /* Size check. Note: Nintendo does not size check. */ if constexpr (!std::is_same::value) { - STS_ASSERT(sizeof(Value) <= this->value_size); + AMS_ASSERT(sizeof(Value) <= this->value_size); /* Ensure we only get pod. */ static_assert(std::is_pod::value, "KeyValueStore Values must be pod"); } diff --git a/include/stratosphere/ldr/ldr_pm_api.hpp b/include/stratosphere/ldr/ldr_pm_api.hpp index 823c34b1..87a19428 100644 --- a/include/stratosphere/ldr/ldr_pm_api.hpp +++ b/include/stratosphere/ldr/ldr_pm_api.hpp @@ -18,7 +18,7 @@ #include "ldr_types.hpp" -namespace sts::ldr::pm { +namespace ams::ldr::pm { /* Process Manager API. */ Result CreateProcess(Handle *out, PinId pin_id, u32 flags, Handle reslimit); diff --git a/include/stratosphere/ldr/ldr_types.hpp b/include/stratosphere/ldr/ldr_types.hpp index ab92463e..b0b25a5d 100644 --- a/include/stratosphere/ldr/ldr_types.hpp +++ b/include/stratosphere/ldr/ldr_types.hpp @@ -22,7 +22,7 @@ #include "../ncm/ncm_types.hpp" #include "../sf/sf_buffer_tags.hpp" -namespace sts::ldr { +namespace ams::ldr { /* General types. */ struct ProgramInfo : sf::LargeData { diff --git a/include/stratosphere/map/map_api.hpp b/include/stratosphere/map/map_api.hpp index 75065447..26aca5c2 100644 --- a/include/stratosphere/map/map_api.hpp +++ b/include/stratosphere/map/map_api.hpp @@ -19,7 +19,7 @@ #include "map_types.hpp" -namespace sts::map { +namespace ams::map { /* Public API. */ Result GetProcessAddressSpaceInfo(AddressSpaceInfo *out, Handle process_h); diff --git a/include/stratosphere/map/map_types.hpp b/include/stratosphere/map/map_types.hpp index 28a0b8d1..ad33a9c4 100644 --- a/include/stratosphere/map/map_types.hpp +++ b/include/stratosphere/map/map_types.hpp @@ -18,7 +18,7 @@ #include #include "../results.hpp" -namespace sts::map { +namespace ams::map { /* Types. */ struct AddressSpaceInfo { diff --git a/include/stratosphere/ncm/ncm_types.hpp b/include/stratosphere/ncm/ncm_types.hpp index 722fc4ac..61aff676 100644 --- a/include/stratosphere/ncm/ncm_types.hpp +++ b/include/stratosphere/ncm/ncm_types.hpp @@ -18,7 +18,7 @@ #include -namespace sts::ncm { +namespace ams::ncm { /* Storage IDs. */ enum class StorageId : u8 { diff --git a/include/stratosphere/os/os_common_types.hpp b/include/stratosphere/os/os_common_types.hpp index 9ed48405..0e581d93 100644 --- a/include/stratosphere/os/os_common_types.hpp +++ b/include/stratosphere/os/os_common_types.hpp @@ -18,7 +18,7 @@ #include "../results.hpp" #include "../util.hpp" -namespace sts::os { +namespace ams::os { enum class TriBool { False = 0, diff --git a/include/stratosphere/os/os_condvar.hpp b/include/stratosphere/os/os_condvar.hpp index eed8e16c..4e00ade0 100644 --- a/include/stratosphere/os/os_condvar.hpp +++ b/include/stratosphere/os/os_condvar.hpp @@ -17,7 +17,7 @@ #pragma once #include "os_mutex.hpp" -namespace sts::os { +namespace ams::os { class ConditionVariable { NON_COPYABLE(ConditionVariable); diff --git a/include/stratosphere/os/os_event.hpp b/include/stratosphere/os/os_event.hpp index 461e0a23..b19ce3a6 100644 --- a/include/stratosphere/os/os_event.hpp +++ b/include/stratosphere/os/os_event.hpp @@ -19,7 +19,7 @@ #include "os_condvar.hpp" #include "os_timeout_helper.hpp" -namespace sts::os { +namespace ams::os { namespace impl { diff --git a/include/stratosphere/os/os_interrupt_event.hpp b/include/stratosphere/os/os_interrupt_event.hpp index d1fd1592..d11ab529 100644 --- a/include/stratosphere/os/os_interrupt_event.hpp +++ b/include/stratosphere/os/os_interrupt_event.hpp @@ -18,7 +18,7 @@ #include "os_common_types.hpp" #include "os_managed_handle.hpp" -namespace sts::os { +namespace ams::os { namespace impl { diff --git a/include/stratosphere/os/os_managed_handle.hpp b/include/stratosphere/os/os_managed_handle.hpp index 0d2d91ff..3f127d11 100644 --- a/include/stratosphere/os/os_managed_handle.hpp +++ b/include/stratosphere/os/os_managed_handle.hpp @@ -19,7 +19,7 @@ #include "../defines.hpp" #include "../results.hpp" -namespace sts::os { +namespace ams::os { class ManagedHandle { NON_COPYABLE(ManagedHandle); diff --git a/include/stratosphere/os/os_message_queue.hpp b/include/stratosphere/os/os_message_queue.hpp index a320e29c..f7e925b0 100644 --- a/include/stratosphere/os/os_message_queue.hpp +++ b/include/stratosphere/os/os_message_queue.hpp @@ -20,7 +20,7 @@ #include "os_mutex.hpp" #include "os_condvar.hpp" -namespace sts::os { +namespace ams::os { namespace impl { diff --git a/include/stratosphere/os/os_mutex.hpp b/include/stratosphere/os/os_mutex.hpp index c17038d8..d11dc7e0 100644 --- a/include/stratosphere/os/os_mutex.hpp +++ b/include/stratosphere/os/os_mutex.hpp @@ -19,14 +19,14 @@ #include #include "../util.hpp" -namespace sts::os { +namespace ams::os { class ConditionVariable; class Mutex { NON_COPYABLE(Mutex); NON_MOVEABLE(Mutex); - friend class sts::os::ConditionVariable; + friend class ams::os::ConditionVariable; private: ::Mutex m; private: diff --git a/include/stratosphere/os/os_semaphore.hpp b/include/stratosphere/os/os_semaphore.hpp index 3b8ac706..ae8c49ca 100644 --- a/include/stratosphere/os/os_semaphore.hpp +++ b/include/stratosphere/os/os_semaphore.hpp @@ -17,7 +17,7 @@ #pragma once #include -namespace sts::os { +namespace ams::os { class Semaphore { NON_COPYABLE(Semaphore); diff --git a/include/stratosphere/os/os_system_event.hpp b/include/stratosphere/os/os_system_event.hpp index 50654455..564ee407 100644 --- a/include/stratosphere/os/os_system_event.hpp +++ b/include/stratosphere/os/os_system_event.hpp @@ -18,7 +18,7 @@ #include "os_common_types.hpp" #include "os_event.hpp" -namespace sts::os { +namespace ams::os { class WaitableHolder; diff --git a/include/stratosphere/os/os_thread.hpp b/include/stratosphere/os/os_thread.hpp index a647e571..0c5da0be 100644 --- a/include/stratosphere/os/os_thread.hpp +++ b/include/stratosphere/os/os_thread.hpp @@ -17,7 +17,7 @@ #pragma once #include -namespace sts::os { +namespace ams::os { class Thread { NON_COPYABLE(Thread); diff --git a/include/stratosphere/os/os_timeout_helper.hpp b/include/stratosphere/os/os_timeout_helper.hpp index 31c52b38..f91398a2 100644 --- a/include/stratosphere/os/os_timeout_helper.hpp +++ b/include/stratosphere/os/os_timeout_helper.hpp @@ -16,7 +16,7 @@ #pragma once #include -namespace sts::os { +namespace ams::os { class TimeoutHelper { private: diff --git a/include/stratosphere/os/os_waitable_holder.hpp b/include/stratosphere/os/os_waitable_holder.hpp index 6118a3a2..dccbb6db 100644 --- a/include/stratosphere/os/os_waitable_holder.hpp +++ b/include/stratosphere/os/os_waitable_holder.hpp @@ -17,7 +17,7 @@ #include "../util.hpp" #include "os_common_types.hpp" -namespace sts::os { +namespace ams::os { class WaitableManager; diff --git a/include/stratosphere/os/os_waitable_manager.hpp b/include/stratosphere/os/os_waitable_manager.hpp index c4eaf721..b2b2fba8 100644 --- a/include/stratosphere/os/os_waitable_manager.hpp +++ b/include/stratosphere/os/os_waitable_manager.hpp @@ -18,7 +18,7 @@ #include "os_common_types.hpp" #include "os_mutex.hpp" -namespace sts::os { +namespace ams::os { class WaitableHolder; diff --git a/include/stratosphere/patcher/patcher_api.hpp b/include/stratosphere/patcher/patcher_api.hpp index 5be0f589..16735500 100644 --- a/include/stratosphere/patcher/patcher_api.hpp +++ b/include/stratosphere/patcher/patcher_api.hpp @@ -18,7 +18,7 @@ #include "../ro/ro_types.hpp" -namespace sts::patcher { +namespace ams::patcher { /* 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); diff --git a/include/stratosphere/pm/pm_boot_mode_api.hpp b/include/stratosphere/pm/pm_boot_mode_api.hpp index dee49a0a..326dc12e 100644 --- a/include/stratosphere/pm/pm_boot_mode_api.hpp +++ b/include/stratosphere/pm/pm_boot_mode_api.hpp @@ -18,7 +18,7 @@ #include "pm_types.hpp" -namespace sts::pm::bm { +namespace ams::pm::bm { /* Boot Mode API. */ BootMode GetBootMode(); diff --git a/include/stratosphere/pm/pm_dmnt_api.hpp b/include/stratosphere/pm/pm_dmnt_api.hpp index a9dc3894..01e7063a 100644 --- a/include/stratosphere/pm/pm_dmnt_api.hpp +++ b/include/stratosphere/pm/pm_dmnt_api.hpp @@ -19,7 +19,7 @@ #include "../ldr.hpp" #include "pm_types.hpp" -namespace sts::pm::dmnt { +namespace ams::pm::dmnt { /* Debug Monitor API. */ Result StartProcess(os::ProcessId process_id); diff --git a/include/stratosphere/pm/pm_info_api.hpp b/include/stratosphere/pm/pm_info_api.hpp index ab330ba2..1fb5248a 100644 --- a/include/stratosphere/pm/pm_info_api.hpp +++ b/include/stratosphere/pm/pm_info_api.hpp @@ -19,7 +19,7 @@ #include "pm_types.hpp" #include "../ncm/ncm_types.hpp" -namespace sts::pm::info { +namespace ams::pm::info { /* Information API. */ Result GetTitleId(ncm::TitleId *out_title_id, os::ProcessId process_id); diff --git a/include/stratosphere/pm/pm_shell_api.hpp b/include/stratosphere/pm/pm_shell_api.hpp index 4277e3f8..d513dff7 100644 --- a/include/stratosphere/pm/pm_shell_api.hpp +++ b/include/stratosphere/pm/pm_shell_api.hpp @@ -19,7 +19,7 @@ #include "../ldr.hpp" #include "pm_types.hpp" -namespace sts::pm::shell { +namespace ams::pm::shell { /* Shell API. */ Result LaunchTitle(os::ProcessId *out_process_id, const ncm::TitleLocation &loc, u32 launch_flags); diff --git a/include/stratosphere/pm/pm_types.hpp b/include/stratosphere/pm/pm_types.hpp index d7ad6ce6..36671b83 100644 --- a/include/stratosphere/pm/pm_types.hpp +++ b/include/stratosphere/pm/pm_types.hpp @@ -18,7 +18,7 @@ #include #include "../os/os_common_types.hpp" -namespace sts::pm { +namespace ams::pm { enum class BootMode { Normal = 0, diff --git a/include/stratosphere/reg.hpp b/include/stratosphere/reg.hpp index 5ff90518..b3748199 100644 --- a/include/stratosphere/reg.hpp +++ b/include/stratosphere/reg.hpp @@ -17,7 +17,7 @@ #pragma once #include -namespace sts::reg { +namespace ams::reg { inline void Write(volatile u32 *reg, u32 val) { *reg = val; diff --git a/include/stratosphere/results.hpp b/include/stratosphere/results.hpp index b3f11354..595235bc 100644 --- a/include/stratosphere/results.hpp +++ b/include/stratosphere/results.hpp @@ -45,4 +45,4 @@ #include "results/vi_results.hpp" /* Unofficial. */ -#include "results/ams_results.hpp" +#include "results/exosphere_results.hpp" diff --git a/include/stratosphere/results/cal_results.hpp b/include/stratosphere/results/cal_results.hpp index cdb7c81c..69f3a8b1 100644 --- a/include/stratosphere/results/cal_results.hpp +++ b/include/stratosphere/results/cal_results.hpp @@ -17,7 +17,7 @@ #pragma once #include "results_common.hpp" -namespace sts::cal { +namespace ams::cal { R_DEFINE_NAMESPACE_RESULT_MODULE(198); diff --git a/include/stratosphere/results/creport_results.hpp b/include/stratosphere/results/creport_results.hpp index eb3d0bc3..6f836d8b 100644 --- a/include/stratosphere/results/creport_results.hpp +++ b/include/stratosphere/results/creport_results.hpp @@ -17,7 +17,7 @@ #pragma once #include "results_common.hpp" -namespace sts::creport { +namespace ams::creport { R_DEFINE_NAMESPACE_RESULT_MODULE(168); diff --git a/include/stratosphere/results/debug_results.hpp b/include/stratosphere/results/debug_results.hpp index 868df16f..fcf9d661 100644 --- a/include/stratosphere/results/debug_results.hpp +++ b/include/stratosphere/results/debug_results.hpp @@ -17,7 +17,7 @@ #pragma once #include "results_common.hpp" -namespace sts::dbg { +namespace ams::dbg { R_DEFINE_NAMESPACE_RESULT_MODULE(183); diff --git a/include/stratosphere/results/dmnt_results.hpp b/include/stratosphere/results/dmnt_results.hpp index ec2fdd69..aaa1a3d8 100644 --- a/include/stratosphere/results/dmnt_results.hpp +++ b/include/stratosphere/results/dmnt_results.hpp @@ -17,7 +17,7 @@ #pragma once #include "results_common.hpp" -namespace sts::dmnt { +namespace ams::dmnt { R_DEFINE_NAMESPACE_RESULT_MODULE(13); diff --git a/include/stratosphere/results/err_results.hpp b/include/stratosphere/results/err_results.hpp index 05612b49..dd46dc53 100644 --- a/include/stratosphere/results/err_results.hpp +++ b/include/stratosphere/results/err_results.hpp @@ -17,7 +17,7 @@ #pragma once #include "results_common.hpp" -namespace sts::err { +namespace ams::err { R_DEFINE_NAMESPACE_RESULT_MODULE(162); diff --git a/include/stratosphere/results/ams_results.hpp b/include/stratosphere/results/exosphere_results.hpp similarity index 72% rename from include/stratosphere/results/ams_results.hpp rename to include/stratosphere/results/exosphere_results.hpp index beb605e4..8804473b 100644 --- a/include/stratosphere/results/ams_results.hpp +++ b/include/stratosphere/results/exosphere_results.hpp @@ -17,22 +17,14 @@ #pragma once #include "results_common.hpp" -namespace sts::ams { +namespace ams::exosphere { /* Please note: These results are all custom, and not official. */ R_DEFINE_NAMESPACE_RESULT_MODULE(444); /* Result 1-1000 reserved for Atmosphere. */ - R_DEFINE_ERROR_RESULT(ExosphereNotPresent, 1); - 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); - - } + R_DEFINE_ERROR_RESULT(NotPresent, 1); + R_DEFINE_ERROR_RESULT(VersionMismatch, 2); } diff --git a/include/stratosphere/results/fatal_results.hpp b/include/stratosphere/results/fatal_results.hpp index fda9db86..076171d5 100644 --- a/include/stratosphere/results/fatal_results.hpp +++ b/include/stratosphere/results/fatal_results.hpp @@ -17,7 +17,7 @@ #pragma once #include "results_common.hpp" -namespace sts::fatal { +namespace ams::fatal { R_DEFINE_NAMESPACE_RESULT_MODULE(163); diff --git a/include/stratosphere/results/fs_results.hpp b/include/stratosphere/results/fs_results.hpp index 821a3e20..b3877c33 100644 --- a/include/stratosphere/results/fs_results.hpp +++ b/include/stratosphere/results/fs_results.hpp @@ -17,7 +17,7 @@ #pragma once #include "results_common.hpp" -namespace sts::fs { +namespace ams::fs { R_DEFINE_NAMESPACE_RESULT_MODULE(2); diff --git a/include/stratosphere/results/hipc_results.hpp b/include/stratosphere/results/hipc_results.hpp index 930bdf66..65f396f0 100644 --- a/include/stratosphere/results/hipc_results.hpp +++ b/include/stratosphere/results/hipc_results.hpp @@ -17,7 +17,7 @@ #pragma once #include "results_common.hpp" -namespace sts::sf::hipc { +namespace ams::sf::hipc { R_DEFINE_NAMESPACE_RESULT_MODULE(11); diff --git a/include/stratosphere/results/i2c_results.hpp b/include/stratosphere/results/i2c_results.hpp index c25a7e9a..bd7f7955 100644 --- a/include/stratosphere/results/i2c_results.hpp +++ b/include/stratosphere/results/i2c_results.hpp @@ -17,7 +17,7 @@ #pragma once #include "results_common.hpp" -namespace sts::i2c { +namespace ams::i2c { R_DEFINE_NAMESPACE_RESULT_MODULE(101); diff --git a/include/stratosphere/results/kvdb_results.hpp b/include/stratosphere/results/kvdb_results.hpp index 3a452801..2c19921a 100644 --- a/include/stratosphere/results/kvdb_results.hpp +++ b/include/stratosphere/results/kvdb_results.hpp @@ -17,7 +17,7 @@ #pragma once #include "results_common.hpp" -namespace sts::kvdb { +namespace ams::kvdb { R_DEFINE_NAMESPACE_RESULT_MODULE(20); diff --git a/include/stratosphere/results/loader_results.hpp b/include/stratosphere/results/loader_results.hpp index 01cb0a44..29b80bf4 100644 --- a/include/stratosphere/results/loader_results.hpp +++ b/include/stratosphere/results/loader_results.hpp @@ -17,7 +17,7 @@ #pragma once #include "results_common.hpp" -namespace sts::ldr { +namespace ams::ldr { R_DEFINE_NAMESPACE_RESULT_MODULE(9); diff --git a/include/stratosphere/results/lr_results.hpp b/include/stratosphere/results/lr_results.hpp index 615d5239..c1983ee0 100644 --- a/include/stratosphere/results/lr_results.hpp +++ b/include/stratosphere/results/lr_results.hpp @@ -17,7 +17,7 @@ #pragma once #include "results_common.hpp" -namespace sts::lr { +namespace ams::lr { R_DEFINE_NAMESPACE_RESULT_MODULE(8); diff --git a/include/stratosphere/results/ncm_results.hpp b/include/stratosphere/results/ncm_results.hpp index 5406064d..cdba12c7 100644 --- a/include/stratosphere/results/ncm_results.hpp +++ b/include/stratosphere/results/ncm_results.hpp @@ -17,7 +17,7 @@ #pragma once #include "results_common.hpp" -namespace sts::ncm { +namespace ams::ncm { R_DEFINE_NAMESPACE_RESULT_MODULE(5); diff --git a/include/stratosphere/results/os_results.hpp b/include/stratosphere/results/os_results.hpp index 93ff349a..5fd716d0 100644 --- a/include/stratosphere/results/os_results.hpp +++ b/include/stratosphere/results/os_results.hpp @@ -17,7 +17,7 @@ #pragma once #include "results_common.hpp" -namespace sts::os { +namespace ams::os { R_DEFINE_NAMESPACE_RESULT_MODULE(3); diff --git a/include/stratosphere/results/pm_results.hpp b/include/stratosphere/results/pm_results.hpp index 463ce62d..50d4c3f7 100644 --- a/include/stratosphere/results/pm_results.hpp +++ b/include/stratosphere/results/pm_results.hpp @@ -17,7 +17,7 @@ #pragma once #include "results_common.hpp" -namespace sts::pm { +namespace ams::pm { R_DEFINE_NAMESPACE_RESULT_MODULE(15); diff --git a/include/stratosphere/results/results_common.hpp b/include/stratosphere/results/results_common.hpp index 00d0d658..a52a9908 100644 --- a/include/stratosphere/results/results_common.hpp +++ b/include/stratosphere/results/results_common.hpp @@ -19,7 +19,7 @@ #include #include "../defines.hpp" -namespace sts { +namespace ams { namespace result::impl { @@ -179,17 +179,17 @@ namespace sts { } /* 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_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) \ - class Result##name final : public ::sts::result::impl::ResultErrorBase, public ::sts::result::impl::ResultErrorRangeBase {} + class Result##name final : public ::ams::result::impl::ResultErrorBase, public ::ams::result::impl::ResultErrorRangeBase {} #define R_DEFINE_ABSTRACT_ERROR_RESULT_IMPL(name, desc_start, desc_end) \ - class Result##name final : public ::sts::result::impl::ResultErrorRangeBase {} + class Result##name final : public ::ams::result::impl::ResultErrorRangeBase {} #define R_DEFINE_ERROR_RESULT(name, desc) R_DEFINE_ERROR_RESULT_IMPL(name, desc, desc) @@ -211,8 +211,8 @@ namespace sts { #undef R_FAILED -#define R_SUCCEEDED(res) (static_cast<::sts::Result>(res).IsSuccess()) -#define R_FAILED(res) (static_cast<::sts::Result>(res).IsFailure()) +#define R_SUCCEEDED(res) (static_cast<::ams::Result>(res).IsSuccess()) +#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. @@ -229,7 +229,7 @@ namespace sts { ({ \ const auto _tmp_r_assert_rc = res_expr; \ 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) \ ({ \ 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 (false) -namespace sts::result::impl { +namespace ams::result::impl { template NX_CONSTEXPR bool AnyIncludes(Result result) { @@ -260,18 +260,18 @@ namespace sts::result::impl { } #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) #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() \ } else if (R_FAILED(R_CURRENT_RESULT)) { \ if (true) #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 \ else if (R_FAILED(R_CURRENT_RESULT)) { \ diff --git a/include/stratosphere/results/ro_results.hpp b/include/stratosphere/results/ro_results.hpp index a83a809f..67227050 100644 --- a/include/stratosphere/results/ro_results.hpp +++ b/include/stratosphere/results/ro_results.hpp @@ -17,7 +17,7 @@ #pragma once #include "results_common.hpp" -namespace sts::ro { +namespace ams::ro { R_DEFINE_NAMESPACE_RESULT_MODULE(22); diff --git a/include/stratosphere/results/settings_results.hpp b/include/stratosphere/results/settings_results.hpp index a7232510..6f015cdf 100644 --- a/include/stratosphere/results/settings_results.hpp +++ b/include/stratosphere/results/settings_results.hpp @@ -17,7 +17,7 @@ #pragma once #include "results_common.hpp" -namespace sts::settings { +namespace ams::settings { R_DEFINE_NAMESPACE_RESULT_MODULE(105); diff --git a/include/stratosphere/results/sf_results.hpp b/include/stratosphere/results/sf_results.hpp index ceb635bc..19252553 100644 --- a/include/stratosphere/results/sf_results.hpp +++ b/include/stratosphere/results/sf_results.hpp @@ -17,7 +17,7 @@ #pragma once #include "results_common.hpp" -namespace sts::sf { +namespace ams::sf { R_DEFINE_NAMESPACE_RESULT_MODULE(10); diff --git a/include/stratosphere/results/sm_results.hpp b/include/stratosphere/results/sm_results.hpp index 0a66c81c..89829f79 100644 --- a/include/stratosphere/results/sm_results.hpp +++ b/include/stratosphere/results/sm_results.hpp @@ -17,7 +17,7 @@ #pragma once #include "results_common.hpp" -namespace sts::sm { +namespace ams::sm { R_DEFINE_NAMESPACE_RESULT_MODULE(21); @@ -31,4 +31,12 @@ namespace sts::sm { R_DEFINE_ERROR_RESULT(NotAllowed, 8); 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); + + } + } diff --git a/include/stratosphere/results/spl_results.hpp b/include/stratosphere/results/spl_results.hpp index c54c3671..0670c6fa 100644 --- a/include/stratosphere/results/spl_results.hpp +++ b/include/stratosphere/results/spl_results.hpp @@ -17,7 +17,7 @@ #pragma once #include "results_common.hpp" -namespace sts::spl { +namespace ams::spl { R_DEFINE_NAMESPACE_RESULT_MODULE(26); diff --git a/include/stratosphere/results/svc_results.hpp b/include/stratosphere/results/svc_results.hpp index 29acd1aa..8b5149e3 100644 --- a/include/stratosphere/results/svc_results.hpp +++ b/include/stratosphere/results/svc_results.hpp @@ -17,7 +17,7 @@ #pragma once #include "results_common.hpp" -namespace sts::svc { +namespace ams::svc { R_DEFINE_NAMESPACE_RESULT_MODULE(1); diff --git a/include/stratosphere/results/updater_results.hpp b/include/stratosphere/results/updater_results.hpp index 16028441..ea40f962 100644 --- a/include/stratosphere/results/updater_results.hpp +++ b/include/stratosphere/results/updater_results.hpp @@ -17,7 +17,7 @@ #pragma once #include "results_common.hpp" -namespace sts::updater { +namespace ams::updater { R_DEFINE_NAMESPACE_RESULT_MODULE(158); diff --git a/include/stratosphere/results/vi_results.hpp b/include/stratosphere/results/vi_results.hpp index 7c5e5c0c..30b5190c 100644 --- a/include/stratosphere/results/vi_results.hpp +++ b/include/stratosphere/results/vi_results.hpp @@ -17,7 +17,7 @@ #pragma once #include "results_common.hpp" -namespace sts::vi { +namespace ams::vi { R_DEFINE_NAMESPACE_RESULT_MODULE(114); diff --git a/include/stratosphere/rnd/rnd_api.hpp b/include/stratosphere/rnd/rnd_api.hpp index 073a4134..ae352f56 100644 --- a/include/stratosphere/rnd/rnd_api.hpp +++ b/include/stratosphere/rnd/rnd_api.hpp @@ -18,7 +18,7 @@ #include #include -namespace sts::rnd { +namespace ams::rnd { /* Random utilities. */ void GenerateRandomBytes(void* out, size_t size); diff --git a/include/stratosphere/ro/ro_types.hpp b/include/stratosphere/ro/ro_types.hpp index 19c3d2b5..b4f857eb 100644 --- a/include/stratosphere/ro/ro_types.hpp +++ b/include/stratosphere/ro/ro_types.hpp @@ -20,7 +20,7 @@ #include "../defines.hpp" #include "../ncm.hpp" -namespace sts::ro { +namespace ams::ro { enum class ModuleType : u8 { ForSelf = 0, @@ -63,7 +63,7 @@ namespace sts::ro { ModuleType GetType() const { const ModuleType type = static_cast(this->type); - STS_ASSERT(type < ModuleType::Count); + AMS_ASSERT(type < ModuleType::Count); return type; } diff --git a/include/stratosphere/sf/cmif/sf_cmif_domain_api.hpp b/include/stratosphere/sf/cmif/sf_cmif_domain_api.hpp index 68ae2ed9..9e792d1b 100644 --- a/include/stratosphere/sf/cmif/sf_cmif_domain_api.hpp +++ b/include/stratosphere/sf/cmif/sf_cmif_domain_api.hpp @@ -18,7 +18,7 @@ #include "../sf_common.hpp" #include "sf_cmif_service_object_holder.hpp" -namespace sts::sf::cmif { +namespace ams::sf::cmif { struct DomainObjectId { u32 value; diff --git a/include/stratosphere/sf/cmif/sf_cmif_domain_manager.hpp b/include/stratosphere/sf/cmif/sf_cmif_domain_manager.hpp index 90beb3a2..27d70b84 100644 --- a/include/stratosphere/sf/cmif/sf_cmif_domain_manager.hpp +++ b/include/stratosphere/sf/cmif/sf_cmif_domain_manager.hpp @@ -19,7 +19,7 @@ #include "sf_cmif_domain_api.hpp" #include "sf_cmif_domain_service_object.hpp" -namespace sts::sf::cmif { +namespace ams::sf::cmif { class ServerDomainManager { NON_COPYABLE(ServerDomainManager); @@ -85,7 +85,7 @@ namespace sts::sf::cmif { inline DomainObjectId GetId(Entry *e) { const size_t index = e - this->entries; - STS_ASSERT(index < this->num_entries); + AMS_ASSERT(index < this->num_entries); return DomainObjectId{ u32(index + 1) }; } diff --git a/include/stratosphere/sf/cmif/sf_cmif_domain_service_object.hpp b/include/stratosphere/sf/cmif/sf_cmif_domain_service_object.hpp index ad11979e..9dbea100 100644 --- a/include/stratosphere/sf/cmif/sf_cmif_domain_service_object.hpp +++ b/include/stratosphere/sf/cmif/sf_cmif_domain_service_object.hpp @@ -19,7 +19,7 @@ #include "sf_cmif_domain_api.hpp" #include "sf_cmif_server_message_processor.hpp" -namespace sts::sf::cmif { +namespace ams::sf::cmif { class DomainServiceObjectDispatchTable : public impl::ServiceDispatchTableBase { private: @@ -41,8 +41,8 @@ namespace sts::sf::cmif { ServerMessageRuntimeMetadata impl_metadata; 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) { - STS_ASSERT(this->domain != nullptr); - STS_ASSERT(this->in_object_ids != nullptr); + AMS_ASSERT(this->domain != nullptr); + AMS_ASSERT(this->in_object_ids != nullptr); this->impl_processor = nullptr; this->out_object_ids = nullptr; this->impl_metadata = {}; diff --git a/include/stratosphere/sf/cmif/sf_cmif_pointer_and_size.hpp b/include/stratosphere/sf/cmif/sf_cmif_pointer_and_size.hpp index 13f1858c..e957b194 100644 --- a/include/stratosphere/sf/cmif/sf_cmif_pointer_and_size.hpp +++ b/include/stratosphere/sf/cmif/sf_cmif_pointer_and_size.hpp @@ -17,7 +17,7 @@ #pragma once #include "../sf_common.hpp" -namespace sts::sf::cmif { +namespace ams::sf::cmif { class PointerAndSize { private: diff --git a/include/stratosphere/sf/cmif/sf_cmif_server_message_processor.hpp b/include/stratosphere/sf/cmif/sf_cmif_server_message_processor.hpp index 54755175..ef4d1f2d 100644 --- a/include/stratosphere/sf/cmif/sf_cmif_server_message_processor.hpp +++ b/include/stratosphere/sf/cmif/sf_cmif_server_message_processor.hpp @@ -18,7 +18,7 @@ #include "../sf_service_object.hpp" #include "sf_cmif_pointer_and_size.hpp" -namespace sts::sf::cmif { +namespace ams::sf::cmif { /* Forward declare ServiceDispatchContext, ServiceObjectHolder. */ struct ServiceDispatchContext; diff --git a/include/stratosphere/sf/cmif/sf_cmif_service_dispatch.hpp b/include/stratosphere/sf/cmif/sf_cmif_service_dispatch.hpp index 511aa125..ee8aef1e 100644 --- a/include/stratosphere/sf/cmif/sf_cmif_service_dispatch.hpp +++ b/include/stratosphere/sf/cmif/sf_cmif_service_dispatch.hpp @@ -19,14 +19,14 @@ #include "sf_cmif_pointer_and_size.hpp" #include "sf_cmif_server_message_processor.hpp" -namespace sts::sf::hipc { +namespace ams::sf::hipc { class ServerSessionManager; class ServerSession; } -namespace sts::sf::cmif { +namespace ams::sf::cmif { class ServerMessageProcessor; diff --git a/include/stratosphere/sf/cmif/sf_cmif_service_object_holder.hpp b/include/stratosphere/sf/cmif/sf_cmif_service_object_holder.hpp index 2d8baff6..12c8969b 100644 --- a/include/stratosphere/sf/cmif/sf_cmif_service_object_holder.hpp +++ b/include/stratosphere/sf/cmif/sf_cmif_service_object_holder.hpp @@ -18,7 +18,7 @@ #include "../sf_service_object.hpp" #include "sf_cmif_service_dispatch.hpp" -namespace sts::sf::cmif { +namespace ams::sf::cmif { class ServiceObjectHolder { private: diff --git a/include/stratosphere/sf/hipc/sf_hipc_api.hpp b/include/stratosphere/sf/hipc/sf_hipc_api.hpp index 0478ca49..cd4b3535 100644 --- a/include/stratosphere/sf/hipc/sf_hipc_api.hpp +++ b/include/stratosphere/sf/hipc/sf_hipc_api.hpp @@ -18,7 +18,7 @@ #include "../sf_common.hpp" #include "../cmif/sf_cmif_pointer_and_size.hpp" -namespace sts::sf::hipc { +namespace ams::sf::hipc { constexpr size_t TlsMessageBufferSize = 0x100; diff --git a/include/stratosphere/sf/hipc/sf_hipc_server_domain_session_manager.hpp b/include/stratosphere/sf/hipc/sf_hipc_server_domain_session_manager.hpp index a8d6b74e..6d5c4527 100644 --- a/include/stratosphere/sf/hipc/sf_hipc_server_domain_session_manager.hpp +++ b/include/stratosphere/sf/hipc/sf_hipc_server_domain_session_manager.hpp @@ -18,7 +18,7 @@ #include "sf_hipc_server_session_manager.hpp" #include "../cmif/sf_cmif_domain_manager.hpp" -namespace sts::sf::hipc { +namespace ams::sf::hipc { class ServerDomainSessionManager : public ServerSessionManager, private cmif::ServerDomainManager { protected: diff --git a/include/stratosphere/sf/hipc/sf_hipc_server_manager.hpp b/include/stratosphere/sf/hipc/sf_hipc_server_manager.hpp index fffeebc4..43cdc501 100644 --- a/include/stratosphere/sf/hipc/sf_hipc_server_manager.hpp +++ b/include/stratosphere/sf/hipc/sf_hipc_server_manager.hpp @@ -17,7 +17,7 @@ #pragma once #include "sf_hipc_server_domain_session_manager.hpp" -namespace sts::sf::hipc { +namespace ams::sf::hipc { struct DefaultServerManagerOptions { 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) { /* Allocate server memory. */ auto *server = this->AllocateServer(); - STS_ASSERT(server != nullptr); + AMS_ASSERT(server != nullptr); new (server) Server(port_handle, service_name, managed, std::forward(static_holder)); if constexpr (!ServiceObjectTraits::IsMitmServiceObject) { @@ -253,13 +253,13 @@ namespace sts::sf::hipc { private: constexpr inline size_t GetServerIndex(const ServerBase *server) const { const size_t i = server - GetPointer(this->server_storages[0]); - STS_ASSERT(i < MaxServers); + AMS_ASSERT(i < MaxServers); return i; } constexpr inline size_t GetSessionIndex(const ServerSession *session) const { const size_t i = session - GetPointer(this->session_storages[0]); - STS_ASSERT(i < MaxSessions); + AMS_ASSERT(i < MaxSessions); return i; } @@ -281,7 +281,7 @@ namespace sts::sf::hipc { virtual void FreeSession(ServerSession *session) override final { std::scoped_lock lk(this->resource_mutex); const size_t index = this->GetSessionIndex(session); - STS_ASSERT(this->session_allocated[index]); + AMS_ASSERT(this->session_allocated[index]); this->session_allocated[index] = false; } @@ -299,7 +299,7 @@ namespace sts::sf::hipc { virtual void DestroyServer(ServerBase *server) override final { std::scoped_lock lk(this->resource_mutex); const size_t index = this->GetServerIndex(server); - STS_ASSERT(this->server_allocated[index]); + AMS_ASSERT(this->server_allocated[index]); server->~ServerBase(); this->server_allocated[index] = false; } @@ -319,8 +319,8 @@ namespace sts::sf::hipc { std::scoped_lock lk(this->resource_mutex); DomainStorage *ptr = static_cast(domain); const size_t index = ptr - this->domain_storages; - STS_ASSERT(index < ManagerOptions::MaxDomains); - STS_ASSERT(this->domain_allocated[index]); + AMS_ASSERT(index < ManagerOptions::MaxDomains); + AMS_ASSERT(this->domain_allocated[index]); this->domain_allocated[index] = false; } diff --git a/include/stratosphere/sf/hipc/sf_hipc_server_session_manager.hpp b/include/stratosphere/sf/hipc/sf_hipc_server_session_manager.hpp index 2cb74f60..bc3da6fa 100644 --- a/include/stratosphere/sf/hipc/sf_hipc_server_session_manager.hpp +++ b/include/stratosphere/sf/hipc/sf_hipc_server_session_manager.hpp @@ -21,13 +21,13 @@ #include "../cmif/sf_cmif_service_object_holder.hpp" #include "sf_hipc_api.hpp" -namespace sts::sf::cmif { +namespace ams::sf::cmif { struct ServiceDispatchContext; } -namespace sts::sf::hipc { +namespace ams::sf::hipc { class ServerSessionManager; class ServerManagerBase; @@ -58,14 +58,14 @@ namespace sts::sf::hipc { this->is_closed = false; this->has_received = false; 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) { this->is_closed = false; this->has_received = false; this->forward_service = std::move(fsrv); - STS_ASSERT(this->IsMitmSession()); + AMS_ASSERT(this->IsMitmSession()); } bool IsMitmSession() const { diff --git a/include/stratosphere/sf/impl/sf_impl_command_serialization.hpp b/include/stratosphere/sf/impl/sf_impl_command_serialization.hpp index e2cfc1a2..0dfdd763 100644 --- a/include/stratosphere/sf/impl/sf_impl_command_serialization.hpp +++ b/include/stratosphere/sf/impl/sf_impl_command_serialization.hpp @@ -28,7 +28,7 @@ #include "../hipc/sf_hipc_server_session_manager.hpp" /* Serialization classes. */ -namespace sts::sf { +namespace ams::sf { namespace impl { @@ -99,7 +99,7 @@ namespace sts::sf { } -namespace sts::sf::impl { +namespace ams::sf::impl { /* Machinery for filtering type lists. */ template @@ -167,7 +167,7 @@ namespace sts::sf::impl { return ArgumentType::OutData; } else if constexpr (std::is_trivial::value && !std::is_pointer::value) { return ArgumentType::InData; - } else if constexpr (std::is_same::value) { + } else if constexpr (std::is_same::value) { return ArgumentType::InData; } else { static_assert(!std::is_same::value, "Invalid ArgumentType"); @@ -1020,7 +1020,7 @@ namespace sts::sf::impl { /* Fake buffer. This is either InData or OutData, but serializing over buffers. */ constexpr auto Attributes = CommandMeta::BufferAttributes[Info.buffer_index]; if constexpr (Attributes & SfBufferAttr_In) { - /* TODO: STS_ASSERT()? N does not bother. */ + /* TODO: AMS_ASSERT()? N does not bother. */ return *reinterpret_cast(buffers[Info.buffer_index].GetAddress()); } else if constexpr (Attributes & SfBufferAttr_Out) { return T(buffers[Info.buffer_index]); @@ -1139,7 +1139,7 @@ namespace sts::sf::impl { } -namespace sts::sf { +namespace ams::sf { template inline static constexpr cmif::ServiceCommandMeta MakeServiceCommandMeta() { @@ -1147,10 +1147,10 @@ namespace sts::sf { .hosver_low = Low, .hosver_high = High, .cmd_id = static_cast(CommandId), - .handler = ::sts::sf::impl::InvokeServiceCommandImpl, + .handler = ::ams::sf::impl::InvokeServiceCommandImpl, }; } } -#define MAKE_SERVICE_COMMAND_META(Name, ...) ::sts::sf::MakeServiceCommandMeta() +#define MAKE_SERVICE_COMMAND_META(Name, ...) ::ams::sf::MakeServiceCommandMeta() diff --git a/include/stratosphere/sf/sf_buffer_tags.hpp b/include/stratosphere/sf/sf_buffer_tags.hpp index 2c278f70..62c53ff8 100644 --- a/include/stratosphere/sf/sf_buffer_tags.hpp +++ b/include/stratosphere/sf/sf_buffer_tags.hpp @@ -16,7 +16,7 @@ #pragma once -namespace sts::sf { +namespace ams::sf { /* Helper structs for serialization of buffers. */ struct LargeData{}; diff --git a/include/stratosphere/sf/sf_buffers.hpp b/include/stratosphere/sf/sf_buffers.hpp index 03e03fca..9497d170 100644 --- a/include/stratosphere/sf/sf_buffers.hpp +++ b/include/stratosphere/sf/sf_buffers.hpp @@ -20,7 +20,7 @@ #include "cmif/sf_cmif_pointer_and_size.hpp" #include "sf_buffer_tags.hpp" -namespace sts::sf { +namespace ams::sf { enum class BufferTransferMode { MapAlias, diff --git a/include/stratosphere/sf/sf_handles.hpp b/include/stratosphere/sf/sf_handles.hpp index 2003a123..29c860ba 100644 --- a/include/stratosphere/sf/sf_handles.hpp +++ b/include/stratosphere/sf/sf_handles.hpp @@ -19,7 +19,7 @@ #include "sf_out.hpp" #include "cmif/sf_cmif_pointer_and_size.hpp" -namespace sts::sf { +namespace ams::sf { namespace impl { diff --git a/include/stratosphere/sf/sf_out.hpp b/include/stratosphere/sf/sf_out.hpp index ea6877f4..cfdc79b1 100644 --- a/include/stratosphere/sf/sf_out.hpp +++ b/include/stratosphere/sf/sf_out.hpp @@ -18,7 +18,7 @@ #include "sf_common.hpp" #include "cmif/sf_cmif_pointer_and_size.hpp" -namespace sts::sf { +namespace ams::sf { namespace impl { @@ -30,7 +30,7 @@ namespace sts::sf { struct IsOutForceEnabled : public std::false_type{}; template<> - struct IsOutForceEnabled<::sts::Result> : public std::true_type{}; + struct IsOutForceEnabled<::ams::Result> : public std::true_type{}; template using IsOutEnabled = typename std::enable_if::value || IsOutForceEnabled::value>::type; @@ -44,7 +44,7 @@ namespace sts::sf { public: constexpr Out(uintptr_t p) : ptr(reinterpret_cast(p)) { /* ... */ } constexpr Out(T *p) : ptr(p) { /* ... */ } - constexpr Out(const cmif::PointerAndSize &pas) : ptr(reinterpret_cast(pas.GetAddress())) { /* TODO: Is STS_ASSERT(pas.GetSize() >= sizeof(T)); necessary? */ } + constexpr Out(const cmif::PointerAndSize &pas) : ptr(reinterpret_cast(pas.GetAddress())) { /* TODO: Is AMS_ASSERT(pas.GetSize() >= sizeof(T)); necessary? */ } void SetValue(const T& value) const { *this->ptr = value; diff --git a/include/stratosphere/sf/sf_service_object.hpp b/include/stratosphere/sf/sf_service_object.hpp index 15e86cd7..052154d6 100644 --- a/include/stratosphere/sf/sf_service_object.hpp +++ b/include/stratosphere/sf/sf_service_object.hpp @@ -18,7 +18,7 @@ #include "sf_common.hpp" #include "sf_out.hpp" -namespace sts::sf { +namespace ams::sf { class IServiceObject{}; @@ -35,7 +35,7 @@ namespace sts::sf { template struct ServiceObjectTraits { - static_assert(std::is_base_of::value, "ServiceObjectTraits requires ServiceObject"); + static_assert(std::is_base_of::value, "ServiceObjectTraits requires ServiceObject"); static constexpr bool IsMitmServiceObject = std::is_base_of::value; diff --git a/include/stratosphere/sm/sm_api.hpp b/include/stratosphere/sm/sm_api.hpp index 2fb4f938..28c9b0fc 100644 --- a/include/stratosphere/sm/sm_api.hpp +++ b/include/stratosphere/sm/sm_api.hpp @@ -18,7 +18,7 @@ #include "sm_types.hpp" -namespace sts::sm { +namespace ams::sm { /* Ordinary SM API. */ Result GetService(Service *out, ServiceName name); diff --git a/include/stratosphere/sm/sm_manager_api.hpp b/include/stratosphere/sm/sm_manager_api.hpp index a2279fac..ba76fcbc 100644 --- a/include/stratosphere/sm/sm_manager_api.hpp +++ b/include/stratosphere/sm/sm_manager_api.hpp @@ -20,7 +20,7 @@ #include "../ncm/ncm_types.hpp" #include "../os/os_common_types.hpp" -namespace sts::sm::manager { +namespace ams::sm::manager { /* 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); diff --git a/include/stratosphere/sm/sm_mitm_api.hpp b/include/stratosphere/sm/sm_mitm_api.hpp index fd51fb2e..ecb1abbe 100644 --- a/include/stratosphere/sm/sm_mitm_api.hpp +++ b/include/stratosphere/sm/sm_mitm_api.hpp @@ -19,7 +19,7 @@ #include "sm_types.hpp" #include "../ncm/ncm_types.hpp" -namespace sts::sm::mitm { +namespace ams::sm::mitm { /* Mitm API. */ Result InstallMitm(Handle *out_port, Handle *out_query, ServiceName name); diff --git a/include/stratosphere/sm/sm_scoped_holder.hpp b/include/stratosphere/sm/sm_scoped_holder.hpp index ae416dd8..0a2d1d97 100644 --- a/include/stratosphere/sm/sm_scoped_holder.hpp +++ b/include/stratosphere/sm/sm_scoped_holder.hpp @@ -18,7 +18,7 @@ #include "sm_api.hpp" -namespace sts::sm { +namespace ams::sm { /* Utility, for scoped access to libnx services. */ template @@ -62,7 +62,7 @@ namespace sts::sm { } Result Initialize() { - STS_ASSERT(!this->has_initialized); + AMS_ASSERT(!this->has_initialized); sm::DoWithSession([&]() { this->result = Initializer(); @@ -73,7 +73,7 @@ namespace sts::sm { } void Finalize() { - STS_ASSERT(this->has_initialized); + AMS_ASSERT(this->has_initialized); Finalizer(); this->has_initialized = false; } diff --git a/include/stratosphere/sm/sm_types.hpp b/include/stratosphere/sm/sm_types.hpp index 30d97b3b..d61777f4 100644 --- a/include/stratosphere/sm/sm_types.hpp +++ b/include/stratosphere/sm/sm_types.hpp @@ -22,7 +22,7 @@ #include "../results.hpp" #include "../os.hpp" -namespace sts::sm { +namespace ams::sm { struct ServiceName { static constexpr size_t MaxLength = 8; diff --git a/include/stratosphere/spl/smc/spl_smc.hpp b/include/stratosphere/spl/smc/spl_smc.hpp index fe39687b..5d1c05b7 100644 --- a/include/stratosphere/spl/smc/spl_smc.hpp +++ b/include/stratosphere/spl/smc/spl_smc.hpp @@ -20,7 +20,7 @@ #include "../spl_types.hpp" -namespace sts::spl::smc { +namespace ams::spl::smc { /* Helpers for converting arguments. */ inline u32 GetCryptAesMode(CipherMode mode, u32 keyslot) { diff --git a/include/stratosphere/spl/spl_api.hpp b/include/stratosphere/spl/spl_api.hpp index b511ad9e..d49c1518 100644 --- a/include/stratosphere/spl/spl_api.hpp +++ b/include/stratosphere/spl/spl_api.hpp @@ -18,7 +18,7 @@ #include "spl_types.hpp" -namespace sts::spl { +namespace ams::spl { HardwareType GetHardwareType(); MemoryArrangement GetMemoryArrangement(); diff --git a/include/stratosphere/spl/spl_types.hpp b/include/stratosphere/spl/spl_types.hpp index 4dd0d285..1cd3f721 100644 --- a/include/stratosphere/spl/spl_types.hpp +++ b/include/stratosphere/spl/spl_types.hpp @@ -18,7 +18,7 @@ #include #include "../results.hpp" -namespace sts::spl { +namespace ams::spl { namespace smc { @@ -64,12 +64,12 @@ namespace sts::spl { NotPermitted = 6, }; - constexpr inline ::sts::Result ConvertResult(Result smc_result) { + constexpr inline ::ams::Result ConvertResult(Result smc_result) { /* smc::Result::Success becomes ResultSuccess() directly. */ R_UNLESS(smc_result != Result::Success, ResultSuccess()); /* Convert to the list of known SecureMonitorErrors. */ - const auto converted = R_MAKE_NAMESPACE_RESULT(::sts::spl, static_cast(smc_result)); + const auto converted = R_MAKE_NAMESPACE_RESULT(::ams::spl, static_cast(smc_result)); if (spl::ResultSecureMonitorError::Includes(converted)) { return converted; } diff --git a/include/stratosphere/svc/svc_types.hpp b/include/stratosphere/svc/svc_types.hpp index 74612d49..275cbe08 100644 --- a/include/stratosphere/svc/svc_types.hpp +++ b/include/stratosphere/svc/svc_types.hpp @@ -20,7 +20,7 @@ #include "../defines.hpp" #include "../results.hpp" -namespace sts::svc { +namespace ams::svc { /* Debug event types. */ enum class DebugEventType : u32 { diff --git a/include/stratosphere/updater/updater_api.hpp b/include/stratosphere/updater/updater_api.hpp index e8f37263..55482efc 100644 --- a/include/stratosphere/updater/updater_api.hpp +++ b/include/stratosphere/updater/updater_api.hpp @@ -20,7 +20,7 @@ #include "../spl/spl_types.hpp" #include "updater_types.hpp" -namespace sts::updater { +namespace ams::updater { /* Public API. */ BootImageUpdateType GetBootImageUpdateType(spl::HardwareType hw_type); diff --git a/include/stratosphere/updater/updater_types.hpp b/include/stratosphere/updater/updater_types.hpp index da5ef7e9..6675f3d4 100644 --- a/include/stratosphere/updater/updater_types.hpp +++ b/include/stratosphere/updater/updater_types.hpp @@ -17,7 +17,7 @@ #pragma once #include -namespace sts::updater { +namespace ams::updater { /* Types. */ enum class BootImageUpdateType { diff --git a/include/stratosphere/util/util_alignment.hpp b/include/stratosphere/util/util_alignment.hpp index 90a482db..7ef5c053 100644 --- a/include/stratosphere/util/util_alignment.hpp +++ b/include/stratosphere/util/util_alignment.hpp @@ -19,7 +19,7 @@ #include "../defines.hpp" #include -namespace sts::util { +namespace ams::util { /* Utilities for alignment to power of two. */ diff --git a/include/stratosphere/util/util_compression.hpp b/include/stratosphere/util/util_compression.hpp index d86652e7..644cfef5 100644 --- a/include/stratosphere/util/util_compression.hpp +++ b/include/stratosphere/util/util_compression.hpp @@ -17,7 +17,7 @@ #pragma once #include -namespace sts::util { +namespace ams::util { /* Compression utilities. */ int CompressLZ4(void *dst, size_t dst_size, const void *src, size_t src_size); diff --git a/include/stratosphere/util/util_ini.hpp b/include/stratosphere/util/util_ini.hpp index 235d7c48..ba398cfc 100644 --- a/include/stratosphere/util/util_ini.hpp +++ b/include/stratosphere/util/util_ini.hpp @@ -18,7 +18,7 @@ #include #include -namespace sts::util::ini { +namespace ams::util::ini { /* Ini handler type. */ using Handler = int (*)(void *user_ctx, const char *section, const char *name, const char *value); diff --git a/include/stratosphere/util/util_intrusive_list.hpp b/include/stratosphere/util/util_intrusive_list.hpp index a4f3bf7d..36f64317 100644 --- a/include/stratosphere/util/util_intrusive_list.hpp +++ b/include/stratosphere/util/util_intrusive_list.hpp @@ -21,7 +21,7 @@ #include "util_parent_of_member.hpp" -namespace sts::util { +namespace ams::util { /* Forward declare implementation class for Node. */ namespace impl { @@ -49,7 +49,7 @@ namespace sts::util { private: void LinkPrev(IntrusiveListNode *node) { /* We can't link an already linked node. */ - STS_ASSERT(!node->IsLinked()); + AMS_ASSERT(!node->IsLinked()); this->SplicePrev(node, node); } @@ -64,7 +64,7 @@ namespace sts::util { void LinkNext(IntrusiveListNode *node) { /* We can't link an already linked node. */ - STS_ASSERT(!node->IsLinked()); + AMS_ASSERT(!node->IsLinked()); return this->SpliceNext(node, node); } @@ -210,13 +210,13 @@ namespace sts::util { iterator iterator_to(reference v) { /* Only allow iterator_to for values in lists. */ - STS_ASSERT(v.IsLinked()); + AMS_ASSERT(v.IsLinked()); return iterator(&v); } const_iterator iterator_to(const_reference v) const { /* Only allow iterator_to for values in lists. */ - STS_ASSERT(v.IsLinked()); + AMS_ASSERT(v.IsLinked()); return const_iterator(&v); } @@ -334,9 +334,9 @@ namespace sts::util { template class Iterator { public: - friend class sts::util::IntrusiveList; + friend class ams::util::IntrusiveList; - using ImplIterator = typename std::conditional::type; + using ImplIterator = typename std::conditional::type; using iterator_category = std::bidirectional_iterator_tag; using value_type = typename IntrusiveList::value_type; @@ -480,22 +480,22 @@ namespace sts::util { } reference back() { - STS_ASSERT(!this->impl.empty()); + AMS_ASSERT(!this->impl.empty()); return GetParent(this->impl.back()); } const_reference back() const { - STS_ASSERT(!this->impl.empty()); + AMS_ASSERT(!this->impl.empty()); return GetParent(this->impl.back()); } reference front() { - STS_ASSERT(!this->impl.empty()); + AMS_ASSERT(!this->impl.empty()); return GetParent(this->impl.front()); } const_reference front() const { - STS_ASSERT(!this->impl.empty()); + AMS_ASSERT(!this->impl.empty()); return GetParent(this->impl.front()); } @@ -508,12 +508,12 @@ namespace sts::util { } void pop_back() { - STS_ASSERT(!this->impl.empty()); + AMS_ASSERT(!this->impl.empty()); this->impl.pop_back(); } void pop_front() { - STS_ASSERT(!this->impl.empty()); + AMS_ASSERT(!this->impl.empty()); this->impl.pop_front(); } diff --git a/include/stratosphere/util/util_intrusive_red_black_tree.hpp b/include/stratosphere/util/util_intrusive_red_black_tree.hpp index eef85307..b1769f18 100644 --- a/include/stratosphere/util/util_intrusive_red_black_tree.hpp +++ b/include/stratosphere/util/util_intrusive_red_black_tree.hpp @@ -22,7 +22,7 @@ #include "util_parent_of_member.hpp" -namespace sts::util { +namespace ams::util { struct IntrusiveRedBlackTreeNode { NON_COPYABLE(IntrusiveRedBlackTreeNode); diff --git a/include/stratosphere/util/util_parent_of_member.hpp b/include/stratosphere/util/util_parent_of_member.hpp index 88fe61e4..55efae08 100644 --- a/include/stratosphere/util/util_parent_of_member.hpp +++ b/include/stratosphere/util/util_parent_of_member.hpp @@ -18,7 +18,7 @@ #include #include "../defines.hpp" -namespace sts::util { +namespace ams::util { namespace impl { diff --git a/include/stratosphere/util/util_scope_guard.hpp b/include/stratosphere/util/util_scope_guard.hpp index 275c1368..462f797e 100644 --- a/include/stratosphere/util/util_scope_guard.hpp +++ b/include/stratosphere/util/util_scope_guard.hpp @@ -19,7 +19,7 @@ #include #include "../defines.hpp" -namespace sts::util { +namespace ams::util { namespace impl { @@ -55,5 +55,5 @@ namespace sts::util { } -#define SCOPE_GUARD ::sts::util::impl::ScopeGuardOnExit() + [&]() +#define SCOPE_GUARD ::ams::util::impl::ScopeGuardOnExit() + [&]() #define ON_SCOPE_EXIT auto ANONYMOUS_VARIABLE(SCOPE_EXIT_STATE_) = SCOPE_GUARD diff --git a/include/stratosphere/util/util_size.hpp b/include/stratosphere/util/util_size.hpp index 8f1785c5..78e9cbe4 100644 --- a/include/stratosphere/util/util_size.hpp +++ b/include/stratosphere/util/util_size.hpp @@ -17,7 +17,7 @@ #pragma once #include -namespace sts::util { +namespace ams::util { /* std::size() does not support zero-size C arrays. We're fixing that. */ template diff --git a/include/stratosphere/util/util_typed_storage.hpp b/include/stratosphere/util/util_typed_storage.hpp index 54999a87..9b3960dd 100644 --- a/include/stratosphere/util/util_typed_storage.hpp +++ b/include/stratosphere/util/util_typed_storage.hpp @@ -19,14 +19,14 @@ #include "../defines.hpp" #include -namespace sts::util { +namespace ams::util { template struct TypedStorage { typename std::aligned_storage::type _storage; }; - #define TYPED_STORAGE(T) ::sts::util::TypedStorage + #define TYPED_STORAGE(T) ::ams::util::TypedStorage template static constexpr inline __attribute__((always_inline)) T *GetPointer(TYPED_STORAGE(T) &ts) { diff --git a/source/ams/ams_environment.cpp b/source/ams/ams_environment.cpp index c28e8d46..36a31d14 100644 --- a/source/ams/ams_environment.cpp +++ b/source/ams/ams_environment.cpp @@ -17,7 +17,7 @@ #include #include "ams_bpc.h" -namespace sts::ams { +namespace ams { namespace { @@ -34,7 +34,7 @@ namespace sts::ams { } - extern ncm::TitleId StratosphereTitleId; + extern ncm::TitleId CurrentTitleId; void WEAK ExceptionHandler(FatalErrorContext *ctx) { R_ASSERT(amsBpcInitialize()); @@ -49,7 +49,7 @@ namespace sts::ams { { ams_ctx.magic = FatalErrorContext::Magic; ams_ctx.error_desc = ctx->error_desc; - ams_ctx.title_id = static_cast(StratosphereTitleId); + ams_ctx.title_id = static_cast(CurrentTitleId); for (size_t i = 0; i < FatalErrorContext::NumGprs; i++) { ams_ctx.gprs[i] = ctx->cpu_gprs[i].x; } @@ -122,7 +122,7 @@ namespace sts::ams { } /* Just call the user exception handler. */ - ::sts::ams::ExceptionHandler(&ams_ctx); + ::ams::ExceptionHandler(&ams_ctx); } inline NORETURN void AbortImpl() { @@ -160,7 +160,7 @@ extern "C" { /* Custom abort handler, so that std::abort will trigger these. */ void abort() { - sts::ams::AbortImpl(); + ams::AbortImpl(); } void *__cxa_allocate_ecxeption(size_t thrown_size) { diff --git a/source/ams/ams_exosphere_api.cpp b/source/ams/ams_exosphere_api.cpp index 2ad9d997..9d97f2c6 100644 --- a/source/ams/ams_exosphere_api.cpp +++ b/source/ams/ams_exosphere_api.cpp @@ -18,12 +18,12 @@ #include #include -namespace sts::ams { +namespace ams::exosphere { ApiInfo GetApiInfo() { u64 exosphere_cfg; if (spl::smc::GetConfig(&exosphere_cfg, 1, SplConfigItem_ExosphereApiVersion) != spl::smc::Result::Success) { - R_ASSERT(ResultExosphereNotPresent()); + R_ASSERT(ResultNotPresent()); } return ApiInfo{ diff --git a/source/boot2/boot2_api.cpp b/source/boot2/boot2_api.cpp index e81ce619..6cf08901 100644 --- a/source/boot2/boot2_api.cpp +++ b/source/boot2/boot2_api.cpp @@ -21,7 +21,7 @@ #include #include -namespace sts::boot2 { +namespace ams::boot2 { namespace { @@ -145,9 +145,9 @@ namespace sts::boot2 { /* Launch, lightly validate result. */ { const auto launch_result = pm::shell::LaunchTitle(&process_id, loc, launch_flags); - STS_ASSERT(!(svc::ResultOutOfResource::Includes(launch_result))); - STS_ASSERT(!(svc::ResultOutOfMemory::Includes(launch_result))); - STS_ASSERT(!(svc::ResultLimitReached::Includes(launch_result))); + AMS_ASSERT(!(svc::ResultOutOfResource::Includes(launch_result))); + AMS_ASSERT(!(svc::ResultOutOfMemory::Includes(launch_result))); + AMS_ASSERT(!(svc::ResultLimitReached::Includes(launch_result))); } if (out_process_id) { @@ -271,7 +271,7 @@ namespace sts::boot2 { } /* Don't allow invalid lines. */ - STS_ASSERT(name_len <= sizeof(sm::ServiceName)); + AMS_ASSERT(name_len <= sizeof(sm::ServiceName)); /* Declare the service. */ R_ASSERT(sm::mitm::DeclareFutureMitm(sm::ServiceName::Encode(mitm_list + offset, name_len))); diff --git a/source/cfg/cfg_flags.cpp b/source/cfg/cfg_flags.cpp index 1d464784..ed0ea9d2 100644 --- a/source/cfg/cfg_flags.cpp +++ b/source/cfg/cfg_flags.cpp @@ -18,7 +18,7 @@ #include #include -namespace sts::cfg { +namespace ams::cfg { namespace { diff --git a/source/cfg/cfg_override.cpp b/source/cfg/cfg_override.cpp index 218f3055..76a20fb4 100644 --- a/source/cfg/cfg_override.cpp +++ b/source/cfg/cfg_override.cpp @@ -22,7 +22,7 @@ #include #include -namespace sts::cfg { +namespace ams::cfg { namespace { diff --git a/source/cfg/cfg_privileged_process.cpp b/source/cfg/cfg_privileged_process.cpp index 406a6233..670e590e 100644 --- a/source/cfg/cfg_privileged_process.cpp +++ b/source/cfg/cfg_privileged_process.cpp @@ -18,7 +18,7 @@ #include #include -namespace sts::cfg { +namespace ams::cfg { namespace { diff --git a/source/cfg/cfg_sd_card.cpp b/source/cfg/cfg_sd_card.cpp index 6aaeccc2..15004785 100644 --- a/source/cfg/cfg_sd_card.cpp +++ b/source/cfg/cfg_sd_card.cpp @@ -19,7 +19,7 @@ #include #include -namespace sts::cfg { +namespace ams::cfg { namespace { diff --git a/source/dd/dd_io_mappings.cpp b/source/dd/dd_io_mappings.cpp index 7bc09ab5..c423fd4a 100644 --- a/source/dd/dd_io_mappings.cpp +++ b/source/dd/dd_io_mappings.cpp @@ -15,7 +15,7 @@ */ #include -namespace sts::dd { +namespace ams::dd { uintptr_t QueryIoMapping(uintptr_t phys_addr, size_t size) { u64 virtual_addr; diff --git a/source/hid/hid_api.cpp b/source/hid/hid_api.cpp index 4ee4db6b..0419f96d 100644 --- a/source/hid/hid_api.cpp +++ b/source/hid/hid_api.cpp @@ -19,7 +19,7 @@ #include #include -namespace sts::hid { +namespace ams::hid { namespace { diff --git a/source/ams/ams_hos_version_api.cpp b/source/hos/hos_version_api.cpp similarity index 81% rename from source/ams/ams_hos_version_api.cpp rename to source/hos/hos_version_api.cpp index 5f6ac7b3..d0118a75 100644 --- a/source/ams/ams_hos_version_api.cpp +++ b/source/hos/hos_version_api.cpp @@ -16,7 +16,7 @@ #include -namespace sts::hos { +namespace ams::hos { namespace { @@ -35,39 +35,39 @@ namespace sts::hos { return; } - switch (ams::GetApiInfo().GetTargetFirmware()) { - case ams::TargetFirmware_100: + switch (exosphere::GetApiInfo().GetTargetFirmware()) { + case exosphere::TargetFirmware_100: g_hos_version = hos::Version_100; break; - case ams::TargetFirmware_200: + case exosphere::TargetFirmware_200: g_hos_version = hos::Version_200; break; - case ams::TargetFirmware_300: + case exosphere::TargetFirmware_300: g_hos_version = hos::Version_300; break; - case ams::TargetFirmware_400: + case exosphere::TargetFirmware_400: g_hos_version = hos::Version_400; break; - case ams::TargetFirmware_500: + case exosphere::TargetFirmware_500: g_hos_version = hos::Version_500; break; - case ams::TargetFirmware_600: - case ams::TargetFirmware_620: + case exosphere::TargetFirmware_600: + case exosphere::TargetFirmware_620: g_hos_version = hos::Version_600; break; - case ams::TargetFirmware_700: + case exosphere::TargetFirmware_700: g_hos_version = hos::Version_700; break; - case ams::TargetFirmware_800: + case exosphere::TargetFirmware_800: g_hos_version = hos::Version_800; break; - case ams::TargetFirmware_810: + case exosphere::TargetFirmware_810: g_hos_version = hos::Version_810; break; - case ams::TargetFirmware_900: + case exosphere::TargetFirmware_900: g_hos_version = hos::Version_900; break; - STS_UNREACHABLE_DEFAULT_CASE(); + AMS_UNREACHABLE_DEFAULT_CASE(); } __atomic_store_n(&g_has_cached, true, __ATOMIC_SEQ_CST); @@ -75,7 +75,7 @@ namespace sts::hos { } - ::sts::hos::Version GetVersion() { + ::ams::hos::Version GetVersion() { CacheValues(); return g_hos_version; } @@ -133,7 +133,7 @@ namespace sts::hos { minor = 0; micro = 0; break; - STS_UNREACHABLE_DEFAULT_CASE(); + AMS_UNREACHABLE_DEFAULT_CASE(); } hosversionSet(MAKEHOSVERSION(major, minor, micro)); } diff --git a/source/kvdb/kvdb_archive.cpp b/source/kvdb/kvdb_archive.cpp index 3dce172d..f7f3418d 100644 --- a/source/kvdb/kvdb_archive.cpp +++ b/source/kvdb/kvdb_archive.cpp @@ -17,7 +17,7 @@ #include #include -namespace sts::kvdb { +namespace ams::kvdb { namespace { @@ -90,7 +90,7 @@ namespace sts::kvdb { Result ArchiveReader::ReadEntryCount(size_t *out) { /* This should only be called at the start of reading stream. */ - STS_ASSERT(this->offset == 0); + AMS_ASSERT(this->offset == 0); /* Read and validate header. */ ArchiveHeader header; @@ -103,7 +103,7 @@ namespace sts::kvdb { Result ArchiveReader::GetEntrySize(size_t *out_key_size, size_t *out_value_size) { /* This should only be called after ReadEntryCount. */ - STS_ASSERT(this->offset != 0); + AMS_ASSERT(this->offset != 0); /* Peek the next entry header. */ ArchiveEntryHeader header; @@ -117,7 +117,7 @@ namespace sts::kvdb { Result ArchiveReader::ReadEntry(void *out_key, size_t key_size, void *out_value, size_t value_size) { /* This should only be called after ReadEntryCount. */ - STS_ASSERT(this->offset != 0); + AMS_ASSERT(this->offset != 0); /* Read the next entry header. */ ArchiveEntryHeader header; @@ -125,8 +125,8 @@ namespace sts::kvdb { R_TRY(header.Validate()); /* Key size and Value size must be correct. */ - STS_ASSERT(key_size == header.key_size); - STS_ASSERT(value_size == header.value_size); + AMS_ASSERT(key_size == header.key_size); + AMS_ASSERT(value_size == header.value_size); R_ASSERT(this->Read(out_key, key_size)); R_ASSERT(this->Read(out_value, value_size)); @@ -147,7 +147,7 @@ namespace sts::kvdb { void ArchiveWriter::WriteHeader(size_t entry_count) { /* This should only be called at start of write. */ - STS_ASSERT(this->offset == 0); + AMS_ASSERT(this->offset == 0); ArchiveHeader header = ArchiveHeader::Make(entry_count); R_ASSERT(this->Write(&header, sizeof(header))); @@ -155,7 +155,7 @@ namespace sts::kvdb { void ArchiveWriter::WriteEntry(const void *key, size_t key_size, const void *value, size_t value_size) { /* This should only be called after writing header. */ - STS_ASSERT(this->offset != 0); + AMS_ASSERT(this->offset != 0); ArchiveEntryHeader header = ArchiveEntryHeader::Make(key_size, value_size); R_ASSERT(this->Write(&header, sizeof(header))); diff --git a/source/kvdb/kvdb_file_key_value_store.cpp b/source/kvdb/kvdb_file_key_value_store.cpp index d4ec971c..7b23e4c3 100644 --- a/source/kvdb/kvdb_file_key_value_store.cpp +++ b/source/kvdb/kvdb_file_key_value_store.cpp @@ -18,7 +18,7 @@ #include #include -namespace sts::kvdb { +namespace ams::kvdb { /* Cache implementation. */ void *FileKeyValueStore::Cache::Allocate(size_t size) { @@ -57,7 +57,7 @@ namespace sts::kvdb { this->backing_buffer_free_offset = 0; this->count = 0; this->entries = static_castentries)>(this->Allocate(sizeof(*this->entries) * this->capacity)); - STS_ASSERT(this->entries != nullptr); + AMS_ASSERT(this->entries != nullptr); } std::optional FileKeyValueStore::Cache::TryGet(void *out_value, size_t max_out_size, const void *key, size_t key_size) { @@ -104,7 +104,7 @@ namespace sts::kvdb { } /* Ensure key size is small enough. */ - STS_ASSERT(key_size <= MaxKeySize); + AMS_ASSERT(key_size <= MaxKeySize); /* If we're at capacity, invalidate the cache. */ if (this->count == this->capacity) { diff --git a/source/ldr/ldr_pm_api.cpp b/source/ldr/ldr_pm_api.cpp index 4f4e5e0f..6e213438 100644 --- a/source/ldr/ldr_pm_api.cpp +++ b/source/ldr/ldr_pm_api.cpp @@ -21,7 +21,7 @@ #include "ldr_ams.h" -namespace sts::ldr::pm { +namespace ams::ldr::pm { /* Information API. */ Result CreateProcess(Handle *out, PinId pin_id, u32 flags, Handle reslimit) { diff --git a/source/map/map_api.cpp b/source/map/map_api.cpp index 11fb6842..d3e5ef33 100644 --- a/source/map/map_api.cpp +++ b/source/map/map_api.cpp @@ -18,7 +18,7 @@ #include #include -namespace sts::map { +namespace ams::map { namespace { @@ -106,7 +106,7 @@ namespace sts::map { R_TRY(GetProcessAddressSpaceInfo(&address_space, process_handle)); if (size > address_space.aslr_size) { - return ro::ResultInsufficientAddressSpace(); + return ro::ResultOutOfAddressSpace(); } uintptr_t try_address; @@ -129,7 +129,7 @@ namespace sts::map { return ResultSuccess(); } - return ro::ResultInsufficientAddressSpace();; + return ro::ResultOutOfAddressSpace(); } Result MapCodeMemoryInProcessModern(MappedCodeMemory &out_mcm, Handle process_handle, uintptr_t base_address, size_t size) { @@ -137,7 +137,7 @@ namespace sts::map { R_TRY(GetProcessAddressSpaceInfo(&address_space, process_handle)); if (size > address_space.aslr_size) { - return ro::ResultInsufficientAddressSpace();; + return ro::ResultOutOfAddressSpace(); } uintptr_t try_address; @@ -169,7 +169,7 @@ namespace sts::map { return ResultSuccess(); } - return ro::ResultInsufficientAddressSpace();; + return ro::ResultOutOfAddressSpace(); } } diff --git a/source/os/impl/os_inter_process_event.cpp b/source/os/impl/os_inter_process_event.cpp index a96a1316..d6a5b31c 100644 --- a/source/os/impl/os_inter_process_event.cpp +++ b/source/os/impl/os_inter_process_event.cpp @@ -16,7 +16,7 @@ #include #include "os_inter_process_event.hpp" -namespace sts::os::impl { +namespace ams::os::impl { namespace { @@ -40,7 +40,7 @@ namespace sts::os::impl { } Result InterProcessEvent::Initialize(bool autoclear) { - STS_ASSERT(!this->is_initialized); + AMS_ASSERT(!this->is_initialized); Handle rh, wh; R_TRY(CreateEventHandles(&rh, &wh)); this->Initialize(rh, true, wh, true, autoclear); @@ -48,8 +48,8 @@ namespace sts::os::impl { } void InterProcessEvent::Initialize(Handle read_handle, bool manage_read_handle, Handle write_handle, bool manage_write_handle, bool autoclear) { - STS_ASSERT(!this->is_initialized); - STS_ASSERT(read_handle != INVALID_HANDLE || write_handle != INVALID_HANDLE); + AMS_ASSERT(!this->is_initialized); + AMS_ASSERT(read_handle != INVALID_HANDLE || write_handle != INVALID_HANDLE); this->read_handle = read_handle; this->manage_read_handle = manage_read_handle; this->write_handle = write_handle; @@ -59,30 +59,30 @@ namespace sts::os::impl { } Handle InterProcessEvent::DetachReadableHandle() { - STS_ASSERT(this->is_initialized); + AMS_ASSERT(this->is_initialized); const Handle handle = this->read_handle; - STS_ASSERT(handle != INVALID_HANDLE); + AMS_ASSERT(handle != INVALID_HANDLE); this->read_handle = INVALID_HANDLE; this->manage_read_handle = false; return handle; } Handle InterProcessEvent::DetachWritableHandle() { - STS_ASSERT(this->is_initialized); + AMS_ASSERT(this->is_initialized); const Handle handle = this->write_handle; - STS_ASSERT(handle != INVALID_HANDLE); + AMS_ASSERT(handle != INVALID_HANDLE); this->write_handle = INVALID_HANDLE; this->manage_write_handle = false; return handle; } Handle InterProcessEvent::GetReadableHandle() const { - STS_ASSERT(this->is_initialized); + AMS_ASSERT(this->is_initialized); return this->read_handle; } Handle InterProcessEvent::GetWritableHandle() const { - STS_ASSERT(this->is_initialized); + AMS_ASSERT(this->is_initialized); return this->write_handle; } diff --git a/source/os/impl/os_inter_process_event.hpp b/source/os/impl/os_inter_process_event.hpp index 98f5d974..ad3d56e8 100644 --- a/source/os/impl/os_inter_process_event.hpp +++ b/source/os/impl/os_inter_process_event.hpp @@ -17,7 +17,7 @@ #pragma once #include -namespace sts::os::impl { +namespace ams::os::impl { class WaitableHolderOfInterProcessEvent; diff --git a/source/os/impl/os_waitable_holder_base.hpp b/source/os/impl/os_waitable_holder_base.hpp index dbe229bd..d0fd901b 100644 --- a/source/os/impl/os_waitable_holder_base.hpp +++ b/source/os/impl/os_waitable_holder_base.hpp @@ -16,7 +16,7 @@ #pragma once #include -namespace sts::os::impl { +namespace ams::os::impl { class WaitableObjectList; class WaitableManagerImpl; diff --git a/source/os/impl/os_waitable_holder_impl.hpp b/source/os/impl/os_waitable_holder_impl.hpp index 59fe202b..ccd7a335 100644 --- a/source/os/impl/os_waitable_holder_impl.hpp +++ b/source/os/impl/os_waitable_holder_impl.hpp @@ -21,7 +21,7 @@ #include "os_waitable_holder_of_thread.hpp" #include "os_waitable_holder_of_message_queue.hpp" -namespace sts::os::impl { +namespace ams::os::impl { struct WaitableHolderImpl { union { @@ -36,7 +36,7 @@ namespace sts::os::impl { }; #define CHECK_HOLDER(T) \ - static_assert(std::is_base_of<::sts::os::impl::WaitableHolderBase, T>::value && std::is_trivially_destructible::value, #T) + static_assert(std::is_base_of<::ams::os::impl::WaitableHolderBase, T>::value && std::is_trivially_destructible::value, #T) CHECK_HOLDER(WaitableHolderOfHandle); CHECK_HOLDER(WaitableHolderOfEvent); diff --git a/source/os/impl/os_waitable_holder_of_event.hpp b/source/os/impl/os_waitable_holder_of_event.hpp index fc440fac..cafb4c5a 100644 --- a/source/os/impl/os_waitable_holder_of_event.hpp +++ b/source/os/impl/os_waitable_holder_of_event.hpp @@ -17,7 +17,7 @@ #include "os_waitable_holder_base.hpp" #include "os_waitable_object_list.hpp" -namespace sts::os::impl { +namespace ams::os::impl { class WaitableHolderOfEvent : public WaitableHolderOfUserObject { private: diff --git a/source/os/impl/os_waitable_holder_of_handle.hpp b/source/os/impl/os_waitable_holder_of_handle.hpp index f11acf70..67843c6d 100644 --- a/source/os/impl/os_waitable_holder_of_handle.hpp +++ b/source/os/impl/os_waitable_holder_of_handle.hpp @@ -16,7 +16,7 @@ #pragma once #include "os_waitable_holder_base.hpp" -namespace sts::os::impl { +namespace ams::os::impl { class WaitableHolderOfHandle : public WaitableHolderOfKernelObject { private: diff --git a/source/os/impl/os_waitable_holder_of_inter_process_event.hpp b/source/os/impl/os_waitable_holder_of_inter_process_event.hpp index 8439a7b6..6ff58989 100644 --- a/source/os/impl/os_waitable_holder_of_inter_process_event.hpp +++ b/source/os/impl/os_waitable_holder_of_inter_process_event.hpp @@ -17,7 +17,7 @@ #include "os_waitable_holder_base.hpp" #include "os_inter_process_event.hpp" -namespace sts::os::impl { +namespace ams::os::impl { class WaitableHolderOfInterProcessEvent : public WaitableHolderOfKernelObject { private: @@ -31,7 +31,7 @@ namespace sts::os::impl { } virtual Handle GetHandle() const override { - STS_ASSERT(this->event->is_initialized); + AMS_ASSERT(this->event->is_initialized); return this->event->GetReadableHandle(); } }; diff --git a/source/os/impl/os_waitable_holder_of_interrupt_event.hpp b/source/os/impl/os_waitable_holder_of_interrupt_event.hpp index f54952c3..43706c27 100644 --- a/source/os/impl/os_waitable_holder_of_interrupt_event.hpp +++ b/source/os/impl/os_waitable_holder_of_interrupt_event.hpp @@ -16,7 +16,7 @@ #pragma once #include "os_waitable_holder_base.hpp" -namespace sts::os::impl { +namespace ams::os::impl { class WaitableHolderOfInterruptEvent : public WaitableHolderOfKernelObject { private: @@ -30,7 +30,7 @@ namespace sts::os::impl { } virtual Handle GetHandle() const override { - STS_ASSERT(this->event->is_initialized); + AMS_ASSERT(this->event->is_initialized); return this->event->handle.Get(); } }; diff --git a/source/os/impl/os_waitable_holder_of_message_queue.hpp b/source/os/impl/os_waitable_holder_of_message_queue.hpp index d85c6123..ff5aefa6 100644 --- a/source/os/impl/os_waitable_holder_of_message_queue.hpp +++ b/source/os/impl/os_waitable_holder_of_message_queue.hpp @@ -17,7 +17,7 @@ #include "os_waitable_holder_base.hpp" #include "os_waitable_object_list.hpp" -namespace sts::os::impl { +namespace ams::os::impl { template class WaitableHolderOfMessageQueue : public WaitableHolderOfUserObject { diff --git a/source/os/impl/os_waitable_holder_of_thread.hpp b/source/os/impl/os_waitable_holder_of_thread.hpp index 844eaf8b..6e489556 100644 --- a/source/os/impl/os_waitable_holder_of_thread.hpp +++ b/source/os/impl/os_waitable_holder_of_thread.hpp @@ -16,7 +16,7 @@ #pragma once #include "os_waitable_holder_base.hpp" -namespace sts::os::impl { +namespace ams::os::impl { /* Nintendo implements this as a user wait object, operating on Thread state. */ /* Libnx doesn't have an equivalent, so we'll use the thread's handle for kernel semantics. */ diff --git a/source/os/impl/os_waitable_manager_impl.cpp b/source/os/impl/os_waitable_manager_impl.cpp index a30f36bc..d448b95b 100644 --- a/source/os/impl/os_waitable_manager_impl.cpp +++ b/source/os/impl/os_waitable_manager_impl.cpp @@ -16,7 +16,7 @@ #include "os_waitable_manager_impl.hpp" #include "os_waitable_object_list.hpp" -namespace sts::os::impl{ +namespace ams::os::impl{ WaitableHolderBase *WaitableManagerImpl::WaitAnyImpl(bool infinite, u64 timeout) { /* Set processing thread handle while in scope. */ @@ -64,7 +64,7 @@ namespace sts::os::impl{ index = WaitTimedOut; } else { index = this->WaitSynchronization(object_handles, count, min_timeout); - STS_ASSERT(index != WaitInvalid); + AMS_ASSERT(index != WaitInvalid); } switch (index) { @@ -115,7 +115,7 @@ namespace sts::os::impl{ for (WaitableHolderBase &holder_base : this->waitable_list) { if (Handle handle = holder_base.GetHandle(); handle != INVALID_HANDLE) { - STS_ASSERT(count < MaximumHandleCount); + AMS_ASSERT(count < MaximumHandleCount); out_handles[count] = handle; out_objects[count] = &holder_base; diff --git a/source/os/impl/os_waitable_manager_impl.hpp b/source/os/impl/os_waitable_manager_impl.hpp index bea1a0f2..af889c6b 100644 --- a/source/os/impl/os_waitable_manager_impl.hpp +++ b/source/os/impl/os_waitable_manager_impl.hpp @@ -16,7 +16,7 @@ #pragma once #include "os_waitable_holder_base.hpp" -namespace sts::os::impl { +namespace ams::os::impl { class WaitableManagerImpl { public: diff --git a/source/os/impl/os_waitable_object_list.hpp b/source/os/impl/os_waitable_object_list.hpp index 7129b661..71660ad3 100644 --- a/source/os/impl/os_waitable_object_list.hpp +++ b/source/os/impl/os_waitable_object_list.hpp @@ -17,7 +17,7 @@ #include "os_waitable_holder_base.hpp" #include "os_waitable_manager_impl.hpp" -namespace sts::os::impl { +namespace ams::os::impl { class WaitableObjectList { public: diff --git a/source/os/os_event.cpp b/source/os/os_event.cpp index 51b5ebe1..0aa4d348 100644 --- a/source/os/os_event.cpp +++ b/source/os/os_event.cpp @@ -16,7 +16,7 @@ #include #include "impl/os_waitable_object_list.hpp" -namespace sts::os { +namespace ams::os { Event::Event(bool a, bool s) : auto_clear(a), signaled(s) { new (GetPointer(this->waitable_object_list_storage)) impl::WaitableObjectList(); diff --git a/source/os/os_interrupt_event.cpp b/source/os/os_interrupt_event.cpp index 624e14a9..4fdeba40 100644 --- a/source/os/os_interrupt_event.cpp +++ b/source/os/os_interrupt_event.cpp @@ -16,10 +16,10 @@ #include #include "impl/os_waitable_object_list.hpp" -namespace sts::os { +namespace ams::os { Result InterruptEvent::Initialize(u32 interrupt_id, bool autoclear) { - STS_ASSERT(!this->is_initialized); + AMS_ASSERT(!this->is_initialized); this->auto_clear = autoclear; const auto type = this->auto_clear ? svc::InterruptType_Edge : svc::InterruptType_Level; @@ -30,7 +30,7 @@ namespace sts::os { } void InterruptEvent::Finalize() { - STS_ASSERT(this->is_initialized); + AMS_ASSERT(this->is_initialized); R_ASSERT(svcCloseHandle(this->handle.Move())); this->auto_clear = true; this->is_initialized = false; @@ -46,7 +46,7 @@ namespace sts::os { } void InterruptEvent::Wait() { - STS_ASSERT(this->is_initialized); + AMS_ASSERT(this->is_initialized); while (true) { /* Continuously wait, until success. */ @@ -66,7 +66,7 @@ namespace sts::os { } bool InterruptEvent::TryWait() { - STS_ASSERT(this->is_initialized); + AMS_ASSERT(this->is_initialized); if (this->auto_clear) { /* Auto-clear. Just try to reset. */ @@ -87,7 +87,7 @@ namespace sts::os { } bool InterruptEvent::TimedWait(u64 ns) { - STS_ASSERT(this->is_initialized); + AMS_ASSERT(this->is_initialized); TimeoutHelper timeout_helper(ns); while (true) { diff --git a/source/os/os_message_queue.cpp b/source/os/os_message_queue.cpp index 26b1ae6d..6d0a547a 100644 --- a/source/os/os_message_queue.cpp +++ b/source/os/os_message_queue.cpp @@ -16,7 +16,7 @@ #include #include "impl/os_waitable_object_list.hpp" -namespace sts::os { +namespace ams::os { MessageQueue::MessageQueue(std::unique_ptr buf, size_t c): buffer(std::move(buf)), capacity(c) { new (GetPointer(this->waitable_object_list_storage)) impl::WaitableObjectList(); @@ -28,7 +28,7 @@ namespace sts::os { void MessageQueue::SendInternal(uintptr_t data) { /* Ensure we don't corrupt the queue, but this should never happen. */ - STS_ASSERT(this->count < this->capacity); + AMS_ASSERT(this->count < this->capacity); /* Write data to tail of queue. */ this->buffer[(this->count++ + this->offset) % this->capacity] = data; @@ -36,7 +36,7 @@ namespace sts::os { void MessageQueue::SendNextInternal(uintptr_t data) { /* Ensure we don't corrupt the queue, but this should never happen. */ - STS_ASSERT(this->count < this->capacity); + AMS_ASSERT(this->count < this->capacity); /* Write data to head of queue. */ this->offset = (this->offset + this->capacity - 1) % this->capacity; @@ -46,7 +46,7 @@ namespace sts::os { uintptr_t MessageQueue::ReceiveInternal() { /* Ensure we don't corrupt the queue, but this should never happen. */ - STS_ASSERT(this->count > 0); + AMS_ASSERT(this->count > 0); uintptr_t data = this->buffer[this->offset]; this->offset = (this->offset + 1) % this->capacity; @@ -56,7 +56,7 @@ namespace sts::os { uintptr_t MessageQueue::PeekInternal() { /* Ensure we don't corrupt the queue, but this should never happen. */ - STS_ASSERT(this->count > 0); + AMS_ASSERT(this->count > 0); return this->buffer[this->offset]; } diff --git a/source/os/os_system_event.cpp b/source/os/os_system_event.cpp index 2ef82542..3933e8b5 100644 --- a/source/os/os_system_event.cpp +++ b/source/os/os_system_event.cpp @@ -16,7 +16,7 @@ #include #include "impl/os_waitable_holder_impl.hpp" -namespace sts::os { +namespace ams::os { SystemEvent::SystemEvent(bool inter_process, bool autoclear) : state(SystemEventState::Uninitialized) { if (inter_process) { @@ -35,34 +35,34 @@ namespace sts::os { } Event &SystemEvent::GetEvent() { - STS_ASSERT(this->state == SystemEventState::Event); + AMS_ASSERT(this->state == SystemEventState::Event); return GetReference(this->storage_for_event); } const Event &SystemEvent::GetEvent() const { - STS_ASSERT(this->state == SystemEventState::Event); + AMS_ASSERT(this->state == SystemEventState::Event); return GetReference(this->storage_for_event); } impl::InterProcessEvent &SystemEvent::GetInterProcessEvent() { - STS_ASSERT(this->state == SystemEventState::InterProcessEvent); + AMS_ASSERT(this->state == SystemEventState::InterProcessEvent); return GetReference(this->storage_for_inter_process_event); } const impl::InterProcessEvent &SystemEvent::GetInterProcessEvent() const { - STS_ASSERT(this->state == SystemEventState::InterProcessEvent); + AMS_ASSERT(this->state == SystemEventState::InterProcessEvent); return GetReference(this->storage_for_inter_process_event); } Result SystemEvent::InitializeAsEvent(bool autoclear) { - STS_ASSERT(this->state == SystemEventState::Uninitialized); + AMS_ASSERT(this->state == SystemEventState::Uninitialized); new (GetPointer(this->storage_for_event)) Event(autoclear); this->state = SystemEventState::Event; return ResultSuccess(); } Result SystemEvent::InitializeAsInterProcessEvent(bool autoclear) { - STS_ASSERT(this->state == SystemEventState::Uninitialized); + AMS_ASSERT(this->state == SystemEventState::Uninitialized); new (GetPointer(this->storage_for_inter_process_event)) impl::InterProcessEvent(); this->state = SystemEventState::InterProcessEvent; @@ -77,7 +77,7 @@ namespace sts::os { } void SystemEvent::AttachHandles(Handle read_handle, bool manage_read_handle, Handle write_handle, bool manage_write_handle, bool autoclear) { - STS_ASSERT(this->state == SystemEventState::Uninitialized); + AMS_ASSERT(this->state == SystemEventState::Uninitialized); new (GetPointer(this->storage_for_inter_process_event)) impl::InterProcessEvent(); this->state = SystemEventState::InterProcessEvent; this->GetInterProcessEvent().Initialize(read_handle, manage_read_handle, write_handle, manage_write_handle, autoclear); @@ -92,22 +92,22 @@ namespace sts::os { } Handle SystemEvent::DetachReadableHandle() { - STS_ASSERT(this->state == SystemEventState::InterProcessEvent); + AMS_ASSERT(this->state == SystemEventState::InterProcessEvent); return this->GetInterProcessEvent().DetachReadableHandle(); } Handle SystemEvent::DetachWritableHandle() { - STS_ASSERT(this->state == SystemEventState::InterProcessEvent); + AMS_ASSERT(this->state == SystemEventState::InterProcessEvent); return this->GetInterProcessEvent().DetachWritableHandle(); } Handle SystemEvent::GetReadableHandle() const { - STS_ASSERT(this->state == SystemEventState::InterProcessEvent); + AMS_ASSERT(this->state == SystemEventState::InterProcessEvent); return this->GetInterProcessEvent().GetReadableHandle(); } Handle SystemEvent::GetWritableHandle() const { - STS_ASSERT(this->state == SystemEventState::InterProcessEvent); + AMS_ASSERT(this->state == SystemEventState::InterProcessEvent); return this->GetInterProcessEvent().GetWritableHandle(); } @@ -121,7 +121,7 @@ namespace sts::os { case SystemEventState::InterProcessEvent: this->GetInterProcessEvent().~InterProcessEvent(); break; - STS_UNREACHABLE_DEFAULT_CASE(); + AMS_UNREACHABLE_DEFAULT_CASE(); } this->state = SystemEventState::Uninitialized; } @@ -135,7 +135,7 @@ namespace sts::os { this->GetInterProcessEvent().Signal(); break; case SystemEventState::Uninitialized: - STS_UNREACHABLE_DEFAULT_CASE(); + AMS_UNREACHABLE_DEFAULT_CASE(); } } @@ -148,7 +148,7 @@ namespace sts::os { this->GetInterProcessEvent().Reset(); break; case SystemEventState::Uninitialized: - STS_UNREACHABLE_DEFAULT_CASE(); + AMS_UNREACHABLE_DEFAULT_CASE(); } } void SystemEvent::Wait() { @@ -160,7 +160,7 @@ namespace sts::os { this->GetInterProcessEvent().Wait(); break; case SystemEventState::Uninitialized: - STS_UNREACHABLE_DEFAULT_CASE(); + AMS_UNREACHABLE_DEFAULT_CASE(); } } @@ -171,7 +171,7 @@ namespace sts::os { case SystemEventState::InterProcessEvent: return this->GetInterProcessEvent().TryWait(); case SystemEventState::Uninitialized: - STS_UNREACHABLE_DEFAULT_CASE(); + AMS_UNREACHABLE_DEFAULT_CASE(); } } @@ -182,7 +182,7 @@ namespace sts::os { case SystemEventState::InterProcessEvent: return this->GetInterProcessEvent().TimedWait(ns); case SystemEventState::Uninitialized: - STS_UNREACHABLE_DEFAULT_CASE(); + AMS_UNREACHABLE_DEFAULT_CASE(); } } } diff --git a/source/os/os_waitable_holder.cpp b/source/os/os_waitable_holder.cpp index b908f3d0..e0f03b52 100644 --- a/source/os/os_waitable_holder.cpp +++ b/source/os/os_waitable_holder.cpp @@ -17,11 +17,11 @@ #include "impl/os_waitable_holder_impl.hpp" #include "impl/os_waitable_manager_impl.hpp" -namespace sts::os { +namespace ams::os { WaitableHolder::WaitableHolder(Handle handle) { /* Don't allow invalid handles. */ - STS_ASSERT(handle != INVALID_HANDLE); + AMS_ASSERT(handle != INVALID_HANDLE); /* Initialize appropriate holder. */ new (GetPointer(this->impl_storage)) impl::WaitableHolderOfHandle(handle); @@ -48,7 +48,7 @@ namespace sts::os { new (GetPointer(this->impl_storage)) impl::WaitableHolderOfInterProcessEvent(&event->GetInterProcessEvent()); break; case SystemEventState::Uninitialized: - STS_UNREACHABLE_DEFAULT_CASE(); + AMS_UNREACHABLE_DEFAULT_CASE(); } /* Set user-data. */ @@ -80,7 +80,7 @@ namespace sts::os { case MessageQueueWaitKind::ForNotEmpty: new (GetPointer(this->impl_storage)) impl::WaitableHolderOfMessageQueueForNotEmpty(message_queue); break; - STS_UNREACHABLE_DEFAULT_CASE(); + AMS_UNREACHABLE_DEFAULT_CASE(); } /* Set user-data. */ @@ -91,7 +91,7 @@ namespace sts::os { auto holder_base = reinterpret_cast(GetPointer(this->impl_storage)); /* Don't allow destruction of a linked waitable holder. */ - STS_ASSERT(!holder_base->IsLinkedToManager()); + AMS_ASSERT(!holder_base->IsLinkedToManager()); holder_base->~WaitableHolderBase(); } @@ -100,7 +100,7 @@ namespace sts::os { auto holder_base = reinterpret_cast(GetPointer(this->impl_storage)); /* Don't allow unlinking of an unlinked holder. */ - STS_ASSERT(holder_base->IsLinkedToManager()); + AMS_ASSERT(holder_base->IsLinkedToManager()); holder_base->GetManager()->UnlinkWaitableHolder(*holder_base); holder_base->SetManager(nullptr); diff --git a/source/os/os_waitable_manager.cpp b/source/os/os_waitable_manager.cpp index bfec7eda..434ddfbd 100644 --- a/source/os/os_waitable_manager.cpp +++ b/source/os/os_waitable_manager.cpp @@ -17,7 +17,7 @@ #include "impl/os_waitable_holder_impl.hpp" #include "impl/os_waitable_manager_impl.hpp" -namespace sts::os { +namespace ams::os { WaitableManager::WaitableManager() { /* Initialize storage. */ @@ -28,7 +28,7 @@ namespace sts::os { auto &impl = GetReference(this->impl_storage); /* Don't allow destruction of a non-empty waitable holder. */ - STS_ASSERT(impl.IsEmpty()); + AMS_ASSERT(impl.IsEmpty()); impl.~WaitableManagerImpl(); } @@ -39,7 +39,7 @@ namespace sts::os { auto &impl = GetReference(this->impl_storage); /* Don't allow waiting on empty list. */ - STS_ASSERT(!impl.IsEmpty()); + AMS_ASSERT(!impl.IsEmpty()); return reinterpret_cast(impl.WaitAny()); } @@ -48,7 +48,7 @@ namespace sts::os { auto &impl = GetReference(this->impl_storage); /* Don't allow waiting on empty list. */ - STS_ASSERT(!impl.IsEmpty()); + AMS_ASSERT(!impl.IsEmpty()); return reinterpret_cast(impl.TryWaitAny()); } @@ -57,7 +57,7 @@ namespace sts::os { auto &impl = GetReference(this->impl_storage); /* Don't allow waiting on empty list. */ - STS_ASSERT(!impl.IsEmpty()); + AMS_ASSERT(!impl.IsEmpty()); return reinterpret_cast(impl.TimedWaitAny(timeout)); } @@ -68,7 +68,7 @@ namespace sts::os { auto holder_base = reinterpret_cast(GetPointer(holder->impl_storage)); /* Don't allow double-linking a holder. */ - STS_ASSERT(!holder_base->IsLinkedToManager()); + AMS_ASSERT(!holder_base->IsLinkedToManager()); impl.LinkWaitableHolder(*holder_base); holder_base->SetManager(&impl); diff --git a/source/patcher/patcher_api.cpp b/source/patcher/patcher_api.cpp index 63257d7a..8fbe4a43 100644 --- a/source/patcher/patcher_api.cpp +++ b/source/patcher/patcher_api.cpp @@ -27,7 +27,7 @@ /* IPS Patching adapted from Luma3DS (https://github.com/AuroraWright/Luma3DS/blob/master/sysmodules/loader/source/patcher.c) */ -namespace sts::patcher { +namespace ams::patcher { namespace { @@ -101,11 +101,11 @@ namespace sts::patcher { void ApplyIpsPatch(u8 *mapped_module, size_t mapped_size, size_t protected_size, size_t offset, bool is_ips32, FILE *f_ips) { /* Validate offset/protected size. */ - STS_ASSERT(offset <= protected_size); + AMS_ASSERT(offset <= protected_size); u8 buffer[sizeof(Ips32TailMagic)]; while (true) { - STS_ASSERT(fread(buffer, is_ips32 ? sizeof(Ips32TailMagic) : sizeof(IpsTailMagic), 1, f_ips) == 1); + AMS_ASSERT(fread(buffer, is_ips32 ? sizeof(Ips32TailMagic) : sizeof(IpsTailMagic), 1, f_ips) == 1); if (IsIpsTail(is_ips32, buffer)) { break; @@ -115,18 +115,18 @@ namespace sts::patcher { u32 patch_offset = GetIpsPatchOffset(is_ips32, buffer); /* Size of patch. */ - STS_ASSERT(fread(buffer, 2, 1, f_ips) == 1); + AMS_ASSERT(fread(buffer, 2, 1, f_ips) == 1); u32 patch_size = GetIpsPatchSize(is_ips32, buffer); /* Check for RLE encoding. */ if (patch_size == 0) { /* Size of RLE. */ - STS_ASSERT(fread(buffer, 2, 1, f_ips) == 1); + AMS_ASSERT(fread(buffer, 2, 1, f_ips) == 1); u32 rle_size = (buffer[0] << 8) | (buffer[1]); /* Value for RLE. */ - STS_ASSERT(fread(buffer, 1, 1, f_ips) == 1); + AMS_ASSERT(fread(buffer, 1, 1, f_ips) == 1); /* Ensure we don't write to protected region. */ if (patch_offset < protected_size) { @@ -169,7 +169,7 @@ namespace sts::patcher { if (patch_offset + read_size > mapped_size) { read_size = mapped_size - patch_offset; } - STS_ASSERT(fread(mapped_module + patch_offset, read_size, 1, f_ips) == 1); + AMS_ASSERT(fread(mapped_module + patch_offset, read_size, 1, f_ips) == 1); if (patch_size > read_size) { fseek(f_ips, patch_size - read_size, SEEK_CUR); } diff --git a/source/pm/pm_boot_mode_api.cpp b/source/pm/pm_boot_mode_api.cpp index c207b7e7..5e4e8614 100644 --- a/source/pm/pm_boot_mode_api.cpp +++ b/source/pm/pm_boot_mode_api.cpp @@ -17,10 +17,10 @@ #include #include -namespace sts::pm::bm { +namespace ams::pm::bm { /* Boot Mode API. */ - /* Both functions should be weakly linked, so that they can be overridden by sts::boot2 as needed. */ + /* Both functions should be weakly linked, so that they can be overridden by ams::boot2 as needed. */ BootMode WEAK GetBootMode() { PmBootMode boot_mode = PmBootMode_Normal; R_ASSERT(pmbmGetBootMode(&boot_mode)); diff --git a/source/pm/pm_dmnt_api.cpp b/source/pm/pm_dmnt_api.cpp index 89ff3749..72534637 100644 --- a/source/pm/pm_dmnt_api.cpp +++ b/source/pm/pm_dmnt_api.cpp @@ -20,7 +20,7 @@ #include "pm_ams.h" -namespace sts::pm::dmnt { +namespace ams::pm::dmnt { /* Debug Monitor API. */ Result StartProcess(os::ProcessId process_id) { diff --git a/source/pm/pm_info_api.cpp b/source/pm/pm_info_api.cpp index 88e913c1..5685208a 100644 --- a/source/pm/pm_info_api.cpp +++ b/source/pm/pm_info_api.cpp @@ -20,7 +20,7 @@ #include "pm_ams.h" -namespace sts::pm::info { +namespace ams::pm::info { namespace { diff --git a/source/pm/pm_shell_api.cpp b/source/pm/pm_shell_api.cpp index f85eb1a3..d7c4dbc9 100644 --- a/source/pm/pm_shell_api.cpp +++ b/source/pm/pm_shell_api.cpp @@ -18,7 +18,7 @@ #include #include -namespace sts::pm::shell { +namespace ams::pm::shell { /* Shell API. */ Result WEAK LaunchTitle(os::ProcessId *out_process_id, const ncm::TitleLocation &loc, u32 launch_flags) { diff --git a/source/result/result_on_assertion.cpp b/source/result/result_on_assertion.cpp index cef62139..160b220f 100644 --- a/source/result/result_on_assertion.cpp +++ b/source/result/result_on_assertion.cpp @@ -16,21 +16,21 @@ #include -namespace sts::result { +namespace ams::result { extern bool CallFatalOnResultAssertion; } -namespace sts::result::impl { +namespace ams::result::impl { NORETURN WEAK void OnResultAssertion(Result result) { /* Assert that we should call fatal on result assertion. */ /* If we shouldn't fatal, this will std::abort(); */ /* If we should, we'll continue onwards. */ - STS_ASSERT((sts::result::CallFatalOnResultAssertion)); + AMS_ASSERT((ams::result::CallFatalOnResultAssertion)); - /* TODO: sts::fatal:: */ + /* TODO: ams::fatal:: */ fatalSimple(result.GetValue()); while (true) { /* ... */ } } diff --git a/source/rnd/rnd_api.cpp b/source/rnd/rnd_api.cpp index c9c83bb8..c8cc07df 100644 --- a/source/rnd/rnd_api.cpp +++ b/source/rnd/rnd_api.cpp @@ -19,7 +19,7 @@ #include #include -namespace sts::rnd { +namespace ams::rnd { namespace { diff --git a/source/sf/cmif/sf_cmif_domain_manager.cpp b/source/sf/cmif/sf_cmif_domain_manager.cpp index 537f451f..6be09d7c 100644 --- a/source/sf/cmif/sf_cmif_domain_manager.cpp +++ b/source/sf/cmif/sf_cmif_domain_manager.cpp @@ -15,14 +15,14 @@ */ #include -namespace sts::sf::cmif { +namespace ams::sf::cmif { ServerDomainManager::Domain::~Domain() { while (!this->entries.empty()) { Entry *entry = &this->entries.front(); { std::scoped_lock lk(this->manager->entry_owner_lock); - STS_ASSERT(entry->owner == this); + AMS_ASSERT(entry->owner == this); entry->owner = nullptr; } entry->object.Reset(); @@ -35,7 +35,7 @@ namespace sts::sf::cmif { for (size_t i = 0; i < count; i++) { Entry *entry = this->manager->entry_manager.AllocateEntry(); R_UNLESS(entry != nullptr, sf::cmif::ResultOutOfDomainEntries()); - STS_ASSERT(entry->owner == nullptr); + AMS_ASSERT(entry->owner == nullptr); out_ids[i] = this->manager->entry_manager.GetId(entry); } return ResultSuccess(); @@ -48,18 +48,18 @@ namespace sts::sf::cmif { void ServerDomainManager::Domain::UnreserveIds(const DomainObjectId *ids, size_t count) { for (size_t i = 0; i < count; i++) { Entry *entry = this->manager->entry_manager.GetEntry(ids[i]); - STS_ASSERT(entry != nullptr); - STS_ASSERT(entry->owner == nullptr); + AMS_ASSERT(entry != nullptr); + AMS_ASSERT(entry->owner == nullptr); this->manager->entry_manager.FreeEntry(entry); } } void ServerDomainManager::Domain::RegisterObject(DomainObjectId id, ServiceObjectHolder &&obj) { Entry *entry = this->manager->entry_manager.GetEntry(id); - STS_ASSERT(entry != nullptr); + AMS_ASSERT(entry != nullptr); { std::scoped_lock lk(this->manager->entry_owner_lock); - STS_ASSERT(entry->owner == nullptr); + AMS_ASSERT(entry->owner == nullptr); entry->owner = this; this->entries.push_back(*entry); } @@ -129,8 +129,8 @@ namespace sts::sf::cmif { void ServerDomainManager::EntryManager::FreeEntry(Entry *entry) { std::scoped_lock lk(this->lock); - STS_ASSERT(entry->owner == nullptr); - STS_ASSERT(!entry->object); + AMS_ASSERT(entry->owner == nullptr); + AMS_ASSERT(!entry->object); this->free_list.push_front(*entry); } @@ -142,8 +142,8 @@ namespace sts::sf::cmif { const auto id = ids[i]; Entry *entry = this->GetEntry(id); if (id != InvalidDomainObjectId) { - STS_ASSERT(entry != nullptr); - STS_ASSERT(entry->owner == nullptr); + AMS_ASSERT(entry != nullptr); + AMS_ASSERT(entry->owner == nullptr); this->free_list.erase(this->free_list.iterator_to(*entry)); } } diff --git a/source/sf/cmif/sf_cmif_domain_service_object.cpp b/source/sf/cmif/sf_cmif_domain_service_object.cpp index 8bdaf083..57c53bb9 100644 --- a/source/sf/cmif/sf_cmif_domain_service_object.cpp +++ b/source/sf/cmif/sf_cmif_domain_service_object.cpp @@ -16,7 +16,7 @@ #include #include -namespace sts::sf::cmif { +namespace ams::sf::cmif { Result DomainServiceObjectDispatchTable::ProcessMessage(ServiceDispatchContext &ctx, const cmif::PointerAndSize &in_raw_data) const { return this->ProcessMessageImpl(ctx, static_cast(ctx.srv_obj)->GetServerDomain(), in_raw_data); @@ -133,7 +133,7 @@ namespace sts::sf::cmif { /* Write out header. */ constexpr size_t out_header_size = sizeof(CmifDomainOutHeader); const size_t impl_out_data_total_size = this->GetImplOutDataTotalSize(); - STS_ASSERT(out_header_size + impl_out_data_total_size + sizeof(DomainObjectId) * this->GetOutObjectCount() <= raw_data.GetSize()); + AMS_ASSERT(out_header_size + impl_out_data_total_size + sizeof(DomainObjectId) * this->GetOutObjectCount() <= raw_data.GetSize()); *reinterpret_cast(raw_data.GetPointer()) = CmifDomainOutHeader{ .num_out_objects = static_cast(this->GetOutObjectCount()), }; /* Set output raw data. */ @@ -151,7 +151,7 @@ namespace sts::sf::cmif { /* Write out header. */ constexpr size_t out_header_size = sizeof(CmifDomainOutHeader); const size_t impl_out_data_total_size = this->GetImplOutDataTotalSize(); - STS_ASSERT(out_header_size + impl_out_data_total_size <= raw_data.GetSize()); + AMS_ASSERT(out_header_size + impl_out_data_total_size <= raw_data.GetSize()); *reinterpret_cast(raw_data.GetPointer()) = CmifDomainOutHeader{ .num_out_objects = 0, }; /* Set output raw data. */ diff --git a/source/sf/cmif/sf_cmif_service_dispatch.cpp b/source/sf/cmif/sf_cmif_service_dispatch.cpp index 4d27bffe..41e61f37 100644 --- a/source/sf/cmif/sf_cmif_service_dispatch.cpp +++ b/source/sf/cmif/sf_cmif_service_dispatch.cpp @@ -15,7 +15,7 @@ */ #include -namespace sts::sf::cmif { +namespace ams::sf::cmif { Result impl::ServiceDispatchTableBase::ProcessMessageImpl(ServiceDispatchContext &ctx, const cmif::PointerAndSize &in_raw_data, const ServiceCommandMeta *entries, const size_t entry_count) const { /* Get versioning info. */ @@ -46,7 +46,7 @@ namespace sts::sf::cmif { /* Forward forwardable results, otherwise ensure we can send result to user. */ R_TRY_CATCH(command_result) { R_CATCH(sf::impl::ResultRequestContextChanged) { return R_CURRENT_RESULT; } - R_CATCH_ALL() { STS_ASSERT(out_header != nullptr); } + R_CATCH_ALL() { AMS_ASSERT(out_header != nullptr); } } R_END_TRY_CATCH; /* Write output header to raw data. */ @@ -89,11 +89,11 @@ namespace sts::sf::cmif { /* Forward forwardable results, otherwise ensure we can send result to user. */ R_TRY_CATCH(command_result) { - R_CATCH(ams::mitm::ResultShouldForwardToSession) { + R_CATCH(sm::mitm::ResultShouldForwardToSession) { return ctx.session->ForwardRequest(ctx); } R_CATCH(sf::impl::ResultRequestContextChanged) { return R_CURRENT_RESULT; } - R_CATCH_ALL() { STS_ASSERT(out_header != nullptr); } + R_CATCH_ALL() { AMS_ASSERT(out_header != nullptr); } } R_END_TRY_CATCH; /* Write output header to raw data. */ diff --git a/source/sf/cmif/sf_cmif_service_object_holder.cpp b/source/sf/cmif/sf_cmif_service_object_holder.cpp index 8f03a576..7bdcc4a1 100644 --- a/source/sf/cmif/sf_cmif_service_object_holder.cpp +++ b/source/sf/cmif/sf_cmif_service_object_holder.cpp @@ -16,7 +16,7 @@ #include #include -namespace sts::sf::cmif { +namespace ams::sf::cmif { Result ServiceObjectHolder::ProcessMessage(ServiceDispatchContext &ctx, const cmif::PointerAndSize &in_raw_data) const { const auto ProcessHandler = this->dispatch_meta->ProcessHandler; diff --git a/source/sf/hipc/sf_hipc_api.cpp b/source/sf/hipc/sf_hipc_api.cpp index a0994b44..246373ab 100644 --- a/source/sf/hipc/sf_hipc_api.cpp +++ b/source/sf/hipc/sf_hipc_api.cpp @@ -15,14 +15,14 @@ */ #include -namespace sts::sf::hipc { +namespace ams::sf::hipc { namespace { NX_INLINE Result ReceiveImpl(Handle session_handle, void *message_buf, size_t message_buf_size) { s32 unused_index; if (message_buf == armGetTls()) { - /* Consider: STS_ASSERT(message_buf_size == TlsMessageBufferSize); */ + /* Consider: AMS_ASSERT(message_buf_size == TlsMessageBufferSize); */ return svcReplyAndReceive(&unused_index, &session_handle, 1, INVALID_HANDLE, U64_MAX); } else { return svcReplyAndReceiveWithUserBuffer(&unused_index, message_buf, message_buf_size, &session_handle, 1, INVALID_HANDLE, U64_MAX); @@ -32,7 +32,7 @@ namespace sts::sf::hipc { NX_INLINE Result ReplyImpl(Handle session_handle, void *message_buf, size_t message_buf_size) { s32 unused_index; if (message_buf == armGetTls()) { - /* Consider: STS_ASSERT(message_buf_size == TlsMessageBufferSize); */ + /* Consider: AMS_ASSERT(message_buf_size == TlsMessageBufferSize); */ return svcReplyAndReceive(&unused_index, &session_handle, 0, session_handle, 0); } else { return svcReplyAndReceiveWithUserBuffer(&unused_index, message_buf, message_buf_size, &session_handle, 0, session_handle, 0); @@ -73,7 +73,7 @@ namespace sts::sf::hipc { R_CONVERT(svc::ResultSessionClosed, ResultSuccess()) } R_END_TRY_CATCH; /* ReplyImpl should *always* return an error. */ - STS_ASSERT(false); + AMS_ASSERT(false); } Result CreateSession(Handle *out_server_handle, Handle *out_client_handle) { diff --git a/source/sf/hipc/sf_hipc_server_domain_session_manager.cpp b/source/sf/hipc/sf_hipc_server_domain_session_manager.cpp index f096d694..85c4aa41 100644 --- a/source/sf/hipc/sf_hipc_server_domain_session_manager.cpp +++ b/source/sf/hipc/sf_hipc_server_domain_session_manager.cpp @@ -15,7 +15,7 @@ */ #include -namespace sts::sf::hipc { +namespace ams::sf::hipc { namespace impl { @@ -71,7 +71,7 @@ namespace sts::sf::hipc { if (this->is_mitm_session) { /* If we're a mitm session, we need to convert the remote session to domain. */ - STS_ASSERT(session->forward_service->own_handle); + AMS_ASSERT(session->forward_service->own_handle); R_TRY(serviceConvertToDomain(session->forward_service.get())); /* The object ID reservation cannot fail here, as that would cause desynchronization from target domain. */ @@ -94,8 +94,8 @@ namespace sts::sf::hipc { }))); } - STS_ASSERT(object_id != cmif::InvalidDomainObjectId); - STS_ASSERT(static_cast(new_holder)); + AMS_ASSERT(object_id != cmif::InvalidDomainObjectId); + AMS_ASSERT(static_cast(new_holder)); /* We succeeded! */ domain_guard.Cancel(); diff --git a/source/sf/hipc/sf_hipc_server_manager.cpp b/source/sf/hipc/sf_hipc_server_manager.cpp index 51726ae4..563ea280 100644 --- a/source/sf/hipc/sf_hipc_server_manager.cpp +++ b/source/sf/hipc/sf_hipc_server_manager.cpp @@ -15,7 +15,7 @@ */ #include -namespace sts::sf::hipc { +namespace ams::sf::hipc { ServerManagerBase::ServerBase::~ServerBase() { /* Pure virtual destructor, to prevent linker errors. */ } @@ -65,14 +65,14 @@ namespace sts::sf::hipc { void ServerManagerBase::AddUserWaitableHolder(os::WaitableHolder *waitable) { const auto user_data_tag = static_cast(waitable->GetUserData()); - STS_ASSERT(user_data_tag != UserDataTag::Server); - STS_ASSERT(user_data_tag != UserDataTag::MitmServer); - STS_ASSERT(user_data_tag != UserDataTag::Session); + AMS_ASSERT(user_data_tag != UserDataTag::Server); + AMS_ASSERT(user_data_tag != UserDataTag::MitmServer); + AMS_ASSERT(user_data_tag != UserDataTag::Session); this->RegisterToWaitList(waitable); } Result ServerManagerBase::ProcessForServer(os::WaitableHolder *holder) { - STS_ASSERT(static_cast(holder->GetUserData()) == UserDataTag::Server); + AMS_ASSERT(static_cast(holder->GetUserData()) == UserDataTag::Server); ServerBase *server = static_cast(holder); ON_SCOPE_EXIT { this->RegisterToWaitList(server); }; @@ -83,14 +83,14 @@ namespace sts::sf::hipc { server->CreateSessionObjectHolder(&obj, &fsrv); /* Not a mitm server, so we must have no forward service. */ - STS_ASSERT(fsrv == nullptr); + AMS_ASSERT(fsrv == nullptr); /* Try to accept. */ return this->AcceptSession(server->port_handle, std::move(obj)); } Result ServerManagerBase::ProcessForMitmServer(os::WaitableHolder *holder) { - STS_ASSERT(static_cast(holder->GetUserData()) == UserDataTag::MitmServer); + AMS_ASSERT(static_cast(holder->GetUserData()) == UserDataTag::MitmServer); ServerBase *server = static_cast(holder); ON_SCOPE_EXIT { this->RegisterToWaitList(server); }; @@ -101,20 +101,20 @@ namespace sts::sf::hipc { server->CreateSessionObjectHolder(&obj, &fsrv); /* Mitm server, so we must have forward service. */ - STS_ASSERT(fsrv != nullptr); + AMS_ASSERT(fsrv != nullptr); /* Try to accept. */ return this->AcceptMitmSession(server->port_handle, std::move(obj), std::move(fsrv)); } Result ServerManagerBase::ProcessForSession(os::WaitableHolder *holder) { - STS_ASSERT(static_cast(holder->GetUserData()) == UserDataTag::Session); + AMS_ASSERT(static_cast(holder->GetUserData()) == UserDataTag::Session); ServerSession *session = static_cast(holder); cmif::PointerAndSize tls_message(armGetTls(), hipc::TlsMessageBufferSize); const cmif::PointerAndSize &saved_message = session->saved_message; - STS_ASSERT(tls_message.GetSize() == saved_message.GetSize()); + AMS_ASSERT(tls_message.GetSize() == saved_message.GetSize()); if (!session->has_received) { R_TRY(this->ReceiveRequest(session, tls_message)); session->has_received = true; @@ -180,7 +180,7 @@ namespace sts::sf::hipc { this->ProcessDeferredSessions(); return ResultSuccess(); break; - STS_UNREACHABLE_DEFAULT_CASE(); + AMS_UNREACHABLE_DEFAULT_CASE(); } } diff --git a/source/sf/hipc/sf_hipc_server_session_manager.cpp b/source/sf/hipc/sf_hipc_server_session_manager.cpp index 9447445f..85be7985 100644 --- a/source/sf/hipc/sf_hipc_server_session_manager.cpp +++ b/source/sf/hipc/sf_hipc_server_session_manager.cpp @@ -15,7 +15,7 @@ */ #include -namespace sts::sf::hipc { +namespace ams::sf::hipc { namespace { @@ -40,10 +40,10 @@ namespace sts::sf::hipc { } Result ServerSession::ForwardRequest(const cmif::ServiceDispatchContext &ctx) const { - STS_ASSERT(this->IsMitmSession()); + AMS_ASSERT(this->IsMitmSession()); /* TODO: Support non-TLS messages? */ - STS_ASSERT(this->saved_message.GetPointer() != nullptr); - STS_ASSERT(this->saved_message.GetSize() == TlsMessageBufferSize); + AMS_ASSERT(this->saved_message.GetPointer() != nullptr); + AMS_ASSERT(this->saved_message.GetSize() == TlsMessageBufferSize); /* Copy saved TLS in. */ std::memcpy(armGetTls(), this->saved_message.GetPointer(), this->saved_message.GetSize()); @@ -115,7 +115,7 @@ namespace sts::sf::hipc { session_memory->pointer_buffer = this->GetSessionPointerBuffer(session_memory); session_memory->saved_message = this->GetSessionSavedMessageBuffer(session_memory); /* Validate session pointer buffer. */ - STS_ASSERT(session_memory->pointer_buffer.GetSize() >= session_memory->forward_service->pointer_buffer_size); + AMS_ASSERT(session_memory->pointer_buffer.GetSize() >= session_memory->forward_service->pointer_buffer_size); session_memory->pointer_buffer = cmif::PointerAndSize(session_memory->pointer_buffer.GetAddress(), session_memory->forward_service->pointer_buffer_size); /* Register to wait list. */ this->RegisterSessionToWaitList(session_memory); @@ -188,7 +188,7 @@ namespace sts::sf::hipc { return ResultSuccess(); case hipc::ReceiveResult::NeedsRetry: continue; - STS_UNREACHABLE_DEFAULT_CASE(); + AMS_UNREACHABLE_DEFAULT_CASE(); } } } diff --git a/source/sm/sm_api.cpp b/source/sm/sm_api.cpp index 11047c6b..7fa6666a 100644 --- a/source/sm/sm_api.cpp +++ b/source/sm/sm_api.cpp @@ -21,7 +21,7 @@ #include "sm_ams.h" #include "sm_utils.hpp" -namespace sts::sm { +namespace ams::sm { /* Ordinary SM API. */ Result GetService(Service *out, ServiceName name) { diff --git a/source/sm/sm_manager_api.cpp b/source/sm/sm_manager_api.cpp index 8318d794..e00977f2 100644 --- a/source/sm/sm_manager_api.cpp +++ b/source/sm/sm_manager_api.cpp @@ -22,7 +22,7 @@ #include "smm_ams.h" #include "sm_utils.hpp" -namespace sts::sm::manager { +namespace ams::sm::manager { /* 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) { diff --git a/source/sm/sm_mitm_api.cpp b/source/sm/sm_mitm_api.cpp index 09b97ae2..0f475b85 100644 --- a/source/sm/sm_mitm_api.cpp +++ b/source/sm/sm_mitm_api.cpp @@ -21,7 +21,7 @@ #include "sm_ams.h" #include "sm_utils.hpp" -namespace sts::sm::mitm { +namespace ams::sm::mitm { /* Mitm API. */ Result InstallMitm(Handle *out_port, Handle *out_query, ServiceName name) { diff --git a/source/sm/sm_utils.cpp b/source/sm/sm_utils.cpp index 460fce33..4f553faa 100644 --- a/source/sm/sm_utils.cpp +++ b/source/sm/sm_utils.cpp @@ -16,7 +16,7 @@ #include "sm_utils.hpp" -namespace sts::sm::impl { +namespace ams::sm::impl { namespace { diff --git a/source/sm/sm_utils.hpp b/source/sm/sm_utils.hpp index c1cd9ed7..5a15bf6c 100644 --- a/source/sm/sm_utils.hpp +++ b/source/sm/sm_utils.hpp @@ -22,7 +22,7 @@ #include "sm_ams.h" -namespace sts::sm::impl { +namespace ams::sm::impl { /* Utilities. */ os::RecursiveMutex &GetUserSessionMutex(); diff --git a/source/spl/smc/spl_smc.cpp b/source/spl/smc/spl_smc.cpp index 8b3c9733..b8692755 100644 --- a/source/spl/smc/spl_smc.cpp +++ b/source/spl/smc/spl_smc.cpp @@ -18,7 +18,7 @@ #include #include -namespace sts::spl::smc { +namespace ams::spl::smc { Result SetConfig(SplConfigItem which, const u64 *value, size_t num_qwords) { SecmonArgs args; @@ -352,7 +352,7 @@ namespace sts::spl::smc { } Result AtmosphereWriteAddress(void *dst, const void *src, size_t size) { - STS_ASSERT(size <= sizeof(u64)); + AMS_ASSERT(size <= sizeof(u64)); SecmonArgs args; args.X[0] = static_cast(FunctionId::AtmosphereWriteAddress); diff --git a/source/spl/spl_api.cpp b/source/spl/spl_api.cpp index 23c3eb2b..a9bc8f1f 100644 --- a/source/spl/spl_api.cpp +++ b/source/spl/spl_api.cpp @@ -17,7 +17,7 @@ #include #include -namespace sts::spl { +namespace ams::spl { HardwareType GetHardwareType() { u64 out_val = 0; @@ -70,7 +70,7 @@ namespace sts::spl { case HardwareType::Hoag: case HardwareType::Iowa: return true; - STS_UNREACHABLE_DEFAULT_CASE(); + AMS_UNREACHABLE_DEFAULT_CASE(); } } diff --git a/source/updater/updater_api.cpp b/source/updater/updater_api.cpp index a573d83d..36242410 100644 --- a/source/updater/updater_api.cpp +++ b/source/updater/updater_api.cpp @@ -22,7 +22,7 @@ #include "updater_files.hpp" #include "updater_paths.hpp" -namespace sts::updater { +namespace ams::updater { namespace { @@ -72,7 +72,7 @@ namespace sts::updater { return true; case BootImageUpdateType::Mariko: return false; - STS_UNREACHABLE_DEFAULT_CASE(); + AMS_UNREACHABLE_DEFAULT_CASE(); } } @@ -82,7 +82,7 @@ namespace sts::updater { return true; case BootImageUpdateType::Mariko: return false; - STS_UNREACHABLE_DEFAULT_CASE(); + AMS_UNREACHABLE_DEFAULT_CASE(); } } @@ -92,7 +92,7 @@ namespace sts::updater { return NcmContentMetaType_BootImagePackage; case BootModeType::Safe: return NcmContentMetaType_BootImagePackageSafe; - STS_UNREACHABLE_DEFAULT_CASE(); + AMS_UNREACHABLE_DEFAULT_CASE(); } } @@ -139,7 +139,7 @@ namespace sts::updater { Result GetBootImagePackageDataId(u64 *out_data_id, BootModeType mode, void *work_buffer, size_t work_buffer_size) { /* Ensure we can read content metas. */ constexpr size_t MaxContentMetas = 0x40; - STS_ASSERT(work_buffer_size >= sizeof(NcmContentMetaKey) * MaxContentMetas); + AMS_ASSERT(work_buffer_size >= sizeof(NcmContentMetaKey) * MaxContentMetas); /* Open NAND System meta database, list contents. */ NcmContentMetaDatabase meta_db; @@ -156,7 +156,7 @@ namespace sts::updater { return ResultBootImagePackageNotFound(); } - STS_ASSERT(total_entries == written_entries); + AMS_ASSERT(total_entries == written_entries); /* Output is sorted, return the lowest valid exfat entry. */ if (total_entries > 1) { @@ -182,7 +182,7 @@ namespace sts::updater { return VerifyBootImagesNormal(data_id, work_buffer, work_buffer_size, boot_image_update_type); case BootModeType::Safe: return VerifyBootImagesSafe(data_id, work_buffer, work_buffer_size, boot_image_update_type); - STS_UNREACHABLE_DEFAULT_CASE(); + AMS_UNREACHABLE_DEFAULT_CASE(); } } @@ -303,7 +303,7 @@ namespace sts::updater { return UpdateBootImagesNormal(data_id, work_buffer, work_buffer_size, boot_image_update_type); case BootModeType::Safe: return UpdateBootImagesSafe(data_id, work_buffer, work_buffer_size, boot_image_update_type); - STS_UNREACHABLE_DEFAULT_CASE(); + AMS_UNREACHABLE_DEFAULT_CASE(); } } @@ -340,7 +340,7 @@ namespace sts::updater { } /* Only preserve autorcm if on a unit with unpatched rcm bug. */ - if (HasAutoRcmPreserve(boot_image_update_type) && !ams::IsRcmBugPatched()) { + if (HasAutoRcmPreserve(boot_image_update_type) && !exosphere::IsRcmBugPatched()) { R_TRY(boot0_accessor.PreserveAutoRcm(bct, work, Boot0Partition::BctNormalSub)); R_TRY(boot0_accessor.Write(bct, BctSize, Boot0Partition::BctNormalSub)); R_TRY(boot0_accessor.PreserveAutoRcm(bct, work, Boot0Partition::BctNormalMain)); @@ -399,7 +399,7 @@ namespace sts::updater { R_TRY(boot0_accessor.UpdateEks(bct, work)); } /* Only preserve autorcm if on a unit with unpatched rcm bug. */ - if (HasAutoRcmPreserve(boot_image_update_type) && !ams::IsRcmBugPatched()) { + if (HasAutoRcmPreserve(boot_image_update_type) && !exosphere::IsRcmBugPatched()) { R_TRY(boot0_accessor.PreserveAutoRcm(bct, work, Boot0Partition::BctSafeSub)); R_TRY(boot0_accessor.Write(bct, BctSize, Boot0Partition::BctSafeSub)); R_TRY(boot0_accessor.PreserveAutoRcm(bct, work, Boot0Partition::BctSafeMain)); @@ -492,7 +492,7 @@ namespace sts::updater { case spl::HardwareType::Hoag: case spl::HardwareType::Iowa: return BootImageUpdateType::Mariko; - STS_UNREACHABLE_DEFAULT_CASE(); + AMS_UNREACHABLE_DEFAULT_CASE(); } } diff --git a/source/updater/updater_bis_management.cpp b/source/updater/updater_bis_management.cpp index d90421f6..879810d9 100644 --- a/source/updater/updater_bis_management.cpp +++ b/source/updater/updater_bis_management.cpp @@ -19,7 +19,7 @@ #include "updater_bis_management.hpp" -namespace sts::updater { +namespace ams::updater { Result BisAccessor::Initialize() { R_TRY(fsOpenBisStorage(&this->storage, this->partition_id)); @@ -35,18 +35,18 @@ namespace sts::updater { } Result BisAccessor::Read(void *dst, size_t size, u64 offset) { - STS_ASSERT((offset % SectorAlignment) == 0); + AMS_ASSERT((offset % SectorAlignment) == 0); return fsStorageRead(&this->storage, offset, dst, size); } Result BisAccessor::Write(u64 offset, const void *src, size_t size) { - STS_ASSERT((offset % SectorAlignment) == 0); + AMS_ASSERT((offset % SectorAlignment) == 0); return fsStorageWrite(&this->storage, offset, src, size); } Result BisAccessor::Write(u64 offset, size_t size, const char *bip_path, void *work_buffer, size_t work_buffer_size) { - STS_ASSERT((offset % SectorAlignment) == 0); - STS_ASSERT((work_buffer_size % SectorAlignment) == 0); + AMS_ASSERT((offset % SectorAlignment) == 0); + AMS_ASSERT((work_buffer_size % SectorAlignment) == 0); FILE *bip_fp = fopen(bip_path, "rb"); if (bip_fp == NULL) { @@ -63,7 +63,7 @@ namespace sts::updater { return fsdevGetLastResult(); } } - STS_ASSERT(written + read_size <= size); + AMS_ASSERT(written + read_size <= size); size_t aligned_size = ((read_size + SectorAlignment - 1) / SectorAlignment) * SectorAlignment; R_TRY(this->Write(offset + written, work_buffer, aligned_size)); @@ -77,8 +77,8 @@ namespace sts::updater { } Result BisAccessor::Clear(u64 offset, u64 size, void *work_buffer, size_t work_buffer_size) { - STS_ASSERT((offset % SectorAlignment) == 0); - STS_ASSERT((work_buffer_size % SectorAlignment) == 0); + AMS_ASSERT((offset % SectorAlignment) == 0); + AMS_ASSERT((work_buffer_size % SectorAlignment) == 0); std::memset(work_buffer, 0, work_buffer_size); @@ -92,8 +92,8 @@ namespace sts::updater { } Result BisAccessor::GetHash(void *dst, u64 offset, u64 size, u64 hash_size, void *work_buffer, size_t work_buffer_size) { - STS_ASSERT((offset % SectorAlignment) == 0); - STS_ASSERT((work_buffer_size % SectorAlignment) == 0); + AMS_ASSERT((offset % SectorAlignment) == 0); + AMS_ASSERT((work_buffer_size % SectorAlignment) == 0); Sha256Context sha_ctx; sha256ContextCreate(&sha_ctx); @@ -113,12 +113,12 @@ namespace sts::updater { size_t Boot0Accessor::GetBootloaderVersion(void *bct) { u32 version = *reinterpret_cast(reinterpret_cast(bct) + BctVersionOffset); - STS_ASSERT(version <= BctVersionMax); + AMS_ASSERT(version <= BctVersionMax); return static_cast(version); } size_t Boot0Accessor::GetEksIndex(size_t bootloader_version) { - STS_ASSERT(bootloader_version <= BctVersionMax); + AMS_ASSERT(bootloader_version <= BctVersionMax); return (bootloader_version > 0) ? bootloader_version - 1 : 0; } diff --git a/source/updater/updater_bis_management.hpp b/source/updater/updater_bis_management.hpp index 597ebd4d..df7c1a85 100644 --- a/source/updater/updater_bis_management.hpp +++ b/source/updater/updater_bis_management.hpp @@ -19,7 +19,7 @@ #include #include -namespace sts::updater { +namespace ams::updater { class BisAccessor { public: @@ -138,13 +138,13 @@ namespace sts::updater { } } - STS_ASSERT(entry != nullptr); + AMS_ASSERT(entry != nullptr); return entry; } public: Result Read(size_t *out_size, void *dst, size_t size, EnumType which) { const auto entry = FindEntry(which); - STS_ASSERT(size >= entry->size); + AMS_ASSERT(size >= entry->size); R_TRY(BisAccessor::Read(dst, entry->size, entry->offset)); @@ -154,8 +154,8 @@ namespace sts::updater { Result Write(const void *src, size_t size, EnumType which) { const auto entry = FindEntry(which); - STS_ASSERT(size <= entry->size); - STS_ASSERT((size % BisAccessor::SectorAlignment) == 0); + AMS_ASSERT(size <= entry->size); + AMS_ASSERT((size % BisAccessor::SectorAlignment) == 0); return BisAccessor::Write(entry->offset, src, size); } @@ -198,7 +198,7 @@ namespace sts::updater { return FsBisStorageId_BootConfigAndPackage2RepairMain; case Package2Type::RepairSub: return FsBisStorageId_BootConfigAndPackage2RepairSub; - STS_UNREACHABLE_DEFAULT_CASE(); + AMS_UNREACHABLE_DEFAULT_CASE(); } } diff --git a/source/updater/updater_bis_save.cpp b/source/updater/updater_bis_save.cpp index 6ec4fd14..6b0c1133 100644 --- a/source/updater/updater_bis_save.cpp +++ b/source/updater/updater_bis_save.cpp @@ -19,7 +19,7 @@ #include "updater_bis_save.hpp" -namespace sts::updater { +namespace ams::updater { size_t BisSave::GetVerificationFlagOffset(BootModeType mode) { switch (mode) { @@ -33,9 +33,9 @@ namespace sts::updater { } Result BisSave::Initialize(void *work_buffer, size_t work_buffer_size) { - STS_ASSERT(work_buffer_size >= SaveSize); - STS_ASSERT(util::IsAligned(reinterpret_cast(work_buffer), 0x1000)); - STS_ASSERT(util::IsAligned(work_buffer_size, 0x200)); + AMS_ASSERT(work_buffer_size >= SaveSize); + AMS_ASSERT(util::IsAligned(reinterpret_cast(work_buffer), 0x1000)); + AMS_ASSERT(util::IsAligned(work_buffer_size, 0x200)); R_TRY(this->accessor.Initialize()); this->save_buffer = work_buffer; diff --git a/source/updater/updater_bis_save.hpp b/source/updater/updater_bis_save.hpp index 23dde4ba..a3b0ecbc 100644 --- a/source/updater/updater_bis_save.hpp +++ b/source/updater/updater_bis_save.hpp @@ -21,7 +21,7 @@ #include "updater_bis_management.hpp" -namespace sts::updater { +namespace ams::updater { class BisSave { public: diff --git a/source/updater/updater_files.cpp b/source/updater/updater_files.cpp index feda0b70..0c172d2c 100644 --- a/source/updater/updater_files.cpp +++ b/source/updater/updater_files.cpp @@ -19,7 +19,7 @@ #include "updater_files.hpp" -namespace sts::updater { +namespace ams::updater { Result ReadFile(size_t *out_size, void *dst, size_t dst_size, const char *path) { FILE *fp = fopen(path, "rb"); diff --git a/source/updater/updater_files.hpp b/source/updater/updater_files.hpp index 9b2db301..369d4c09 100644 --- a/source/updater/updater_files.hpp +++ b/source/updater/updater_files.hpp @@ -19,7 +19,7 @@ #include #include -namespace sts::updater { +namespace ams::updater { /* File helpers. */ Result ReadFile(size_t *out_size, void *dst, size_t dst_size, const char *path); diff --git a/source/updater/updater_paths.cpp b/source/updater/updater_paths.cpp index 01c90612..355708c8 100644 --- a/source/updater/updater_paths.cpp +++ b/source/updater/updater_paths.cpp @@ -20,7 +20,7 @@ #include "updater_paths.hpp" -namespace sts::updater { +namespace ams::updater { namespace { @@ -34,7 +34,7 @@ namespace sts::updater { constexpr const char *Package2PathA = "bip:/a/package2"; const char *ChooseCandidatePath(const char * const *candidates, size_t num_candidates) { - STS_ASSERT(num_candidates > 0); + AMS_ASSERT(num_candidates > 0); for (size_t i = 0; i < num_candidates; i++) { struct stat buf; @@ -72,7 +72,7 @@ namespace sts::updater { constexpr const char *candidates[] = {BctPathA, BctPathNx}; return ChooseCandidatePath(candidates, util::size(candidates)); } - STS_UNREACHABLE_DEFAULT_CASE(); + AMS_UNREACHABLE_DEFAULT_CASE(); } } @@ -88,7 +88,7 @@ namespace sts::updater { constexpr const char *candidates[] = {Package1PathA, Package1PathNx}; return ChooseCandidatePath(candidates, util::size(candidates)); } - STS_UNREACHABLE_DEFAULT_CASE(); + AMS_UNREACHABLE_DEFAULT_CASE(); } } @@ -104,7 +104,7 @@ namespace sts::updater { constexpr const char *candidates[] = {Package2PathA, Package2PathNx}; return ChooseCandidatePath(candidates, util::size(candidates)); } - STS_UNREACHABLE_DEFAULT_CASE();; + AMS_UNREACHABLE_DEFAULT_CASE(); } } diff --git a/source/updater/updater_paths.hpp b/source/updater/updater_paths.hpp index d09ae867..8a573921 100644 --- a/source/updater/updater_paths.hpp +++ b/source/updater/updater_paths.hpp @@ -19,7 +19,7 @@ #include #include -namespace sts::updater { +namespace ams::updater { /* Path functionality. */ const char *GetBootImagePackageMountPath(); diff --git a/source/util/util_compression.cpp b/source/util/util_compression.cpp index ba33163b..54199f27 100644 --- a/source/util/util_compression.cpp +++ b/source/util/util_compression.cpp @@ -20,13 +20,13 @@ #include "lz4.h" -namespace sts::util { +namespace ams::util { /* Compression utilities. */ int CompressLZ4(void *dst, size_t dst_size, const void *src, size_t src_size) { /* Size checks. */ - STS_ASSERT(dst_size <= std::numeric_limits::max()); - STS_ASSERT(src_size <= std::numeric_limits::max()); + AMS_ASSERT(dst_size <= std::numeric_limits::max()); + AMS_ASSERT(src_size <= std::numeric_limits::max()); /* This is just a thin wrapper around LZ4. */ return LZ4_compress_default(reinterpret_cast(src), reinterpret_cast(dst), static_cast(src_size), static_cast(dst_size)); @@ -35,8 +35,8 @@ namespace sts::util { /* Decompression utilities. */ int DecompressLZ4(void *dst, size_t dst_size, const void *src, size_t src_size) { /* Size checks. */ - STS_ASSERT(dst_size <= std::numeric_limits::max()); - STS_ASSERT(src_size <= std::numeric_limits::max()); + AMS_ASSERT(dst_size <= std::numeric_limits::max()); + AMS_ASSERT(src_size <= std::numeric_limits::max()); /* This is just a thin wrapper around LZ4. */ return LZ4_decompress_safe(reinterpret_cast(src), reinterpret_cast(dst), static_cast(src_size), static_cast(dst_size)); diff --git a/source/util/util_ini.cpp b/source/util/util_ini.cpp index ffaf7bd5..00640540 100644 --- a/source/util/util_ini.cpp +++ b/source/util/util_ini.cpp @@ -20,7 +20,7 @@ #include "ini.h" -namespace sts::util::ini { +namespace ams::util::ini { /* Ensure that types are the same for Handler vs ini_handler. */ static_assert(std::is_same::value, "Bad ini::Handler definition!"); @@ -50,7 +50,7 @@ namespace sts::util::ini { size_t try_read = std::min(size_t(num - 1), ctx->num_left); size_t actually_read; R_ASSERT(fsFileRead(ctx->f, ctx->offset, str, try_read, FsReadOption_None, &actually_read)); - STS_ASSERT(actually_read == try_read); + AMS_ASSERT(actually_read == try_read); /* Only "read" up to the first \n. */ size_t offset = actually_read;