mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-13 19:38:37 +02:00
[meta] clang-format literally all of the Qt code (#3706)
I'm tired of dealing with this tbh Signed-off-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3706 Reviewed-by: Lizzie <lizzie@eden-emu.dev>
This commit is contained in:
parent
769edbfea3
commit
8678cb06eb
107 changed files with 1457 additions and 1737 deletions
|
|
@ -5,7 +5,5 @@
|
|||
#define QT_APPLET_UTIL_H
|
||||
|
||||
// TODO
|
||||
namespace QtCommon::Applets {
|
||||
|
||||
}
|
||||
namespace QtCommon::Applets {}
|
||||
#endif // QT_APPLET_UTIL_H
|
||||
|
|
|
|||
|
|
@ -10,11 +10,8 @@
|
|||
/** This is a modified version of JlCompress **/
|
||||
namespace QtCommon::Compress {
|
||||
|
||||
bool compressDir(QString fileCompressed,
|
||||
QString dir,
|
||||
const Options &options,
|
||||
QtCommon::QtProgressCallback callback)
|
||||
{
|
||||
bool compressDir(QString fileCompressed, QString dir, const Options& options,
|
||||
QtCommon::QtProgressCallback callback) {
|
||||
// Create zip
|
||||
QuaZip zip(fileCompressed);
|
||||
QDir().mkpath(QFileInfo(fileCompressed).absolutePath());
|
||||
|
|
@ -26,8 +23,7 @@ bool compressDir(QString fileCompressed,
|
|||
// See how big the overall fs structure is
|
||||
// good approx. of total progress
|
||||
// TODO(crueter): QDirListing impl... or fs::recursive_dir_iterator
|
||||
QDirIterator iter(dir,
|
||||
QDir::NoDotAndDotDot | QDir::Hidden | QDir::Files,
|
||||
QDirIterator iter(dir, QDir::NoDotAndDotDot | QDir::Hidden | QDir::Files,
|
||||
QDirIterator::Subdirectories);
|
||||
|
||||
std::size_t total = 0;
|
||||
|
|
@ -54,14 +50,8 @@ bool compressDir(QString fileCompressed,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool compressSubDir(QuaZip *zip,
|
||||
QString dir,
|
||||
QString origDir,
|
||||
const Options &options,
|
||||
std::size_t total,
|
||||
std::size_t &progress,
|
||||
QtProgressCallback callback)
|
||||
{
|
||||
bool compressSubDir(QuaZip* zip, QString dir, QString origDir, const Options& options,
|
||||
std::size_t total, std::size_t& progress, QtProgressCallback callback) {
|
||||
// zip: object where to add the file
|
||||
// dir: current real directory
|
||||
// origDir: original real directory
|
||||
|
|
@ -69,22 +59,20 @@ bool compressSubDir(QuaZip *zip,
|
|||
|
||||
if (!zip)
|
||||
return false;
|
||||
if (zip->getMode() != QuaZip::mdCreate && zip->getMode() != QuaZip::mdAppend
|
||||
&& zip->getMode() != QuaZip::mdAdd)
|
||||
if (zip->getMode() != QuaZip::mdCreate && zip->getMode() != QuaZip::mdAppend &&
|
||||
zip->getMode() != QuaZip::mdAdd)
|
||||
return false;
|
||||
|
||||
QDir directory(dir);
|
||||
if (!directory.exists())
|
||||
return false;
|
||||
|
||||
|
||||
QDir origDirectory(origDir);
|
||||
if (dir != origDir) {
|
||||
QuaZipFile dirZipFile(zip);
|
||||
std::unique_ptr<QuaZipNewInfo> qzni;
|
||||
qzni = std::make_unique<QuaZipNewInfo>(origDirectory.relativeFilePath(dir)
|
||||
+ QLatin1String("/"),
|
||||
dir);
|
||||
qzni = std::make_unique<QuaZipNewInfo>(
|
||||
origDirectory.relativeFilePath(dir) + QLatin1String("/"), dir);
|
||||
if (!dirZipFile.open(QIODevice::WriteOnly, *qzni, nullptr, 0, 0)) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -92,18 +80,18 @@ bool compressSubDir(QuaZip *zip,
|
|||
}
|
||||
|
||||
// For each subfolder
|
||||
QFileInfoList subfiles = directory.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot
|
||||
| QDir::Hidden | QDir::Dirs);
|
||||
for (const auto &file : std::as_const(subfiles)) {
|
||||
if (!compressSubDir(
|
||||
zip, file.absoluteFilePath(), origDir, options, total, progress, callback)) {
|
||||
QFileInfoList subfiles =
|
||||
directory.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::Dirs);
|
||||
for (const auto& file : std::as_const(subfiles)) {
|
||||
if (!compressSubDir(zip, file.absoluteFilePath(), origDir, options, total, progress,
|
||||
callback)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// For each file in directory
|
||||
QFileInfoList files = directory.entryInfoList(QDir::Hidden | QDir::Files);
|
||||
for (const auto &file : std::as_const(files)) {
|
||||
for (const auto& file : std::as_const(files)) {
|
||||
// If it's not a file or it's the compressed file being created
|
||||
if (!file.isFile() || file.absoluteFilePath() == zip->getZipName())
|
||||
continue;
|
||||
|
|
@ -112,7 +100,8 @@ bool compressSubDir(QuaZip *zip,
|
|||
QString filename = origDirectory.relativeFilePath(file.absoluteFilePath());
|
||||
|
||||
// Compress the file
|
||||
if (!compressFile(zip, file.absoluteFilePath(), filename, options, total, progress, callback)) {
|
||||
if (!compressFile(zip, file.absoluteFilePath(), filename, options, total, progress,
|
||||
callback)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -120,40 +109,26 @@ bool compressSubDir(QuaZip *zip,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool compressFile(QuaZip *zip,
|
||||
QString fileName,
|
||||
QString fileDest,
|
||||
const Options &options,
|
||||
std::size_t total,
|
||||
std::size_t &progress,
|
||||
QtCommon::QtProgressCallback callback)
|
||||
{
|
||||
bool compressFile(QuaZip* zip, QString fileName, QString fileDest, const Options& options,
|
||||
std::size_t total, std::size_t& progress, QtCommon::QtProgressCallback callback) {
|
||||
// zip: object where to add the file
|
||||
// fileName: real file name
|
||||
// fileDest: file name inside the zip object
|
||||
|
||||
if (!zip)
|
||||
return false;
|
||||
if (zip->getMode() != QuaZip::mdCreate && zip->getMode() != QuaZip::mdAppend
|
||||
&& zip->getMode() != QuaZip::mdAdd)
|
||||
if (zip->getMode() != QuaZip::mdCreate && zip->getMode() != QuaZip::mdAppend &&
|
||||
zip->getMode() != QuaZip::mdAdd)
|
||||
return false;
|
||||
|
||||
QuaZipFile outFile(zip);
|
||||
if (options.getDateTime().isNull()) {
|
||||
if (!outFile.open(QIODevice::WriteOnly,
|
||||
QuaZipNewInfo(fileDest, fileName),
|
||||
nullptr,
|
||||
0,
|
||||
options.getCompressionMethod(),
|
||||
options.getCompressionLevel()))
|
||||
if (!outFile.open(QIODevice::WriteOnly, QuaZipNewInfo(fileDest, fileName), nullptr, 0,
|
||||
options.getCompressionMethod(), options.getCompressionLevel()))
|
||||
return false;
|
||||
} else {
|
||||
if (!outFile.open(QIODevice::WriteOnly,
|
||||
QuaZipNewInfo(fileDest, fileName),
|
||||
nullptr,
|
||||
0,
|
||||
options.getCompressionMethod(),
|
||||
options.getCompressionLevel()))
|
||||
if (!outFile.open(QIODevice::WriteOnly, QuaZipNewInfo(fileDest, fileName), nullptr, 0,
|
||||
options.getCompressionMethod(), options.getCompressionLevel()))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -171,7 +146,8 @@ bool compressFile(QuaZip *zip,
|
|||
if (!inFile.open(QIODevice::ReadOnly)) {
|
||||
return false;
|
||||
}
|
||||
if (!copyData(inFile, outFile, total, progress, callback) || outFile.getZipError() != UNZ_OK) {
|
||||
if (!copyData(inFile, outFile, total, progress, callback) ||
|
||||
outFile.getZipError() != UNZ_OK) {
|
||||
return false;
|
||||
}
|
||||
inFile.close();
|
||||
|
|
@ -181,12 +157,8 @@ bool compressFile(QuaZip *zip,
|
|||
return outFile.getZipError() == UNZ_OK;
|
||||
}
|
||||
|
||||
bool copyData(QIODevice &inFile,
|
||||
QIODevice &outFile,
|
||||
std::size_t total,
|
||||
std::size_t &progress,
|
||||
QtProgressCallback callback)
|
||||
{
|
||||
bool copyData(QIODevice& inFile, QIODevice& outFile, std::size_t total, std::size_t& progress,
|
||||
QtProgressCallback callback) {
|
||||
while (!inFile.atEnd()) {
|
||||
char buf[4096];
|
||||
qint64 readLen = inFile.read(buf, 4096);
|
||||
|
|
@ -203,15 +175,13 @@ bool copyData(QIODevice &inFile,
|
|||
return true;
|
||||
}
|
||||
|
||||
QStringList extractDir(QString fileCompressed, QString dir, QtCommon::QtProgressCallback callback)
|
||||
{
|
||||
QStringList extractDir(QString fileCompressed, QString dir, QtCommon::QtProgressCallback callback) {
|
||||
// Open zip
|
||||
QuaZip zip(fileCompressed);
|
||||
return extractDir(zip, dir, callback);
|
||||
}
|
||||
|
||||
QStringList extractDir(QuaZip &zip, const QString &dir, QtCommon::QtProgressCallback callback)
|
||||
{
|
||||
QStringList extractDir(QuaZip& zip, const QString& dir, QtCommon::QtProgressCallback callback) {
|
||||
if (!zip.open(QuaZip::mdUnzip)) {
|
||||
return QStringList();
|
||||
}
|
||||
|
|
@ -226,7 +196,7 @@ QStringList extractDir(QuaZip &zip, const QString &dir, QtCommon::QtProgressCall
|
|||
}
|
||||
|
||||
std::size_t total = 0;
|
||||
for (const QuaZipFileInfo64 &info : zip.getFileInfoList64()) {
|
||||
for (const QuaZipFileInfo64& info : zip.getFileInfoList64()) {
|
||||
total += info.uncompressedSize;
|
||||
}
|
||||
|
||||
|
|
@ -256,13 +226,8 @@ QStringList extractDir(QuaZip &zip, const QString &dir, QtCommon::QtProgressCall
|
|||
return extracted;
|
||||
}
|
||||
|
||||
bool extractFile(QuaZip *zip,
|
||||
QString fileName,
|
||||
QString fileDest,
|
||||
std::size_t total,
|
||||
std::size_t &progress,
|
||||
QtCommon::QtProgressCallback callback)
|
||||
{
|
||||
bool extractFile(QuaZip* zip, QString fileName, QString fileDest, std::size_t total,
|
||||
std::size_t& progress, QtCommon::QtProgressCallback callback) {
|
||||
// zip: object where to add the file
|
||||
// filename: real file name
|
||||
// fileincompress: file name of the compressed file
|
||||
|
|
@ -334,8 +299,7 @@ bool extractFile(QuaZip *zip,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool removeFile(QStringList listFile)
|
||||
{
|
||||
bool removeFile(QStringList listFile) {
|
||||
bool ret = true;
|
||||
// For each file
|
||||
for (int i = 0; i < listFile.count(); i++) {
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
#include <QDir>
|
||||
#include <QString>
|
||||
#include "qt_common/qt_common.h"
|
||||
#include <quazip.h>
|
||||
#include <zlib.h>
|
||||
#include "qt_common/qt_common.h"
|
||||
|
||||
/** This is a modified version of JlCompress **/
|
||||
namespace QtCommon::Compress {
|
||||
|
|
@ -15,49 +15,49 @@ namespace QtCommon::Compress {
|
|||
class Options {
|
||||
public:
|
||||
/**
|
||||
* The enum values refer to the comments in the open function of the quazipfile.h file.
|
||||
*
|
||||
* The value is represented by two hexadecimal characters,
|
||||
* the left character indicating the compression method,
|
||||
* and the right character indicating the compression level.
|
||||
*
|
||||
* method == 0 indicates that the file is not compressed but rather stored as is.
|
||||
* method == 8(Z_DEFLATED) indicates that zlib compression is used.
|
||||
*
|
||||
* A higher value of level indicates a smaller size of the compressed file,
|
||||
* although it also implies more time consumed during the compression process.
|
||||
*/
|
||||
enum CompressionStrategy
|
||||
{
|
||||
* The enum values refer to the comments in the open function of the quazipfile.h file.
|
||||
*
|
||||
* The value is represented by two hexadecimal characters,
|
||||
* the left character indicating the compression method,
|
||||
* and the right character indicating the compression level.
|
||||
*
|
||||
* method == 0 indicates that the file is not compressed but rather stored as is.
|
||||
* method == 8(Z_DEFLATED) indicates that zlib compression is used.
|
||||
*
|
||||
* A higher value of level indicates a smaller size of the compressed file,
|
||||
* although it also implies more time consumed during the compression process.
|
||||
*/
|
||||
enum CompressionStrategy {
|
||||
/// Storage without compression
|
||||
Storage = 0x00, // Z_NO_COMPRESSION 0
|
||||
/// The fastest compression speed
|
||||
Fastest = 0x81, // Z_BEST_SPEED 1
|
||||
/// Relatively fast compression speed
|
||||
Faster = 0x83,
|
||||
Storage = 0x00, // Z_NO_COMPRESSION 0
|
||||
/// The fastest compression speed
|
||||
Fastest = 0x81, // Z_BEST_SPEED 1
|
||||
/// Relatively fast compression speed
|
||||
Faster = 0x83,
|
||||
/// Standard compression speed and ratio
|
||||
Standard = 0x86,
|
||||
/// Better compression ratio
|
||||
Better = 0x87,
|
||||
Better = 0x87,
|
||||
/// The best compression ratio
|
||||
Best = 0x89, // Z_BEST_COMPRESSION 9
|
||||
/// The default compression strategy, according to the open function of quazipfile.h,
|
||||
/// the value of method is Z_DEFLATED, and the value of level is Z_DEFAULT_COMPRESSION -1 (equals lvl 6)
|
||||
Default = 0xff
|
||||
Best = 0x89, // Z_BEST_COMPRESSION 9
|
||||
/// The default compression strategy, according to the open function of
|
||||
/// quazipfile.h, the value of method is Z_DEFLATED, and the value of level is
|
||||
/// Z_DEFAULT_COMPRESSION -1 (equals lvl 6)
|
||||
Default = 0xff
|
||||
};
|
||||
|
||||
public:
|
||||
explicit Options(const CompressionStrategy& strategy)
|
||||
: m_compressionStrategy(strategy) {}
|
||||
explicit Options(const CompressionStrategy& strategy) : m_compressionStrategy(strategy) {}
|
||||
|
||||
explicit Options(const QDateTime& dateTime = QDateTime(), const CompressionStrategy& strategy = Default)
|
||||
explicit Options(const QDateTime& dateTime = QDateTime(),
|
||||
const CompressionStrategy& strategy = Default)
|
||||
: m_dateTime(dateTime), m_compressionStrategy(strategy) {}
|
||||
|
||||
QDateTime getDateTime() const {
|
||||
return m_dateTime;
|
||||
}
|
||||
|
||||
void setDateTime(const QDateTime &dateTime) {
|
||||
void setDateTime(const QDateTime& dateTime) {
|
||||
m_dateTime = dateTime;
|
||||
}
|
||||
|
||||
|
|
@ -70,10 +70,11 @@ public:
|
|||
}
|
||||
|
||||
int getCompressionLevel() const {
|
||||
return m_compressionStrategy != Default ? m_compressionStrategy & 0x0f : Z_DEFAULT_COMPRESSION;
|
||||
return m_compressionStrategy != Default ? m_compressionStrategy & 0x0f
|
||||
: Z_DEFAULT_COMPRESSION;
|
||||
}
|
||||
|
||||
void setCompressionStrategy(const CompressionStrategy &strategy) {
|
||||
void setCompressionStrategy(const CompressionStrategy& strategy) {
|
||||
m_compressionStrategy = strategy;
|
||||
}
|
||||
|
||||
|
|
@ -89,34 +90,21 @@ private:
|
|||
* @param fileCompressed Destination file
|
||||
* @param dir The directory to compress
|
||||
* @param options Compression level, etc
|
||||
* @param callback Callback that takes in two std::size_t (total, progress) and returns false if the current operation should be cancelled.
|
||||
* @param callback Callback that takes in two std::size_t (total, progress) and returns false
|
||||
* if the current operation should be cancelled.
|
||||
*/
|
||||
bool compressDir(QString fileCompressed,
|
||||
QString dir,
|
||||
const Options& options = Options(),
|
||||
bool compressDir(QString fileCompressed, QString dir, const Options& options = Options(),
|
||||
QtCommon::QtProgressCallback callback = {});
|
||||
|
||||
// Internal //
|
||||
bool compressSubDir(QuaZip *zip,
|
||||
QString dir,
|
||||
QString origDir,
|
||||
const Options &options,
|
||||
std::size_t total,
|
||||
std::size_t &progress,
|
||||
bool compressSubDir(QuaZip* zip, QString dir, QString origDir, const Options& options,
|
||||
std::size_t total, std::size_t& progress,
|
||||
QtCommon::QtProgressCallback callback);
|
||||
|
||||
bool compressFile(QuaZip *zip,
|
||||
QString fileName,
|
||||
QString fileDest,
|
||||
const Options &options,
|
||||
std::size_t total,
|
||||
std::size_t &progress,
|
||||
QtCommon::QtProgressCallback callback);
|
||||
bool compressFile(QuaZip* zip, QString fileName, QString fileDest, const Options& options,
|
||||
std::size_t total, std::size_t& progress, QtCommon::QtProgressCallback callback);
|
||||
|
||||
bool copyData(QIODevice &inFile,
|
||||
QIODevice &outFile,
|
||||
std::size_t total,
|
||||
std::size_t &progress,
|
||||
bool copyData(QIODevice& inFile, QIODevice& outFile, std::size_t total, std::size_t& progress,
|
||||
QtCommon::QtProgressCallback callback);
|
||||
|
||||
// Extract //
|
||||
|
|
@ -125,20 +113,18 @@ bool copyData(QIODevice &inFile,
|
|||
* @brief Extract a zip file and report its progress.
|
||||
* @param fileCompressed Compressed file
|
||||
* @param dir The directory to push the results to
|
||||
* @param callback Callback that takes in two std::size_t (total, progress) and returns false if the current operation should be cancelled.
|
||||
* @param callback Callback that takes in two std::size_t (total, progress) and returns false
|
||||
* if the current operation should be cancelled.
|
||||
*/
|
||||
QStringList extractDir(QString fileCompressed, QString dir, QtCommon::QtProgressCallback callback = {});
|
||||
QStringList extractDir(QString fileCompressed, QString dir,
|
||||
QtCommon::QtProgressCallback callback = {});
|
||||
|
||||
// Internal //
|
||||
QStringList extractDir(QuaZip &zip, const QString &dir, QtCommon::QtProgressCallback callback);
|
||||
QStringList extractDir(QuaZip& zip, const QString& dir, QtCommon::QtProgressCallback callback);
|
||||
|
||||
bool extractFile(QuaZip *zip,
|
||||
QString fileName,
|
||||
QString fileDest,
|
||||
std::size_t total,
|
||||
std::size_t &progress,
|
||||
QtCommon::QtProgressCallback callback);
|
||||
bool extractFile(QuaZip* zip, QString fileName, QString fileDest, std::size_t total,
|
||||
std::size_t& progress, QtCommon::QtProgressCallback callback);
|
||||
|
||||
bool removeFile(QStringList listFile);
|
||||
|
||||
}
|
||||
} // namespace QtCommon::Compress
|
||||
|
|
|
|||
|
|
@ -15,17 +15,16 @@
|
|||
#include "qt_common/abstract/progress.h"
|
||||
#include "qt_common/qt_common.h"
|
||||
|
||||
#include <JlCompress.h>
|
||||
#include <QFuture>
|
||||
#include <QFutureWatcher>
|
||||
#include <QtConcurrentRun>
|
||||
#include <JlCompress.h>
|
||||
|
||||
namespace QtCommon::Content {
|
||||
|
||||
bool CheckGameFirmware(u64 program_id)
|
||||
{
|
||||
if (FirmwareManager::GameRequiresFirmware(program_id)
|
||||
&& !FirmwareManager::CheckFirmwarePresence(*system)) {
|
||||
bool CheckGameFirmware(u64 program_id) {
|
||||
if (FirmwareManager::GameRequiresFirmware(program_id) &&
|
||||
!FirmwareManager::CheckFirmwarePresence(*system)) {
|
||||
auto result = QtCommon::Frontend::Warning(
|
||||
tr("Game Requires Firmware"),
|
||||
tr("The game you are trying to launch requires firmware to boot or to get past the "
|
||||
|
|
@ -39,11 +38,10 @@ bool CheckGameFirmware(u64 program_id)
|
|||
return true;
|
||||
}
|
||||
|
||||
void InstallFirmware(const QString& location, bool recursive)
|
||||
{
|
||||
void InstallFirmware(const QString& location, bool recursive) {
|
||||
// Initialize a progress dialog.
|
||||
auto progress = QtCommon::Frontend::newProgressDialog(tr("Installing Firmware..."),
|
||||
tr("Cancel"), 0, 100);
|
||||
auto progress =
|
||||
QtCommon::Frontend::newProgressDialog(tr("Installing Firmware..."), tr("Cancel"), 0, 100);
|
||||
progress->show();
|
||||
|
||||
QGuiApplication::processEvents();
|
||||
|
|
@ -61,9 +59,7 @@ void InstallFirmware(const QString& location, bool recursive)
|
|||
FirmwareInstallResult result;
|
||||
|
||||
const auto ShowMessage = [&]() {
|
||||
QtCommon::Frontend::ShowMessage(icon,
|
||||
failedTitle,
|
||||
GetFirmwareInstallResultString(result));
|
||||
QtCommon::Frontend::ShowMessage(icon, failedTitle, GetFirmwareInstallResultString(result));
|
||||
};
|
||||
|
||||
LOG_INFO(Frontend, "Installing firmware from {}", location.toStdString());
|
||||
|
|
@ -88,12 +84,10 @@ void InstallFirmware(const QString& location, bool recursive)
|
|||
callback(100, 10);
|
||||
|
||||
if (recursive) {
|
||||
Common::FS::IterateDirEntriesRecursively(firmware_source_path,
|
||||
dir_callback,
|
||||
Common::FS::IterateDirEntriesRecursively(firmware_source_path, dir_callback,
|
||||
Common::FS::DirEntryFilter::File);
|
||||
} else {
|
||||
Common::FS::IterateDirEntries(firmware_source_path,
|
||||
dir_callback,
|
||||
Common::FS::IterateDirEntries(firmware_source_path, dir_callback,
|
||||
Common::FS::DirEntryFilter::File);
|
||||
}
|
||||
|
||||
|
|
@ -106,8 +100,8 @@ void InstallFirmware(const QString& location, bool recursive)
|
|||
|
||||
// Locate and erase the content of nand/system/Content/registered/*.nca, if any.
|
||||
auto sysnand_content_vdir = system->GetFileSystemController().GetSystemNANDContentDirectory();
|
||||
if (sysnand_content_vdir->IsWritable()
|
||||
&& !sysnand_content_vdir->CleanSubdirectoryRecursive("registered")) {
|
||||
if (sysnand_content_vdir->IsWritable() &&
|
||||
!sysnand_content_vdir->CleanSubdirectoryRecursive("registered")) {
|
||||
result = FirmwareInstallResult::FailedDelete;
|
||||
icon = QtCommon::Frontend::Icon::Critical;
|
||||
ShowMessage();
|
||||
|
|
@ -125,16 +119,14 @@ void InstallFirmware(const QString& location, bool recursive)
|
|||
int i = 0;
|
||||
for (const auto& firmware_src_path : out) {
|
||||
i++;
|
||||
auto firmware_src_vfile = vfs->OpenFile(firmware_src_path.generic_string(),
|
||||
FileSys::OpenMode::Read);
|
||||
auto firmware_dst_vfile = firmware_vdir->CreateFileRelative(
|
||||
firmware_src_path.filename().string());
|
||||
auto firmware_src_vfile =
|
||||
vfs->OpenFile(firmware_src_path.generic_string(), FileSys::OpenMode::Read);
|
||||
auto firmware_dst_vfile =
|
||||
firmware_vdir->CreateFileRelative(firmware_src_path.filename().string());
|
||||
|
||||
if (!VfsRawCopy(firmware_src_vfile, firmware_dst_vfile)) {
|
||||
LOG_ERROR(Frontend,
|
||||
"Failed to copy firmware file {} to {} in registered folder!",
|
||||
firmware_src_path.generic_string(),
|
||||
firmware_src_path.filename().string());
|
||||
LOG_ERROR(Frontend, "Failed to copy firmware file {} to {} in registered folder!",
|
||||
firmware_src_path.generic_string(), firmware_src_path.filename().string());
|
||||
success = false;
|
||||
}
|
||||
|
||||
|
|
@ -162,14 +154,12 @@ void InstallFirmware(const QString& location, bool recursive)
|
|||
return progress->wasCanceled();
|
||||
};
|
||||
|
||||
auto results = ContentManager::VerifyInstalledContents(*QtCommon::system,
|
||||
*QtCommon::provider,
|
||||
VerifyFirmwareCallback,
|
||||
true);
|
||||
auto results = ContentManager::VerifyInstalledContents(*QtCommon::system, *QtCommon::provider,
|
||||
VerifyFirmwareCallback, true);
|
||||
|
||||
if (results.size() > 0) {
|
||||
const auto failed_names = QString::fromStdString(
|
||||
fmt::format("{}", fmt::join(results, "\n")));
|
||||
const auto failed_names =
|
||||
QString::fromStdString(fmt::format("{}", fmt::join(results, "\n")));
|
||||
progress->close();
|
||||
QtCommon::Frontend::Critical(
|
||||
tr("Firmware integrity verification failed!"),
|
||||
|
|
@ -185,13 +175,11 @@ void InstallFirmware(const QString& location, bool recursive)
|
|||
const std::string display_version(firmware_data.display_version.data());
|
||||
|
||||
result = FirmwareInstallResult::Success;
|
||||
QtCommon::Frontend::Information(successTitle,
|
||||
GetFirmwareInstallResultString(result).arg(
|
||||
QString::fromStdString(display_version)));
|
||||
QtCommon::Frontend::Information(successTitle, GetFirmwareInstallResultString(result).arg(
|
||||
QString::fromStdString(display_version)));
|
||||
}
|
||||
|
||||
QString UnzipFirmwareToTmp(const QString& location)
|
||||
{
|
||||
QString UnzipFirmwareToTmp(const QString& location) {
|
||||
namespace fs = std::filesystem;
|
||||
fs::path tmp{fs::temp_directory_path()};
|
||||
|
||||
|
|
@ -216,8 +204,7 @@ QString UnzipFirmwareToTmp(const QString& location)
|
|||
}
|
||||
|
||||
// Content //
|
||||
void VerifyGameContents(const std::string& game_path)
|
||||
{
|
||||
void VerifyGameContents(const std::string& game_path) {
|
||||
auto progress =
|
||||
QtCommon::Frontend::newProgressDialog(tr("Verifying integrity..."), tr("Cancel"), 0, 100);
|
||||
progress->show();
|
||||
|
|
@ -234,34 +221,30 @@ void VerifyGameContents(const std::string& game_path)
|
|||
|
||||
switch (result) {
|
||||
case ContentManager::GameVerificationResult::Success:
|
||||
QtCommon::Frontend::Information(rootObject,
|
||||
tr("Integrity verification succeeded!"),
|
||||
QtCommon::Frontend::Information(rootObject, tr("Integrity verification succeeded!"),
|
||||
tr("The operation completed successfully."));
|
||||
break;
|
||||
case ContentManager::GameVerificationResult::Failed:
|
||||
QtCommon::Frontend::Critical(rootObject,
|
||||
tr("Integrity verification failed!"),
|
||||
QtCommon::Frontend::Critical(rootObject, tr("Integrity verification failed!"),
|
||||
tr("File contents may be corrupt or missing."));
|
||||
break;
|
||||
case ContentManager::GameVerificationResult::NotImplemented:
|
||||
QtCommon::Frontend::Warning(
|
||||
rootObject,
|
||||
tr("Integrity verification couldn't be performed"),
|
||||
rootObject, tr("Integrity verification couldn't be performed"),
|
||||
tr("Firmware installation cancelled, firmware may be in a bad state or corrupted. "
|
||||
"File contents could not be checked for validity."));
|
||||
}
|
||||
}
|
||||
|
||||
void InstallKeys()
|
||||
{
|
||||
void InstallKeys() {
|
||||
const QString key_source_location = QtCommon::Frontend::GetOpenFileName(
|
||||
tr("Select Dumped Keys Location"), {}, QStringLiteral("Decryption Keys (*.keys)"), {});
|
||||
|
||||
if (key_source_location.isEmpty())
|
||||
return;
|
||||
|
||||
FirmwareManager::KeyInstallResult result
|
||||
= FirmwareManager::InstallKeys(key_source_location.toStdString(), "keys");
|
||||
FirmwareManager::KeyInstallResult result =
|
||||
FirmwareManager::InstallKeys(key_source_location.toStdString(), "keys");
|
||||
|
||||
system->GetFileSystemController().CreateFactories(*QtCommon::vfs);
|
||||
|
||||
|
|
@ -276,11 +259,10 @@ void InstallKeys()
|
|||
}
|
||||
}
|
||||
|
||||
void VerifyInstalledContents()
|
||||
{
|
||||
void VerifyInstalledContents() {
|
||||
// Initialize a progress dialog.
|
||||
auto progress = QtCommon::Frontend::newProgressDialog(tr("Verifying integrity..."),
|
||||
tr("Cancel"), 0, 100);
|
||||
auto progress =
|
||||
QtCommon::Frontend::newProgressDialog(tr("Verifying integrity..."), tr("Cancel"), 0, 100);
|
||||
progress->show();
|
||||
|
||||
QGuiApplication::processEvents();
|
||||
|
|
@ -289,7 +271,8 @@ void VerifyInstalledContents()
|
|||
auto QtProgressCallback = [&](size_t total_size, size_t processed_size) {
|
||||
QGuiApplication::processEvents();
|
||||
progress->setValue(static_cast<int>((processed_size * 100) / total_size));
|
||||
return progress->wasCanceled(); };
|
||||
return progress->wasCanceled();
|
||||
};
|
||||
|
||||
const std::vector<std::string> result = ContentManager::VerifyInstalledContents(
|
||||
*QtCommon::system, *QtCommon::provider, QtProgressCallback);
|
||||
|
|
@ -300,17 +283,18 @@ void VerifyInstalledContents()
|
|||
QtCommon::Frontend::Information(tr("Integrity verification succeeded!"),
|
||||
tr("The operation completed successfully."));
|
||||
} else {
|
||||
const auto failed_names = QString::fromStdString(fmt::format("{}", fmt::join(result, "\n")));
|
||||
const auto failed_names =
|
||||
QString::fromStdString(fmt::format("{}", fmt::join(result, "\n")));
|
||||
QtCommon::Frontend::Critical(
|
||||
tr("Integrity verification failed!"),
|
||||
tr("Verification failed for the following files:\n\n%1").arg(failed_names));
|
||||
}
|
||||
}
|
||||
|
||||
void FixProfiles()
|
||||
{
|
||||
void FixProfiles() {
|
||||
// Reset user save files after config is initialized and migration is done.
|
||||
// Doing it at init time causes profiles to read from the wrong place entirely if NAND dir is not default
|
||||
// Doing it at init time causes profiles to read from the wrong place entirely if NAND dir is
|
||||
// not default
|
||||
// TODO: better solution
|
||||
system->GetProfileManager().ResetUserSaveFile();
|
||||
std::vector<std::string> orphaned = system->GetProfileManager().FindOrphanedProfiles();
|
||||
|
|
@ -350,28 +334,27 @@ void FixProfiles()
|
|||
"%2<br><br>"
|
||||
"Click \"OK\" to open your save folder and fix up your profiles.<br>"
|
||||
"Hint: copy the contents of the largest or last-modified folder elsewhere, "
|
||||
"delete all orphaned profiles, and move your copied contents to the good profile.<br><br>"
|
||||
"Still confused? See the <a href='https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/user/Orphaned.md'>help page</a>.<br>")
|
||||
"delete all orphaned profiles, and move your copied contents to the good "
|
||||
"profile.<br><br>"
|
||||
"Still confused? See the <a "
|
||||
"href='https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/user/"
|
||||
"Orphaned.md'>help page</a>.<br>")
|
||||
.arg(qorphaned, qgood));
|
||||
|
||||
QtCommon::Game::OpenSaveFolder();
|
||||
}
|
||||
|
||||
void ClearDataDir(FrontendCommon::DataManager::DataDir dir, const std::string& user_id)
|
||||
{
|
||||
void ClearDataDir(FrontendCommon::DataManager::DataDir dir, const std::string& user_id) {
|
||||
using namespace QtCommon::Frontend;
|
||||
auto result = Warning(tr("Really clear data?"),
|
||||
tr("Important data may be lost!"),
|
||||
Yes | No);
|
||||
auto result = Warning(tr("Really clear data?"), tr("Important data may be lost!"), Yes | No);
|
||||
|
||||
if (result != Yes)
|
||||
return;
|
||||
|
||||
result = Warning(
|
||||
tr("Are you REALLY sure?"),
|
||||
tr("Once deleted, your data will NOT come back!\n"
|
||||
"Only do this if you're 100% sure you want to delete this data."),
|
||||
Yes | No);
|
||||
result = Warning(tr("Are you REALLY sure?"),
|
||||
tr("Once deleted, your data will NOT come back!\n"
|
||||
"Only do this if you're 100% sure you want to delete this data."),
|
||||
Yes | No);
|
||||
|
||||
if (result != Yes)
|
||||
return;
|
||||
|
|
@ -384,17 +367,13 @@ void ClearDataDir(FrontendCommon::DataManager::DataDir dir, const std::string& u
|
|||
dialog->close();
|
||||
}
|
||||
|
||||
void ExportDataDir(FrontendCommon::DataManager::DataDir data_dir,
|
||||
const std::string& user_id,
|
||||
const QString& name,
|
||||
std::function<void()> callback)
|
||||
{
|
||||
void ExportDataDir(FrontendCommon::DataManager::DataDir data_dir, const std::string& user_id,
|
||||
const QString& name, std::function<void()> callback) {
|
||||
using namespace QtCommon::Frontend;
|
||||
const std::string dir = FrontendCommon::DataManager::GetDataDirString(data_dir, user_id);
|
||||
|
||||
const QString zip_dump_location = GetSaveFileName(tr("Select Export Location"),
|
||||
tr("%1.zip").arg(name),
|
||||
tr("Zipped Archives (*.zip)"));
|
||||
const QString zip_dump_location = GetSaveFileName(
|
||||
tr("Select Export Location"), tr("%1.zip").arg(name), tr("Zipped Archives (*.zip)"));
|
||||
|
||||
if (zip_dump_location.isEmpty())
|
||||
return;
|
||||
|
|
@ -406,18 +385,15 @@ void ExportDataDir(FrontendCommon::DataManager::DataDir data_dir,
|
|||
progress->show();
|
||||
|
||||
auto progress_callback = [=](size_t total_size, size_t processed_size) {
|
||||
QMetaObject::invokeMethod(progress,
|
||||
"setValue",
|
||||
Qt::DirectConnection,
|
||||
Q_ARG(int, static_cast<int>((processed_size * 100) / total_size)));
|
||||
QMetaObject::invokeMethod(
|
||||
progress, "setValue", Qt::DirectConnection,
|
||||
Q_ARG(int, static_cast<int>((processed_size * 100) / total_size)));
|
||||
return !progress->wasCanceled();
|
||||
};
|
||||
|
||||
QFuture<bool> future = QtConcurrent::run([=]() {
|
||||
return QtCommon::Compress::compressDir(zip_dump_location,
|
||||
QString::fromStdString(dir),
|
||||
QtCommon::Compress::Options(),
|
||||
progress_callback);
|
||||
return QtCommon::Compress::compressDir(zip_dump_location, QString::fromStdString(dir),
|
||||
QtCommon::Compress::Options(), progress_callback);
|
||||
});
|
||||
|
||||
QFutureWatcher<bool>* watcher = new QFutureWatcher<bool>(rootObject);
|
||||
|
|
@ -444,37 +420,34 @@ void ExportDataDir(FrontendCommon::DataManager::DataDir data_dir,
|
|||
watcher->setFuture(future);
|
||||
}
|
||||
|
||||
void ImportDataDir(FrontendCommon::DataManager::DataDir data_dir,
|
||||
const std::string& user_id,
|
||||
std::function<void()> callback)
|
||||
{
|
||||
void ImportDataDir(FrontendCommon::DataManager::DataDir data_dir, const std::string& user_id,
|
||||
std::function<void()> callback) {
|
||||
const std::string dir = FrontendCommon::DataManager::GetDataDirString(data_dir, user_id);
|
||||
|
||||
using namespace QtCommon::Frontend;
|
||||
|
||||
const QString zip_dump_location = GetOpenFileName(tr("Select Import Location"),
|
||||
{},
|
||||
tr("Zipped Archives (*.zip)"));
|
||||
const QString zip_dump_location =
|
||||
GetOpenFileName(tr("Select Import Location"), {}, tr("Zipped Archives (*.zip)"));
|
||||
|
||||
if (zip_dump_location.isEmpty())
|
||||
return;
|
||||
|
||||
StandardButton button = Warning(
|
||||
tr("Import Warning"),
|
||||
tr("All previous data in this directory will be deleted. Are you sure you wish to "
|
||||
"proceed?"),
|
||||
StandardButton::Yes | StandardButton::No);
|
||||
StandardButton button =
|
||||
Warning(tr("Import Warning"),
|
||||
tr("All previous data in this directory will be deleted. Are you sure you wish to "
|
||||
"proceed?"),
|
||||
StandardButton::Yes | StandardButton::No);
|
||||
|
||||
if (button != QtCommon::Frontend::Yes)
|
||||
return;
|
||||
|
||||
QtProgressDialog* progress = newProgressDialogPtr(
|
||||
tr("Importing data. This may take a while..."), tr("Cancel"), 0, 100);
|
||||
QtProgressDialog* progress =
|
||||
newProgressDialogPtr(tr("Importing data. This may take a while..."), tr("Cancel"), 0, 100);
|
||||
|
||||
progress->setTitle(tr("Importing"));
|
||||
progress->show();
|
||||
|
||||
// to prevent GUI mangling we have to run this in a thread as well
|
||||
// to prevent GUI mangling we have to run this in a thread as well
|
||||
QFuture<bool> delete_future = QtConcurrent::run([=]() {
|
||||
FrontendCommon::DataManager::ClearDir(data_dir, user_id);
|
||||
return !progress->wasCanceled();
|
||||
|
|
@ -485,17 +458,14 @@ void ImportDataDir(FrontendCommon::DataManager::DataDir data_dir,
|
|||
|
||||
QObject::connect(delete_watcher, &QFutureWatcher<bool>::finished, rootObject, [=]() {
|
||||
auto progress_callback = [=](size_t total_size, size_t processed_size) {
|
||||
QMetaObject::invokeMethod(progress,
|
||||
"setValue",
|
||||
Qt::DirectConnection,
|
||||
Q_ARG(int,
|
||||
static_cast<int>((processed_size * 100) / total_size)));
|
||||
QMetaObject::invokeMethod(
|
||||
progress, "setValue", Qt::DirectConnection,
|
||||
Q_ARG(int, static_cast<int>((processed_size * 100) / total_size)));
|
||||
return !progress->wasCanceled();
|
||||
};
|
||||
|
||||
QFuture<bool> future = QtConcurrent::run([=]() {
|
||||
return !QtCommon::Compress::extractDir(zip_dump_location,
|
||||
QString::fromStdString(dir),
|
||||
return !QtCommon::Compress::extractDir(zip_dump_location, QString::fromStdString(dir),
|
||||
progress_callback)
|
||||
.empty();
|
||||
});
|
||||
|
|
@ -505,7 +475,7 @@ void ImportDataDir(FrontendCommon::DataManager::DataDir data_dir,
|
|||
QObject::connect(watcher, &QFutureWatcher<bool>::finished, rootObject, [=]() {
|
||||
progress->close();
|
||||
|
||||
// this sucks
|
||||
// this sucks
|
||||
if (watcher->result()) {
|
||||
Information(tr("Imported Successfully"), tr("Data was imported successfully."));
|
||||
} else if (progress->wasCanceled()) {
|
||||
|
|
|
|||
|
|
@ -23,8 +23,7 @@ enum class FirmwareInstallResult {
|
|||
FailedCorrupted,
|
||||
};
|
||||
|
||||
inline const QString GetFirmwareInstallResultString(FirmwareInstallResult result)
|
||||
{
|
||||
inline const QString GetFirmwareInstallResultString(FirmwareInstallResult result) {
|
||||
return LOOKUP_ENUM(result, FwInstallSuccess);
|
||||
}
|
||||
|
||||
|
|
@ -33,30 +32,29 @@ inline const QString GetFirmwareInstallResultString(FirmwareInstallResult result
|
|||
* \param result The result code.
|
||||
* \return A string representation of the passed result code.
|
||||
*/
|
||||
inline const QString GetKeyInstallResultString(FirmwareManager::KeyInstallResult result)
|
||||
{
|
||||
inline const QString GetKeyInstallResultString(FirmwareManager::KeyInstallResult result) {
|
||||
return LOOKUP_ENUM(result, KeyInstallSuccess);
|
||||
}
|
||||
|
||||
void InstallFirmware(const QString &location, bool recursive);
|
||||
void InstallFirmware(const QString& location, bool recursive);
|
||||
|
||||
QString UnzipFirmwareToTmp(const QString &location);
|
||||
QString UnzipFirmwareToTmp(const QString& location);
|
||||
|
||||
// Keys //
|
||||
void InstallKeys();
|
||||
|
||||
// Content //
|
||||
void VerifyGameContents(const std::string &game_path);
|
||||
void VerifyGameContents(const std::string& game_path);
|
||||
void VerifyInstalledContents();
|
||||
|
||||
void ClearDataDir(FrontendCommon::DataManager::DataDir dir, const std::string &user_id = "");
|
||||
void ExportDataDir(FrontendCommon::DataManager::DataDir dir,
|
||||
const std::string &user_id = "",
|
||||
const QString &name = QStringLiteral("export"),
|
||||
void ClearDataDir(FrontendCommon::DataManager::DataDir dir, const std::string& user_id = "");
|
||||
void ExportDataDir(FrontendCommon::DataManager::DataDir dir, const std::string& user_id = "",
|
||||
const QString& name = QStringLiteral("export"),
|
||||
std::function<void()> callback = {});
|
||||
void ImportDataDir(FrontendCommon::DataManager::DataDir dir, const std::string& user_id = "",
|
||||
std::function<void()> callback = {});
|
||||
void ImportDataDir(FrontendCommon::DataManager::DataDir dir, const std::string &user_id = "", std::function<void()> callback = {});
|
||||
|
||||
// Profiles //
|
||||
void FixProfiles();
|
||||
}
|
||||
} // namespace QtCommon::Content
|
||||
#endif // QT_CONTENT_UTIL_H
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@ namespace fs = std::filesystem;
|
|||
|
||||
namespace QtCommon::FS {
|
||||
|
||||
void LinkRyujinx(std::filesystem::path &from, std::filesystem::path &to)
|
||||
{
|
||||
void LinkRyujinx(std::filesystem::path& from, std::filesystem::path& to) {
|
||||
std::error_code ec;
|
||||
|
||||
// "ignore" errors--if the dir fails to be deleted, error handling later will handle it
|
||||
|
|
@ -25,12 +24,12 @@ void LinkRyujinx(std::filesystem::path &from, std::filesystem::path &to)
|
|||
} else {
|
||||
QtCommon::Frontend::Critical(
|
||||
tr("Failed to link save data"),
|
||||
tr("Could not link directory:\n\t%1\nTo:\n\t%2").arg(QString::fromStdString(from.string()), QString::fromStdString(to.string())));
|
||||
tr("Could not link directory:\n\t%1\nTo:\n\t%2")
|
||||
.arg(QString::fromStdString(from.string()), QString::fromStdString(to.string())));
|
||||
}
|
||||
}
|
||||
|
||||
bool CheckUnlink(const fs::path &eden_dir, const fs::path &ryu_dir)
|
||||
{
|
||||
bool CheckUnlink(const fs::path& eden_dir, const fs::path& ryu_dir) {
|
||||
bool eden_link = Common::FS::IsSymlink(eden_dir);
|
||||
bool ryu_link = Common::FS::IsSymlink(ryu_dir);
|
||||
|
||||
|
|
@ -64,7 +63,7 @@ bool CheckUnlink(const fs::path &eden_dir, const fs::path &ryu_dir)
|
|||
// NB: do NOT use remove_all, as Windows treats this as a remove_all to the target,
|
||||
// NOT the junction
|
||||
fs::remove(linked);
|
||||
} catch (std::exception &e) {
|
||||
} catch (std::exception& e) {
|
||||
QtCommon::Frontend::Critical(
|
||||
tr("Failed to unlink old directory"),
|
||||
tr("OS returned error: %1").arg(QString::fromStdString(e.what())));
|
||||
|
|
@ -74,7 +73,7 @@ bool CheckUnlink(const fs::path &eden_dir, const fs::path &ryu_dir)
|
|||
// then COPY the other dir
|
||||
try {
|
||||
fs::copy(orig, linked, fs::copy_options::recursive);
|
||||
} catch (std::exception &e) {
|
||||
} catch (std::exception& e) {
|
||||
QtCommon::Frontend::Critical(
|
||||
tr("Failed to copy save data"),
|
||||
tr("OS returned error: %1").arg(QString::fromStdString(e.what())));
|
||||
|
|
@ -87,8 +86,7 @@ bool CheckUnlink(const fs::path &eden_dir, const fs::path &ryu_dir)
|
|||
return true;
|
||||
}
|
||||
|
||||
const fs::path GetRyujinxSavePath(const fs::path &path_hint, const u64 &program_id)
|
||||
{
|
||||
const fs::path GetRyujinxSavePath(const fs::path& path_hint, const u64& program_id) {
|
||||
auto ryu_path = path_hint;
|
||||
|
||||
auto kvdb_path = Common::FS::GetKvdbPath(ryu_path);
|
||||
|
|
@ -99,10 +97,13 @@ const fs::path GetRyujinxSavePath(const fs::path &path_hint, const u64 &program_
|
|||
tr("Could not find Ryujinx installation"),
|
||||
tr("Could not find a valid Ryujinx installation. This may typically occur if you are "
|
||||
"using Ryujinx in portable mode.\n\nWould you like to manually select a portable "
|
||||
"folder to use?"), StandardButton::Yes | StandardButton::No);
|
||||
"folder to use?"),
|
||||
StandardButton::Yes | StandardButton::No);
|
||||
|
||||
if (res == StandardButton::Yes) {
|
||||
auto selected_path = GetExistingDirectory(tr("Ryujinx Portable Location"), QDir::homePath()).toStdString();
|
||||
auto selected_path =
|
||||
GetExistingDirectory(tr("Ryujinx Portable Location"), QDir::homePath())
|
||||
.toStdString();
|
||||
if (selected_path.empty())
|
||||
return fs::path{};
|
||||
|
||||
|
|
@ -131,7 +132,7 @@ const fs::path GetRyujinxSavePath(const fs::path &path_hint, const u64 &program_
|
|||
Common::FS::IMENReadResult res = Common::FS::ReadKvdb(kvdb_path, imens);
|
||||
|
||||
if (res == Common::FS::IMENReadResult::Success) {
|
||||
for (const Common::FS::IMEN &imen : imens) {
|
||||
for (const Common::FS::IMEN& imen : imens) {
|
||||
if (imen.title_id == program_id)
|
||||
return Common::FS::GetRyuSavePath(ryu_path, imen.save_id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include <filesystem>
|
||||
#include <optional>
|
||||
#include "common/common_types.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace QtCommon::FS {
|
||||
|
||||
void LinkRyujinx(std::filesystem::path &from, std::filesystem::path &to);
|
||||
const std::filesystem::path GetRyujinxSavePath(const std::filesystem::path &path_hint, const u64 &program_id);
|
||||
void LinkRyujinx(std::filesystem::path& from, std::filesystem::path& to);
|
||||
const std::filesystem::path GetRyujinxSavePath(const std::filesystem::path& path_hint,
|
||||
const u64& program_id);
|
||||
|
||||
/// returns FALSE if the dirs are NOT linked
|
||||
bool CheckUnlink(const std::filesystem::path& eden_dir,
|
||||
const std::filesystem::path& ryu_dir);
|
||||
bool CheckUnlink(const std::filesystem::path& eden_dir, const std::filesystem::path& ryu_dir);
|
||||
|
||||
} // namespace QtCommon::FS
|
||||
|
|
|
|||
|
|
@ -18,40 +18,34 @@
|
|||
#include <QUrl>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "common/scope_exit.h"
|
||||
#include "common/string_util.h"
|
||||
#include <shlobj.h>
|
||||
#include <windows.h>
|
||||
#include "common/scope_exit.h"
|
||||
#include "common/string_util.h"
|
||||
#else
|
||||
#include "fmt/ostream.h"
|
||||
#include <fstream>
|
||||
#include "fmt/ostream.h"
|
||||
#endif
|
||||
|
||||
namespace QtCommon::Game {
|
||||
|
||||
bool CreateShortcutLink(const std::filesystem::path& shortcut_path,
|
||||
const std::string& comment,
|
||||
bool CreateShortcutLink(const std::filesystem::path& shortcut_path, const std::string& comment,
|
||||
const std::filesystem::path& icon_path,
|
||||
const std::filesystem::path& command,
|
||||
const std::string& arguments,
|
||||
const std::string& categories,
|
||||
const std::string& keywords,
|
||||
const std::string& name)
|
||||
try {
|
||||
const std::filesystem::path& command, const std::string& arguments,
|
||||
const std::string& categories, const std::string& keywords,
|
||||
const std::string& name) try {
|
||||
#ifdef _WIN32 // Windows
|
||||
HRESULT hr = CoInitialize(nullptr);
|
||||
if (FAILED(hr)) {
|
||||
LOG_ERROR(Frontend, "CoInitialize failed");
|
||||
return false;
|
||||
}
|
||||
SCOPE_EXIT
|
||||
{
|
||||
SCOPE_EXIT {
|
||||
CoUninitialize();
|
||||
};
|
||||
IShellLinkW* ps1 = nullptr;
|
||||
IPersistFile* persist_file = nullptr;
|
||||
SCOPE_EXIT
|
||||
{
|
||||
SCOPE_EXIT {
|
||||
if (persist_file != nullptr) {
|
||||
persist_file->Release();
|
||||
}
|
||||
|
|
@ -59,10 +53,7 @@ try {
|
|||
ps1->Release();
|
||||
}
|
||||
};
|
||||
HRESULT hres = CoCreateInstance(CLSID_ShellLink,
|
||||
nullptr,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
IID_IShellLinkW,
|
||||
HRESULT hres = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_IShellLinkW,
|
||||
reinterpret_cast<void**>(&ps1));
|
||||
if (FAILED(hres)) {
|
||||
LOG_ERROR(Frontend, "Failed to create IShellLinkW instance");
|
||||
|
|
@ -142,10 +133,8 @@ try {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool MakeShortcutIcoPath(const u64 program_id,
|
||||
const std::string_view game_file_name,
|
||||
std::filesystem::path& out_icon_path)
|
||||
{
|
||||
bool MakeShortcutIcoPath(const u64 program_id, const std::string_view game_file_name,
|
||||
std::filesystem::path& out_icon_path) {
|
||||
// Get path to Yuzu icons directory & icon extension
|
||||
std::string ico_extension = "png";
|
||||
#if defined(_WIN32)
|
||||
|
|
@ -166,46 +155,38 @@ bool MakeShortcutIcoPath(const u64 program_id,
|
|||
return true;
|
||||
}
|
||||
|
||||
void OpenEdenFolder(const Common::FS::EdenPath& path)
|
||||
{
|
||||
void OpenEdenFolder(const Common::FS::EdenPath& path) {
|
||||
QDesktopServices::openUrl(
|
||||
QUrl::fromLocalFile(QString::fromStdString(Common::FS::GetEdenPathString(path))));
|
||||
}
|
||||
|
||||
void OpenRootDataFolder()
|
||||
{
|
||||
void OpenRootDataFolder() {
|
||||
OpenEdenFolder(Common::FS::EdenPath::EdenDir);
|
||||
}
|
||||
|
||||
void OpenNANDFolder()
|
||||
{
|
||||
void OpenNANDFolder() {
|
||||
OpenEdenFolder(Common::FS::EdenPath::NANDDir);
|
||||
}
|
||||
|
||||
void OpenSaveFolder()
|
||||
{
|
||||
const auto path = Common::FS::GetEdenPath(Common::FS::EdenPath::NANDDir)
|
||||
/ "user/save/0000000000000000";
|
||||
void OpenSaveFolder() {
|
||||
const auto path =
|
||||
Common::FS::GetEdenPath(Common::FS::EdenPath::NANDDir) / "user/save/0000000000000000";
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromStdString(path.string())));
|
||||
}
|
||||
|
||||
void OpenSDMCFolder()
|
||||
{
|
||||
void OpenSDMCFolder() {
|
||||
OpenEdenFolder(Common::FS::EdenPath::SDMCDir);
|
||||
}
|
||||
|
||||
void OpenModFolder()
|
||||
{
|
||||
void OpenModFolder() {
|
||||
OpenEdenFolder(Common::FS::EdenPath::LoadDir);
|
||||
}
|
||||
|
||||
void OpenLogFolder()
|
||||
{
|
||||
void OpenLogFolder() {
|
||||
OpenEdenFolder(Common::FS::EdenPath::LogDir);
|
||||
}
|
||||
|
||||
static QString GetGameListErrorRemoving(QtCommon::Game::InstalledEntryType type)
|
||||
{
|
||||
static QString GetGameListErrorRemoving(QtCommon::Game::InstalledEntryType type) {
|
||||
switch (type) {
|
||||
case QtCommon::Game::InstalledEntryType::Game:
|
||||
return tr("Error Removing Contents");
|
||||
|
|
@ -219,10 +200,9 @@ static QString GetGameListErrorRemoving(QtCommon::Game::InstalledEntryType type)
|
|||
}
|
||||
|
||||
// Game Content //
|
||||
void RemoveBaseContent(u64 program_id, InstalledEntryType type)
|
||||
{
|
||||
const auto res = ContentManager::RemoveBaseContent(system->GetFileSystemController(),
|
||||
program_id);
|
||||
void RemoveBaseContent(u64 program_id, InstalledEntryType type) {
|
||||
const auto res =
|
||||
ContentManager::RemoveBaseContent(system->GetFileSystemController(), program_id);
|
||||
if (res) {
|
||||
QtCommon::Frontend::Information(tr("Successfully Removed"),
|
||||
tr("Successfully removed the installed base game."));
|
||||
|
|
@ -234,8 +214,7 @@ void RemoveBaseContent(u64 program_id, InstalledEntryType type)
|
|||
}
|
||||
}
|
||||
|
||||
void RemoveUpdateContent(u64 program_id, InstalledEntryType type)
|
||||
{
|
||||
void RemoveUpdateContent(u64 program_id, InstalledEntryType type) {
|
||||
const auto res = ContentManager::RemoveUpdate(system->GetFileSystemController(), program_id);
|
||||
if (res) {
|
||||
QtCommon::Frontend::Information(tr("Successfully Removed"),
|
||||
|
|
@ -246,8 +225,7 @@ void RemoveUpdateContent(u64 program_id, InstalledEntryType type)
|
|||
}
|
||||
}
|
||||
|
||||
void RemoveAddOnContent(u64 program_id, InstalledEntryType type)
|
||||
{
|
||||
void RemoveAddOnContent(u64 program_id, InstalledEntryType type) {
|
||||
const size_t count = ContentManager::RemoveAllDLC(*system, program_id);
|
||||
if (count == 0) {
|
||||
QtCommon::Frontend::Warning(GetGameListErrorRemoving(type),
|
||||
|
|
@ -261,8 +239,7 @@ void RemoveAddOnContent(u64 program_id, InstalledEntryType type)
|
|||
|
||||
// Global Content //
|
||||
|
||||
void RemoveTransferableShaderCache(u64 program_id, GameListRemoveTarget target)
|
||||
{
|
||||
void RemoveTransferableShaderCache(u64 program_id, GameListRemoveTarget target) {
|
||||
const auto target_file_name = [target] {
|
||||
switch (target) {
|
||||
case GameListRemoveTarget::GlShaderCache:
|
||||
|
|
@ -291,8 +268,7 @@ void RemoveTransferableShaderCache(u64 program_id, GameListRemoveTarget target)
|
|||
}
|
||||
}
|
||||
|
||||
void RemoveVulkanDriverPipelineCache(u64 program_id)
|
||||
{
|
||||
void RemoveVulkanDriverPipelineCache(u64 program_id) {
|
||||
static constexpr std::string_view target_file_name = "vulkan_pipelines.bin";
|
||||
|
||||
const auto shader_cache_dir = Common::FS::GetEdenPath(Common::FS::EdenPath::ShaderDir);
|
||||
|
|
@ -308,8 +284,7 @@ void RemoveVulkanDriverPipelineCache(u64 program_id)
|
|||
}
|
||||
}
|
||||
|
||||
void RemoveAllTransferableShaderCaches(u64 program_id)
|
||||
{
|
||||
void RemoveAllTransferableShaderCaches(u64 program_id) {
|
||||
const auto shader_cache_dir = Common::FS::GetEdenPath(Common::FS::EdenPath::ShaderDir);
|
||||
const auto program_shader_cache_dir = shader_cache_dir / fmt::format("{:016x}", program_id);
|
||||
|
||||
|
|
@ -329,14 +304,13 @@ void RemoveAllTransferableShaderCaches(u64 program_id)
|
|||
}
|
||||
}
|
||||
|
||||
void RemoveCustomConfiguration(u64 program_id, const std::string& game_path)
|
||||
{
|
||||
void RemoveCustomConfiguration(u64 program_id, const std::string& game_path) {
|
||||
const auto file_path = std::filesystem::path(Common::FS::ToU8String(game_path));
|
||||
const auto config_file_name
|
||||
= program_id == 0 ? Common::FS::PathToUTF8String(file_path.filename()).append(".ini")
|
||||
: fmt::format("{:016X}.ini", program_id);
|
||||
const auto custom_config_file_path = Common::FS::GetEdenPath(Common::FS::EdenPath::ConfigDir)
|
||||
/ "custom" / config_file_name;
|
||||
const auto config_file_name =
|
||||
program_id == 0 ? Common::FS::PathToUTF8String(file_path.filename()).append(".ini")
|
||||
: fmt::format("{:016X}.ini", program_id);
|
||||
const auto custom_config_file_path =
|
||||
Common::FS::GetEdenPath(Common::FS::EdenPath::ConfigDir) / "custom" / config_file_name;
|
||||
|
||||
if (!Common::FS::Exists(custom_config_file_path)) {
|
||||
QtCommon::Frontend::Warning(tr("Error Removing Custom Configuration"),
|
||||
|
|
@ -353,20 +327,14 @@ void RemoveCustomConfiguration(u64 program_id, const std::string& game_path)
|
|||
}
|
||||
}
|
||||
|
||||
void RemoveCacheStorage(u64 program_id)
|
||||
{
|
||||
void RemoveCacheStorage(u64 program_id) {
|
||||
const auto nand_dir = Common::FS::GetEdenPath(Common::FS::EdenPath::NANDDir);
|
||||
auto vfs_nand_dir = vfs->OpenDirectory(Common::FS::PathToUTF8String(nand_dir),
|
||||
FileSys::OpenMode::Read);
|
||||
auto vfs_nand_dir =
|
||||
vfs->OpenDirectory(Common::FS::PathToUTF8String(nand_dir), FileSys::OpenMode::Read);
|
||||
|
||||
const auto cache_storage_path
|
||||
= FileSys::SaveDataFactory::GetFullPath({},
|
||||
vfs_nand_dir,
|
||||
FileSys::SaveDataSpaceId::User,
|
||||
FileSys::SaveDataType::Cache,
|
||||
0 /* program_id */,
|
||||
{},
|
||||
0);
|
||||
const auto cache_storage_path = FileSys::SaveDataFactory::GetFullPath(
|
||||
{}, vfs_nand_dir, FileSys::SaveDataSpaceId::User, FileSys::SaveDataType::Cache,
|
||||
0 /* program_id */, {}, 0);
|
||||
|
||||
const auto path = Common::FS::ConcatPathSafe(nand_dir, cache_storage_path);
|
||||
|
||||
|
|
@ -400,8 +368,7 @@ void ResetMetadata(bool show_message) {
|
|||
// Uhhh //
|
||||
|
||||
// Messages in pre-defined message boxes for less code spaghetti
|
||||
inline constexpr bool CreateShortcutMessagesGUI(ShortcutMessages imsg, const QString& game_title)
|
||||
{
|
||||
inline constexpr bool CreateShortcutMessagesGUI(ShortcutMessages imsg, const QString& game_title) {
|
||||
int result = 0;
|
||||
using namespace QtCommon::Frontend;
|
||||
int buttons;
|
||||
|
|
@ -433,13 +400,9 @@ inline constexpr bool CreateShortcutMessagesGUI(ShortcutMessages imsg, const QSt
|
|||
}
|
||||
}
|
||||
|
||||
void CreateShortcut(const std::string& game_path,
|
||||
const u64 program_id,
|
||||
const std::string& game_title_,
|
||||
const ShortcutTarget& target,
|
||||
std::string arguments_,
|
||||
const bool needs_title)
|
||||
{
|
||||
void CreateShortcut(const std::string& game_path, const u64 program_id,
|
||||
const std::string& game_title_, const ShortcutTarget& target,
|
||||
std::string arguments_, const bool needs_title) {
|
||||
// Get path to Eden executable
|
||||
std::filesystem::path command = GetEdenCommand();
|
||||
|
||||
|
|
@ -453,13 +416,11 @@ void CreateShortcut(const std::string& game_path,
|
|||
return;
|
||||
}
|
||||
|
||||
const FileSys::PatchManager pm{program_id,
|
||||
QtCommon::system->GetFileSystemController(),
|
||||
const FileSys::PatchManager pm{program_id, QtCommon::system->GetFileSystemController(),
|
||||
QtCommon::system->GetContentProvider()};
|
||||
const auto control = pm.GetControlMetadata();
|
||||
const auto loader = Loader::GetLoader(*QtCommon::system,
|
||||
QtCommon::vfs->OpenFile(game_path,
|
||||
FileSys::OpenMode::Read));
|
||||
const auto loader = Loader::GetLoader(
|
||||
*QtCommon::system, QtCommon::vfs->OpenFile(game_path, FileSys::OpenMode::Read));
|
||||
|
||||
std::string game_title{game_title_};
|
||||
|
||||
|
|
@ -490,8 +451,8 @@ void CreateShortcut(const std::string& game_path,
|
|||
LOG_WARNING(Frontend, "Could not read icon from {:s}", game_path);
|
||||
}
|
||||
|
||||
QImage icon_data = QImage::fromData(icon_image_file.data(),
|
||||
static_cast<int>(icon_image_file.size()));
|
||||
QImage icon_data =
|
||||
QImage::fromData(icon_image_file.data(), static_cast<int>(icon_image_file.size()));
|
||||
std::filesystem::path out_icon_path;
|
||||
if (QtCommon::Game::MakeShortcutIcoPath(program_id, game_title, out_icon_path)) {
|
||||
if (!SaveIconToFile(out_icon_path, icon_data)) {
|
||||
|
|
@ -524,39 +485,32 @@ void CreateShortcut(const std::string& game_path,
|
|||
const std::string categories = "Game;Emulator;Qt;";
|
||||
const std::string keywords = "Switch;Nintendo;";
|
||||
|
||||
if (QtCommon::Game::CreateShortcutLink(shortcut_path,
|
||||
comment,
|
||||
out_icon_path,
|
||||
command,
|
||||
arguments,
|
||||
categories,
|
||||
keywords,
|
||||
game_title)) {
|
||||
if (QtCommon::Game::CreateShortcutLink(shortcut_path, comment, out_icon_path, command,
|
||||
arguments, categories, keywords, game_title)) {
|
||||
CreateShortcutMessagesGUI(ShortcutMessages::Success, qgame_title);
|
||||
return;
|
||||
}
|
||||
CreateShortcutMessagesGUI(ShortcutMessages::Failed, qgame_title);
|
||||
}
|
||||
|
||||
// TODO: You want this to be constexpr? Well too bad, clang19 doesn't believe this is a string literal
|
||||
std::string GetShortcutPath(ShortcutTarget target)
|
||||
{
|
||||
// TODO: You want this to be constexpr? Well too bad, clang19 doesn't believe this is a string
|
||||
// literal
|
||||
std::string GetShortcutPath(ShortcutTarget target) {
|
||||
{
|
||||
std::string shortcut_path{};
|
||||
if (target == ShortcutTarget::Desktop) {
|
||||
shortcut_path
|
||||
= QStandardPaths::writableLocation(QStandardPaths::DesktopLocation).toStdString();
|
||||
shortcut_path =
|
||||
QStandardPaths::writableLocation(QStandardPaths::DesktopLocation).toStdString();
|
||||
} else if (target == ShortcutTarget::Applications) {
|
||||
shortcut_path
|
||||
= QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation).toStdString();
|
||||
shortcut_path = QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation)
|
||||
.toStdString();
|
||||
}
|
||||
|
||||
return shortcut_path;
|
||||
}
|
||||
}
|
||||
|
||||
void CreateHomeMenuShortcut(ShortcutTarget target)
|
||||
{
|
||||
void CreateHomeMenuShortcut(ShortcutTarget target) {
|
||||
constexpr u64 QLaunchId = static_cast<u64>(Service::AM::AppletProgramId::QLaunch);
|
||||
auto bis_system = QtCommon::system->GetFileSystemController().GetSystemNANDContents();
|
||||
if (!bis_system) {
|
||||
|
|
|
|||
|
|
@ -29,27 +29,18 @@ enum class ShortcutTarget {
|
|||
Applications,
|
||||
};
|
||||
|
||||
enum class ShortcutMessages{
|
||||
Fullscreen = 0,
|
||||
Success = 1,
|
||||
Volatile = 2,
|
||||
Failed = 3
|
||||
};
|
||||
enum class ShortcutMessages { Fullscreen = 0, Success = 1, Volatile = 2, Failed = 3 };
|
||||
|
||||
bool CreateShortcutLink(const std::filesystem::path& shortcut_path,
|
||||
const std::string& comment,
|
||||
bool CreateShortcutLink(const std::filesystem::path& shortcut_path, const std::string& comment,
|
||||
const std::filesystem::path& icon_path,
|
||||
const std::filesystem::path& command,
|
||||
const std::string& arguments,
|
||||
const std::string& categories,
|
||||
const std::string& keywords,
|
||||
const std::filesystem::path& command, const std::string& arguments,
|
||||
const std::string& categories, const std::string& keywords,
|
||||
const std::string& name);
|
||||
|
||||
bool MakeShortcutIcoPath(const u64 program_id,
|
||||
const std::string_view game_file_name,
|
||||
bool MakeShortcutIcoPath(const u64 program_id, const std::string_view game_file_name,
|
||||
std::filesystem::path& out_icon_path);
|
||||
|
||||
void OpenEdenFolder(const Common::FS::EdenPath &path);
|
||||
void OpenEdenFolder(const Common::FS::EdenPath& path);
|
||||
void OpenRootDataFolder();
|
||||
void OpenNANDFolder();
|
||||
void OpenSaveFolder();
|
||||
|
|
@ -71,16 +62,13 @@ void RemoveCacheStorage(u64 program_id);
|
|||
void ResetMetadata(bool show_message = true);
|
||||
|
||||
// Shortcuts //
|
||||
void CreateShortcut(const std::string& game_path,
|
||||
const u64 program_id,
|
||||
const std::string& game_title_,
|
||||
const ShortcutTarget& target,
|
||||
std::string arguments_,
|
||||
const bool needs_title);
|
||||
void CreateShortcut(const std::string& game_path, const u64 program_id,
|
||||
const std::string& game_title_, const ShortcutTarget& target,
|
||||
std::string arguments_, const bool needs_title);
|
||||
|
||||
std::string GetShortcutPath(ShortcutTarget target);
|
||||
void CreateHomeMenuShortcut(ShortcutTarget target);
|
||||
|
||||
}
|
||||
} // namespace QtCommon::Game
|
||||
|
||||
#endif // QT_GAME_UTIL_H
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "qt_common/util/meta.h"
|
||||
#include "common/common_types.h"
|
||||
#include "core/core.h"
|
||||
#include "core/frontend/applets/cabinet.h"
|
||||
|
|
@ -9,11 +8,11 @@
|
|||
#include "core/frontend/applets/profile_select.h"
|
||||
#include "core/frontend/applets/software_keyboard.h"
|
||||
#include "core/hle/service/am/frontend/applet_web_browser_types.h"
|
||||
#include "qt_common/util/meta.h"
|
||||
|
||||
namespace QtCommon::Meta {
|
||||
|
||||
void RegisterMetaTypes()
|
||||
{
|
||||
void RegisterMetaTypes() {
|
||||
// Register integral and floating point types
|
||||
qRegisterMetaType<u8>("u8");
|
||||
qRegisterMetaType<u16>("u16");
|
||||
|
|
@ -72,4 +71,4 @@ void RegisterMetaTypes()
|
|||
qRegisterMetaType<Core::SystemResultStatus>("Core::SystemResultStatus");
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace QtCommon::Meta
|
||||
|
|
|
|||
|
|
@ -11,5 +11,5 @@ namespace QtCommon::Meta {
|
|||
//
|
||||
void RegisterMetaTypes();
|
||||
|
||||
}
|
||||
} // namespace QtCommon::Meta
|
||||
#endif // QT_META_H
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ QStringList GetModFolders(const QString& root, const QString& fallbackName) {
|
|||
QString name = QtCommon::Frontend::GetTextInput(
|
||||
tr("Mod Name"), tr("What should this mod be called?"), default_name);
|
||||
|
||||
if (name.isEmpty()) return {};
|
||||
if (name.isEmpty())
|
||||
return {};
|
||||
|
||||
// if std_path is empty, frontend_common could not determine mod type and/or name.
|
||||
// so we have to prompt the user and set up the structure ourselves
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
namespace QtCommon::Mod {
|
||||
|
||||
QStringList GetModFolders(const QString &root, const QString &fallbackName);
|
||||
QStringList GetModFolders(const QString& root, const QString& fallbackName);
|
||||
|
||||
const QString ExtractMod(const QString &path);
|
||||
const QString ExtractMod(const QString& path);
|
||||
|
||||
}
|
||||
} // namespace QtCommon::Mod
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@
|
|||
#ifndef QT_PATH_UTIL_H
|
||||
#define QT_PATH_UTIL_H
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include <QObject>
|
||||
#include "common/common_types.h"
|
||||
|
||||
namespace QtCommon::Path { bool OpenShaderCache(u64 program_id, QObject *parent); }
|
||||
namespace QtCommon::Path {
|
||||
bool OpenShaderCache(u64 program_id, QObject* parent);
|
||||
}
|
||||
|
||||
#endif // QT_PATH_UTIL_H
|
||||
|
|
|
|||
|
|
@ -7,13 +7,8 @@
|
|||
|
||||
namespace QtCommon::ROM {
|
||||
|
||||
bool RomFSRawCopy(size_t total_size,
|
||||
size_t& read_size,
|
||||
QtProgressCallback callback,
|
||||
const FileSys::VirtualDir& src,
|
||||
const FileSys::VirtualDir& dest,
|
||||
bool full)
|
||||
{
|
||||
bool RomFSRawCopy(size_t total_size, size_t& read_size, QtProgressCallback callback,
|
||||
const FileSys::VirtualDir& src, const FileSys::VirtualDir& dest, bool full) {
|
||||
// TODO(crueter)
|
||||
// if (src == nullptr || dest == nullptr || !src->IsReadable() || !dest->IsWritable())
|
||||
// return false;
|
||||
|
|
@ -75,4 +70,4 @@ bool RomFSRawCopy(size_t total_size,
|
|||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace QtCommon::ROM
|
||||
|
|
|
|||
|
|
@ -4,17 +4,13 @@
|
|||
#ifndef QT_ROM_UTIL_H
|
||||
#define QT_ROM_UTIL_H
|
||||
|
||||
#include "qt_common/qt_common.h"
|
||||
#include <cstddef>
|
||||
#include "qt_common/qt_common.h"
|
||||
|
||||
namespace QtCommon::ROM {
|
||||
|
||||
bool RomFSRawCopy(size_t total_size,
|
||||
size_t& read_size,
|
||||
QtProgressCallback callback,
|
||||
const FileSys::VirtualDir& src,
|
||||
const FileSys::VirtualDir& dest,
|
||||
bool full);
|
||||
bool RomFSRawCopy(size_t total_size, size_t& read_size, QtProgressCallback callback,
|
||||
const FileSys::VirtualDir& src, const FileSys::VirtualDir& dest, bool full);
|
||||
|
||||
}
|
||||
#endif // QT_ROM_UTIL_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue