diff --git a/rpcs3/rpcs3qt/game_list_table.cpp b/rpcs3/rpcs3qt/game_list_table.cpp index c3069ef67e..a91141eb57 100644 --- a/rpcs3/rpcs3qt/game_list_table.cpp +++ b/rpcs3/rpcs3qt/game_list_table.cpp @@ -11,6 +11,8 @@ #include "Emu/vfs_config.h" #include "Utilities/StrUtil.h" +#include "Loader/ISO.h" + #include #include #include @@ -242,6 +244,12 @@ void game_list_table::populate( custom_table_widget_item* icon_item = new custom_table_widget_item; game->item = icon_item; + if (is_file_iso(game->info.path) && !game->info.movie_path.empty() + && !fs::exists(game->info.movie_path)) + { + icon_item->set_source_path(game->info.path); + } + icon_item->set_image_change_callback([this, icon_item, game](const QVideoFrame& frame) { if (!icon_item || !game) diff --git a/rpcs3/rpcs3qt/qt_video_source.cpp b/rpcs3/rpcs3qt/qt_video_source.cpp index 107e5ef850..81e6d98e55 100644 --- a/rpcs3/rpcs3qt/qt_video_source.cpp +++ b/rpcs3/rpcs3qt/qt_video_source.cpp @@ -2,6 +2,8 @@ #include "Emu/System.h" #include "qt_video_source.h" +#include "Loader/ISO.h" + #include qt_video_source::qt_video_source() @@ -19,6 +21,11 @@ void qt_video_source::set_video_path(const std::string& video_path) m_video_path = QString::fromStdString(video_path); } +void qt_video_source::set_source_path(const std::string& source_path) +{ + m_source_path = QString::fromStdString(source_path); +} + void qt_video_source::set_active(bool active) { if (m_active.exchange(active) == active) return; @@ -55,7 +62,7 @@ void qt_video_source::init_movie() return; } - if (!m_image_change_callback || m_video_path.isEmpty() || !QFile::exists(m_video_path)) + if (!m_image_change_callback || m_video_path.isEmpty() || (!QFile::exists(m_video_path) && m_source_path.isEmpty())) { m_video_path.clear(); return; @@ -65,8 +72,25 @@ void qt_video_source::init_movie() if (lower.endsWith(".gif")) { - m_movie = std::make_unique(m_video_path); - m_video_path.clear(); + if (m_source_path.isEmpty()) + { + m_movie = std::make_unique(m_video_path); + m_video_path.clear(); + } + else + { + iso_archive archive(m_source_path.toStdString()); + auto movie_file = archive.open(m_video_path.toStdString()); + auto movie_size = movie_file.size(); + m_video_data = QByteArray(movie_size, 0); + movie_file.read(m_video_data.data(), movie_size); + + QBuffer buffer(&m_video_data); + buffer.open(QIODevice::ReadOnly); + m_movie = std::make_unique(&buffer); + + m_video_path.clear(); + } if (!m_movie->isValid()) { @@ -85,17 +109,30 @@ void qt_video_source::init_movie() if (lower.endsWith(".pam")) { // We can't set PAM files as source of the video player, so we have to feed them as raw data. - QFile file(m_video_path); - if (!file.open(QFile::OpenModeFlag::ReadOnly)) + if (m_source_path.isEmpty()) { - return; - } + QFile file(m_video_path); + if (!file.open(QFile::OpenModeFlag::ReadOnly)) + { + return; + } - // TODO: Decode the pam properly before pushing it to the player - m_video_data = file.readAll(); - if (m_video_data.isEmpty()) + // TODO: Decode the pam properly before pushing it to the player + m_video_data = file.readAll(); + if (m_video_data.isEmpty()) + { + return; + } + } + else { - return; + auto source_path = m_source_path.toStdString(); + auto video_path = m_video_path.toStdString(); + iso_archive archive(source_path.c_str()); + auto movie_file = archive.open(video_path); + auto movie_size = movie_file.size(); + m_video_data = QByteArray(movie_size, 0); + movie_file.read(m_video_data.data(), movie_size); } m_video_buffer = std::make_unique(&m_video_data); diff --git a/rpcs3/rpcs3qt/qt_video_source.h b/rpcs3/rpcs3qt/qt_video_source.h index a2710eea33..1f195def02 100644 --- a/rpcs3/rpcs3qt/qt_video_source.h +++ b/rpcs3/rpcs3qt/qt_video_source.h @@ -17,6 +17,7 @@ public: qt_video_source(); virtual ~qt_video_source(); + void set_source_path(const std::string& source_path); void set_video_path(const std::string& video_path) override; const QString& video_path() const { return m_video_path; } @@ -43,6 +44,7 @@ protected: atomic_t m_has_new = false; QString m_video_path; + QString m_source_path; // path of the source archive QByteArray m_video_data{}; QImage m_image{}; std::vector m_image_path;