diff --git a/Makefile b/Makefile index f4b38a2..da2b465 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ include $(DEVKITPRO)/libnx/switch_rules #--------------------------------------------------------------------------------- APP_TITLE := PatchExtractor APP_AUTHOR := NiklasCFW -APP_VERSION := 1.1.0 +APP_VERSION := 1.1.1 #--------------------------------------------------------------------------------- TARGET := $(notdir $(CURDIR)) diff --git a/README.md b/README.md index a8bc5f3..28f1e26 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Nintendo Switch Homebrew App für [OmniNX OC](https://git.niklascfw.de/OmniNX/Om 1. Sucht nach `sd:/SaltySD/plugins/FPSLocker/patches.zip` 2. Entpackt alle Patches in das gleiche Verzeichnis (überschreibt existierende Dateien) 3. Löscht `patches.zip` nach erfolgreichem Entpacken -4. Löscht `sd:/switch/PatchExtractor.nro` beim Beenden (nach `romfsExit`, da eingebettetes ROMFS die Datei sonst offen hält) +4. Löscht `sd:/switch/PatchExtractor.nro` nur beim Beenden nach erfolgreichem Entpacken (Fertig-Bildschirm) ## Nutzung diff --git a/source/extractor.cpp b/source/extractor.cpp index 8aaceab..80d159b 100644 --- a/source/extractor.cpp +++ b/source/extractor.cpp @@ -116,9 +116,6 @@ bool PatchExtractor::cleanup() { if (remove(PATCHES_ZIP) != 0) cleanupOk_ = false; - // Cannot delete our own NRO while the app is still running; try anyway for edge cases. - remove(SELF_NRO); - remove("sdmc:/switch/.PatchExtractor.nro.star"); remove("sdmc:/switch/.packages/boot_package.ini"); diff --git a/source/main.cpp b/source/main.cpp index dfe2d8e..3634158 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -20,6 +20,8 @@ int main(int argc, char* argv[]) { while (brls::Application::mainLoop()) {} - PatchExtractor::tryDeleteSelfOnExit(); + if (PatchActivity::shouldDeleteSelfOnExit()) + PatchExtractor::tryDeleteSelfOnExit(); + return 0; } diff --git a/source/patch_activity.cpp b/source/patch_activity.cpp index e82b0e4..206c71d 100644 --- a/source/patch_activity.cpp +++ b/source/patch_activity.cpp @@ -2,6 +2,14 @@ #include +namespace { +bool g_deleteSelfOnExit = false; +} + +bool PatchActivity::shouldDeleteSelfOnExit() { + return g_deleteSelfOnExit; +} + PatchActivity::PatchActivity() { extractor = std::make_unique(); @@ -128,6 +136,7 @@ void PatchActivity::showScreen(Screen screen) { break; case Screen::Done: { + g_deleteSelfOnExit = true; titleLabel->setText("Fertig"); const unsigned long ok = extractor->getExtracted() - extractor->getSkipped(); char msg[128]; diff --git a/source/patch_activity.hpp b/source/patch_activity.hpp index a2c61d9..53d05fc 100644 --- a/source/patch_activity.hpp +++ b/source/patch_activity.hpp @@ -13,6 +13,9 @@ public: brls::View* createContentView() override; void onContentAvailable() override; + /** True only after a finished extraction (Done screen was reached). */ + static bool shouldDeleteSelfOnExit(); + private: enum class Screen { Error, Ready, Extracting, Done };