mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-01-09 11:17:30 -03:00
Prioritize non-NUS format over NUS
If a title exists multiple times in the game folder in different formats, then prefer and use non-NUS format if one is available. This is so we match previous Cemu behavior where Cemu would pick non-NUS simply due the fact that NUS format wasn't supported yet.
This commit is contained in:
parent
ce34b95b82
commit
43976ca7eb
3 changed files with 25 additions and 13 deletions
|
@ -27,17 +27,13 @@ public:
|
||||||
|
|
||||||
void SetBase(const TitleInfo& titleInfo)
|
void SetBase(const TitleInfo& titleInfo)
|
||||||
{
|
{
|
||||||
m_base = titleInfo;
|
if (IsPrioritizedVersionOrFormat(m_base, titleInfo))
|
||||||
|
m_base = titleInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetUpdate(const TitleInfo& titleInfo)
|
void SetUpdate(const TitleInfo& titleInfo)
|
||||||
{
|
{
|
||||||
if (HasUpdate())
|
if (IsPrioritizedVersionOrFormat(m_update, titleInfo))
|
||||||
{
|
|
||||||
if (titleInfo.GetAppTitleVersion() > m_update.GetAppTitleVersion())
|
|
||||||
m_update = titleInfo;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
m_update = titleInfo;
|
m_update = titleInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +49,7 @@ public:
|
||||||
auto it = std::find_if(m_aoc.begin(), m_aoc.end(), [aocTitleId](const TitleInfo& rhs) { return rhs.GetAppTitleId() == aocTitleId; });
|
auto it = std::find_if(m_aoc.begin(), m_aoc.end(), [aocTitleId](const TitleInfo& rhs) { return rhs.GetAppTitleId() == aocTitleId; });
|
||||||
if (it != m_aoc.end())
|
if (it != m_aoc.end())
|
||||||
{
|
{
|
||||||
if(it->GetAppTitleVersion() >= aocVersion)
|
if (!IsPrioritizedVersionOrFormat(*it, titleInfo))
|
||||||
return;
|
return;
|
||||||
m_aoc.erase(it);
|
m_aoc.erase(it);
|
||||||
}
|
}
|
||||||
|
@ -126,6 +122,25 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool IsPrioritizedVersionOrFormat(const TitleInfo& currentTitle, const TitleInfo& newTitle)
|
||||||
|
{
|
||||||
|
if (!currentTitle.IsValid())
|
||||||
|
return true; // always prefer a valid title over an invalid one
|
||||||
|
// always prefer higher version
|
||||||
|
if (newTitle.GetAppTitleVersion() > currentTitle.GetAppTitleVersion())
|
||||||
|
return true;
|
||||||
|
// never prefer lower version
|
||||||
|
if (newTitle.GetAppTitleVersion() < currentTitle.GetAppTitleVersion())
|
||||||
|
return false;
|
||||||
|
// for users which have both NUS and non-NUS titles in their games folder we want to prioritize non-NUS formats
|
||||||
|
// this is to stay consistent with previous Cemu versions which did not support NUS format at all
|
||||||
|
TitleInfo::TitleDataFormat currentFormat = currentTitle.GetFormat();
|
||||||
|
TitleInfo::TitleDataFormat newFormat = newTitle.GetFormat();
|
||||||
|
if (currentFormat != newFormat && currentFormat == TitleInfo::TitleDataFormat::NUS)
|
||||||
|
return true;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
TitleInfo m_base;
|
TitleInfo m_base;
|
||||||
TitleInfo m_update;
|
TitleInfo m_update;
|
||||||
std::vector<TitleInfo> m_aoc;
|
std::vector<TitleInfo> m_aoc;
|
||||||
|
|
|
@ -633,8 +633,7 @@ GameInfo2 CafeTitleList::GetGameInfo(TitleId titleId)
|
||||||
uint64 baseTitleId;
|
uint64 baseTitleId;
|
||||||
if (!FindBaseTitleId(titleId, baseTitleId))
|
if (!FindBaseTitleId(titleId, baseTitleId))
|
||||||
{
|
{
|
||||||
cemuLog_logDebug(LogType::Force, "Failed to translate title id in GetGameInfo()");
|
cemu_assert_suspicious();
|
||||||
return gameInfo;
|
|
||||||
}
|
}
|
||||||
// determine if an optional update title id exists
|
// determine if an optional update title id exists
|
||||||
TitleIdParser tip(baseTitleId);
|
TitleIdParser tip(baseTitleId);
|
||||||
|
|
|
@ -953,9 +953,7 @@ wxString wxTitleManagerList::GetTitleEntryText(const TitleEntry& entry, ItemColu
|
||||||
}
|
}
|
||||||
case ColumnLocation:
|
case ColumnLocation:
|
||||||
{
|
{
|
||||||
const auto relative_mlc_path =
|
const auto relative_mlc_path = _pathToUtf8(entry.path.lexically_relative(ActiveSettings::GetMlcPath()));
|
||||||
entry.path.lexically_relative(ActiveSettings::GetMlcPath()).string();
|
|
||||||
|
|
||||||
if (relative_mlc_path.starts_with("usr") || relative_mlc_path.starts_with("sys"))
|
if (relative_mlc_path.starts_with("usr") || relative_mlc_path.starts_with("sys"))
|
||||||
return _("MLC");
|
return _("MLC");
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue