diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index fd76e1cb6..8c8732d19 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h @@ -245,7 +245,7 @@ public: } /** - * Get the title of the application + * Get the short title of the application * @param title Reference to store the application title into * @return ResultStatus result of function */ @@ -253,6 +253,15 @@ public: return ResultStatus::ErrorNotImplemented; } + /** + * Get the long title of the application + * @param title Referencec to store the application title into + * @param ResultStatus result of function + */ + virtual ResultStatus ReadTitleLong([[maybe_unused]]std::string& title) { + return ResultStatus::ErrorNotImplemented; + } + protected: Core::System& system; FileUtil::IOFile file; diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp index 695a612f4..337177a88 100644 --- a/src/core/loader/ncch.cpp +++ b/src/core/loader/ncch.cpp @@ -381,4 +381,22 @@ ResultStatus AppLoader_NCCH::ReadTitle(std::string& title) { return ResultStatus::Success; } +ResultStatus AppLoader_NCCH::ReadTitleLong(std::string& title) { + std::vector data; + Loader::SMDH smdh; + ReadIcon(data); + + if (!Loader::IsValidSMDH(data)) { + return ResultStatus::ErrorInvalidFormat; + } + + std::memcpy(&smdh, data.data(), sizeof(Loader::SMDH)); + + const auto& long_title = smdh.GetLongTitle(SMDH::TitleLanguage::English); + auto title_end = std::find(long_title.begin(), long_title.end(), u'\0'); + title = Common::UTF16ToUTF8(std::u16string{long_title.begin(), title_end}); + + return ResultStatus::Success; +} + } // namespace Loader diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h index 099644b75..5c8f73d1e 100644 --- a/src/core/loader/ncch.h +++ b/src/core/loader/ncch.h @@ -70,6 +70,7 @@ public: ResultStatus DumpUpdateRomFS(const std::string& target_path) override; ResultStatus ReadTitle(std::string& title) override; + ResultStatus ReadTitleLong(std::string& title) override; private: /**