From fbb5730369f6e15eebc3a0e5476429b07c0f79cf Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Fri, 18 Oct 2019 10:37:03 -0700 Subject: [PATCH] strat: update for latest libnx commit --- stratosphere/boot/source/boot_main.cpp | 1 + .../dmnt/source/cheat/impl/dmnt_cheat_api.cpp | 8 +++++--- stratosphere/fatal/source/fatal_config.cpp | 11 ++++++----- stratosphere/fatal/source/fatal_font.cpp | 2 +- stratosphere/fatal/source/fatal_repair.cpp | 6 +++--- stratosphere/pm/source/impl/pm_process_manager.cpp | 2 +- 6 files changed, 17 insertions(+), 13 deletions(-) diff --git a/stratosphere/boot/source/boot_main.cpp b/stratosphere/boot/source/boot_main.cpp index a41895e9d..68be3ca9b 100644 --- a/stratosphere/boot/source/boot_main.cpp +++ b/stratosphere/boot/source/boot_main.cpp @@ -46,6 +46,7 @@ extern "C" { u32 __nx_applet_type = AppletType_None; + /* TODO: Evaluate to what extent this can be reduced. */ #define INNER_HEAP_SIZE 0x200000 size_t nx_inner_heap_size = INNER_HEAP_SIZE; char nx_inner_heap[INNER_HEAP_SIZE]; diff --git a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp index f6f0cbe26..b1374f8f3 100644 --- a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp +++ b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp @@ -187,12 +187,14 @@ namespace sts::dmnt::cheat::impl { /* Learn whether we should enable cheats by default. */ { - u8 en; - if (R_SUCCEEDED(setsysGetSettingsItemValue("atmosphere", "dmnt_cheats_enabled_by_default", &en, sizeof(en)))) { + u64 size_out; + u8 en = 0; + if (R_SUCCEEDED(setsysGetSettingsItemValue("atmosphere", "dmnt_cheats_enabled_by_default", &en, sizeof(en), &size_out))) { this->enable_cheats_by_default = (en != 0); } - if (R_SUCCEEDED(setsysGetSettingsItemValue("atmosphere", "dmnt_always_save_cheat_toggles", &en, sizeof(en)))) { + en = 0; + if (R_SUCCEEDED(setsysGetSettingsItemValue("atmosphere", "dmnt_always_save_cheat_toggles", &en, sizeof(en), &size_out))) { this->always_save_cheat_toggles = (en != 0); } } diff --git a/stratosphere/fatal/source/fatal_config.cpp b/stratosphere/fatal/source/fatal_config.cpp index 8cfd922b5..da8429568 100644 --- a/stratosphere/fatal/source/fatal_config.cpp +++ b/stratosphere/fatal/source/fatal_config.cpp @@ -56,16 +56,17 @@ namespace sts::fatal::srv { /* Get information from set. */ setsysGetSerialNumber(this->serial_number); setsysGetFirmwareVersion(&this->firmware_version); - setsysGetFlag(SetSysFlag_Quest, &this->quest_flag); + setsysGetQuestFlag(&this->quest_flag); this->UpdateLanguageCode(); /* Read information from settings. */ - setsysGetSettingsItemValue("fatal", "transition_to_fatal", &this->transition_to_fatal, sizeof(this->transition_to_fatal)); - setsysGetSettingsItemValue("fatal", "show_extra_info", &this->show_extra_info, sizeof(this->show_extra_info)); - setsysGetSettingsItemValue("fatal", "quest_reboot_interval_second", &this->quest_reboot_interval_second, sizeof(this->quest_reboot_interval_second)); + u64 set_size_out; + setsysGetSettingsItemValue("fatal", "transition_to_fatal", &this->transition_to_fatal, sizeof(this->transition_to_fatal), &set_size_out); + setsysGetSettingsItemValue("fatal", "show_extra_info", &this->show_extra_info, sizeof(this->show_extra_info), &set_size_out); + setsysGetSettingsItemValue("fatal", "quest_reboot_interval_second", &this->quest_reboot_interval_second, sizeof(this->quest_reboot_interval_second), &set_size_out); /* Atmosphere extension for automatic reboot. */ - if (R_SUCCEEDED(setsysGetSettingsItemValue("atmosphere", "fatal_auto_reboot_interval", &this->fatal_auto_reboot_interval, sizeof(this->fatal_auto_reboot_interval)))) { + if (R_SUCCEEDED(setsysGetSettingsItemValue("atmosphere", "fatal_auto_reboot_interval", &this->fatal_auto_reboot_interval, sizeof(this->fatal_auto_reboot_interval), &set_size_out))) { this->fatal_auto_reboot_enabled = this->fatal_auto_reboot_interval != 0; } diff --git a/stratosphere/fatal/source/fatal_font.cpp b/stratosphere/fatal/source/fatal_font.cpp index c7b66f67c..67ee8880f 100644 --- a/stratosphere/fatal/source/fatal_font.cpp +++ b/stratosphere/fatal/source/fatal_font.cpp @@ -223,7 +223,7 @@ namespace sts::fatal::srv::font { } Result InitializeSharedFont() { - size_t total_fonts = 0; + s32 total_fonts = 0; R_TRY(plGetSharedFont(GetFatalConfig().GetLanguageCode(), g_fonts, PlSharedFontType_Total, &total_fonts)); R_TRY(plGetSharedFontByType(&g_font, PlSharedFontType_Standard)); diff --git a/stratosphere/fatal/source/fatal_repair.cpp b/stratosphere/fatal/source/fatal_repair.cpp index d3a4edbdc..39d587a7e 100644 --- a/stratosphere/fatal/source/fatal_repair.cpp +++ b/stratosphere/fatal/source/fatal_repair.cpp @@ -28,7 +28,7 @@ namespace sts::fatal::srv { } bool in_repair; - return R_SUCCEEDED(setsysGetFlag(SetSysFlag_InRepairProcessEnable, &in_repair)) && in_repair; + return R_SUCCEEDED(setsysGetInRepairProcessEnableFlag(&in_repair)) && in_repair; } bool IsInRepairWithoutVolHeld() { @@ -62,12 +62,12 @@ namespace sts::fatal::srv { bool NeedsRunTimeReviser() { /* Before firmware 5.0.0, this wasn't implemented. */ - if (hos::GetVersion() < hos::Version_300) { + if (hos::GetVersion() < hos::Version_500) { return false; } bool requires_time_reviser; - return R_SUCCEEDED(setsysGetFlag(SetSysFlag_RequiresRunRepairTimeReviser, &requires_time_reviser)) && requires_time_reviser; + return R_SUCCEEDED(setsysGetRequiresRunRepairTimeReviser(&requires_time_reviser)) && requires_time_reviser; } bool IsTimeReviserCartridgeInserted() { diff --git a/stratosphere/pm/source/impl/pm_process_manager.cpp b/stratosphere/pm/source/impl/pm_process_manager.cpp index 881b3b689..4eaf20e77 100644 --- a/stratosphere/pm/source/impl/pm_process_manager.cpp +++ b/stratosphere/pm/source/impl/pm_process_manager.cpp @@ -162,6 +162,7 @@ namespace sts::pm::impl { for (size_t i = 0; i < MaxProcessInfos; i++) { if (!this->process_info_allocated[i]) { this->process_info_allocated[i] = true; + std::memset(&this->process_info_storages[i], 0, sizeof(this->process_info_storages[i])); return GetPointer(this->process_info_storages[i]); } } @@ -176,7 +177,6 @@ namespace sts::pm::impl { STS_ASSERT(this->process_info_allocated[index]); process_info->~ProcessInfo(); - std::memset(process_info, 0, sizeof(*process_info)); this->process_info_allocated[index] = false; } };