Merge pull request #14436 from cbartondock/master
Loading custom textures using combination of elf/dol game ids and iso game ids.
This commit is contained in:
5 files changed
+83
-24
No files matched your search
@@ -4,6 +4,7 @@
|
||||
#include "Core/ConfigManager.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <fmt/format.h>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
@@ -13,8 +14,6 @@
|
||||
|
||||
#include <Core/Core.h>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "AudioCommon/AudioCommon.h"
|
||||
|
||||
#include "Common/CommonPaths.h"
|
||||
@@ -130,6 +129,27 @@ const std::string SConfig::GetGameTDBID() const
|
||||
return m_gametdb_id;
|
||||
}
|
||||
|
||||
const std::string SConfig::GetGameIDElfDol() const
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(m_metadata_lock);
|
||||
return m_game_id_elf_dol;
|
||||
}
|
||||
|
||||
const std::string SConfig::GetGameIDForTextures() const
|
||||
{
|
||||
return GetGameIDsForTextures().front();
|
||||
}
|
||||
|
||||
const std::vector<std::string> SConfig::GetGameIDsForTextures() const
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(m_metadata_lock);
|
||||
|
||||
if (m_game_id_elf_dol.empty())
|
||||
return {m_game_id};
|
||||
|
||||
return {fmt::format("{}-{}", m_game_id_elf_dol, m_game_id), m_game_id};
|
||||
}
|
||||
|
||||
const std::string SConfig::GetTitleName() const
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(m_metadata_lock);
|
||||
@@ -164,6 +184,7 @@ void SConfig::ResetRunningGameMetadata()
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(m_metadata_lock);
|
||||
SetRunningGameMetadata("00000000", "", 0, 0, DiscIO::Region::Unknown, 0);
|
||||
SetElfDolID("");
|
||||
}
|
||||
|
||||
void SConfig::SetRunningGameMetadata(const DiscIO::Volume& volume,
|
||||
@@ -269,6 +290,12 @@ void SConfig::SetRunningGameMetadata(const std::string& game_id, const std::stri
|
||||
DolphinAnalytics::Instance().ReportGameStart();
|
||||
}
|
||||
|
||||
void SConfig::SetElfDolID(const std::string& game_id)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(m_metadata_lock);
|
||||
m_game_id_elf_dol = game_id;
|
||||
}
|
||||
|
||||
void SConfig::OnESTitleChanged()
|
||||
{
|
||||
auto& system = Core::System::GetInstance();
|
||||
@@ -368,7 +395,9 @@ struct SetGameMetadata
|
||||
constexpr char BACKSLASH = '\\';
|
||||
constexpr char FORWARDSLASH = '/';
|
||||
std::ranges::replace(executable_path, BACKSLASH, FORWARDSLASH);
|
||||
config->SetRunningGameMetadata(SConfig::MakeGameID(PathToFileName(executable_path)));
|
||||
const std::string made_game_id = SConfig::MakeGameID(PathToFileName(executable_path));
|
||||
config->SetRunningGameMetadata(made_game_id);
|
||||
config->SetElfDolID(made_game_id);
|
||||
|
||||
Host_TitleChanged();
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
@@ -61,6 +62,16 @@ struct SConfig
|
||||
|
||||
const std::string GetGameID() const;
|
||||
const std::string GetGameTDBID() const;
|
||||
const std::string GetGameIDElfDol() const;
|
||||
|
||||
// Returns a preference ordered list of ids to try for texture loading.
|
||||
// If launched via elf/dol, returns {elfdolid-gameid, gameid}. Otherwise returns {gameid}.
|
||||
const std::vector<std::string> GetGameIDsForTextures() const;
|
||||
|
||||
// Returns the single most-preferred id from GetGameIDsForTextures(); see that function for
|
||||
// the full priority order.
|
||||
const std::string GetGameIDForTextures() const;
|
||||
|
||||
const std::string GetTitleName() const;
|
||||
const std::string GetTitleDescription() const;
|
||||
u64 GetTitleID() const;
|
||||
@@ -71,6 +82,8 @@ struct SConfig
|
||||
void SetRunningGameMetadata(const IOS::ES::TMDReader& tmd, DiscIO::Platform platform);
|
||||
void SetRunningGameMetadata(const std::string& game_id);
|
||||
|
||||
void SetElfDolID(const std::string& game_id);
|
||||
|
||||
// Triggered when Dolphin loads a title directly
|
||||
// Reloads title-specific map files, patches, etc.
|
||||
static void OnTitleDirectlyBooted(const Core::CPUThreadGuard& guard);
|
||||
@@ -127,6 +140,7 @@ private:
|
||||
mutable std::recursive_mutex m_metadata_lock;
|
||||
|
||||
std::string m_game_id;
|
||||
std::string m_game_id_elf_dol;
|
||||
std::string m_gametdb_id;
|
||||
std::string m_title_name;
|
||||
std::string m_title_description;
|
||||
|
||||
Reference in new issue
Block a user