mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-01-12 19:50:23 +01:00
ISO: Move game image loading to game_list_base::IconLoadFunction
This commit is contained in:
parent
acdb0ee729
commit
27510f5fa8
|
|
@ -1,6 +1,8 @@
|
|||
#include "stdafx.h"
|
||||
#include "game_list_base.h"
|
||||
|
||||
#include "Loader/ISO.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QPainter>
|
||||
|
||||
|
|
@ -50,7 +52,20 @@ void game_list_base::IconLoadFunction(game_info game, qreal device_pixel_ratio,
|
|||
|
||||
if (game->icon.isNull() && (game->info.icon_path.empty() || !game->icon.load(QString::fromStdString(game->info.icon_path))))
|
||||
{
|
||||
if (game_list_log.warning)
|
||||
if (game->icon_in_archive)
|
||||
{
|
||||
iso_archive archive(game->info.path);
|
||||
auto icon_file = archive.open(game->info.icon_path);
|
||||
auto icon_size = icon_file.size();
|
||||
QByteArray data(icon_size, 0);
|
||||
icon_file.read(data.data(), icon_size);
|
||||
QImage iconImage;
|
||||
if (iconImage.loadFromData(data))
|
||||
{
|
||||
game->icon = QPixmap::fromImage(iconImage);
|
||||
}
|
||||
}
|
||||
else if (game_list_log.warning)
|
||||
{
|
||||
bool logged = false;
|
||||
{
|
||||
|
|
|
|||
|
|
@ -643,16 +643,7 @@ void game_list_frame::OnParsingFinished()
|
|||
{
|
||||
if (!archive->exists(game.info.icon_path)) return;
|
||||
|
||||
auto icon_file = archive->open(game.info.icon_path);
|
||||
auto icon_size = icon_file.size();
|
||||
QByteArray data(icon_size, 0);
|
||||
icon_file.read(data.data(), icon_size);
|
||||
QImage iconImage;
|
||||
if (iconImage.loadFromData(data))
|
||||
{
|
||||
game.icon = QPixmap::fromImage(iconImage);
|
||||
}
|
||||
game.info.icon_path.clear();
|
||||
game.icon_in_archive = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ struct gui_game_info
|
|||
bool has_custom_icon = false;
|
||||
bool has_hover_gif = false;
|
||||
bool has_hover_pam = false;
|
||||
bool icon_in_archive = false;
|
||||
movie_item_base* item = nullptr;
|
||||
|
||||
// Returns the visible version string in the game list
|
||||
|
|
|
|||
Loading…
Reference in a new issue