mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-10 20:25:06 +01:00
Update app loader to have a function for getting the long variant of the game title.
This commit is contained in:
parent
92f999d76b
commit
5873e292e7
@ -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;
|
||||
|
@ -381,4 +381,22 @@ ResultStatus AppLoader_NCCH::ReadTitle(std::string& title) {
|
||||
return ResultStatus::Success;
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_NCCH::ReadTitleLong(std::string& title) {
|
||||
std::vector<u8> 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
|
||||
|
@ -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:
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user