From 979ed8364087ac54b81a1364dc3251c928473786 Mon Sep 17 00:00:00 2001 From: Edoardo Lolletti Date: Mon, 18 Aug 2025 01:30:24 +0200 Subject: [PATCH] Try to mark HNAA tmd as writable only if it exists --- arm9/src/unlaunch.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/arm9/src/unlaunch.cpp b/arm9/src/unlaunch.cpp index c23f324..f2137d5 100644 --- a/arm9/src/unlaunch.cpp +++ b/arm9/src/unlaunch.cpp @@ -56,14 +56,16 @@ bool isValidUnlaunchInstallerSize(size_t size) static bool removeHnaaLauncher() { auto* errString = [] -> const char* { - if(!toggleFileReadOnly(hnaaTmdPath, false)) - { - return "\x1B[31mError:\x1B[33m Failed to mark unlaunch's title.tmd as writable\nLeaving as is\n"; - } - if(!removeIfExists(hnaaTmdPath)) - { - return "\x1B[31mError:\x1B[33m Failed to delete ulnaunch's title.tmd\n"; - } + if(fileExists(hnaaTmdPath)) { + if(!toggleFileReadOnly(hnaaTmdPath, false)) + { + return "\x1B[31mError:\x1B[33m Failed to mark unlaunch's title.tmd as writable\nLeaving as is\n"; + } + if(!removeIfExists(hnaaTmdPath)) + { + return "\x1B[31mError:\x1B[33m Failed to delete ulnaunch's title.tmd\n"; + } + } if(!removeIfExists("nand:/title/00030017/484e4141/content")) { return "\x1B[31mError:\x1B[33m Failed to delete ulnaunch's content folder\n";