Qt: Fix manual redump database downloading/updating
This commit is contained in:
parent
a75b6e512a
commit
16a6c1706e
|
@ -145,11 +145,8 @@ void GameListSettingsWidget::onUpdateRedumpDatabaseButtonClicked()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (downloadRedumpDatabase(
|
if (downloadRedumpDatabase(m_host_interface->getUserDirectoryRelativePath("redump.dat")))
|
||||||
m_host_interface->getUserDirectoryRelativePath("database" FS_OSPATH_SEPARATOR_STR "redump.dat")))
|
|
||||||
{
|
|
||||||
m_host_interface->refreshGameList(true, true);
|
m_host_interface->refreshGameList(true, true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ExtractRedumpDatabase(const QByteArray& data, const QString& destination_path)
|
static bool ExtractRedumpDatabase(const QByteArray& data, const QString& destination_path)
|
||||||
|
|
|
@ -70,7 +70,8 @@ bool CommonHostInterface::Initialize()
|
||||||
|
|
||||||
m_game_list = std::make_unique<GameList>();
|
m_game_list = std::make_unique<GameList>();
|
||||||
m_game_list->SetCacheFilename(GetUserDirectoryRelativePath("cache/gamelist.cache"));
|
m_game_list->SetCacheFilename(GetUserDirectoryRelativePath("cache/gamelist.cache"));
|
||||||
m_game_list->SetUserCompatibilityListFilename(GetProgramDirectoryRelativePath("compatibility.xml"));
|
m_game_list->SetUserDatabaseFilename(GetUserDirectoryRelativePath("redump.dat"));
|
||||||
|
m_game_list->SetUserCompatibilityListFilename(GetUserDirectoryRelativePath("compatibility.xml"));
|
||||||
m_game_list->SetUserGameSettingsFilename(GetUserDirectoryRelativePath("gamesettings.ini"));
|
m_game_list->SetUserGameSettingsFilename(GetUserDirectoryRelativePath("gamesettings.ini"));
|
||||||
|
|
||||||
m_save_state_selector_ui = std::make_unique<FrontendCommon::SaveStateSelectorUI>(this);
|
m_save_state_selector_ui = std::make_unique<FrontendCommon::SaveStateSelectorUI>(this);
|
||||||
|
|
|
@ -737,6 +737,22 @@ void GameList::LoadDatabase()
|
||||||
m_database_load_tried = true;
|
m_database_load_tried = true;
|
||||||
|
|
||||||
tinyxml2::XMLDocument doc;
|
tinyxml2::XMLDocument doc;
|
||||||
|
if (FileSystem::FileExists(m_user_database_filename.c_str()))
|
||||||
|
{
|
||||||
|
std::unique_ptr<ByteStream> stream =
|
||||||
|
FileSystem::OpenFile(m_user_database_filename.c_str(), BYTESTREAM_OPEN_READ | BYTESTREAM_OPEN_STREAMED);
|
||||||
|
if (stream)
|
||||||
|
{
|
||||||
|
const std::string xml(FileSystem::ReadStreamToString(stream.get()));
|
||||||
|
tinyxml2::XMLError error = doc.Parse(xml.data(), xml.size());
|
||||||
|
if (error != tinyxml2::XML_SUCCESS)
|
||||||
|
{
|
||||||
|
Log_ErrorPrintf("Failed to parse redump dat: %s", tinyxml2::XMLDocument::ErrorIDToName(error));
|
||||||
|
doc.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!doc.RootElement())
|
||||||
{
|
{
|
||||||
std::unique_ptr<ByteStream> stream = g_host_interface->OpenPackageFile(
|
std::unique_ptr<ByteStream> stream = g_host_interface->OpenPackageFile(
|
||||||
"database" FS_OSPATH_SEPARATOR_STR "redump.dat", BYTESTREAM_OPEN_READ | BYTESTREAM_OPEN_STREAMED);
|
"database" FS_OSPATH_SEPARATOR_STR "redump.dat", BYTESTREAM_OPEN_READ | BYTESTREAM_OPEN_STREAMED);
|
||||||
|
|
|
@ -85,6 +85,7 @@ public:
|
||||||
const GameListCompatibilityEntry* GetCompatibilityEntryForCode(const std::string& code) const;
|
const GameListCompatibilityEntry* GetCompatibilityEntryForCode(const std::string& code) const;
|
||||||
|
|
||||||
void SetCacheFilename(std::string filename) { m_cache_filename = std::move(filename); }
|
void SetCacheFilename(std::string filename) { m_cache_filename = std::move(filename); }
|
||||||
|
void SetUserDatabaseFilename(std::string filename) { m_user_database_filename = std::move(filename); }
|
||||||
void SetUserCompatibilityListFilename(std::string filename) { m_user_compatibility_list_filename = std::move(filename); }
|
void SetUserCompatibilityListFilename(std::string filename) { m_user_compatibility_list_filename = std::move(filename); }
|
||||||
void SetUserGameSettingsFilename(std::string filename) { m_user_game_settings_filename = std::move(filename); }
|
void SetUserGameSettingsFilename(std::string filename) { m_user_game_settings_filename = std::move(filename); }
|
||||||
void SetSearchDirectoriesFromSettings(SettingsInterface& si);
|
void SetSearchDirectoriesFromSettings(SettingsInterface& si);
|
||||||
|
@ -159,6 +160,7 @@ private:
|
||||||
|
|
||||||
std::vector<DirectoryEntry> m_search_directories;
|
std::vector<DirectoryEntry> m_search_directories;
|
||||||
std::string m_cache_filename;
|
std::string m_cache_filename;
|
||||||
|
std::string m_user_database_filename;
|
||||||
std::string m_user_compatibility_list_filename;
|
std::string m_user_compatibility_list_filename;
|
||||||
std::string m_user_game_settings_filename;
|
std::string m_user_game_settings_filename;
|
||||||
bool m_database_load_tried = false;
|
bool m_database_load_tried = false;
|
||||||
|
|
Loading…
Reference in New Issue