loader: Expose program title.
This commit is contained in:
parent
035716d57b
commit
f5cf9960d9
3 changed files with 31 additions and 12 deletions
|
@ -4,7 +4,9 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <cinttypes>
|
||||
#include <codecvt>
|
||||
#include <cstring>
|
||||
#include <locale>
|
||||
#include <memory>
|
||||
#include "common/logging/log.h"
|
||||
#include "common/string_util.h"
|
||||
|
@ -420,4 +422,22 @@ ResultStatus AppLoader_NCCH::ReadRomFS(std::shared_ptr<FileUtil::IOFile>& romfs_
|
|||
return ResultStatus::ErrorNotUsed;
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_NCCH::ReadTitle(std::string& title) {
|
||||
std::vector<u8> data;
|
||||
Loader::SMDH smdh;
|
||||
ReadIcon(data);
|
||||
|
||||
if (!Loader::IsValidSMDH(data)) {
|
||||
return ResultStatus::ErrorInvalidFormat;
|
||||
}
|
||||
|
||||
memcpy(&smdh, data.data(), sizeof(Loader::SMDH));
|
||||
|
||||
const auto& short_title = smdh.GetShortTitle(SMDH::TitleLanguage::English);
|
||||
auto title_end = std::find(short_title.begin(), short_title.end(), u'\0');
|
||||
title = Common::UTF16ToUTF8(std::u16string{short_title.begin(), title_end});
|
||||
|
||||
return ResultStatus::Success;
|
||||
}
|
||||
|
||||
} // namespace Loader
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue