mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 13:31:27 +12:00
Qt/patches: move game list loop to patch manager
This deduplicates some code
This commit is contained in:
parent
1920aee415
commit
d034f6a77f
12 changed files with 99 additions and 94 deletions
|
@ -757,6 +757,7 @@
|
||||||
<ClCompile Include="rpcs3qt\breakpoint_list.cpp" />
|
<ClCompile Include="rpcs3qt\breakpoint_list.cpp" />
|
||||||
<ClCompile Include="rpcs3qt\call_stack_list.cpp" />
|
<ClCompile Include="rpcs3qt\call_stack_list.cpp" />
|
||||||
<ClCompile Include="rpcs3qt\camera_settings_dialog.cpp" />
|
<ClCompile Include="rpcs3qt\camera_settings_dialog.cpp" />
|
||||||
|
<ClCompile Include="rpcs3qt\gui_game_info.cpp" />
|
||||||
<ClCompile Include="rpcs3qt\permissions.cpp" />
|
<ClCompile Include="rpcs3qt\permissions.cpp" />
|
||||||
<ClCompile Include="rpcs3qt\ps_move_tracker_dialog.cpp" />
|
<ClCompile Include="rpcs3qt\ps_move_tracker_dialog.cpp" />
|
||||||
<ClCompile Include="rpcs3qt\cheat_manager.cpp" />
|
<ClCompile Include="rpcs3qt\cheat_manager.cpp" />
|
||||||
|
@ -1368,6 +1369,7 @@
|
||||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
|
||||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DWIN32_LEAN_AND_MEAN -DHAVE_VULKAN -DMINIUPNP_STATICLIB -DHAVE_SDL2 -DWITH_DISCORD_RPC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -DQT_WINEXTRAS_LIB -DQT_CONCURRENT_LIB -DQT_MULTIMEDIA_LIB -DQT_MULTIMEDIAWIDGETS_LIB -DQT_SVG_LIB -D%(PreprocessorDefinitions) "-I.\..\3rdparty\SoundTouch\soundtouch\include" "-I.\..\3rdparty\cubeb\extra" "-I.\..\3rdparty\cubeb\cubeb\include" "-I.\..\3rdparty\flatbuffers\include" "-I.\..\3rdparty\wolfssl\wolfssl" "-I.\..\3rdparty\curl\curl\include" "-I.\..\3rdparty\libusb\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I.\..\3rdparty\libsdl-org\SDL\include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtCore" "-I.\release" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtMultimedia" "-I$(QTDIR)\include\QtMultimediaWidgets" "-I$(QTDIR)\include\QtSvg"</Command>
|
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DWIN32_LEAN_AND_MEAN -DHAVE_VULKAN -DMINIUPNP_STATICLIB -DHAVE_SDL2 -DWITH_DISCORD_RPC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -DQT_WINEXTRAS_LIB -DQT_CONCURRENT_LIB -DQT_MULTIMEDIA_LIB -DQT_MULTIMEDIAWIDGETS_LIB -DQT_SVG_LIB -D%(PreprocessorDefinitions) "-I.\..\3rdparty\SoundTouch\soundtouch\include" "-I.\..\3rdparty\cubeb\extra" "-I.\..\3rdparty\cubeb\cubeb\include" "-I.\..\3rdparty\flatbuffers\include" "-I.\..\3rdparty\wolfssl\wolfssl" "-I.\..\3rdparty\curl\curl\include" "-I.\..\3rdparty\libusb\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I.\..\3rdparty\libsdl-org\SDL\include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtCore" "-I.\release" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtMultimedia" "-I$(QTDIR)\include\QtMultimediaWidgets" "-I$(QTDIR)\include\QtSvg"</Command>
|
||||||
</CustomBuild>
|
</CustomBuild>
|
||||||
|
<ClInclude Include="rpcs3qt\gui_game_info.h" />
|
||||||
<ClInclude Include="rpcs3qt\gui_save.h" />
|
<ClInclude Include="rpcs3qt\gui_save.h" />
|
||||||
<CustomBuild Include="rpcs3qt\patch_manager_dialog.h">
|
<CustomBuild Include="rpcs3qt\patch_manager_dialog.h">
|
||||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
||||||
|
|
|
@ -1164,6 +1164,9 @@
|
||||||
<ClCompile Include="rpcs3qt\permissions.cpp">
|
<ClCompile Include="rpcs3qt\permissions.cpp">
|
||||||
<Filter>Gui\utils</Filter>
|
<Filter>Gui\utils</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="rpcs3qt\gui_game_info.cpp">
|
||||||
|
<Filter>Gui\game list</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="Input\ds4_pad_handler.h">
|
<ClInclude Include="Input\ds4_pad_handler.h">
|
||||||
|
@ -1370,6 +1373,9 @@
|
||||||
<ClInclude Include="rpcs3qt\permissions.h">
|
<ClInclude Include="rpcs3qt\permissions.h">
|
||||||
<Filter>Gui\utils</Filter>
|
<Filter>Gui\utils</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="rpcs3qt\gui_game_info.h">
|
||||||
|
<Filter>Gui\game list</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CustomBuild Include="debug\moc_predefs.h.cbt">
|
<CustomBuild Include="debug\moc_predefs.h.cbt">
|
||||||
|
|
|
@ -37,6 +37,7 @@ add_library(rpcs3_ui STATIC
|
||||||
gui_application.cpp
|
gui_application.cpp
|
||||||
gl_gs_frame.cpp
|
gl_gs_frame.cpp
|
||||||
gs_frame.cpp
|
gs_frame.cpp
|
||||||
|
gui_game_info.cpp
|
||||||
gui_settings.cpp
|
gui_settings.cpp
|
||||||
infinity_dialog.cpp
|
infinity_dialog.cpp
|
||||||
input_dialog.cpp
|
input_dialog.cpp
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "game_list_base.h"
|
#include "game_list_base.h"
|
||||||
#include "localized.h"
|
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
@ -189,17 +188,6 @@ QColor game_list_base::GetGridCompatibilityColor(const QString& string) const
|
||||||
return QColor();
|
return QColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string game_list_base::GetGameVersion(const game_info& game)
|
|
||||||
{
|
|
||||||
if (game->info.app_ver == Localized().category.unknown.toStdString())
|
|
||||||
{
|
|
||||||
// Fall back to Disc/Pkg Revision
|
|
||||||
return game->info.version;
|
|
||||||
}
|
|
||||||
|
|
||||||
return game->info.app_ver;
|
|
||||||
}
|
|
||||||
|
|
||||||
QIcon game_list_base::GetCustomConfigIcon(const game_info& game)
|
QIcon game_list_base::GetCustomConfigIcon(const game_info& game)
|
||||||
{
|
{
|
||||||
if (!game)
|
if (!game)
|
||||||
|
|
|
@ -1,31 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "movie_item_base.h"
|
#include "gui_game_info.h"
|
||||||
#include "game_compatibility.h"
|
|
||||||
#include "Emu/GameInfo.h"
|
|
||||||
|
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QPixmap>
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
/* Having the icons associated with the game info simplifies logic internally */
|
|
||||||
struct gui_game_info
|
|
||||||
{
|
|
||||||
GameInfo info{};
|
|
||||||
QString localized_category;
|
|
||||||
compat::status compat;
|
|
||||||
QPixmap icon;
|
|
||||||
QPixmap pxmap;
|
|
||||||
bool hasCustomConfig = false;
|
|
||||||
bool hasCustomPadConfig = false;
|
|
||||||
bool has_hover_gif = false;
|
|
||||||
bool has_hover_pam = false;
|
|
||||||
movie_item_base* item = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef std::shared_ptr<gui_game_info> game_info;
|
|
||||||
Q_DECLARE_METATYPE(game_info)
|
|
||||||
|
|
||||||
class game_list_base
|
class game_list_base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -45,9 +24,6 @@ public:
|
||||||
|
|
||||||
virtual void repaint_icons(std::vector<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio);
|
virtual void repaint_icons(std::vector<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio);
|
||||||
|
|
||||||
// Returns the visible version string in the game list
|
|
||||||
static std::string GetGameVersion(const game_info& game);
|
|
||||||
|
|
||||||
/** Sets the custom config icon. */
|
/** Sets the custom config icon. */
|
||||||
static QIcon GetCustomConfigIcon(const game_info& game);
|
static QIcon GetCustomConfigIcon(const game_info& game);
|
||||||
|
|
||||||
|
|
|
@ -839,10 +839,10 @@ void game_list_frame::OnRefreshFinished()
|
||||||
const std::string cat_unknown_localized = localized.category.unknown.toStdString();
|
const std::string cat_unknown_localized = localized.category.unknown.toStdString();
|
||||||
|
|
||||||
// Try to update the app version for disc games if there is a patch
|
// Try to update the app version for disc games if there is a patch
|
||||||
for (const auto& entry : m_game_data)
|
for (const game_info& entry : m_game_data)
|
||||||
{
|
|
||||||
if (entry->info.category == "DG")
|
|
||||||
{
|
{
|
||||||
|
if (entry->info.category != "DG") continue;
|
||||||
|
|
||||||
for (const auto& other : m_game_data)
|
for (const auto& other : m_game_data)
|
||||||
{
|
{
|
||||||
// The patch is game data and must have the same serial and an app version
|
// The patch is game data and must have the same serial and an app version
|
||||||
|
@ -881,7 +881,6 @@ void game_list_frame::OnRefreshFinished()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Sort by name at the very least.
|
// Sort by name at the very least.
|
||||||
std::sort(m_game_data.begin(), m_game_data.end(), [&](const game_info& game1, const game_info& game2)
|
std::sort(m_game_data.begin(), m_game_data.end(), [&](const game_info& game1, const game_info& game2)
|
||||||
|
@ -1873,15 +1872,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
|
||||||
});
|
});
|
||||||
connect(configure_patches, &QAction::triggered, this, [this, gameinfo]()
|
connect(configure_patches, &QAction::triggered, this, [this, gameinfo]()
|
||||||
{
|
{
|
||||||
std::unordered_map<std::string, std::set<std::string>> games;
|
patch_manager_dialog patch_manager(m_gui_settings, m_game_data, gameinfo->info.serial, gameinfo->GetGameVersion(), this);
|
||||||
for (const auto& game : m_game_data)
|
|
||||||
{
|
|
||||||
if (game)
|
|
||||||
{
|
|
||||||
games[game->info.serial].insert(game_list::GetGameVersion(game));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
patch_manager_dialog patch_manager(m_gui_settings, games, gameinfo->info.serial, game_list::GetGameVersion(gameinfo), this);
|
|
||||||
patch_manager.exec();
|
patch_manager.exec();
|
||||||
});
|
});
|
||||||
connect(check_compat, &QAction::triggered, this, [serial]
|
connect(check_compat, &QAction::triggered, this, [serial]
|
||||||
|
|
|
@ -332,7 +332,7 @@ void game_list_table::populate(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Version
|
// Version
|
||||||
QString app_version = QString::fromStdString(game_list::GetGameVersion(game));
|
QString app_version = QString::fromStdString(game->GetGameVersion());
|
||||||
|
|
||||||
if (game->info.bootable && !game->compat.latest_version.isEmpty())
|
if (game->info.bootable && !game->compat.latest_version.isEmpty())
|
||||||
{
|
{
|
||||||
|
|
14
rpcs3/rpcs3qt/gui_game_info.cpp
Normal file
14
rpcs3/rpcs3qt/gui_game_info.cpp
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "gui_game_info.h"
|
||||||
|
#include "localized.h"
|
||||||
|
|
||||||
|
std::string gui_game_info::GetGameVersion() const
|
||||||
|
{
|
||||||
|
if (info.app_ver == Localized().category.unknown.toStdString())
|
||||||
|
{
|
||||||
|
// Fall back to Disc/Pkg Revision
|
||||||
|
return info.version;
|
||||||
|
}
|
||||||
|
|
||||||
|
return info.app_ver;
|
||||||
|
}
|
29
rpcs3/rpcs3qt/gui_game_info.h
Normal file
29
rpcs3/rpcs3qt/gui_game_info.h
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "movie_item_base.h"
|
||||||
|
#include "game_compatibility.h"
|
||||||
|
|
||||||
|
#include "Emu/GameInfo.h"
|
||||||
|
|
||||||
|
#include <QPixmap>
|
||||||
|
|
||||||
|
/* Having the icons associated with the game info simplifies logic internally */
|
||||||
|
struct gui_game_info
|
||||||
|
{
|
||||||
|
GameInfo info{};
|
||||||
|
QString localized_category;
|
||||||
|
compat::status compat;
|
||||||
|
QPixmap icon;
|
||||||
|
QPixmap pxmap;
|
||||||
|
bool hasCustomConfig = false;
|
||||||
|
bool hasCustomPadConfig = false;
|
||||||
|
bool has_hover_gif = false;
|
||||||
|
bool has_hover_pam = false;
|
||||||
|
movie_item_base* item = nullptr;
|
||||||
|
|
||||||
|
// Returns the visible version string in the game list
|
||||||
|
std::string GetGameVersion() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::shared_ptr<gui_game_info> game_info;
|
||||||
|
Q_DECLARE_METATYPE(game_info)
|
|
@ -3070,18 +3070,7 @@ void main_window::CreateConnects()
|
||||||
|
|
||||||
connect(ui->actionManage_Game_Patches, &QAction::triggered, this, [this]
|
connect(ui->actionManage_Game_Patches, &QAction::triggered, this, [this]
|
||||||
{
|
{
|
||||||
std::unordered_map<std::string, std::set<std::string>> games;
|
patch_manager_dialog patch_manager(m_gui_settings, m_game_list_frame ? m_game_list_frame->GetGameInfo() : std::vector<game_info>{}, "", "", this);
|
||||||
if (m_game_list_frame)
|
|
||||||
{
|
|
||||||
for (const game_info& game : m_game_list_frame->GetGameInfo())
|
|
||||||
{
|
|
||||||
if (game)
|
|
||||||
{
|
|
||||||
games[game->info.serial].insert(game_list::GetGameVersion(game));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
patch_manager_dialog patch_manager(m_gui_settings, games, "", "", this);
|
|
||||||
patch_manager.exec();
|
patch_manager.exec();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -57,12 +57,11 @@ enum node_level : int
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(patch_engine::patch_config_value);
|
Q_DECLARE_METATYPE(patch_engine::patch_config_value);
|
||||||
|
|
||||||
patch_manager_dialog::patch_manager_dialog(std::shared_ptr<gui_settings> gui_settings, std::unordered_map<std::string, std::set<std::string>> games, const std::string& title_id, const std::string& version, QWidget* parent)
|
patch_manager_dialog::patch_manager_dialog(std::shared_ptr<gui_settings> gui_settings, const std::vector<game_info>& games, const std::string& title_id, const std::string& version, QWidget* parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
, m_gui_settings(std::move(gui_settings))
|
, m_gui_settings(std::move(gui_settings))
|
||||||
, m_expand_current_match(!title_id.empty() && !version.empty()) // Expand first search results
|
, m_expand_current_match(!title_id.empty() && !version.empty()) // Expand first search results
|
||||||
, m_search_version(QString::fromStdString(version))
|
, m_search_version(QString::fromStdString(version))
|
||||||
, m_owned_games(std::move(games))
|
|
||||||
, ui(new Ui::patch_manager_dialog)
|
, ui(new Ui::patch_manager_dialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -71,6 +70,15 @@ patch_manager_dialog::patch_manager_dialog(std::shared_ptr<gui_settings> gui_set
|
||||||
// Load gui settings
|
// Load gui settings
|
||||||
m_show_owned_games_only = m_gui_settings->GetValue(gui::pm_show_owned).toBool();
|
m_show_owned_games_only = m_gui_settings->GetValue(gui::pm_show_owned).toBool();
|
||||||
|
|
||||||
|
// Get owned games
|
||||||
|
for (const auto& game : games)
|
||||||
|
{
|
||||||
|
if (game)
|
||||||
|
{
|
||||||
|
m_owned_games[game->info.serial].insert(game->GetGameVersion());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize gui controls
|
// Initialize gui controls
|
||||||
ui->patch_filter->setText(QString::fromStdString(title_id));
|
ui->patch_filter->setText(QString::fromStdString(title_id));
|
||||||
ui->cb_owned_games_only->setChecked(m_show_owned_games_only);
|
ui->cb_owned_games_only->setChecked(m_show_owned_games_only);
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <QDragMoveEvent>
|
#include <QDragMoveEvent>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
|
|
||||||
|
#include "gui_game_info.h"
|
||||||
#include "Utilities/bin_patch.h"
|
#include "Utilities/bin_patch.h"
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@ class patch_manager_dialog : public QDialog
|
||||||
const QString tr_all_versions = tr("All versions");
|
const QString tr_all_versions = tr("All versions");
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit patch_manager_dialog(std::shared_ptr<gui_settings> gui_settings, std::unordered_map<std::string, std::set<std::string>> games, const std::string& title_id, const std::string& version, QWidget* parent = nullptr);
|
explicit patch_manager_dialog(std::shared_ptr<gui_settings> gui_settings, const std::vector<game_info>& games, const std::string& title_id, const std::string& version, QWidget* parent = nullptr);
|
||||||
~patch_manager_dialog();
|
~patch_manager_dialog();
|
||||||
|
|
||||||
int exec() override;
|
int exec() override;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue