mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-25 15:19:42 -06:00
Merge pull request #9078 from JosJuice/android-metadata-from-core
Android: Get game metadata from core
This commit is contained in:
@ -583,6 +583,11 @@ if (APPLE)
|
||||
${IOB_LIBRARY}
|
||||
${IOK_LIBRARY}
|
||||
)
|
||||
elseif (ANDROID)
|
||||
target_link_libraries(core
|
||||
PRIVATE
|
||||
androidcommon
|
||||
)
|
||||
endif()
|
||||
|
||||
if(LIBUSB_FOUND)
|
||||
|
@ -681,12 +681,14 @@ void SConfig::SetRunningGameMetadata(const std::string& game_id, const std::stri
|
||||
|
||||
if (game_id == "00000000")
|
||||
{
|
||||
m_title_name.clear();
|
||||
m_title_description.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
const Core::TitleDatabase title_database;
|
||||
const DiscIO::Language language = GetLanguageAdjustedForRegion(bWii, region);
|
||||
m_title_name = title_database.GetTitleName(m_gametdb_id, language);
|
||||
m_title_description = title_database.Describe(m_gametdb_id, language);
|
||||
NOTICE_LOG(CORE, "Active title: %s", m_title_description.c_str());
|
||||
Host_TitleChanged();
|
||||
@ -819,10 +821,10 @@ struct SetGameMetadata
|
||||
SetGameMetadata(SConfig* config_, DiscIO::Region* region_) : config(config_), region(region_) {}
|
||||
bool operator()(const BootParameters::Disc& disc) const
|
||||
{
|
||||
config->SetRunningGameMetadata(*disc.volume, disc.volume->GetGamePartition());
|
||||
*region = disc.volume->GetRegion();
|
||||
config->bWii = disc.volume->GetVolumeType() == DiscIO::Platform::WiiDisc;
|
||||
config->m_disc_booted_from_game_list = true;
|
||||
*region = disc.volume->GetRegion();
|
||||
config->SetRunningGameMetadata(*disc.volume, disc.volume->GetGamePartition());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -831,12 +833,14 @@ struct SetGameMetadata
|
||||
if (!executable.reader->IsValid())
|
||||
return false;
|
||||
|
||||
config->bWii = executable.reader->IsWii();
|
||||
|
||||
*region = DiscIO::Region::Unknown;
|
||||
config->bWii = executable.reader->IsWii();
|
||||
|
||||
// Strip the .elf/.dol file extension and directories before the name
|
||||
SplitPath(executable.path, nullptr, &config->m_debugger_game_id, nullptr);
|
||||
|
||||
Host_TitleChanged();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -854,9 +858,10 @@ struct SetGameMetadata
|
||||
}
|
||||
|
||||
const IOS::ES::TMDReader& tmd = wad.GetTMD();
|
||||
config->SetRunningGameMetadata(tmd, DiscIO::Platform::WiiWAD);
|
||||
config->bWii = true;
|
||||
*region = tmd.GetRegion();
|
||||
config->bWii = true;
|
||||
config->SetRunningGameMetadata(tmd, DiscIO::Platform::WiiWAD);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -869,16 +874,20 @@ struct SetGameMetadata
|
||||
PanicAlertT("This title cannot be booted.");
|
||||
return false;
|
||||
}
|
||||
config->SetRunningGameMetadata(tmd, DiscIO::Platform::WiiWAD);
|
||||
config->bWii = true;
|
||||
|
||||
*region = tmd.GetRegion();
|
||||
config->bWii = true;
|
||||
config->SetRunningGameMetadata(tmd, DiscIO::Platform::WiiWAD);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool operator()(const BootParameters::IPL& ipl) const
|
||||
{
|
||||
config->bWii = false;
|
||||
*region = ipl.region;
|
||||
config->bWii = false;
|
||||
Host_TitleChanged();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -888,8 +897,10 @@ struct SetGameMetadata
|
||||
if (!dff_file)
|
||||
return false;
|
||||
|
||||
config->bWii = dff_file->GetIsWii();
|
||||
*region = DiscIO::Region::NTSC_U;
|
||||
config->bWii = dff_file->GetIsWii();
|
||||
Host_TitleChanged();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -188,6 +188,7 @@ struct SConfig
|
||||
bool m_disc_booted_from_game_list = false;
|
||||
|
||||
const std::string& GetGameID() const { return m_game_id; }
|
||||
const std::string& GetTitleName() const { return m_title_name; }
|
||||
const std::string& GetTitleDescription() const { return m_title_description; }
|
||||
u64 GetTitleID() const { return m_title_id; }
|
||||
u16 GetRevision() const { return m_revision; }
|
||||
@ -360,6 +361,7 @@ private:
|
||||
|
||||
std::string m_game_id;
|
||||
std::string m_gametdb_id;
|
||||
std::string m_title_name;
|
||||
std::string m_title_description;
|
||||
u64 m_title_id;
|
||||
u16 m_revision;
|
||||
|
@ -85,6 +85,10 @@
|
||||
#include "VideoCommon/VideoBackendBase.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
#include "jni/AndroidCommon/IDCache.h"
|
||||
#endif
|
||||
|
||||
namespace Core
|
||||
{
|
||||
static bool s_wants_determinism;
|
||||
@ -335,6 +339,12 @@ static void CpuThread(const std::optional<std::string>& savestate_path, bool del
|
||||
// This needs to be delayed until after the video backend is ready.
|
||||
DolphinAnalytics::Instance().ReportGameStart();
|
||||
|
||||
#ifdef ANDROID
|
||||
// For some reason, calling the JNI function AttachCurrentThread from the CPU thread after a
|
||||
// certain point causes a crash if fastmem is enabled. Let's call it early to avoid that problem.
|
||||
static_cast<void>(IDCache::GetEnvForThread());
|
||||
#endif
|
||||
|
||||
if (_CoreParameter.bFastmem)
|
||||
EMM::InstallExceptionHandler(); // Let's run under memory watch
|
||||
|
||||
|
Reference in New Issue
Block a user