diff --git a/src/duckstation-qt/gamelistsettingswidget.cpp b/src/duckstation-qt/gamelistsettingswidget.cpp index f29d1ea30..5c775ebb6 100644 --- a/src/duckstation-qt/gamelistsettingswidget.cpp +++ b/src/duckstation-qt/gamelistsettingswidget.cpp @@ -145,11 +145,8 @@ void GameListSettingsWidget::onUpdateRedumpDatabaseButtonClicked() return; } - if (downloadRedumpDatabase( - m_host_interface->getUserDirectoryRelativePath("database" FS_OSPATH_SEPARATOR_STR "redump.dat"))) - { + if (downloadRedumpDatabase(m_host_interface->getUserDirectoryRelativePath("redump.dat"))) m_host_interface->refreshGameList(true, true); - } } static bool ExtractRedumpDatabase(const QByteArray& data, const QString& destination_path) diff --git a/src/frontend-common/common_host_interface.cpp b/src/frontend-common/common_host_interface.cpp index 0b9170174..aa94d61c5 100644 --- a/src/frontend-common/common_host_interface.cpp +++ b/src/frontend-common/common_host_interface.cpp @@ -70,7 +70,8 @@ bool CommonHostInterface::Initialize() m_game_list = std::make_unique(); 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_save_state_selector_ui = std::make_unique(this); diff --git a/src/frontend-common/game_list.cpp b/src/frontend-common/game_list.cpp index 1a22741e8..7ddbb69a3 100644 --- a/src/frontend-common/game_list.cpp +++ b/src/frontend-common/game_list.cpp @@ -737,6 +737,22 @@ void GameList::LoadDatabase() m_database_load_tried = true; tinyxml2::XMLDocument doc; + if (FileSystem::FileExists(m_user_database_filename.c_str())) + { + std::unique_ptr 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 stream = g_host_interface->OpenPackageFile( "database" FS_OSPATH_SEPARATOR_STR "redump.dat", BYTESTREAM_OPEN_READ | BYTESTREAM_OPEN_STREAMED); diff --git a/src/frontend-common/game_list.h b/src/frontend-common/game_list.h index d5f9fed8f..858a618f3 100644 --- a/src/frontend-common/game_list.h +++ b/src/frontend-common/game_list.h @@ -85,6 +85,7 @@ public: const GameListCompatibilityEntry* GetCompatibilityEntryForCode(const std::string& code) const; 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 SetUserGameSettingsFilename(std::string filename) { m_user_game_settings_filename = std::move(filename); } void SetSearchDirectoriesFromSettings(SettingsInterface& si); @@ -159,6 +160,7 @@ private: std::vector m_search_directories; std::string m_cache_filename; + std::string m_user_database_filename; std::string m_user_compatibility_list_filename; std::string m_user_game_settings_filename; bool m_database_load_tried = false;