mirror of
https://github.com/cemu-project/Cemu.git
synced 2026-03-21 18:05:00 -05:00
impl. graphicpack titleid wildcard
Co-authored-by: Luminyx <79218624+Luminyx1@users.noreply.github.com>
This commit is contained in:
parent
5bc60b9452
commit
9ec02dfd6e
|
|
@ -328,7 +328,7 @@ GraphicPack2::GraphicPack2(fs::path rulesPath, IniParser& rules)
|
|||
}
|
||||
|
||||
m_title_ids = ParseTitleIds(rules, "titleIds");
|
||||
if(m_title_ids.empty())
|
||||
if(m_title_ids.empty() && !m_universal)
|
||||
throw std::exception();
|
||||
|
||||
auto option_fsPriority = rules.FindOption("fsPriority");
|
||||
|
|
@ -532,6 +532,9 @@ std::string GraphicPack2::GetNormalizedPathString() const
|
|||
|
||||
bool GraphicPack2::ContainsTitleId(uint64_t title_id) const
|
||||
{
|
||||
if (m_universal)
|
||||
return true;
|
||||
|
||||
const auto it = std::find_if(m_title_ids.begin(), m_title_ids.end(), [title_id](uint64 id) { return id == title_id; });
|
||||
return it != m_title_ids.end();
|
||||
}
|
||||
|
|
@ -1188,7 +1191,7 @@ std::vector<GraphicPack2::PresetPtr> GraphicPack2::GetActivePresets() const
|
|||
return result;
|
||||
}
|
||||
|
||||
std::vector<uint64> GraphicPack2::ParseTitleIds(IniParser& rules, const char* option_name) const
|
||||
std::vector<uint64> GraphicPack2::ParseTitleIds(IniParser& rules, const char* option_name)
|
||||
{
|
||||
std::vector<uint64> result;
|
||||
|
||||
|
|
@ -1198,6 +1201,13 @@ std::vector<uint64> GraphicPack2::ParseTitleIds(IniParser& rules, const char* op
|
|||
|
||||
for (auto& token : TokenizeView(*option_text, ','))
|
||||
{
|
||||
if (token == "*")
|
||||
{
|
||||
m_universal = true;
|
||||
result.clear();
|
||||
break;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
result.emplace_back(ConvertString<uint64>(token, 16));
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ public:
|
|||
bool Reload();
|
||||
|
||||
bool HasName() const { return !m_name.empty(); }
|
||||
bool IsUniversal() const { return m_universal; }
|
||||
|
||||
const std::string& GetName() const { return m_name.empty() ? m_virtualPath : m_name; }
|
||||
const std::string& GetVirtualPath() const { return m_virtualPath; } // returns the path in the gfx tree hierarchy
|
||||
|
|
@ -229,6 +230,7 @@ private:
|
|||
bool m_activated = false; // set if the graphic pack is currently used by the running game
|
||||
std::vector<uint64_t> m_title_ids;
|
||||
bool m_patchedFilesLoaded = false; // set to true once patched files are loaded
|
||||
bool m_universal = false; // set if this pack applies to every titl eid
|
||||
|
||||
sint32 m_vsync_frequency = -1;
|
||||
sint32 m_fs_priority = 100;
|
||||
|
|
@ -256,7 +258,7 @@ private:
|
|||
|
||||
std::unordered_map<std::string, PresetVar> ParsePresetVars(IniParser& rules) const;
|
||||
|
||||
std::vector<uint64> ParseTitleIds(IniParser& rules, const char* option_name) const;
|
||||
std::vector<uint64> ParseTitleIds(IniParser& rules, const char* option_name);
|
||||
|
||||
CustomShader LoadShader(const fs::path& path, uint64 shader_base_hash, uint64 shader_aux_hash, GP_SHADER_TYPE shader_type, bool isMetalShader) const;
|
||||
void ApplyShaderPresets(std::string& shader_source) const;
|
||||
|
|
|
|||
|
|
@ -43,44 +43,47 @@ void GraphicPacksWindow2::FillGraphicPackList() const
|
|||
|
||||
for(auto& p : graphic_packs)
|
||||
{
|
||||
// filter graphic packs by given title id
|
||||
if (m_filter_installed_games && !m_installed_games.empty())
|
||||
if (!p->IsUniversal())
|
||||
{
|
||||
bool found = false;
|
||||
for (uint64 titleId : p->GetTitleIds())
|
||||
{
|
||||
if (std::find(m_installed_games.cbegin(), m_installed_games.cend(), titleId) != m_installed_games.cend())
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
continue;
|
||||
}
|
||||
|
||||
// filter graphic packs by given title id
|
||||
if(has_filter)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
if (boost::icontains(p->GetVirtualPath(), m_filter))
|
||||
found = true;
|
||||
else
|
||||
// filter graphic packs by given title id
|
||||
if (m_filter_installed_games && !m_installed_games.empty())
|
||||
{
|
||||
bool found = false;
|
||||
for (uint64 titleId : p->GetTitleIds())
|
||||
{
|
||||
if (boost::icontains(fmt::format("{:x}", titleId), m_filter))
|
||||
if (std::find(m_installed_games.cbegin(), m_installed_games.cend(), titleId) != m_installed_games.cend())
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
continue;
|
||||
}
|
||||
|
||||
// filter graphic packs by given title id
|
||||
if(has_filter)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
if (boost::icontains(p->GetVirtualPath(), m_filter))
|
||||
found = true;
|
||||
else
|
||||
{
|
||||
for (uint64 titleId : p->GetTitleIds())
|
||||
{
|
||||
if (boost::icontains(fmt::format("{:x}", titleId), m_filter))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!found)
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto& path = p->GetVirtualPath();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user