mirror of
https://github.com/Lime3DS/Lime3DS
synced 2025-01-09 13:43:27 +00: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
3 changed files with 29 additions and 1 deletions
|
@ -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
|
* @param title Reference to store the application title into
|
||||||
* @return ResultStatus result of function
|
* @return ResultStatus result of function
|
||||||
*/
|
*/
|
||||||
|
@ -253,6 +253,15 @@ public:
|
||||||
return ResultStatus::ErrorNotImplemented;
|
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:
|
protected:
|
||||||
Core::System& system;
|
Core::System& system;
|
||||||
FileUtil::IOFile file;
|
FileUtil::IOFile file;
|
||||||
|
|
|
@ -381,4 +381,22 @@ ResultStatus AppLoader_NCCH::ReadTitle(std::string& title) {
|
||||||
return ResultStatus::Success;
|
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
|
} // namespace Loader
|
||||||
|
|
|
@ -70,6 +70,7 @@ public:
|
||||||
ResultStatus DumpUpdateRomFS(const std::string& target_path) override;
|
ResultStatus DumpUpdateRomFS(const std::string& target_path) override;
|
||||||
|
|
||||||
ResultStatus ReadTitle(std::string& title) override;
|
ResultStatus ReadTitle(std::string& title) override;
|
||||||
|
ResultStatus ReadTitleLong(std::string& title) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue