mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-09 06:03:32 +01: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
c1042976ba
commit
ee051da66d
@ -182,12 +182,19 @@ 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
|
||||
size_t estimate_start = file_path.find_last_of("\\/");
|
||||
size_t estimate_end = file_path.find_first_of('.');
|
||||
m_title_estimate = file_path.substr(estimate_start + 1, estimate_end - estimate_start - 1);
|
||||
#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};
|
||||
@ -1479,6 +1486,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;
|
||||
@ -1544,6 +1552,14 @@ void AchievementManager::MemoryPoker(u32 address, u8* buffer, u32 num_bytes, rc_
|
||||
PowerPC::RequestedAddressSpace::Physical);
|
||||
}
|
||||
}
|
||||
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(),
|
||||
std::min(instance.m_title_estimate.size(), static_cast<size_t>(buffer_size)));
|
||||
}
|
||||
#endif // RC_CLIENT_SUPPORTS_RAINTEGRATION
|
||||
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
|
@ -253,6 +253,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::function<void(void)> m_hardcore_callback;
|
||||
std::vector<u8> m_cloned_memory;
|
||||
std::string m_title_estimate;
|
||||
#endif // RC_CLIENT_SUPPORTS_RAINTEGRATION
|
||||
|
||||
Common::WorkQueueThread<std::function<void()>> m_queue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user