mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-14 18:58:29 +12:00
More detailed error messages when encrypted titles fail to launch
This commit is contained in:
parent
5ad57bb0c9
commit
f6c3c96d94
5 changed files with 81 additions and 15 deletions
|
@ -77,6 +77,7 @@ TitleInfo::TitleInfo(const fs::path& path, std::string_view subPath)
|
|||
if (!path.has_filename())
|
||||
{
|
||||
m_isValid = false;
|
||||
SetInvalidReason(InvalidReason::BAD_PATH_OR_INACCESSIBLE);
|
||||
return;
|
||||
}
|
||||
m_isValid = true;
|
||||
|
@ -269,6 +270,7 @@ bool TitleInfo::DetectFormat(const fs::path& path, fs::path& pathOut, TitleDataF
|
|||
return true;
|
||||
}
|
||||
}
|
||||
SetInvalidReason(InvalidReason::UNKNOWN_FORMAT);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -321,6 +323,12 @@ uint64 TitleInfo::GetUID()
|
|||
return m_uid;
|
||||
}
|
||||
|
||||
void TitleInfo::SetInvalidReason(InvalidReason reason)
|
||||
{
|
||||
if(m_invalidReason == InvalidReason::NONE)
|
||||
m_invalidReason = reason; // only update reason when it hasn't been set before
|
||||
}
|
||||
|
||||
std::mutex sZArchivePoolMtx;
|
||||
std::map<fs::path, std::pair<uint32, ZArchiveReader*>> sZArchivePool;
|
||||
|
||||
|
@ -382,21 +390,29 @@ bool TitleInfo::Mount(std::string_view virtualPath, std::string_view subfolder,
|
|||
if (!r)
|
||||
{
|
||||
cemuLog_log(LogType::Force, "Failed to mount {} to {}", virtualPath, subfolder);
|
||||
SetInvalidReason(InvalidReason::BAD_PATH_OR_INACCESSIBLE);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (m_titleFormat == TitleDataFormat::WUD || m_titleFormat == TitleDataFormat::NUS)
|
||||
{
|
||||
FSTVolume::ErrorCode fstError;
|
||||
if (m_mountpoints.empty())
|
||||
{
|
||||
cemu_assert_debug(!m_wudVolume);
|
||||
if(m_titleFormat == TitleDataFormat::WUD)
|
||||
m_wudVolume = FSTVolume::OpenFromDiscImage(m_fullPath); // open wud/wux
|
||||
m_wudVolume = FSTVolume::OpenFromDiscImage(m_fullPath, &fstError); // open wud/wux
|
||||
else
|
||||
m_wudVolume = FSTVolume::OpenFromContentFolder(m_fullPath.parent_path()); // open from .app files directory, the path points to /title.tmd
|
||||
m_wudVolume = FSTVolume::OpenFromContentFolder(m_fullPath.parent_path(), &fstError); // open from .app files directory, the path points to /title.tmd
|
||||
}
|
||||
if (!m_wudVolume)
|
||||
{
|
||||
if (fstError == FSTVolume::ErrorCode::DISC_KEY_MISSING)
|
||||
SetInvalidReason(InvalidReason::NO_DISC_KEY);
|
||||
else if (fstError == FSTVolume::ErrorCode::TITLE_TIK_MISSING)
|
||||
SetInvalidReason(InvalidReason::NO_TITLE_TIK);
|
||||
return false;
|
||||
}
|
||||
bool r = FSCDeviceWUD_Mount(virtualPath, subfolder, m_wudVolume, mountPriority);
|
||||
cemu_assert_debug(r);
|
||||
if (!r)
|
||||
|
@ -518,6 +534,7 @@ bool TitleInfo::ParseXmlInfo()
|
|||
m_parsedAppXml = nullptr;
|
||||
m_parsedCosXml = nullptr;
|
||||
m_isValid = false;
|
||||
SetInvalidReason(InvalidReason::MISSING_XML_FILES);
|
||||
return false;
|
||||
}
|
||||
m_isValid = true;
|
||||
|
|
|
@ -65,6 +65,16 @@ public:
|
|||
INVALID_STRUCTURE = 0,
|
||||
};
|
||||
|
||||
enum class InvalidReason : uint8
|
||||
{
|
||||
NONE = 0,
|
||||
BAD_PATH_OR_INACCESSIBLE = 1,
|
||||
UNKNOWN_FORMAT = 2,
|
||||
NO_DISC_KEY = 3,
|
||||
NO_TITLE_TIK = 4,
|
||||
MISSING_XML_FILES = 4,
|
||||
};
|
||||
|
||||
struct CachedInfo
|
||||
{
|
||||
TitleDataFormat titleDataFormat;
|
||||
|
@ -101,6 +111,7 @@ public:
|
|||
CachedInfo MakeCacheEntry();
|
||||
|
||||
bool IsValid() const;
|
||||
InvalidReason GetInvalidReason() const { return m_invalidReason; }
|
||||
uint64 GetUID(); // returns a unique identifier derived from the absolute canonical title location which can be used to identify this title by its location. May not persist across sessions, especially when Cemu is used portable
|
||||
|
||||
fs::path GetPath() const;
|
||||
|
@ -182,7 +193,7 @@ private:
|
|||
|
||||
bool DetectFormat(const fs::path& path, fs::path& pathOut, TitleDataFormat& formatOut);
|
||||
void CalcUID();
|
||||
|
||||
void SetInvalidReason(InvalidReason reason);
|
||||
bool ParseAppXml(std::vector<uint8>& appXmlData);
|
||||
|
||||
bool m_isValid{ false };
|
||||
|
@ -190,6 +201,7 @@ private:
|
|||
fs::path m_fullPath;
|
||||
std::string m_subPath; // used for formats where fullPath isn't unique on its own (like WUA)
|
||||
uint64 m_uid{};
|
||||
InvalidReason m_invalidReason{ InvalidReason::NONE }; // if m_isValid == false, this contains a more detailed error code
|
||||
// mounting info
|
||||
std::vector<std::pair<sint32, std::string>> m_mountpoints;
|
||||
class FSTVolume* m_wudVolume{};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue