mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-20 03:24:59 +00:00
Added game title estimate for achievement development
If the development system is started for a game with an unrecognized hash, RA_Integration opens a dialog for connecting the hash with a title. That dialog is prepopulated by the results of GameTitleEstimateHandler.
This commit is contained in:
parent
ef612912a2
commit
b9a93794ff
2 changed files with 19 additions and 3 deletions
|
@ -22,6 +22,7 @@
|
|||
#include "Common/Image.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/ScopeGuard.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Common/Version.h"
|
||||
#include "Common/WorkQueueThread.h"
|
||||
#include "Core/ActionReplay.h"
|
||||
|
@ -180,12 +181,17 @@ void AchievementManager::LoadGame(const std::string& file_path, const DiscIO::Vo
|
|||
rc_client_set_unofficial_enabled(m_client, Config::Get(Config::RA_UNOFFICIAL_ENABLED));
|
||||
rc_client_set_encore_mode_enabled(m_client, Config::Get(Config::RA_ENCORE_ENABLED));
|
||||
rc_client_set_spectator_mode_enabled(m_client, Config::Get(Config::RA_SPECTATOR_ENABLED));
|
||||
if (volume)
|
||||
{
|
||||
std::lock_guard lg{m_lock};
|
||||
if (!m_loading_volume)
|
||||
#ifdef RC_CLIENT_SUPPORTS_RAINTEGRATION
|
||||
SplitPath(file_path, nullptr, &m_title_estimate, nullptr);
|
||||
#endif // RC_CLIENT_SUPPORTS_RAINTEGRATION
|
||||
if (volume)
|
||||
{
|
||||
m_loading_volume = DiscIO::CreateVolume(volume->GetBlobReader().CopyReader());
|
||||
if (!m_loading_volume)
|
||||
{
|
||||
m_loading_volume = DiscIO::CreateVolume(volume->GetBlobReader().CopyReader());
|
||||
}
|
||||
}
|
||||
}
|
||||
std::lock_guard lg{m_filereader_lock};
|
||||
|
@ -1494,6 +1500,7 @@ void AchievementManager::LoadIntegrationCallback(int result, const char* error_m
|
|||
instance.m_dll_found = true;
|
||||
rc_client_raintegration_set_event_handler(instance.m_client, RAIntegrationEventHandler);
|
||||
rc_client_raintegration_set_write_memory_function(instance.m_client, MemoryPoker);
|
||||
rc_client_raintegration_set_get_game_name_function(instance.m_client, GameTitleEstimateHandler);
|
||||
instance.m_dev_menu_callback();
|
||||
// TODO: hook up menu and dll event handlers
|
||||
break;
|
||||
|
@ -1565,6 +1572,13 @@ void AchievementManager::MemoryPoker(u32 address, u8* buffer, u32 num_bytes, rc_
|
|||
system->GetMemory().CopyToEmu(address, buffer, num_bytes);
|
||||
std::copy(buffer, buffer + num_bytes, instance.m_cloned_memory.begin() + address);
|
||||
}
|
||||
void AchievementManager::GameTitleEstimateHandler(char* buffer, u32 buffer_size,
|
||||
rc_client_t* client)
|
||||
{
|
||||
auto& instance = AchievementManager::GetInstance();
|
||||
std::lock_guard lg{instance.m_lock};
|
||||
strncpy(buffer, instance.m_title_estimate.c_str(), static_cast<size_t>(buffer_size));
|
||||
}
|
||||
#endif // RC_CLIENT_SUPPORTS_RAINTEGRATION
|
||||
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
|
|
|
@ -254,6 +254,7 @@ private:
|
|||
static void RAIntegrationEventHandler(const rc_client_raintegration_event_t* event,
|
||||
rc_client_t* client);
|
||||
static void MemoryPoker(u32 address, u8* buffer, u32 num_bytes, rc_client_t* client);
|
||||
static void GameTitleEstimateHandler(char* buffer, u32 buffer_size, rc_client_t* client);
|
||||
#endif // RC_CLIENT_SUPPORTS_RAINTEGRATION
|
||||
|
||||
rc_runtime_t m_runtime{};
|
||||
|
@ -292,6 +293,7 @@ private:
|
|||
std::function<void(void)> m_dev_menu_callback;
|
||||
std::vector<u8> m_cloned_memory;
|
||||
std::recursive_mutex m_memory_lock;
|
||||
std::string m_title_estimate;
|
||||
#endif // RC_CLIENT_SUPPORTS_RAINTEGRATION
|
||||
|
||||
Common::WorkQueueThread<std::function<void()>> m_queue;
|
||||
|
|
Loading…
Add table
Reference in a new issue