diff --git a/common/include/atmosphere/version.h b/common/include/atmosphere/version.h index c47cb77..c61e87e 100644 --- a/common/include/atmosphere/version.h +++ b/common/include/atmosphere/version.h @@ -23,6 +23,6 @@ #define ATMOSPHERE_SUPPORTED_HOS_VERSION_MAJOR 9 #define ATMOSPHERE_SUPPORTED_HOS_VERSION_MINOR 0 -#define ATMOSPHERE_SUPPORTED_HOS_VERSION_MICRO 0 +#define ATMOSPHERE_SUPPORTED_HOS_VERSION_MICRO 1 #endif \ No newline at end of file diff --git a/stratosphere/boot/source/boot_battery_driver.cpp b/stratosphere/boot/source/boot_battery_driver.cpp index 6c88101..5404e58 100644 --- a/stratosphere/boot/source/boot_battery_driver.cpp +++ b/stratosphere/boot/source/boot_battery_driver.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 "boot_battery_driver.hpp" #include "boot_calibration.hpp" #include "boot_i2c_utils.hpp" diff --git a/stratosphere/boot/source/boot_battery_driver.hpp b/stratosphere/boot/source/boot_battery_driver.hpp index 58e8902..e16b37f 100644 --- a/stratosphere/boot/source/boot_battery_driver.hpp +++ b/stratosphere/boot/source/boot_battery_driver.hpp @@ -13,11 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include -#include - #include "i2c/driver/i2c_api.hpp" namespace ams::boot { diff --git a/stratosphere/boot/source/boot_battery_icons.cpp b/stratosphere/boot/source/boot_battery_icons.cpp index d4cc6d5..64a9068 100644 --- a/stratosphere/boot/source/boot_battery_icons.cpp +++ b/stratosphere/boot/source/boot_battery_icons.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 "boot_battery_icons.hpp" #include "boot_display.hpp" diff --git a/stratosphere/boot/source/boot_battery_icons.hpp b/stratosphere/boot/source/boot_battery_icons.hpp index ca5254b..12e23fe 100644 --- a/stratosphere/boot/source/boot_battery_icons.hpp +++ b/stratosphere/boot/source/boot_battery_icons.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::boot { diff --git a/stratosphere/boot/source/boot_boot_reason.cpp b/stratosphere/boot/source/boot_boot_reason.cpp index 3aac96e..41ac67d 100644 --- a/stratosphere/boot/source/boot_boot_reason.cpp +++ b/stratosphere/boot/source/boot_boot_reason.cpp @@ -13,9 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include - #include "boot_boot_reason.hpp" #include "boot_pmic_driver.hpp" #include "boot_rtc_driver.hpp" diff --git a/stratosphere/boot/source/boot_boot_reason.hpp b/stratosphere/boot/source/boot_boot_reason.hpp index 476eb14..016dac6 100644 --- a/stratosphere/boot/source/boot_boot_reason.hpp +++ b/stratosphere/boot/source/boot_boot_reason.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::boot { diff --git a/stratosphere/boot/source/boot_bq24193_charger.hpp b/stratosphere/boot/source/boot_bq24193_charger.hpp index c5fd7ba..f209134 100644 --- a/stratosphere/boot/source/boot_bq24193_charger.hpp +++ b/stratosphere/boot/source/boot_bq24193_charger.hpp @@ -13,6 +13,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#pragma once +#include namespace ams::boot::bq24193 { diff --git a/stratosphere/boot/source/boot_calibration.cpp b/stratosphere/boot/source/boot_calibration.cpp index 839001e..b6e1068 100644 --- a/stratosphere/boot/source/boot_calibration.cpp +++ b/stratosphere/boot/source/boot_calibration.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 "boot_calibration.hpp" namespace ams::boot { diff --git a/stratosphere/boot/source/boot_calibration.hpp b/stratosphere/boot/source/boot_calibration.hpp index 0b53fd0..21805c1 100644 --- a/stratosphere/boot/source/boot_calibration.hpp +++ b/stratosphere/boot/source/boot_calibration.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::boot { diff --git a/stratosphere/boot/source/boot_change_voltage.cpp b/stratosphere/boot/source/boot_change_voltage.cpp index 553c234..f7245e5 100644 --- a/stratosphere/boot/source/boot_change_voltage.cpp +++ b/stratosphere/boot/source/boot_change_voltage.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 "boot_change_voltage.hpp" #include "boot_pmc_wrapper.hpp" diff --git a/stratosphere/boot/source/boot_change_voltage.hpp b/stratosphere/boot/source/boot_change_voltage.hpp index c5c6a1f..dad0bde 100644 --- a/stratosphere/boot/source/boot_change_voltage.hpp +++ b/stratosphere/boot/source/boot_change_voltage.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::boot { diff --git a/stratosphere/boot/source/boot_charger_driver.cpp b/stratosphere/boot/source/boot_charger_driver.cpp index 402fe0a..26cd425 100644 --- a/stratosphere/boot/source/boot_charger_driver.cpp +++ b/stratosphere/boot/source/boot_charger_driver.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 "boot_charger_driver.hpp" namespace ams::boot { diff --git a/stratosphere/boot/source/boot_charger_driver.hpp b/stratosphere/boot/source/boot_charger_driver.hpp index d770ce0..a6cf824 100644 --- a/stratosphere/boot/source/boot_charger_driver.hpp +++ b/stratosphere/boot/source/boot_charger_driver.hpp @@ -13,11 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include -#include - #include "boot_bq24193_charger.hpp" #include "boot_i2c_utils.hpp" diff --git a/stratosphere/boot/source/boot_check_battery.cpp b/stratosphere/boot/source/boot_check_battery.cpp index e47c37a..12691df 100644 --- a/stratosphere/boot/source/boot_check_battery.cpp +++ b/stratosphere/boot/source/boot_check_battery.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 "boot_battery_driver.hpp" #include "boot_battery_icons.hpp" #include "boot_boot_reason.hpp" diff --git a/stratosphere/boot/source/boot_check_battery.hpp b/stratosphere/boot/source/boot_check_battery.hpp index 63be38e..32cc5da 100644 --- a/stratosphere/boot/source/boot_check_battery.hpp +++ b/stratosphere/boot/source/boot_check_battery.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::boot { diff --git a/stratosphere/boot/source/boot_check_clock.cpp b/stratosphere/boot/source/boot_check_clock.cpp index f5f5365..b807962 100644 --- a/stratosphere/boot/source/boot_check_clock.cpp +++ b/stratosphere/boot/source/boot_check_clock.cpp @@ -13,8 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include #include "boot_check_clock.hpp" #include "boot_power_utils.hpp" diff --git a/stratosphere/boot/source/boot_check_clock.hpp b/stratosphere/boot/source/boot_check_clock.hpp index 5fea378..fe3516a 100644 --- a/stratosphere/boot/source/boot_check_clock.hpp +++ b/stratosphere/boot/source/boot_check_clock.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::boot { diff --git a/stratosphere/boot/source/boot_clock_initial_configuration.cpp b/stratosphere/boot/source/boot_clock_initial_configuration.cpp index 043e4f2..d171b45 100644 --- a/stratosphere/boot/source/boot_clock_initial_configuration.cpp +++ b/stratosphere/boot/source/boot_clock_initial_configuration.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 "boot_clock_initial_configuration.hpp" #include "boot_pmc_wrapper.hpp" #include "boot_registers_pmc.hpp" diff --git a/stratosphere/boot/source/boot_clock_initial_configuration.hpp b/stratosphere/boot/source/boot_clock_initial_configuration.hpp index 660d6c1..a1f87ac 100644 --- a/stratosphere/boot/source/boot_clock_initial_configuration.hpp +++ b/stratosphere/boot/source/boot_clock_initial_configuration.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::boot { diff --git a/stratosphere/boot/source/boot_display.cpp b/stratosphere/boot/source/boot_display.cpp index 8418f3a..8b3f472 100644 --- a/stratosphere/boot/source/boot_display.cpp +++ b/stratosphere/boot/source/boot_display.cpp @@ -13,11 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - - -#include -#include - #include "boot_display.hpp" #include "boot_i2c_utils.hpp" #include "boot_pmc_wrapper.hpp" diff --git a/stratosphere/boot/source/boot_display.hpp b/stratosphere/boot/source/boot_display.hpp index a01450a..6da8bfa 100644 --- a/stratosphere/boot/source/boot_display.hpp +++ b/stratosphere/boot/source/boot_display.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::boot { diff --git a/stratosphere/boot/source/boot_fan_enable.cpp b/stratosphere/boot/source/boot_fan_enable.cpp index 0fd2b38..f1a9613 100644 --- a/stratosphere/boot/source/boot_fan_enable.cpp +++ b/stratosphere/boot/source/boot_fan_enable.cpp @@ -13,9 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include - #include "boot_fan_enable.hpp" #include "gpio/gpio_utils.hpp" diff --git a/stratosphere/boot/source/boot_fan_enable.hpp b/stratosphere/boot/source/boot_fan_enable.hpp index 05dc983..1610c8c 100644 --- a/stratosphere/boot/source/boot_fan_enable.hpp +++ b/stratosphere/boot/source/boot_fan_enable.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::boot { diff --git a/stratosphere/boot/source/boot_i2c_utils.cpp b/stratosphere/boot/source/boot_i2c_utils.cpp index a7adaee..e395f86 100644 --- a/stratosphere/boot/source/boot_i2c_utils.cpp +++ b/stratosphere/boot/source/boot_i2c_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 "boot_i2c_utils.hpp" namespace ams::boot { diff --git a/stratosphere/boot/source/boot_i2c_utils.hpp b/stratosphere/boot/source/boot_i2c_utils.hpp index 6f617e9..12f2cf6 100644 --- a/stratosphere/boot/source/boot_i2c_utils.hpp +++ b/stratosphere/boot/source/boot_i2c_utils.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include #include "i2c/driver/i2c_api.hpp" diff --git a/stratosphere/boot/source/boot_main.cpp b/stratosphere/boot/source/boot_main.cpp index 125b7cd..4d0505b 100644 --- a/stratosphere/boot/source/boot_main.cpp +++ b/stratosphere/boot/source/boot_main.cpp @@ -13,17 +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 - -#include -#include -#include -#include - #include "boot_boot_reason.hpp" #include "boot_change_voltage.hpp" #include "boot_check_battery.hpp" diff --git a/stratosphere/boot/source/boot_pcv.cpp b/stratosphere/boot/source/boot_pcv.cpp index fa9380a..50a912a 100644 --- a/stratosphere/boot/source/boot_pcv.cpp +++ b/stratosphere/boot/source/boot_pcv.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 "i2c/i2c_types.hpp" #include "i2c/driver/impl/i2c_pcv.hpp" #include "i2c/driver/impl/i2c_registers.hpp" diff --git a/stratosphere/boot/source/boot_pmc_wrapper.cpp b/stratosphere/boot/source/boot_pmc_wrapper.cpp index 4b3058d..2f1745a 100644 --- a/stratosphere/boot/source/boot_pmc_wrapper.cpp +++ b/stratosphere/boot/source/boot_pmc_wrapper.cpp @@ -13,8 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include -#include #include "boot_pmc_wrapper.hpp" namespace ams::boot { diff --git a/stratosphere/boot/source/boot_pmc_wrapper.hpp b/stratosphere/boot/source/boot_pmc_wrapper.hpp index 8d25622..5a5953d 100644 --- a/stratosphere/boot/source/boot_pmc_wrapper.hpp +++ b/stratosphere/boot/source/boot_pmc_wrapper.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::boot { diff --git a/stratosphere/boot/source/boot_pmic_driver.cpp b/stratosphere/boot/source/boot_pmic_driver.cpp index afa098d..bf14111 100644 --- a/stratosphere/boot/source/boot_pmic_driver.cpp +++ b/stratosphere/boot/source/boot_pmic_driver.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 "boot_i2c_utils.hpp" #include "boot_pmic_driver.hpp" diff --git a/stratosphere/boot/source/boot_pmic_driver.hpp b/stratosphere/boot/source/boot_pmic_driver.hpp index 8ff07e8..06d7610 100644 --- a/stratosphere/boot/source/boot_pmic_driver.hpp +++ b/stratosphere/boot/source/boot_pmic_driver.hpp @@ -13,11 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include -#include - #include "boot_battery_driver.hpp" namespace ams::boot { diff --git a/stratosphere/boot/source/boot_power_utils.cpp b/stratosphere/boot/source/boot_power_utils.cpp index dfa9074..7fd38c3 100644 --- a/stratosphere/boot/source/boot_power_utils.cpp +++ b/stratosphere/boot/source/boot_power_utils.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 - +#pragma once #include "boot_power_utils.hpp" #include "fusee-primary_bin.h" diff --git a/stratosphere/boot/source/boot_power_utils.hpp b/stratosphere/boot/source/boot_power_utils.hpp index 31a59b8..a53ea3a 100644 --- a/stratosphere/boot/source/boot_power_utils.hpp +++ b/stratosphere/boot/source/boot_power_utils.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::boot { diff --git a/stratosphere/boot/source/boot_registers_clkrst.hpp b/stratosphere/boot/source/boot_registers_clkrst.hpp index daebdc7..7185757 100644 --- a/stratosphere/boot/source/boot_registers_clkrst.hpp +++ b/stratosphere/boot/source/boot_registers_clkrst.hpp @@ -13,9 +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 static constexpr size_t CLK_RST_CONTROLLER_RST_SOURCE = 0x0; static constexpr size_t CLK_RST_CONTROLLER_RST_DEVICES_L = 0x4; diff --git a/stratosphere/boot/source/boot_registers_di.hpp b/stratosphere/boot/source/boot_registers_di.hpp index 3b5a13b..aa8dd1d 100644 --- a/stratosphere/boot/source/boot_registers_di.hpp +++ b/stratosphere/boot/source/boot_registers_di.hpp @@ -15,9 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include +#include #define DC_CMD_GENERAL_INCR_SYNCPT 0x00 diff --git a/stratosphere/boot/source/boot_registers_gpio.hpp b/stratosphere/boot/source/boot_registers_gpio.hpp index c9ce383..594d86a 100644 --- a/stratosphere/boot/source/boot_registers_gpio.hpp +++ b/stratosphere/boot/source/boot_registers_gpio.hpp @@ -13,9 +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 static constexpr size_t GPIO_PORT3_CNF_0 = 0x200; static constexpr size_t GPIO_PORT3_OE_0 = 0x210; diff --git a/stratosphere/boot/source/boot_registers_pinmux.hpp b/stratosphere/boot/source/boot_registers_pinmux.hpp index 322195c..df83cf2 100644 --- a/stratosphere/boot/source/boot_registers_pinmux.hpp +++ b/stratosphere/boot/source/boot_registers_pinmux.hpp @@ -13,9 +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 static constexpr size_t APB_MISC_GP_SDMMC1_CLK_LPBK_CONTROL = 0x8D4; static constexpr size_t APB_MISC_GP_SDMMC3_CLK_LPBK_CONTROL = 0x8D8; diff --git a/stratosphere/boot/source/boot_registers_pmc.hpp b/stratosphere/boot/source/boot_registers_pmc.hpp index e95acc1..86ab915 100644 --- a/stratosphere/boot/source/boot_registers_pmc.hpp +++ b/stratosphere/boot/source/boot_registers_pmc.hpp @@ -13,9 +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 static constexpr uintptr_t PmcBase = 0x7000E400ul; diff --git a/stratosphere/boot/source/boot_repair_boot_images.cpp b/stratosphere/boot/source/boot_repair_boot_images.cpp index 5323910..95bf67f 100644 --- a/stratosphere/boot/source/boot_repair_boot_images.cpp +++ b/stratosphere/boot/source/boot_repair_boot_images.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 "boot_power_utils.hpp" #include "boot_repair_boot_images.hpp" diff --git a/stratosphere/boot/source/boot_repair_boot_images.hpp b/stratosphere/boot/source/boot_repair_boot_images.hpp index 7b53ed2..3a973e1 100644 --- a/stratosphere/boot/source/boot_repair_boot_images.hpp +++ b/stratosphere/boot/source/boot_repair_boot_images.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::boot { diff --git a/stratosphere/boot/source/boot_rtc_driver.cpp b/stratosphere/boot/source/boot_rtc_driver.cpp index 932a701..d5c4bd2 100644 --- a/stratosphere/boot/source/boot_rtc_driver.cpp +++ b/stratosphere/boot/source/boot_rtc_driver.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 "boot_rtc_driver.hpp" namespace ams::boot { diff --git a/stratosphere/boot/source/boot_rtc_driver.hpp b/stratosphere/boot/source/boot_rtc_driver.hpp index 740a49e..1a9bb45 100644 --- a/stratosphere/boot/source/boot_rtc_driver.hpp +++ b/stratosphere/boot/source/boot_rtc_driver.hpp @@ -13,11 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include -#include - #include "boot_i2c_utils.hpp" namespace ams::boot { diff --git a/stratosphere/boot/source/boot_splash_screen.cpp b/stratosphere/boot/source/boot_splash_screen.cpp index 786b74d..4710f0e 100644 --- a/stratosphere/boot/source/boot_splash_screen.cpp +++ b/stratosphere/boot/source/boot_splash_screen.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 "boot_boot_reason.hpp" #include "boot_display.hpp" #include "boot_splash_screen.hpp" diff --git a/stratosphere/boot/source/boot_splash_screen.hpp b/stratosphere/boot/source/boot_splash_screen.hpp index a357141..aae5379 100644 --- a/stratosphere/boot/source/boot_splash_screen.hpp +++ b/stratosphere/boot/source/boot_splash_screen.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::boot { diff --git a/stratosphere/boot/source/boot_wake_pins.cpp b/stratosphere/boot/source/boot_wake_pins.cpp index f4cebbd..9525367 100644 --- a/stratosphere/boot/source/boot_wake_pins.cpp +++ b/stratosphere/boot/source/boot_wake_pins.cpp @@ -13,9 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include - #include "boot_pmc_wrapper.hpp" #include "boot_wake_pins.hpp" diff --git a/stratosphere/boot/source/boot_wake_pins.hpp b/stratosphere/boot/source/boot_wake_pins.hpp index 92e7b72..e771b51 100644 --- a/stratosphere/boot/source/boot_wake_pins.hpp +++ b/stratosphere/boot/source/boot_wake_pins.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::boot { diff --git a/stratosphere/boot/source/i2c/driver/i2c_api.cpp b/stratosphere/boot/source/i2c/driver/i2c_api.cpp index 74b7321..2261a62 100644 --- a/stratosphere/boot/source/i2c/driver/i2c_api.cpp +++ b/stratosphere/boot/source/i2c/driver/i2c_api.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 "i2c_api.hpp" #include "impl/i2c_resource_manager.hpp" diff --git a/stratosphere/boot/source/i2c/driver/i2c_api.hpp b/stratosphere/boot/source/i2c/driver/i2c_api.hpp index 2b8e1dd..1449f72 100644 --- a/stratosphere/boot/source/i2c/driver/i2c_api.hpp +++ b/stratosphere/boot/source/i2c/driver/i2c_api.hpp @@ -13,11 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include -#include - #include "../i2c_types.hpp" #include "../i2c_command_list.hpp" diff --git a/stratosphere/boot/source/i2c/driver/impl/i2c_bus_accessor.cpp b/stratosphere/boot/source/i2c/driver/impl/i2c_bus_accessor.cpp index 2b590ab..6bf8e94 100644 --- a/stratosphere/boot/source/i2c/driver/impl/i2c_bus_accessor.cpp +++ b/stratosphere/boot/source/i2c/driver/impl/i2c_bus_accessor.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 "i2c_pcv.hpp" #include "i2c_bus_accessor.hpp" diff --git a/stratosphere/boot/source/i2c/driver/impl/i2c_bus_accessor.hpp b/stratosphere/boot/source/i2c/driver/impl/i2c_bus_accessor.hpp index 3595867..8a23a74 100644 --- a/stratosphere/boot/source/i2c/driver/impl/i2c_bus_accessor.hpp +++ b/stratosphere/boot/source/i2c/driver/impl/i2c_bus_accessor.hpp @@ -13,11 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include -#include - #include "i2c_driver_types.hpp" #include "i2c_registers.hpp" diff --git a/stratosphere/boot/source/i2c/driver/impl/i2c_device_config.cpp b/stratosphere/boot/source/i2c/driver/impl/i2c_device_config.cpp index 584a00c..8759c40 100644 --- a/stratosphere/boot/source/i2c/driver/impl/i2c_device_config.cpp +++ b/stratosphere/boot/source/i2c/driver/impl/i2c_device_config.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 "i2c_driver_types.hpp" namespace ams::i2c::driver::impl { diff --git a/stratosphere/boot/source/i2c/driver/impl/i2c_driver_types.hpp b/stratosphere/boot/source/i2c/driver/impl/i2c_driver_types.hpp index c80695f..12441af 100644 --- a/stratosphere/boot/source/i2c/driver/impl/i2c_driver_types.hpp +++ b/stratosphere/boot/source/i2c/driver/impl/i2c_driver_types.hpp @@ -13,11 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include -#include - #include "../../i2c_types.hpp" namespace ams::i2c::driver::impl { diff --git a/stratosphere/boot/source/i2c/driver/impl/i2c_pcv.hpp b/stratosphere/boot/source/i2c/driver/impl/i2c_pcv.hpp index fc0db11..8143afc 100644 --- a/stratosphere/boot/source/i2c/driver/impl/i2c_pcv.hpp +++ b/stratosphere/boot/source/i2c/driver/impl/i2c_pcv.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include /* This forward declares the functionality from pcv that i2c::driver uses. */ diff --git a/stratosphere/boot/source/i2c/driver/impl/i2c_registers.hpp b/stratosphere/boot/source/i2c/driver/impl/i2c_registers.hpp index 255e48b..c699cd9 100644 --- a/stratosphere/boot/source/i2c/driver/impl/i2c_registers.hpp +++ b/stratosphere/boot/source/i2c/driver/impl/i2c_registers.hpp @@ -13,12 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include -#include -#include - #include "i2c_driver_types.hpp" namespace ams::i2c::driver::impl { diff --git a/stratosphere/boot/source/i2c/driver/impl/i2c_resource_manager.cpp b/stratosphere/boot/source/i2c/driver/impl/i2c_resource_manager.cpp index 0364892..70f7ca7 100644 --- a/stratosphere/boot/source/i2c/driver/impl/i2c_resource_manager.cpp +++ b/stratosphere/boot/source/i2c/driver/impl/i2c_resource_manager.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 "i2c_pcv.hpp" #include "i2c_resource_manager.hpp" diff --git a/stratosphere/boot/source/i2c/driver/impl/i2c_resource_manager.hpp b/stratosphere/boot/source/i2c/driver/impl/i2c_resource_manager.hpp index ba811009..a419766 100644 --- a/stratosphere/boot/source/i2c/driver/impl/i2c_resource_manager.hpp +++ b/stratosphere/boot/source/i2c/driver/impl/i2c_resource_manager.hpp @@ -13,11 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include -#include - #include "../i2c_api.hpp" #include "i2c_driver_types.hpp" #include "i2c_bus_accessor.hpp" diff --git a/stratosphere/boot/source/i2c/driver/impl/i2c_session.cpp b/stratosphere/boot/source/i2c/driver/impl/i2c_session.cpp index f0e1941..1ef4a4a 100644 --- a/stratosphere/boot/source/i2c/driver/impl/i2c_session.cpp +++ b/stratosphere/boot/source/i2c/driver/impl/i2c_session.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 "i2c_session.hpp" namespace ams::i2c::driver::impl { diff --git a/stratosphere/boot/source/i2c/driver/impl/i2c_session.hpp b/stratosphere/boot/source/i2c/driver/impl/i2c_session.hpp index 49e58ad..9ba64c9 100644 --- a/stratosphere/boot/source/i2c/driver/impl/i2c_session.hpp +++ b/stratosphere/boot/source/i2c/driver/impl/i2c_session.hpp @@ -13,11 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include -#include - #include "i2c_driver_types.hpp" #include "i2c_bus_accessor.hpp" diff --git a/stratosphere/boot/source/i2c/i2c_command_list.cpp b/stratosphere/boot/source/i2c/i2c_command_list.cpp index 16a874c..044ec79 100644 --- a/stratosphere/boot/source/i2c/i2c_command_list.cpp +++ b/stratosphere/boot/source/i2c/i2c_command_list.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 "i2c_types.hpp" #include "i2c_command_list.hpp" diff --git a/stratosphere/boot/source/i2c/i2c_command_list.hpp b/stratosphere/boot/source/i2c/i2c_command_list.hpp index de1c475..6872206 100644 --- a/stratosphere/boot/source/i2c/i2c_command_list.hpp +++ b/stratosphere/boot/source/i2c/i2c_command_list.hpp @@ -13,11 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include -#include - #include "i2c_types.hpp" namespace ams::i2c { diff --git a/stratosphere/boot/source/i2c/i2c_types.hpp b/stratosphere/boot/source/i2c/i2c_types.hpp index a64f8b4..d03c3f8 100644 --- a/stratosphere/boot/source/i2c/i2c_types.hpp +++ b/stratosphere/boot/source/i2c/i2c_types.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::i2c { diff --git a/stratosphere/boot/source/pinmux/pinmux_initial_configuration.cpp b/stratosphere/boot/source/pinmux/pinmux_initial_configuration.cpp index 13a1550..462e69f 100644 --- a/stratosphere/boot/source/pinmux/pinmux_initial_configuration.cpp +++ b/stratosphere/boot/source/pinmux/pinmux_initial_configuration.cpp @@ -13,9 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include - #include "pinmux_initial_configuration.hpp" #include "pinmux_utils.hpp" diff --git a/stratosphere/boot/source/pinmux/pinmux_initial_configuration.hpp b/stratosphere/boot/source/pinmux/pinmux_initial_configuration.hpp index 814d02f..239f5bd 100644 --- a/stratosphere/boot/source/pinmux/pinmux_initial_configuration.hpp +++ b/stratosphere/boot/source/pinmux/pinmux_initial_configuration.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::pinmux { diff --git a/stratosphere/boot/source/pinmux/pinmux_utils.cpp b/stratosphere/boot/source/pinmux/pinmux_utils.cpp index d140bf5..39404df 100644 --- a/stratosphere/boot/source/pinmux/pinmux_utils.cpp +++ b/stratosphere/boot/source/pinmux/pinmux_utils.cpp @@ -13,9 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include - #include "pinmux_utils.hpp" namespace ams::pinmux { diff --git a/stratosphere/boot/source/pinmux/pinmux_utils.hpp b/stratosphere/boot/source/pinmux/pinmux_utils.hpp index 9f0eac9..6e12d4f 100644 --- a/stratosphere/boot/source/pinmux/pinmux_utils.hpp +++ b/stratosphere/boot/source/pinmux/pinmux_utils.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::pinmux { diff --git a/stratosphere/boot2/source/boot2_main.cpp b/stratosphere/boot2/source/boot2_main.cpp index f4b6748..481aca8 100644 --- a/stratosphere/boot2/source/boot2_main.cpp +++ b/stratosphere/boot2/source/boot2_main.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 extern "C" { extern u32 __start__; diff --git a/stratosphere/creport/source/creport_crash_report.cpp b/stratosphere/creport/source/creport_crash_report.cpp index e65f61f..0314ecb 100644 --- a/stratosphere/creport/source/creport_crash_report.cpp +++ b/stratosphere/creport/source/creport_crash_report.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 "creport_crash_report.hpp" #include "creport_utils.hpp" diff --git a/stratosphere/creport/source/creport_crash_report.hpp b/stratosphere/creport/source/creport_crash_report.hpp index 42ad932..03f13bc 100644 --- a/stratosphere/creport/source/creport_crash_report.hpp +++ b/stratosphere/creport/source/creport_crash_report.hpp @@ -13,12 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include -#include -#include - #include "creport_threads.hpp" #include "creport_modules.hpp" diff --git a/stratosphere/creport/source/creport_main.cpp b/stratosphere/creport/source/creport_main.cpp index 7f902ac..1f87dfc 100644 --- a/stratosphere/creport/source/creport_main.cpp +++ b/stratosphere/creport/source/creport_main.cpp @@ -13,14 +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 - -#include -#include #include "creport_crash_report.hpp" #include "creport_utils.hpp" diff --git a/stratosphere/creport/source/creport_modules.cpp b/stratosphere/creport/source/creport_modules.cpp index 3e3665f..6997c86 100644 --- a/stratosphere/creport/source/creport_modules.cpp +++ b/stratosphere/creport/source/creport_modules.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 "creport_modules.hpp" #include "creport_utils.hpp" diff --git a/stratosphere/creport/source/creport_modules.hpp b/stratosphere/creport/source/creport_modules.hpp index 9a6ff9f..e5c0fb1 100644 --- a/stratosphere/creport/source/creport_modules.hpp +++ b/stratosphere/creport/source/creport_modules.hpp @@ -13,10 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include -#include #include "creport_threads.hpp" namespace ams::creport { diff --git a/stratosphere/creport/source/creport_threads.cpp b/stratosphere/creport/source/creport_threads.cpp index 2570de5..0fb39a6 100644 --- a/stratosphere/creport/source/creport_threads.cpp +++ b/stratosphere/creport/source/creport_threads.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 "creport_threads.hpp" #include "creport_modules.hpp" diff --git a/stratosphere/creport/source/creport_threads.hpp b/stratosphere/creport/source/creport_threads.hpp index 9170090..ae87f4e 100644 --- a/stratosphere/creport/source/creport_threads.hpp +++ b/stratosphere/creport/source/creport_threads.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::creport { diff --git a/stratosphere/creport/source/creport_utils.cpp b/stratosphere/creport/source/creport_utils.cpp index ed0ea68..ad5191f 100644 --- a/stratosphere/creport/source/creport_utils.cpp +++ b/stratosphere/creport/source/creport_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 "creport_utils.hpp" namespace ams::creport { diff --git a/stratosphere/creport/source/creport_utils.hpp b/stratosphere/creport/source/creport_utils.hpp index b675972..512bae3 100644 --- a/stratosphere/creport/source/creport_utils.hpp +++ b/stratosphere/creport/source/creport_utils.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::creport { diff --git a/stratosphere/dmnt/source/cheat/dmnt_cheat_service.cpp b/stratosphere/dmnt/source/cheat/dmnt_cheat_service.cpp index 2de80e3..c51033c 100644 --- a/stratosphere/dmnt/source/cheat/dmnt_cheat_service.cpp +++ b/stratosphere/dmnt/source/cheat/dmnt_cheat_service.cpp @@ -13,8 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include #include "dmnt_cheat_service.hpp" #include "impl/dmnt_cheat_api.hpp" diff --git a/stratosphere/dmnt/source/cheat/dmnt_cheat_service.hpp b/stratosphere/dmnt/source/cheat/dmnt_cheat_service.hpp index 18f969d..a453bfb 100644 --- a/stratosphere/dmnt/source/cheat/dmnt_cheat_service.hpp +++ b/stratosphere/dmnt/source/cheat/dmnt_cheat_service.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::dmnt::cheat { diff --git a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp index fc188cd..dea8462 100644 --- a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp +++ b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp @@ -13,12 +13,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include #include "dmnt_cheat_api.hpp" #include "dmnt_cheat_vm.hpp" #include "dmnt_cheat_debug_events_manager.hpp" -#include namespace ams::dmnt::cheat::impl { diff --git a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.hpp b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.hpp index 1fdc447..bab10a8 100644 --- a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.hpp +++ b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.hpp @@ -13,10 +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 namespace ams::dmnt::cheat::impl { diff --git a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_debug_events_manager.cpp b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_debug_events_manager.cpp index 6967949..5c1d3b9 100644 --- a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_debug_events_manager.cpp +++ b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_debug_events_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 "dmnt_cheat_debug_events_manager.hpp" /* WORKAROUND: This design prevents a kernel deadlock from occurring on 6.0.0+ */ diff --git a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_debug_events_manager.hpp b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_debug_events_manager.hpp index 145dd23..b0f57d7 100644 --- a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_debug_events_manager.hpp +++ b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_debug_events_manager.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::dmnt::cheat::impl { diff --git a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_vm.cpp b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_vm.cpp index d718f65..10be699 100644 --- a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_vm.cpp +++ b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_vm.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 "dmnt_cheat_vm.hpp" #include "dmnt_cheat_api.hpp" diff --git a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_vm.hpp b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_vm.hpp index 2f4d24a..0e44783 100644 --- a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_vm.hpp +++ b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_vm.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::dmnt::cheat::impl { diff --git a/stratosphere/dmnt/source/dmnt_main.cpp b/stratosphere/dmnt/source/dmnt_main.cpp index 74f38bf..41e6c14 100644 --- a/stratosphere/dmnt/source/dmnt_main.cpp +++ b/stratosphere/dmnt/source/dmnt_main.cpp @@ -13,16 +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 - -#include -#include -#include - #include "dmnt_service.hpp" #include "cheat/dmnt_cheat_service.hpp" diff --git a/stratosphere/dmnt/source/dmnt_service.hpp b/stratosphere/dmnt/source/dmnt_service.hpp index b2ccf4c..62cc375 100644 --- a/stratosphere/dmnt/source/dmnt_service.hpp +++ b/stratosphere/dmnt/source/dmnt_service.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::dmnt { diff --git a/stratosphere/dmnt/source/dmnt_service_debug.cpp b/stratosphere/dmnt/source/dmnt_service_debug.cpp index 73220a6..4066dfa 100644 --- a/stratosphere/dmnt/source/dmnt_service_debug.cpp +++ b/stratosphere/dmnt/source/dmnt_service_debug.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 "dmnt_service.hpp" namespace ams::dmnt { diff --git a/stratosphere/dmnt/source/dmnt_service_target_io.cpp b/stratosphere/dmnt/source/dmnt_service_target_io.cpp index 49fc41c..39eff94 100644 --- a/stratosphere/dmnt/source/dmnt_service_target_io.cpp +++ b/stratosphere/dmnt/source/dmnt_service_target_io.cpp @@ -13,8 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include #include "dmnt_service.hpp" namespace std { diff --git a/stratosphere/eclct.stub/source/eclct_stub.cpp b/stratosphere/eclct.stub/source/eclct_stub.cpp index e62b5a3..31f4e2c 100644 --- a/stratosphere/eclct.stub/source/eclct_stub.cpp +++ b/stratosphere/eclct.stub/source/eclct_stub.cpp @@ -13,14 +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 - -#include -#include #include extern "C" { diff --git a/stratosphere/fatal/source/fatal_config.cpp b/stratosphere/fatal/source/fatal_config.cpp index a3247d5..4f7f84e 100644 --- a/stratosphere/fatal/source/fatal_config.cpp +++ b/stratosphere/fatal/source/fatal_config.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 "fatal_config.hpp" namespace ams::fatal::srv { diff --git a/stratosphere/fatal/source/fatal_config.hpp b/stratosphere/fatal/source/fatal_config.hpp index fa26459..2b0d2e8 100644 --- a/stratosphere/fatal/source/fatal_config.hpp +++ b/stratosphere/fatal/source/fatal_config.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::fatal::srv { diff --git a/stratosphere/fatal/source/fatal_debug.cpp b/stratosphere/fatal/source/fatal_debug.cpp index bc68154..edf23d6 100644 --- a/stratosphere/fatal/source/fatal_debug.cpp +++ b/stratosphere/fatal/source/fatal_debug.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 "fatal_debug.hpp" #include "fatal_config.hpp" diff --git a/stratosphere/fatal/source/fatal_debug.hpp b/stratosphere/fatal/source/fatal_debug.hpp index 1642eac..85457a2 100644 --- a/stratosphere/fatal/source/fatal_debug.hpp +++ b/stratosphere/fatal/source/fatal_debug.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::fatal::srv { diff --git a/stratosphere/fatal/source/fatal_event_manager.cpp b/stratosphere/fatal/source/fatal_event_manager.cpp index 90dcc6e..18574f2 100644 --- a/stratosphere/fatal/source/fatal_event_manager.cpp +++ b/stratosphere/fatal/source/fatal_event_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 "fatal_event_manager.hpp" namespace ams::fatal::srv { diff --git a/stratosphere/fatal/source/fatal_event_manager.hpp b/stratosphere/fatal/source/fatal_event_manager.hpp index d7d79f8..e93bec1 100644 --- a/stratosphere/fatal/source/fatal_event_manager.hpp +++ b/stratosphere/fatal/source/fatal_event_manager.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::fatal::srv { diff --git a/stratosphere/fatal/source/fatal_font.cpp b/stratosphere/fatal/source/fatal_font.cpp index 09feecb..572e49c 100644 --- a/stratosphere/fatal/source/fatal_font.cpp +++ b/stratosphere/fatal/source/fatal_font.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 FT_FREETYPE_H diff --git a/stratosphere/fatal/source/fatal_font.hpp b/stratosphere/fatal/source/fatal_font.hpp index 18c7f13..43f3d41 100644 --- a/stratosphere/fatal/source/fatal_font.hpp +++ b/stratosphere/fatal/source/fatal_font.hpp @@ -13,10 +13,7 @@ * 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::fatal::srv::font { diff --git a/stratosphere/fatal/source/fatal_main.cpp b/stratosphere/fatal/source/fatal_main.cpp index 1e6bb51..feb669f 100644 --- a/stratosphere/fatal/source/fatal_main.cpp +++ b/stratosphere/fatal/source/fatal_main.cpp @@ -13,15 +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 -#include -#include - #include "fatal_service.hpp" #include "fatal_config.hpp" #include "fatal_repair.hpp" diff --git a/stratosphere/fatal/source/fatal_repair.cpp b/stratosphere/fatal/source/fatal_repair.cpp index 6fde826..da309cf 100644 --- a/stratosphere/fatal/source/fatal_repair.cpp +++ b/stratosphere/fatal/source/fatal_repair.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 "fatal_repair.hpp" #include "fatal_service_for_self.hpp" diff --git a/stratosphere/fatal/source/fatal_repair.hpp b/stratosphere/fatal/source/fatal_repair.hpp index da72164..def54b6 100644 --- a/stratosphere/fatal/source/fatal_repair.hpp +++ b/stratosphere/fatal/source/fatal_repair.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::fatal::srv { diff --git a/stratosphere/fatal/source/fatal_service.cpp b/stratosphere/fatal/source/fatal_service.cpp index 646a34c..b706d96 100644 --- a/stratosphere/fatal/source/fatal_service.cpp +++ b/stratosphere/fatal/source/fatal_service.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 "fatal_config.hpp" #include "fatal_debug.hpp" #include "fatal_service.hpp" diff --git a/stratosphere/fatal/source/fatal_service.hpp b/stratosphere/fatal/source/fatal_service.hpp index 70eabf2..52f28fc 100644 --- a/stratosphere/fatal/source/fatal_service.hpp +++ b/stratosphere/fatal/source/fatal_service.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::fatal::srv { diff --git a/stratosphere/fatal/source/fatal_service_for_self.hpp b/stratosphere/fatal/source/fatal_service_for_self.hpp index d1c4bef..b80508b 100644 --- a/stratosphere/fatal/source/fatal_service_for_self.hpp +++ b/stratosphere/fatal/source/fatal_service_for_self.hpp @@ -13,9 +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 namespace ams::fatal::srv { diff --git a/stratosphere/fatal/source/fatal_task.cpp b/stratosphere/fatal/source/fatal_task.cpp index b8e77a7..e9b3bf0 100644 --- a/stratosphere/fatal/source/fatal_task.cpp +++ b/stratosphere/fatal/source/fatal_task.cpp @@ -13,9 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include - #include "fatal_task.hpp" #include "fatal_task_error_report.hpp" diff --git a/stratosphere/fatal/source/fatal_task.hpp b/stratosphere/fatal/source/fatal_task.hpp index 0ac774a..fa656f9 100644 --- a/stratosphere/fatal/source/fatal_task.hpp +++ b/stratosphere/fatal/source/fatal_task.hpp @@ -13,10 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include -#include #include "fatal_service.hpp" namespace ams::fatal::srv { diff --git a/stratosphere/fatal/source/fatal_task_clock.cpp b/stratosphere/fatal/source/fatal_task_clock.cpp index 418b291..51b8564 100644 --- a/stratosphere/fatal/source/fatal_task_clock.cpp +++ b/stratosphere/fatal/source/fatal_task_clock.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 "fatal_task_clock.hpp" namespace ams::fatal::srv { diff --git a/stratosphere/fatal/source/fatal_task_clock.hpp b/stratosphere/fatal/source/fatal_task_clock.hpp index e0445bc..1c94a7a 100644 --- a/stratosphere/fatal/source/fatal_task_clock.hpp +++ b/stratosphere/fatal/source/fatal_task_clock.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 "fatal_task.hpp" diff --git a/stratosphere/fatal/source/fatal_task_error_report.cpp b/stratosphere/fatal/source/fatal_task_error_report.cpp index 7c3a2a1..753d044 100644 --- a/stratosphere/fatal/source/fatal_task_error_report.cpp +++ b/stratosphere/fatal/source/fatal_task_error_report.cpp @@ -13,12 +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 "fatal_config.hpp" #include "fatal_task_error_report.hpp" diff --git a/stratosphere/fatal/source/fatal_task_error_report.hpp b/stratosphere/fatal/source/fatal_task_error_report.hpp index 316134f..1c6ffb6 100644 --- a/stratosphere/fatal/source/fatal_task_error_report.hpp +++ b/stratosphere/fatal/source/fatal_task_error_report.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 "fatal_task.hpp" diff --git a/stratosphere/fatal/source/fatal_task_power.cpp b/stratosphere/fatal/source/fatal_task_power.cpp index af6513b..0006a79 100644 --- a/stratosphere/fatal/source/fatal_task_power.cpp +++ b/stratosphere/fatal/source/fatal_task_power.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 "fatal_config.hpp" #include "fatal_task_power.hpp" diff --git a/stratosphere/fatal/source/fatal_task_power.hpp b/stratosphere/fatal/source/fatal_task_power.hpp index 7d9f62a..5b9ff7b 100644 --- a/stratosphere/fatal/source/fatal_task_power.hpp +++ b/stratosphere/fatal/source/fatal_task_power.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 "fatal_task.hpp" diff --git a/stratosphere/fatal/source/fatal_task_screen.cpp b/stratosphere/fatal/source/fatal_task_screen.cpp index 7aece02..7d1b098 100644 --- a/stratosphere/fatal/source/fatal_task_screen.cpp +++ b/stratosphere/fatal/source/fatal_task_screen.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 "fatal_task_screen.hpp" #include "fatal_config.hpp" #include "fatal_font.hpp" diff --git a/stratosphere/fatal/source/fatal_task_screen.hpp b/stratosphere/fatal/source/fatal_task_screen.hpp index 8c96a42..245e344 100644 --- a/stratosphere/fatal/source/fatal_task_screen.hpp +++ b/stratosphere/fatal/source/fatal_task_screen.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 "fatal_task.hpp" diff --git a/stratosphere/fatal/source/fatal_task_sound.cpp b/stratosphere/fatal/source/fatal_task_sound.cpp index ab03c74..88e9aff 100644 --- a/stratosphere/fatal/source/fatal_task_sound.cpp +++ b/stratosphere/fatal/source/fatal_task_sound.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 "fatal_task_sound.hpp" namespace ams::fatal::srv { diff --git a/stratosphere/fatal/source/fatal_task_sound.hpp b/stratosphere/fatal/source/fatal_task_sound.hpp index 069bc80..7dc5405 100644 --- a/stratosphere/fatal/source/fatal_task_sound.hpp +++ b/stratosphere/fatal/source/fatal_task_sound.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 "fatal_task.hpp" diff --git a/stratosphere/libstratosphere/include/atmosphere/common.hpp b/stratosphere/libstratosphere/include/atmosphere/common.hpp new file mode 100644 index 0000000..6a87be4 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/common.hpp @@ -0,0 +1,22 @@ +/* + * 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 "common_includes.hpp" +#include "defines.hpp" +#include "util.hpp" +#include "results.hpp" +#include "svc.hpp" diff --git a/stratosphere/libstratosphere/include/atmosphere/common_includes.hpp b/stratosphere/libstratosphere/include/atmosphere/common_includes.hpp new file mode 100644 index 0000000..fec9205 --- /dev/null +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/atmosphere/defines.hpp b/stratosphere/libstratosphere/include/atmosphere/defines.hpp new file mode 100644 index 0000000..a20d4c7 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/defines.hpp @@ -0,0 +1,46 @@ +/* + * 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 "common_includes.hpp" + +/* Any broadly useful language defines should go here. */ + +#define AMS_ASSERT(expr) do { if (!(expr)) { std::abort(); } } while (0) + +#define AMS_UNREACHABLE_DEFAULT_CASE() default: std::abort() + +#define NON_COPYABLE(cls) \ + cls(const cls&) = delete; \ + cls& operator=(const cls&) = delete + +#define NON_MOVEABLE(cls) \ + cls(cls&&) = delete; \ + cls& operator=(cls&&) = delete + +#define ALIGNED(algn) __attribute__((aligned(algn))) +#define NORETURN __attribute__((noreturn)) +#define WEAK __attribute__((weak)) + + +#define CONCATENATE_IMPL(S1, s2) s1##s2 +#define CONCATENATE(s1, s2) CONCATENATE_IMPL(s1, s2) + +#ifdef __COUNTER__ +#define ANONYMOUS_VARIABLE(pref) CONCATENATE(pref, __COUNTER__) +#else +#define ANONYMOUS_VARIABLE(pref) CONCATENATE(pref, __LINE__) +#endif diff --git a/stratosphere/libstratosphere/include/atmosphere/results.hpp b/stratosphere/libstratosphere/include/atmosphere/results.hpp new file mode 100644 index 0000000..992733d --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results.hpp @@ -0,0 +1,50 @@ +/* + * 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 "defines.hpp" +#include "util.hpp" + +/* Utilities. */ +#include "results/results_common.hpp" + +/* Official. */ +#include "results/cal_results.hpp" +#include "results/creport_results.hpp" +#include "results/debug_results.hpp" +#include "results/dmnt_results.hpp" +#include "results/err_results.hpp" +#include "results/fatal_results.hpp" +#include "results/fs_results.hpp" +#include "results/hipc_results.hpp" +#include "results/i2c_results.hpp" +#include "results/kvdb_results.hpp" +#include "results/loader_results.hpp" +#include "results/lr_results.hpp" +#include "results/os_results.hpp" +#include "results/ncm_results.hpp" +#include "results/pm_results.hpp" +#include "results/ro_results.hpp" +#include "results/settings_results.hpp" +#include "results/sf_results.hpp" +#include "results/sm_results.hpp" +#include "results/spl_results.hpp" +#include "results/svc_results.hpp" +#include "results/updater_results.hpp" +#include "results/vi_results.hpp" + +/* Unofficial. */ +#include "results/exosphere_results.hpp" diff --git a/stratosphere/libstratosphere/include/atmosphere/results/cal_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/cal_results.hpp new file mode 100644 index 0000000..69f3a8b --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/cal_results.hpp @@ -0,0 +1,26 @@ +/* + * 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 "results_common.hpp" + +namespace ams::cal { + + R_DEFINE_NAMESPACE_RESULT_MODULE(198); + + R_DEFINE_ERROR_RESULT(CalibrationDataCrcError, 101); + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/results/creport_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/creport_results.hpp new file mode 100644 index 0000000..6f836d8 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/creport_results.hpp @@ -0,0 +1,37 @@ +/* + * 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 "results_common.hpp" + +namespace ams::creport { + + R_DEFINE_NAMESPACE_RESULT_MODULE(168); + + R_DEFINE_ERROR_RESULT(UndefinedInstruction, 0); + R_DEFINE_ERROR_RESULT(InstructionAbort, 1); + R_DEFINE_ERROR_RESULT(DataAbort, 2); + R_DEFINE_ERROR_RESULT(AlignmentFault, 3); + R_DEFINE_ERROR_RESULT(DebuggerAttached, 4); + R_DEFINE_ERROR_RESULT(BreakPoint, 5); + R_DEFINE_ERROR_RESULT(UserBreak, 6); + R_DEFINE_ERROR_RESULT(DebuggerBreak, 7); + R_DEFINE_ERROR_RESULT(UndefinedSystemCall, 8); + R_DEFINE_ERROR_RESULT(SystemMemoryError, 9); + + R_DEFINE_ERROR_RESULT(IncompleteReport, 99); + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/results/debug_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/debug_results.hpp new file mode 100644 index 0000000..fcf9d66 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/debug_results.hpp @@ -0,0 +1,28 @@ +/* + * 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 "results_common.hpp" + +namespace ams::dbg { + + R_DEFINE_NAMESPACE_RESULT_MODULE(183); + + R_DEFINE_ERROR_RESULT(CannotDebug, 1); + R_DEFINE_ERROR_RESULT(AlreadyAttached, 2); + R_DEFINE_ERROR_RESULT(Cancelled, 3); + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/results/dmnt_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/dmnt_results.hpp new file mode 100644 index 0000000..aaa1a3d --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/dmnt_results.hpp @@ -0,0 +1,50 @@ +/* + * 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 "results_common.hpp" + +namespace ams::dmnt { + + R_DEFINE_NAMESPACE_RESULT_MODULE(13); + + R_DEFINE_ERROR_RESULT(Unknown, 1); + R_DEFINE_ERROR_RESULT(DebuggingDisabled, 2); + + /* Atmosphere extension. */ + namespace cheat { + + R_DEFINE_ABSTRACT_ERROR_RANGE(CheatError, 6500, 6599); + R_DEFINE_ERROR_RESULT(CheatNotAttached, 6500); + R_DEFINE_ERROR_RESULT(CheatNullBuffer, 6501); + R_DEFINE_ERROR_RESULT(CheatInvalidBuffer, 6502); + R_DEFINE_ERROR_RESULT(CheatUnknownId, 6503); + R_DEFINE_ERROR_RESULT(CheatOutOfResource, 6504); + R_DEFINE_ERROR_RESULT(CheatInvalid, 6505); + R_DEFINE_ERROR_RESULT(CheatCannotDisable, 6506); + + R_DEFINE_ABSTRACT_ERROR_RANGE(FrozenAddressError, 6600, 6699); + R_DEFINE_ERROR_RESULT(FrozenAddressInvalidWidth, 6600); + R_DEFINE_ERROR_RESULT(FrozenAddressAlreadyExists, 6601); + R_DEFINE_ERROR_RESULT(FrozenAddressNotFound, 6602); + R_DEFINE_ERROR_RESULT(FrozenAddressOutOfResource, 6603); + + R_DEFINE_ABSTRACT_ERROR_RANGE(VirtualMachineError, 6700, 6799); + R_DEFINE_ERROR_RESULT(VirtualMachineInvalidConditionDepth, 6700); + + } + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/results/err_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/err_results.hpp new file mode 100644 index 0000000..dd46dc5 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/err_results.hpp @@ -0,0 +1,27 @@ +/* + * 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 "results_common.hpp" + +namespace ams::err { + + R_DEFINE_NAMESPACE_RESULT_MODULE(162); + + R_DEFINE_ERROR_RESULT(ApplicationAborted, 1); + R_DEFINE_ERROR_RESULT(SystemModuleAborted, 2); + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/results/exosphere_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/exosphere_results.hpp new file mode 100644 index 0000000..8804473 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/exosphere_results.hpp @@ -0,0 +1,30 @@ +/* + * 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 "results_common.hpp" + +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(NotPresent, 1); + R_DEFINE_ERROR_RESULT(VersionMismatch, 2); + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/results/fatal_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/fatal_results.hpp new file mode 100644 index 0000000..076171d --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/fatal_results.hpp @@ -0,0 +1,31 @@ +/* + * 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 "results_common.hpp" + +namespace ams::fatal { + + R_DEFINE_NAMESPACE_RESULT_MODULE(163); + + R_DEFINE_ERROR_RESULT(AllocationFailed, 1); + R_DEFINE_ERROR_RESULT(NullGraphicsBuffer, 2); + R_DEFINE_ERROR_RESULT(AlreadyThrown, 3); + R_DEFINE_ERROR_RESULT(TooManyEvents, 4); + R_DEFINE_ERROR_RESULT(InRepairWithoutVolHeld, 5); + R_DEFINE_ERROR_RESULT(InRepairWithoutTimeReviserCartridge, 6); + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/results/fs_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/fs_results.hpp new file mode 100644 index 0000000..b3877c3 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/fs_results.hpp @@ -0,0 +1,116 @@ +/* + * 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 "results_common.hpp" + +namespace ams::fs { + + R_DEFINE_NAMESPACE_RESULT_MODULE(2); + + R_DEFINE_ERROR_RESULT(PathNotFound, 1); + R_DEFINE_ERROR_RESULT(PathAlreadyExists, 2); + + R_DEFINE_ERROR_RESULT(TargetLocked, 7); + R_DEFINE_ERROR_RESULT(DirectoryNotEmpty, 8); + + R_DEFINE_ERROR_RANGE (NotEnoughFreeSpace, 30, 45); + R_DEFINE_ERROR_RANGE(NotEnoughFreeSpaceBis, 34, 38); + R_DEFINE_ERROR_RESULT(NotEnoughFreeSpaceBisCalibration, 35); + R_DEFINE_ERROR_RESULT(NotEnoughFreeSpaceBisSafe, 36); + R_DEFINE_ERROR_RESULT(NotEnoughFreeSpaceBisUser, 37); + R_DEFINE_ERROR_RESULT(NotEnoughFreeSpaceBisSystem, 38); + R_DEFINE_ERROR_RESULT(NotEnoughFreeSpaceSdCard, 39); + + R_DEFINE_ERROR_RESULT(MountNameAlreadyExists, 60); + + R_DEFINE_ERROR_RESULT(TargetNotFound, 1002); + + R_DEFINE_ERROR_RANGE(SdCardAccessFailed, 2000, 2499); + R_DEFINE_ERROR_RESULT(SdCardNotPresent, 2001); + + R_DEFINE_ERROR_RANGE(GameCardAccessFailed, 2500, 2999); + + R_DEFINE_ERROR_RESULT(NotImplemented, 3001); + R_DEFINE_ERROR_RESULT(OutOfRange, 3005); + + R_DEFINE_ERROR_RANGE(AllocationFailure, 3200, 3499); + R_DEFINE_ERROR_RESULT(AllocationFailureInDirectorySaveDataFileSystem, 3321); + R_DEFINE_ERROR_RESULT(AllocationFailureInSubDirectoryFileSystem, 3355); + + R_DEFINE_ERROR_RANGE(MmcAccessFailed, 3500, 3999); + + R_DEFINE_ERROR_RANGE(DataCorrupted, 4000, 4999); + R_DEFINE_ERROR_RANGE(RomCorrupted, 4001, 4299); + R_DEFINE_ERROR_RANGE(SaveDataCorrupted, 4301, 4499); + R_DEFINE_ERROR_RANGE(NcaCorrupted, 4501, 4599); + R_DEFINE_ERROR_RANGE(IntegrityVerificationStorageCorrupted, 4601, 4639); + R_DEFINE_ERROR_RANGE(PartitionFileSystemCorrupted, 4641, 4659); + R_DEFINE_ERROR_RANGE(BuiltInStorageCorrupted, 4661, 4679); + R_DEFINE_ERROR_RANGE(HostFileSystemCorrupted, 4701, 4719); + R_DEFINE_ERROR_RANGE(DatabaseCorrupted, 4721, 4739); + R_DEFINE_ERROR_RANGE(AesXtsFileSystemCorrupted, 4741, 4759); + R_DEFINE_ERROR_RANGE(SaveDataTransferDataCorrupted, 4761, 4769); + R_DEFINE_ERROR_RANGE(SignedSystemPartitionDataCorrupted, 4771, 4779); + + R_DEFINE_ERROR_RESULT(GameCardLogoDataCorrupted, 4781); + + R_DEFINE_ERROR_RANGE(Unexpected, 5000, 5999); + + R_DEFINE_ERROR_RANGE(PreconditionViolation, 6000, 6499); + R_DEFINE_ERROR_RANGE(InvalidArgument, 6001, 6199); + R_DEFINE_ERROR_RANGE(InvalidPath, 6002, 6029); + R_DEFINE_ERROR_RESULT(TooLongPath, 6003); + R_DEFINE_ERROR_RESULT(InvalidCharacter, 6004); + R_DEFINE_ERROR_RESULT(InvalidPathFormat, 6005); + R_DEFINE_ERROR_RESULT(DirectoryUnobtainable, 6006); + R_DEFINE_ERROR_RESULT(NotNormalized, 6007); + + R_DEFINE_ERROR_RESULT(InvalidOffset, 6061); + R_DEFINE_ERROR_RESULT(InvalidSize, 6062); + R_DEFINE_ERROR_RESULT(NullptrArgument, 6063); + R_DEFINE_ERROR_RESULT(InvalidAlignment, 6064); + R_DEFINE_ERROR_RESULT(InvalidMountName, 6065); + + R_DEFINE_ERROR_RESULT(ExtensionSizeTooLarge, 6066); + R_DEFINE_ERROR_RESULT(ExtensionSizeInvalid, 6067); + + R_DEFINE_ERROR_RANGE(InvalidEnumValue, 6080, 6099); + R_DEFINE_ERROR_RESULT(InvalidSaveDataState, 6081); + R_DEFINE_ERROR_RESULT(InvalidSaveDataSpaceId, 6082); + + R_DEFINE_ERROR_RANGE(InvalidOperationForOpenMode, 6200, 6299); + R_DEFINE_ERROR_RESULT(FileExtensionWithoutOpenModeAllowAppend, 6201); + + R_DEFINE_ERROR_RANGE(UnsupportedOperation, 6300, 6399); + + R_DEFINE_ERROR_RANGE(PermissionDenied, 6400, 6449); + + R_DEFINE_ERROR_RESULT(WriteModeFileNotClosed, 6457); + R_DEFINE_ERROR_RESULT(AllocatorAlignmentViolation, 6461); + R_DEFINE_ERROR_RESULT(UserNotExist, 6465); + + R_DEFINE_ERROR_RANGE(OutOfResource, 6700, 6799); + R_DEFINE_ERROR_RESULT(MappingTableFull, 6706); + R_DEFINE_ERROR_RESULT(OpenCountLimit, 6709); + + R_DEFINE_ERROR_RANGE(MappingFailed, 6800, 6899); + R_DEFINE_ERROR_RESULT(MapFull, 6811); + + R_DEFINE_ERROR_RANGE(BadState, 6900, 6999); + R_DEFINE_ERROR_RESULT(NotMounted, 6905); + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/results/hipc_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/hipc_results.hpp new file mode 100644 index 0000000..65f396f --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/hipc_results.hpp @@ -0,0 +1,41 @@ +/* + * 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 "results_common.hpp" + +namespace ams::sf::hipc { + + R_DEFINE_NAMESPACE_RESULT_MODULE(11); + + R_DEFINE_ABSTRACT_ERROR_RANGE(OutOfResource, 100, 299); + R_DEFINE_ERROR_RESULT(OutOfSessionMemory, 102); + R_DEFINE_ERROR_RANGE (OutOfSessions, 131, 139); + R_DEFINE_ERROR_RESULT(PointerBufferTooSmall, 141); + + R_DEFINE_ERROR_RESULT(OutOfDomains, 200); + + R_DEFINE_ERROR_RESULT(SessionClosed, 301); + + R_DEFINE_ERROR_RESULT(InvalidRequestSize, 402); + R_DEFINE_ERROR_RESULT(UnknownCommandType, 403); + + R_DEFINE_ERROR_RESULT(InvalidCmifRequest, 420); + + R_DEFINE_ERROR_RESULT(TargetNotDomain, 491); + R_DEFINE_ERROR_RESULT(DomainObjectNotFound, 492); + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/results/i2c_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/i2c_results.hpp new file mode 100644 index 0000000..bd7f795 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/i2c_results.hpp @@ -0,0 +1,30 @@ +/* + * 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 "results_common.hpp" + +namespace ams::i2c { + + R_DEFINE_NAMESPACE_RESULT_MODULE(101); + + R_DEFINE_ERROR_RESULT(NoAck, 1); + R_DEFINE_ERROR_RESULT(BusBusy, 2); + R_DEFINE_ERROR_RESULT(FullCommandList, 3); + R_DEFINE_ERROR_RESULT(TimedOut, 4); + R_DEFINE_ERROR_RESULT(UnknownDevice, 5); + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/results/kvdb_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/kvdb_results.hpp new file mode 100644 index 0000000..052ced4 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/kvdb_results.hpp @@ -0,0 +1,33 @@ +/* + * 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 "results_common.hpp" + +namespace ams::kvdb { + + R_DEFINE_NAMESPACE_RESULT_MODULE(20); + + R_DEFINE_ERROR_RESULT(OutOfKeyResource, 1); + R_DEFINE_ERROR_RESULT(KeyNotFound, 2); + R_DEFINE_ERROR_RESULT(AllocationFailed, 4); + R_DEFINE_ERROR_RESULT(InvalidKeyValue, 5); + R_DEFINE_ERROR_RESULT(BufferInsufficient, 6); + + R_DEFINE_ERROR_RESULT(InvalidFilesystemState, 8); + R_DEFINE_ERROR_RESULT(NotCreated, 9); + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/results/loader_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/loader_results.hpp new file mode 100644 index 0000000..29b80bf --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/loader_results.hpp @@ -0,0 +1,63 @@ +/* + * 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 "results_common.hpp" + +namespace ams::ldr { + + R_DEFINE_NAMESPACE_RESULT_MODULE(9); + + R_DEFINE_ERROR_RESULT(TooLongArgument, 1); + R_DEFINE_ERROR_RESULT(TooManyArguments, 2); + R_DEFINE_ERROR_RESULT(TooLargeMeta, 3); + R_DEFINE_ERROR_RESULT(InvalidMeta, 4); + R_DEFINE_ERROR_RESULT(InvalidNso, 5); + R_DEFINE_ERROR_RESULT(InvalidPath, 6); + R_DEFINE_ERROR_RESULT(TooManyProcesses, 7); + R_DEFINE_ERROR_RESULT(NotPinned, 8); + R_DEFINE_ERROR_RESULT(InvalidProgramId, 9); + R_DEFINE_ERROR_RESULT(InvalidVersion, 10); + + R_DEFINE_ERROR_RESULT(InsufficientAddressSpace, 51); + R_DEFINE_ERROR_RESULT(InvalidNro, 52); + R_DEFINE_ERROR_RESULT(InvalidNrr, 53); + R_DEFINE_ERROR_RESULT(InvalidSignature, 54); + R_DEFINE_ERROR_RESULT(InsufficientNroRegistrations, 55); + R_DEFINE_ERROR_RESULT(InsufficientNrrRegistrations, 56); + R_DEFINE_ERROR_RESULT(NroAlreadyLoaded, 57); + + R_DEFINE_ERROR_RESULT(InvalidAddress, 81); + R_DEFINE_ERROR_RESULT(InvalidSize, 82); + R_DEFINE_ERROR_RESULT(NotLoaded, 84); + R_DEFINE_ERROR_RESULT(NotRegistered, 85); + R_DEFINE_ERROR_RESULT(InvalidSession, 86); + R_DEFINE_ERROR_RESULT(InvalidProcess, 87); + + R_DEFINE_ERROR_RESULT(UnknownCapability, 100); + R_DEFINE_ERROR_RESULT(InvalidCapabilityKernelFlags, 103); + R_DEFINE_ERROR_RESULT(InvalidCapabilitySyscallMask, 104); + R_DEFINE_ERROR_RESULT(InvalidCapabilityMapRange, 106); + R_DEFINE_ERROR_RESULT(InvalidCapabilityMapPage, 107); + R_DEFINE_ERROR_RESULT(InvalidCapabilityInterruptPair, 111); + R_DEFINE_ERROR_RESULT(InvalidCapabilityApplicationType, 113); + R_DEFINE_ERROR_RESULT(InvalidCapabilityKernelVersion, 114); + R_DEFINE_ERROR_RESULT(InvalidCapabilityHandleTable, 115); + R_DEFINE_ERROR_RESULT(InvalidCapabilityDebugFlags, 116); + + R_DEFINE_ERROR_RESULT(InternalError, 200); + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/results/lr_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/lr_results.hpp new file mode 100644 index 0000000..c1983ee --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/lr_results.hpp @@ -0,0 +1,34 @@ +/* + * 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 "results_common.hpp" + +namespace ams::lr { + + R_DEFINE_NAMESPACE_RESULT_MODULE(8); + + R_DEFINE_ERROR_RESULT(ProgramNotFound, 2); + R_DEFINE_ERROR_RESULT(DataNotFound, 3); + R_DEFINE_ERROR_RESULT(UnknownStorageId, 4); + R_DEFINE_ERROR_RESULT(HtmlDocumentNotFound, 6); + R_DEFINE_ERROR_RESULT(AddOnContentNotFound, 7); + R_DEFINE_ERROR_RESULT(ControlNotFound, 8); + R_DEFINE_ERROR_RESULT(LegalInformationNotFound, 9); + + R_DEFINE_ERROR_RESULT(TooManyRegisteredPaths, 90); + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/results/ncm_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/ncm_results.hpp new file mode 100644 index 0000000..cdba12c --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/ncm_results.hpp @@ -0,0 +1,55 @@ +/* + * 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 "results_common.hpp" + +namespace ams::ncm { + + R_DEFINE_NAMESPACE_RESULT_MODULE(5); + + R_DEFINE_ERROR_RESULT(PlaceHolderAlreadyExists, 2); + R_DEFINE_ERROR_RESULT(PlaceHolderNotFound, 3); + R_DEFINE_ERROR_RESULT(ContentAlreadyExists, 4); + R_DEFINE_ERROR_RESULT(ContentNotFound, 5); + R_DEFINE_ERROR_RESULT(ContentMetaNotFound, 7); + R_DEFINE_ERROR_RESULT(AllocationFailed, 8); + R_DEFINE_ERROR_RESULT(UnknownStorage, 12); + + R_DEFINE_ERROR_RESULT(InvalidContentStorage, 100); + R_DEFINE_ERROR_RESULT(InvalidContentMetaDatabase, 110); + + R_DEFINE_ERROR_RESULT(BufferInsufficient, 180); + R_DEFINE_ERROR_RESULT(InvalidContentMetaKey, 240); + + R_DEFINE_ERROR_RANGE(ContentStorageNotActive, 250, 258); + R_DEFINE_ERROR_RESULT(GameCardContentStorageNotActive, 251); + R_DEFINE_ERROR_RESULT(NandSystemContentStorageNotActive, 252); + R_DEFINE_ERROR_RESULT(NandUserContentStorageNotActive, 253); + R_DEFINE_ERROR_RESULT(SdCardContentStorageNotActive, 254); + R_DEFINE_ERROR_RESULT(UnknownContentStorageNotActive, 258); + + R_DEFINE_ERROR_RANGE(ContentMetaDatabaseNotActive, 260, 268); + R_DEFINE_ERROR_RESULT(GameCardContentMetaDatabaseNotActive, 261); + R_DEFINE_ERROR_RESULT(NandSystemContentMetaDatabaseNotActive, 262); + R_DEFINE_ERROR_RESULT(NandUserContentMetaDatabaseNotActive, 263); + R_DEFINE_ERROR_RESULT(SdCardContentMetaDatabaseNotActive, 264); + R_DEFINE_ERROR_RESULT(UnknownContentMetaDatabaseNotActive, 268); + + R_DEFINE_ERROR_RANGE(InvalidArgument, 8181, 8191); + R_DEFINE_ERROR_RESULT(InvalidOffset, 8182); + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/results/os_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/os_results.hpp new file mode 100644 index 0000000..5fd716d --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/os_results.hpp @@ -0,0 +1,32 @@ +/* + * 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 "results_common.hpp" + +namespace ams::os { + + R_DEFINE_NAMESPACE_RESULT_MODULE(3); + + R_DEFINE_ERROR_RESULT(Busy, 4); + + R_DEFINE_ERROR_RESULT(OutOfMemory, 8); + R_DEFINE_ERROR_RESULT(OutOfResource, 9); + + R_DEFINE_ERROR_RESULT(OutOfVirtualAddressSpace, 12); + R_DEFINE_ERROR_RESULT(ResourceLimit, 13); + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/results/pm_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/pm_results.hpp new file mode 100644 index 0000000..50d4c3f --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/pm_results.hpp @@ -0,0 +1,31 @@ +/* + * 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 "results_common.hpp" + +namespace ams::pm { + + R_DEFINE_NAMESPACE_RESULT_MODULE(15); + + R_DEFINE_ERROR_RESULT(ProcessNotFound, 1); + R_DEFINE_ERROR_RESULT(AlreadyStarted, 2); + R_DEFINE_ERROR_RESULT(NotExited, 3); + R_DEFINE_ERROR_RESULT(DebugHookInUse, 4); + R_DEFINE_ERROR_RESULT(ApplicationRunning, 5); + R_DEFINE_ERROR_RESULT(InvalidSize, 6); + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/results/results_common.hpp b/stratosphere/libstratosphere/include/atmosphere/results/results_common.hpp new file mode 100644 index 0000000..b0b50d4 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/results_common.hpp @@ -0,0 +1,286 @@ +/* + * 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 "../defines.hpp" + +namespace ams { + + namespace result::impl { + + class ResultTraits { + public: + using BaseType = u32; + static_assert(std::is_same::value, "std::is_same::value"); + static constexpr BaseType SuccessValue = BaseType(); + static constexpr BaseType ModuleBits = 9; + static constexpr BaseType DescriptionBits = 13; + static constexpr BaseType ReservedBits = 10; + static_assert(ModuleBits + DescriptionBits + ReservedBits == sizeof(BaseType) * CHAR_BIT, "ModuleBits + DescriptionBits + ReservedBits == sizeof(BaseType) * CHAR_BIT"); + public: + NX_CONSTEXPR BaseType MakeValue(BaseType module, BaseType description) { + return (module) | (description << ModuleBits); + } + + template + struct MakeStaticValue : public std::integral_constant { + static_assert(module < (1 << ModuleBits), "Invalid Module"); + static_assert(description < (1 << DescriptionBits), "Invalid Description"); + }; + + NX_CONSTEXPR BaseType GetModuleFromValue(BaseType value) { + return value & ~(~BaseType() << ModuleBits); + } + + NX_CONSTEXPR BaseType GetDescriptionFromValue(BaseType value) { + return ((value >> ModuleBits) & ~(~BaseType() << DescriptionBits)); + } + }; + + /* Use CRTP for Results. */ + template + class ResultBase { + public: + using BaseType = typename ResultTraits::BaseType; + static constexpr BaseType SuccessValue = ResultTraits::SuccessValue; + public: + constexpr inline BaseType GetModule() const { return ResultTraits::GetModuleFromValue(static_cast(this)->GetValue()); } + constexpr inline BaseType GetDescription() const { return ResultTraits::GetDescriptionFromValue(static_cast(this)->GetValue()); } + }; + + class ResultConstructor; + + } + + class ResultSuccess; + + class Result final : public result::impl::ResultBase { + friend class ResultConstructor; + public: + using Base = typename result::impl::ResultBase; + private: + typename Base::BaseType value; + private: + /* TODO: Maybe one-day, the result constructor. */ + public: + Result() { /* ... */ } + + /* TODO: It sure would be nice to make this private. */ + constexpr Result(typename Base::BaseType v) : value(v) { static_assert(std::is_same::value); } + + constexpr inline operator ResultSuccess() const; + NX_CONSTEXPR bool CanAccept(Result result) { return true; } + + constexpr inline bool IsSuccess() const { return this->GetValue() == Base::SuccessValue; } + constexpr inline bool IsFailure() const { return !this->IsSuccess(); } + constexpr inline typename Base::BaseType GetModule() const { return Base::GetModule(); } + constexpr inline typename Base::BaseType GetDescription() const { return Base::GetDescription(); } + + constexpr inline typename Base::BaseType GetValue() const { return this->value; } + }; + static_assert(sizeof(Result) == sizeof(Result::Base::BaseType), "sizeof(Result) == sizeof(Result::Base::BaseType)"); + static_assert(std::is_trivially_destructible::value, "std::is_trivially_destructible::value"); + + namespace result::impl { + + class ResultConstructor { + public: + static constexpr inline Result MakeResult(ResultTraits::BaseType value) { + return Result(value); + } + }; + + constexpr inline Result MakeResult(ResultTraits::BaseType value) { + return ResultConstructor::MakeResult(value); + } + + } + + class ResultSuccess final : public result::impl::ResultBase { + public: + using Base = typename result::impl::ResultBase; + public: + constexpr operator Result() const { return result::impl::MakeResult(Base::SuccessValue); } + NX_CONSTEXPR bool CanAccept(Result result) { return result.IsSuccess(); } + + constexpr inline bool IsSuccess() const { return true; } + constexpr inline bool IsFailure() const { return !this->IsSuccess(); } + constexpr inline typename Base::BaseType GetModule() const { return Base::GetModule(); } + constexpr inline typename Base::BaseType GetDescription() const { return Base::GetDescription(); } + + constexpr inline typename Base::BaseType GetValue() const { return Base::SuccessValue; } + }; + + namespace result::impl { + + NORETURN void OnResultAssertion(Result result); + + } + + constexpr inline Result::operator ResultSuccess() const { + if (!ResultSuccess::CanAccept(*this)) { + result::impl::OnResultAssertion(*this); + } + return ResultSuccess(); + } + + namespace result::impl { + + template + class ResultErrorBase : public ResultBase> { + public: + using Base = typename result::impl::ResultBase>; + static constexpr typename Base::BaseType Module = _Module; + static constexpr typename Base::BaseType Description = _Description; + static constexpr typename Base::BaseType Value = ResultTraits::MakeStaticValue::value; + static_assert(Value != Base::SuccessValue, "Value != Base::SuccessValue"); + public: + constexpr operator Result() const { return MakeResult(Value); } + constexpr operator ResultSuccess() const { OnResultAssertion(Value); } + + constexpr inline bool IsSuccess() const { return false; } + constexpr inline bool IsFailure() const { return !this->IsSuccess(); } + + constexpr inline typename Base::BaseType GetValue() const { return Value; } + }; + + template + class ResultErrorRangeBase { + public: + static constexpr ResultTraits::BaseType Module = _Module; + static constexpr ResultTraits::BaseType DescriptionStart = DescStart; + static constexpr ResultTraits::BaseType DescriptionEnd = DescEnd; + static_assert(DescriptionStart <= DescriptionEnd, "DescriptionStart <= DescriptionEnd"); + static constexpr typename ResultTraits::BaseType StartValue = ResultTraits::MakeStaticValue::value; + static constexpr typename ResultTraits::BaseType EndValue = ResultTraits::MakeStaticValue::value; + public: + NX_CONSTEXPR bool Includes(Result result) { + return StartValue <= result.GetValue() && result.GetValue() <= EndValue; + } + }; + + } + +} + +/* Macros for defining new results. */ +#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<::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 ::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 ::ams::result::impl::ResultErrorRangeBase {} + + +#define R_DEFINE_ERROR_RESULT(name, desc) R_DEFINE_ERROR_RESULT_IMPL(name, desc, desc) +#define R_DEFINE_ERROR_RANGE(name, start, end) R_DEFINE_ERROR_RESULT_IMPL(name, start, end) + +#define R_DEFINE_ABSTRACT_ERROR_RESULT(name, desc) R_DEFINE_ABSTRACT_ERROR_RESULT_IMPL(name, desc, desc) +#define R_DEFINE_ABSTRACT_ERROR_RANGE(name, start, end) R_DEFINE_ABSTRACT_ERROR_RESULT_IMPL(name, start, end) + +/* Remove libnx macros, replace with our own. */ +#ifndef R_SUCCEEDED +#error "R_SUCCEEDED not defined." +#endif + +#undef R_SUCCEEDED + +#ifndef R_FAILED +#error "R_FAILED not defined" +#endif + +#undef R_FAILED + +#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. +#define R_TRY(res_expr) \ + ({ \ + const auto _tmp_r_try_rc = res_expr; \ + if (R_FAILED(_tmp_r_try_rc)) { \ + return _tmp_r_try_rc; \ + } \ + }) + +/// Evaluates an expression that returns a result, and fatals the result if it would fail. +#define R_ASSERT(res_expr) \ + ({ \ + const auto _tmp_r_assert_rc = res_expr; \ + if (R_FAILED(_tmp_r_assert_rc)) { \ + ::ams::result::impl::OnResultAssertion(_tmp_r_assert_rc); \ + } \ + }) + +/// Evaluates a boolean expression, and returns a result unless that expression is true. +#define R_UNLESS(expr, res) \ + ({ \ + if (!(expr)) { \ + return static_cast<::ams::Result>(res); \ + } \ + }) + +/// Helpers for pattern-matching on a result expression, if the result would fail. +#define R_CURRENT_RESULT _tmp_r_current_result + +#define R_TRY_CATCH(res_expr) \ + ({ \ + const auto R_CURRENT_RESULT = res_expr; \ + if (R_FAILED(R_CURRENT_RESULT)) { \ + if (false) + +namespace ams::result::impl { + + template + NX_CONSTEXPR bool AnyIncludes(Result result) { + return (Rs::Includes(result) || ...); + } + +} + +#define R_CATCH(...) \ + } 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<::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<::ams::Result>(convert_type); } + +#define R_END_TRY_CATCH \ + else if (R_FAILED(R_CURRENT_RESULT)) { \ + return R_CURRENT_RESULT; \ + } \ + } \ + }) + +#define R_END_TRY_CATCH_WITH_ASSERT \ + else { \ + R_ASSERT(R_CURRENT_RESULT); \ + } \ + } \ + }) diff --git a/stratosphere/libstratosphere/include/atmosphere/results/ro_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/ro_results.hpp new file mode 100644 index 0000000..6722705 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/ro_results.hpp @@ -0,0 +1,45 @@ +/* + * 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 "results_common.hpp" + +namespace ams::ro { + + R_DEFINE_NAMESPACE_RESULT_MODULE(22); + + R_DEFINE_ERROR_RANGE(RoError, 1, 1023); + R_DEFINE_ERROR_RESULT(OutOfAddressSpace, 2); + R_DEFINE_ERROR_RESULT(AlreadyLoaded, 3); + R_DEFINE_ERROR_RESULT(InvalidNro, 4); + + R_DEFINE_ERROR_RESULT(InvalidNrr, 6); + R_DEFINE_ERROR_RESULT(TooManyNro, 7); + R_DEFINE_ERROR_RESULT(TooManyNrr, 8); + R_DEFINE_ERROR_RESULT(NotAuthorized, 9); + R_DEFINE_ERROR_RESULT(InvalidNrrType, 10); + + R_DEFINE_ERROR_RESULT(InternalError, 1023); + + R_DEFINE_ERROR_RESULT(InvalidAddress, 1025); + R_DEFINE_ERROR_RESULT(InvalidSize, 1026); + + R_DEFINE_ERROR_RESULT(NotLoaded, 1028); + R_DEFINE_ERROR_RESULT(NotRegistered, 1029); + R_DEFINE_ERROR_RESULT(InvalidSession, 1030); + R_DEFINE_ERROR_RESULT(InvalidProcess, 1031); + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/results/settings_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/settings_results.hpp new file mode 100644 index 0000000..6f015cd --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/settings_results.hpp @@ -0,0 +1,47 @@ +/* + * 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 "results_common.hpp" + +namespace ams::settings { + + R_DEFINE_NAMESPACE_RESULT_MODULE(105); + + R_DEFINE_ERROR_RESULT(ItemNotFound, 11); + + R_DEFINE_ERROR_RANGE(InternalError, 100, 149); + R_DEFINE_ERROR_RESULT(ItemKeyAllocationFailed, 101); + R_DEFINE_ERROR_RESULT(ItemValueAllocationFailed, 102); + + R_DEFINE_ERROR_RANGE(InvalidArgument, 200, 399); + R_DEFINE_ERROR_RESULT(SettingsNameNull, 201); + R_DEFINE_ERROR_RESULT(SettingsItemKeyNull, 202); + R_DEFINE_ERROR_RESULT(SettingsItemValueNull, 203); + R_DEFINE_ERROR_RESULT(SettingsItemKeyBufferNull, 204); + R_DEFINE_ERROR_RESULT(SettingsItemValueBufferNull, 205); + + R_DEFINE_ERROR_RESULT(SettingsNameEmpty, 221); + R_DEFINE_ERROR_RESULT(SettingsItemKeyEmpty, 222); + + R_DEFINE_ERROR_RESULT(SettingsNameTooLong, 241); + R_DEFINE_ERROR_RESULT(SettingsItemKeyTooLong, 242); + + R_DEFINE_ERROR_RESULT(SettingsNameInvalidFormat, 261); + R_DEFINE_ERROR_RESULT(SettingsItemKeyInvalidFormat, 262); + R_DEFINE_ERROR_RESULT(SettingsItemValueInvalidFormat, 263); + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/results/sf_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/sf_results.hpp new file mode 100644 index 0000000..1925255 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/sf_results.hpp @@ -0,0 +1,54 @@ +/* + * 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 "results_common.hpp" + +namespace ams::sf { + + R_DEFINE_NAMESPACE_RESULT_MODULE(10); + + R_DEFINE_ERROR_RESULT(NotSupported, 1); + R_DEFINE_ERROR_RESULT(PreconditionViolation, 3); + + namespace cmif { + + R_DEFINE_ERROR_RESULT(InvalidHeaderSize, 202); + R_DEFINE_ERROR_RESULT(InvalidInHeader, 211); + R_DEFINE_ERROR_RESULT(UnknownCommandId, 221); + R_DEFINE_ERROR_RESULT(InvalidOutRawSize, 232); + R_DEFINE_ERROR_RESULT(InvalidNumInObjects, 235); + R_DEFINE_ERROR_RESULT(InvalidNumOutObjects, 236); + R_DEFINE_ERROR_RESULT(InvalidInObject, 239); + + R_DEFINE_ERROR_RESULT(TargetNotFound, 261); + + R_DEFINE_ERROR_RESULT(OutOfDomainEntries, 301); + + } + + namespace impl { + + R_DEFINE_ABSTRACT_ERROR_RANGE(RequestContextChanged, 800, 899); + R_DEFINE_ABSTRACT_ERROR_RANGE(RequestInvalidated, 801, 809); + R_DEFINE_ERROR_RESULT(RequestInvalidatedByUser, 802); + + } + + R_DEFINE_ABSTRACT_ERROR_RANGE(RequestDeferred, 811, 819); + R_DEFINE_ERROR_RESULT(RequestDeferredByUser, 812); + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/results/sm_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/sm_results.hpp new file mode 100644 index 0000000..89829f7 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/sm_results.hpp @@ -0,0 +1,42 @@ +/* + * 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 "results_common.hpp" + +namespace ams::sm { + + R_DEFINE_NAMESPACE_RESULT_MODULE(21); + + R_DEFINE_ERROR_RESULT(OutOfProcesses, 1); + R_DEFINE_ERROR_RESULT(InvalidClient, 2); + R_DEFINE_ERROR_RESULT(OutOfSessions, 3); + R_DEFINE_ERROR_RESULT(AlreadyRegistered, 4); + R_DEFINE_ERROR_RESULT(OutOfServices, 5); + R_DEFINE_ERROR_RESULT(InvalidServiceName, 6); + R_DEFINE_ERROR_RESULT(NotRegistered, 7); + 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/stratosphere/libstratosphere/include/atmosphere/results/spl_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/spl_results.hpp new file mode 100644 index 0000000..0670c6f --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/spl_results.hpp @@ -0,0 +1,42 @@ +/* + * 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 "results_common.hpp" + +namespace ams::spl { + + R_DEFINE_NAMESPACE_RESULT_MODULE(26); + + R_DEFINE_ERROR_RANGE(SecureMonitorError, 0, 99); + R_DEFINE_ERROR_RESULT(SecureMonitorNotImplemented, 1); + R_DEFINE_ERROR_RESULT(SecureMonitorInvalidArgument, 2); + R_DEFINE_ERROR_RESULT(SecureMonitorBusy, 3); + R_DEFINE_ERROR_RESULT(SecureMonitorNoAsyncOperation, 4); + R_DEFINE_ERROR_RESULT(SecureMonitorInvalidAsyncOperation, 5); + R_DEFINE_ERROR_RESULT(SecureMonitorNotPermitted, 6); + + R_DEFINE_ERROR_RESULT(InvalidSize, 100); + R_DEFINE_ERROR_RESULT(UnknownSecureMonitorError, 101); + R_DEFINE_ERROR_RESULT(DecryptionFailed, 102); + + R_DEFINE_ERROR_RESULT(OutOfKeyslots, 104); + R_DEFINE_ERROR_RESULT(InvalidKeyslot, 105); + R_DEFINE_ERROR_RESULT(BootReasonAlreadySet, 106); + R_DEFINE_ERROR_RESULT(BootReasonNotSet, 107); + R_DEFINE_ERROR_RESULT(InvalidArgument, 108); + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/results/svc_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/svc_results.hpp new file mode 100644 index 0000000..8b5149e --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/svc_results.hpp @@ -0,0 +1,73 @@ +/* + * 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 "results_common.hpp" + +namespace ams::svc { + + R_DEFINE_NAMESPACE_RESULT_MODULE(1); + + R_DEFINE_ERROR_RESULT(OutOfSessions, 7); + + R_DEFINE_ERROR_RESULT(InvalidArgument, 14); + + R_DEFINE_ERROR_RESULT(NotImplemented, 33); + + R_DEFINE_ERROR_RESULT(ThreadTerminating, 59); + + R_DEFINE_ERROR_RESULT(NoEvent, 70); + + R_DEFINE_ERROR_RESULT(InvalidSize, 101); + R_DEFINE_ERROR_RESULT(InvalidAddress, 102); + R_DEFINE_ERROR_RESULT(OutOfResource, 103); + R_DEFINE_ERROR_RESULT(OutOfMemory, 104); + R_DEFINE_ERROR_RESULT(OutOfHandles, 105); + R_DEFINE_ERROR_RESULT(InvalidCurrentMemoryState, 106); + + R_DEFINE_ERROR_RESULT(InvalidNewMemoryPermissions, 108); + + R_DEFINE_ERROR_RESULT(InvalidMemoryRegion, 110); + + R_DEFINE_ERROR_RESULT(InvalidPriority, 112); + R_DEFINE_ERROR_RESULT(InvalidCoreId, 113); + R_DEFINE_ERROR_RESULT(InvalidHandle, 114); + R_DEFINE_ERROR_RESULT(InvalidPointer, 115); + R_DEFINE_ERROR_RESULT(InvalidCombination, 116); + R_DEFINE_ERROR_RESULT(TimedOut, 117); + R_DEFINE_ERROR_RESULT(Cancelled, 118); + R_DEFINE_ERROR_RESULT(OutOfRange, 119); + R_DEFINE_ERROR_RESULT(InvalidEnumValue, 120); + R_DEFINE_ERROR_RESULT(NotFound, 121); + R_DEFINE_ERROR_RESULT(Busy, 122); + R_DEFINE_ERROR_RESULT(SessionClosed, 123); + R_DEFINE_ERROR_RESULT(NotHandled, 124); + R_DEFINE_ERROR_RESULT(InvalidState, 125); + R_DEFINE_ERROR_RESULT(ReservedValue, 126); + R_DEFINE_ERROR_RESULT(NotSupported, 127); + R_DEFINE_ERROR_RESULT(Debug, 128); + R_DEFINE_ERROR_RESULT(ThreadNotOwned, 129); + + R_DEFINE_ERROR_RESULT(PortClosed, 131); + R_DEFINE_ERROR_RESULT(LimitReached, 132); + + R_DEFINE_ERROR_RESULT(ReceiveListBroken, 258); + R_DEFINE_ERROR_RESULT(OutOfAddressSpace, 259); + R_DEFINE_ERROR_RESULT(MessageTooLarge, 260); + + R_DEFINE_ERROR_RESULT(ProcessTerminated, 520); + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/results/updater_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/updater_results.hpp new file mode 100644 index 0000000..ea40f96 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/updater_results.hpp @@ -0,0 +1,30 @@ +/* + * 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 "results_common.hpp" + +namespace ams::updater { + + R_DEFINE_NAMESPACE_RESULT_MODULE(158); + + R_DEFINE_ERROR_RESULT(BootImagePackageNotFound, 2); + R_DEFINE_ERROR_RESULT(InvalidBootImagePackage, 3); + R_DEFINE_ERROR_RESULT(TooSmallWorkBuffer, 4); + R_DEFINE_ERROR_RESULT(NotAlignedWorkBuffer, 5); + R_DEFINE_ERROR_RESULT(NeedsRepairBootImages, 6); + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/results/vi_results.hpp b/stratosphere/libstratosphere/include/atmosphere/results/vi_results.hpp new file mode 100644 index 0000000..30b5190 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/results/vi_results.hpp @@ -0,0 +1,28 @@ +/* + * 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 "results_common.hpp" + +namespace ams::vi { + + R_DEFINE_NAMESPACE_RESULT_MODULE(114); + + R_DEFINE_ERROR_RESULT(OperationFailed, 1); + R_DEFINE_ERROR_RESULT(NotSupported, 6); + R_DEFINE_ERROR_RESULT(NotFound, 7); + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/svc.hpp b/stratosphere/libstratosphere/include/atmosphere/svc.hpp new file mode 100644 index 0000000..fce8871 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/svc.hpp @@ -0,0 +1,21 @@ +/* + * 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 "defines.hpp" +#include "results.hpp" + +#include "svc/svc_types.hpp" diff --git a/stratosphere/libstratosphere/include/atmosphere/svc/svc_types.hpp b/stratosphere/libstratosphere/include/atmosphere/svc/svc_types.hpp new file mode 100644 index 0000000..cc4bb44 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/svc/svc_types.hpp @@ -0,0 +1,208 @@ +/* + * 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 "../results.hpp" + +namespace ams::svc { + + /* Debug event types. */ + enum class DebugEventType : u32 { + AttachProcess = 0, + AttachThread = 1, + ExitProcess = 2, + ExitThread = 3, + Exception = 4, + }; + + struct DebugInfoAttachProcess { + u64 title_id; + u64 process_id; + char name[0xC]; + u32 flags; + u64 user_exception_context_address; /* 5.0.0+ */ + }; + + struct DebugInfoAttachThread { + u64 thread_id; + u64 tls_address; + u64 entrypoint; + }; + + enum class ExitProcessReason : u32 { + ExitProcess = 0, + TerminateProcess = 1, + Exception = 2, + }; + + struct DebugInfoExitProcess { + ExitProcessReason reason; + }; + + enum class ExitThreadReason : u32 { + ExitThread = 0, + TerminateThread = 1, + ExitProcess = 2, + TerminateProcess = 3, + }; + + struct DebugInfoExitThread { + ExitThreadReason reason; + }; + + enum class DebugExceptionType : u32 { + UndefinedInstruction = 0, + InstructionAbort = 1, + DataAbort = 2, + AlignmentFault = 3, + DebuggerAttached = 4, + BreakPoint = 5, + UserBreak = 6, + DebuggerBreak = 7, + UndefinedSystemCall = 8, + SystemMemoryError = 9, + }; + + struct DebugInfoUndefinedInstructionException { + u32 insn; + }; + + struct DebugInfoDataAbortException { + u64 address; + }; + + struct DebugInfoAligntmentFaultException { + u64 address; + }; + + enum class BreakPointType : u32 { + BreakPoint = 0, + WatchPoint = 1, + }; + + struct DebugInfoBreakPointException { + BreakPointType type; + u64 address; + }; + + struct DebugInfoUserBreakException { + u32 break_reason; /* TODO: enum? */ + u64 address; + u64 size; + }; + + struct DebugInfoDebuggerBreakException { + u64 active_thread_ids[4]; + }; + + struct DebugInfoUndefinedSystemCallException { + u32 id; + }; + + union DebugInfoSpecificException { + DebugInfoUndefinedInstructionException undefined_instruction; + DebugInfoDataAbortException data_abort; + DebugInfoAligntmentFaultException alignment_fault; + DebugInfoBreakPointException break_point; + DebugInfoUserBreakException user_break; + DebugInfoDebuggerBreakException debugger_break; + DebugInfoUndefinedSystemCallException undefined_system_call; + u64 raw; + }; + + struct DebugInfoException { + DebugExceptionType type; + u64 address; + DebugInfoSpecificException specific; + }; + + union DebugInfo { + DebugInfoAttachProcess attach_process; + DebugInfoAttachThread attach_thread; + DebugInfoExitProcess exit_process; + DebugInfoExitThread exit_thread; + DebugInfoException exception; + }; + + struct DebugEventInfo { + DebugEventType type; + u32 flags; + u64 thread_id; + DebugInfo info; + }; + static_assert(sizeof(DebugEventInfo) >= 0x40, "DebugEventInfo definition!"); + + /* Thread State, for svcGetDebugThreadParam. */ + enum class ThreadState : u32 { + Waiting = 0, + Running = 1, + Terminated = 4, + Initializing = 5, + }; + + enum ThreadContextFlag : u32 { + ThreadContextFlag_General = (1 << 0), + ThreadContextFlag_Control = (1 << 1), + ThreadContextFlag_Fpu = (1 << 2), + ThreadContextFlag_FpuControl = (1 << 3), + + ThreadContextFlag_All = (ThreadContextFlag_General | ThreadContextFlag_Control | ThreadContextFlag_Fpu | ThreadContextFlag_FpuControl), + }; + + /* Flags for svcCreateProcess. */ + enum CreateProcessFlag : u32 { + /* Is 64 bit? */ + CreateProcessFlag_Is64Bit = (1 << 0), + + /* What kind of address space? */ + CreateProcessFlag_AddressSpaceShift = 1, + CreateProcessFlag_AddressSpaceMask = (7 << CreateProcessFlag_AddressSpaceShift), + CreateProcessFlag_AddressSpace32Bit = (0 << CreateProcessFlag_AddressSpaceShift), + CreateProcessFlag_AddressSpace64BitDeprecated = (1 << CreateProcessFlag_AddressSpaceShift), + CreateProcessFlag_AddressSpace32BitWithoutAlias = (2 << CreateProcessFlag_AddressSpaceShift), + CreateProcessFlag_AddressSpace64Bit = (3 << CreateProcessFlag_AddressSpaceShift), + + /* Should JIT debug be done on crash? */ + CreateProcessFlag_EnableDebug = (1 << 4), + + /* Should ASLR be enabled for the process? */ + CreateProcessFlag_EnableAslr = (1 << 5), + + /* Is the process an application? */ + CreateProcessFlag_IsApplication = (1 << 6), + + /* 4.x deprecated: Should use secure memory? */ + CreateProcessFlag_DeprecatedUseSecureMemory = (1 << 7), + + /* 5.x+ Pool partition type. */ + CreateProcessFlag_PoolPartitionShift = 7, + CreateProcessFlag_PoolPartitionMask = (0xF << CreateProcessFlag_PoolPartitionShift), + CreateProcessFlag_PoolPartitionApplication = (0 << CreateProcessFlag_PoolPartitionShift), + CreateProcessFlag_PoolPartitionApplet = (1 << CreateProcessFlag_PoolPartitionShift), + CreateProcessFlag_PoolPartitionSystem = (2 << CreateProcessFlag_PoolPartitionShift), + CreateProcessFlag_PoolPartitionSystemNonSecure = (3 << CreateProcessFlag_PoolPartitionShift), + + /* 7.x+ Should memory allocation be optimized? This requires IsApplication. */ + CreateProcessFlag_OptimizeMemoryAllocation = (1 << 11), + }; + + /* Type for svcCreateInterruptEvent. */ + enum InterruptType : u32 { + InterruptType_Edge = 0, + InterruptType_Level = 1, + }; + +} diff --git a/stratosphere/libstratosphere/include/atmosphere/util.hpp b/stratosphere/libstratosphere/include/atmosphere/util.hpp new file mode 100644 index 0000000..c058362 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/util.hpp @@ -0,0 +1,27 @@ +/* + * 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 "defines.hpp" + +#include "util/util_alignment.hpp" +#include "util/util_size.hpp" +#include "util/util_scope_guard.hpp" +#include "util/util_typed_storage.hpp" +#include "util/util_intrusive_list.hpp" +#include "util/util_intrusive_red_black_tree.hpp" +#include "util/util_compression.hpp" +#include "util/util_ini.hpp" diff --git a/stratosphere/libstratosphere/include/atmosphere/util/util_alignment.hpp b/stratosphere/libstratosphere/include/atmosphere/util/util_alignment.hpp new file mode 100644 index 0000000..36f28e7 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/util/util_alignment.hpp @@ -0,0 +1,75 @@ +/* + * 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 "../defines.hpp" + +namespace ams::util { + + /* Utilities for alignment to power of two. */ + + template + constexpr inline T AlignUp(T value, size_t alignment) { + using U = typename std::make_unsigned::type; + const U invmask = static_cast(alignment - 1); + return static_cast((value + invmask) & ~invmask); + } + + template + constexpr inline T AlignDown(T value, size_t alignment) { + using U = typename std::make_unsigned::type; + const U invmask = static_cast(alignment - 1); + return static_cast(value & ~invmask); + } + + template + constexpr inline bool IsAligned(T value, size_t alignment) { + using U = typename std::make_unsigned::type; + const U invmask = static_cast(alignment - 1); + return (value & invmask) == 0; + } + + template<> + constexpr inline void *AlignUp(void *value, size_t alignment) { + return reinterpret_cast(AlignUp(reinterpret_cast(value), alignment)); + } + + template<> + constexpr inline const void *AlignUp(const void *value, size_t alignment) { + return reinterpret_cast(AlignUp(reinterpret_cast(value), alignment)); + } + + template<> + constexpr inline void *AlignDown(void *value, size_t alignment) { + return reinterpret_cast(AlignDown(reinterpret_cast(value), alignment)); + } + + template<> + constexpr inline const void *AlignDown(const void *value, size_t alignment) { + return reinterpret_cast(AlignDown(reinterpret_cast(value), alignment)); + } + + template<> + constexpr inline bool IsAligned(void *value, size_t alignment) { + return IsAligned(reinterpret_cast(value), alignment); + } + + template<> + constexpr inline bool IsAligned(const void *value, size_t alignment) { + return IsAligned(reinterpret_cast(value), alignment); + } + +} \ No newline at end of file diff --git a/stratosphere/libstratosphere/include/atmosphere/util/util_compression.hpp b/stratosphere/libstratosphere/include/atmosphere/util/util_compression.hpp new file mode 100644 index 0000000..3f310ae --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/util/util_compression.hpp @@ -0,0 +1,28 @@ +/* + * 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 "../defines.hpp" + +namespace ams::util { + + /* Compression utilities. */ + int CompressLZ4(void *dst, size_t dst_size, const void *src, size_t src_size); + + /* Decompression utilities. */ + int DecompressLZ4(void *dst, size_t dst_size, const void *src, size_t src_size); + +} \ No newline at end of file diff --git a/stratosphere/libstratosphere/include/atmosphere/util/util_ini.hpp b/stratosphere/libstratosphere/include/atmosphere/util/util_ini.hpp new file mode 100644 index 0000000..7815820 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/util/util_ini.hpp @@ -0,0 +1,31 @@ +/* + * 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 "../defines.hpp" + +namespace ams::util::ini { + + /* Ini handler type. */ + using Handler = int (*)(void *user_ctx, const char *section, const char *name, const char *value); + + /* Utilities for dealing with INI file configuration. */ + int ParseString(const char *ini_str, void *user_ctx, Handler h); + int ParseFile(FILE *f, void *user_ctx, Handler h); + int ParseFile(FsFile *f, void *user_ctx, Handler h); + int ParseFile(const char *path, void *user_ctx, Handler h); + +} \ No newline at end of file diff --git a/stratosphere/libstratosphere/include/atmosphere/util/util_intrusive_list.hpp b/stratosphere/libstratosphere/include/atmosphere/util/util_intrusive_list.hpp new file mode 100644 index 0000000..df74896 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/util/util_intrusive_list.hpp @@ -0,0 +1,595 @@ +/* + * 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 "util_parent_of_member.hpp" + +namespace ams::util { + + /* Forward declare implementation class for Node. */ + namespace impl { + + class IntrusiveListImpl; + + } + + class IntrusiveListNode { + NON_COPYABLE(IntrusiveListNode); + private: + friend class impl::IntrusiveListImpl; + + IntrusiveListNode *prev; + IntrusiveListNode *next; + public: + IntrusiveListNode() { + this->prev = this; + this->next = this; + } + + bool IsLinked() const { + return this->next != this; + } + private: + void LinkPrev(IntrusiveListNode *node) { + /* We can't link an already linked node. */ + AMS_ASSERT(!node->IsLinked()); + this->SplicePrev(node, node); + } + + void SplicePrev(IntrusiveListNode *first, IntrusiveListNode *last) { + /* Splice a range into the list. */ + auto last_prev = last->prev; + first->prev = this->prev; + this->prev->next = first; + last_prev->next = this; + this->prev = last_prev; + } + + void LinkNext(IntrusiveListNode *node) { + /* We can't link an already linked node. */ + AMS_ASSERT(!node->IsLinked()); + return this->SpliceNext(node, node); + } + + void SpliceNext(IntrusiveListNode *first, IntrusiveListNode *last) { + /* Splice a range into the list. */ + auto last_prev = last->prev; + first->prev = this; + this->next = first; + last_prev->next = next; + this->next->prev = last_prev; + } + + void Unlink() { + this->Unlink(this->next); + } + + void Unlink(IntrusiveListNode *last) { + /* Unlink a node from a next node. */ + auto last_prev = last->prev; + this->prev->next = last; + last->prev = this->prev; + last_prev->next = this; + this->prev = last_prev; + } + + IntrusiveListNode *GetPrev() { + return this->prev; + } + + const IntrusiveListNode *GetPrev() const { + return this->prev; + } + + IntrusiveListNode *GetNext() { + return this->next; + } + + const IntrusiveListNode *GetNext() const { + return this->next; + } + }; + + namespace impl { + + class IntrusiveListImpl { + NON_COPYABLE(IntrusiveListImpl); + private: + IntrusiveListNode root_node; + public: + template + class Iterator; + + using value_type = IntrusiveListNode; + using size_type = size_t; + using difference_type = ptrdiff_t; + using pointer = value_type *; + using const_pointer = const value_type *; + using reference = value_type &; + using const_reference = const value_type &; + using iterator = Iterator; + using const_iterator = Iterator; + using reverse_iterator = std::reverse_iterator; + using const_reverse_iterator = std::reverse_iterator; + + template + class Iterator { + public: + using iterator_category = std::bidirectional_iterator_tag; + using value_type = typename IntrusiveListImpl::value_type; + using difference_type = typename IntrusiveListImpl::difference_type; + using pointer = typename std::conditional::type; + using reference = typename std::conditional::type; + private: + pointer node; + public: + explicit Iterator(pointer n) : node(n) { /* ... */ } + + bool operator==(const Iterator &rhs) const { + return this->node == rhs.node; + } + + bool operator!=(const Iterator &rhs) const { + return !(*this == rhs); + } + + pointer operator->() const { + return this->node; + } + + reference operator*() const { + return *this->node; + } + + Iterator &operator++() { + this->node = this->node->next; + return *this; + } + + Iterator &operator--() { + this->node = this->node->prev; + return *this; + } + + Iterator operator++(int) { + const Iterator it{*this}; + ++(*this); + return it; + } + + Iterator operator--(int) { + const Iterator it{*this}; + --(*this); + return it; + } + + operator Iterator() const { + return Iterator(this->node); + } + + Iterator GetNonConstIterator() const { + return Iterator(const_cast(this->node)); + } + }; + public: + IntrusiveListImpl() : root_node() { /* ... */ } + + /* Iterator accessors. */ + iterator begin() { + return iterator(this->root_node.GetNext()); + } + + const_iterator begin() const { + return const_iterator(this->root_node.GetNext()); + } + + iterator end() { + return iterator(&this->root_node); + } + + const_iterator end() const { + return const_iterator(&this->root_node); + } + + iterator iterator_to(reference v) { + /* Only allow iterator_to for values in lists. */ + AMS_ASSERT(v.IsLinked()); + return iterator(&v); + } + + const_iterator iterator_to(const_reference v) const { + /* Only allow iterator_to for values in lists. */ + AMS_ASSERT(v.IsLinked()); + return const_iterator(&v); + } + + /* Content management. */ + bool empty() const { + return !this->root_node.IsLinked(); + } + + size_type size() const { + return static_cast(std::distance(this->begin(), this->end())); + } + + reference back() { + return *this->root_node.GetPrev(); + } + + const_reference back() const { + return *this->root_node.GetPrev(); + } + + reference front() { + return *this->root_node.GetNext(); + } + + const_reference front() const { + return *this->root_node.GetNext(); + } + + void push_back(reference node) { + this->root_node.LinkPrev(&node); + } + + void push_front(reference node) { + this->root_node.LinkNext(&node); + } + + void pop_back() { + this->root_node.GetPrev()->Unlink(); + } + + void pop_front() { + this->root_node.GetNext()->Unlink(); + } + + iterator insert(const_iterator pos, reference node) { + pos.GetNonConstIterator()->LinkPrev(&node); + return iterator(&node); + } + + void splice(const_iterator pos, IntrusiveListImpl &o) { + splice_impl(pos, o.begin(), o.end()); + } + + void splice(const_iterator pos, IntrusiveListImpl &o, const_iterator first) { + const_iterator last(first); + std::advance(last, 1); + splice_impl(pos, first, last); + } + + void splice(const_iterator pos, IntrusiveListImpl &o, const_iterator first, const_iterator last) { + splice_impl(pos, first, last); + } + + iterator erase(const iterator pos) { + if (pos == this->end()) { + return this->end(); + } + iterator it(pos.GetNonConstIterator()); + (it++)->Unlink(); + return it; + } + + void clear() { + while (!this->empty()) { + this->pop_front(); + } + } + private: + void splice_impl(const_iterator _pos, const_iterator _first, const_iterator _last) { + if (_first == _last) { + return; + } + iterator pos(_pos.GetNonConstIterator()); + iterator first(_first.GetNonConstIterator()); + iterator last(_last.GetNonConstIterator()); + first->Unlink(&*last); + pos->SplicePrev(&*first, &*first); + } + + }; + + } + + template + class IntrusiveList { + NON_COPYABLE(IntrusiveList); + private: + impl::IntrusiveListImpl impl; + public: + template + class Iterator; + + using value_type = T; + using size_type = size_t; + using difference_type = ptrdiff_t; + using pointer = value_type *; + using const_pointer = const value_type *; + using reference = value_type &; + using const_reference = const value_type &; + using iterator = Iterator; + using const_iterator = Iterator; + using reverse_iterator = std::reverse_iterator; + using const_reverse_iterator = std::reverse_iterator; + + template + class Iterator { + public: + friend class ams::util::IntrusiveList; + + using ImplIterator = typename std::conditional::type; + + using iterator_category = std::bidirectional_iterator_tag; + using value_type = typename IntrusiveList::value_type; + using difference_type = typename IntrusiveList::difference_type; + using pointer = typename std::conditional::type; + using reference = typename std::conditional::type; + private: + ImplIterator iterator; + private: + explicit Iterator(ImplIterator it) : iterator(it) { /* ... */ } + + ImplIterator GetImplIterator() const { + return this->iterator; + } + public: + bool operator==(const Iterator &rhs) const { + return this->iterator == rhs.iterator; + } + + bool operator!=(const Iterator &rhs) const { + return !(*this == rhs); + } + + pointer operator->() const { + return &Traits::GetParent(*this->iterator); + } + + reference operator*() const { + return Traits::GetParent(*this->iterator); + } + + Iterator &operator++() { + ++this->iterator; + return *this; + } + + Iterator &operator--() { + --this->iterator; + return *this; + } + + Iterator operator++(int) { + const Iterator it{*this}; + ++this->iterator; + return it; + } + + Iterator operator--(int) { + const Iterator it{*this}; + --this->iterator; + return it; + } + + operator Iterator() const { + return Iterator(this->iterator); + } + }; + private: + static constexpr IntrusiveListNode &GetNode(reference ref) { + return Traits::GetNode(ref); + } + + static constexpr IntrusiveListNode const &GetNode(const_reference ref) { + return Traits::GetNode(ref); + } + + static constexpr reference GetParent(IntrusiveListNode &node) { + return Traits::GetParent(node); + } + + static constexpr const_reference GetParent(IntrusiveListNode const &node) { + return Traits::GetParent(node); + } + public: + IntrusiveList() : impl() { /* ... */ } + + /* Iterator accessors. */ + iterator begin() { + return iterator(this->impl.begin()); + } + + const_iterator begin() const { + return const_iterator(this->impl.begin()); + } + + iterator end() { + return iterator(this->impl.end()); + } + + const_iterator end() const { + return const_iterator(this->impl.end()); + } + + const_iterator cbegin() const { + return this->begin(); + } + + const_iterator cend() const { + return this->end(); + } + + reverse_iterator rbegin() { + return reverse_iterator(this->end()); + } + + const_reverse_iterator rbegin() const { + return const_reverse_iterator(this->end()); + } + + reverse_iterator rend() { + return reverse_iterator(this->begin()); + } + + const_reverse_iterator rend() const { + return const_reverse_iterator(this->begin()); + } + + const_reverse_iterator crbegin() const { + return this->rbegin(); + } + + const_reverse_iterator crend() const { + return this->rend(); + } + + iterator iterator_to(reference v) { + return iterator(this->impl.iterator_to(GetNode(v))); + } + + const_iterator iterator_to(const_reference v) const { + return const_iterator(this->impl.iterator_to(GetNode(v))); + } + + /* Content management. */ + bool empty() const { + return this->impl.empty(); + } + + size_type size() const { + return this->impl.size(); + } + + reference back() { + AMS_ASSERT(!this->impl.empty()); + return GetParent(this->impl.back()); + } + + const_reference back() const { + AMS_ASSERT(!this->impl.empty()); + return GetParent(this->impl.back()); + } + + reference front() { + AMS_ASSERT(!this->impl.empty()); + return GetParent(this->impl.front()); + } + + const_reference front() const { + AMS_ASSERT(!this->impl.empty()); + return GetParent(this->impl.front()); + } + + void push_back(reference ref) { + this->impl.push_back(GetNode(ref)); + } + + void push_front(reference ref) { + this->impl.push_back(GetNode(ref)); + } + + void pop_back() { + AMS_ASSERT(!this->impl.empty()); + this->impl.pop_back(); + } + + void pop_front() { + AMS_ASSERT(!this->impl.empty()); + this->impl.pop_front(); + } + + iterator insert(const_iterator pos, reference ref) { + return iterator(this->impl.insert(pos.GetImplIterator(), GetNode(ref))); + } + + void splice(const_iterator pos, IntrusiveList &o) { + this->impl.splice(pos.GetImplIterator(), o.impl); + } + + void splice(const_iterator pos, IntrusiveList &o, const_iterator first) { + this->impl.splice(pos.GetImplIterator(), o.impl, first.GetImplIterator()); + } + + void splice(const_iterator pos, IntrusiveList &o, const_iterator first, const_iterator last) { + this->impl.splice(pos.GetImplIterator(), o.impl, first.GetImplIterator(), last.GetImplIterator()); + } + + iterator erase(const iterator pos) { + return iterator(this->impl.erase(pos.GetImplIterator())); + } + + void clear() { + this->impl.clear(); + } + }; + + template> + class IntrusiveListMemberTraits; + + template + class IntrusiveListMemberTraits { + public: + using ListType = IntrusiveList; + private: + friend class IntrusiveList; + + static constexpr IntrusiveListNode &GetNode(Derived &parent) { + return parent.*Member; + } + + static constexpr IntrusiveListNode const &GetNode(Derived const &parent) { + return parent.*Member; + } + + static constexpr Derived &GetParent(IntrusiveListNode &node) { + return static_cast(util::GetParentReference(&node)); + } + + static constexpr Derived const &GetParent(IntrusiveListNode const &node) { + return static_cast(util::GetParentReference(&node)); + } + }; + + template + class IntrusiveListBaseNode : public IntrusiveListNode{}; + + template + class IntrusiveListBaseTraits { + public: + using ListType = IntrusiveList; + private: + friend class IntrusiveList; + + static constexpr IntrusiveListNode &GetNode(Derived &parent) { + return static_cast(parent); + } + + static constexpr IntrusiveListNode const &GetNode(Derived const &parent) { + return static_cast(parent); + } + + static constexpr Derived &GetParent(IntrusiveListNode &node) { + return static_cast(node); + } + + static constexpr Derived const &GetParent(IntrusiveListNode const &node) { + return static_cast(node); + } + }; + +} \ No newline at end of file diff --git a/stratosphere/libstratosphere/include/atmosphere/util/util_intrusive_red_black_tree.hpp b/stratosphere/libstratosphere/include/atmosphere/util/util_intrusive_red_black_tree.hpp new file mode 100644 index 0000000..088286d --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/util/util_intrusive_red_black_tree.hpp @@ -0,0 +1,297 @@ +/* + * 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 "util_parent_of_member.hpp" + +namespace ams::util { + + struct IntrusiveRedBlackTreeNode { + NON_COPYABLE(IntrusiveRedBlackTreeNode); + private: + RB_ENTRY(IntrusiveRedBlackTreeNode) entry; + + template + friend class IntrusiveRedBlackTree; + public: + IntrusiveRedBlackTreeNode() { /* ... */} + }; + + template + class IntrusiveRedBlackTree { + NON_COPYABLE(IntrusiveRedBlackTree); + private: + RB_HEAD(IntrusiveRedBlackTreeRoot, IntrusiveRedBlackTreeNode); + + IntrusiveRedBlackTreeRoot root; + public: + template + class Iterator; + + using value_type = T; + using size_type = size_t; + using difference_type = ptrdiff_t; + using pointer = T *; + using const_pointer = const T *; + using reference = T &; + using const_reference = const T &; + using iterator = Iterator; + using const_iterator = Iterator; + + template + class Iterator { + public: + using iterator_category = std::bidirectional_iterator_tag; + using value_type = typename IntrusiveRedBlackTree::value_type; + using difference_type = typename IntrusiveRedBlackTree::difference_type; + using pointer = typename std::conditional::type; + using reference = typename std::conditional::type; + private: + pointer node; + public: + explicit Iterator(pointer n) : node(n) { /* ... */ } + + bool operator==(const Iterator &rhs) const { + return this->node == rhs.node; + } + + bool operator!=(const Iterator &rhs) const { + return !(*this == rhs); + } + + pointer operator->() const { + return this->node; + } + + reference operator*() const { + return *this->node; + } + + Iterator &operator++() { + this->node = Traits::GetParent(GetNext(Traits::GetNode(this->node))); + return *this; + } + + Iterator &operator--() { + this->node = Traits::GetParent(GetPrev(Traits::GetNode(this->node))); + return *this; + } + + Iterator operator++(int) { + const Iterator it{*this}; + ++(*this); + return it; + } + + Iterator operator--(int) { + const Iterator it{*this}; + --(*this); + return it; + } + + operator Iterator() const { + return Iterator(this->node); + } + }; + private: + static int CompareImpl(const IntrusiveRedBlackTreeNode *lhs, const IntrusiveRedBlackTreeNode *rhs) { + return Comparator::Compare(*Traits::GetParent(lhs), *Traits::GetParent(rhs)); + } + + /* Generate static implementations for IntrusiveRedBlackTreeRoot. */ + RB_GENERATE_STATIC(IntrusiveRedBlackTreeRoot, IntrusiveRedBlackTreeNode, entry, CompareImpl); + + static constexpr inline IntrusiveRedBlackTreeNode *GetNext(IntrusiveRedBlackTreeNode *node) { + return RB_NEXT(IntrusiveRedBlackTreeRoot, nullptr, node); + } + + static constexpr inline IntrusiveRedBlackTreeNode const *GetNext(IntrusiveRedBlackTreeNode const *node) { + return const_cast(GetNext(const_cast(node))); + } + + static constexpr inline IntrusiveRedBlackTreeNode *GetPrev(IntrusiveRedBlackTreeNode *node) { + return RB_NEXT(IntrusiveRedBlackTreeRoot, nullptr, node); + } + + static constexpr inline IntrusiveRedBlackTreeNode const *GetPrev(IntrusiveRedBlackTreeNode const *node) { + return const_cast(GetPrev(const_cast(node))); + } + + /* Define accessors using RB_* functions. */ + void InitializeImpl() { + RB_INIT(&this->root); + } + + bool EmptyImpl() const { + return RB_EMPTY(&this->root); + } + + IntrusiveRedBlackTreeNode *GetMinImpl() const { + return RB_MIN(IntrusiveRedBlackTreeRoot, const_cast(&this->root)); + } + + IntrusiveRedBlackTreeNode *GetMaxImpl() const { + return RB_MIN(IntrusiveRedBlackTreeRoot, const_cast(&this->root)); + } + + IntrusiveRedBlackTreeNode *InsertImpl(IntrusiveRedBlackTreeNode *node) { + return RB_INSERT(IntrusiveRedBlackTreeRoot, &this->root, node); + } + + IntrusiveRedBlackTreeNode *RemoveImpl(IntrusiveRedBlackTreeNode *node) { + return RB_REMOVE(IntrusiveRedBlackTreeRoot, &this->root, node); + } + + IntrusiveRedBlackTreeNode *FindImpl(IntrusiveRedBlackTreeNode const *node) const { + return RB_FIND(IntrusiveRedBlackTreeRoot, const_cast(&this->root), const_cast(node)); + } + + IntrusiveRedBlackTreeNode *NFindImpl(IntrusiveRedBlackTreeNode const *node) const { + return RB_NFIND(IntrusiveRedBlackTreeRoot, const_cast(&this->root), const_cast(node)); + } + + public: + IntrusiveRedBlackTree() { + this->InitializeImpl(); + } + + /* Iterator accessors. */ + iterator begin() { + return iterator(Traits::GetParent(this->GetMinImpl())); + } + + const_iterator begin() const { + return const_iterator(Traits::GetParent(this->GetMinImpl())); + } + + iterator end() { + return iterator(Traits::GetParent(static_cast(nullptr))); + } + + const_iterator end() const { + return const_iterator(Traits::GetParent(static_cast(nullptr))); + } + + iterator iterator_to(reference ref) { + return iterator(&ref); + } + + const_iterator iterator_to(const_reference ref) const { + return const_iterator(&ref); + } + + /* Content management. */ + bool empty() const { + return this->EmptyImpl(); + } + + reference back() { + return Traits::GetParent(this->GetMaxImpl()); + } + + const_reference back() const { + return Traits::GetParent(this->GetMaxImpl()); + } + + reference front() { + return Traits::GetParent(this->GetMinImpl()); + } + + const_reference front() const { + return Traits::GetParent(this->GetMinImpl()); + } + + iterator insert(reference ref) { + this->InsertImpl(Traits::GetNode(&ref)); + return iterator(&ref); + } + + iterator erase(iterator it) { + auto cur = Traits::GetNode(&*it); + auto next = Traits::GetParent(GetNext(cur)); + this->RemoveImpl(cur); + return iterator(next); + } + + iterator find(const_reference ref) const { + return iterator(Traits::GetParent(this->FindImpl(Traits::GetNode(&ref)))); + } + + iterator nfind(const_reference ref) const { + return iterator(Traits::GetParent(this->NFindImpl(Traits::GetNode(&ref)))); + } + }; + + template> + class IntrusiveRedBlackTreeMemberTraits; + + template + class IntrusiveRedBlackTreeMemberTraits { + public: + template + using ListType = IntrusiveRedBlackTree; + private: + template + friend class IntrusiveRedBlackTree; + + static constexpr IntrusiveRedBlackTreeNode *GetNode(Derived *parent) { + return &(parent->*Member); + } + + static constexpr IntrusiveRedBlackTreeNode const *GetNode(Derived const *parent) { + return &(parent->*Member); + } + + static constexpr Derived *GetParent(IntrusiveRedBlackTreeNode *node) { + return static_cast(util::GetParentPointer(node)); + } + + static constexpr Derived const *GetParent(IntrusiveRedBlackTreeNode const *node) { + return static_cast(util::GetParentPointer(node)); + } + }; + + template + class IntrusiveRedBlackTreeBaseNode : public IntrusiveRedBlackTreeNode{}; + + template + class IntrusiveRedBlackTreeBaseTraits { + public: + template + using ListType = IntrusiveRedBlackTree; + private: + template + friend class IntrusiveRedBlackTree; + + static constexpr IntrusiveRedBlackTreeNode *GetNode(Derived *parent) { + return static_cast(parent); + } + + static constexpr IntrusiveRedBlackTreeNode const *GetNode(Derived const *parent) { + return static_cast(parent); + } + + static constexpr Derived *GetParent(IntrusiveRedBlackTreeNode *node) { + return static_cast(node); + } + + static constexpr Derived const *GetParent(IntrusiveRedBlackTreeNode const *node) { + return static_cast(node); + } + }; + +} \ No newline at end of file diff --git a/stratosphere/libstratosphere/include/atmosphere/util/util_parent_of_member.hpp b/stratosphere/libstratosphere/include/atmosphere/util/util_parent_of_member.hpp new file mode 100644 index 0000000..4402e92 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/util/util_parent_of_member.hpp @@ -0,0 +1,77 @@ +/* + * 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 "../defines.hpp" + +namespace ams::util { + + namespace impl { + + template + union OffsetOfImpl { + Member Parent::* ptr; + intptr_t offset; + }; + + template + constexpr inline Parent *GetParentOfMemberImpl(Member *member, Member Parent::* ptr) { + return reinterpret_cast(reinterpret_cast(member) - OffsetOfImpl{ ptr }.offset); + } + + template + constexpr inline Parent const *GetParentOfMemberImpl(Member const *member, Member Parent::* ptr) { + return reinterpret_cast(reinterpret_cast(member) - OffsetOfImpl{ ptr }.offset); + } + + template + struct GetMemberPointerTraits; + + template + struct GetMemberPointerTraits { + using Parent = P; + using Member = M; + }; + + template + using GetParentType = typename GetMemberPointerTraits::Parent; + + template + using GetMemberType = typename GetMemberPointerTraits::Member; + + } + + template + constexpr inline impl::GetParentType *GetParentPointer(impl::GetMemberType *member) { + return impl::GetParentOfMemberImpl, impl::GetMemberType>(member, MemberPtr); + } + + template + constexpr inline impl::GetParentType const *GetParentPointer(impl::GetMemberType const *member) { + return impl::GetParentOfMemberImpl, impl::GetMemberType>(member, MemberPtr); + } + + template + constexpr inline impl::GetParentType &GetParentReference(impl::GetMemberType *member) { + return *impl::GetParentOfMemberImpl, impl::GetMemberType>(member, MemberPtr); + } + + template + constexpr inline impl::GetParentType const &GetParentReference(impl::GetMemberType const *member) { + return *impl::GetParentOfMemberImpl, impl::GetMemberType>(member, MemberPtr); + } + +} \ No newline at end of file diff --git a/stratosphere/libstratosphere/include/atmosphere/util/util_scope_guard.hpp b/stratosphere/libstratosphere/include/atmosphere/util/util_scope_guard.hpp new file mode 100644 index 0000000..a48d825 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/util/util_scope_guard.hpp @@ -0,0 +1,58 @@ +/* + * 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 . + */ + + /* Scope guard logic lovingly taken from Andrei Alexandrescu's "Systemic Error Handling in C++" */ +#pragma once +#include "../defines.hpp" + +namespace ams::util { + + namespace impl { + + template + class ScopeGuard { + NON_COPYABLE(ScopeGuard); + private: + F f; + bool active; + public: + constexpr ScopeGuard(F f) : f(std::move(f)), active(true) { } + ~ScopeGuard() { if (active) { f(); } } + void Cancel() { active = false; } + + ScopeGuard(ScopeGuard&& rhs) : f(std::move(rhs.f)), active(rhs.active) { + rhs.Cancel(); + } + }; + + template + constexpr ScopeGuard MakeScopeGuard(F f) { + return ScopeGuard(std::move(f)); + } + + enum class ScopeGuardOnExit {}; + + template + constexpr ScopeGuard operator+(ScopeGuardOnExit, F&& f) { + return ScopeGuard(std::forward(f)); + } + + } + +} + +#define SCOPE_GUARD ::ams::util::impl::ScopeGuardOnExit() + [&]() +#define ON_SCOPE_EXIT auto ANONYMOUS_VARIABLE(SCOPE_EXIT_STATE_) = SCOPE_GUARD diff --git a/stratosphere/libstratosphere/include/atmosphere/util/util_size.hpp b/stratosphere/libstratosphere/include/atmosphere/util/util_size.hpp new file mode 100644 index 0000000..c4db1a3 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/util/util_size.hpp @@ -0,0 +1,37 @@ +/* + * 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 "../defines.hpp" + +namespace ams::util { + + /* std::size() does not support zero-size C arrays. We're fixing that. */ + template + constexpr auto size(const C& c) -> decltype(c.size()) { + return std::size(c); + } + + template + constexpr std::size_t size(const C& c) { + if constexpr (sizeof(C) == 0) { + return 0; + } else { + return std::size(c); + } + } + +} \ No newline at end of file diff --git a/stratosphere/libstratosphere/include/atmosphere/util/util_typed_storage.hpp b/stratosphere/libstratosphere/include/atmosphere/util/util_typed_storage.hpp new file mode 100644 index 0000000..ffcd564 --- /dev/null +++ b/stratosphere/libstratosphere/include/atmosphere/util/util_typed_storage.hpp @@ -0,0 +1,49 @@ +/* + * 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 "../defines.hpp" + +namespace ams::util { + + template + struct TypedStorage { + typename std::aligned_storage::type _storage; + }; + + #define TYPED_STORAGE(T) ::ams::util::TypedStorage + + template + static constexpr inline __attribute__((always_inline)) T *GetPointer(TYPED_STORAGE(T) &ts) { + return reinterpret_cast(&ts._storage); + } + + template + static constexpr inline __attribute__((always_inline)) const T *GetPointer(const TYPED_STORAGE(T) &ts) { + return reinterpret_cast(&ts._storage); + } + + template + static constexpr inline __attribute__((always_inline)) T &GetReference(TYPED_STORAGE(T) &ts) { + return *GetPointer(ts); + } + + template + static constexpr inline __attribute__((always_inline)) const T &GetReference(const TYPED_STORAGE(T) &ts) { + return *GetPointer(ts); + } + +} \ No newline at end of file diff --git a/stratosphere/libstratosphere/include/stratosphere.hpp b/stratosphere/libstratosphere/include/stratosphere.hpp index 58e7ffe..fdbeea8 100644 --- a/stratosphere/libstratosphere/include/stratosphere.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/ams/ams_types.hpp b/stratosphere/libstratosphere/include/stratosphere/ams/ams_types.hpp index 661d940..dc24b93 100644 --- a/stratosphere/libstratosphere/include/stratosphere/ams/ams_types.hpp +++ b/stratosphere/libstratosphere/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 @@ 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/stratosphere/libstratosphere/include/stratosphere/boot2.hpp b/stratosphere/libstratosphere/include/stratosphere/boot2.hpp index 55b3fc3..f75afe4 100644 --- a/stratosphere/libstratosphere/include/stratosphere/boot2.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/boot2.hpp @@ -15,6 +15,5 @@ */ #pragma once -#include #include "boot2/boot2_api.hpp" diff --git a/stratosphere/libstratosphere/include/stratosphere/boot2/boot2_api.hpp b/stratosphere/libstratosphere/include/stratosphere/boot2/boot2_api.hpp index 468d8cd..f239258 100644 --- a/stratosphere/libstratosphere/include/stratosphere/boot2/boot2_api.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/boot2/boot2_api.hpp @@ -15,8 +15,7 @@ */ #pragma once -#include -#include +#include namespace ams::boot2 { diff --git a/stratosphere/libstratosphere/include/stratosphere/cfg.hpp b/stratosphere/libstratosphere/include/stratosphere/cfg.hpp index e78dd8a..6c9f85b 100644 --- a/stratosphere/libstratosphere/include/stratosphere/cfg.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/cfg.hpp @@ -15,6 +15,5 @@ */ #pragma once -#include #include "cfg/cfg_api.hpp" diff --git a/stratosphere/libstratosphere/include/stratosphere/cfg/cfg_api.hpp b/stratosphere/libstratosphere/include/stratosphere/cfg/cfg_api.hpp index 292f18b..68e1974 100644 --- a/stratosphere/libstratosphere/include/stratosphere/cfg/cfg_api.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/dd.hpp b/stratosphere/libstratosphere/include/stratosphere/dd.hpp index a4ba4aa..8d8c9bb 100644 --- a/stratosphere/libstratosphere/include/stratosphere/dd.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/dd.hpp @@ -15,6 +15,5 @@ */ #pragma once -#include #include "dd/dd_io_mappings.hpp" diff --git a/stratosphere/libstratosphere/include/stratosphere/dd/dd_io_mappings.hpp b/stratosphere/libstratosphere/include/stratosphere/dd/dd_io_mappings.hpp index c0d913f..4105751 100644 --- a/stratosphere/libstratosphere/include/stratosphere/dd/dd_io_mappings.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/dd/dd_io_mappings.hpp @@ -15,8 +15,7 @@ */ #pragma once -#include -#include "../defines.hpp" +#include namespace ams::dd { diff --git a/stratosphere/libstratosphere/include/stratosphere/defines.hpp b/stratosphere/libstratosphere/include/stratosphere/defines.hpp deleted file mode 100644 index d2dbd52..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/defines.hpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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 - -/* Any broadly useful language defines should go here. */ - -#define AMS_ASSERT(expr) do { if (!(expr)) { std::abort(); } } while (0) - -#define AMS_UNREACHABLE_DEFAULT_CASE() default: std::abort() - -#define NON_COPYABLE(cls) \ - cls(const cls&) = delete; \ - cls& operator=(const cls&) = delete - -#define NON_MOVEABLE(cls) \ - cls(cls&&) = delete; \ - cls& operator=(cls&&) = delete - -#define ALIGNED(algn) __attribute__((aligned(algn))) -#define NORETURN __attribute__((noreturn)) -#define WEAK __attribute__((weak)) - - -#define CONCATENATE_IMPL(S1, s2) s1##s2 -#define CONCATENATE(s1, s2) CONCATENATE_IMPL(s1, s2) - -#ifdef __COUNTER__ -#define ANONYMOUS_VARIABLE(pref) CONCATENATE(pref, __COUNTER__) -#else -#define ANONYMOUS_VARIABLE(pref) CONCATENATE(pref, __LINE__) -#endif \ No newline at end of file diff --git a/stratosphere/libstratosphere/include/stratosphere/dmnt.hpp b/stratosphere/libstratosphere/include/stratosphere/dmnt.hpp index 6253995..a0d421b 100644 --- a/stratosphere/libstratosphere/include/stratosphere/dmnt.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/dmnt.hpp @@ -15,6 +15,5 @@ */ #pragma once -#include #include "dmnt/dmnt_cheat_types.hpp" diff --git a/stratosphere/libstratosphere/include/stratosphere/dmnt/dmnt_cheat_types.hpp b/stratosphere/libstratosphere/include/stratosphere/dmnt/dmnt_cheat_types.hpp index 3c5ed2d..1231cb5 100644 --- a/stratosphere/libstratosphere/include/stratosphere/dmnt/dmnt_cheat_types.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/fatal.hpp b/stratosphere/libstratosphere/include/stratosphere/fatal.hpp index d3fbb88..de81dac 100644 --- a/stratosphere/libstratosphere/include/stratosphere/fatal.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/fatal.hpp @@ -15,6 +15,5 @@ */ #pragma once -#include #include "fatal/fatal_types.hpp" diff --git a/stratosphere/libstratosphere/include/stratosphere/fatal/fatal_types.hpp b/stratosphere/libstratosphere/include/stratosphere/fatal/fatal_types.hpp index 69996d3..6dfb60f 100644 --- a/stratosphere/libstratosphere/include/stratosphere/fatal/fatal_types.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/hid.hpp b/stratosphere/libstratosphere/include/stratosphere/hid.hpp index bea31e2..6f6c152 100644 --- a/stratosphere/libstratosphere/include/stratosphere/hid.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/hos/hos_types.hpp b/stratosphere/libstratosphere/include/stratosphere/hos/hos_types.hpp index 79b58a0..0b8c60b 100644 --- a/stratosphere/libstratosphere/include/stratosphere/hos/hos_types.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/ipc.hpp b/stratosphere/libstratosphere/include/stratosphere/ipc.hpp deleted file mode 100644 index 09cdf25..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/ipc.hpp +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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 "ipc/ipc_service_object.hpp" -#include "ipc/ipc_serialization.hpp" - -#include "ipc/ipc_service_session.hpp" \ No newline at end of file diff --git a/stratosphere/libstratosphere/include/stratosphere/kvdb.hpp b/stratosphere/libstratosphere/include/stratosphere/kvdb.hpp new file mode 100644 index 0000000..f600cdb --- /dev/null +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/kvdb/kvdb_archive.hpp b/stratosphere/libstratosphere/include/stratosphere/kvdb/kvdb_archive.hpp index 5b7ab3e..b315de8 100644 --- a/stratosphere/libstratosphere/include/stratosphere/kvdb/kvdb_archive.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/kvdb/kvdb_auto_buffer.hpp b/stratosphere/libstratosphere/include/stratosphere/kvdb/kvdb_auto_buffer.hpp index 3b315e5..0950c91 100644 --- a/stratosphere/libstratosphere/include/stratosphere/kvdb/kvdb_auto_buffer.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/kvdb/kvdb_bounded_string.hpp b/stratosphere/libstratosphere/include/stratosphere/kvdb/kvdb_bounded_string.hpp index f9aac8d..16b4b43 100644 --- a/stratosphere/libstratosphere/include/stratosphere/kvdb/kvdb_bounded_string.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_cache.hpp b/stratosphere/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_cache.hpp index 4c7b5b3..d37c471 100644 --- a/stratosphere/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_cache.hpp +++ b/stratosphere/libstratosphere/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 @@ /* 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 @@ 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 @@ /* 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 @@ 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 @@ } 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 @@ 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 @@ 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 @@ 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/stratosphere/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_store.hpp b/stratosphere/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_store.hpp index 83ce93b..a53fca9 100644 --- a/stratosphere/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_store.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/kvdb/kvdb_memory_key_value_store.hpp b/stratosphere/libstratosphere/include/stratosphere/kvdb/kvdb_memory_key_value_store.hpp index e18a9a8..8627f34 100644 --- a/stratosphere/libstratosphere/include/stratosphere/kvdb/kvdb_memory_key_value_store.hpp +++ b/stratosphere/libstratosphere/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 @@ 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 @@ 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 @@ 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 @@ 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 @@ /* 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 @@ /* 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 @@ /* 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ /* 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 @@ 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 @@ /* 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/stratosphere/libstratosphere/include/stratosphere/ldr.hpp b/stratosphere/libstratosphere/include/stratosphere/ldr.hpp index fc56cb7..5a4d655 100644 --- a/stratosphere/libstratosphere/include/stratosphere/ldr.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/ldr/ldr_pm_api.hpp b/stratosphere/libstratosphere/include/stratosphere/ldr/ldr_pm_api.hpp index 87a1942..440513f 100644 --- a/stratosphere/libstratosphere/include/stratosphere/ldr/ldr_pm_api.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/ldr/ldr_pm_api.hpp @@ -15,7 +15,6 @@ */ #pragma once - #include "ldr_types.hpp" namespace ams::ldr::pm { diff --git a/stratosphere/libstratosphere/include/stratosphere/ldr/ldr_types.hpp b/stratosphere/libstratosphere/include/stratosphere/ldr/ldr_types.hpp index b0b25a5..3ab3c3e 100644 --- a/stratosphere/libstratosphere/include/stratosphere/ldr/ldr_types.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/map.hpp b/stratosphere/libstratosphere/include/stratosphere/map.hpp index 0d9d8ba..3b34b23 100644 --- a/stratosphere/libstratosphere/include/stratosphere/map.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/map.hpp @@ -15,7 +15,6 @@ */ #pragma once -#include #include "map/map_types.hpp" #include "map/map_api.hpp" diff --git a/stratosphere/libstratosphere/include/stratosphere/map/map_api.hpp b/stratosphere/libstratosphere/include/stratosphere/map/map_api.hpp index 26aca5c..89f04b5 100644 --- a/stratosphere/libstratosphere/include/stratosphere/map/map_api.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/map/map_api.hpp @@ -15,8 +15,6 @@ */ #pragma once -#include - #include "map_types.hpp" namespace ams::map { diff --git a/stratosphere/libstratosphere/include/stratosphere/map/map_types.hpp b/stratosphere/libstratosphere/include/stratosphere/map/map_types.hpp index ad33a9c..41127e8 100644 --- a/stratosphere/libstratosphere/include/stratosphere/map/map_types.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/map/map_types.hpp @@ -15,8 +15,7 @@ */ #pragma once -#include -#include "../results.hpp" +#include namespace ams::map { diff --git a/stratosphere/libstratosphere/include/stratosphere/ncm.hpp b/stratosphere/libstratosphere/include/stratosphere/ncm.hpp index ec0830d..8f2d108 100644 --- a/stratosphere/libstratosphere/include/stratosphere/ncm.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/ncm.hpp @@ -15,6 +15,5 @@ */ #pragma once -#include #include "ncm/ncm_types.hpp" diff --git a/stratosphere/libstratosphere/include/stratosphere/os.hpp b/stratosphere/libstratosphere/include/stratosphere/os.hpp index 6d009ee..04664b1 100644 --- a/stratosphere/libstratosphere/include/stratosphere/os.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/os/os_common_types.hpp b/stratosphere/libstratosphere/include/stratosphere/os/os_common_types.hpp index 0e581d9..f88c3ba 100644 --- a/stratosphere/libstratosphere/include/stratosphere/os/os_common_types.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/os/os_interrupt_event.hpp b/stratosphere/libstratosphere/include/stratosphere/os/os_interrupt_event.hpp index d11ab52..ccfd979 100644 --- a/stratosphere/libstratosphere/include/stratosphere/os/os_interrupt_event.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/os/os_managed_handle.hpp b/stratosphere/libstratosphere/include/stratosphere/os/os_managed_handle.hpp index 3f127d1..72ecda1 100644 --- a/stratosphere/libstratosphere/include/stratosphere/os/os_managed_handle.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/os/os_message_queue.hpp b/stratosphere/libstratosphere/include/stratosphere/os/os_message_queue.hpp index f7e925b..5c24bf5 100644 --- a/stratosphere/libstratosphere/include/stratosphere/os/os_message_queue.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/os/os_mutex.hpp b/stratosphere/libstratosphere/include/stratosphere/os/os_mutex.hpp index d11dc7e..26ba66c 100644 --- a/stratosphere/libstratosphere/include/stratosphere/os/os_mutex.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/os/os_semaphore.hpp b/stratosphere/libstratosphere/include/stratosphere/os/os_semaphore.hpp index ae8c49c..7cda2c8 100644 --- a/stratosphere/libstratosphere/include/stratosphere/os/os_semaphore.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/os/os_semaphore.hpp @@ -15,7 +15,7 @@ */ #pragma once -#include +#include "os_common_types.hpp" namespace ams::os { diff --git a/stratosphere/libstratosphere/include/stratosphere/os/os_system_event.hpp b/stratosphere/libstratosphere/include/stratosphere/os/os_system_event.hpp index 564ee40..290bfe5 100644 --- a/stratosphere/libstratosphere/include/stratosphere/os/os_system_event.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/os/os_thread.hpp b/stratosphere/libstratosphere/include/stratosphere/os/os_thread.hpp index 0c5da0b..d1b35d7 100644 --- a/stratosphere/libstratosphere/include/stratosphere/os/os_thread.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/os/os_thread.hpp @@ -15,7 +15,7 @@ */ #pragma once -#include +#include "os_common_types.hpp" namespace ams::os { diff --git a/stratosphere/libstratosphere/include/stratosphere/os/os_timeout_helper.hpp b/stratosphere/libstratosphere/include/stratosphere/os/os_timeout_helper.hpp index f91398a..650a3e3 100644 --- a/stratosphere/libstratosphere/include/stratosphere/os/os_timeout_helper.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/os/os_waitable_holder.hpp b/stratosphere/libstratosphere/include/stratosphere/os/os_waitable_holder.hpp index dccbb6d..ea3216b 100644 --- a/stratosphere/libstratosphere/include/stratosphere/os/os_waitable_holder.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/os/os_waitable_manager.hpp b/stratosphere/libstratosphere/include/stratosphere/os/os_waitable_manager.hpp index b2b2fba..90e912e 100644 --- a/stratosphere/libstratosphere/include/stratosphere/os/os_waitable_manager.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/patcher.hpp b/stratosphere/libstratosphere/include/stratosphere/patcher.hpp index 0e11d4c..deafa05 100644 --- a/stratosphere/libstratosphere/include/stratosphere/patcher.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/patcher.hpp @@ -15,6 +15,5 @@ */ #pragma once -#include #include "patcher/patcher_api.hpp" diff --git a/stratosphere/libstratosphere/include/stratosphere/pm.hpp b/stratosphere/libstratosphere/include/stratosphere/pm.hpp index 2a8d797..7593c5b 100644 --- a/stratosphere/libstratosphere/include/stratosphere/pm.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/pm/pm_types.hpp b/stratosphere/libstratosphere/include/stratosphere/pm/pm_types.hpp index 36671b8..a40eee8 100644 --- a/stratosphere/libstratosphere/include/stratosphere/pm/pm_types.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/reg.hpp b/stratosphere/libstratosphere/include/stratosphere/reg.hpp index b374819..001c628 100644 --- a/stratosphere/libstratosphere/include/stratosphere/reg.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/reg.hpp @@ -15,7 +15,7 @@ */ #pragma once -#include +#include namespace ams::reg { diff --git a/stratosphere/libstratosphere/include/stratosphere/results.hpp b/stratosphere/libstratosphere/include/stratosphere/results.hpp deleted file mode 100644 index 595235b..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 - -/* Utilities. */ -#include "results/results_common.hpp" - -/* Official. */ -#include "results/cal_results.hpp" -#include "results/creport_results.hpp" -#include "results/debug_results.hpp" -#include "results/dmnt_results.hpp" -#include "results/err_results.hpp" -#include "results/fatal_results.hpp" -#include "results/fs_results.hpp" -#include "results/hipc_results.hpp" -#include "results/i2c_results.hpp" -#include "results/kvdb_results.hpp" -#include "results/loader_results.hpp" -#include "results/lr_results.hpp" -#include "results/os_results.hpp" -#include "results/ncm_results.hpp" -#include "results/pm_results.hpp" -#include "results/ro_results.hpp" -#include "results/settings_results.hpp" -#include "results/sf_results.hpp" -#include "results/sm_results.hpp" -#include "results/spl_results.hpp" -#include "results/svc_results.hpp" -#include "results/updater_results.hpp" -#include "results/vi_results.hpp" - -/* Unofficial. */ -#include "results/exosphere_results.hpp" diff --git a/stratosphere/libstratosphere/include/stratosphere/results/cal_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/cal_results.hpp deleted file mode 100644 index 69f3a8b..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/cal_results.hpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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 "results_common.hpp" - -namespace ams::cal { - - R_DEFINE_NAMESPACE_RESULT_MODULE(198); - - R_DEFINE_ERROR_RESULT(CalibrationDataCrcError, 101); - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/results/creport_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/creport_results.hpp deleted file mode 100644 index 6f836d8..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/creport_results.hpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 "results_common.hpp" - -namespace ams::creport { - - R_DEFINE_NAMESPACE_RESULT_MODULE(168); - - R_DEFINE_ERROR_RESULT(UndefinedInstruction, 0); - R_DEFINE_ERROR_RESULT(InstructionAbort, 1); - R_DEFINE_ERROR_RESULT(DataAbort, 2); - R_DEFINE_ERROR_RESULT(AlignmentFault, 3); - R_DEFINE_ERROR_RESULT(DebuggerAttached, 4); - R_DEFINE_ERROR_RESULT(BreakPoint, 5); - R_DEFINE_ERROR_RESULT(UserBreak, 6); - R_DEFINE_ERROR_RESULT(DebuggerBreak, 7); - R_DEFINE_ERROR_RESULT(UndefinedSystemCall, 8); - R_DEFINE_ERROR_RESULT(SystemMemoryError, 9); - - R_DEFINE_ERROR_RESULT(IncompleteReport, 99); - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/results/debug_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/debug_results.hpp deleted file mode 100644 index fcf9d66..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/debug_results.hpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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 "results_common.hpp" - -namespace ams::dbg { - - R_DEFINE_NAMESPACE_RESULT_MODULE(183); - - R_DEFINE_ERROR_RESULT(CannotDebug, 1); - R_DEFINE_ERROR_RESULT(AlreadyAttached, 2); - R_DEFINE_ERROR_RESULT(Cancelled, 3); - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/results/dmnt_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/dmnt_results.hpp deleted file mode 100644 index aaa1a3d..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/dmnt_results.hpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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 "results_common.hpp" - -namespace ams::dmnt { - - R_DEFINE_NAMESPACE_RESULT_MODULE(13); - - R_DEFINE_ERROR_RESULT(Unknown, 1); - R_DEFINE_ERROR_RESULT(DebuggingDisabled, 2); - - /* Atmosphere extension. */ - namespace cheat { - - R_DEFINE_ABSTRACT_ERROR_RANGE(CheatError, 6500, 6599); - R_DEFINE_ERROR_RESULT(CheatNotAttached, 6500); - R_DEFINE_ERROR_RESULT(CheatNullBuffer, 6501); - R_DEFINE_ERROR_RESULT(CheatInvalidBuffer, 6502); - R_DEFINE_ERROR_RESULT(CheatUnknownId, 6503); - R_DEFINE_ERROR_RESULT(CheatOutOfResource, 6504); - R_DEFINE_ERROR_RESULT(CheatInvalid, 6505); - R_DEFINE_ERROR_RESULT(CheatCannotDisable, 6506); - - R_DEFINE_ABSTRACT_ERROR_RANGE(FrozenAddressError, 6600, 6699); - R_DEFINE_ERROR_RESULT(FrozenAddressInvalidWidth, 6600); - R_DEFINE_ERROR_RESULT(FrozenAddressAlreadyExists, 6601); - R_DEFINE_ERROR_RESULT(FrozenAddressNotFound, 6602); - R_DEFINE_ERROR_RESULT(FrozenAddressOutOfResource, 6603); - - R_DEFINE_ABSTRACT_ERROR_RANGE(VirtualMachineError, 6700, 6799); - R_DEFINE_ERROR_RESULT(VirtualMachineInvalidConditionDepth, 6700); - - } - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/results/err_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/err_results.hpp deleted file mode 100644 index dd46dc5..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/err_results.hpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 "results_common.hpp" - -namespace ams::err { - - R_DEFINE_NAMESPACE_RESULT_MODULE(162); - - R_DEFINE_ERROR_RESULT(ApplicationAborted, 1); - R_DEFINE_ERROR_RESULT(SystemModuleAborted, 2); - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/results/exosphere_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/exosphere_results.hpp deleted file mode 100644 index 8804473..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/exosphere_results.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 "results_common.hpp" - -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(NotPresent, 1); - R_DEFINE_ERROR_RESULT(VersionMismatch, 2); - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/results/fatal_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/fatal_results.hpp deleted file mode 100644 index 076171d..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/fatal_results.hpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 "results_common.hpp" - -namespace ams::fatal { - - R_DEFINE_NAMESPACE_RESULT_MODULE(163); - - R_DEFINE_ERROR_RESULT(AllocationFailed, 1); - R_DEFINE_ERROR_RESULT(NullGraphicsBuffer, 2); - R_DEFINE_ERROR_RESULT(AlreadyThrown, 3); - R_DEFINE_ERROR_RESULT(TooManyEvents, 4); - R_DEFINE_ERROR_RESULT(InRepairWithoutVolHeld, 5); - R_DEFINE_ERROR_RESULT(InRepairWithoutTimeReviserCartridge, 6); - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/results/fs_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/fs_results.hpp deleted file mode 100644 index b3877c3..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/fs_results.hpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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 "results_common.hpp" - -namespace ams::fs { - - R_DEFINE_NAMESPACE_RESULT_MODULE(2); - - R_DEFINE_ERROR_RESULT(PathNotFound, 1); - R_DEFINE_ERROR_RESULT(PathAlreadyExists, 2); - - R_DEFINE_ERROR_RESULT(TargetLocked, 7); - R_DEFINE_ERROR_RESULT(DirectoryNotEmpty, 8); - - R_DEFINE_ERROR_RANGE (NotEnoughFreeSpace, 30, 45); - R_DEFINE_ERROR_RANGE(NotEnoughFreeSpaceBis, 34, 38); - R_DEFINE_ERROR_RESULT(NotEnoughFreeSpaceBisCalibration, 35); - R_DEFINE_ERROR_RESULT(NotEnoughFreeSpaceBisSafe, 36); - R_DEFINE_ERROR_RESULT(NotEnoughFreeSpaceBisUser, 37); - R_DEFINE_ERROR_RESULT(NotEnoughFreeSpaceBisSystem, 38); - R_DEFINE_ERROR_RESULT(NotEnoughFreeSpaceSdCard, 39); - - R_DEFINE_ERROR_RESULT(MountNameAlreadyExists, 60); - - R_DEFINE_ERROR_RESULT(TargetNotFound, 1002); - - R_DEFINE_ERROR_RANGE(SdCardAccessFailed, 2000, 2499); - R_DEFINE_ERROR_RESULT(SdCardNotPresent, 2001); - - R_DEFINE_ERROR_RANGE(GameCardAccessFailed, 2500, 2999); - - R_DEFINE_ERROR_RESULT(NotImplemented, 3001); - R_DEFINE_ERROR_RESULT(OutOfRange, 3005); - - R_DEFINE_ERROR_RANGE(AllocationFailure, 3200, 3499); - R_DEFINE_ERROR_RESULT(AllocationFailureInDirectorySaveDataFileSystem, 3321); - R_DEFINE_ERROR_RESULT(AllocationFailureInSubDirectoryFileSystem, 3355); - - R_DEFINE_ERROR_RANGE(MmcAccessFailed, 3500, 3999); - - R_DEFINE_ERROR_RANGE(DataCorrupted, 4000, 4999); - R_DEFINE_ERROR_RANGE(RomCorrupted, 4001, 4299); - R_DEFINE_ERROR_RANGE(SaveDataCorrupted, 4301, 4499); - R_DEFINE_ERROR_RANGE(NcaCorrupted, 4501, 4599); - R_DEFINE_ERROR_RANGE(IntegrityVerificationStorageCorrupted, 4601, 4639); - R_DEFINE_ERROR_RANGE(PartitionFileSystemCorrupted, 4641, 4659); - R_DEFINE_ERROR_RANGE(BuiltInStorageCorrupted, 4661, 4679); - R_DEFINE_ERROR_RANGE(HostFileSystemCorrupted, 4701, 4719); - R_DEFINE_ERROR_RANGE(DatabaseCorrupted, 4721, 4739); - R_DEFINE_ERROR_RANGE(AesXtsFileSystemCorrupted, 4741, 4759); - R_DEFINE_ERROR_RANGE(SaveDataTransferDataCorrupted, 4761, 4769); - R_DEFINE_ERROR_RANGE(SignedSystemPartitionDataCorrupted, 4771, 4779); - - R_DEFINE_ERROR_RESULT(GameCardLogoDataCorrupted, 4781); - - R_DEFINE_ERROR_RANGE(Unexpected, 5000, 5999); - - R_DEFINE_ERROR_RANGE(PreconditionViolation, 6000, 6499); - R_DEFINE_ERROR_RANGE(InvalidArgument, 6001, 6199); - R_DEFINE_ERROR_RANGE(InvalidPath, 6002, 6029); - R_DEFINE_ERROR_RESULT(TooLongPath, 6003); - R_DEFINE_ERROR_RESULT(InvalidCharacter, 6004); - R_DEFINE_ERROR_RESULT(InvalidPathFormat, 6005); - R_DEFINE_ERROR_RESULT(DirectoryUnobtainable, 6006); - R_DEFINE_ERROR_RESULT(NotNormalized, 6007); - - R_DEFINE_ERROR_RESULT(InvalidOffset, 6061); - R_DEFINE_ERROR_RESULT(InvalidSize, 6062); - R_DEFINE_ERROR_RESULT(NullptrArgument, 6063); - R_DEFINE_ERROR_RESULT(InvalidAlignment, 6064); - R_DEFINE_ERROR_RESULT(InvalidMountName, 6065); - - R_DEFINE_ERROR_RESULT(ExtensionSizeTooLarge, 6066); - R_DEFINE_ERROR_RESULT(ExtensionSizeInvalid, 6067); - - R_DEFINE_ERROR_RANGE(InvalidEnumValue, 6080, 6099); - R_DEFINE_ERROR_RESULT(InvalidSaveDataState, 6081); - R_DEFINE_ERROR_RESULT(InvalidSaveDataSpaceId, 6082); - - R_DEFINE_ERROR_RANGE(InvalidOperationForOpenMode, 6200, 6299); - R_DEFINE_ERROR_RESULT(FileExtensionWithoutOpenModeAllowAppend, 6201); - - R_DEFINE_ERROR_RANGE(UnsupportedOperation, 6300, 6399); - - R_DEFINE_ERROR_RANGE(PermissionDenied, 6400, 6449); - - R_DEFINE_ERROR_RESULT(WriteModeFileNotClosed, 6457); - R_DEFINE_ERROR_RESULT(AllocatorAlignmentViolation, 6461); - R_DEFINE_ERROR_RESULT(UserNotExist, 6465); - - R_DEFINE_ERROR_RANGE(OutOfResource, 6700, 6799); - R_DEFINE_ERROR_RESULT(MappingTableFull, 6706); - R_DEFINE_ERROR_RESULT(OpenCountLimit, 6709); - - R_DEFINE_ERROR_RANGE(MappingFailed, 6800, 6899); - R_DEFINE_ERROR_RESULT(MapFull, 6811); - - R_DEFINE_ERROR_RANGE(BadState, 6900, 6999); - R_DEFINE_ERROR_RESULT(NotMounted, 6905); - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/results/hipc_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/hipc_results.hpp deleted file mode 100644 index 65f396f..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/hipc_results.hpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 "results_common.hpp" - -namespace ams::sf::hipc { - - R_DEFINE_NAMESPACE_RESULT_MODULE(11); - - R_DEFINE_ABSTRACT_ERROR_RANGE(OutOfResource, 100, 299); - R_DEFINE_ERROR_RESULT(OutOfSessionMemory, 102); - R_DEFINE_ERROR_RANGE (OutOfSessions, 131, 139); - R_DEFINE_ERROR_RESULT(PointerBufferTooSmall, 141); - - R_DEFINE_ERROR_RESULT(OutOfDomains, 200); - - R_DEFINE_ERROR_RESULT(SessionClosed, 301); - - R_DEFINE_ERROR_RESULT(InvalidRequestSize, 402); - R_DEFINE_ERROR_RESULT(UnknownCommandType, 403); - - R_DEFINE_ERROR_RESULT(InvalidCmifRequest, 420); - - R_DEFINE_ERROR_RESULT(TargetNotDomain, 491); - R_DEFINE_ERROR_RESULT(DomainObjectNotFound, 492); - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/results/i2c_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/i2c_results.hpp deleted file mode 100644 index bd7f795..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/i2c_results.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 "results_common.hpp" - -namespace ams::i2c { - - R_DEFINE_NAMESPACE_RESULT_MODULE(101); - - R_DEFINE_ERROR_RESULT(NoAck, 1); - R_DEFINE_ERROR_RESULT(BusBusy, 2); - R_DEFINE_ERROR_RESULT(FullCommandList, 3); - R_DEFINE_ERROR_RESULT(TimedOut, 4); - R_DEFINE_ERROR_RESULT(UnknownDevice, 5); - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/results/kvdb_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/kvdb_results.hpp deleted file mode 100644 index 2c19921..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/kvdb_results.hpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 "results_common.hpp" - -namespace ams::kvdb { - - R_DEFINE_NAMESPACE_RESULT_MODULE(20); - - R_DEFINE_ERROR_RESULT(KeyCapacityInsufficient, 1); - R_DEFINE_ERROR_RESULT(KeyNotFound, 2); - R_DEFINE_ERROR_RESULT(AllocationFailed, 4); - R_DEFINE_ERROR_RESULT(InvalidKeyValue, 5); - R_DEFINE_ERROR_RESULT(BufferInsufficient, 6); - - R_DEFINE_ERROR_RESULT(InvalidFilesystemState, 8); - R_DEFINE_ERROR_RESULT(NotCreated, 9); - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/results/loader_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/loader_results.hpp deleted file mode 100644 index 29b80bf..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/loader_results.hpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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 "results_common.hpp" - -namespace ams::ldr { - - R_DEFINE_NAMESPACE_RESULT_MODULE(9); - - R_DEFINE_ERROR_RESULT(TooLongArgument, 1); - R_DEFINE_ERROR_RESULT(TooManyArguments, 2); - R_DEFINE_ERROR_RESULT(TooLargeMeta, 3); - R_DEFINE_ERROR_RESULT(InvalidMeta, 4); - R_DEFINE_ERROR_RESULT(InvalidNso, 5); - R_DEFINE_ERROR_RESULT(InvalidPath, 6); - R_DEFINE_ERROR_RESULT(TooManyProcesses, 7); - R_DEFINE_ERROR_RESULT(NotPinned, 8); - R_DEFINE_ERROR_RESULT(InvalidProgramId, 9); - R_DEFINE_ERROR_RESULT(InvalidVersion, 10); - - R_DEFINE_ERROR_RESULT(InsufficientAddressSpace, 51); - R_DEFINE_ERROR_RESULT(InvalidNro, 52); - R_DEFINE_ERROR_RESULT(InvalidNrr, 53); - R_DEFINE_ERROR_RESULT(InvalidSignature, 54); - R_DEFINE_ERROR_RESULT(InsufficientNroRegistrations, 55); - R_DEFINE_ERROR_RESULT(InsufficientNrrRegistrations, 56); - R_DEFINE_ERROR_RESULT(NroAlreadyLoaded, 57); - - R_DEFINE_ERROR_RESULT(InvalidAddress, 81); - R_DEFINE_ERROR_RESULT(InvalidSize, 82); - R_DEFINE_ERROR_RESULT(NotLoaded, 84); - R_DEFINE_ERROR_RESULT(NotRegistered, 85); - R_DEFINE_ERROR_RESULT(InvalidSession, 86); - R_DEFINE_ERROR_RESULT(InvalidProcess, 87); - - R_DEFINE_ERROR_RESULT(UnknownCapability, 100); - R_DEFINE_ERROR_RESULT(InvalidCapabilityKernelFlags, 103); - R_DEFINE_ERROR_RESULT(InvalidCapabilitySyscallMask, 104); - R_DEFINE_ERROR_RESULT(InvalidCapabilityMapRange, 106); - R_DEFINE_ERROR_RESULT(InvalidCapabilityMapPage, 107); - R_DEFINE_ERROR_RESULT(InvalidCapabilityInterruptPair, 111); - R_DEFINE_ERROR_RESULT(InvalidCapabilityApplicationType, 113); - R_DEFINE_ERROR_RESULT(InvalidCapabilityKernelVersion, 114); - R_DEFINE_ERROR_RESULT(InvalidCapabilityHandleTable, 115); - R_DEFINE_ERROR_RESULT(InvalidCapabilityDebugFlags, 116); - - R_DEFINE_ERROR_RESULT(InternalError, 200); - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/results/lr_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/lr_results.hpp deleted file mode 100644 index c1983ee..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/lr_results.hpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 "results_common.hpp" - -namespace ams::lr { - - R_DEFINE_NAMESPACE_RESULT_MODULE(8); - - R_DEFINE_ERROR_RESULT(ProgramNotFound, 2); - R_DEFINE_ERROR_RESULT(DataNotFound, 3); - R_DEFINE_ERROR_RESULT(UnknownStorageId, 4); - R_DEFINE_ERROR_RESULT(HtmlDocumentNotFound, 6); - R_DEFINE_ERROR_RESULT(AddOnContentNotFound, 7); - R_DEFINE_ERROR_RESULT(ControlNotFound, 8); - R_DEFINE_ERROR_RESULT(LegalInformationNotFound, 9); - - R_DEFINE_ERROR_RESULT(TooManyRegisteredPaths, 90); - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/results/ncm_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/ncm_results.hpp deleted file mode 100644 index cdba12c..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/ncm_results.hpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 "results_common.hpp" - -namespace ams::ncm { - - R_DEFINE_NAMESPACE_RESULT_MODULE(5); - - R_DEFINE_ERROR_RESULT(PlaceHolderAlreadyExists, 2); - R_DEFINE_ERROR_RESULT(PlaceHolderNotFound, 3); - R_DEFINE_ERROR_RESULT(ContentAlreadyExists, 4); - R_DEFINE_ERROR_RESULT(ContentNotFound, 5); - R_DEFINE_ERROR_RESULT(ContentMetaNotFound, 7); - R_DEFINE_ERROR_RESULT(AllocationFailed, 8); - R_DEFINE_ERROR_RESULT(UnknownStorage, 12); - - R_DEFINE_ERROR_RESULT(InvalidContentStorage, 100); - R_DEFINE_ERROR_RESULT(InvalidContentMetaDatabase, 110); - - R_DEFINE_ERROR_RESULT(BufferInsufficient, 180); - R_DEFINE_ERROR_RESULT(InvalidContentMetaKey, 240); - - R_DEFINE_ERROR_RANGE(ContentStorageNotActive, 250, 258); - R_DEFINE_ERROR_RESULT(GameCardContentStorageNotActive, 251); - R_DEFINE_ERROR_RESULT(NandSystemContentStorageNotActive, 252); - R_DEFINE_ERROR_RESULT(NandUserContentStorageNotActive, 253); - R_DEFINE_ERROR_RESULT(SdCardContentStorageNotActive, 254); - R_DEFINE_ERROR_RESULT(UnknownContentStorageNotActive, 258); - - R_DEFINE_ERROR_RANGE(ContentMetaDatabaseNotActive, 260, 268); - R_DEFINE_ERROR_RESULT(GameCardContentMetaDatabaseNotActive, 261); - R_DEFINE_ERROR_RESULT(NandSystemContentMetaDatabaseNotActive, 262); - R_DEFINE_ERROR_RESULT(NandUserContentMetaDatabaseNotActive, 263); - R_DEFINE_ERROR_RESULT(SdCardContentMetaDatabaseNotActive, 264); - R_DEFINE_ERROR_RESULT(UnknownContentMetaDatabaseNotActive, 268); - - R_DEFINE_ERROR_RANGE(InvalidArgument, 8181, 8191); - R_DEFINE_ERROR_RESULT(InvalidOffset, 8182); - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/results/os_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/os_results.hpp deleted file mode 100644 index 5fd716d..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/os_results.hpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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 "results_common.hpp" - -namespace ams::os { - - R_DEFINE_NAMESPACE_RESULT_MODULE(3); - - R_DEFINE_ERROR_RESULT(Busy, 4); - - R_DEFINE_ERROR_RESULT(OutOfMemory, 8); - R_DEFINE_ERROR_RESULT(OutOfResource, 9); - - R_DEFINE_ERROR_RESULT(OutOfVirtualAddressSpace, 12); - R_DEFINE_ERROR_RESULT(ResourceLimit, 13); - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/results/pm_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/pm_results.hpp deleted file mode 100644 index 50d4c3f..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/pm_results.hpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 "results_common.hpp" - -namespace ams::pm { - - R_DEFINE_NAMESPACE_RESULT_MODULE(15); - - R_DEFINE_ERROR_RESULT(ProcessNotFound, 1); - R_DEFINE_ERROR_RESULT(AlreadyStarted, 2); - R_DEFINE_ERROR_RESULT(NotExited, 3); - R_DEFINE_ERROR_RESULT(DebugHookInUse, 4); - R_DEFINE_ERROR_RESULT(ApplicationRunning, 5); - R_DEFINE_ERROR_RESULT(InvalidSize, 6); - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/results/results_common.hpp b/stratosphere/libstratosphere/include/stratosphere/results/results_common.hpp deleted file mode 100644 index a52a990..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/results_common.hpp +++ /dev/null @@ -1,288 +0,0 @@ -/* - * 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 -#include "../defines.hpp" - -namespace ams { - - namespace result::impl { - - class ResultTraits { - public: - using BaseType = u32; - static_assert(std::is_same::value, "std::is_same::value"); - static constexpr BaseType SuccessValue = BaseType(); - static constexpr BaseType ModuleBits = 9; - static constexpr BaseType DescriptionBits = 13; - static constexpr BaseType ReservedBits = 10; - static_assert(ModuleBits + DescriptionBits + ReservedBits == sizeof(BaseType) * CHAR_BIT, "ModuleBits + DescriptionBits + ReservedBits == sizeof(BaseType) * CHAR_BIT"); - public: - NX_CONSTEXPR BaseType MakeValue(BaseType module, BaseType description) { - return (module) | (description << ModuleBits); - } - - template - struct MakeStaticValue : public std::integral_constant { - static_assert(module < (1 << ModuleBits), "Invalid Module"); - static_assert(description < (1 << DescriptionBits), "Invalid Description"); - }; - - NX_CONSTEXPR BaseType GetModuleFromValue(BaseType value) { - return value & ~(~BaseType() << ModuleBits); - } - - NX_CONSTEXPR BaseType GetDescriptionFromValue(BaseType value) { - return ((value >> ModuleBits) & ~(~BaseType() << DescriptionBits)); - } - }; - - /* Use CRTP for Results. */ - template - class ResultBase { - public: - using BaseType = typename ResultTraits::BaseType; - static constexpr BaseType SuccessValue = ResultTraits::SuccessValue; - public: - constexpr inline BaseType GetModule() const { return ResultTraits::GetModuleFromValue(static_cast(this)->GetValue()); } - constexpr inline BaseType GetDescription() const { return ResultTraits::GetDescriptionFromValue(static_cast(this)->GetValue()); } - }; - - class ResultConstructor; - - } - - class ResultSuccess; - - class Result final : public result::impl::ResultBase { - friend class ResultConstructor; - public: - using Base = typename result::impl::ResultBase; - private: - typename Base::BaseType value; - private: - /* TODO: Maybe one-day, the result constructor. */ - public: - Result() { /* ... */ } - - /* TODO: It sure would be nice to make this private. */ - constexpr Result(typename Base::BaseType v) : value(v) { static_assert(std::is_same::value); } - - constexpr inline operator ResultSuccess() const; - NX_CONSTEXPR bool CanAccept(Result result) { return true; } - - constexpr inline bool IsSuccess() const { return this->GetValue() == Base::SuccessValue; } - constexpr inline bool IsFailure() const { return !this->IsSuccess(); } - constexpr inline typename Base::BaseType GetModule() const { return Base::GetModule(); } - constexpr inline typename Base::BaseType GetDescription() const { return Base::GetDescription(); } - - constexpr inline typename Base::BaseType GetValue() const { return this->value; } - }; - static_assert(sizeof(Result) == sizeof(Result::Base::BaseType), "sizeof(Result) == sizeof(Result::Base::BaseType)"); - static_assert(std::is_trivially_destructible::value, "std::is_trivially_destructible::value"); - - namespace result::impl { - - class ResultConstructor { - public: - static constexpr inline Result MakeResult(ResultTraits::BaseType value) { - return Result(value); - } - }; - - constexpr inline Result MakeResult(ResultTraits::BaseType value) { - return ResultConstructor::MakeResult(value); - } - - } - - class ResultSuccess final : public result::impl::ResultBase { - public: - using Base = typename result::impl::ResultBase; - public: - constexpr operator Result() const { return result::impl::MakeResult(Base::SuccessValue); } - NX_CONSTEXPR bool CanAccept(Result result) { return result.IsSuccess(); } - - constexpr inline bool IsSuccess() const { return true; } - constexpr inline bool IsFailure() const { return !this->IsSuccess(); } - constexpr inline typename Base::BaseType GetModule() const { return Base::GetModule(); } - constexpr inline typename Base::BaseType GetDescription() const { return Base::GetDescription(); } - - constexpr inline typename Base::BaseType GetValue() const { return Base::SuccessValue; } - }; - - namespace result::impl { - - NORETURN void OnResultAssertion(Result result); - - } - - constexpr inline Result::operator ResultSuccess() const { - if (!ResultSuccess::CanAccept(*this)) { - result::impl::OnResultAssertion(*this); - } - return ResultSuccess(); - } - - namespace result::impl { - - template - class ResultErrorBase : public ResultBase> { - public: - using Base = typename result::impl::ResultBase>; - static constexpr typename Base::BaseType Module = _Module; - static constexpr typename Base::BaseType Description = _Description; - static constexpr typename Base::BaseType Value = ResultTraits::MakeStaticValue::value; - static_assert(Value != Base::SuccessValue, "Value != Base::SuccessValue"); - public: - constexpr operator Result() const { return MakeResult(Value); } - constexpr operator ResultSuccess() const { OnResultAssertion(Value); } - - constexpr inline bool IsSuccess() const { return false; } - constexpr inline bool IsFailure() const { return !this->IsSuccess(); } - - constexpr inline typename Base::BaseType GetValue() const { return Value; } - }; - - template - class ResultErrorRangeBase { - public: - static constexpr ResultTraits::BaseType Module = _Module; - static constexpr ResultTraits::BaseType DescriptionStart = DescStart; - static constexpr ResultTraits::BaseType DescriptionEnd = DescEnd; - static_assert(DescriptionStart <= DescriptionEnd, "DescriptionStart <= DescriptionEnd"); - static constexpr typename ResultTraits::BaseType StartValue = ResultTraits::MakeStaticValue::value; - static constexpr typename ResultTraits::BaseType EndValue = ResultTraits::MakeStaticValue::value; - public: - NX_CONSTEXPR bool Includes(Result result) { - return StartValue <= result.GetValue() && result.GetValue() <= EndValue; - } - }; - - } - -} - -/* Macros for defining new results. */ -#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<::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 ::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 ::ams::result::impl::ResultErrorRangeBase {} - - -#define R_DEFINE_ERROR_RESULT(name, desc) R_DEFINE_ERROR_RESULT_IMPL(name, desc, desc) -#define R_DEFINE_ERROR_RANGE(name, start, end) R_DEFINE_ERROR_RESULT_IMPL(name, start, end) - -#define R_DEFINE_ABSTRACT_ERROR_RESULT(name, desc) R_DEFINE_ABSTRACT_ERROR_RESULT_IMPL(name, desc, desc) -#define R_DEFINE_ABSTRACT_ERROR_RANGE(name, start, end) R_DEFINE_ABSTRACT_ERROR_RESULT_IMPL(name, start, end) - -/* Remove libnx macros, replace with our own. */ -#ifndef R_SUCCEEDED -#error "R_SUCCEEDED not defined." -#endif - -#undef R_SUCCEEDED - -#ifndef R_FAILED -#error "R_FAILED not defined" -#endif - -#undef R_FAILED - -#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. -#define R_TRY(res_expr) \ - ({ \ - const auto _tmp_r_try_rc = res_expr; \ - if (R_FAILED(_tmp_r_try_rc)) { \ - return _tmp_r_try_rc; \ - } \ - }) - -/// Evaluates an expression that returns a result, and fatals the result if it would fail. -#define R_ASSERT(res_expr) \ - ({ \ - const auto _tmp_r_assert_rc = res_expr; \ - if (R_FAILED(_tmp_r_assert_rc)) { \ - ::ams::result::impl::OnResultAssertion(_tmp_r_assert_rc); \ - } \ - }) - -/// Evaluates a boolean expression, and returns a result unless that expression is true. -#define R_UNLESS(expr, res) \ - ({ \ - if (!(expr)) { \ - return static_cast<::ams::Result>(res); \ - } \ - }) - -/// Helpers for pattern-matching on a result expression, if the result would fail. -#define R_CURRENT_RESULT _tmp_r_current_result - -#define R_TRY_CATCH(res_expr) \ - ({ \ - const auto R_CURRENT_RESULT = res_expr; \ - if (R_FAILED(R_CURRENT_RESULT)) { \ - if (false) - -namespace ams::result::impl { - - template - NX_CONSTEXPR bool AnyIncludes(Result result) { - return (Rs::Includes(result) || ...); - } - -} - -#define R_CATCH(...) \ - } 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<::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<::ams::Result>(convert_type); } - -#define R_END_TRY_CATCH \ - else if (R_FAILED(R_CURRENT_RESULT)) { \ - return R_CURRENT_RESULT; \ - } \ - } \ - }) - -#define R_END_TRY_CATCH_WITH_ASSERT \ - else { \ - R_ASSERT(R_CURRENT_RESULT); \ - } \ - } \ - }) diff --git a/stratosphere/libstratosphere/include/stratosphere/results/ro_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/ro_results.hpp deleted file mode 100644 index 6722705..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/ro_results.hpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 "results_common.hpp" - -namespace ams::ro { - - R_DEFINE_NAMESPACE_RESULT_MODULE(22); - - R_DEFINE_ERROR_RANGE(RoError, 1, 1023); - R_DEFINE_ERROR_RESULT(OutOfAddressSpace, 2); - R_DEFINE_ERROR_RESULT(AlreadyLoaded, 3); - R_DEFINE_ERROR_RESULT(InvalidNro, 4); - - R_DEFINE_ERROR_RESULT(InvalidNrr, 6); - R_DEFINE_ERROR_RESULT(TooManyNro, 7); - R_DEFINE_ERROR_RESULT(TooManyNrr, 8); - R_DEFINE_ERROR_RESULT(NotAuthorized, 9); - R_DEFINE_ERROR_RESULT(InvalidNrrType, 10); - - R_DEFINE_ERROR_RESULT(InternalError, 1023); - - R_DEFINE_ERROR_RESULT(InvalidAddress, 1025); - R_DEFINE_ERROR_RESULT(InvalidSize, 1026); - - R_DEFINE_ERROR_RESULT(NotLoaded, 1028); - R_DEFINE_ERROR_RESULT(NotRegistered, 1029); - R_DEFINE_ERROR_RESULT(InvalidSession, 1030); - R_DEFINE_ERROR_RESULT(InvalidProcess, 1031); - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/results/settings_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/settings_results.hpp deleted file mode 100644 index 6f015cd..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/settings_results.hpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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 "results_common.hpp" - -namespace ams::settings { - - R_DEFINE_NAMESPACE_RESULT_MODULE(105); - - R_DEFINE_ERROR_RESULT(ItemNotFound, 11); - - R_DEFINE_ERROR_RANGE(InternalError, 100, 149); - R_DEFINE_ERROR_RESULT(ItemKeyAllocationFailed, 101); - R_DEFINE_ERROR_RESULT(ItemValueAllocationFailed, 102); - - R_DEFINE_ERROR_RANGE(InvalidArgument, 200, 399); - R_DEFINE_ERROR_RESULT(SettingsNameNull, 201); - R_DEFINE_ERROR_RESULT(SettingsItemKeyNull, 202); - R_DEFINE_ERROR_RESULT(SettingsItemValueNull, 203); - R_DEFINE_ERROR_RESULT(SettingsItemKeyBufferNull, 204); - R_DEFINE_ERROR_RESULT(SettingsItemValueBufferNull, 205); - - R_DEFINE_ERROR_RESULT(SettingsNameEmpty, 221); - R_DEFINE_ERROR_RESULT(SettingsItemKeyEmpty, 222); - - R_DEFINE_ERROR_RESULT(SettingsNameTooLong, 241); - R_DEFINE_ERROR_RESULT(SettingsItemKeyTooLong, 242); - - R_DEFINE_ERROR_RESULT(SettingsNameInvalidFormat, 261); - R_DEFINE_ERROR_RESULT(SettingsItemKeyInvalidFormat, 262); - R_DEFINE_ERROR_RESULT(SettingsItemValueInvalidFormat, 263); - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/results/sf_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/sf_results.hpp deleted file mode 100644 index 1925255..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/sf_results.hpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 "results_common.hpp" - -namespace ams::sf { - - R_DEFINE_NAMESPACE_RESULT_MODULE(10); - - R_DEFINE_ERROR_RESULT(NotSupported, 1); - R_DEFINE_ERROR_RESULT(PreconditionViolation, 3); - - namespace cmif { - - R_DEFINE_ERROR_RESULT(InvalidHeaderSize, 202); - R_DEFINE_ERROR_RESULT(InvalidInHeader, 211); - R_DEFINE_ERROR_RESULT(UnknownCommandId, 221); - R_DEFINE_ERROR_RESULT(InvalidOutRawSize, 232); - R_DEFINE_ERROR_RESULT(InvalidNumInObjects, 235); - R_DEFINE_ERROR_RESULT(InvalidNumOutObjects, 236); - R_DEFINE_ERROR_RESULT(InvalidInObject, 239); - - R_DEFINE_ERROR_RESULT(TargetNotFound, 261); - - R_DEFINE_ERROR_RESULT(OutOfDomainEntries, 301); - - } - - namespace impl { - - R_DEFINE_ABSTRACT_ERROR_RANGE(RequestContextChanged, 800, 899); - R_DEFINE_ABSTRACT_ERROR_RANGE(RequestInvalidated, 801, 809); - R_DEFINE_ERROR_RESULT(RequestInvalidatedByUser, 802); - - } - - R_DEFINE_ABSTRACT_ERROR_RANGE(RequestDeferred, 811, 819); - R_DEFINE_ERROR_RESULT(RequestDeferredByUser, 812); - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/results/sm_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/sm_results.hpp deleted file mode 100644 index 89829f7..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/sm_results.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 "results_common.hpp" - -namespace ams::sm { - - R_DEFINE_NAMESPACE_RESULT_MODULE(21); - - R_DEFINE_ERROR_RESULT(OutOfProcesses, 1); - R_DEFINE_ERROR_RESULT(InvalidClient, 2); - R_DEFINE_ERROR_RESULT(OutOfSessions, 3); - R_DEFINE_ERROR_RESULT(AlreadyRegistered, 4); - R_DEFINE_ERROR_RESULT(OutOfServices, 5); - R_DEFINE_ERROR_RESULT(InvalidServiceName, 6); - R_DEFINE_ERROR_RESULT(NotRegistered, 7); - 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/stratosphere/libstratosphere/include/stratosphere/results/spl_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/spl_results.hpp deleted file mode 100644 index 0670c6f..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/spl_results.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 "results_common.hpp" - -namespace ams::spl { - - R_DEFINE_NAMESPACE_RESULT_MODULE(26); - - R_DEFINE_ERROR_RANGE(SecureMonitorError, 0, 99); - R_DEFINE_ERROR_RESULT(SecureMonitorNotImplemented, 1); - R_DEFINE_ERROR_RESULT(SecureMonitorInvalidArgument, 2); - R_DEFINE_ERROR_RESULT(SecureMonitorBusy, 3); - R_DEFINE_ERROR_RESULT(SecureMonitorNoAsyncOperation, 4); - R_DEFINE_ERROR_RESULT(SecureMonitorInvalidAsyncOperation, 5); - R_DEFINE_ERROR_RESULT(SecureMonitorNotPermitted, 6); - - R_DEFINE_ERROR_RESULT(InvalidSize, 100); - R_DEFINE_ERROR_RESULT(UnknownSecureMonitorError, 101); - R_DEFINE_ERROR_RESULT(DecryptionFailed, 102); - - R_DEFINE_ERROR_RESULT(OutOfKeyslots, 104); - R_DEFINE_ERROR_RESULT(InvalidKeyslot, 105); - R_DEFINE_ERROR_RESULT(BootReasonAlreadySet, 106); - R_DEFINE_ERROR_RESULT(BootReasonNotSet, 107); - R_DEFINE_ERROR_RESULT(InvalidArgument, 108); - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/results/svc_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/svc_results.hpp deleted file mode 100644 index 8b5149e..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/svc_results.hpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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 "results_common.hpp" - -namespace ams::svc { - - R_DEFINE_NAMESPACE_RESULT_MODULE(1); - - R_DEFINE_ERROR_RESULT(OutOfSessions, 7); - - R_DEFINE_ERROR_RESULT(InvalidArgument, 14); - - R_DEFINE_ERROR_RESULT(NotImplemented, 33); - - R_DEFINE_ERROR_RESULT(ThreadTerminating, 59); - - R_DEFINE_ERROR_RESULT(NoEvent, 70); - - R_DEFINE_ERROR_RESULT(InvalidSize, 101); - R_DEFINE_ERROR_RESULT(InvalidAddress, 102); - R_DEFINE_ERROR_RESULT(OutOfResource, 103); - R_DEFINE_ERROR_RESULT(OutOfMemory, 104); - R_DEFINE_ERROR_RESULT(OutOfHandles, 105); - R_DEFINE_ERROR_RESULT(InvalidCurrentMemoryState, 106); - - R_DEFINE_ERROR_RESULT(InvalidNewMemoryPermissions, 108); - - R_DEFINE_ERROR_RESULT(InvalidMemoryRegion, 110); - - R_DEFINE_ERROR_RESULT(InvalidPriority, 112); - R_DEFINE_ERROR_RESULT(InvalidCoreId, 113); - R_DEFINE_ERROR_RESULT(InvalidHandle, 114); - R_DEFINE_ERROR_RESULT(InvalidPointer, 115); - R_DEFINE_ERROR_RESULT(InvalidCombination, 116); - R_DEFINE_ERROR_RESULT(TimedOut, 117); - R_DEFINE_ERROR_RESULT(Cancelled, 118); - R_DEFINE_ERROR_RESULT(OutOfRange, 119); - R_DEFINE_ERROR_RESULT(InvalidEnumValue, 120); - R_DEFINE_ERROR_RESULT(NotFound, 121); - R_DEFINE_ERROR_RESULT(Busy, 122); - R_DEFINE_ERROR_RESULT(SessionClosed, 123); - R_DEFINE_ERROR_RESULT(NotHandled, 124); - R_DEFINE_ERROR_RESULT(InvalidState, 125); - R_DEFINE_ERROR_RESULT(ReservedValue, 126); - R_DEFINE_ERROR_RESULT(NotSupported, 127); - R_DEFINE_ERROR_RESULT(Debug, 128); - R_DEFINE_ERROR_RESULT(ThreadNotOwned, 129); - - R_DEFINE_ERROR_RESULT(PortClosed, 131); - R_DEFINE_ERROR_RESULT(LimitReached, 132); - - R_DEFINE_ERROR_RESULT(ReceiveListBroken, 258); - R_DEFINE_ERROR_RESULT(OutOfAddressSpace, 259); - R_DEFINE_ERROR_RESULT(MessageTooLarge, 260); - - R_DEFINE_ERROR_RESULT(ProcessTerminated, 520); - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/results/updater_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/updater_results.hpp deleted file mode 100644 index ea40f96..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/updater_results.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 "results_common.hpp" - -namespace ams::updater { - - R_DEFINE_NAMESPACE_RESULT_MODULE(158); - - R_DEFINE_ERROR_RESULT(BootImagePackageNotFound, 2); - R_DEFINE_ERROR_RESULT(InvalidBootImagePackage, 3); - R_DEFINE_ERROR_RESULT(TooSmallWorkBuffer, 4); - R_DEFINE_ERROR_RESULT(NotAlignedWorkBuffer, 5); - R_DEFINE_ERROR_RESULT(NeedsRepairBootImages, 6); - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/results/vi_results.hpp b/stratosphere/libstratosphere/include/stratosphere/results/vi_results.hpp deleted file mode 100644 index 30b5190..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/results/vi_results.hpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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 "results_common.hpp" - -namespace ams::vi { - - R_DEFINE_NAMESPACE_RESULT_MODULE(114); - - R_DEFINE_ERROR_RESULT(OperationFailed, 1); - R_DEFINE_ERROR_RESULT(NotSupported, 6); - R_DEFINE_ERROR_RESULT(NotFound, 7); - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/rnd.hpp b/stratosphere/libstratosphere/include/stratosphere/rnd.hpp index 7315f6b..a11eba7 100644 --- a/stratosphere/libstratosphere/include/stratosphere/rnd.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/rnd.hpp @@ -15,6 +15,5 @@ */ #pragma once -#include #include "rnd/rnd_api.hpp" diff --git a/stratosphere/libstratosphere/include/stratosphere/rnd/rnd_api.hpp b/stratosphere/libstratosphere/include/stratosphere/rnd/rnd_api.hpp index ae352f5..dcea365 100644 --- a/stratosphere/libstratosphere/include/stratosphere/rnd/rnd_api.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/rnd/rnd_api.hpp @@ -15,8 +15,7 @@ */ #pragma once -#include -#include +#include namespace ams::rnd { diff --git a/stratosphere/libstratosphere/include/stratosphere/ro.hpp b/stratosphere/libstratosphere/include/stratosphere/ro.hpp index 42239e9..c5835d4 100644 --- a/stratosphere/libstratosphere/include/stratosphere/ro.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/ro.hpp @@ -15,6 +15,5 @@ */ #pragma once -#include #include "ro/ro_types.hpp" diff --git a/stratosphere/libstratosphere/include/stratosphere/ro/ro_types.hpp b/stratosphere/libstratosphere/include/stratosphere/ro/ro_types.hpp index b4f857e..ed03932 100644 --- a/stratosphere/libstratosphere/include/stratosphere/ro/ro_types.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/sf.hpp b/stratosphere/libstratosphere/include/stratosphere/sf.hpp index 8b39292..7c7a528 100644 --- a/stratosphere/libstratosphere/include/stratosphere/sf.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/sf/hipc/sf_hipc_server_manager.hpp b/stratosphere/libstratosphere/include/stratosphere/sf/hipc/sf_hipc_server_manager.hpp index 43cdc50..4604a93 100644 --- a/stratosphere/libstratosphere/include/stratosphere/sf/hipc/sf_hipc_server_manager.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/sf/sf_common.hpp b/stratosphere/libstratosphere/include/stratosphere/sf/sf_common.hpp index 57b9bc8..7197532 100644 --- a/stratosphere/libstratosphere/include/stratosphere/sf/sf_common.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/sm.hpp b/stratosphere/libstratosphere/include/stratosphere/sm.hpp index 5c6ac9f..8dd7421 100644 --- a/stratosphere/libstratosphere/include/stratosphere/sm.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/sm/sm_types.hpp b/stratosphere/libstratosphere/include/stratosphere/sm/sm_types.hpp index d61777f..028f2a8 100644 --- a/stratosphere/libstratosphere/include/stratosphere/sm/sm_types.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/spl.hpp b/stratosphere/libstratosphere/include/stratosphere/spl.hpp index d0b43e9..25f266b 100644 --- a/stratosphere/libstratosphere/include/stratosphere/spl.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/spl.hpp @@ -15,7 +15,6 @@ */ #pragma once -#include #include "spl/spl_types.hpp" #include "spl/spl_api.hpp" diff --git a/stratosphere/libstratosphere/include/stratosphere/spl/smc/spl_smc.hpp b/stratosphere/libstratosphere/include/stratosphere/spl/smc/spl_smc.hpp index 5d1c05b..cef9c97 100644 --- a/stratosphere/libstratosphere/include/stratosphere/spl/smc/spl_smc.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/spl/spl_api.hpp b/stratosphere/libstratosphere/include/stratosphere/spl/spl_api.hpp index d49c151..d68abc9 100644 --- a/stratosphere/libstratosphere/include/stratosphere/spl/spl_api.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/spl/spl_api.hpp @@ -15,7 +15,6 @@ */ #pragma once - #include "spl_types.hpp" namespace ams::spl { diff --git a/stratosphere/libstratosphere/include/stratosphere/spl/spl_types.hpp b/stratosphere/libstratosphere/include/stratosphere/spl/spl_types.hpp index 1cd3f72..4f1816b 100644 --- a/stratosphere/libstratosphere/include/stratosphere/spl/spl_types.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/spl/spl_types.hpp @@ -15,8 +15,7 @@ */ #pragma once -#include -#include "../results.hpp" +#include namespace ams::spl { diff --git a/stratosphere/libstratosphere/include/stratosphere/svc.hpp b/stratosphere/libstratosphere/include/stratosphere/svc.hpp deleted file mode 100644 index dad8515..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/svc.hpp +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 "svc/svc_types.hpp" diff --git a/stratosphere/libstratosphere/include/stratosphere/svc/svc_types.hpp b/stratosphere/libstratosphere/include/stratosphere/svc/svc_types.hpp deleted file mode 100644 index 275cbe0..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/svc/svc_types.hpp +++ /dev/null @@ -1,211 +0,0 @@ -/* - * 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 -#include "../defines.hpp" -#include "../results.hpp" - -namespace ams::svc { - - /* Debug event types. */ - enum class DebugEventType : u32 { - AttachProcess = 0, - AttachThread = 1, - ExitProcess = 2, - ExitThread = 3, - Exception = 4, - }; - - struct DebugInfoAttachProcess { - u64 title_id; - u64 process_id; - char name[0xC]; - u32 flags; - u64 user_exception_context_address; /* 5.0.0+ */ - }; - - struct DebugInfoAttachThread { - u64 thread_id; - u64 tls_address; - u64 entrypoint; - }; - - enum class ExitProcessReason : u32 { - ExitProcess = 0, - TerminateProcess = 1, - Exception = 2, - }; - - struct DebugInfoExitProcess { - ExitProcessReason reason; - }; - - enum class ExitThreadReason : u32 { - ExitThread = 0, - TerminateThread = 1, - ExitProcess = 2, - TerminateProcess = 3, - }; - - struct DebugInfoExitThread { - ExitThreadReason reason; - }; - - enum class DebugExceptionType : u32 { - UndefinedInstruction = 0, - InstructionAbort = 1, - DataAbort = 2, - AlignmentFault = 3, - DebuggerAttached = 4, - BreakPoint = 5, - UserBreak = 6, - DebuggerBreak = 7, - UndefinedSystemCall = 8, - SystemMemoryError = 9, - }; - - struct DebugInfoUndefinedInstructionException { - u32 insn; - }; - - struct DebugInfoDataAbortException { - u64 address; - }; - - struct DebugInfoAligntmentFaultException { - u64 address; - }; - - enum class BreakPointType : u32 { - BreakPoint = 0, - WatchPoint = 1, - }; - - struct DebugInfoBreakPointException { - BreakPointType type; - u64 address; - }; - - struct DebugInfoUserBreakException { - u32 break_reason; /* TODO: enum? */ - u64 address; - u64 size; - }; - - struct DebugInfoDebuggerBreakException { - u64 active_thread_ids[4]; - }; - - struct DebugInfoUndefinedSystemCallException { - u32 id; - }; - - union DebugInfoSpecificException { - DebugInfoUndefinedInstructionException undefined_instruction; - DebugInfoDataAbortException data_abort; - DebugInfoAligntmentFaultException alignment_fault; - DebugInfoBreakPointException break_point; - DebugInfoUserBreakException user_break; - DebugInfoDebuggerBreakException debugger_break; - DebugInfoUndefinedSystemCallException undefined_system_call; - u64 raw; - }; - - struct DebugInfoException { - DebugExceptionType type; - u64 address; - DebugInfoSpecificException specific; - }; - - union DebugInfo { - DebugInfoAttachProcess attach_process; - DebugInfoAttachThread attach_thread; - DebugInfoExitProcess exit_process; - DebugInfoExitThread exit_thread; - DebugInfoException exception; - }; - - struct DebugEventInfo { - DebugEventType type; - u32 flags; - u64 thread_id; - DebugInfo info; - }; - static_assert(sizeof(DebugEventInfo) >= 0x40, "DebugEventInfo definition!"); - - /* Thread State, for svcGetDebugThreadParam. */ - enum class ThreadState : u32 { - Waiting = 0, - Running = 1, - Terminated = 4, - Initializing = 5, - }; - - enum ThreadContextFlag : u32 { - ThreadContextFlag_General = (1 << 0), - ThreadContextFlag_Control = (1 << 1), - ThreadContextFlag_Fpu = (1 << 2), - ThreadContextFlag_FpuControl = (1 << 3), - - ThreadContextFlag_All = (ThreadContextFlag_General | ThreadContextFlag_Control | ThreadContextFlag_Fpu | ThreadContextFlag_FpuControl), - }; - - /* Flags for svcCreateProcess. */ - enum CreateProcessFlag : u32 { - /* Is 64 bit? */ - CreateProcessFlag_Is64Bit = (1 << 0), - - /* What kind of address space? */ - CreateProcessFlag_AddressSpaceShift = 1, - CreateProcessFlag_AddressSpaceMask = (7 << CreateProcessFlag_AddressSpaceShift), - CreateProcessFlag_AddressSpace32Bit = (0 << CreateProcessFlag_AddressSpaceShift), - CreateProcessFlag_AddressSpace64BitDeprecated = (1 << CreateProcessFlag_AddressSpaceShift), - CreateProcessFlag_AddressSpace32BitWithoutAlias = (2 << CreateProcessFlag_AddressSpaceShift), - CreateProcessFlag_AddressSpace64Bit = (3 << CreateProcessFlag_AddressSpaceShift), - - /* Should JIT debug be done on crash? */ - CreateProcessFlag_EnableDebug = (1 << 4), - - /* Should ASLR be enabled for the process? */ - CreateProcessFlag_EnableAslr = (1 << 5), - - /* Is the process an application? */ - CreateProcessFlag_IsApplication = (1 << 6), - - /* 4.x deprecated: Should use secure memory? */ - CreateProcessFlag_DeprecatedUseSecureMemory = (1 << 7), - - /* 5.x+ Pool partition type. */ - CreateProcessFlag_PoolPartitionShift = 7, - CreateProcessFlag_PoolPartitionMask = (0xF << CreateProcessFlag_PoolPartitionShift), - CreateProcessFlag_PoolPartitionApplication = (0 << CreateProcessFlag_PoolPartitionShift), - CreateProcessFlag_PoolPartitionApplet = (1 << CreateProcessFlag_PoolPartitionShift), - CreateProcessFlag_PoolPartitionSystem = (2 << CreateProcessFlag_PoolPartitionShift), - CreateProcessFlag_PoolPartitionSystemNonSecure = (3 << CreateProcessFlag_PoolPartitionShift), - - /* 7.x+ Should memory allocation be optimized? This requires IsApplication. */ - CreateProcessFlag_OptimizeMemoryAllocation = (1 << 11), - }; - - /* Type for svcCreateInterruptEvent. */ - enum InterruptType : u32 { - InterruptType_Edge = 0, - InterruptType_Level = 1, - }; - -} diff --git a/stratosphere/libstratosphere/include/stratosphere/updater.hpp b/stratosphere/libstratosphere/include/stratosphere/updater.hpp index 5195450..5d49414 100644 --- a/stratosphere/libstratosphere/include/stratosphere/updater.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/updater.hpp @@ -15,7 +15,6 @@ */ #pragma once -#include #include "updater/updater_types.hpp" #include "updater/updater_api.hpp" diff --git a/stratosphere/libstratosphere/include/stratosphere/updater/updater_api.hpp b/stratosphere/libstratosphere/include/stratosphere/updater/updater_api.hpp index 55482ef..4c36dd2 100644 --- a/stratosphere/libstratosphere/include/stratosphere/updater/updater_api.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/include/stratosphere/updater/updater_types.hpp b/stratosphere/libstratosphere/include/stratosphere/updater/updater_types.hpp index 6675f3d..4690369 100644 --- a/stratosphere/libstratosphere/include/stratosphere/updater/updater_types.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/updater/updater_types.hpp @@ -15,7 +15,7 @@ */ #pragma once -#include +#include namespace ams::updater { diff --git a/stratosphere/libstratosphere/include/stratosphere/util.hpp b/stratosphere/libstratosphere/include/stratosphere/util.hpp deleted file mode 100644 index a8b21ab..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/util.hpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 "util/util_alignment.hpp" -#include "util/util_size.hpp" -#include "util/util_scope_guard.hpp" -#include "util/util_typed_storage.hpp" -#include "util/util_intrusive_list.hpp" -#include "util/util_intrusive_red_black_tree.hpp" -#include "util/util_compression.hpp" -#include "util/util_ini.hpp" diff --git a/stratosphere/libstratosphere/include/stratosphere/util/util_alignment.hpp b/stratosphere/libstratosphere/include/stratosphere/util/util_alignment.hpp deleted file mode 100644 index 7ef5c05..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/util/util_alignment.hpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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 - -namespace ams::util { - - /* Utilities for alignment to power of two. */ - - template - constexpr inline T AlignUp(T value, size_t alignment) { - using U = typename std::make_unsigned::type; - const U invmask = static_cast(alignment - 1); - return static_cast((value + invmask) & ~invmask); - } - - template - constexpr inline T AlignDown(T value, size_t alignment) { - using U = typename std::make_unsigned::type; - const U invmask = static_cast(alignment - 1); - return static_cast(value & ~invmask); - } - - template - constexpr inline bool IsAligned(T value, size_t alignment) { - using U = typename std::make_unsigned::type; - const U invmask = static_cast(alignment - 1); - return (value & invmask) == 0; - } - - template<> - constexpr inline void *AlignUp(void *value, size_t alignment) { - return reinterpret_cast(AlignUp(reinterpret_cast(value), alignment)); - } - - template<> - constexpr inline const void *AlignUp(const void *value, size_t alignment) { - return reinterpret_cast(AlignUp(reinterpret_cast(value), alignment)); - } - - template<> - constexpr inline void *AlignDown(void *value, size_t alignment) { - return reinterpret_cast(AlignDown(reinterpret_cast(value), alignment)); - } - - template<> - constexpr inline const void *AlignDown(const void *value, size_t alignment) { - return reinterpret_cast(AlignDown(reinterpret_cast(value), alignment)); - } - - template<> - constexpr inline bool IsAligned(void *value, size_t alignment) { - return IsAligned(reinterpret_cast(value), alignment); - } - - template<> - constexpr inline bool IsAligned(const void *value, size_t alignment) { - return IsAligned(reinterpret_cast(value), alignment); - } - -} \ No newline at end of file diff --git a/stratosphere/libstratosphere/include/stratosphere/util/util_compression.hpp b/stratosphere/libstratosphere/include/stratosphere/util/util_compression.hpp deleted file mode 100644 index 644cfef..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/util/util_compression.hpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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 - -namespace ams::util { - - /* Compression utilities. */ - int CompressLZ4(void *dst, size_t dst_size, const void *src, size_t src_size); - - /* Decompression utilities. */ - int DecompressLZ4(void *dst, size_t dst_size, const void *src, size_t src_size); - -} \ No newline at end of file diff --git a/stratosphere/libstratosphere/include/stratosphere/util/util_ini.hpp b/stratosphere/libstratosphere/include/stratosphere/util/util_ini.hpp deleted file mode 100644 index ba398cf..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/util/util_ini.hpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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 - -namespace ams::util::ini { - - /* Ini handler type. */ - using Handler = int (*)(void *user_ctx, const char *section, const char *name, const char *value); - - /* Utilities for dealing with INI file configuration. */ - int ParseString(const char *ini_str, void *user_ctx, Handler h); - int ParseFile(FILE *f, void *user_ctx, Handler h); - int ParseFile(FsFile *f, void *user_ctx, Handler h); - int ParseFile(const char *path, void *user_ctx, Handler h); - -} \ No newline at end of file diff --git a/stratosphere/libstratosphere/include/stratosphere/util/util_intrusive_list.hpp b/stratosphere/libstratosphere/include/stratosphere/util/util_intrusive_list.hpp deleted file mode 100644 index 36f6431..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/util/util_intrusive_list.hpp +++ /dev/null @@ -1,599 +0,0 @@ -/* - * 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 -#include "../defines.hpp" - -#include "util_parent_of_member.hpp" - -namespace ams::util { - - /* Forward declare implementation class for Node. */ - namespace impl { - - class IntrusiveListImpl; - - } - - class IntrusiveListNode { - NON_COPYABLE(IntrusiveListNode); - private: - friend class impl::IntrusiveListImpl; - - IntrusiveListNode *prev; - IntrusiveListNode *next; - public: - IntrusiveListNode() { - this->prev = this; - this->next = this; - } - - bool IsLinked() const { - return this->next != this; - } - private: - void LinkPrev(IntrusiveListNode *node) { - /* We can't link an already linked node. */ - AMS_ASSERT(!node->IsLinked()); - this->SplicePrev(node, node); - } - - void SplicePrev(IntrusiveListNode *first, IntrusiveListNode *last) { - /* Splice a range into the list. */ - auto last_prev = last->prev; - first->prev = this->prev; - this->prev->next = first; - last_prev->next = this; - this->prev = last_prev; - } - - void LinkNext(IntrusiveListNode *node) { - /* We can't link an already linked node. */ - AMS_ASSERT(!node->IsLinked()); - return this->SpliceNext(node, node); - } - - void SpliceNext(IntrusiveListNode *first, IntrusiveListNode *last) { - /* Splice a range into the list. */ - auto last_prev = last->prev; - first->prev = this; - this->next = first; - last_prev->next = next; - this->next->prev = last_prev; - } - - void Unlink() { - this->Unlink(this->next); - } - - void Unlink(IntrusiveListNode *last) { - /* Unlink a node from a next node. */ - auto last_prev = last->prev; - this->prev->next = last; - last->prev = this->prev; - last_prev->next = this; - this->prev = last_prev; - } - - IntrusiveListNode *GetPrev() { - return this->prev; - } - - const IntrusiveListNode *GetPrev() const { - return this->prev; - } - - IntrusiveListNode *GetNext() { - return this->next; - } - - const IntrusiveListNode *GetNext() const { - return this->next; - } - }; - - namespace impl { - - class IntrusiveListImpl { - NON_COPYABLE(IntrusiveListImpl); - private: - IntrusiveListNode root_node; - public: - template - class Iterator; - - using value_type = IntrusiveListNode; - using size_type = size_t; - using difference_type = ptrdiff_t; - using pointer = value_type *; - using const_pointer = const value_type *; - using reference = value_type &; - using const_reference = const value_type &; - using iterator = Iterator; - using const_iterator = Iterator; - using reverse_iterator = std::reverse_iterator; - using const_reverse_iterator = std::reverse_iterator; - - template - class Iterator { - public: - using iterator_category = std::bidirectional_iterator_tag; - using value_type = typename IntrusiveListImpl::value_type; - using difference_type = typename IntrusiveListImpl::difference_type; - using pointer = typename std::conditional::type; - using reference = typename std::conditional::type; - private: - pointer node; - public: - explicit Iterator(pointer n) : node(n) { /* ... */ } - - bool operator==(const Iterator &rhs) const { - return this->node == rhs.node; - } - - bool operator!=(const Iterator &rhs) const { - return !(*this == rhs); - } - - pointer operator->() const { - return this->node; - } - - reference operator*() const { - return *this->node; - } - - Iterator &operator++() { - this->node = this->node->next; - return *this; - } - - Iterator &operator--() { - this->node = this->node->prev; - return *this; - } - - Iterator operator++(int) { - const Iterator it{*this}; - ++(*this); - return it; - } - - Iterator operator--(int) { - const Iterator it{*this}; - --(*this); - return it; - } - - operator Iterator() const { - return Iterator(this->node); - } - - Iterator GetNonConstIterator() const { - return Iterator(const_cast(this->node)); - } - }; - public: - IntrusiveListImpl() : root_node() { /* ... */ } - - /* Iterator accessors. */ - iterator begin() { - return iterator(this->root_node.GetNext()); - } - - const_iterator begin() const { - return const_iterator(this->root_node.GetNext()); - } - - iterator end() { - return iterator(&this->root_node); - } - - const_iterator end() const { - return const_iterator(&this->root_node); - } - - iterator iterator_to(reference v) { - /* Only allow iterator_to for values in lists. */ - AMS_ASSERT(v.IsLinked()); - return iterator(&v); - } - - const_iterator iterator_to(const_reference v) const { - /* Only allow iterator_to for values in lists. */ - AMS_ASSERT(v.IsLinked()); - return const_iterator(&v); - } - - /* Content management. */ - bool empty() const { - return !this->root_node.IsLinked(); - } - - size_type size() const { - return static_cast(std::distance(this->begin(), this->end())); - } - - reference back() { - return *this->root_node.GetPrev(); - } - - const_reference back() const { - return *this->root_node.GetPrev(); - } - - reference front() { - return *this->root_node.GetNext(); - } - - const_reference front() const { - return *this->root_node.GetNext(); - } - - void push_back(reference node) { - this->root_node.LinkPrev(&node); - } - - void push_front(reference node) { - this->root_node.LinkNext(&node); - } - - void pop_back() { - this->root_node.GetPrev()->Unlink(); - } - - void pop_front() { - this->root_node.GetNext()->Unlink(); - } - - iterator insert(const_iterator pos, reference node) { - pos.GetNonConstIterator()->LinkPrev(&node); - return iterator(&node); - } - - void splice(const_iterator pos, IntrusiveListImpl &o) { - splice_impl(pos, o.begin(), o.end()); - } - - void splice(const_iterator pos, IntrusiveListImpl &o, const_iterator first) { - const_iterator last(first); - std::advance(last, 1); - splice_impl(pos, first, last); - } - - void splice(const_iterator pos, IntrusiveListImpl &o, const_iterator first, const_iterator last) { - splice_impl(pos, first, last); - } - - iterator erase(const iterator pos) { - if (pos == this->end()) { - return this->end(); - } - iterator it(pos.GetNonConstIterator()); - (it++)->Unlink(); - return it; - } - - void clear() { - while (!this->empty()) { - this->pop_front(); - } - } - private: - void splice_impl(const_iterator _pos, const_iterator _first, const_iterator _last) { - if (_first == _last) { - return; - } - iterator pos(_pos.GetNonConstIterator()); - iterator first(_first.GetNonConstIterator()); - iterator last(_last.GetNonConstIterator()); - first->Unlink(&*last); - pos->SplicePrev(&*first, &*first); - } - - }; - - } - - template - class IntrusiveList { - NON_COPYABLE(IntrusiveList); - private: - impl::IntrusiveListImpl impl; - public: - template - class Iterator; - - using value_type = T; - using size_type = size_t; - using difference_type = ptrdiff_t; - using pointer = value_type *; - using const_pointer = const value_type *; - using reference = value_type &; - using const_reference = const value_type &; - using iterator = Iterator; - using const_iterator = Iterator; - using reverse_iterator = std::reverse_iterator; - using const_reverse_iterator = std::reverse_iterator; - - template - class Iterator { - public: - friend class ams::util::IntrusiveList; - - using ImplIterator = typename std::conditional::type; - - using iterator_category = std::bidirectional_iterator_tag; - using value_type = typename IntrusiveList::value_type; - using difference_type = typename IntrusiveList::difference_type; - using pointer = typename std::conditional::type; - using reference = typename std::conditional::type; - private: - ImplIterator iterator; - private: - explicit Iterator(ImplIterator it) : iterator(it) { /* ... */ } - - ImplIterator GetImplIterator() const { - return this->iterator; - } - public: - bool operator==(const Iterator &rhs) const { - return this->iterator == rhs.iterator; - } - - bool operator!=(const Iterator &rhs) const { - return !(*this == rhs); - } - - pointer operator->() const { - return &Traits::GetParent(*this->iterator); - } - - reference operator*() const { - return Traits::GetParent(*this->iterator); - } - - Iterator &operator++() { - ++this->iterator; - return *this; - } - - Iterator &operator--() { - --this->iterator; - return *this; - } - - Iterator operator++(int) { - const Iterator it{*this}; - ++this->iterator; - return it; - } - - Iterator operator--(int) { - const Iterator it{*this}; - --this->iterator; - return it; - } - - operator Iterator() const { - return Iterator(this->iterator); - } - }; - private: - static constexpr IntrusiveListNode &GetNode(reference ref) { - return Traits::GetNode(ref); - } - - static constexpr IntrusiveListNode const &GetNode(const_reference ref) { - return Traits::GetNode(ref); - } - - static constexpr reference GetParent(IntrusiveListNode &node) { - return Traits::GetParent(node); - } - - static constexpr const_reference GetParent(IntrusiveListNode const &node) { - return Traits::GetParent(node); - } - public: - IntrusiveList() : impl() { /* ... */ } - - /* Iterator accessors. */ - iterator begin() { - return iterator(this->impl.begin()); - } - - const_iterator begin() const { - return const_iterator(this->impl.begin()); - } - - iterator end() { - return iterator(this->impl.end()); - } - - const_iterator end() const { - return const_iterator(this->impl.end()); - } - - const_iterator cbegin() const { - return this->begin(); - } - - const_iterator cend() const { - return this->end(); - } - - reverse_iterator rbegin() { - return reverse_iterator(this->end()); - } - - const_reverse_iterator rbegin() const { - return const_reverse_iterator(this->end()); - } - - reverse_iterator rend() { - return reverse_iterator(this->begin()); - } - - const_reverse_iterator rend() const { - return const_reverse_iterator(this->begin()); - } - - const_reverse_iterator crbegin() const { - return this->rbegin(); - } - - const_reverse_iterator crend() const { - return this->rend(); - } - - iterator iterator_to(reference v) { - return iterator(this->impl.iterator_to(GetNode(v))); - } - - const_iterator iterator_to(const_reference v) const { - return const_iterator(this->impl.iterator_to(GetNode(v))); - } - - /* Content management. */ - bool empty() const { - return this->impl.empty(); - } - - size_type size() const { - return this->impl.size(); - } - - reference back() { - AMS_ASSERT(!this->impl.empty()); - return GetParent(this->impl.back()); - } - - const_reference back() const { - AMS_ASSERT(!this->impl.empty()); - return GetParent(this->impl.back()); - } - - reference front() { - AMS_ASSERT(!this->impl.empty()); - return GetParent(this->impl.front()); - } - - const_reference front() const { - AMS_ASSERT(!this->impl.empty()); - return GetParent(this->impl.front()); - } - - void push_back(reference ref) { - this->impl.push_back(GetNode(ref)); - } - - void push_front(reference ref) { - this->impl.push_back(GetNode(ref)); - } - - void pop_back() { - AMS_ASSERT(!this->impl.empty()); - this->impl.pop_back(); - } - - void pop_front() { - AMS_ASSERT(!this->impl.empty()); - this->impl.pop_front(); - } - - iterator insert(const_iterator pos, reference ref) { - return iterator(this->impl.insert(pos.GetImplIterator(), GetNode(ref))); - } - - void splice(const_iterator pos, IntrusiveList &o) { - this->impl.splice(pos.GetImplIterator(), o.impl); - } - - void splice(const_iterator pos, IntrusiveList &o, const_iterator first) { - this->impl.splice(pos.GetImplIterator(), o.impl, first.GetImplIterator()); - } - - void splice(const_iterator pos, IntrusiveList &o, const_iterator first, const_iterator last) { - this->impl.splice(pos.GetImplIterator(), o.impl, first.GetImplIterator(), last.GetImplIterator()); - } - - iterator erase(const iterator pos) { - return iterator(this->impl.erase(pos.GetImplIterator())); - } - - void clear() { - this->impl.clear(); - } - }; - - template> - class IntrusiveListMemberTraits; - - template - class IntrusiveListMemberTraits { - public: - using ListType = IntrusiveList; - private: - friend class IntrusiveList; - - static constexpr IntrusiveListNode &GetNode(Derived &parent) { - return parent.*Member; - } - - static constexpr IntrusiveListNode const &GetNode(Derived const &parent) { - return parent.*Member; - } - - static constexpr Derived &GetParent(IntrusiveListNode &node) { - return static_cast(util::GetParentReference(&node)); - } - - static constexpr Derived const &GetParent(IntrusiveListNode const &node) { - return static_cast(util::GetParentReference(&node)); - } - }; - - template - class IntrusiveListBaseNode : public IntrusiveListNode{}; - - template - class IntrusiveListBaseTraits { - public: - using ListType = IntrusiveList; - private: - friend class IntrusiveList; - - static constexpr IntrusiveListNode &GetNode(Derived &parent) { - return static_cast(parent); - } - - static constexpr IntrusiveListNode const &GetNode(Derived const &parent) { - return static_cast(parent); - } - - static constexpr Derived &GetParent(IntrusiveListNode &node) { - return static_cast(node); - } - - static constexpr Derived const &GetParent(IntrusiveListNode const &node) { - return static_cast(node); - } - }; - -} \ No newline at end of file diff --git a/stratosphere/libstratosphere/include/stratosphere/util/util_intrusive_red_black_tree.hpp b/stratosphere/libstratosphere/include/stratosphere/util/util_intrusive_red_black_tree.hpp deleted file mode 100644 index b1769f1..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/util/util_intrusive_red_black_tree.hpp +++ /dev/null @@ -1,301 +0,0 @@ -/* - * 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 -#include -#include "../defines.hpp" - -#include "util_parent_of_member.hpp" - -namespace ams::util { - - struct IntrusiveRedBlackTreeNode { - NON_COPYABLE(IntrusiveRedBlackTreeNode); - private: - RB_ENTRY(IntrusiveRedBlackTreeNode) entry; - - template - friend class IntrusiveRedBlackTree; - public: - IntrusiveRedBlackTreeNode() { /* ... */} - }; - - template - class IntrusiveRedBlackTree { - NON_COPYABLE(IntrusiveRedBlackTree); - private: - RB_HEAD(IntrusiveRedBlackTreeRoot, IntrusiveRedBlackTreeNode); - - IntrusiveRedBlackTreeRoot root; - public: - template - class Iterator; - - using value_type = T; - using size_type = size_t; - using difference_type = ptrdiff_t; - using pointer = T *; - using const_pointer = const T *; - using reference = T &; - using const_reference = const T &; - using iterator = Iterator; - using const_iterator = Iterator; - - template - class Iterator { - public: - using iterator_category = std::bidirectional_iterator_tag; - using value_type = typename IntrusiveRedBlackTree::value_type; - using difference_type = typename IntrusiveRedBlackTree::difference_type; - using pointer = typename std::conditional::type; - using reference = typename std::conditional::type; - private: - pointer node; - public: - explicit Iterator(pointer n) : node(n) { /* ... */ } - - bool operator==(const Iterator &rhs) const { - return this->node == rhs.node; - } - - bool operator!=(const Iterator &rhs) const { - return !(*this == rhs); - } - - pointer operator->() const { - return this->node; - } - - reference operator*() const { - return *this->node; - } - - Iterator &operator++() { - this->node = Traits::GetParent(GetNext(Traits::GetNode(this->node))); - return *this; - } - - Iterator &operator--() { - this->node = Traits::GetParent(GetPrev(Traits::GetNode(this->node))); - return *this; - } - - Iterator operator++(int) { - const Iterator it{*this}; - ++(*this); - return it; - } - - Iterator operator--(int) { - const Iterator it{*this}; - --(*this); - return it; - } - - operator Iterator() const { - return Iterator(this->node); - } - }; - private: - static int CompareImpl(const IntrusiveRedBlackTreeNode *lhs, const IntrusiveRedBlackTreeNode *rhs) { - return Comparator::Compare(*Traits::GetParent(lhs), *Traits::GetParent(rhs)); - } - - /* Generate static implementations for IntrusiveRedBlackTreeRoot. */ - RB_GENERATE_STATIC(IntrusiveRedBlackTreeRoot, IntrusiveRedBlackTreeNode, entry, CompareImpl); - - static constexpr inline IntrusiveRedBlackTreeNode *GetNext(IntrusiveRedBlackTreeNode *node) { - return RB_NEXT(IntrusiveRedBlackTreeRoot, nullptr, node); - } - - static constexpr inline IntrusiveRedBlackTreeNode const *GetNext(IntrusiveRedBlackTreeNode const *node) { - return const_cast(GetNext(const_cast(node))); - } - - static constexpr inline IntrusiveRedBlackTreeNode *GetPrev(IntrusiveRedBlackTreeNode *node) { - return RB_NEXT(IntrusiveRedBlackTreeRoot, nullptr, node); - } - - static constexpr inline IntrusiveRedBlackTreeNode const *GetPrev(IntrusiveRedBlackTreeNode const *node) { - return const_cast(GetPrev(const_cast(node))); - } - - /* Define accessors using RB_* functions. */ - void InitializeImpl() { - RB_INIT(&this->root); - } - - bool EmptyImpl() const { - return RB_EMPTY(&this->root); - } - - IntrusiveRedBlackTreeNode *GetMinImpl() const { - return RB_MIN(IntrusiveRedBlackTreeRoot, const_cast(&this->root)); - } - - IntrusiveRedBlackTreeNode *GetMaxImpl() const { - return RB_MIN(IntrusiveRedBlackTreeRoot, const_cast(&this->root)); - } - - IntrusiveRedBlackTreeNode *InsertImpl(IntrusiveRedBlackTreeNode *node) { - return RB_INSERT(IntrusiveRedBlackTreeRoot, &this->root, node); - } - - IntrusiveRedBlackTreeNode *RemoveImpl(IntrusiveRedBlackTreeNode *node) { - return RB_REMOVE(IntrusiveRedBlackTreeRoot, &this->root, node); - } - - IntrusiveRedBlackTreeNode *FindImpl(IntrusiveRedBlackTreeNode const *node) const { - return RB_FIND(IntrusiveRedBlackTreeRoot, const_cast(&this->root), const_cast(node)); - } - - IntrusiveRedBlackTreeNode *NFindImpl(IntrusiveRedBlackTreeNode const *node) const { - return RB_NFIND(IntrusiveRedBlackTreeRoot, const_cast(&this->root), const_cast(node)); - } - - public: - IntrusiveRedBlackTree() { - this->InitializeImpl(); - } - - /* Iterator accessors. */ - iterator begin() { - return iterator(Traits::GetParent(this->GetMinImpl())); - } - - const_iterator begin() const { - return const_iterator(Traits::GetParent(this->GetMinImpl())); - } - - iterator end() { - return iterator(Traits::GetParent(static_cast(nullptr))); - } - - const_iterator end() const { - return const_iterator(Traits::GetParent(static_cast(nullptr))); - } - - iterator iterator_to(reference ref) { - return iterator(&ref); - } - - const_iterator iterator_to(const_reference ref) const { - return const_iterator(&ref); - } - - /* Content management. */ - bool empty() const { - return this->EmptyImpl(); - } - - reference back() { - return Traits::GetParent(this->GetMaxImpl()); - } - - const_reference back() const { - return Traits::GetParent(this->GetMaxImpl()); - } - - reference front() { - return Traits::GetParent(this->GetMinImpl()); - } - - const_reference front() const { - return Traits::GetParent(this->GetMinImpl()); - } - - iterator insert(reference ref) { - this->InsertImpl(Traits::GetNode(&ref)); - return iterator(&ref); - } - - iterator erase(iterator it) { - auto cur = Traits::GetNode(&*it); - auto next = Traits::GetParent(GetNext(cur)); - this->RemoveImpl(cur); - return iterator(next); - } - - iterator find(const_reference ref) const { - return iterator(Traits::GetParent(this->FindImpl(Traits::GetNode(&ref)))); - } - - iterator nfind(const_reference ref) const { - return iterator(Traits::GetParent(this->NFindImpl(Traits::GetNode(&ref)))); - } - }; - - template> - class IntrusiveRedBlackTreeMemberTraits; - - template - class IntrusiveRedBlackTreeMemberTraits { - public: - template - using ListType = IntrusiveRedBlackTree; - private: - template - friend class IntrusiveRedBlackTree; - - static constexpr IntrusiveRedBlackTreeNode *GetNode(Derived *parent) { - return &(parent->*Member); - } - - static constexpr IntrusiveRedBlackTreeNode const *GetNode(Derived const *parent) { - return &(parent->*Member); - } - - static constexpr Derived *GetParent(IntrusiveRedBlackTreeNode *node) { - return static_cast(util::GetParentPointer(node)); - } - - static constexpr Derived const *GetParent(IntrusiveRedBlackTreeNode const *node) { - return static_cast(util::GetParentPointer(node)); - } - }; - - template - class IntrusiveRedBlackTreeBaseNode : public IntrusiveRedBlackTreeNode{}; - - template - class IntrusiveRedBlackTreeBaseTraits { - public: - template - using ListType = IntrusiveRedBlackTree; - private: - template - friend class IntrusiveRedBlackTree; - - static constexpr IntrusiveRedBlackTreeNode *GetNode(Derived *parent) { - return static_cast(parent); - } - - static constexpr IntrusiveRedBlackTreeNode const *GetNode(Derived const *parent) { - return static_cast(parent); - } - - static constexpr Derived *GetParent(IntrusiveRedBlackTreeNode *node) { - return static_cast(node); - } - - static constexpr Derived const *GetParent(IntrusiveRedBlackTreeNode const *node) { - return static_cast(node); - } - }; - -} \ No newline at end of file diff --git a/stratosphere/libstratosphere/include/stratosphere/util/util_parent_of_member.hpp b/stratosphere/libstratosphere/include/stratosphere/util/util_parent_of_member.hpp deleted file mode 100644 index 55efae0..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/util/util_parent_of_member.hpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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" - -namespace ams::util { - - namespace impl { - - template - union OffsetOfImpl { - Member Parent::* ptr; - intptr_t offset; - }; - - template - constexpr inline Parent *GetParentOfMemberImpl(Member *member, Member Parent::* ptr) { - return reinterpret_cast(reinterpret_cast(member) - OffsetOfImpl{ ptr }.offset); - } - - template - constexpr inline Parent const *GetParentOfMemberImpl(Member const *member, Member Parent::* ptr) { - return reinterpret_cast(reinterpret_cast(member) - OffsetOfImpl{ ptr }.offset); - } - - template - struct GetMemberPointerTraits; - - template - struct GetMemberPointerTraits { - using Parent = P; - using Member = M; - }; - - template - using GetParentType = typename GetMemberPointerTraits::Parent; - - template - using GetMemberType = typename GetMemberPointerTraits::Member; - - } - - template - constexpr inline impl::GetParentType *GetParentPointer(impl::GetMemberType *member) { - return impl::GetParentOfMemberImpl, impl::GetMemberType>(member, MemberPtr); - } - - template - constexpr inline impl::GetParentType const *GetParentPointer(impl::GetMemberType const *member) { - return impl::GetParentOfMemberImpl, impl::GetMemberType>(member, MemberPtr); - } - - template - constexpr inline impl::GetParentType &GetParentReference(impl::GetMemberType *member) { - return *impl::GetParentOfMemberImpl, impl::GetMemberType>(member, MemberPtr); - } - - template - constexpr inline impl::GetParentType const &GetParentReference(impl::GetMemberType const *member) { - return *impl::GetParentOfMemberImpl, impl::GetMemberType>(member, MemberPtr); - } - -} \ No newline at end of file diff --git a/stratosphere/libstratosphere/include/stratosphere/util/util_scope_guard.hpp b/stratosphere/libstratosphere/include/stratosphere/util/util_scope_guard.hpp deleted file mode 100644 index 462f797..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/util/util_scope_guard.hpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 . - */ - - /* Scope guard logic lovingly taken from Andrei Alexandrescu's "Systemic Error Handling in C++" */ -#pragma once -#include -#include "../defines.hpp" - -namespace ams::util { - - namespace impl { - - template - class ScopeGuard { - NON_COPYABLE(ScopeGuard); - private: - F f; - bool active; - public: - constexpr ScopeGuard(F f) : f(std::move(f)), active(true) { } - ~ScopeGuard() { if (active) { f(); } } - void Cancel() { active = false; } - - ScopeGuard(ScopeGuard&& rhs) : f(std::move(rhs.f)), active(rhs.active) { - rhs.Cancel(); - } - }; - - template - constexpr ScopeGuard MakeScopeGuard(F f) { - return ScopeGuard(std::move(f)); - } - - enum class ScopeGuardOnExit {}; - - template - constexpr ScopeGuard operator+(ScopeGuardOnExit, F&& f) { - return ScopeGuard(std::forward(f)); - } - - } - -} - -#define SCOPE_GUARD ::ams::util::impl::ScopeGuardOnExit() + [&]() -#define ON_SCOPE_EXIT auto ANONYMOUS_VARIABLE(SCOPE_EXIT_STATE_) = SCOPE_GUARD diff --git a/stratosphere/libstratosphere/include/stratosphere/util/util_size.hpp b/stratosphere/libstratosphere/include/stratosphere/util/util_size.hpp deleted file mode 100644 index 78e9cbe..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/util/util_size.hpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 - -namespace ams::util { - - /* std::size() does not support zero-size C arrays. We're fixing that. */ - template - constexpr auto size(const C& c) -> decltype(c.size()) { - return std::size(c); - } - - template - constexpr std::size_t size(const C& c) { - if constexpr (sizeof(C) == 0) { - return 0; - } else { - return std::size(c); - } - } - -} \ No newline at end of file diff --git a/stratosphere/libstratosphere/include/stratosphere/util/util_typed_storage.hpp b/stratosphere/libstratosphere/include/stratosphere/util/util_typed_storage.hpp deleted file mode 100644 index 9b3960d..0000000 --- a/stratosphere/libstratosphere/include/stratosphere/util/util_typed_storage.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 - -namespace ams::util { - - template - struct TypedStorage { - typename std::aligned_storage::type _storage; - }; - - #define TYPED_STORAGE(T) ::ams::util::TypedStorage - - template - static constexpr inline __attribute__((always_inline)) T *GetPointer(TYPED_STORAGE(T) &ts) { - return reinterpret_cast(&ts._storage); - } - - template - static constexpr inline __attribute__((always_inline)) const T *GetPointer(const TYPED_STORAGE(T) &ts) { - return reinterpret_cast(&ts._storage); - } - - template - static constexpr inline __attribute__((always_inline)) T &GetReference(TYPED_STORAGE(T) &ts) { - return *GetPointer(ts); - } - - template - static constexpr inline __attribute__((always_inline)) const T &GetReference(const TYPED_STORAGE(T) &ts) { - return *GetPointer(ts); - } - -} \ No newline at end of file diff --git a/stratosphere/libstratosphere/source/boot2/boot2_api.cpp b/stratosphere/libstratosphere/source/boot2/boot2_api.cpp index 6cf0890..d12e493 100644 --- a/stratosphere/libstratosphere/source/boot2/boot2_api.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/cfg/cfg_flags.cpp b/stratosphere/libstratosphere/source/cfg/cfg_flags.cpp index ed0ea9d..e5d70ed 100644 --- a/stratosphere/libstratosphere/source/cfg/cfg_flags.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/cfg/cfg_override.cpp b/stratosphere/libstratosphere/source/cfg/cfg_override.cpp index 76a20fb..2c17067 100644 --- a/stratosphere/libstratosphere/source/cfg/cfg_override.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/cfg/cfg_privileged_process.cpp b/stratosphere/libstratosphere/source/cfg/cfg_privileged_process.cpp index 670e590..34a8fd2 100644 --- a/stratosphere/libstratosphere/source/cfg/cfg_privileged_process.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/cfg/cfg_sd_card.cpp b/stratosphere/libstratosphere/source/cfg/cfg_sd_card.cpp index 1500478..079e245 100644 --- a/stratosphere/libstratosphere/source/cfg/cfg_sd_card.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/hid/hid_api.cpp b/stratosphere/libstratosphere/source/hid/hid_api.cpp index 0419f96..220cabd 100644 --- a/stratosphere/libstratosphere/source/hid/hid_api.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/kvdb/kvdb_archive.cpp b/stratosphere/libstratosphere/source/kvdb/kvdb_archive.cpp index f7f3418..40a4d05 100644 --- a/stratosphere/libstratosphere/source/kvdb/kvdb_archive.cpp +++ b/stratosphere/libstratosphere/source/kvdb/kvdb_archive.cpp @@ -15,7 +15,6 @@ */ #include -#include namespace ams::kvdb { @@ -32,9 +31,7 @@ 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 @@ 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 @@ /* 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 @@ /* 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/stratosphere/libstratosphere/source/kvdb/kvdb_file_key_value_store.cpp b/stratosphere/libstratosphere/source/kvdb/kvdb_file_key_value_store.cpp index 7b23e4c..3e67cd6 100644 --- a/stratosphere/libstratosphere/source/kvdb/kvdb_file_key_value_store.cpp +++ b/stratosphere/libstratosphere/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 @@ /* 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 @@ /* 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 @@ /* 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ /* 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 @@ 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/stratosphere/libstratosphere/source/ldr/ldr_pm_api.cpp b/stratosphere/libstratosphere/source/ldr/ldr_pm_api.cpp index 6e21343..de73724 100644 --- a/stratosphere/libstratosphere/source/ldr/ldr_pm_api.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/map/map_api.cpp b/stratosphere/libstratosphere/source/map/map_api.cpp index d3e5ef3..ca23927 100644 --- a/stratosphere/libstratosphere/source/map/map_api.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/os/impl/os_inter_process_event.cpp b/stratosphere/libstratosphere/source/os/impl/os_inter_process_event.cpp index d6a5b31..7194571 100644 --- a/stratosphere/libstratosphere/source/os/impl/os_inter_process_event.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/os/impl/os_inter_process_event.hpp b/stratosphere/libstratosphere/source/os/impl/os_inter_process_event.hpp index ad3d56e..51e32c9 100644 --- a/stratosphere/libstratosphere/source/os/impl/os_inter_process_event.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/os/os_event.cpp b/stratosphere/libstratosphere/source/os/os_event.cpp index 0aa4d34..1e146b9 100644 --- a/stratosphere/libstratosphere/source/os/os_event.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/os/os_interrupt_event.cpp b/stratosphere/libstratosphere/source/os/os_interrupt_event.cpp index 4fdeba4..c9ee819 100644 --- a/stratosphere/libstratosphere/source/os/os_interrupt_event.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/os/os_message_queue.cpp b/stratosphere/libstratosphere/source/os/os_message_queue.cpp index 6d0a547..17accc8 100644 --- a/stratosphere/libstratosphere/source/os/os_message_queue.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/os/os_waitable_holder.cpp b/stratosphere/libstratosphere/source/os/os_waitable_holder.cpp index e0f03b5..1221e44 100644 --- a/stratosphere/libstratosphere/source/os/os_waitable_holder.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/os/os_waitable_manager.cpp b/stratosphere/libstratosphere/source/os/os_waitable_manager.cpp index 434ddfb..3d00554 100644 --- a/stratosphere/libstratosphere/source/os/os_waitable_manager.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/patcher/patcher_api.cpp b/stratosphere/libstratosphere/source/patcher/patcher_api.cpp index 8fbe4a4..e46b6a9 100644 --- a/stratosphere/libstratosphere/source/patcher/patcher_api.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/pm/pm_boot_mode_api.cpp b/stratosphere/libstratosphere/source/pm/pm_boot_mode_api.cpp index 5e4e861..48a7b2e 100644 --- a/stratosphere/libstratosphere/source/pm/pm_boot_mode_api.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/pm/pm_dmnt_api.cpp b/stratosphere/libstratosphere/source/pm/pm_dmnt_api.cpp index 7253463..b42016d 100644 --- a/stratosphere/libstratosphere/source/pm/pm_dmnt_api.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/pm/pm_info_api.cpp b/stratosphere/libstratosphere/source/pm/pm_info_api.cpp index 5685208..8b6eeea 100644 --- a/stratosphere/libstratosphere/source/pm/pm_info_api.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/pm/pm_shell_api.cpp b/stratosphere/libstratosphere/source/pm/pm_shell_api.cpp index d7c4dbc..c71c6a9 100644 --- a/stratosphere/libstratosphere/source/pm/pm_shell_api.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/result/result_on_assertion.cpp b/stratosphere/libstratosphere/source/result/result_on_assertion.cpp index 160b220..848138f 100644 --- a/stratosphere/libstratosphere/source/result/result_on_assertion.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/rnd/rnd_api.cpp b/stratosphere/libstratosphere/source/rnd/rnd_api.cpp index c8cc07d..e0553c7 100644 --- a/stratosphere/libstratosphere/source/rnd/rnd_api.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/sf/cmif/sf_cmif_domain_service_object.cpp b/stratosphere/libstratosphere/source/sf/cmif/sf_cmif_domain_service_object.cpp index 57c53bb..0570553 100644 --- a/stratosphere/libstratosphere/source/sf/cmif/sf_cmif_domain_service_object.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/sf/cmif/sf_cmif_service_object_holder.cpp b/stratosphere/libstratosphere/source/sf/cmif/sf_cmif_service_object_holder.cpp index 7bdcc4a..c842b03 100644 --- a/stratosphere/libstratosphere/source/sf/cmif/sf_cmif_service_object_holder.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/sm/sm_api.cpp b/stratosphere/libstratosphere/source/sm/sm_api.cpp index 7fa6666..a865b64 100644 --- a/stratosphere/libstratosphere/source/sm/sm_api.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/sm/sm_manager_api.cpp b/stratosphere/libstratosphere/source/sm/sm_manager_api.cpp index e00977f..374428c 100644 --- a/stratosphere/libstratosphere/source/sm/sm_manager_api.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/sm/sm_mitm_api.cpp b/stratosphere/libstratosphere/source/sm/sm_mitm_api.cpp index 0f475b8..037cb6b 100644 --- a/stratosphere/libstratosphere/source/sm/sm_mitm_api.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/sm/sm_utils.cpp b/stratosphere/libstratosphere/source/sm/sm_utils.cpp index 4f553fa..5c920b0 100644 --- a/stratosphere/libstratosphere/source/sm/sm_utils.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/sm/sm_utils.hpp b/stratosphere/libstratosphere/source/sm/sm_utils.hpp index 5a15bf6..3b1804f 100644 --- a/stratosphere/libstratosphere/source/sm/sm_utils.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/spl/smc/spl_smc.cpp b/stratosphere/libstratosphere/source/spl/smc/spl_smc.cpp index b869275..50aac6f 100644 --- a/stratosphere/libstratosphere/source/spl/smc/spl_smc.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/spl/spl_api.cpp b/stratosphere/libstratosphere/source/spl/spl_api.cpp index a9bc8f1..6edd72f 100644 --- a/stratosphere/libstratosphere/source/spl/spl_api.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/updater/updater_bis_management.cpp b/stratosphere/libstratosphere/source/updater/updater_bis_management.cpp index 879810d..29a34b4 100644 --- a/stratosphere/libstratosphere/source/updater/updater_bis_management.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/updater/updater_bis_management.hpp b/stratosphere/libstratosphere/source/updater/updater_bis_management.hpp index df7c1a8..73ae1e7 100644 --- a/stratosphere/libstratosphere/source/updater/updater_bis_management.hpp +++ b/stratosphere/libstratosphere/source/updater/updater_bis_management.hpp @@ -15,9 +15,7 @@ */ #pragma once -#include #include -#include namespace ams::updater { diff --git a/stratosphere/libstratosphere/source/updater/updater_bis_save.cpp b/stratosphere/libstratosphere/source/updater/updater_bis_save.cpp index 6b0c113..fba4226 100644 --- a/stratosphere/libstratosphere/source/updater/updater_bis_save.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/updater/updater_bis_save.hpp b/stratosphere/libstratosphere/source/updater/updater_bis_save.hpp index a3b0ecb..8f3dea2 100644 --- a/stratosphere/libstratosphere/source/updater/updater_bis_save.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/updater/updater_files.cpp b/stratosphere/libstratosphere/source/updater/updater_files.cpp index 0c172d2..0ddab96 100644 --- a/stratosphere/libstratosphere/source/updater/updater_files.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/updater/updater_files.hpp b/stratosphere/libstratosphere/source/updater/updater_files.hpp index 369d4c0..d1c5845 100644 --- a/stratosphere/libstratosphere/source/updater/updater_files.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/updater/updater_paths.cpp b/stratosphere/libstratosphere/source/updater/updater_paths.cpp index 355708c..8c659a1 100644 --- a/stratosphere/libstratosphere/source/updater/updater_paths.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/updater/updater_paths.hpp b/stratosphere/libstratosphere/source/updater/updater_paths.hpp index 8a57392..a7a0e59 100644 --- a/stratosphere/libstratosphere/source/updater/updater_paths.hpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/util/util_compression.cpp b/stratosphere/libstratosphere/source/util/util_compression.cpp index 54199f2..6874844 100644 --- a/stratosphere/libstratosphere/source/util/util_compression.cpp +++ b/stratosphere/libstratosphere/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/stratosphere/libstratosphere/source/util/util_ini.cpp b/stratosphere/libstratosphere/source/util/util_ini.cpp index 0064054..aac3c20 100644 --- a/stratosphere/libstratosphere/source/util/util_ini.cpp +++ b/stratosphere/libstratosphere/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 { diff --git a/stratosphere/loader/source/ldr_arguments.cpp b/stratosphere/loader/source/ldr_arguments.cpp index c23e60c..6496ccd 100644 --- a/stratosphere/loader/source/ldr_arguments.cpp +++ b/stratosphere/loader/source/ldr_arguments.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 "ldr_arguments.hpp" namespace ams::ldr::args { diff --git a/stratosphere/loader/source/ldr_arguments.hpp b/stratosphere/loader/source/ldr_arguments.hpp index 66abdda..478acfa 100644 --- a/stratosphere/loader/source/ldr_arguments.hpp +++ b/stratosphere/loader/source/ldr_arguments.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::ldr::args { diff --git a/stratosphere/loader/source/ldr_capabilities.cpp b/stratosphere/loader/source/ldr_capabilities.cpp index 01ce1b9..bcb57d0 100644 --- a/stratosphere/loader/source/ldr_capabilities.cpp +++ b/stratosphere/loader/source/ldr_capabilities.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 "ldr_capabilities.hpp" namespace ams::ldr::caps { diff --git a/stratosphere/loader/source/ldr_capabilities.hpp b/stratosphere/loader/source/ldr_capabilities.hpp index e98a5a5..1d04408 100644 --- a/stratosphere/loader/source/ldr_capabilities.hpp +++ b/stratosphere/loader/source/ldr_capabilities.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::ldr::caps { diff --git a/stratosphere/loader/source/ldr_content_management.cpp b/stratosphere/loader/source/ldr_content_management.cpp index 4c3ddaa..43f6ce6 100644 --- a/stratosphere/loader/source/ldr_content_management.cpp +++ b/stratosphere/loader/source/ldr_content_management.cpp @@ -14,8 +14,6 @@ * along with this program. If not, see . */ #include -#include - #include "ldr_content_management.hpp" #include "ldr_ecs.hpp" diff --git a/stratosphere/loader/source/ldr_content_management.hpp b/stratosphere/loader/source/ldr_content_management.hpp index b6a789e..0294282 100644 --- a/stratosphere/loader/source/ldr_content_management.hpp +++ b/stratosphere/loader/source/ldr_content_management.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::ldr { diff --git a/stratosphere/loader/source/ldr_ecs.cpp b/stratosphere/loader/source/ldr_ecs.cpp index c969281..3ba4caa 100644 --- a/stratosphere/loader/source/ldr_ecs.cpp +++ b/stratosphere/loader/source/ldr_ecs.cpp @@ -13,8 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include #include "ldr_ecs.hpp" namespace ams::ldr::ecs { diff --git a/stratosphere/loader/source/ldr_ecs.hpp b/stratosphere/loader/source/ldr_ecs.hpp index 481125b..40d5c6d 100644 --- a/stratosphere/loader/source/ldr_ecs.hpp +++ b/stratosphere/loader/source/ldr_ecs.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::ldr::ecs { diff --git a/stratosphere/loader/source/ldr_launch_record.cpp b/stratosphere/loader/source/ldr_launch_record.cpp index 314f254..6c9ee86 100644 --- a/stratosphere/loader/source/ldr_launch_record.cpp +++ b/stratosphere/loader/source/ldr_launch_record.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 "ldr_launch_record.hpp" namespace ams::ldr { diff --git a/stratosphere/loader/source/ldr_launch_record.hpp b/stratosphere/loader/source/ldr_launch_record.hpp index 9fac03a..f0288e3 100644 --- a/stratosphere/loader/source/ldr_launch_record.hpp +++ b/stratosphere/loader/source/ldr_launch_record.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::ldr { diff --git a/stratosphere/loader/source/ldr_loader_service.cpp b/stratosphere/loader/source/ldr_loader_service.cpp index 5481e94..a1652c6 100644 --- a/stratosphere/loader/source/ldr_loader_service.cpp +++ b/stratosphere/loader/source/ldr_loader_service.cpp @@ -13,8 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include #include "ldr_arguments.hpp" #include "ldr_content_management.hpp" #include "ldr_ecs.hpp" diff --git a/stratosphere/loader/source/ldr_loader_service.hpp b/stratosphere/loader/source/ldr_loader_service.hpp index e150cf9..f6cada3 100644 --- a/stratosphere/loader/source/ldr_loader_service.hpp +++ b/stratosphere/loader/source/ldr_loader_service.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::ldr { diff --git a/stratosphere/loader/source/ldr_main.cpp b/stratosphere/loader/source/ldr_main.cpp index 8bf6fa5..9ced0ef 100644 --- a/stratosphere/loader/source/ldr_main.cpp +++ b/stratosphere/loader/source/ldr_main.cpp @@ -14,17 +14,6 @@ * along with this program. If not, see . */ -#include -#include -#include -#include - -#include -#include -#include -#include -#include - #include "ldr_loader_service.hpp" extern "C" { diff --git a/stratosphere/loader/source/ldr_meta.cpp b/stratosphere/loader/source/ldr_meta.cpp index bef672d..2a7a841 100644 --- a/stratosphere/loader/source/ldr_meta.cpp +++ b/stratosphere/loader/source/ldr_meta.cpp @@ -13,8 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include #include "ldr_capabilities.hpp" #include "ldr_content_management.hpp" #include "ldr_meta.hpp" diff --git a/stratosphere/loader/source/ldr_meta.hpp b/stratosphere/loader/source/ldr_meta.hpp index 66a3dea..8f5b8af 100644 --- a/stratosphere/loader/source/ldr_meta.hpp +++ b/stratosphere/loader/source/ldr_meta.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::ldr { diff --git a/stratosphere/loader/source/ldr_patcher.cpp b/stratosphere/loader/source/ldr_patcher.cpp index 38b6c24..4f109be 100644 --- a/stratosphere/loader/source/ldr_patcher.cpp +++ b/stratosphere/loader/source/ldr_patcher.cpp @@ -13,11 +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 "ldr_patcher.hpp" namespace ams::ldr { diff --git a/stratosphere/loader/source/ldr_patcher.hpp b/stratosphere/loader/source/ldr_patcher.hpp index 3f1c6b3..60e02b1 100644 --- a/stratosphere/loader/source/ldr_patcher.hpp +++ b/stratosphere/loader/source/ldr_patcher.hpp @@ -13,10 +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::ldr { diff --git a/stratosphere/loader/source/ldr_process_creation.cpp b/stratosphere/loader/source/ldr_process_creation.cpp index 8b5c0d2..0cce9eb 100644 --- a/stratosphere/loader/source/ldr_process_creation.cpp +++ b/stratosphere/loader/source/ldr_process_creation.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 - #include "ldr_capabilities.hpp" #include "ldr_content_management.hpp" #include "ldr_ecs.hpp" diff --git a/stratosphere/loader/source/ldr_process_creation.hpp b/stratosphere/loader/source/ldr_process_creation.hpp index 1d1704d..f240281 100644 --- a/stratosphere/loader/source/ldr_process_creation.hpp +++ b/stratosphere/loader/source/ldr_process_creation.hpp @@ -13,12 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include -#include -#include - #include "ldr_arguments.hpp" namespace ams::ldr { diff --git a/stratosphere/loader/source/ldr_ro_manager.cpp b/stratosphere/loader/source/ldr_ro_manager.cpp index eaca6c3..358fe14 100644 --- a/stratosphere/loader/source/ldr_ro_manager.cpp +++ b/stratosphere/loader/source/ldr_ro_manager.cpp @@ -13,8 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include #include "ldr_ro_manager.hpp" namespace ams::ldr::ro { diff --git a/stratosphere/loader/source/ldr_ro_manager.hpp b/stratosphere/loader/source/ldr_ro_manager.hpp index 4b1c929..6441f68 100644 --- a/stratosphere/loader/source/ldr_ro_manager.hpp +++ b/stratosphere/loader/source/ldr_ro_manager.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::ldr::ro { diff --git a/stratosphere/pm/source/impl/pm_process_info.cpp b/stratosphere/pm/source/impl/pm_process_info.cpp index f38962e..eacd026 100644 --- a/stratosphere/pm/source/impl/pm_process_info.cpp +++ b/stratosphere/pm/source/impl/pm_process_info.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 "pm_process_info.hpp" namespace ams::pm::impl { diff --git a/stratosphere/pm/source/impl/pm_process_info.hpp b/stratosphere/pm/source/impl/pm_process_info.hpp index 514b65f..fa12dae 100644 --- a/stratosphere/pm/source/impl/pm_process_info.hpp +++ b/stratosphere/pm/source/impl/pm_process_info.hpp @@ -13,13 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include -#include -#include -#include - #include "pm_process_manager.hpp" namespace ams::pm::impl { diff --git a/stratosphere/pm/source/impl/pm_process_manager.cpp b/stratosphere/pm/source/impl/pm_process_manager.cpp index 14bb7d8..6ad2d5f 100644 --- a/stratosphere/pm/source/impl/pm_process_manager.cpp +++ b/stratosphere/pm/source/impl/pm_process_manager.cpp @@ -13,13 +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 -#include - #include "pm_process_manager.hpp" #include "pm_resource_manager.hpp" diff --git a/stratosphere/pm/source/impl/pm_process_manager.hpp b/stratosphere/pm/source/impl/pm_process_manager.hpp index 4fe7340..2f525c7 100644 --- a/stratosphere/pm/source/impl/pm_process_manager.hpp +++ b/stratosphere/pm/source/impl/pm_process_manager.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 -#include namespace ams::pm::impl { diff --git a/stratosphere/pm/source/impl/pm_resource_manager.cpp b/stratosphere/pm/source/impl/pm_resource_manager.cpp index d9f840d..0babd15 100644 --- a/stratosphere/pm/source/impl/pm_resource_manager.cpp +++ b/stratosphere/pm/source/impl/pm_resource_manager.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 "pm_resource_manager.hpp" namespace ams::pm::resource { diff --git a/stratosphere/pm/source/impl/pm_resource_manager.hpp b/stratosphere/pm/source/impl/pm_resource_manager.hpp index 53e515e..f100e36 100644 --- a/stratosphere/pm/source/impl/pm_resource_manager.hpp +++ b/stratosphere/pm/source/impl/pm_resource_manager.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 -#include namespace ams::pm::resource { diff --git a/stratosphere/pm/source/pm_boot_mode_service.cpp b/stratosphere/pm/source/pm_boot_mode_service.cpp index 66c0801..3935a76 100644 --- a/stratosphere/pm/source/pm_boot_mode_service.cpp +++ b/stratosphere/pm/source/pm_boot_mode_service.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 "pm_boot_mode_service.hpp" namespace ams::pm::bm { diff --git a/stratosphere/pm/source/pm_boot_mode_service.hpp b/stratosphere/pm/source/pm_boot_mode_service.hpp index 44890fa..4e676d3 100644 --- a/stratosphere/pm/source/pm_boot_mode_service.hpp +++ b/stratosphere/pm/source/pm_boot_mode_service.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::pm::bm { diff --git a/stratosphere/pm/source/pm_debug_monitor_service.cpp b/stratosphere/pm/source/pm_debug_monitor_service.cpp index bf4780d..cda2a87 100644 --- a/stratosphere/pm/source/pm_debug_monitor_service.cpp +++ b/stratosphere/pm/source/pm_debug_monitor_service.cpp @@ -13,8 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include #include "pm_debug_monitor_service.hpp" #include "impl/pm_process_manager.hpp" diff --git a/stratosphere/pm/source/pm_debug_monitor_service.hpp b/stratosphere/pm/source/pm_debug_monitor_service.hpp index c610d0f..6692dc6 100644 --- a/stratosphere/pm/source/pm_debug_monitor_service.hpp +++ b/stratosphere/pm/source/pm_debug_monitor_service.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 -#include namespace ams::pm::dmnt { diff --git a/stratosphere/pm/source/pm_info_service.cpp b/stratosphere/pm/source/pm_info_service.cpp index c7ada3d..890bd04 100644 --- a/stratosphere/pm/source/pm_info_service.cpp +++ b/stratosphere/pm/source/pm_info_service.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 "pm_info_service.hpp" #include "impl/pm_process_manager.hpp" diff --git a/stratosphere/pm/source/pm_info_service.hpp b/stratosphere/pm/source/pm_info_service.hpp index 47b778a..4542659 100644 --- a/stratosphere/pm/source/pm_info_service.hpp +++ b/stratosphere/pm/source/pm_info_service.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 -#include namespace ams::pm::info { diff --git a/stratosphere/pm/source/pm_main.cpp b/stratosphere/pm/source/pm_main.cpp index 6040a05..e286302 100644 --- a/stratosphere/pm/source/pm_main.cpp +++ b/stratosphere/pm/source/pm_main.cpp @@ -13,17 +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 -#include -#include -#include -#include - #include "pm_boot_mode_service.hpp" #include "pm_debug_monitor_service.hpp" #include "pm_info_service.hpp" diff --git a/stratosphere/pm/source/pm_shell_service.cpp b/stratosphere/pm/source/pm_shell_service.cpp index 8f159c9..a671542 100644 --- a/stratosphere/pm/source/pm_shell_service.cpp +++ b/stratosphere/pm/source/pm_shell_service.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 "pm_shell_service.hpp" #include "impl/pm_process_manager.hpp" diff --git a/stratosphere/pm/source/pm_shell_service.hpp b/stratosphere/pm/source/pm_shell_service.hpp index ac6ee39..81245eb 100644 --- a/stratosphere/pm/source/pm_shell_service.hpp +++ b/stratosphere/pm/source/pm_shell_service.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 -#include namespace ams::pm::shell { diff --git a/stratosphere/ro/source/impl/ro_nro_utils.cpp b/stratosphere/ro/source/impl/ro_nro_utils.cpp index 6606e82..02abc77 100644 --- a/stratosphere/ro/source/impl/ro_nro_utils.cpp +++ b/stratosphere/ro/source/impl/ro_nro_utils.cpp @@ -13,9 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include - #include "ro_nro_utils.hpp" namespace ams::ro::impl { diff --git a/stratosphere/ro/source/impl/ro_nro_utils.hpp b/stratosphere/ro/source/impl/ro_nro_utils.hpp index 84d20ee..f22435e 100644 --- a/stratosphere/ro/source/impl/ro_nro_utils.hpp +++ b/stratosphere/ro/source/impl/ro_nro_utils.hpp @@ -15,9 +15,7 @@ */ #pragma once -#include #include -#include namespace ams::ro::impl { diff --git a/stratosphere/ro/source/impl/ro_nrr_utils.cpp b/stratosphere/ro/source/impl/ro_nrr_utils.cpp index 0b7a9a7..4343ba7 100644 --- a/stratosphere/ro/source/impl/ro_nrr_utils.cpp +++ b/stratosphere/ro/source/impl/ro_nrr_utils.cpp @@ -13,9 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include - #include "ro_nrr_utils.hpp" #include "ro_service_impl.hpp" diff --git a/stratosphere/ro/source/impl/ro_nrr_utils.hpp b/stratosphere/ro/source/impl/ro_nrr_utils.hpp index 351a936..2b66c36 100644 --- a/stratosphere/ro/source/impl/ro_nrr_utils.hpp +++ b/stratosphere/ro/source/impl/ro_nrr_utils.hpp @@ -15,9 +15,7 @@ */ #pragma once -#include #include -#include namespace ams::ro::impl { diff --git a/stratosphere/ro/source/impl/ro_patcher.cpp b/stratosphere/ro/source/impl/ro_patcher.cpp index e4f5318..ec97642 100644 --- a/stratosphere/ro/source/impl/ro_patcher.cpp +++ b/stratosphere/ro/source/impl/ro_patcher.cpp @@ -13,9 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include - #include "ro_patcher.hpp" namespace ams::ro::impl { diff --git a/stratosphere/ro/source/impl/ro_patcher.hpp b/stratosphere/ro/source/impl/ro_patcher.hpp index 2a92390..310bc7f 100644 --- a/stratosphere/ro/source/impl/ro_patcher.hpp +++ b/stratosphere/ro/source/impl/ro_patcher.hpp @@ -15,8 +15,7 @@ */ #pragma once -#include -#include +#include namespace ams::ro::impl { diff --git a/stratosphere/ro/source/impl/ro_service_impl.cpp b/stratosphere/ro/source/impl/ro_service_impl.cpp index 2f957b1..66938ce 100644 --- a/stratosphere/ro/source/impl/ro_service_impl.cpp +++ b/stratosphere/ro/source/impl/ro_service_impl.cpp @@ -13,13 +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 -#include - #include "ro_nrr_utils.hpp" #include "ro_nro_utils.hpp" #include "ro_patcher.hpp" diff --git a/stratosphere/ro/source/impl/ro_service_impl.hpp b/stratosphere/ro/source/impl/ro_service_impl.hpp index 4bc646e..0ca419c 100644 --- a/stratosphere/ro/source/impl/ro_service_impl.hpp +++ b/stratosphere/ro/source/impl/ro_service_impl.hpp @@ -15,9 +15,7 @@ */ #pragma once -#include #include -#include namespace ams::ro::impl { diff --git a/stratosphere/ro/source/ro_debug_monitor.cpp b/stratosphere/ro/source/ro_debug_monitor.cpp index f648d91..4e41144 100644 --- a/stratosphere/ro/source/ro_debug_monitor.cpp +++ b/stratosphere/ro/source/ro_debug_monitor.cpp @@ -13,11 +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 "ro_debug_monitor.hpp" #include "impl/ro_service_impl.hpp" diff --git a/stratosphere/ro/source/ro_debug_monitor.hpp b/stratosphere/ro/source/ro_debug_monitor.hpp index 0cbced5..f6cf6b6 100644 --- a/stratosphere/ro/source/ro_debug_monitor.hpp +++ b/stratosphere/ro/source/ro_debug_monitor.hpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include #include namespace ams::ro { diff --git a/stratosphere/ro/source/ro_main.cpp b/stratosphere/ro/source/ro_main.cpp index e60cf51..9c16b56 100644 --- a/stratosphere/ro/source/ro_main.cpp +++ b/stratosphere/ro/source/ro_main.cpp @@ -13,18 +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 - -#include -#include -#include -#include -#include - #include "ro_debug_monitor.hpp" #include "ro_service.hpp" diff --git a/stratosphere/ro/source/ro_service.cpp b/stratosphere/ro/source/ro_service.cpp index 9de7d0a..1a3578a 100644 --- a/stratosphere/ro/source/ro_service.cpp +++ b/stratosphere/ro/source/ro_service.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 - #include "ro_service.hpp" #include "impl/ro_service_impl.hpp" diff --git a/stratosphere/ro/source/ro_service.hpp b/stratosphere/ro/source/ro_service.hpp index ddbb3b9..1676d94 100644 --- a/stratosphere/ro/source/ro_service.hpp +++ b/stratosphere/ro/source/ro_service.hpp @@ -15,10 +15,7 @@ */ #pragma once -#include - #include -#include namespace ams::ro { diff --git a/stratosphere/sm/source/impl/sm_service_manager.cpp b/stratosphere/sm/source/impl/sm_service_manager.cpp index 1a4150c..50f0e58 100644 --- a/stratosphere/sm/source/impl/sm_service_manager.cpp +++ b/stratosphere/sm/source/impl/sm_service_manager.cpp @@ -13,13 +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 -#include - #include "sm_service_manager.hpp" namespace ams::sm::impl { diff --git a/stratosphere/sm/source/impl/sm_service_manager.hpp b/stratosphere/sm/source/impl/sm_service_manager.hpp index 155e93a..f07713a 100644 --- a/stratosphere/sm/source/impl/sm_service_manager.hpp +++ b/stratosphere/sm/source/impl/sm_service_manager.hpp @@ -15,9 +15,7 @@ */ #pragma once -#include -#include -#include +#include namespace ams::sm::impl { diff --git a/stratosphere/sm/source/sm_dmnt_service.cpp b/stratosphere/sm/source/sm_dmnt_service.cpp index f56a824..a5f25b9 100644 --- a/stratosphere/sm/source/sm_dmnt_service.cpp +++ b/stratosphere/sm/source/sm_dmnt_service.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 "sm_dmnt_service.hpp" #include "impl/sm_service_manager.hpp" diff --git a/stratosphere/sm/source/sm_dmnt_service.hpp b/stratosphere/sm/source/sm_dmnt_service.hpp index bbf7c6e..5f5ef65 100644 --- a/stratosphere/sm/source/sm_dmnt_service.hpp +++ b/stratosphere/sm/source/sm_dmnt_service.hpp @@ -15,9 +15,7 @@ */ #pragma once -#include #include -#include namespace ams::sm { diff --git a/stratosphere/sm/source/sm_main.cpp b/stratosphere/sm/source/sm_main.cpp index e35d152..eb21c49 100644 --- a/stratosphere/sm/source/sm_main.cpp +++ b/stratosphere/sm/source/sm_main.cpp @@ -13,19 +13,9 @@ * 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 "sm_user_service.hpp" #include "sm_manager_service.hpp" #include "sm_dmnt_service.hpp" - #include "impl/sm_service_manager.hpp" extern "C" { diff --git a/stratosphere/sm/source/sm_manager_service.cpp b/stratosphere/sm/source/sm_manager_service.cpp index 2438b83..9e646f3 100644 --- a/stratosphere/sm/source/sm_manager_service.cpp +++ b/stratosphere/sm/source/sm_manager_service.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 "sm_manager_service.hpp" #include "impl/sm_service_manager.hpp" diff --git a/stratosphere/sm/source/sm_manager_service.hpp b/stratosphere/sm/source/sm_manager_service.hpp index 6292a67..0fb9f1a 100644 --- a/stratosphere/sm/source/sm_manager_service.hpp +++ b/stratosphere/sm/source/sm_manager_service.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 -#include namespace ams::sm { diff --git a/stratosphere/sm/source/sm_user_service.cpp b/stratosphere/sm/source/sm_user_service.cpp index ad8ff8b..6f8c22b 100644 --- a/stratosphere/sm/source/sm_user_service.cpp +++ b/stratosphere/sm/source/sm_user_service.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 "sm_user_service.hpp" #include "impl/sm_service_manager.hpp" diff --git a/stratosphere/sm/source/sm_user_service.hpp b/stratosphere/sm/source/sm_user_service.hpp index 1b3d427..9edb805 100644 --- a/stratosphere/sm/source/sm_user_service.hpp +++ b/stratosphere/sm/source/sm_user_service.hpp @@ -15,10 +15,7 @@ */ #pragma once -#include #include -#include -#include namespace ams::sm { diff --git a/stratosphere/spl/source/spl_api_impl.cpp b/stratosphere/spl/source/spl_api_impl.cpp index 2451125..4376160 100644 --- a/stratosphere/spl/source/spl_api_impl.cpp +++ b/stratosphere/spl/source/spl_api_impl.cpp @@ -13,11 +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 "spl_api_impl.hpp" #include "spl_ctr_drbg.hpp" diff --git a/stratosphere/spl/source/spl_api_impl.hpp b/stratosphere/spl/source/spl_api_impl.hpp index 03c3573..d255295 100644 --- a/stratosphere/spl/source/spl_api_impl.hpp +++ b/stratosphere/spl/source/spl_api_impl.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::spl::impl { diff --git a/stratosphere/spl/source/spl_crypto_service.cpp b/stratosphere/spl/source/spl_crypto_service.cpp index 600ab49..4397e2e 100644 --- a/stratosphere/spl/source/spl_crypto_service.cpp +++ b/stratosphere/spl/source/spl_crypto_service.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 "spl_api_impl.hpp" #include "spl_crypto_service.hpp" diff --git a/stratosphere/spl/source/spl_crypto_service.hpp b/stratosphere/spl/source/spl_crypto_service.hpp index 36f75c6..c817b0b 100644 --- a/stratosphere/spl/source/spl_crypto_service.hpp +++ b/stratosphere/spl/source/spl_crypto_service.hpp @@ -13,12 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include -#include -#include - #include "spl_general_service.hpp" namespace ams::spl { diff --git a/stratosphere/spl/source/spl_ctr_drbg.cpp b/stratosphere/spl/source/spl_ctr_drbg.cpp index 2dd90b1..a83a6ea 100644 --- a/stratosphere/spl/source/spl_ctr_drbg.cpp +++ b/stratosphere/spl/source/spl_ctr_drbg.cpp @@ -13,11 +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 "spl_ctr_drbg.hpp" namespace ams::spl { diff --git a/stratosphere/spl/source/spl_ctr_drbg.hpp b/stratosphere/spl/source/spl_ctr_drbg.hpp index 53c21da..d17cc1b 100644 --- a/stratosphere/spl/source/spl_ctr_drbg.hpp +++ b/stratosphere/spl/source/spl_ctr_drbg.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::spl { diff --git a/stratosphere/spl/source/spl_deprecated_service.cpp b/stratosphere/spl/source/spl_deprecated_service.cpp index c8b33b9..9fef93f 100644 --- a/stratosphere/spl/source/spl_deprecated_service.cpp +++ b/stratosphere/spl/source/spl_deprecated_service.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 "spl_api_impl.hpp" #include "spl_deprecated_service.hpp" diff --git a/stratosphere/spl/source/spl_deprecated_service.hpp b/stratosphere/spl/source/spl_deprecated_service.hpp index 9f0978b..39aae3b 100644 --- a/stratosphere/spl/source/spl_deprecated_service.hpp +++ b/stratosphere/spl/source/spl_deprecated_service.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::spl { diff --git a/stratosphere/spl/source/spl_es_service.cpp b/stratosphere/spl/source/spl_es_service.cpp index e27fa4c..ed5f2d0 100644 --- a/stratosphere/spl/source/spl_es_service.cpp +++ b/stratosphere/spl/source/spl_es_service.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 "spl_api_impl.hpp" #include "spl_es_service.hpp" diff --git a/stratosphere/spl/source/spl_es_service.hpp b/stratosphere/spl/source/spl_es_service.hpp index e827d00..d08681a 100644 --- a/stratosphere/spl/source/spl_es_service.hpp +++ b/stratosphere/spl/source/spl_es_service.hpp @@ -13,12 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include -#include -#include - #include "spl_rsa_service.hpp" namespace ams::spl { diff --git a/stratosphere/spl/source/spl_fs_service.cpp b/stratosphere/spl/source/spl_fs_service.cpp index e191ae0..b4e7255 100644 --- a/stratosphere/spl/source/spl_fs_service.cpp +++ b/stratosphere/spl/source/spl_fs_service.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 "spl_api_impl.hpp" #include "spl_fs_service.hpp" diff --git a/stratosphere/spl/source/spl_fs_service.hpp b/stratosphere/spl/source/spl_fs_service.hpp index 6f5ab9b..7478f7a 100644 --- a/stratosphere/spl/source/spl_fs_service.hpp +++ b/stratosphere/spl/source/spl_fs_service.hpp @@ -13,12 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include -#include -#include - #include "spl_crypto_service.hpp" namespace ams::spl { diff --git a/stratosphere/spl/source/spl_general_service.cpp b/stratosphere/spl/source/spl_general_service.cpp index f655be8..a39473d 100644 --- a/stratosphere/spl/source/spl_general_service.cpp +++ b/stratosphere/spl/source/spl_general_service.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 "spl_api_impl.hpp" #include "spl_general_service.hpp" diff --git a/stratosphere/spl/source/spl_general_service.hpp b/stratosphere/spl/source/spl_general_service.hpp index 9bd35d1..1261a5a 100644 --- a/stratosphere/spl/source/spl_general_service.hpp +++ b/stratosphere/spl/source/spl_general_service.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::spl { diff --git a/stratosphere/spl/source/spl_main.cpp b/stratosphere/spl/source/spl_main.cpp index d4eaa57..c43b6fa 100644 --- a/stratosphere/spl/source/spl_main.cpp +++ b/stratosphere/spl/source/spl_main.cpp @@ -13,15 +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 -#include -#include - #include "spl_api_impl.hpp" #include "spl_random_service.hpp" diff --git a/stratosphere/spl/source/spl_manu_service.cpp b/stratosphere/spl/source/spl_manu_service.cpp index 458e649..8825d86 100644 --- a/stratosphere/spl/source/spl_manu_service.cpp +++ b/stratosphere/spl/source/spl_manu_service.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 "spl_api_impl.hpp" #include "spl_manu_service.hpp" diff --git a/stratosphere/spl/source/spl_manu_service.hpp b/stratosphere/spl/source/spl_manu_service.hpp index 371d48a..8667f66 100644 --- a/stratosphere/spl/source/spl_manu_service.hpp +++ b/stratosphere/spl/source/spl_manu_service.hpp @@ -13,12 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include -#include -#include - #include "spl_rsa_service.hpp" namespace ams::spl { diff --git a/stratosphere/spl/source/spl_random_service.cpp b/stratosphere/spl/source/spl_random_service.cpp index f307900..932d17c 100644 --- a/stratosphere/spl/source/spl_random_service.cpp +++ b/stratosphere/spl/source/spl_random_service.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 "spl_api_impl.hpp" #include "spl_random_service.hpp" diff --git a/stratosphere/spl/source/spl_random_service.hpp b/stratosphere/spl/source/spl_random_service.hpp index 408144c..2d64a83 100644 --- a/stratosphere/spl/source/spl_random_service.hpp +++ b/stratosphere/spl/source/spl_random_service.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::spl { diff --git a/stratosphere/spl/source/spl_rsa_service.cpp b/stratosphere/spl/source/spl_rsa_service.cpp index 17ebd27..ab61b91 100644 --- a/stratosphere/spl/source/spl_rsa_service.cpp +++ b/stratosphere/spl/source/spl_rsa_service.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 "spl_api_impl.hpp" #include "spl_rsa_service.hpp" diff --git a/stratosphere/spl/source/spl_rsa_service.hpp b/stratosphere/spl/source/spl_rsa_service.hpp index a428eb0..5ced887 100644 --- a/stratosphere/spl/source/spl_rsa_service.hpp +++ b/stratosphere/spl/source/spl_rsa_service.hpp @@ -13,12 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include -#include -#include - #include "spl_crypto_service.hpp" namespace ams::spl { diff --git a/stratosphere/spl/source/spl_ssl_service.cpp b/stratosphere/spl/source/spl_ssl_service.cpp index 12b2d46..4f57c21 100644 --- a/stratosphere/spl/source/spl_ssl_service.cpp +++ b/stratosphere/spl/source/spl_ssl_service.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 "spl_api_impl.hpp" #include "spl_ssl_service.hpp" diff --git a/stratosphere/spl/source/spl_ssl_service.hpp b/stratosphere/spl/source/spl_ssl_service.hpp index 845097c..3c3aa12 100644 --- a/stratosphere/spl/source/spl_ssl_service.hpp +++ b/stratosphere/spl/source/spl_ssl_service.hpp @@ -13,12 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #pragma once -#include -#include -#include - #include "spl_rsa_service.hpp" namespace ams::spl {