From fba4053fd8d7d76b59d04337eb0d380b29b29551 Mon Sep 17 00:00:00 2001 From: Kewlan Date: Mon, 27 Nov 2023 22:27:51 +0100 Subject: [PATCH] Small updates: Less folder creation messages + clarified description --- source/custom_music/sequence_data.cpp | 5 +++- source/descriptions.cpp | 5 +++- source/music.cpp | 39 ++++++++++++++------------- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/source/custom_music/sequence_data.cpp b/source/custom_music/sequence_data.cpp index bb9b410e..971d4b4c 100644 --- a/source/custom_music/sequence_data.cpp +++ b/source/custom_music/sequence_data.cpp @@ -110,11 +110,14 @@ void MusicCategoryNode::AddNewSeqData(SequenceData seqData) { } void MusicCategoryNode::AddExternalSeqDatas(FS_Archive sdmcArchive) { + // Make sure directory exists to avoid issues + FSUSER_CreateDirectory(sdmcArchive, fsMakePath(PATH_ASCII, GetFullPath().c_str()), FS_ATTRIBUTE_DIRECTORY); + for (const auto& bcseq : fs::directory_iterator(GetFullPath())) { if (bcseq.is_regular_file() && bcseq.path().extension().string() == bcseqExtension) { std::array banks = { 7, 7, 7, 7 }; // Set banks to Orchestra by default u16 chFlags = -1; // Enable all channel flags by default - u8 volume = 127; // 100% by default + u8 volume = 127; // 100% (assumed, as it's unsigned) by default // Check for cmeta file auto fileName = bcseq.path().stem().string(); diff --git a/source/descriptions.cpp b/source/descriptions.cpp index d7a9d47d..687c3fcb 100644 --- a/source/descriptions.cpp +++ b/source/descriptions.cpp @@ -1290,7 +1290,10 @@ string_view randomGsLocationsDesc = "Moves Gold Skulltulas to different loca "The logic is updated for any that are moved."; // // string_view gsLocGuaranteeNewDesc = "Excludes the original location from the Gold\n" // - "Skulltula's available locations pool."; // + "Skulltula's available locations pool.\n" // + "\n" // + "If no new locations are available, the original\n"// + "will be used regardless."; // // //--------------// /*------------------------------ // diff --git a/source/music.cpp b/source/music.cpp index 588e8449..83f3619a 100644 --- a/source/music.cpp +++ b/source/music.cpp @@ -335,31 +335,32 @@ bool archiveFound = false; bool musicDirsCreated = false; void CreateMusicDirectories(FS_Archive sdmcArchive) { - std::vector dirs; + if (R_FAILED(FSUSER_OpenDirectory(nullptr, sdmcArchive, fsMakePath(PATH_ASCII, CustomMusicRootPath.c_str())))) { + std::vector dirs; - dirs.push_back("/OoT3DR/"); - dirs.push_back(CustomMusicRootPath); + dirs.push_back("/OoT3DR/"); + dirs.push_back(CustomMusicRootPath); - auto bgmDirs = mcBgm_Root.GetDirectories(); - dirs.insert(dirs.end(), bgmDirs.begin(), bgmDirs.end()); + auto bgmDirs = mcBgm_Root.GetDirectories(); + dirs.insert(dirs.end(), bgmDirs.begin(), bgmDirs.end()); - auto melodyDirs = mcMelodies_Root.GetDirectories(); - dirs.insert(dirs.end(), melodyDirs.begin(), melodyDirs.end()); + auto melodyDirs = mcMelodies_Root.GetDirectories(); + dirs.insert(dirs.end(), melodyDirs.begin(), melodyDirs.end()); - const auto printInfo = [&](int progress) { - consoleClear(); - printf("\x1b[10;10HCreating Music Directories"); - printf("\x1b[11;10HProgress: %d/%d", progress, dirs.size()); - printf("\x1b[13;10HIf this is slow, don't worry."); - printf("\x1b[14;10HThis only has to be done once."); - }; + const auto printInfo = [&](int progress) { + consoleClear(); + printf("\x1b[10;10HCreating Music Directories"); + printf("\x1b[11;10HProgress: %d/%d", progress, dirs.size()); - printInfo(0); - for (size_t i = 0; i < dirs.size(); i++) { - FSUSER_CreateDirectory(sdmcArchive, fsMakePath(PATH_ASCII, dirs[i].c_str()), FS_ATTRIBUTE_DIRECTORY); - printInfo(i + 1); - } + printf("\x1b[13;10HOnly needs to be done once."); + }; + printInfo(0); + for (size_t i = 0; i < dirs.size(); i++) { + FSUSER_CreateDirectory(sdmcArchive, fsMakePath(PATH_ASCII, dirs[i].c_str()), FS_ATTRIBUTE_DIRECTORY); + printInfo(i + 1); + } + } musicDirsCreated = true; }