From 27465434d479aa19854c2fba96e05933e30e70fe Mon Sep 17 00:00:00 2001 From: Pablo Curiel Date: Mon, 15 Apr 2024 13:47:50 +0200 Subject: [PATCH] [ci skip] GamecardTab: fix transition to DumpOptionsFrame view --- include/gamecard_tab.hpp | 3 +++ include/options_tab.hpp | 2 +- source/gamecard_tab.cpp | 21 ++++++++++++++------- source/options_tab.cpp | 4 ++-- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/include/gamecard_tab.hpp b/include/gamecard_tab.hpp index 5995168..05040eb 100644 --- a/include/gamecard_tab.hpp +++ b/include/gamecard_tab.hpp @@ -40,6 +40,9 @@ namespace nxdt::views nxdt::tasks::GameCardStatusEvent::Subscription gc_status_task_sub; GameCardStatus gc_status = GameCardStatus_NotInserted; + std::string raw_filename_full = ""; + std::string raw_filename_id_only = ""; + void ProcessGameCardStatus(GameCardStatus gc_status); std::string GetFormattedSizeString(GameCardSizeFunc func); std::string GetCardIdSetString(FsGameCardIdSet *card_id_set); diff --git a/include/options_tab.hpp b/include/options_tab.hpp index e5c718e..3c3f6f2 100644 --- a/include/options_tab.hpp +++ b/include/options_tab.hpp @@ -77,7 +77,7 @@ namespace nxdt::views brls::menu_timer_t notification_timer = 0.0f; brls::menu_timer_ctx_entry_t notification_timer_ctx = {0}; - void DisplayNotification(std::string str); + void DisplayNotification(const std::string& str); public: OptionsTab(RootView *root_view); ~OptionsTab(void); diff --git a/source/gamecard_tab.cpp b/source/gamecard_tab.cpp index 3366b53..dd7b4ae 100644 --- a/source/gamecard_tab.cpp +++ b/source/gamecard_tab.cpp @@ -113,11 +113,12 @@ namespace nxdt::views void GameCardTab::PopulateList(void) { - TitleApplicationMetadata **app_metadata = NULL; + TitleApplicationMetadata **app_metadata = nullptr; u32 app_metadata_count = 0; GameCardHeader card_header = {0}; GameCardInfo card_info = {0}; FsGameCardIdSet card_id_set = {0}; + char *raw_filename = nullptr; bool update_focused_view = this->IsListItemFocused(); int focus_stack_index = this->GetFocusStackViewIndex(); @@ -242,19 +243,25 @@ namespace nxdt::views /* ListItem elements. */ this->list->addView(new brls::Header("gamecard_tab/list/dump_options"_i18n)); + raw_filename = titleGenerateGameCardFileName(TitleNamingConvention_Full, TitleFileNameIllegalCharReplaceType_None); + this->raw_filename_full = std::string(raw_filename); + if (raw_filename) free(raw_filename); + + raw_filename = titleGenerateGameCardFileName(TitleNamingConvention_IdAndVersionOnly, TitleFileNameIllegalCharReplaceType_None); + this->raw_filename_id_only = std::string(raw_filename); + if (raw_filename) free(raw_filename); + + raw_filename = nullptr; + brls::ListItem *dump_card_image = new brls::ListItem("gamecard_tab/list/dump_card_image/label"_i18n, "gamecard_tab/list/dump_card_image/description"_i18n); dump_card_image->getClickEvent()->subscribe([this](brls::View *view) { - char *raw_filename = titleGenerateGameCardFileName(configGetInteger("naming_convention"), TitleFileNameIllegalCharReplaceType_None); - if (!raw_filename) return; - brls::Image *icon = new brls::Image(); icon->setImage(BOREALIS_ASSET("icon/" APP_TITLE ".jpg")); icon->setScaleType(brls::ImageScaleType::SCALE); - brls::Application::pushView(new DumpOptionsFrame(this->root_view, "gamecard_tab/list/dump_card_image/label"_i18n, icon, std::string(raw_filename), ".xci"), brls::ViewAnimation::SLIDE_LEFT); - - free(raw_filename); + brls::Application::pushView(new DumpOptionsFrame(this->root_view, "gamecard_tab/list/dump_card_image/label"_i18n, icon, + configGetInteger("naming_convention") == TitleNamingConvention_Full ? raw_filename_full : raw_filename_id_only, ".xci"), brls::ViewAnimation::SLIDE_LEFT); }); this->list->addView(dump_card_image); diff --git a/source/options_tab.cpp b/source/options_tab.cpp index 16023e7..9757f10 100644 --- a/source/options_tab.cpp +++ b/source/options_tab.cpp @@ -370,9 +370,9 @@ namespace nxdt::views brls::menu_timer_kill(&(this->notification_timer)); } - void OptionsTab::DisplayNotification(std::string str) + void OptionsTab::DisplayNotification(const std::string& str) { - if (str == "" || !this->display_notification) return; + if (str.empty() || !this->display_notification) return; brls::Application::notify(str); this->display_notification = false;