IOS/ES: Add functions to get TMDs
This commit is contained in:
parent
194b0ae36d
commit
0ed8d68192
|
@ -18,6 +18,29 @@ namespace IOS
|
||||||
{
|
{
|
||||||
namespace ES
|
namespace ES
|
||||||
{
|
{
|
||||||
|
static TMDReader FindTMD(u64 title_id, const std::string& tmd_path)
|
||||||
|
{
|
||||||
|
File::IOFile file(tmd_path, "rb");
|
||||||
|
if (!file)
|
||||||
|
return {};
|
||||||
|
|
||||||
|
std::vector<u8> tmd_bytes(file.GetSize());
|
||||||
|
if (!file.ReadBytes(tmd_bytes.data(), tmd_bytes.size()))
|
||||||
|
return {};
|
||||||
|
|
||||||
|
return TMDReader{std::move(tmd_bytes)};
|
||||||
|
}
|
||||||
|
|
||||||
|
TMDReader FindImportTMD(u64 title_id)
|
||||||
|
{
|
||||||
|
return FindTMD(title_id, Common::GetImportTitlePath(title_id) + "/content/title.tmd");
|
||||||
|
}
|
||||||
|
|
||||||
|
TMDReader FindInstalledTMD(u64 title_id)
|
||||||
|
{
|
||||||
|
return FindTMD(title_id, Common::GetTMDFileName(title_id, Common::FROM_SESSION_ROOT));
|
||||||
|
}
|
||||||
|
|
||||||
static bool IsValidPartOfTitleID(const std::string& string)
|
static bool IsValidPartOfTitleID(const std::string& string)
|
||||||
{
|
{
|
||||||
if (string.length() != 8)
|
if (string.length() != 8)
|
||||||
|
|
|
@ -13,6 +13,9 @@ namespace IOS
|
||||||
{
|
{
|
||||||
namespace ES
|
namespace ES
|
||||||
{
|
{
|
||||||
|
TMDReader FindImportTMD(u64 title_id);
|
||||||
|
TMDReader FindInstalledTMD(u64 title_id);
|
||||||
|
|
||||||
// Get installed titles (in /title) without checking for TMDs at all.
|
// Get installed titles (in /title) without checking for TMDs at all.
|
||||||
std::vector<u64> GetInstalledTitles();
|
std::vector<u64> GetInstalledTitles();
|
||||||
// Get titles which are being imported (in /import) without checking for TMDs at all.
|
// Get titles which are being imported (in /import) without checking for TMDs at all.
|
||||||
|
|
Loading…
Reference in New Issue