From 6d387ecd4e9441f1ce82fac27320424ac6ba443f Mon Sep 17 00:00:00 2001 From: joel16 Date: Sat, 6 Feb 2021 16:31:23 -0500 Subject: [PATCH] gui: Allow touch controls to access sd/nand/search icons --- source/fs.cpp | 5 ++++- source/gui/gui.cpp | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/source/fs.cpp b/source/fs.cpp index 776a781..e514dd7 100644 --- a/source/fs.cpp +++ b/source/fs.cpp @@ -203,7 +203,10 @@ namespace FS { entries.clear(); cfg.cwd = path; - Config::Save(cfg); + + if (archive == sdmc_archive) + Config::Save(cfg); + entries = new_entries; return 0; } diff --git a/source/gui/gui.cpp b/source/gui/gui.cpp index d5c6755..7fd3ff0 100644 --- a/source/gui/gui.cpp +++ b/source/gui/gui.cpp @@ -8,6 +8,7 @@ #include "config.h" #include "fs.h" #include "gui.h" +#include "osk.h" #include "textures.h" #include "touch.h" #include "utils.h" @@ -94,6 +95,37 @@ namespace GUI { item->state = MENU_STATE_OPTIONS; else if ((*kDown & KEY_TOUCH) && (Touch::Rect(48, 0, 72, 20))) item->state = MENU_STATE_SETTINGS; + else if ((*kDown & KEY_TOUCH) && (Touch::Rect(247, 0, 272, 20))) { + if (archive != sdmc_archive) { + archive = sdmc_archive; + cfg.cwd = "/"; + item->selected = 0; + FS::GetDirList(cfg.cwd, item->entries); + GUI::ResetCheckbox(item); + GUI::RecalcStorageSize(item); + } + } + else if ((*kDown & KEY_TOUCH) && (Touch::Rect(273, 0, 292, 20))) { + if (archive != nand_archive) { + archive = nand_archive; + cfg.cwd = "/"; + item->selected = 0; + FS::GetDirList(cfg.cwd, item->entries); + GUI::ResetCheckbox(item); + GUI::RecalcStorageSize(item); + } + } + else if ((*kDown & KEY_TOUCH) && (Touch::Rect(293, 0, 320, 20))) { + std::string path = OSK::GetText("/", "Enter file path"); + path.append((path.back() != '/')? "/" : ""); + if (FS::DirExists(archive, path)) { + cfg.cwd = path; + item->selected = 0; + FS::GetDirList(cfg.cwd, item->entries); + GUI::ResetCheckbox(item); + GUI::RecalcStorageSize(item); + } + } } Result Loop(void) {