From 38f19ec77896532bcf8df3bfdc030e8d0ad4410a Mon Sep 17 00:00:00 2001 From: ITotalJustice <47043333+ITotalJustice@users.noreply.github.com> Date: Wed, 25 Jun 2025 17:49:45 +0100 Subject: [PATCH] add option to disable erpt_reports --- sphaira/source/app.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sphaira/source/app.cpp b/sphaira/source/app.cpp index a836b47..7b24219 100644 --- a/sphaira/source/app.cpp +++ b/sphaira/source/app.cpp @@ -1758,6 +1758,25 @@ void App::DisplayAdvancedOptions(bool left_side) { options->Add(std::make_unique("Dump options"_i18n, [left_side](){ App::DisplayDumpOptions(left_side); })); + + static const char* erpt_path = "/atmosphere/erpt_reports"; + options->Add(std::make_unique("Disable erpt_reports"_i18n, fs::FsNativeSd().FileExists(erpt_path), [](bool& enable){ + fs::FsNativeSd fs; + if (enable) { + Result rc; + // it's possible for erpt to generate a report in between deleting the folder and creating the file. + for (int i = 0; i < 10; i++) { + fs.DeleteDirectoryRecursively(erpt_path); + if (R_SUCCEEDED(rc = fs.CreateFile(erpt_path))) { + break; + } + } + enable = R_SUCCEEDED(rc); + } else { + fs.DeleteFile(erpt_path); + fs.CreateDirectory(erpt_path); + } + })); } void App::DisplayInstallOptions(bool left_side) {