diff --git a/include/stratosphere/ipc.hpp b/include/atmosphere/common.hpp similarity index 85% rename from include/stratosphere/ipc.hpp rename to include/atmosphere/common.hpp index 09cdf25f..6a87be4f 100644 --- a/include/stratosphere/ipc.hpp +++ b/include/atmosphere/common.hpp @@ -15,8 +15,8 @@ */ #pragma once - -#include "ipc/ipc_service_object.hpp" -#include "ipc/ipc_serialization.hpp" - -#include "ipc/ipc_service_session.hpp" \ No newline at end of file +#include "common_includes.hpp" +#include "defines.hpp" +#include "util.hpp" +#include "results.hpp" +#include "svc.hpp" diff --git a/include/atmosphere/common_includes.hpp b/include/atmosphere/common_includes.hpp new file mode 100644 index 00000000..fec9205c --- /dev/null +++ b/include/atmosphere/common_includes.hpp @@ -0,0 +1,52 @@ +/* + * 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 + +/* C headers. */ +#include +#include +#include +#include +#include +#include +#include +#include + +/* C++ headers. */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Libnx. */ +#include + +/* Atmosphere meta. */ +#if __has_include() +#include +#endif diff --git a/include/stratosphere/defines.hpp b/include/atmosphere/defines.hpp similarity index 96% rename from include/stratosphere/defines.hpp rename to include/atmosphere/defines.hpp index d2dbd52d..a20d4c76 100644 --- a/include/stratosphere/defines.hpp +++ b/include/atmosphere/defines.hpp @@ -15,8 +15,7 @@ */ #pragma once -#include -#include +#include "common_includes.hpp" /* Any broadly useful language defines should go here. */ @@ -44,4 +43,4 @@ #define ANONYMOUS_VARIABLE(pref) CONCATENATE(pref, __COUNTER__) #else #define ANONYMOUS_VARIABLE(pref) CONCATENATE(pref, __LINE__) -#endif \ No newline at end of file +#endif diff --git a/include/stratosphere/results.hpp b/include/atmosphere/results.hpp similarity index 97% rename from include/stratosphere/results.hpp rename to include/atmosphere/results.hpp index 595235bc..992733d7 100644 --- a/include/stratosphere/results.hpp +++ b/include/atmosphere/results.hpp @@ -15,6 +15,8 @@ */ #pragma once +#include "defines.hpp" +#include "util.hpp" /* Utilities. */ #include "results/results_common.hpp" diff --git a/include/stratosphere/results/cal_results.hpp b/include/atmosphere/results/cal_results.hpp similarity index 100% rename from include/stratosphere/results/cal_results.hpp rename to include/atmosphere/results/cal_results.hpp diff --git a/include/stratosphere/results/creport_results.hpp b/include/atmosphere/results/creport_results.hpp similarity index 100% rename from include/stratosphere/results/creport_results.hpp rename to include/atmosphere/results/creport_results.hpp diff --git a/include/stratosphere/results/debug_results.hpp b/include/atmosphere/results/debug_results.hpp similarity index 100% rename from include/stratosphere/results/debug_results.hpp rename to include/atmosphere/results/debug_results.hpp diff --git a/include/stratosphere/results/dmnt_results.hpp b/include/atmosphere/results/dmnt_results.hpp similarity index 100% rename from include/stratosphere/results/dmnt_results.hpp rename to include/atmosphere/results/dmnt_results.hpp diff --git a/include/stratosphere/results/err_results.hpp b/include/atmosphere/results/err_results.hpp similarity index 100% rename from include/stratosphere/results/err_results.hpp rename to include/atmosphere/results/err_results.hpp diff --git a/include/stratosphere/results/exosphere_results.hpp b/include/atmosphere/results/exosphere_results.hpp similarity index 100% rename from include/stratosphere/results/exosphere_results.hpp rename to include/atmosphere/results/exosphere_results.hpp diff --git a/include/stratosphere/results/fatal_results.hpp b/include/atmosphere/results/fatal_results.hpp similarity index 100% rename from include/stratosphere/results/fatal_results.hpp rename to include/atmosphere/results/fatal_results.hpp diff --git a/include/stratosphere/results/fs_results.hpp b/include/atmosphere/results/fs_results.hpp similarity index 100% rename from include/stratosphere/results/fs_results.hpp rename to include/atmosphere/results/fs_results.hpp diff --git a/include/stratosphere/results/hipc_results.hpp b/include/atmosphere/results/hipc_results.hpp similarity index 100% rename from include/stratosphere/results/hipc_results.hpp rename to include/atmosphere/results/hipc_results.hpp diff --git a/include/stratosphere/results/i2c_results.hpp b/include/atmosphere/results/i2c_results.hpp similarity index 100% rename from include/stratosphere/results/i2c_results.hpp rename to include/atmosphere/results/i2c_results.hpp diff --git a/include/stratosphere/results/kvdb_results.hpp b/include/atmosphere/results/kvdb_results.hpp similarity index 95% rename from include/stratosphere/results/kvdb_results.hpp rename to include/atmosphere/results/kvdb_results.hpp index 2c19921a..052ced40 100644 --- a/include/stratosphere/results/kvdb_results.hpp +++ b/include/atmosphere/results/kvdb_results.hpp @@ -21,7 +21,7 @@ namespace ams::kvdb { R_DEFINE_NAMESPACE_RESULT_MODULE(20); - R_DEFINE_ERROR_RESULT(KeyCapacityInsufficient, 1); + R_DEFINE_ERROR_RESULT(OutOfKeyResource, 1); R_DEFINE_ERROR_RESULT(KeyNotFound, 2); R_DEFINE_ERROR_RESULT(AllocationFailed, 4); R_DEFINE_ERROR_RESULT(InvalidKeyValue, 5); diff --git a/include/stratosphere/results/loader_results.hpp b/include/atmosphere/results/loader_results.hpp similarity index 100% rename from include/stratosphere/results/loader_results.hpp rename to include/atmosphere/results/loader_results.hpp diff --git a/include/stratosphere/results/lr_results.hpp b/include/atmosphere/results/lr_results.hpp similarity index 100% rename from include/stratosphere/results/lr_results.hpp rename to include/atmosphere/results/lr_results.hpp diff --git a/include/stratosphere/results/ncm_results.hpp b/include/atmosphere/results/ncm_results.hpp similarity index 100% rename from include/stratosphere/results/ncm_results.hpp rename to include/atmosphere/results/ncm_results.hpp diff --git a/include/stratosphere/results/os_results.hpp b/include/atmosphere/results/os_results.hpp similarity index 100% rename from include/stratosphere/results/os_results.hpp rename to include/atmosphere/results/os_results.hpp diff --git a/include/stratosphere/results/pm_results.hpp b/include/atmosphere/results/pm_results.hpp similarity index 100% rename from include/stratosphere/results/pm_results.hpp rename to include/atmosphere/results/pm_results.hpp diff --git a/include/stratosphere/results/results_common.hpp b/include/atmosphere/results/results_common.hpp similarity index 99% rename from include/stratosphere/results/results_common.hpp rename to include/atmosphere/results/results_common.hpp index a52a9908..b0b50d43 100644 --- a/include/stratosphere/results/results_common.hpp +++ b/include/atmosphere/results/results_common.hpp @@ -15,8 +15,6 @@ */ #pragma once -#include -#include #include "../defines.hpp" namespace ams { diff --git a/include/stratosphere/results/ro_results.hpp b/include/atmosphere/results/ro_results.hpp similarity index 100% rename from include/stratosphere/results/ro_results.hpp rename to include/atmosphere/results/ro_results.hpp diff --git a/include/stratosphere/results/settings_results.hpp b/include/atmosphere/results/settings_results.hpp similarity index 100% rename from include/stratosphere/results/settings_results.hpp rename to include/atmosphere/results/settings_results.hpp diff --git a/include/stratosphere/results/sf_results.hpp b/include/atmosphere/results/sf_results.hpp similarity index 100% rename from include/stratosphere/results/sf_results.hpp rename to include/atmosphere/results/sf_results.hpp diff --git a/include/stratosphere/results/sm_results.hpp b/include/atmosphere/results/sm_results.hpp similarity index 100% rename from include/stratosphere/results/sm_results.hpp rename to include/atmosphere/results/sm_results.hpp diff --git a/include/stratosphere/results/spl_results.hpp b/include/atmosphere/results/spl_results.hpp similarity index 100% rename from include/stratosphere/results/spl_results.hpp rename to include/atmosphere/results/spl_results.hpp diff --git a/include/stratosphere/results/svc_results.hpp b/include/atmosphere/results/svc_results.hpp similarity index 100% rename from include/stratosphere/results/svc_results.hpp rename to include/atmosphere/results/svc_results.hpp diff --git a/include/stratosphere/results/updater_results.hpp b/include/atmosphere/results/updater_results.hpp similarity index 100% rename from include/stratosphere/results/updater_results.hpp rename to include/atmosphere/results/updater_results.hpp diff --git a/include/stratosphere/results/vi_results.hpp b/include/atmosphere/results/vi_results.hpp similarity index 100% rename from include/stratosphere/results/vi_results.hpp rename to include/atmosphere/results/vi_results.hpp diff --git a/include/stratosphere/svc.hpp b/include/atmosphere/svc.hpp similarity index 93% rename from include/stratosphere/svc.hpp rename to include/atmosphere/svc.hpp index dad85159..fce88714 100644 --- a/include/stratosphere/svc.hpp +++ b/include/atmosphere/svc.hpp @@ -15,6 +15,7 @@ */ #pragma once -#include +#include "defines.hpp" +#include "results.hpp" #include "svc/svc_types.hpp" diff --git a/include/stratosphere/svc/svc_types.hpp b/include/atmosphere/svc/svc_types.hpp similarity index 99% rename from include/stratosphere/svc/svc_types.hpp rename to include/atmosphere/svc/svc_types.hpp index 275cbe08..cc4bb446 100644 --- a/include/stratosphere/svc/svc_types.hpp +++ b/include/atmosphere/svc/svc_types.hpp @@ -15,9 +15,6 @@ */ #pragma once -#include -#include -#include "../defines.hpp" #include "../results.hpp" namespace ams::svc { diff --git a/include/stratosphere/util.hpp b/include/atmosphere/util.hpp similarity index 97% rename from include/stratosphere/util.hpp rename to include/atmosphere/util.hpp index a8b21abe..c0583621 100644 --- a/include/stratosphere/util.hpp +++ b/include/atmosphere/util.hpp @@ -15,7 +15,7 @@ */ #pragma once -#include +#include "defines.hpp" #include "util/util_alignment.hpp" #include "util/util_size.hpp" diff --git a/include/stratosphere/util/util_alignment.hpp b/include/atmosphere/util/util_alignment.hpp similarity index 98% rename from include/stratosphere/util/util_alignment.hpp rename to include/atmosphere/util/util_alignment.hpp index 7ef5c053..36f28e71 100644 --- a/include/stratosphere/util/util_alignment.hpp +++ b/include/atmosphere/util/util_alignment.hpp @@ -15,9 +15,7 @@ */ #pragma once -#include #include "../defines.hpp" -#include namespace ams::util { diff --git a/include/stratosphere/util/util_compression.hpp b/include/atmosphere/util/util_compression.hpp similarity index 97% rename from include/stratosphere/util/util_compression.hpp rename to include/atmosphere/util/util_compression.hpp index 644cfef5..3f310ae8 100644 --- a/include/stratosphere/util/util_compression.hpp +++ b/include/atmosphere/util/util_compression.hpp @@ -15,7 +15,7 @@ */ #pragma once -#include +#include "../defines.hpp" namespace ams::util { diff --git a/include/stratosphere/util/util_ini.hpp b/include/atmosphere/util/util_ini.hpp similarity index 96% rename from include/stratosphere/util/util_ini.hpp rename to include/atmosphere/util/util_ini.hpp index ba398cfc..7815820b 100644 --- a/include/stratosphere/util/util_ini.hpp +++ b/include/atmosphere/util/util_ini.hpp @@ -15,8 +15,7 @@ */ #pragma once -#include -#include +#include "../defines.hpp" namespace ams::util::ini { diff --git a/include/stratosphere/util/util_intrusive_list.hpp b/include/atmosphere/util/util_intrusive_list.hpp similarity index 99% rename from include/stratosphere/util/util_intrusive_list.hpp rename to include/atmosphere/util/util_intrusive_list.hpp index 36f64317..df748960 100644 --- a/include/stratosphere/util/util_intrusive_list.hpp +++ b/include/atmosphere/util/util_intrusive_list.hpp @@ -15,10 +15,6 @@ */ #pragma once -#include -#include -#include "../defines.hpp" - #include "util_parent_of_member.hpp" namespace ams::util { diff --git a/include/stratosphere/util/util_intrusive_red_black_tree.hpp b/include/atmosphere/util/util_intrusive_red_black_tree.hpp similarity index 99% rename from include/stratosphere/util/util_intrusive_red_black_tree.hpp rename to include/atmosphere/util/util_intrusive_red_black_tree.hpp index b1769f18..088286dd 100644 --- a/include/stratosphere/util/util_intrusive_red_black_tree.hpp +++ b/include/atmosphere/util/util_intrusive_red_black_tree.hpp @@ -16,10 +16,6 @@ #pragma once #include -#include -#include -#include "../defines.hpp" - #include "util_parent_of_member.hpp" namespace ams::util { diff --git a/include/stratosphere/util/util_parent_of_member.hpp b/include/atmosphere/util/util_parent_of_member.hpp similarity index 99% rename from include/stratosphere/util/util_parent_of_member.hpp rename to include/atmosphere/util/util_parent_of_member.hpp index 55efae08..4402e927 100644 --- a/include/stratosphere/util/util_parent_of_member.hpp +++ b/include/atmosphere/util/util_parent_of_member.hpp @@ -15,7 +15,6 @@ */ #pragma once -#include #include "../defines.hpp" namespace ams::util { diff --git a/include/stratosphere/util/util_scope_guard.hpp b/include/atmosphere/util/util_scope_guard.hpp similarity index 98% rename from include/stratosphere/util/util_scope_guard.hpp rename to include/atmosphere/util/util_scope_guard.hpp index 462f797e..a48d825e 100644 --- a/include/stratosphere/util/util_scope_guard.hpp +++ b/include/atmosphere/util/util_scope_guard.hpp @@ -16,7 +16,6 @@ /* Scope guard logic lovingly taken from Andrei Alexandrescu's "Systemic Error Handling in C++" */ #pragma once -#include #include "../defines.hpp" namespace ams::util { diff --git a/include/stratosphere/util/util_size.hpp b/include/atmosphere/util/util_size.hpp similarity index 97% rename from include/stratosphere/util/util_size.hpp rename to include/atmosphere/util/util_size.hpp index 78e9cbe4..c4db1a3b 100644 --- a/include/stratosphere/util/util_size.hpp +++ b/include/atmosphere/util/util_size.hpp @@ -15,7 +15,7 @@ */ #pragma once -#include +#include "../defines.hpp" namespace ams::util { diff --git a/include/stratosphere/util/util_typed_storage.hpp b/include/atmosphere/util/util_typed_storage.hpp similarity index 97% rename from include/stratosphere/util/util_typed_storage.hpp rename to include/atmosphere/util/util_typed_storage.hpp index 9b3960dd..ffcd564a 100644 --- a/include/stratosphere/util/util_typed_storage.hpp +++ b/include/atmosphere/util/util_typed_storage.hpp @@ -15,9 +15,7 @@ */ #pragma once -#include #include "../defines.hpp" -#include namespace ams::util { diff --git a/include/stratosphere.hpp b/include/stratosphere.hpp index 58e7ffe7..fdbeea82 100644 --- a/include/stratosphere.hpp +++ b/include/stratosphere.hpp @@ -16,19 +16,34 @@ #pragma once -#include "stratosphere/defines.hpp" -#include "stratosphere/results.hpp" +/* Pulls in util, svc. */ +#include "atmosphere/common.hpp" -#include "stratosphere/util.hpp" -#include "stratosphere/svc.hpp" +/* Critical modules with no dependencies. */ #include "stratosphere/ams.hpp" #include "stratosphere/os.hpp" #include "stratosphere/dd.hpp" + +/* Lots of things depend on NCM, for Title IDs. */ +#include "stratosphere/ncm.hpp" + +/* At this point, just include the rest alphabetically. */ +/* TODO: Figure out optimal order. */ +#include "stratosphere/boot2.hpp" #include "stratosphere/cfg.hpp" +#include "stratosphere/dmnt.hpp" #include "stratosphere/fatal.hpp" #include "stratosphere/hid.hpp" -#include "stratosphere/ncm.hpp" +#include "stratosphere/hos.hpp" +#include "stratosphere/kvdb.hpp" +#include "stratosphere/ldr.hpp" +#include "stratosphere/map.hpp" +#include "stratosphere/patcher.hpp" #include "stratosphere/pm.hpp" +#include "stratosphere/reg.hpp" #include "stratosphere/rnd.hpp" -#include "stratosphere/sm.hpp" +#include "stratosphere/ro.hpp" #include "stratosphere/sf.hpp" +#include "stratosphere/sm.hpp" +#include "stratosphere/spl.hpp" +#include "stratosphere/updater.hpp" diff --git a/include/stratosphere/ams/ams_types.hpp b/include/stratosphere/ams/ams_types.hpp index 661d940a..dc24b936 100644 --- a/include/stratosphere/ams/ams_types.hpp +++ b/include/stratosphere/ams/ams_types.hpp @@ -15,8 +15,7 @@ */ #pragma once -#include "../defines.hpp" -#include "../results.hpp" +#include #include "../sf/sf_buffer_tags.hpp" #include "../hos.hpp" @@ -36,6 +35,26 @@ namespace ams::exosphere { TargetFirmware_900 = 11, }; +#ifdef ATMOSPHERE_H +/* #ifdef __has_include() */ + +#define AMS_VALIDATE_TARGET_FIRMWARE_ENUM(n) static_assert(TargetFirmware_##n == ATMOSPHERE_TARGET_FIRMWARE_##n) + + AMS_VALIDATE_TARGET_FIRMWARE_ENUM(100); + AMS_VALIDATE_TARGET_FIRMWARE_ENUM(200); + AMS_VALIDATE_TARGET_FIRMWARE_ENUM(300); + AMS_VALIDATE_TARGET_FIRMWARE_ENUM(400); + AMS_VALIDATE_TARGET_FIRMWARE_ENUM(500); + AMS_VALIDATE_TARGET_FIRMWARE_ENUM(620); + AMS_VALIDATE_TARGET_FIRMWARE_ENUM(700); + AMS_VALIDATE_TARGET_FIRMWARE_ENUM(800); + AMS_VALIDATE_TARGET_FIRMWARE_ENUM(810); + AMS_VALIDATE_TARGET_FIRMWARE_ENUM(900); + +#undef AMS_VALIDATE_TARGET_FIRMWARE_ENUM + +#endif + constexpr inline u32 GetVersion(u32 major, u32 minor, u32 micro) { return (major << 16) | (minor << 8) | (micro); } diff --git a/include/stratosphere/boot2.hpp b/include/stratosphere/boot2.hpp index 55b3fc3b..f75afe4b 100644 --- a/include/stratosphere/boot2.hpp +++ b/include/stratosphere/boot2.hpp @@ -15,6 +15,5 @@ */ #pragma once -#include #include "boot2/boot2_api.hpp" diff --git a/include/stratosphere/boot2/boot2_api.hpp b/include/stratosphere/boot2/boot2_api.hpp index 468d8cdf..f2392586 100644 --- a/include/stratosphere/boot2/boot2_api.hpp +++ b/include/stratosphere/boot2/boot2_api.hpp @@ -15,8 +15,7 @@ */ #pragma once -#include -#include +#include namespace ams::boot2 { diff --git a/include/stratosphere/cfg.hpp b/include/stratosphere/cfg.hpp index e78dd8a1..6c9f85bf 100644 --- a/include/stratosphere/cfg.hpp +++ b/include/stratosphere/cfg.hpp @@ -15,6 +15,5 @@ */ #pragma once -#include #include "cfg/cfg_api.hpp" diff --git a/include/stratosphere/cfg/cfg_api.hpp b/include/stratosphere/cfg/cfg_api.hpp index 292f18b0..68e19740 100644 --- a/include/stratosphere/cfg/cfg_api.hpp +++ b/include/stratosphere/cfg/cfg_api.hpp @@ -15,7 +15,6 @@ */ #pragma once -#include #include "../os/os_common_types.hpp" #include "../ncm/ncm_types.hpp" diff --git a/include/stratosphere/dd.hpp b/include/stratosphere/dd.hpp index a4ba4aac..8d8c9bbe 100644 --- a/include/stratosphere/dd.hpp +++ b/include/stratosphere/dd.hpp @@ -15,6 +15,5 @@ */ #pragma once -#include #include "dd/dd_io_mappings.hpp" diff --git a/include/stratosphere/dd/dd_io_mappings.hpp b/include/stratosphere/dd/dd_io_mappings.hpp index c0d913f0..4105751d 100644 --- a/include/stratosphere/dd/dd_io_mappings.hpp +++ b/include/stratosphere/dd/dd_io_mappings.hpp @@ -15,8 +15,7 @@ */ #pragma once -#include -#include "../defines.hpp" +#include namespace ams::dd { diff --git a/include/stratosphere/dmnt.hpp b/include/stratosphere/dmnt.hpp index 62539959..a0d421b4 100644 --- a/include/stratosphere/dmnt.hpp +++ b/include/stratosphere/dmnt.hpp @@ -15,6 +15,5 @@ */ #pragma once -#include #include "dmnt/dmnt_cheat_types.hpp" diff --git a/include/stratosphere/dmnt/dmnt_cheat_types.hpp b/include/stratosphere/dmnt/dmnt_cheat_types.hpp index 3c5ed2da..1231cb5e 100644 --- a/include/stratosphere/dmnt/dmnt_cheat_types.hpp +++ b/include/stratosphere/dmnt/dmnt_cheat_types.hpp @@ -15,7 +15,6 @@ */ #pragma once - #include "../os/os_common_types.hpp" #include "../ncm/ncm_types.hpp" #include "../sf/sf_buffer_tags.hpp" diff --git a/include/stratosphere/fatal.hpp b/include/stratosphere/fatal.hpp index d3fbb885..de81dacf 100644 --- a/include/stratosphere/fatal.hpp +++ b/include/stratosphere/fatal.hpp @@ -15,6 +15,5 @@ */ #pragma once -#include #include "fatal/fatal_types.hpp" diff --git a/include/stratosphere/fatal/fatal_types.hpp b/include/stratosphere/fatal/fatal_types.hpp index 69996d37..6dfb60f4 100644 --- a/include/stratosphere/fatal/fatal_types.hpp +++ b/include/stratosphere/fatal/fatal_types.hpp @@ -15,9 +15,7 @@ */ #pragma once -#include -#include "../defines.hpp" -#include "../results.hpp" +#include #include "../ncm/ncm_types.hpp" #include "../sf/sf_buffer_tags.hpp" diff --git a/include/stratosphere/hid.hpp b/include/stratosphere/hid.hpp index bea31e2c..6f6c1524 100644 --- a/include/stratosphere/hid.hpp +++ b/include/stratosphere/hid.hpp @@ -15,6 +15,5 @@ */ #pragma once -#include #include "hid/hid_api.hpp" \ No newline at end of file diff --git a/include/stratosphere/hos/hos_types.hpp b/include/stratosphere/hos/hos_types.hpp index 79b58a09..0b8c60b4 100644 --- a/include/stratosphere/hos/hos_types.hpp +++ b/include/stratosphere/hos/hos_types.hpp @@ -15,9 +15,7 @@ */ #pragma once -#include -#include "../defines.hpp" -#include "../results.hpp" +#include namespace ams::hos { diff --git a/include/stratosphere/kvdb.hpp b/include/stratosphere/kvdb.hpp new file mode 100644 index 00000000..f600cdbe --- /dev/null +++ b/include/stratosphere/kvdb.hpp @@ -0,0 +1,24 @@ +/* + * 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 "kvdb/kvdb_auto_buffer.hpp" +#include "kvdb/kvdb_bounded_string.hpp" +#include "kvdb/kvdb_archive.hpp" +#include "kvdb/kvdb_memory_key_value_store.hpp" +#include "kvdb/kvdb_file_key_value_store.hpp" +#include "kvdb/kvdb_file_key_value_cache.hpp" diff --git a/include/stratosphere/kvdb/kvdb_archive.hpp b/include/stratosphere/kvdb/kvdb_archive.hpp index 5b7ab3e8..b315de8c 100644 --- a/include/stratosphere/kvdb/kvdb_archive.hpp +++ b/include/stratosphere/kvdb/kvdb_archive.hpp @@ -15,10 +15,6 @@ */ #pragma once -#include -#include "../defines.hpp" -#include "../results.hpp" - #include "kvdb_auto_buffer.hpp" namespace ams::kvdb { diff --git a/include/stratosphere/kvdb/kvdb_auto_buffer.hpp b/include/stratosphere/kvdb/kvdb_auto_buffer.hpp index 3b315e54..0950c914 100644 --- a/include/stratosphere/kvdb/kvdb_auto_buffer.hpp +++ b/include/stratosphere/kvdb/kvdb_auto_buffer.hpp @@ -15,9 +15,7 @@ */ #pragma once -#include -#include "../defines.hpp" -#include "../results.hpp" +#include namespace ams::kvdb { diff --git a/include/stratosphere/kvdb/kvdb_bounded_string.hpp b/include/stratosphere/kvdb/kvdb_bounded_string.hpp index f9aac8d5..16b4b439 100644 --- a/include/stratosphere/kvdb/kvdb_bounded_string.hpp +++ b/include/stratosphere/kvdb/kvdb_bounded_string.hpp @@ -15,11 +15,7 @@ */ #pragma once -#include -#include -#include -#include "../defines.hpp" -#include "../results.hpp" +#include namespace ams::kvdb { diff --git a/include/stratosphere/kvdb/kvdb_file_key_value_cache.hpp b/include/stratosphere/kvdb/kvdb_file_key_value_cache.hpp index 4c7b5b35..d37c4710 100644 --- a/include/stratosphere/kvdb/kvdb_file_key_value_cache.hpp +++ b/include/stratosphere/kvdb/kvdb_file_key_value_cache.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #include -#include #include "kvdb_bounded_string.hpp" #include "kvdb_file_key_value_store.hpp" @@ -45,16 +43,12 @@ namespace ams::kvdb { /* Open the file. */ FILE *fp = fopen(path, "r+b"); - if (fp == nullptr) { - return fsdevGetLastResult(); - } + R_UNLESS(fp != nullptr, fsdevGetLastResult()); ON_SCOPE_EXIT { fclose(fp); }; /* Write new header with zero entries to the file. */ LruHeader new_header = { .entry_count = 0, }; - if (fwrite(&new_header, sizeof(new_header), 1, fp) != 1) { - return fsdevGetLastResult(); - } + R_UNLESS(fwrite(&new_header, sizeof(new_header), 1, fp) == 1, fsdevGetLastResult()); return ResultSuccess(); } @@ -78,7 +72,7 @@ namespace ams::kvdb { Result Initialize(const char *path, void *buf, size_t size) { /* Only initialize once, and ensure we have sufficient memory. */ AMS_ASSERT(this->keys == nullptr); - SSS_ASSERT(size >= BufferSize); + AMS_ASSERT(size >= BufferSize); /* Setup member variables. */ this->keys = static_cast(buf); @@ -87,22 +81,16 @@ namespace ams::kvdb { /* Open file. */ FILE *fp = fopen(this->file_path, "rb"); - if (fp == nullptr) { - return fsdevGetLastResult(); - } + R_UNLESS(fp != nullptr, fsdevGetLastResult()); ON_SCOPE_EXIT { fclose(fp); }; /* Read header. */ - if (fread(&this->header, sizeof(this->header), 1, fp) != 1) { - return fsdevGetLastResult(); - } + R_UNLESS(fread(&this->header, sizeof(this->header), 1, fp) == 1, fsdevGetLastResult()); /* Read entries. */ const size_t count = this->GetCount(); if (count > 0) { - if (fread(this->keys, std::min(BufferSize, sizeof(Key) * count), 1, fp) != 1) { - return fsdevGetLastResult(); - } + R_UNLESS(fread(this->keys, std::min(BufferSize, sizeof(Key) * count), 1, fp) == 1, fsdevGetLastResult()); } return ResultSuccess(); @@ -111,20 +99,14 @@ namespace ams::kvdb { Result Save() { /* Open file. */ FILE *fp = fopen(this->file_path, "r+b"); - if (fp == nullptr) { - return fsdevGetLastResult(); - } + R_UNLESS(fp != nullptr, fsdevGetLastResult()); ON_SCOPE_EXIT { fclose(fp); }; /* Write header. */ - if (fwrite(&this->header, sizeof(this->header), 1, fp) != 1) { - return fsdevGetLastResult(); - } + R_UNLESS(fwrite(&this->header, sizeof(this->header), 1, fp) == 1, fsdevGetLastResult()); /* Write entries. */ - if (fwrite(this->keys, BufferSize, 1, fp) != 1) { - return fsdevGetLastResult(); - } + R_UNLESS(fwrite(this->keys, BufferSize, 1, fp) == 1, fsdevGetLastResult()); /* Flush. */ fflush(fp); @@ -228,21 +210,25 @@ namespace ams::kvdb { } static Result Exists(bool *out, const char *path, bool is_dir) { - /* Check if the path exists. */ - struct stat st; - if (stat(path, &st) != 0) { - R_TRY_CATCH(fsdevGetLastResult()) { - R_CATCH(ResultFsPathNotFound) { - /* If the path doesn't exist, nothing has gone wrong. */ - *out = false; - return ResultSuccess(); - } - } R_END_TRY_CATCH; - } + /* Set out to false initially. */ + *out = false; - /* Check that our entry type is correct. */ - if ((is_dir && !(S_ISDIR(st.st_mode))) || (!is_dir && !(S_ISREG(st.st_mode)))) { - return ResultKvdbInvalidFilesystemState; + /* Check that the path exists, and that our entry type is correct. */ + { + struct stat st; + + if (stat(path, &st) != 0) { + R_TRY_CATCH(fsdevGetLastResult()) { + /* If the path doesn't exist, nothing has gone wrong. */ + R_CONVERT(fs::ResultPathNotFound, ResultSuccess()); + } R_END_TRY_CATCH; + } + + if (is_dir) { + R_UNLESS((S_ISDIR(st.st_mode)), ResultInvalidFilesystemState()); + } else { + R_UNLESS((S_ISREG(st.st_mode)), ResultInvalidFilesystemState()); + } } *out = true; @@ -260,9 +246,7 @@ namespace ams::kvdb { static Result CreateNewCache(const char *dir) { /* Make a new key value store filesystem, and a new lru_list.dat. */ R_TRY(LeastRecentlyUsedList::CreateNewList(GetLeastRecentlyUsedListPath(dir))); - if (mkdir(GetFileKeyValueStorePath(dir), 0) != 0) { - return fsdevGetLastResult(); - } + R_UNLESS(mkdir(GetFileKeyValueStorePath(dir), 0) == 0, fsdevGetLastResult()); return ResultSuccess(); } @@ -274,14 +258,10 @@ namespace ams::kvdb { R_TRY(DirectoryExists(&has_kvs, GetFileKeyValueStorePath(dir))); /* If neither exists, CreateNewCache was never called. */ - if (!has_lru && !has_kvs) { - return ResultKvdbNotCreated; - } + R_UNLESS(has_lru || has_kvs, ResultNotCreated()); /* If one exists but not the other, we have an invalid state. */ - if (has_lru ^ has_kvs) { - return ResultKvdbInvalidFilesystemState; - } + R_UNLESS(has_lru && has_kvs, ResultInvalidFilesystemState()); return ResultSuccess(); } @@ -359,12 +339,12 @@ namespace ams::kvdb { while (true) { /* Try to set the key. */ R_TRY_CATCH(this->kvs.Set(key, value, value_size)) { - R_CATCH_RANGE(ResultFsNotEnoughFreeSpace) { + R_CATCH(fs::ResultNotEnoughFreeSpace) { /* If our entry is the only thing in the Lru list, remove it. */ if (this->lru_list.GetCount() == 1) { this->lru_list.Pop(); R_TRY(this->lru_list.Save()); - return R_TRY_CATCH_RESULT; + return fs::ResultNotEnoughFreeSpace(); } /* Otherwise, remove the oldest element from the cache and try again. */ diff --git a/include/stratosphere/kvdb/kvdb_file_key_value_store.hpp b/include/stratosphere/kvdb/kvdb_file_key_value_store.hpp index 83ce93be..a53fca9f 100644 --- a/include/stratosphere/kvdb/kvdb_file_key_value_store.hpp +++ b/include/stratosphere/kvdb/kvdb_file_key_value_store.hpp @@ -13,12 +13,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include -#include #include "../os.hpp" - #include "kvdb_bounded_string.hpp" namespace ams::kvdb { diff --git a/include/stratosphere/kvdb/kvdb_memory_key_value_store.hpp b/include/stratosphere/kvdb/kvdb_memory_key_value_store.hpp index e18a9a8c..8627f345 100644 --- a/include/stratosphere/kvdb/kvdb_memory_key_value_store.hpp +++ b/include/stratosphere/kvdb/kvdb_memory_key_value_store.hpp @@ -15,12 +15,7 @@ */ #pragma once -#include -#include #include -#include "../defines.hpp" -#include "../results.hpp" -#include "../util.hpp" #include "kvdb_auto_buffer.hpp" #include "kvdb_archive.hpp" #include "kvdb_bounded_string.hpp" @@ -124,9 +119,7 @@ namespace ams::kvdb { Result Initialize(size_t capacity) { this->entries = reinterpret_cast(std::malloc(sizeof(Entry) * capacity)); - if (this->entries == nullptr) { - return ResultKvdbAllocationFailed; - } + R_UNLESS(this->entries != nullptr, ResultAllocationFailed()); this->capacity = capacity; return ResultSuccess(); } @@ -134,9 +127,8 @@ namespace ams::kvdb { Result Set(const Key &key, const void *value, size_t value_size) { /* Allocate new value. */ void *new_value = std::malloc(value_size); - if (new_value == nullptr) { - return ResultKvdbAllocationFailed; - } + R_UNLESS(new_value != nullptr, ResultAllocationFailed()); + auto value_guard = SCOPE_GUARD { std::free(new_value); }; std::memcpy(new_value, value, value_size); /* Find entry for key. */ @@ -146,23 +138,19 @@ namespace ams::kvdb { std::free(it->GetValuePointer()); } else { /* We need to add a new entry. Check we have room, move future keys forward. */ - if (this->count >= this->capacity) { - std::free(new_value); - return ResultKvdbKeyCapacityInsufficient; - } + R_UNLESS(this->count < this->capacity, ResultOutOfKeyResource()); std::memmove(it + 1, it, sizeof(*it) * (this->end() - it)); this->count++; } /* Save the new Entry in the map. */ + value_guard.Cancel(); *it = Entry(key, new_value, value_size); return ResultSuccess(); } Result AddUnsafe(const Key &key, void *value, size_t value_size) { - if (this->count >= this->capacity) { - return ResultKvdbKeyCapacityInsufficient; - } + R_UNLESS(this->count < this->capacity, ResultOutOfKeyResource()); this->entries[this->count++] = Entry(key, value, value_size); return ResultSuccess(); @@ -171,18 +159,13 @@ namespace ams::kvdb { Result Remove(const Key &key) { /* Find entry for key. */ Entry *it = this->find(key); + R_UNLESS(it != this->end(), ResultKeyNotFound()); - /* Check if the entry is valid. */ - if (it != this->end()) { - /* Free the value, move entries back. */ - std::free(it->GetValuePointer()); - std::memmove(it, it + 1, sizeof(*it) * (this->end() - (it + 1))); - this->count--; - return ResultSuccess(); - } - - /* If it's not, we didn't remove it. */ - return ResultKvdbKeyNotFound; + /* Free the value, move entries back. */ + std::free(it->GetValuePointer()); + std::memmove(it, it + 1, sizeof(*it) * (this->end() - (it + 1))); + this->count--; + return ResultSuccess(); } Entry *begin() { @@ -281,9 +264,8 @@ namespace ams::kvdb { /* Ensure that the passed path is a directory. */ { struct stat st; - if (stat(dir, &st) != 0 || !(S_ISDIR(st.st_mode))) { - return ResultFsPathNotFound; - } + R_UNLESS(stat(dir, &st) == 0, fs::ResultPathNotFound()); + R_UNLESS((S_ISDIR(st.st_mode)), fs::ResultPathNotFound()); } /* Set paths. */ @@ -322,9 +304,7 @@ namespace ams::kvdb { /* This is because no archive file = no entries, so we're in the right state. */ AutoBuffer buffer; R_TRY_CATCH(this->ReadArchiveFile(&buffer)) { - R_CATCH(ResultFsPathNotFound) { - return ResultSuccess(); - } + R_CONVERT(fs::ResultPathNotFound, ResultSuccess()); } R_END_TRY_CATCH; /* Parse entries from the buffer. */ @@ -341,9 +321,7 @@ namespace ams::kvdb { /* Allocate memory for value. */ void *new_value = std::malloc(value_size); - if (new_value == nullptr) { - return ResultKvdbAllocationFailed; - } + R_UNLESS(new_value != nullptr, ResultAllocationFailed()); auto value_guard = SCOPE_GUARD { std::free(new_value); }; /* Read key and value. */ @@ -399,9 +377,7 @@ namespace ams::kvdb { Result Get(size_t *out_size, void *out_value, size_t max_out_size, const Key &key) { /* Find entry. */ auto it = this->find(key); - if (it == this->end()) { - return ResultKvdbKeyNotFound; - } + R_UNLESS(it != this->end(), ResultKeyNotFound()); size_t size = std::min(max_out_size, it->GetValueSize()); std::memcpy(out_value, it->GetValuePointer(), size); @@ -413,9 +389,7 @@ namespace ams::kvdb { Result GetValuePointer(Value **out_value, const Key &key) { /* Find entry. */ auto it = this->find(key); - if (it == this->end()) { - return ResultKvdbKeyNotFound; - } + R_UNLESS(it != this->end(), ResultKeyNotFound()); *out_value = it->template GetValuePointer(); return ResultSuccess(); @@ -425,9 +399,7 @@ namespace ams::kvdb { Result GetValuePointer(const Value **out_value, const Key &key) const { /* Find entry. */ auto it = this->find(key); - if (it == this->end()) { - return ResultKvdbKeyNotFound; - } + R_UNLESS(it != this->end(), ResultKeyNotFound()); *out_value = it->template GetValuePointer(); return ResultSuccess(); @@ -437,9 +409,7 @@ namespace ams::kvdb { Result GetValue(Value *out_value, const Key &key) const { /* Find entry. */ auto it = this->find(key); - if (it == this->end()) { - return ResultKvdbKeyNotFound; - } + R_UNLESS(it != this->end(), ResultKeyNotFound()); *out_value = it->template GetValue(); return ResultSuccess(); @@ -448,9 +418,7 @@ namespace ams::kvdb { Result GetValueSize(size_t *out_size, const Key &key) const { /* Find entry. */ auto it = this->find(key); - if (it == this->end()) { - return ResultKvdbKeyNotFound; - } + R_UNLESS(it != this->end(), ResultKeyNotFound()); *out_size = it->GetValueSize(); return ResultSuccess(); @@ -510,23 +478,17 @@ namespace ams::kvdb { /* Write data to the temporary archive. */ { FILE *f = fopen(this->temp_path, "r+b"); - if (f == nullptr) { - return fsdevGetLastResult(); - } + R_UNLESS(f != nullptr, fsdevGetLastResult()); ON_SCOPE_EXIT { fclose(f); }; - if (fwrite(buffer.Get(), buffer.GetSize(), 1, f) != 1) { - return fsdevGetLastResult(); - } + R_UNLESS(fwrite(buffer.Get(), buffer.GetSize(), 1, f) == 1, fsdevGetLastResult()); } /* Try to delete the saved archive, but allow deletion failure. */ std::remove(this->path.Get()); /* Rename the path. */ - if (std::rename(this->temp_path.Get(), this->path.Get()) != 0) { - return fsdevGetLastResult(); - } + R_UNLESS(std::rename(this->temp_path.Get(), this->path.Get()) == 0, fsdevGetLastResult()); return ResultSuccess(); } @@ -544,9 +506,7 @@ namespace ams::kvdb { Result ReadArchiveFile(AutoBuffer *dst) const { /* Open the file. */ FILE *f = fopen(this->path, "rb"); - if (f == nullptr) { - return fsdevGetLastResult(); - } + R_UNLESS(f != nullptr, fsdevGetLastResult()); ON_SCOPE_EXIT { fclose(f); }; /* Get the archive file size. */ @@ -556,9 +516,7 @@ namespace ams::kvdb { /* Make a new buffer, read the file. */ R_TRY(dst->Initialize(archive_size)); - if (fread(dst->Get(), archive_size, 1, f) != 1) { - return fsdevGetLastResult(); - } + R_UNLESS(fread(dst->Get(), archive_size, 1, f) == 1, fsdevGetLastResult()); return ResultSuccess(); } diff --git a/include/stratosphere/ldr.hpp b/include/stratosphere/ldr.hpp index fc56cb76..5a4d6552 100644 --- a/include/stratosphere/ldr.hpp +++ b/include/stratosphere/ldr.hpp @@ -15,6 +15,6 @@ */ #pragma once -#include #include "ldr/ldr_types.hpp" +#include "ldr/ldr_pm_api.hpp" diff --git a/include/stratosphere/ldr/ldr_pm_api.hpp b/include/stratosphere/ldr/ldr_pm_api.hpp index 87a19428..440513fd 100644 --- a/include/stratosphere/ldr/ldr_pm_api.hpp +++ b/include/stratosphere/ldr/ldr_pm_api.hpp @@ -15,7 +15,6 @@ */ #pragma once - #include "ldr_types.hpp" namespace ams::ldr::pm { diff --git a/include/stratosphere/ldr/ldr_types.hpp b/include/stratosphere/ldr/ldr_types.hpp index b0b25a5d..3ab3c3ea 100644 --- a/include/stratosphere/ldr/ldr_types.hpp +++ b/include/stratosphere/ldr/ldr_types.hpp @@ -15,10 +15,7 @@ */ #pragma once - -#include -#include -#include "../svc/svc_types.hpp" +#include #include "../ncm/ncm_types.hpp" #include "../sf/sf_buffer_tags.hpp" diff --git a/include/stratosphere/map.hpp b/include/stratosphere/map.hpp index 0d9d8ba9..3b34b234 100644 --- a/include/stratosphere/map.hpp +++ b/include/stratosphere/map.hpp @@ -15,7 +15,6 @@ */ #pragma once -#include #include "map/map_types.hpp" #include "map/map_api.hpp" diff --git a/include/stratosphere/map/map_api.hpp b/include/stratosphere/map/map_api.hpp index 26aca5c2..89f04b50 100644 --- a/include/stratosphere/map/map_api.hpp +++ b/include/stratosphere/map/map_api.hpp @@ -15,8 +15,6 @@ */ #pragma once -#include - #include "map_types.hpp" namespace ams::map { diff --git a/include/stratosphere/map/map_types.hpp b/include/stratosphere/map/map_types.hpp index ad33a9c4..41127e87 100644 --- a/include/stratosphere/map/map_types.hpp +++ b/include/stratosphere/map/map_types.hpp @@ -15,8 +15,7 @@ */ #pragma once -#include -#include "../results.hpp" +#include namespace ams::map { diff --git a/include/stratosphere/ncm.hpp b/include/stratosphere/ncm.hpp index ec0830de..8f2d1084 100644 --- a/include/stratosphere/ncm.hpp +++ b/include/stratosphere/ncm.hpp @@ -15,6 +15,5 @@ */ #pragma once -#include #include "ncm/ncm_types.hpp" diff --git a/include/stratosphere/os.hpp b/include/stratosphere/os.hpp index 6d009ee0..04664b12 100644 --- a/include/stratosphere/os.hpp +++ b/include/stratosphere/os.hpp @@ -15,7 +15,6 @@ */ #pragma once -#include #include "os/os_common_types.hpp" #include "os/os_managed_handle.hpp" diff --git a/include/stratosphere/os/os_common_types.hpp b/include/stratosphere/os/os_common_types.hpp index 0e581d93..f88c3ba1 100644 --- a/include/stratosphere/os/os_common_types.hpp +++ b/include/stratosphere/os/os_common_types.hpp @@ -14,9 +14,7 @@ * along with this program. If not, see . */ #pragma once -#include -#include "../results.hpp" -#include "../util.hpp" +#include namespace ams::os { diff --git a/include/stratosphere/os/os_interrupt_event.hpp b/include/stratosphere/os/os_interrupt_event.hpp index d11ab529..ccfd9791 100644 --- a/include/stratosphere/os/os_interrupt_event.hpp +++ b/include/stratosphere/os/os_interrupt_event.hpp @@ -15,7 +15,6 @@ */ #pragma once -#include "os_common_types.hpp" #include "os_managed_handle.hpp" namespace ams::os { diff --git a/include/stratosphere/os/os_managed_handle.hpp b/include/stratosphere/os/os_managed_handle.hpp index 3f127d11..72ecda11 100644 --- a/include/stratosphere/os/os_managed_handle.hpp +++ b/include/stratosphere/os/os_managed_handle.hpp @@ -15,9 +15,7 @@ */ #pragma once -#include -#include "../defines.hpp" -#include "../results.hpp" +#include "os_common_types.hpp" namespace ams::os { diff --git a/include/stratosphere/os/os_message_queue.hpp b/include/stratosphere/os/os_message_queue.hpp index f7e925b0..5c24bf5e 100644 --- a/include/stratosphere/os/os_message_queue.hpp +++ b/include/stratosphere/os/os_message_queue.hpp @@ -15,8 +15,6 @@ */ #pragma once -#include -#include "os_common_types.hpp" #include "os_mutex.hpp" #include "os_condvar.hpp" diff --git a/include/stratosphere/os/os_mutex.hpp b/include/stratosphere/os/os_mutex.hpp index d11dc7e0..26ba66c2 100644 --- a/include/stratosphere/os/os_mutex.hpp +++ b/include/stratosphere/os/os_mutex.hpp @@ -15,9 +15,7 @@ */ #pragma once -#include -#include -#include "../util.hpp" +#include "os_common_types.hpp" namespace ams::os { diff --git a/include/stratosphere/os/os_semaphore.hpp b/include/stratosphere/os/os_semaphore.hpp index ae8c49ca..7cda2c86 100644 --- a/include/stratosphere/os/os_semaphore.hpp +++ b/include/stratosphere/os/os_semaphore.hpp @@ -15,7 +15,7 @@ */ #pragma once -#include +#include "os_common_types.hpp" namespace ams::os { diff --git a/include/stratosphere/os/os_system_event.hpp b/include/stratosphere/os/os_system_event.hpp index 564ee407..290bfe52 100644 --- a/include/stratosphere/os/os_system_event.hpp +++ b/include/stratosphere/os/os_system_event.hpp @@ -15,7 +15,6 @@ */ #pragma once -#include "os_common_types.hpp" #include "os_event.hpp" namespace ams::os { diff --git a/include/stratosphere/os/os_thread.hpp b/include/stratosphere/os/os_thread.hpp index 0c5da0be..d1b35d7c 100644 --- a/include/stratosphere/os/os_thread.hpp +++ b/include/stratosphere/os/os_thread.hpp @@ -15,7 +15,7 @@ */ #pragma once -#include +#include "os_common_types.hpp" namespace ams::os { diff --git a/include/stratosphere/os/os_timeout_helper.hpp b/include/stratosphere/os/os_timeout_helper.hpp index f91398a2..650a3e3e 100644 --- a/include/stratosphere/os/os_timeout_helper.hpp +++ b/include/stratosphere/os/os_timeout_helper.hpp @@ -14,7 +14,7 @@ * along with this program. If not, see . */ #pragma once -#include +#include "os_common_types.hpp" namespace ams::os { diff --git a/include/stratosphere/os/os_waitable_holder.hpp b/include/stratosphere/os/os_waitable_holder.hpp index dccbb6db..ea3216b4 100644 --- a/include/stratosphere/os/os_waitable_holder.hpp +++ b/include/stratosphere/os/os_waitable_holder.hpp @@ -14,7 +14,6 @@ * along with this program. If not, see . */ #pragma once -#include "../util.hpp" #include "os_common_types.hpp" namespace ams::os { diff --git a/include/stratosphere/os/os_waitable_manager.hpp b/include/stratosphere/os/os_waitable_manager.hpp index b2b2fba8..90e912e1 100644 --- a/include/stratosphere/os/os_waitable_manager.hpp +++ b/include/stratosphere/os/os_waitable_manager.hpp @@ -14,8 +14,6 @@ * along with this program. If not, see . */ #pragma once -#include "../util.hpp" -#include "os_common_types.hpp" #include "os_mutex.hpp" namespace ams::os { diff --git a/include/stratosphere/patcher.hpp b/include/stratosphere/patcher.hpp index 0e11d4c4..deafa05c 100644 --- a/include/stratosphere/patcher.hpp +++ b/include/stratosphere/patcher.hpp @@ -15,6 +15,5 @@ */ #pragma once -#include #include "patcher/patcher_api.hpp" diff --git a/include/stratosphere/pm.hpp b/include/stratosphere/pm.hpp index 2a8d7976..7593c5b6 100644 --- a/include/stratosphere/pm.hpp +++ b/include/stratosphere/pm.hpp @@ -15,7 +15,6 @@ */ #pragma once -#include #include "pm/pm_types.hpp" #include "pm/pm_boot_mode_api.hpp" diff --git a/include/stratosphere/pm/pm_types.hpp b/include/stratosphere/pm/pm_types.hpp index 36671b83..a40eee8f 100644 --- a/include/stratosphere/pm/pm_types.hpp +++ b/include/stratosphere/pm/pm_types.hpp @@ -15,7 +15,6 @@ */ #pragma once -#include #include "../os/os_common_types.hpp" namespace ams::pm { diff --git a/include/stratosphere/reg.hpp b/include/stratosphere/reg.hpp index b3748199..001c6282 100644 --- a/include/stratosphere/reg.hpp +++ b/include/stratosphere/reg.hpp @@ -15,7 +15,7 @@ */ #pragma once -#include +#include namespace ams::reg { diff --git a/include/stratosphere/rnd.hpp b/include/stratosphere/rnd.hpp index 7315f6b9..a11eba7b 100644 --- a/include/stratosphere/rnd.hpp +++ b/include/stratosphere/rnd.hpp @@ -15,6 +15,5 @@ */ #pragma once -#include #include "rnd/rnd_api.hpp" diff --git a/include/stratosphere/rnd/rnd_api.hpp b/include/stratosphere/rnd/rnd_api.hpp index ae352f56..dcea365c 100644 --- a/include/stratosphere/rnd/rnd_api.hpp +++ b/include/stratosphere/rnd/rnd_api.hpp @@ -15,8 +15,7 @@ */ #pragma once -#include -#include +#include namespace ams::rnd { diff --git a/include/stratosphere/ro.hpp b/include/stratosphere/ro.hpp index 42239e95..c5835d46 100644 --- a/include/stratosphere/ro.hpp +++ b/include/stratosphere/ro.hpp @@ -15,6 +15,5 @@ */ #pragma once -#include #include "ro/ro_types.hpp" diff --git a/include/stratosphere/ro/ro_types.hpp b/include/stratosphere/ro/ro_types.hpp index b4f857eb..ed039326 100644 --- a/include/stratosphere/ro/ro_types.hpp +++ b/include/stratosphere/ro/ro_types.hpp @@ -15,10 +15,8 @@ */ #pragma once -#include -#include -#include "../defines.hpp" -#include "../ncm.hpp" +#include +#include "../ncm/ncm_types.hpp" namespace ams::ro { diff --git a/include/stratosphere/sf.hpp b/include/stratosphere/sf.hpp index 8b39292a..7c7a5281 100644 --- a/include/stratosphere/sf.hpp +++ b/include/stratosphere/sf.hpp @@ -15,7 +15,6 @@ */ #pragma once -#include #include "sf/sf_common.hpp" #include "sf/sf_service_object.hpp" diff --git a/include/stratosphere/sf/hipc/sf_hipc_server_manager.hpp b/include/stratosphere/sf/hipc/sf_hipc_server_manager.hpp index 43cdc501..4604a933 100644 --- a/include/stratosphere/sf/hipc/sf_hipc_server_manager.hpp +++ b/include/stratosphere/sf/hipc/sf_hipc_server_manager.hpp @@ -16,6 +16,7 @@ #pragma once #include "sf_hipc_server_domain_session_manager.hpp" +#include "../../sm.hpp" namespace ams::sf::hipc { diff --git a/include/stratosphere/sf/sf_common.hpp b/include/stratosphere/sf/sf_common.hpp index 57b9bc8f..71975321 100644 --- a/include/stratosphere/sf/sf_common.hpp +++ b/include/stratosphere/sf/sf_common.hpp @@ -15,11 +15,6 @@ */ #pragma once -#include -#include -#include "../defines.hpp" -#include "../results.hpp" -#include "../util.hpp" -#include "../svc.hpp" +#include #include "../ams.hpp" #include "../os.hpp" \ No newline at end of file diff --git a/include/stratosphere/sm.hpp b/include/stratosphere/sm.hpp index 5c6ac9f3..8dd7421e 100644 --- a/include/stratosphere/sm.hpp +++ b/include/stratosphere/sm.hpp @@ -15,9 +15,10 @@ */ #pragma once -#include #include "sm/sm_types.hpp" #include "sm/sm_api.hpp" #include "sm/sm_mitm_api.hpp" #include "sm/sm_scoped_holder.hpp" + +#include "sm/sm_manager_api.hpp" diff --git a/include/stratosphere/sm/sm_types.hpp b/include/stratosphere/sm/sm_types.hpp index d61777f4..028f2a8b 100644 --- a/include/stratosphere/sm/sm_types.hpp +++ b/include/stratosphere/sm/sm_types.hpp @@ -15,12 +15,7 @@ */ #pragma once -#include -#include -#include -#include "../defines.hpp" -#include "../results.hpp" -#include "../os.hpp" +#include namespace ams::sm { diff --git a/include/stratosphere/spl.hpp b/include/stratosphere/spl.hpp index d0b43e9d..25f266b2 100644 --- a/include/stratosphere/spl.hpp +++ b/include/stratosphere/spl.hpp @@ -15,7 +15,6 @@ */ #pragma once -#include #include "spl/spl_types.hpp" #include "spl/spl_api.hpp" diff --git a/include/stratosphere/spl/smc/spl_smc.hpp b/include/stratosphere/spl/smc/spl_smc.hpp index 5d1c05b7..cef9c970 100644 --- a/include/stratosphere/spl/smc/spl_smc.hpp +++ b/include/stratosphere/spl/smc/spl_smc.hpp @@ -15,9 +15,6 @@ */ #pragma once -#include -#include - #include "../spl_types.hpp" namespace ams::spl::smc { diff --git a/include/stratosphere/spl/spl_api.hpp b/include/stratosphere/spl/spl_api.hpp index d49c1518..d68abc94 100644 --- a/include/stratosphere/spl/spl_api.hpp +++ b/include/stratosphere/spl/spl_api.hpp @@ -15,7 +15,6 @@ */ #pragma once - #include "spl_types.hpp" namespace ams::spl { diff --git a/include/stratosphere/spl/spl_types.hpp b/include/stratosphere/spl/spl_types.hpp index 1cd3f721..4f1816b5 100644 --- a/include/stratosphere/spl/spl_types.hpp +++ b/include/stratosphere/spl/spl_types.hpp @@ -15,8 +15,7 @@ */ #pragma once -#include -#include "../results.hpp" +#include namespace ams::spl { diff --git a/include/stratosphere/updater.hpp b/include/stratosphere/updater.hpp index 5195450c..5d494147 100644 --- a/include/stratosphere/updater.hpp +++ b/include/stratosphere/updater.hpp @@ -15,7 +15,6 @@ */ #pragma once -#include #include "updater/updater_types.hpp" #include "updater/updater_api.hpp" diff --git a/include/stratosphere/updater/updater_api.hpp b/include/stratosphere/updater/updater_api.hpp index 55482efc..4c36dd28 100644 --- a/include/stratosphere/updater/updater_api.hpp +++ b/include/stratosphere/updater/updater_api.hpp @@ -15,10 +15,8 @@ */ #pragma once -#include - -#include "../spl/spl_types.hpp" #include "updater_types.hpp" +#include "../spl/spl_types.hpp" namespace ams::updater { diff --git a/include/stratosphere/updater/updater_types.hpp b/include/stratosphere/updater/updater_types.hpp index 6675f3d4..4690369b 100644 --- a/include/stratosphere/updater/updater_types.hpp +++ b/include/stratosphere/updater/updater_types.hpp @@ -15,7 +15,7 @@ */ #pragma once -#include +#include namespace ams::updater { diff --git a/source/boot2/boot2_api.cpp b/source/boot2/boot2_api.cpp index 6cf08901..d12e4932 100644 --- a/source/boot2/boot2_api.cpp +++ b/source/boot2/boot2_api.cpp @@ -13,13 +13,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include #include -#include -#include -#include -#include +#include namespace ams::boot2 { diff --git a/source/cfg/cfg_flags.cpp b/source/cfg/cfg_flags.cpp index ed0ea9d2..e5d70ed8 100644 --- a/source/cfg/cfg_flags.cpp +++ b/source/cfg/cfg_flags.cpp @@ -14,9 +14,7 @@ * along with this program. If not, see . */ -#include #include -#include namespace ams::cfg { diff --git a/source/cfg/cfg_override.cpp b/source/cfg/cfg_override.cpp index 76a20fb4..2c170674 100644 --- a/source/cfg/cfg_override.cpp +++ b/source/cfg/cfg_override.cpp @@ -14,13 +14,7 @@ * along with this program. If not, see . */ -#include -#include -#include #include -#include -#include -#include namespace ams::cfg { diff --git a/source/cfg/cfg_privileged_process.cpp b/source/cfg/cfg_privileged_process.cpp index 670e590e..34a8fd25 100644 --- a/source/cfg/cfg_privileged_process.cpp +++ b/source/cfg/cfg_privileged_process.cpp @@ -14,9 +14,7 @@ * along with this program. If not, see . */ -#include #include -#include namespace ams::cfg { diff --git a/source/cfg/cfg_sd_card.cpp b/source/cfg/cfg_sd_card.cpp index 15004785..079e2455 100644 --- a/source/cfg/cfg_sd_card.cpp +++ b/source/cfg/cfg_sd_card.cpp @@ -14,10 +14,7 @@ * along with this program. If not, see . */ -#include #include -#include -#include namespace ams::cfg { diff --git a/source/hid/hid_api.cpp b/source/hid/hid_api.cpp index 0419f96d..220cabd6 100644 --- a/source/hid/hid_api.cpp +++ b/source/hid/hid_api.cpp @@ -13,11 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include -#include #include -#include -#include namespace ams::hid { diff --git a/source/kvdb/kvdb_archive.cpp b/source/kvdb/kvdb_archive.cpp index f7f3418d..40a4d055 100644 --- a/source/kvdb/kvdb_archive.cpp +++ b/source/kvdb/kvdb_archive.cpp @@ -15,7 +15,6 @@ */ #include -#include namespace ams::kvdb { @@ -32,9 +31,7 @@ namespace ams::kvdb { u32 entry_count; Result Validate() const { - if (std::memcmp(this->magic, ArchiveHeaderMagic, sizeof(ArchiveHeaderMagic)) != 0) { - return ResultInvalidKeyValue(); - } + R_UNLESS(std::memcmp(this->magic, ArchiveHeaderMagic, sizeof(ArchiveHeaderMagic)) == 0, ResultInvalidKeyValue()); return ResultSuccess(); } @@ -53,9 +50,7 @@ namespace ams::kvdb { u32 value_size; Result Validate() const { - if (std::memcmp(this->magic, ArchiveEntryMagic, sizeof(ArchiveEntryMagic)) != 0) { - return ResultInvalidKeyValue(); - } + R_UNLESS(std::memcmp(this->magic, ArchiveEntryMagic, sizeof(ArchiveEntryMagic)) == 0, ResultInvalidKeyValue()); return ResultSuccess(); } @@ -74,9 +69,8 @@ namespace ams::kvdb { /* Reader functionality. */ Result ArchiveReader::Peek(void *dst, size_t size) { /* Bounds check. */ - if (this->offset + size > this->buffer.GetSize() || this->offset + size <= this->offset) { - return ResultInvalidKeyValue(); - } + R_UNLESS(this->offset + size <= this->buffer.GetSize(), ResultInvalidKeyValue()); + R_UNLESS(this->offset + size <= this->offset, ResultInvalidKeyValue()); std::memcpy(dst, this->buffer.Get() + this->offset, size); return ResultSuccess(); @@ -136,9 +130,8 @@ namespace ams::kvdb { /* Writer functionality. */ Result ArchiveWriter::Write(const void *src, size_t size) { /* Bounds check. */ - if (this->offset + size > this->buffer.GetSize() || this->offset + size <= this->offset) { - return ResultInvalidKeyValue(); - } + R_UNLESS(this->offset + size <= this->buffer.GetSize(), ResultInvalidKeyValue()); + R_UNLESS(this->offset + size <= this->offset, ResultInvalidKeyValue()); std::memcpy(this->buffer.Get() + this->offset, src, size); this->offset += size; diff --git a/source/kvdb/kvdb_file_key_value_store.cpp b/source/kvdb/kvdb_file_key_value_store.cpp index 7b23e4c3..3e67cd63 100644 --- a/source/kvdb/kvdb_file_key_value_store.cpp +++ b/source/kvdb/kvdb_file_key_value_store.cpp @@ -14,9 +14,7 @@ * along with this program. If not, see . */ -#include #include -#include namespace ams::kvdb { @@ -40,9 +38,7 @@ namespace ams::kvdb { /* If we have memory to work with, ensure it's at least enough for the cache entries. */ if (this->backing_buffer != nullptr) { this->entries = static_castentries)>(this->Allocate(sizeof(*this->entries) * this->capacity)); - if (this->entries == nullptr) { - return ResultBufferInsufficient(); - } + R_UNLESS(this->entries != nullptr, ResultBufferInsufficient()); } return ResultSuccess(); @@ -158,15 +154,13 @@ namespace ams::kvdb { /* TODO: Nintendo does not validate that the key is valid hex. Should we do this? */ const size_t file_name_len = file_name.GetLength(); const size_t key_name_len = file_name_len - FileExtensionLength; - if (file_name_len < FileExtensionLength + 2 || !file_name.EndsWith(FileExtension) || key_name_len % 2 != 0) { - return ResultInvalidKeyValue(); - } + R_UNLESS(file_name_len >= FileExtensionLength + 2, ResultInvalidKeyValue()); + R_UNLESS(file_name.EndsWith(FileExtension), ResultInvalidKeyValue()); + R_UNLESS(util::IsAligned(key_name_len, 2), ResultInvalidKeyValue()); /* Validate that we have space for the converted key. */ const size_t key_size = key_name_len / 2; - if (key_size > max_out_size) { - return ResultBufferInsufficient(); - } + R_UNLESS(key_size <= max_out_size, ResultBufferInsufficient()); /* Convert the hex key back. */ u8 *out_key = static_cast(_out_key); @@ -188,9 +182,8 @@ namespace ams::kvdb { /* Ensure that the passed path is a directory. */ { struct stat st; - if (stat(dir, &st) != 0 || !(S_ISDIR(st.st_mode))) { - return fs::ResultPathNotFound(); - } + R_UNLESS(stat(dir, &st) == 0, fs::ResultPathNotFound()); + R_UNLESS((S_ISDIR(st.st_mode)), fs::ResultPathNotFound()); } /* Set path. */ @@ -205,9 +198,7 @@ namespace ams::kvdb { std::scoped_lock lk(this->lock); /* Ensure key size is small enough. */ - if (key_size > MaxKeySize) { - return ResultKeyCapacityInsufficient(); - } + R_UNLESS(key_size <= MaxKeySize, ResultOutOfKeyResource()); /* Try to get from cache. */ { @@ -233,14 +224,10 @@ namespace ams::kvdb { fseek(fp, 0, SEEK_SET); /* Ensure there's enough space for the value. */ - if (max_out_size < value_size) { - return ResultBufferInsufficient(); - } + R_UNLESS(value_size <= max_out_size, ResultBufferInsufficient()); /* Read the value. */ - if (fread(out_value, value_size, 1, fp) != 1) { - return fsdevGetLastResult(); - } + R_UNLESS(fread(out_value, value_size, 1, fp) == 1, fsdevGetLastResult()); *out_size = value_size; /* Cache the newly read value. */ @@ -252,9 +239,7 @@ namespace ams::kvdb { std::scoped_lock lk(this->lock); /* Ensure key size is small enough. */ - if (key_size > MaxKeySize) { - return ResultKeyCapacityInsufficient(); - } + R_UNLESS(key_size <= MaxKeySize, ResultOutOfKeyResource()); /* Try to get from cache. */ { @@ -284,9 +269,7 @@ namespace ams::kvdb { std::scoped_lock lk(this->lock); /* Ensure key size is small enough. */ - if (key_size > MaxKeySize) { - return ResultKeyCapacityInsufficient(); - } + R_UNLESS(key_size <= MaxKeySize, ResultOutOfKeyResource()); /* When the cache contains the key being set, Nintendo invalidates the cache. */ if (this->cache.Contains(key, key_size)) { @@ -299,15 +282,11 @@ namespace ams::kvdb { /* Open the value file. */ FILE *fp = fopen(key_path, "wb"); - if (fp == nullptr) { - return fsdevGetLastResult(); - } + R_UNLESS(fp != nullptr, fsdevGetLastResult()); ON_SCOPE_EXIT { fclose(fp); }; /* Write the value file. */ - if (fwrite(value, value_size, 1, fp) != 1) { - return fsdevGetLastResult(); - } + R_UNLESS(fwrite(value, value_size, 1, fp) == 1, fsdevGetLastResult()); /* Flush the value file. */ fflush(fp); @@ -319,9 +298,7 @@ namespace ams::kvdb { std::scoped_lock lk(this->lock); /* Ensure key size is small enough. */ - if (key_size > MaxKeySize) { - return ResultKeyCapacityInsufficient(); - } + R_UNLESS(key_size <= MaxKeySize, ResultOutOfKeyResource()); /* When the cache contains the key being set, Nintendo invalidates the cache. */ if (this->cache.Contains(key, key_size)) { diff --git a/source/ldr/ldr_pm_api.cpp b/source/ldr/ldr_pm_api.cpp index 6e213438..de73724d 100644 --- a/source/ldr/ldr_pm_api.cpp +++ b/source/ldr/ldr_pm_api.cpp @@ -13,12 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include -#include #include -#include -#include - #include "ldr_ams.h" namespace ams::ldr::pm { diff --git a/source/map/map_api.cpp b/source/map/map_api.cpp index d3e5ef33..ca239272 100644 --- a/source/map/map_api.cpp +++ b/source/map/map_api.cpp @@ -14,9 +14,7 @@ * along with this program. If not, see . */ -#include #include -#include namespace ams::map { diff --git a/source/os/impl/os_inter_process_event.cpp b/source/os/impl/os_inter_process_event.cpp index d6a5b31c..7194571e 100644 --- a/source/os/impl/os_inter_process_event.cpp +++ b/source/os/impl/os_inter_process_event.cpp @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include #include "os_inter_process_event.hpp" namespace ams::os::impl { diff --git a/source/os/impl/os_inter_process_event.hpp b/source/os/impl/os_inter_process_event.hpp index ad3d56e8..51e32c9f 100644 --- a/source/os/impl/os_inter_process_event.hpp +++ b/source/os/impl/os_inter_process_event.hpp @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once #include diff --git a/source/os/os_event.cpp b/source/os/os_event.cpp index 0aa4d348..1e146b9e 100644 --- a/source/os/os_event.cpp +++ b/source/os/os_event.cpp @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include #include "impl/os_waitable_object_list.hpp" namespace ams::os { diff --git a/source/os/os_interrupt_event.cpp b/source/os/os_interrupt_event.cpp index 4fdeba40..c9ee8197 100644 --- a/source/os/os_interrupt_event.cpp +++ b/source/os/os_interrupt_event.cpp @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include #include "impl/os_waitable_object_list.hpp" namespace ams::os { diff --git a/source/os/os_message_queue.cpp b/source/os/os_message_queue.cpp index 6d0a547a..17accc8a 100644 --- a/source/os/os_message_queue.cpp +++ b/source/os/os_message_queue.cpp @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include #include "impl/os_waitable_object_list.hpp" namespace ams::os { diff --git a/source/os/os_waitable_holder.cpp b/source/os/os_waitable_holder.cpp index e0f03b52..1221e446 100644 --- a/source/os/os_waitable_holder.cpp +++ b/source/os/os_waitable_holder.cpp @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include #include "impl/os_waitable_holder_impl.hpp" #include "impl/os_waitable_manager_impl.hpp" diff --git a/source/os/os_waitable_manager.cpp b/source/os/os_waitable_manager.cpp index 434ddfbd..3d00554e 100644 --- a/source/os/os_waitable_manager.cpp +++ b/source/os/os_waitable_manager.cpp @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include #include "impl/os_waitable_holder_impl.hpp" #include "impl/os_waitable_manager_impl.hpp" diff --git a/source/patcher/patcher_api.cpp b/source/patcher/patcher_api.cpp index 8fbe4a43..e46b6a9d 100644 --- a/source/patcher/patcher_api.cpp +++ b/source/patcher/patcher_api.cpp @@ -13,17 +13,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include -#include -#include -#include #include -#include - -#include #include -#include /* IPS Patching adapted from Luma3DS (https://github.com/AuroraWright/Luma3DS/blob/master/sysmodules/loader/source/patcher.c) */ diff --git a/source/pm/pm_boot_mode_api.cpp b/source/pm/pm_boot_mode_api.cpp index 5e4e8614..48a7b2e8 100644 --- a/source/pm/pm_boot_mode_api.cpp +++ b/source/pm/pm_boot_mode_api.cpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include #include -#include namespace ams::pm::bm { diff --git a/source/pm/pm_dmnt_api.cpp b/source/pm/pm_dmnt_api.cpp index 72534637..b42016d8 100644 --- a/source/pm/pm_dmnt_api.cpp +++ b/source/pm/pm_dmnt_api.cpp @@ -13,10 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include #include -#include #include "pm_ams.h" diff --git a/source/pm/pm_info_api.cpp b/source/pm/pm_info_api.cpp index 5685208a..8b6eeead 100644 --- a/source/pm/pm_info_api.cpp +++ b/source/pm/pm_info_api.cpp @@ -13,11 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include -#include #include -#include - #include "pm_ams.h" namespace ams::pm::info { diff --git a/source/pm/pm_shell_api.cpp b/source/pm/pm_shell_api.cpp index d7c4dbc9..c71c6a91 100644 --- a/source/pm/pm_shell_api.cpp +++ b/source/pm/pm_shell_api.cpp @@ -13,10 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include #include -#include namespace ams::pm::shell { diff --git a/source/result/result_on_assertion.cpp b/source/result/result_on_assertion.cpp index 160b220f..848138fd 100644 --- a/source/result/result_on_assertion.cpp +++ b/source/result/result_on_assertion.cpp @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #include namespace ams::result { diff --git a/source/rnd/rnd_api.cpp b/source/rnd/rnd_api.cpp index c8cc07df..e0553c74 100644 --- a/source/rnd/rnd_api.cpp +++ b/source/rnd/rnd_api.cpp @@ -13,11 +13,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #include -#include #include -#include namespace ams::rnd { diff --git a/source/sf/cmif/sf_cmif_domain_service_object.cpp b/source/sf/cmif/sf_cmif_domain_service_object.cpp index 57c53bb9..05705538 100644 --- a/source/sf/cmif/sf_cmif_domain_service_object.cpp +++ b/source/sf/cmif/sf_cmif_domain_service_object.cpp @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include #include namespace ams::sf::cmif { diff --git a/source/sf/cmif/sf_cmif_service_object_holder.cpp b/source/sf/cmif/sf_cmif_service_object_holder.cpp index 7bdcc4a1..c842b038 100644 --- a/source/sf/cmif/sf_cmif_service_object_holder.cpp +++ b/source/sf/cmif/sf_cmif_service_object_holder.cpp @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include #include namespace ams::sf::cmif { diff --git a/source/sm/sm_api.cpp b/source/sm/sm_api.cpp index 7fa6666a..a865b647 100644 --- a/source/sm/sm_api.cpp +++ b/source/sm/sm_api.cpp @@ -13,12 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include -#include -#include - -#include "sm_ams.h" #include "sm_utils.hpp" namespace ams::sm { diff --git a/source/sm/sm_manager_api.cpp b/source/sm/sm_manager_api.cpp index e00977f2..374428c4 100644 --- a/source/sm/sm_manager_api.cpp +++ b/source/sm/sm_manager_api.cpp @@ -13,14 +13,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include -#include -#include -#include - -#include "smm_ams.h" #include "sm_utils.hpp" +#include "smm_ams.h" namespace ams::sm::manager { diff --git a/source/sm/sm_mitm_api.cpp b/source/sm/sm_mitm_api.cpp index 0f475b85..037cb6b3 100644 --- a/source/sm/sm_mitm_api.cpp +++ b/source/sm/sm_mitm_api.cpp @@ -13,12 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include -#include -#include - -#include "sm_ams.h" #include "sm_utils.hpp" namespace ams::sm::mitm { diff --git a/source/sm/sm_utils.cpp b/source/sm/sm_utils.cpp index 4f553faa..5c920b00 100644 --- a/source/sm/sm_utils.cpp +++ b/source/sm/sm_utils.cpp @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #include "sm_utils.hpp" namespace ams::sm::impl { diff --git a/source/sm/sm_utils.hpp b/source/sm/sm_utils.hpp index 5a15bf6c..3b1804f0 100644 --- a/source/sm/sm_utils.hpp +++ b/source/sm/sm_utils.hpp @@ -15,11 +15,7 @@ */ #pragma once - -#include #include -#include - #include "sm_ams.h" namespace ams::sm::impl { diff --git a/source/spl/smc/spl_smc.cpp b/source/spl/smc/spl_smc.cpp index b8692755..50aac6f0 100644 --- a/source/spl/smc/spl_smc.cpp +++ b/source/spl/smc/spl_smc.cpp @@ -13,10 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include #include -#include namespace ams::spl::smc { diff --git a/source/spl/spl_api.cpp b/source/spl/spl_api.cpp index a9bc8f1f..6edd72f0 100644 --- a/source/spl/spl_api.cpp +++ b/source/spl/spl_api.cpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #include -#include namespace ams::spl { diff --git a/source/updater/updater_bis_management.cpp b/source/updater/updater_bis_management.cpp index 879810d9..29a34b48 100644 --- a/source/updater/updater_bis_management.cpp +++ b/source/updater/updater_bis_management.cpp @@ -13,10 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include -#include - #include "updater_bis_management.hpp" namespace ams::updater { diff --git a/source/updater/updater_bis_management.hpp b/source/updater/updater_bis_management.hpp index df7c1a85..73ae1e7d 100644 --- a/source/updater/updater_bis_management.hpp +++ b/source/updater/updater_bis_management.hpp @@ -15,9 +15,7 @@ */ #pragma once -#include #include -#include namespace ams::updater { diff --git a/source/updater/updater_bis_save.cpp b/source/updater/updater_bis_save.cpp index 6b0c1133..fba42267 100644 --- a/source/updater/updater_bis_save.cpp +++ b/source/updater/updater_bis_save.cpp @@ -13,10 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include -#include - #include "updater_bis_save.hpp" namespace ams::updater { diff --git a/source/updater/updater_bis_save.hpp b/source/updater/updater_bis_save.hpp index a3b0ecbc..8f3dea2c 100644 --- a/source/updater/updater_bis_save.hpp +++ b/source/updater/updater_bis_save.hpp @@ -15,10 +15,6 @@ */ #pragma once -#include -#include -#include - #include "updater_bis_management.hpp" namespace ams::updater { diff --git a/source/updater/updater_files.cpp b/source/updater/updater_files.cpp index 0c172d2c..0ddab965 100644 --- a/source/updater/updater_files.cpp +++ b/source/updater/updater_files.cpp @@ -13,10 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include -#include - #include "updater_files.hpp" namespace ams::updater { diff --git a/source/updater/updater_files.hpp b/source/updater/updater_files.hpp index 369d4c09..d1c58451 100644 --- a/source/updater/updater_files.hpp +++ b/source/updater/updater_files.hpp @@ -13,11 +13,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include -#include namespace ams::updater { diff --git a/source/updater/updater_paths.cpp b/source/updater/updater_paths.cpp index 355708c8..8c659a11 100644 --- a/source/updater/updater_paths.cpp +++ b/source/updater/updater_paths.cpp @@ -13,11 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include -#include #include - #include "updater_paths.hpp" namespace ams::updater { diff --git a/source/updater/updater_paths.hpp b/source/updater/updater_paths.hpp index 8a573921..a7a0e594 100644 --- a/source/updater/updater_paths.hpp +++ b/source/updater/updater_paths.hpp @@ -13,11 +13,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include -#include namespace ams::updater { diff --git a/source/util/util_compression.cpp b/source/util/util_compression.cpp index 54199f27..68748443 100644 --- a/source/util/util_compression.cpp +++ b/source/util/util_compression.cpp @@ -13,11 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include #include -#include - #include "lz4.h" namespace ams::util { diff --git a/source/util/util_ini.cpp b/source/util/util_ini.cpp index 00640540..aac3c20b 100644 --- a/source/util/util_ini.cpp +++ b/source/util/util_ini.cpp @@ -14,10 +14,7 @@ * along with this program. If not, see . */ -#include #include -#include - #include "ini.h" namespace ams::util::ini {