From e0f45d54f18196a782eaadb73330cf897997ca9b Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Sun, 5 Sep 2021 15:53:54 -0700 Subject: [PATCH] stratosphere: remove 0.19.0 update cleanup logic. --- Makefile | 1 - .../source/boot2/boot2_api.cpp | 71 ------------------- 2 files changed, 72 deletions(-) diff --git a/Makefile b/Makefile index 7a0a6afd9..019192cbe 100644 --- a/Makefile +++ b/Makefile @@ -83,7 +83,6 @@ dist-no-debug: all mkdir -p atmosphere-$(AMSVER)/atmosphere/config_templates mkdir -p atmosphere-$(AMSVER)/atmosphere/config mkdir -p atmosphere-$(AMSVER)/atmosphere/flags - touch atmosphere-$(AMSVER)/atmosphere/flags/clean_stratosphere_for_0.19.0.flag cp fusee/fusee.bin atmosphere-$(AMSVER)/atmosphere/reboot_payload.bin cp fusee/package3 atmosphere-$(AMSVER)/atmosphere/package3 cp config_templates/stratosphere.ini atmosphere-$(AMSVER)/atmosphere/config_templates/stratosphere.ini diff --git a/libraries/libstratosphere/source/boot2/boot2_api.cpp b/libraries/libstratosphere/source/boot2/boot2_api.cpp index 3ba67a2ae..e892b8c2a 100644 --- a/libraries/libstratosphere/source/boot2/boot2_api.cpp +++ b/libraries/libstratosphere/source/boot2/boot2_api.cpp @@ -307,57 +307,6 @@ namespace ams::boot2 { return hos::GetVersion() >= hos::Version_9_0_0; } - /* Prior to 0.19.0, we distributed system modules inside /atmosphere/contents/. */ - /* We need to clean these up, so that we don't break horribly on first upgrade. */ - constexpr const ncm::SystemProgramId StratosphereSystemModulesForPostZeroPointNineteenPointZeroCleanup[] = { - ncm::SystemProgramId::Boot2, - ncm::SystemProgramId::Creport, - ncm::SystemProgramId::Dmnt, - ncm::SystemProgramId::Eclct, - ncm::SystemProgramId::Erpt, - ncm::SystemProgramId::Fatal, - ncm::SystemProgramId::JpegDec, - ncm::SystemProgramId::Pgl, - ncm::SystemProgramId::Ro, - }; - - alignas(0x40) constinit u8 g_fs_cleanup_buffer[4_KB]; - lmem::HeapHandle g_fs_cleanup_heap_handle; - - void *AllocateForFsForCleanup(size_t size) { - return lmem::AllocateFromExpHeap(g_fs_cleanup_heap_handle, size); - } - - void DeallocateForFsForCleanup(void *p, size_t size) { - return lmem::FreeToExpHeap(g_fs_cleanup_heap_handle, p); - } - - void InitializeFsHeapForCleanup() { - g_fs_cleanup_heap_handle = lmem::CreateExpHeap(g_fs_cleanup_buffer, sizeof(g_fs_cleanup_buffer), lmem::CreateOption_None); - fs::SetAllocator(AllocateForFsForCleanup, DeallocateForFsForCleanup); - } - - void CleanupSdCardSystemProgramsForUpgradeToZeroPointNineteenPointZero() { - /* Temporarily mount the SD card. */ - R_ABORT_UNLESS(fs::MountSdCard("sdmc")); - ON_SCOPE_EXIT { fs::Unmount("sdmc"); }; - - for (const auto program_id : StratosphereSystemModulesForPostZeroPointNineteenPointZeroCleanup) { - /* Get the program's contents path. */ - char path[fs::EntryNameLengthMax]; - util::SNPrintf(path, sizeof(path), "sdmc:/atmosphere/contents/%016lx/", program_id.value); - - /* Check if we have old contents. */ - bool has_dir; - R_ABORT_UNLESS(fs::HasDirectory(std::addressof(has_dir), path)); - - /* Cleanup the old contents, if we have them. */ - if (has_dir) { - R_ABORT_UNLESS(fs::DeleteDirectoryRecursively(path)); - } - } - } - } /* Boot2 API. */ @@ -417,26 +366,6 @@ namespace ams::boot2 { } } - /* Perform cleanup to faciliate upgrade to 0.19.0. */ - /* NOTE: This will be removed in a future atmosphere revision. */ - { - /* Setup FS heap for cleanup. */ - InitializeFsHeapForCleanup(); - - /* Temporarily initialize fs. */ - R_ABORT_UNLESS(fsInitialize()); - ON_SCOPE_EXIT { fsExit(); }; - - /* Wait for the sd card to be available. */ - cfg::WaitSdCardInitialized(); - - /* Cleanup. */ - if (cfg::HasGlobalFlag("clean_stratosphere_for_0.19.0")) { - CleanupSdCardSystemProgramsForUpgradeToZeroPointNineteenPointZero(); - R_ABORT_UNLESS(cfg::DeleteGlobalFlag("clean_stratosphere_for_0.19.0")); - } - } - /* Launch Atmosphere boot2, using NcmStorageId_None to force SD card boot. */ LaunchProgram(nullptr, ncm::ProgramLocation::Make(ncm::SystemProgramId::Boot2, ncm::StorageId::None), 0); }