mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Unify ISOFile (wx) with GameFile (Qt) and put it in UICommon
The original reason I wanted to do this was so that we can replace the Android-specific code with this in the future, but of course, just deduplicating between DolphinWX and DolphinQt2 is nice too. Fixes: - DolphinQt2 showing the wrong size for split WBFS disc images. - DolphinQt2 being case sensitive when checking if a file is a DOL/ELF. - DolphinQt2 not detecting when a Wii banner has become available after the game list cache was created. Removes: - DolphinWX's ability to load PNGs as custom banners. But it was already rather broken (see https://bugs.dolphin-emu.org/issues/10365 and https://bugs.dolphin-emu.org/issues/10366). The reason I removed this was because PNG decoding relied on wx code and we don't have any good non-wx/Qt code for loading PNG files right now (let's not use SOIL), but we should be able to use libpng directly to implement PNG loading in the future. - DolphinQt2's ability to ignore a cached game if the last modified time differs. We currently don't have a non-wx/Qt way to get the time.
This commit is contained in:
@@ -160,6 +160,28 @@ bool InstallWAD(const std::string& wad_path)
|
|||||||
return InstallWAD(ios, DiscIO::WiiWAD{wad_path}, InstallType::Permanent);
|
return InstallWAD(ios, DiscIO::WiiWAD{wad_path}, InstallType::Permanent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UninstallTitle(u64 title_id)
|
||||||
|
{
|
||||||
|
IOS::HLE::Kernel ios;
|
||||||
|
return ios.GetES()->DeleteTitleContent(title_id) == IOS::HLE::IPC_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsTitleInstalled(u64 title_id)
|
||||||
|
{
|
||||||
|
const std::string content_dir =
|
||||||
|
Common::GetTitleContentPath(title_id, Common::FromWhichRoot::FROM_CONFIGURED_ROOT);
|
||||||
|
|
||||||
|
if (!File::IsDirectory(content_dir))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Since this isn't IOS and we only need a simple way to figure out if a title is installed,
|
||||||
|
// we make the (reasonable) assumption that having more than just the TMD in the content
|
||||||
|
// directory means that the title is installed.
|
||||||
|
const auto entries = File::ScanDirectoryTree(content_dir, false);
|
||||||
|
return std::any_of(entries.children.begin(), entries.children.end(),
|
||||||
|
[](const auto& file) { return file.virtualName != "title.tmd"; });
|
||||||
|
}
|
||||||
|
|
||||||
// Common functionality for system updaters.
|
// Common functionality for system updaters.
|
||||||
class SystemUpdater
|
class SystemUpdater
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,6 +38,10 @@ bool InstallWAD(IOS::HLE::Kernel& ios, const DiscIO::WiiWAD& wad, InstallType ty
|
|||||||
// and does a permanent install.
|
// and does a permanent install.
|
||||||
bool InstallWAD(const std::string& wad_path);
|
bool InstallWAD(const std::string& wad_path);
|
||||||
|
|
||||||
|
bool UninstallTitle(u64 title_id);
|
||||||
|
|
||||||
|
bool IsTitleInstalled(u64 title_id);
|
||||||
|
|
||||||
enum class UpdateResult
|
enum class UpdateResult
|
||||||
{
|
{
|
||||||
Succeeded,
|
Succeeded,
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
// Increment CACHE_REVISION (GameListCtrl.cpp) if the enum below is modified
|
// Increment CACHE_REVISION (GameFileCache.cpp) if the enum below is modified
|
||||||
enum class BlobType
|
enum class BlobType
|
||||||
{
|
{
|
||||||
PLAIN,
|
PLAIN,
|
||||||
|
|||||||
@@ -5,12 +5,112 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "Common/Assert.h"
|
||||||
|
#include "Common/Common.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
|
#include "Common/MsgHandler.h"
|
||||||
#include "DiscIO/Enums.h"
|
#include "DiscIO/Enums.h"
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
|
std::string GetName(Country country, bool translate)
|
||||||
|
{
|
||||||
|
std::string name;
|
||||||
|
|
||||||
|
switch (country)
|
||||||
|
{
|
||||||
|
case Country::COUNTRY_EUROPE:
|
||||||
|
name = _trans("Europe");
|
||||||
|
break;
|
||||||
|
case Country::COUNTRY_JAPAN:
|
||||||
|
name = _trans("Japan");
|
||||||
|
break;
|
||||||
|
case Country::COUNTRY_USA:
|
||||||
|
name = _trans("USA");
|
||||||
|
break;
|
||||||
|
case Country::COUNTRY_AUSTRALIA:
|
||||||
|
name = _trans("Australia");
|
||||||
|
break;
|
||||||
|
case Country::COUNTRY_FRANCE:
|
||||||
|
name = _trans("France");
|
||||||
|
break;
|
||||||
|
case Country::COUNTRY_GERMANY:
|
||||||
|
name = _trans("Germany");
|
||||||
|
break;
|
||||||
|
case Country::COUNTRY_ITALY:
|
||||||
|
name = _trans("Italy");
|
||||||
|
break;
|
||||||
|
case Country::COUNTRY_KOREA:
|
||||||
|
name = _trans("Korea");
|
||||||
|
break;
|
||||||
|
case Country::COUNTRY_NETHERLANDS:
|
||||||
|
name = _trans("Netherlands");
|
||||||
|
break;
|
||||||
|
case Country::COUNTRY_RUSSIA:
|
||||||
|
name = _trans("Russia");
|
||||||
|
break;
|
||||||
|
case Country::COUNTRY_SPAIN:
|
||||||
|
name = _trans("Spain");
|
||||||
|
break;
|
||||||
|
case Country::COUNTRY_TAIWAN:
|
||||||
|
name = _trans("Taiwan");
|
||||||
|
break;
|
||||||
|
case Country::COUNTRY_WORLD:
|
||||||
|
name = _trans("World");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
name = _trans("Unknown");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return translate ? GetStringT(name.c_str()) : name;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string GetName(Language language, bool translate)
|
||||||
|
{
|
||||||
|
std::string name;
|
||||||
|
|
||||||
|
switch (language)
|
||||||
|
{
|
||||||
|
case Language::LANGUAGE_JAPANESE:
|
||||||
|
name = _trans("Japanese");
|
||||||
|
break;
|
||||||
|
case Language::LANGUAGE_ENGLISH:
|
||||||
|
name = _trans("English");
|
||||||
|
break;
|
||||||
|
case Language::LANGUAGE_GERMAN:
|
||||||
|
name = _trans("German");
|
||||||
|
break;
|
||||||
|
case Language::LANGUAGE_FRENCH:
|
||||||
|
name = _trans("French");
|
||||||
|
break;
|
||||||
|
case Language::LANGUAGE_SPANISH:
|
||||||
|
name = _trans("Spanish");
|
||||||
|
break;
|
||||||
|
case Language::LANGUAGE_ITALIAN:
|
||||||
|
name = _trans("Italian");
|
||||||
|
break;
|
||||||
|
case Language::LANGUAGE_DUTCH:
|
||||||
|
name = _trans("Dutch");
|
||||||
|
break;
|
||||||
|
case Language::LANGUAGE_SIMPLIFIED_CHINESE:
|
||||||
|
name = _trans("Simplified Chinese");
|
||||||
|
break;
|
||||||
|
case Language::LANGUAGE_TRADITIONAL_CHINESE:
|
||||||
|
name = _trans("Traditional Chinese");
|
||||||
|
break;
|
||||||
|
case Language::LANGUAGE_KOREAN:
|
||||||
|
name = _trans("Korean");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
name = _trans("Unknown");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return translate ? GetStringT(name.c_str()) : name;
|
||||||
|
}
|
||||||
|
|
||||||
bool IsDisc(Platform volume_type)
|
bool IsDisc(Platform volume_type)
|
||||||
{
|
{
|
||||||
return volume_type == Platform::GAMECUBE_DISC || volume_type == Platform::WII_DISC;
|
return volume_type == Platform::GAMECUBE_DISC || volume_type == Platform::WII_DISC;
|
||||||
@@ -26,7 +126,7 @@ bool IsNTSC(Region region)
|
|||||||
return region == Region::NTSC_J || region == Region::NTSC_U || region == Region::NTSC_K;
|
return region == Region::NTSC_J || region == Region::NTSC_U || region == Region::NTSC_K;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Increment CACHE_REVISION (GameListCtrl.cpp) if the code below is modified
|
// Increment CACHE_REVISION (GameFileCache.cpp) if the code below is modified
|
||||||
|
|
||||||
Country TypicalCountryForRegion(Region region)
|
Country TypicalCountryForRegion(Region region)
|
||||||
{
|
{
|
||||||
@@ -230,7 +330,7 @@ std::string GetSysMenuVersionString(u16 title_version)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetCompanyFromID(const std::string& company_id)
|
const std::string& GetCompanyFromID(const std::string& company_id)
|
||||||
{
|
{
|
||||||
static const std::map<std::string, std::string> companies = {
|
static const std::map<std::string, std::string> companies = {
|
||||||
{"01", "Nintendo"},
|
{"01", "Nintendo"},
|
||||||
@@ -517,10 +617,11 @@ std::string GetCompanyFromID(const std::string& company_id)
|
|||||||
{"ZW", "Judo Baby"},
|
{"ZW", "Judo Baby"},
|
||||||
{"ZX", "TopWare Interactive"}};
|
{"ZX", "TopWare Interactive"}};
|
||||||
|
|
||||||
|
static const std::string EMPTY_STRING;
|
||||||
auto iterator = companies.find(company_id);
|
auto iterator = companies.find(company_id);
|
||||||
if (iterator != companies.end())
|
if (iterator != companies.end())
|
||||||
return iterator->second;
|
return iterator->second;
|
||||||
else
|
else
|
||||||
return "";
|
return EMPTY_STRING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
// Increment CACHE_REVISION (GameListCtrl.cpp) if these enums are modified
|
// Increment CACHE_REVISION (GameFileCache.cpp) if these enums are modified
|
||||||
|
|
||||||
enum class Platform
|
enum class Platform
|
||||||
{
|
{
|
||||||
@@ -68,6 +68,9 @@ enum class Language
|
|||||||
LANGUAGE_UNKNOWN
|
LANGUAGE_UNKNOWN
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::string GetName(Country country, bool translate);
|
||||||
|
std::string GetName(Language language, bool translate);
|
||||||
|
|
||||||
bool IsDisc(Platform volume_type);
|
bool IsDisc(Platform volume_type);
|
||||||
bool IsWii(Platform volume_type);
|
bool IsWii(Platform volume_type);
|
||||||
bool IsNTSC(Region region);
|
bool IsNTSC(Region region);
|
||||||
@@ -82,5 +85,5 @@ Country CountrySwitch(u8 country_code);
|
|||||||
Region GetSysMenuRegion(u16 title_version);
|
Region GetSysMenuRegion(u16 title_version);
|
||||||
std::string GetSysMenuVersionString(u16 title_version);
|
std::string GetSysMenuVersionString(u16 title_version);
|
||||||
|
|
||||||
std::string GetCompanyFromID(const std::string& company_id);
|
const std::string& GetCompanyFromID(const std::string& company_id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,8 +82,6 @@ set(SRCS
|
|||||||
Debugger/RegisterColumn.cpp
|
Debugger/RegisterColumn.cpp
|
||||||
Debugger/RegisterWidget.cpp
|
Debugger/RegisterWidget.cpp
|
||||||
Debugger/WatchWidget.cpp
|
Debugger/WatchWidget.cpp
|
||||||
GameList/GameFileCache.cpp
|
|
||||||
GameList/GameFile.cpp
|
|
||||||
GameList/GameList.cpp
|
GameList/GameList.cpp
|
||||||
GameList/GameListModel.cpp
|
GameList/GameListModel.cpp
|
||||||
GameList/GameTracker.cpp
|
GameList/GameTracker.cpp
|
||||||
@@ -98,6 +96,7 @@ set(SRCS
|
|||||||
NetPlay/PadMappingDialog.cpp
|
NetPlay/PadMappingDialog.cpp
|
||||||
QtUtils/DoubleClickEventFilter.cpp
|
QtUtils/DoubleClickEventFilter.cpp
|
||||||
QtUtils/ElidedButton.cpp
|
QtUtils/ElidedButton.cpp
|
||||||
|
QtUtils/ImageConverter.cpp
|
||||||
QtUtils/ListTabWidget.cpp
|
QtUtils/ListTabWidget.cpp
|
||||||
QtUtils/WindowActivationEventFilter.cpp
|
QtUtils/WindowActivationEventFilter.cpp
|
||||||
QtUtils/AspectRatioWidget.cpp
|
QtUtils/AspectRatioWidget.cpp
|
||||||
|
|||||||
@@ -16,10 +16,10 @@
|
|||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "DolphinQt2/Config/CheatCodeEditor.h"
|
#include "DolphinQt2/Config/CheatCodeEditor.h"
|
||||||
#include "DolphinQt2/Config/CheatWarningWidget.h"
|
#include "DolphinQt2/Config/CheatWarningWidget.h"
|
||||||
#include "DolphinQt2/GameList/GameFile.h"
|
#include "UICommon/GameFile.h"
|
||||||
|
|
||||||
ARCodeWidget::ARCodeWidget(const GameFile& game)
|
ARCodeWidget::ARCodeWidget(const UICommon::GameFile& game)
|
||||||
: m_game(game), m_game_id(game.GetGameID().toStdString()), m_game_revision(game.GetRevision())
|
: m_game(game), m_game_id(game.GetGameID()), m_game_revision(game.GetRevision())
|
||||||
{
|
{
|
||||||
CreateWidgets();
|
CreateWidgets();
|
||||||
ConnectWidgets();
|
ConnectWidgets();
|
||||||
|
|||||||
@@ -12,8 +12,12 @@
|
|||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Core/ActionReplay.h"
|
#include "Core/ActionReplay.h"
|
||||||
|
|
||||||
class CheatWarningWidget;
|
namespace UICommon
|
||||||
|
{
|
||||||
class GameFile;
|
class GameFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CheatWarningWidget;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QListWidget;
|
class QListWidget;
|
||||||
class QListWidgetItem;
|
class QListWidgetItem;
|
||||||
@@ -23,7 +27,7 @@ class ARCodeWidget : public QWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ARCodeWidget(const GameFile& game);
|
explicit ARCodeWidget(const UICommon::GameFile& game);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void OpenGeneralSettings();
|
void OpenGeneralSettings();
|
||||||
@@ -41,7 +45,7 @@ private:
|
|||||||
void OnCodeEditPressed();
|
void OnCodeEditPressed();
|
||||||
void OnCodeRemovePressed();
|
void OnCodeRemovePressed();
|
||||||
|
|
||||||
const GameFile& m_game;
|
const UICommon::GameFile& m_game;
|
||||||
std::string m_game_id;
|
std::string m_game_id;
|
||||||
u16 m_game_revision;
|
u16 m_game_revision;
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ enum class EntryType
|
|||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(EntryType);
|
Q_DECLARE_METATYPE(EntryType);
|
||||||
|
|
||||||
FilesystemWidget::FilesystemWidget(const GameFile& game)
|
FilesystemWidget::FilesystemWidget(const UICommon::GameFile& game)
|
||||||
: m_game(game), m_volume(DiscIO::CreateVolumeFromFilename(game.GetFilePath().toStdString()))
|
: m_game(game), m_volume(DiscIO::CreateVolumeFromFilename(game.GetFilePath()))
|
||||||
{
|
{
|
||||||
CreateWidgets();
|
CreateWidgets();
|
||||||
ConnectWidgets();
|
ConnectWidgets();
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "DiscIO/Volume.h"
|
#include "DiscIO/Volume.h"
|
||||||
#include "DolphinQt2/GameList/GameFile.h"
|
#include "UICommon/GameFile.h"
|
||||||
|
|
||||||
class QStandardItem;
|
class QStandardItem;
|
||||||
class QStandardItemModel;
|
class QStandardItemModel;
|
||||||
@@ -24,7 +24,7 @@ class FilesystemWidget final : public QWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit FilesystemWidget(const GameFile& game);
|
explicit FilesystemWidget(const UICommon::GameFile& game);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CreateWidgets();
|
void CreateWidgets();
|
||||||
@@ -46,6 +46,6 @@ private:
|
|||||||
QStandardItemModel* m_tree_model;
|
QStandardItemModel* m_tree_model;
|
||||||
QTreeView* m_tree_view;
|
QTreeView* m_tree_view;
|
||||||
|
|
||||||
GameFile m_game;
|
UICommon::GameFile m_game;
|
||||||
std::unique_ptr<DiscIO::Volume> m_volume;
|
std::unique_ptr<DiscIO::Volume> m_volume;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include "Core/ConfigLoaders/GameConfigLoader.h"
|
#include "Core/ConfigLoaders/GameConfigLoader.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "DolphinQt2/Config/Graphics/GraphicsSlider.h"
|
#include "DolphinQt2/Config/Graphics/GraphicsSlider.h"
|
||||||
#include "DolphinQt2/GameList/GameFile.h"
|
#include "UICommon/GameFile.h"
|
||||||
|
|
||||||
constexpr int DETERMINISM_NOT_SET_INDEX = 0;
|
constexpr int DETERMINISM_NOT_SET_INDEX = 0;
|
||||||
constexpr int DETERMINISM_AUTO_INDEX = 1;
|
constexpr int DETERMINISM_AUTO_INDEX = 1;
|
||||||
@@ -35,9 +35,9 @@ constexpr const char* DETERMINISM_AUTO_STRING = "auto";
|
|||||||
constexpr const char* DETERMINISM_NONE_STRING = "none";
|
constexpr const char* DETERMINISM_NONE_STRING = "none";
|
||||||
constexpr const char* DETERMINISM_FAKE_COMPLETION_STRING = "fake-completion";
|
constexpr const char* DETERMINISM_FAKE_COMPLETION_STRING = "fake-completion";
|
||||||
|
|
||||||
GameConfigWidget::GameConfigWidget(const GameFile& game) : m_game(game)
|
GameConfigWidget::GameConfigWidget(const UICommon::GameFile& game) : m_game(game)
|
||||||
{
|
{
|
||||||
m_game_id = m_game.GetGameID().toStdString();
|
m_game_id = m_game.GetGameID();
|
||||||
m_gameini_local_path =
|
m_gameini_local_path =
|
||||||
QString::fromStdString(File::GetUserPath(D_GAMESETTINGS_IDX) + m_game_id + ".ini");
|
QString::fromStdString(File::GetUserPath(D_GAMESETTINGS_IDX) + m_game_id + ".ini");
|
||||||
m_gameini_local = SConfig::LoadLocalGameIni(m_game_id, m_game.GetRevision());
|
m_gameini_local = SConfig::LoadLocalGameIni(m_game_id, m_game.GetRevision());
|
||||||
@@ -241,8 +241,8 @@ void GameConfigWidget::SaveCheckBox(QCheckBox* checkbox, const std::string& sect
|
|||||||
void GameConfigWidget::LoadSettings()
|
void GameConfigWidget::LoadSettings()
|
||||||
{
|
{
|
||||||
// Load state information
|
// Load state information
|
||||||
m_state_combo->setCurrentIndex(m_game.GetRating());
|
m_state_combo->setCurrentIndex(m_game.GetEmuState());
|
||||||
m_state_comment_edit->setText(m_game.GetIssues());
|
m_state_comment_edit->setText(QString::fromStdString(m_game.GetIssues()));
|
||||||
|
|
||||||
// Load game-specific settings
|
// Load game-specific settings
|
||||||
|
|
||||||
@@ -301,10 +301,10 @@ void GameConfigWidget::SaveSettings()
|
|||||||
QString comment = m_state_comment_edit->text();
|
QString comment = m_state_comment_edit->text();
|
||||||
int state = m_state_combo->currentIndex();
|
int state = m_state_combo->currentIndex();
|
||||||
|
|
||||||
if (comment != m_game.GetIssues())
|
if (comment != QString::fromStdString(m_game.GetIssues()))
|
||||||
m_gameini_local.GetOrCreateSection("EmuState")->Set("EmulationIssues", comment.toStdString());
|
m_gameini_local.GetOrCreateSection("EmuState")->Set("EmulationIssues", comment.toStdString());
|
||||||
|
|
||||||
if (state != m_game.GetRating())
|
if (state != m_game.GetEmuState())
|
||||||
m_gameini_local.GetOrCreateSection("EmuState")->Set("EmulationStateId", state);
|
m_gameini_local.GetOrCreateSection("EmuState")->Set("EmulationStateId", state);
|
||||||
|
|
||||||
// Save game-specific settings
|
// Save game-specific settings
|
||||||
|
|||||||
@@ -11,7 +11,11 @@
|
|||||||
|
|
||||||
#include "Common/IniFile.h"
|
#include "Common/IniFile.h"
|
||||||
|
|
||||||
|
namespace UICommon
|
||||||
|
{
|
||||||
class GameFile;
|
class GameFile;
|
||||||
|
}
|
||||||
|
|
||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
class QGroupBox;
|
class QGroupBox;
|
||||||
@@ -25,7 +29,7 @@ class GameConfigWidget : public QWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit GameConfigWidget(const GameFile& game);
|
explicit GameConfigWidget(const UICommon::GameFile& game);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CreateWidgets();
|
void CreateWidgets();
|
||||||
@@ -65,6 +69,6 @@ private:
|
|||||||
IniFile m_gameini_local;
|
IniFile m_gameini_local;
|
||||||
IniFile m_gameini_default;
|
IniFile m_gameini_default;
|
||||||
|
|
||||||
const GameFile& m_game;
|
const UICommon::GameFile& m_game;
|
||||||
std::string m_game_id;
|
std::string m_game_id;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -20,10 +20,10 @@
|
|||||||
#include "Core/GeckoCodeConfig.h"
|
#include "Core/GeckoCodeConfig.h"
|
||||||
#include "DolphinQt2/Config/CheatCodeEditor.h"
|
#include "DolphinQt2/Config/CheatCodeEditor.h"
|
||||||
#include "DolphinQt2/Config/CheatWarningWidget.h"
|
#include "DolphinQt2/Config/CheatWarningWidget.h"
|
||||||
#include "DolphinQt2/GameList/GameFile.h"
|
#include "UICommon/GameFile.h"
|
||||||
|
|
||||||
GeckoCodeWidget::GeckoCodeWidget(const GameFile& game)
|
GeckoCodeWidget::GeckoCodeWidget(const UICommon::GameFile& game)
|
||||||
: m_game(game), m_game_id(game.GetGameID().toStdString()), m_game_revision(game.GetRevision())
|
: m_game(game), m_game_id(game.GetGameID()), m_game_revision(game.GetRevision())
|
||||||
{
|
{
|
||||||
CreateWidgets();
|
CreateWidgets();
|
||||||
ConnectWidgets();
|
ConnectWidgets();
|
||||||
|
|||||||
@@ -13,18 +13,22 @@
|
|||||||
#include "Core/GeckoCode.h"
|
#include "Core/GeckoCode.h"
|
||||||
|
|
||||||
class CheatWarningWidget;
|
class CheatWarningWidget;
|
||||||
class GameFile;
|
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QListWidget;
|
class QListWidget;
|
||||||
class QListWidgetItem;
|
class QListWidgetItem;
|
||||||
class QTextEdit;
|
class QTextEdit;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
|
|
||||||
|
namespace UICommon
|
||||||
|
{
|
||||||
|
class GameFile;
|
||||||
|
}
|
||||||
|
|
||||||
class GeckoCodeWidget : public QWidget
|
class GeckoCodeWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit GeckoCodeWidget(const GameFile& game);
|
explicit GeckoCodeWidget(const UICommon::GameFile& game);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void OpenGeneralSettings();
|
void OpenGeneralSettings();
|
||||||
@@ -43,7 +47,7 @@ private:
|
|||||||
void DownloadCodes();
|
void DownloadCodes();
|
||||||
void SaveCodes();
|
void SaveCodes();
|
||||||
|
|
||||||
const GameFile& m_game;
|
const UICommon::GameFile& m_game;
|
||||||
std::string m_game_id;
|
std::string m_game_id;
|
||||||
u16 m_game_revision;
|
u16 m_game_revision;
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,10 @@
|
|||||||
#include "DiscIO/Blob.h"
|
#include "DiscIO/Blob.h"
|
||||||
#include "DiscIO/Enums.h"
|
#include "DiscIO/Enums.h"
|
||||||
#include "DolphinQt2/Config/InfoWidget.h"
|
#include "DolphinQt2/Config/InfoWidget.h"
|
||||||
|
#include "DolphinQt2/QtUtils/ImageConverter.h"
|
||||||
|
#include "UICommon/UICommon.h"
|
||||||
|
|
||||||
InfoWidget::InfoWidget(const GameFile& game) : m_game(game)
|
InfoWidget::InfoWidget(const UICommon::GameFile& game) : m_game(game)
|
||||||
{
|
{
|
||||||
QVBoxLayout* layout = new QVBoxLayout();
|
QVBoxLayout* layout = new QVBoxLayout();
|
||||||
layout->addWidget(CreateISODetails());
|
layout->addWidget(CreateISODetails());
|
||||||
@@ -32,17 +34,19 @@ QGroupBox* InfoWidget::CreateISODetails()
|
|||||||
|
|
||||||
QLineEdit* file_path = CreateValueDisplay(m_game.GetFilePath());
|
QLineEdit* file_path = CreateValueDisplay(m_game.GetFilePath());
|
||||||
QLineEdit* internal_name = CreateValueDisplay(m_game.GetInternalName());
|
QLineEdit* internal_name = CreateValueDisplay(m_game.GetInternalName());
|
||||||
QString game_id_string = m_game.GetGameID();
|
|
||||||
|
QString game_id_string = QString::fromStdString(m_game.GetGameID());
|
||||||
if (const u64 title_id = m_game.GetTitleID())
|
if (const u64 title_id = m_game.GetTitleID())
|
||||||
game_id_string += QStringLiteral(" (%1)").arg(title_id, 16, 16, QLatin1Char('0'));
|
game_id_string += QStringLiteral(" (%1)").arg(title_id, 16, 16, QLatin1Char('0'));
|
||||||
QLineEdit* game_id = CreateValueDisplay(game_id_string);
|
QLineEdit* game_id = CreateValueDisplay(game_id_string);
|
||||||
QLineEdit* country = CreateValueDisplay(m_game.GetCountry());
|
|
||||||
|
QLineEdit* country = CreateValueDisplay(DiscIO::GetName(m_game.GetCountry(), true));
|
||||||
QLineEdit* maker = CreateValueDisplay(m_game.GetMaker());
|
QLineEdit* maker = CreateValueDisplay(m_game.GetMaker());
|
||||||
QLineEdit* maker_id = CreateValueDisplay(QStringLiteral("0x") + m_game.GetMakerID());
|
QLineEdit* maker_id = CreateValueDisplay("0x" + m_game.GetMakerID());
|
||||||
QLineEdit* disc_number = CreateValueDisplay(QString::number(m_game.GetDiscNumber()));
|
QLineEdit* disc_number = CreateValueDisplay(QString::number(m_game.GetDiscNumber()));
|
||||||
QLineEdit* revision = CreateValueDisplay(QString::number(m_game.GetRevision()));
|
QLineEdit* revision = CreateValueDisplay(QString::number(m_game.GetRevision()));
|
||||||
QLineEdit* apploader_date = CreateValueDisplay(m_game.GetApploaderDate());
|
QLineEdit* apploader_date = CreateValueDisplay(m_game.GetApploaderDate());
|
||||||
QLineEdit* iso_size = CreateValueDisplay(FormatSize(m_game.GetFileSize()));
|
QLineEdit* iso_size = CreateValueDisplay(UICommon::FormatSize(m_game.GetFileSize()));
|
||||||
QWidget* checksum = CreateChecksumComputer();
|
QWidget* checksum = CreateChecksumComputer();
|
||||||
|
|
||||||
layout->addRow(tr("File Path:"), file_path);
|
layout->addRow(tr("File Path:"), file_path);
|
||||||
@@ -75,7 +79,7 @@ QGroupBox* InfoWidget::CreateBannerDetails()
|
|||||||
CreateLanguageSelector();
|
CreateLanguageSelector();
|
||||||
|
|
||||||
layout->addRow(tr("Show Language:"), m_language_selector);
|
layout->addRow(tr("Show Language:"), m_language_selector);
|
||||||
if (m_game.GetPlatformID() == DiscIO::Platform::GAMECUBE_DISC)
|
if (m_game.GetPlatform() == DiscIO::Platform::GAMECUBE_DISC)
|
||||||
{
|
{
|
||||||
layout->addRow(tr("Short Name:"), m_short_name);
|
layout->addRow(tr("Short Name:"), m_short_name);
|
||||||
layout->addRow(tr("Short Maker:"), m_short_maker);
|
layout->addRow(tr("Short Maker:"), m_short_maker);
|
||||||
@@ -83,27 +87,26 @@ QGroupBox* InfoWidget::CreateBannerDetails()
|
|||||||
layout->addRow(tr("Long Maker:"), m_long_maker);
|
layout->addRow(tr("Long Maker:"), m_long_maker);
|
||||||
layout->addRow(tr("Description:"), m_description);
|
layout->addRow(tr("Description:"), m_description);
|
||||||
}
|
}
|
||||||
else if (DiscIO::IsWii(m_game.GetPlatformID()))
|
else if (DiscIO::IsWii(m_game.GetPlatform()))
|
||||||
{
|
{
|
||||||
layout->addRow(tr("Name:"), m_long_name);
|
layout->addRow(tr("Name:"), m_long_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_game.GetBanner().isNull())
|
QPixmap banner = ToQPixmap(m_game.GetBannerImage());
|
||||||
{
|
if (!banner.isNull())
|
||||||
layout->addRow(tr("Banner:"), CreateBannerGraphic());
|
layout->addRow(tr("Banner:"), CreateBannerGraphic(banner));
|
||||||
}
|
|
||||||
|
|
||||||
group->setLayout(layout);
|
group->setLayout(layout);
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget* InfoWidget::CreateBannerGraphic()
|
QWidget* InfoWidget::CreateBannerGraphic(const QPixmap& image)
|
||||||
{
|
{
|
||||||
QWidget* widget = new QWidget();
|
QWidget* widget = new QWidget();
|
||||||
QHBoxLayout* layout = new QHBoxLayout();
|
QHBoxLayout* layout = new QHBoxLayout();
|
||||||
|
|
||||||
QLabel* banner = new QLabel();
|
QLabel* banner = new QLabel();
|
||||||
banner->setPixmap(m_game.GetBanner());
|
banner->setPixmap(image);
|
||||||
QPushButton* save = new QPushButton(tr("Save as..."));
|
QPushButton* save = new QPushButton(tr("Save as..."));
|
||||||
connect(save, &QPushButton::clicked, this, &InfoWidget::SaveBanner);
|
connect(save, &QPushButton::clicked, this, &InfoWidget::SaveBanner);
|
||||||
|
|
||||||
@@ -117,7 +120,7 @@ void InfoWidget::SaveBanner()
|
|||||||
{
|
{
|
||||||
QString path = QFileDialog::getSaveFileName(this, tr("Select a File"), QDir::currentPath(),
|
QString path = QFileDialog::getSaveFileName(this, tr("Select a File"), QDir::currentPath(),
|
||||||
tr("PNG image file (*.png);; All Files (*)"));
|
tr("PNG image file (*.png);; All Files (*)"));
|
||||||
m_game.GetBanner().save(path, "PNG");
|
ToQPixmap(m_game.GetBannerImage()).save(path, "PNG");
|
||||||
}
|
}
|
||||||
|
|
||||||
QLineEdit* InfoWidget::CreateValueDisplay(const QString& value)
|
QLineEdit* InfoWidget::CreateValueDisplay(const QString& value)
|
||||||
@@ -128,14 +131,18 @@ QLineEdit* InfoWidget::CreateValueDisplay(const QString& value)
|
|||||||
return value_display;
|
return value_display;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QLineEdit* InfoWidget::CreateValueDisplay(const std::string& value)
|
||||||
|
{
|
||||||
|
return CreateValueDisplay(QString::fromStdString(value));
|
||||||
|
}
|
||||||
|
|
||||||
void InfoWidget::CreateLanguageSelector()
|
void InfoWidget::CreateLanguageSelector()
|
||||||
{
|
{
|
||||||
m_language_selector = new QComboBox();
|
m_language_selector = new QComboBox();
|
||||||
QList<DiscIO::Language> languages = m_game.GetAvailableLanguages();
|
for (DiscIO::Language language : m_game.GetLanguages())
|
||||||
for (int i = 0; i < languages.count(); i++)
|
|
||||||
{
|
{
|
||||||
DiscIO::Language language = languages.at(i);
|
m_language_selector->addItem(QString::fromStdString(DiscIO::GetName(language, true)),
|
||||||
m_language_selector->addItem(m_game.GetLanguage(language), static_cast<int>(language));
|
static_cast<int>(language));
|
||||||
}
|
}
|
||||||
if (m_language_selector->count() == 1)
|
if (m_language_selector->count() == 1)
|
||||||
m_language_selector->setDisabled(true);
|
m_language_selector->setDisabled(true);
|
||||||
@@ -149,11 +156,11 @@ void InfoWidget::ChangeLanguage()
|
|||||||
{
|
{
|
||||||
DiscIO::Language language =
|
DiscIO::Language language =
|
||||||
static_cast<DiscIO::Language>(m_language_selector->currentData().toInt());
|
static_cast<DiscIO::Language>(m_language_selector->currentData().toInt());
|
||||||
m_short_name->setText(m_game.GetShortName(language));
|
m_short_name->setText(QString::fromStdString(m_game.GetShortName(language)));
|
||||||
m_short_maker->setText(m_game.GetShortMaker(language));
|
m_short_maker->setText(QString::fromStdString(m_game.GetShortMaker(language)));
|
||||||
m_long_name->setText(m_game.GetLongName(language));
|
m_long_name->setText(QString::fromStdString(m_game.GetLongName(language)));
|
||||||
m_long_maker->setText(m_game.GetLongMaker(language));
|
m_long_maker->setText(QString::fromStdString(m_game.GetLongMaker(language)));
|
||||||
m_description->setText(m_game.GetDescription(language));
|
m_description->setText(QString::fromStdString(m_game.GetDescription(language)));
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget* InfoWidget::CreateChecksumComputer()
|
QWidget* InfoWidget::CreateChecksumComputer()
|
||||||
@@ -176,8 +183,7 @@ void InfoWidget::ComputeChecksum()
|
|||||||
{
|
{
|
||||||
QCryptographicHash hash(QCryptographicHash::Md5);
|
QCryptographicHash hash(QCryptographicHash::Md5);
|
||||||
hash.reset();
|
hash.reset();
|
||||||
std::unique_ptr<DiscIO::BlobReader> file(
|
std::unique_ptr<DiscIO::BlobReader> file(DiscIO::CreateBlobReader(m_game.GetFilePath()));
|
||||||
DiscIO::CreateBlobReader(m_game.GetFilePath().toStdString()));
|
|
||||||
std::vector<u8> file_data(8 * 1080 * 1080); // read 1MB at a time
|
std::vector<u8> file_data(8 * 1080 * 1080); // read 1MB at a time
|
||||||
u64 game_size = file->GetDataSize();
|
u64 game_size = file->GetDataSize();
|
||||||
u64 read_offset = 0;
|
u64 read_offset = 0;
|
||||||
|
|||||||
@@ -4,20 +4,23 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "DolphinQt2/GameList/GameFile.h"
|
#include "UICommon/GameFile.h"
|
||||||
|
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
class QGroupBox;
|
class QGroupBox;
|
||||||
class QTextEdit;
|
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
|
class QPixmap;
|
||||||
|
class QTextEdit;
|
||||||
|
|
||||||
class InfoWidget final : public QWidget
|
class InfoWidget final : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit InfoWidget(const GameFile& game);
|
explicit InfoWidget(const UICommon::GameFile& game);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ComputeChecksum();
|
void ComputeChecksum();
|
||||||
@@ -26,13 +29,13 @@ private:
|
|||||||
|
|
||||||
QGroupBox* CreateBannerDetails();
|
QGroupBox* CreateBannerDetails();
|
||||||
QGroupBox* CreateISODetails();
|
QGroupBox* CreateISODetails();
|
||||||
QLineEdit* CreateValueDisplay() { return CreateValueDisplay(QStringLiteral("")); };
|
|
||||||
QLineEdit* CreateValueDisplay(const QString& value);
|
QLineEdit* CreateValueDisplay(const QString& value);
|
||||||
|
QLineEdit* CreateValueDisplay(const std::string& value = "");
|
||||||
QWidget* CreateChecksumComputer();
|
QWidget* CreateChecksumComputer();
|
||||||
void CreateLanguageSelector();
|
void CreateLanguageSelector();
|
||||||
QWidget* CreateBannerGraphic();
|
QWidget* CreateBannerGraphic(const QPixmap& image);
|
||||||
|
|
||||||
GameFile m_game;
|
UICommon::GameFile m_game;
|
||||||
QLineEdit* m_checksum_result;
|
QLineEdit* m_checksum_result;
|
||||||
QComboBox* m_language_selector;
|
QComboBox* m_language_selector;
|
||||||
QLineEdit* m_long_name;
|
QLineEdit* m_long_name;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "Core/PatchEngine.h"
|
#include "Core/PatchEngine.h"
|
||||||
#include "DolphinQt2/GameList/GameFile.h"
|
|
||||||
|
|
||||||
class QDialogButtonBox;
|
class QDialogButtonBox;
|
||||||
class QGroupBox;
|
class QGroupBox;
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "DolphinQt2/Config/NewPatchDialog.h"
|
#include "DolphinQt2/Config/NewPatchDialog.h"
|
||||||
|
|
||||||
PatchesWidget::PatchesWidget(const GameFile& game)
|
PatchesWidget::PatchesWidget(const UICommon::GameFile& game)
|
||||||
: m_game(game), m_game_id(game.GetGameID().toStdString()), m_game_revision(game.GetRevision())
|
: m_game(game), m_game_id(game.GetGameID()), m_game_revision(game.GetRevision())
|
||||||
{
|
{
|
||||||
IniFile game_ini_local;
|
IniFile game_ini_local;
|
||||||
game_ini_local.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + m_game_id + ".ini");
|
game_ini_local.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + m_game_id + ".ini");
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "Core/PatchEngine.h"
|
#include "Core/PatchEngine.h"
|
||||||
#include "DolphinQt2/GameList/GameFile.h"
|
#include "UICommon/GameFile.h"
|
||||||
|
|
||||||
class QListWidget;
|
class QListWidget;
|
||||||
class QListWidgetItem;
|
class QListWidgetItem;
|
||||||
@@ -19,7 +19,7 @@ class QPushButton;
|
|||||||
class PatchesWidget : public QWidget
|
class PatchesWidget : public QWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit PatchesWidget(const GameFile& game);
|
explicit PatchesWidget(const UICommon::GameFile& game);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CreateWidgets();
|
void CreateWidgets();
|
||||||
@@ -39,7 +39,7 @@ private:
|
|||||||
QPushButton* m_remove_button;
|
QPushButton* m_remove_button;
|
||||||
|
|
||||||
std::vector<PatchEngine::Patch> m_patches;
|
std::vector<PatchEngine::Patch> m_patches;
|
||||||
const GameFile& m_game;
|
const UICommon::GameFile& m_game;
|
||||||
std::string m_game_id;
|
std::string m_game_id;
|
||||||
u16 m_game_revision;
|
u16 m_game_revision;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,11 +13,15 @@
|
|||||||
#include "DolphinQt2/Config/InfoWidget.h"
|
#include "DolphinQt2/Config/InfoWidget.h"
|
||||||
#include "DolphinQt2/Config/PatchesWidget.h"
|
#include "DolphinQt2/Config/PatchesWidget.h"
|
||||||
#include "DolphinQt2/Config/PropertiesDialog.h"
|
#include "DolphinQt2/Config/PropertiesDialog.h"
|
||||||
|
#include "UICommon/GameFile.h"
|
||||||
|
|
||||||
PropertiesDialog::PropertiesDialog(QWidget* parent, const GameFile& game) : QDialog(parent)
|
PropertiesDialog::PropertiesDialog(QWidget* parent, const UICommon::GameFile& game)
|
||||||
|
: QDialog(parent)
|
||||||
{
|
{
|
||||||
setWindowTitle(
|
setWindowTitle(QStringLiteral("%1: %2 - %3")
|
||||||
QStringLiteral("%1: %2 - %3").arg(game.GetFileName(), game.GetGameID(), game.GetLongName()));
|
.arg(QString::fromStdString(game.GetFileName()),
|
||||||
|
QString::fromStdString(game.GetGameID()),
|
||||||
|
QString::fromStdString(game.GetLongName())));
|
||||||
QVBoxLayout* layout = new QVBoxLayout();
|
QVBoxLayout* layout = new QVBoxLayout();
|
||||||
|
|
||||||
QTabWidget* tab_widget = new QTabWidget(this);
|
QTabWidget* tab_widget = new QTabWidget(this);
|
||||||
@@ -39,7 +43,7 @@ PropertiesDialog::PropertiesDialog(QWidget* parent, const GameFile& game) : QDia
|
|||||||
tab_widget->addTab(gecko, tr("Gecko Codes"));
|
tab_widget->addTab(gecko, tr("Gecko Codes"));
|
||||||
tab_widget->addTab(info, tr("Info"));
|
tab_widget->addTab(info, tr("Info"));
|
||||||
|
|
||||||
if (DiscIO::IsDisc(game.GetPlatformID()))
|
if (DiscIO::IsDisc(game.GetPlatform()))
|
||||||
{
|
{
|
||||||
FilesystemWidget* filesystem = new FilesystemWidget(game);
|
FilesystemWidget* filesystem = new FilesystemWidget(game);
|
||||||
tab_widget->addTab(filesystem, tr("Filesystem"));
|
tab_widget->addTab(filesystem, tr("Filesystem"));
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user