improve format awareness, improve RNG

This commit is contained in:
Syping 2023-10-03 22:47:11 +02:00
parent 01424ef51f
commit 4fdde8e485
5 changed files with 80 additions and 64 deletions

View file

@ -60,12 +60,16 @@ QString AppEnv::getGameFolder(bool *ok)
if (dir.exists()) { if (dir.exists()) {
if (ok) if (ok)
*ok = true; *ok = true;
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
return dir.absolutePath(); return dir.absolutePath();
} }
} }
#ifdef Q_OS_WIN
const QString GTAV_defaultFolder = StandardPaths::documentsLocation() % "/Rockstar Games/GTA V"; const QString GTAV_defaultFolder = StandardPaths::documentsLocation() % "/Rockstar Games/GTA V";
#else
// TODO: Try to locate the Steam Proton GTA V folder
const QString GTAV_defaultFolder = StandardPaths::documentsLocation() % "/Rockstar Games/GTA V";
#endif
QString GTAV_returnFolder = GTAV_defaultFolder; QString GTAV_returnFolder = GTAV_defaultFolder;
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR); QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
@ -79,7 +83,6 @@ QString AppEnv::getGameFolder(bool *ok)
if (dir.exists()) { if (dir.exists()) {
if (ok) if (ok)
*ok = true; *ok = true;
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
return dir.absolutePath(); return dir.absolutePath();
} }
} }
@ -88,7 +91,6 @@ QString AppEnv::getGameFolder(bool *ok)
if (dir.exists()) { if (dir.exists()) {
if (ok) if (ok)
*ok = true; *ok = true;
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
return dir.absolutePath(); return dir.absolutePath();
} }
@ -97,7 +99,6 @@ QString AppEnv::getGameFolder(bool *ok)
if (dir.exists()) { if (dir.exists()) {
if (ok) if (ok)
*ok = true; *ok = true;
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
return dir.absolutePath(); return dir.absolutePath();
} }
} }
@ -111,10 +112,8 @@ bool AppEnv::setGameFolder(QString gameFolder)
{ {
QDir dir; QDir dir;
dir.setPath(gameFolder); dir.setPath(gameFolder);
if (dir.exists()) { if (dir.exists())
qputenv("GTAV_FOLDER", dir.absolutePath().toUtf8());
return true; return true;
}
return false; return false;
} }

View file

@ -60,10 +60,6 @@
#include <QUrl> #include <QUrl>
#include <QDir> #include <QDir>
#include <cstdint>
#include <random>
#include <ctime>
#ifdef GTA5SYNC_TELEMETRY #ifdef GTA5SYNC_TELEMETRY
#include "TelemetryClass.h" #include "TelemetryClass.h"
#include <QJsonDocument> #include <QJsonDocument>
@ -138,12 +134,10 @@ ProfileInterface::ProfileInterface(ProfileDatabase *profileDB, CrewDatabase *cre
#endif #endif
// Seed RNG // Seed RNG
pcg32_srandom_r(&rng, time(NULL), (intptr_t)&rng); pcg32_srandom_r(&rng, QDateTime::currentMSecsSinceEpoch(), (intptr_t)&rng);
#if QT_VERSION >= 0x050000
// Register Metatypes // Register Metatypes
qRegisterMetaType<QVector<QString>>(); qRegisterMetaType<QVector<QString>>();
#endif
setMouseTracking(true); setMouseTracking(true);
installEventFilter(this); installEventFilter(this);
@ -175,10 +169,11 @@ ProfileInterface::~ProfileInterface()
delete ui; delete ui;
} }
void ProfileInterface::setProfileFolder(QString folder, QString profile) void ProfileInterface::setProfileFolder(QString folder, QString profile, quint32 format)
{ {
profileFolder = folder; profileFolder = folder;
profileName = profile; profileName = profile;
photoFormat = format;
} }
void ProfileInterface::setupProfileInterface() void ProfileInterface::setupProfileInterface()
@ -186,9 +181,7 @@ void ProfileInterface::setupProfileInterface()
fixedPictures.clear(); fixedPictures.clear();
ui->labProfileLoading->setText(tr("Loading...")); ui->labProfileLoading->setText(tr("Loading..."));
profileLoader = new ProfileLoader(profileFolder, crewDB); profileLoader = new ProfileLoader(profileFolder, crewDB);
#if QT_VERSION >= 0x050000
QObject::connect(profileLoader, SIGNAL(directoryScanned(QVector<QString>,QVector<QString>)), this, SLOT(directoryScanned(QVector<QString>,QVector<QString>))); QObject::connect(profileLoader, SIGNAL(directoryScanned(QVector<QString>,QVector<QString>)), this, SLOT(directoryScanned(QVector<QString>,QVector<QString>)));
#endif
QObject::connect(profileLoader, SIGNAL(savegameLoaded(SavegameData*, QString)), this, SLOT(savegameLoaded_event(SavegameData*, QString))); QObject::connect(profileLoader, SIGNAL(savegameLoaded(SavegameData*, QString)), this, SLOT(savegameLoaded_event(SavegameData*, QString)));
QObject::connect(profileLoader, SIGNAL(pictureLoaded(SnapmaticPicture*)), this, SLOT(pictureLoaded_event(SnapmaticPicture*))); QObject::connect(profileLoader, SIGNAL(pictureLoaded(SnapmaticPicture*)), this, SLOT(pictureLoaded_event(SnapmaticPicture*)));
QObject::connect(profileLoader, SIGNAL(pictureFixed(SnapmaticPicture*)), this, SLOT(pictureFixed_event(SnapmaticPicture*))); QObject::connect(profileLoader, SIGNAL(pictureFixed(SnapmaticPicture*)), this, SLOT(pictureFixed_event(SnapmaticPicture*)));
@ -264,7 +257,6 @@ void ProfileInterface::loadingProgress(int value, int maximum)
ui->labProfileLoading->setText(loadingStr.arg(QString::number(value), QString::number(maximum))); ui->labProfileLoading->setText(loadingStr.arg(QString::number(value), QString::number(maximum)));
} }
#if QT_VERSION >= 0x050000
void ProfileInterface::directoryChanged(const QString &path) void ProfileInterface::directoryChanged(const QString &path)
{ {
Q_UNUSED(path) Q_UNUSED(path)
@ -330,7 +322,6 @@ void ProfileInterface::directoryScanned(QVector<QString> savegameFiles_s, QVecto
fileSystemWatcher.addPath(profileFolder); fileSystemWatcher.addPath(profileFolder);
QObject::connect(&fileSystemWatcher, &QFileSystemWatcher::directoryChanged, this, &ProfileInterface::directoryChanged); QObject::connect(&fileSystemWatcher, &QFileSystemWatcher::directoryChanged, this, &ProfileInterface::directoryChanged);
} }
#endif
void ProfileInterface::insertSnapmaticIPI(QWidget *widget) void ProfileInterface::insertSnapmaticIPI(QWidget *widget)
{ {
@ -726,7 +717,7 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
} }
else if (isSupportedImageFile(selectedFileName)) { else if (isSupportedImageFile(selectedFileName)) {
SnapmaticPicture *picture = new SnapmaticPicture(); SnapmaticPicture *picture = new SnapmaticPicture();
picture->initialise(RagePhoto::PhotoFormat::GTA5); // TODO: check which game we want create for picture->initialise(photoFormat);
if (!notMultiple) { if (!notMultiple) {
QFile snapmaticFile(selectedFile); QFile snapmaticFile(selectedFile);
if (!snapmaticFile.open(QFile::ReadOnly)) { if (!snapmaticFile.open(QFile::ReadOnly)) {
@ -1045,27 +1036,39 @@ bool ProfileInterface::importRemote(QUrl remoteUrl)
bool ProfileInterface::importImage(QImage *snapmaticImage, QDateTime importDateTime) bool ProfileInterface::importImage(QImage *snapmaticImage, QDateTime importDateTime)
{ {
bool success = false;
SnapmaticPicture *picture = new SnapmaticPicture(); SnapmaticPicture *picture = new SnapmaticPicture();
picture->initialise(RagePhoto::PhotoFormat::GTA5); // TODO: check which game we want create for picture->initialise(photoFormat);
ImportDialog *importDialog = new ImportDialog(profileName, this); ImportDialog *importDialog = new ImportDialog(profileName, this);
importDialog->setImage(snapmaticImage); importDialog->setImage(snapmaticImage);
importDialog->setModal(true); importDialog->setModal(true);
importDialog->show(); importDialog->show();
importDialog->exec(); importDialog->exec();
bool success = false;
if (importDialog->isImportAgreed()) { if (importDialog->isImportAgreed()) {
if (picture->setImage(importDialog->image(), importDialog->isUnlimitedBuffer())) { if (picture->setImage(importDialog->image(), importDialog->isUnlimitedBuffer())) {
QString fileFormat;
switch (photoFormat) {
case RagePhoto::PhotoFormat::GTA5:
fileFormat = "PGTA5%1";
break;
case RagePhoto::PhotoFormat::RDR2:
fileFormat = "PRDR3%1";
break;
default:
fileFormat = "%1.lrpx";
break;
}
SnapmaticProperties spJson = picture->getSnapmaticProperties(); SnapmaticProperties spJson = picture->getSnapmaticProperties();
spJson.uid = getRandomUid(); spJson.uid = getRandomUid();
bool fExists = QFile::exists(profileFolder % "/PGTA5" % QString::number(spJson.uid)); bool fExists = QFile::exists(profileFolder % "/" % fileFormat.arg(QString::number(spJson.uid)));
bool fExistsBackup = QFile::exists(profileFolder % "/PGTA5" % QString::number(spJson.uid) % ".bak"); bool fExistsBackup = QFile::exists(profileFolder % "/" % fileFormat.arg(QString::number(spJson.uid) % ".bak"));
bool fExistsHidden = QFile::exists(profileFolder % "/PGTA5" % QString::number(spJson.uid) % ".hidden"); bool fExistsHidden = QFile::exists(profileFolder % "/" % fileFormat.arg(QString::number(spJson.uid) % ".hidden"));
int cEnough = 0; int cEnough = 0;
while ((fExists || fExistsBackup || fExistsHidden) && cEnough < findRetryLimit) { while ((fExists || fExistsBackup || fExistsHidden) && cEnough < findRetryLimit) {
spJson.uid = getRandomUid(); spJson.uid = getRandomUid();
fExists = QFile::exists(profileFolder % "/PGTA5" % QString::number(spJson.uid)); fExists = QFile::exists(profileFolder % "/" % fileFormat.arg(QString::number(spJson.uid)));
fExistsBackup = QFile::exists(profileFolder % "/PGTA5" % QString::number(spJson.uid) % ".bak"); fExistsBackup = QFile::exists(profileFolder % "/" % fileFormat.arg(QString::number(spJson.uid) % ".bak"));
fExistsHidden = QFile::exists(profileFolder % "/PGTA5" % QString::number(spJson.uid) % ".hidden"); fExistsHidden = QFile::exists(profileFolder % "/" % fileFormat.arg(QString::number(spJson.uid) % ".hidden"));
cEnough++; cEnough++;
} }
spJson.createdDateTime = importDateTime; spJson.createdDateTime = importDateTime;
@ -1079,10 +1082,8 @@ bool ProfileInterface::importImage(QImage *snapmaticImage, QDateTime importDateT
spJson.createdTimestamp = spJson.createdDateTime.toTime_t(); spJson.createdTimestamp = spJson.createdDateTime.toTime_t();
#endif #endif
picture->setSnapmaticProperties(spJson); picture->setSnapmaticProperties(spJson);
const QString picFileName = QString("PGTA5%1").arg(QString::number(spJson.uid)); picture->setPicFileName(fileFormat.arg(QString::number(spJson.uid)));
picture->setPicFileName(picFileName);
picture->setPictureTitle(importDialog->getImageTitle()); picture->setPictureTitle(importDialog->getImageTitle());
picture->updateStrings();
success = importSnapmaticPicture(picture, true); success = importSnapmaticPicture(picture, true);
} }
} }
@ -1098,6 +1099,23 @@ bool ProfileInterface::importImage(QImage *snapmaticImage, QDateTime importDateT
bool ProfileInterface::importSnapmaticPicture(SnapmaticPicture *picture, bool warn) bool ProfileInterface::importSnapmaticPicture(SnapmaticPicture *picture, bool warn)
{ {
QString fileFormat;
SnapmaticFormat spFormat;
switch (picture->ragePhoto()->format()) {
case RagePhoto::PhotoFormat::GTA5:
case G5EPhotoFormat::G5EX:
fileFormat = "PGTA5%1";
spFormat = SnapmaticFormat::PGTA5_Format;
break;
case RagePhoto::PhotoFormat::RDR2:
fileFormat = "PRDR3%1";
spFormat = SnapmaticFormat::PRDR3_Format;
break;
default:
fileFormat = "%.lrpx";
spFormat = SnapmaticFormat::G5E_Format;
break;
}
QString picFileName = picture->getPictureFileName(); QString picFileName = picture->getPictureFileName();
QString adjustedFileName = picture->getOriginalPictureFileName(); QString adjustedFileName = picture->getOriginalPictureFileName();
if (!picFileName.startsWith("PGTA5") && !picFileName.startsWith("PRDR3")) { if (!picFileName.startsWith("PGTA5") && !picFileName.startsWith("PRDR3")) {
@ -1122,15 +1140,15 @@ bool ProfileInterface::importSnapmaticPicture(SnapmaticPicture *picture, bool wa
#else #else
snapmaticProperties.createdTimestamp = snapmaticProperties.createdDateTime.toTime_t(); snapmaticProperties.createdTimestamp = snapmaticProperties.createdDateTime.toTime_t();
#endif #endif
bool fExists = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid)); bool fExists = QFile::exists(profileFolder % "/" % fileFormat.arg(QString::number(snapmaticProperties.uid)));
bool fExistsBackup = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".bak"); bool fExistsBackup = QFile::exists(profileFolder % "/" % fileFormat.arg(QString::number(snapmaticProperties.uid)) % ".bak");
bool fExistsHidden = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".hidden"); bool fExistsHidden = QFile::exists(profileFolder % "/" % fileFormat.arg(QString::number(snapmaticProperties.uid)) % ".hidden");
int cEnough = 0; int cEnough = 0;
while ((fExists || fExistsBackup || fExistsHidden) && cEnough < findRetryLimit) { while ((fExists || fExistsBackup || fExistsHidden) && cEnough < findRetryLimit) {
snapmaticProperties.uid = getRandomUid(); snapmaticProperties.uid = getRandomUid();
fExists = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid)); fExists = QFile::exists(profileFolder % "/" % fileFormat.arg(QString::number(snapmaticProperties.uid)));
fExistsBackup = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".bak"); fExistsBackup = QFile::exists(profileFolder % "/" % fileFormat.arg(QString::number(snapmaticProperties.uid)) % ".bak");
fExistsHidden = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".hidden"); fExistsHidden = QFile::exists(profileFolder % "/" % fileFormat.arg(QString::number(snapmaticProperties.uid)) % ".hidden");
cEnough++; cEnough++;
} }
if (fExists || fExistsBackup || fExistsHidden) { if (fExists || fExistsBackup || fExistsHidden) {
@ -1141,9 +1159,8 @@ bool ProfileInterface::importSnapmaticPicture(SnapmaticPicture *picture, bool wa
// That should never happen // That should never happen
return false; return false;
} }
picture->updateStrings(); adjustedFileName = fileFormat.arg(QString::number(snapmaticProperties.uid));
picFileName = picture->getPictureFileName(); picture->setPicFileName(adjustedFileName);
adjustedFileName = picture->getOriginalPictureFileName();
} }
else { else {
return false; return false;
@ -1155,15 +1172,15 @@ bool ProfileInterface::importSnapmaticPicture(SnapmaticPicture *picture, bool wa
snapmaticProperties.createdDateTime = QDateTime::currentDateTime(); snapmaticProperties.createdDateTime = QDateTime::currentDateTime();
qint64 timestamp = snapmaticProperties.createdDateTime.toSecsSinceEpoch(); qint64 timestamp = snapmaticProperties.createdDateTime.toSecsSinceEpoch();
snapmaticProperties.createdTimestamp = timestamp; snapmaticProperties.createdTimestamp = timestamp;
bool fExists = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid)); bool fExists = QFile::exists(profileFolder % "/" % fileFormat.arg(QString::number(snapmaticProperties.uid)));
bool fExistsBackup = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".bak"); bool fExistsBackup = QFile::exists(profileFolder % "/" % fileFormat.arg(QString::number(snapmaticProperties.uid)) % ".bak");
bool fExistsHidden = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".hidden"); bool fExistsHidden = QFile::exists(profileFolder % "/" % fileFormat.arg(QString::number(snapmaticProperties.uid)) % ".hidden");
int cEnough = 0; int cEnough = 0;
while ((fExists || fExistsBackup || fExistsHidden) && cEnough < findRetryLimit) { while ((fExists || fExistsBackup || fExistsHidden) && cEnough < findRetryLimit) {
snapmaticProperties.uid = getRandomUid(); snapmaticProperties.uid = getRandomUid();
fExists = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid)); fExists = QFile::exists(profileFolder % "/" % fileFormat.arg(QString::number(snapmaticProperties.uid)));
fExistsBackup = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".bak"); fExistsBackup = QFile::exists(profileFolder % "/" % fileFormat.arg(QString::number(snapmaticProperties.uid)) % ".bak");
fExistsHidden = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".hidden"); fExistsHidden = QFile::exists(profileFolder % "/" % fileFormat.arg(QString::number(snapmaticProperties.uid)) % ".hidden");
cEnough++; cEnough++;
} }
if (fExists || fExistsBackup || fExistsHidden) { if (fExists || fExistsBackup || fExistsHidden) {
@ -1174,13 +1191,13 @@ bool ProfileInterface::importSnapmaticPicture(SnapmaticPicture *picture, bool wa
// That should never happen // That should never happen
return false; return false;
} }
adjustedFileName = fileFormat.arg(QString::number(snapmaticProperties.uid));
picture->setPicFileName(adjustedFileName);
}
}
if (picture->exportPicture(profileFolder % "/" % adjustedFileName, spFormat)) {
picture->updateStrings(); picture->updateStrings();
picFileName = picture->getPictureFileName(); picture->setSnapmaticFormat(spFormat);
adjustedFileName = picture->getOriginalPictureFileName();
}
}
if (picture->exportPicture(profileFolder % "/" % adjustedFileName, SnapmaticFormat::PGTA5_Format)) {
picture->setSnapmaticFormat(SnapmaticFormat::PGTA5_Format);
picture->setPicFilePath(profileFolder % "/" % adjustedFileName); picture->setPicFilePath(profileFolder % "/" % adjustedFileName);
snapmaticPics << picture->getPictureFileName(); snapmaticPics << picture->getPictureFileName();
pictureLoaded(picture, true); pictureLoaded(picture, true);
@ -1216,9 +1233,7 @@ bool ProfileInterface::importSavegameData(SavegameData *savegame, QString sgdPat
const QString newSgdPath = profileFolder % "/" % sgdFileName; const QString newSgdPath = profileFolder % "/" % sgdFileName;
if (QFile::copy(sgdPath, newSgdPath)) { if (QFile::copy(sgdPath, newSgdPath)) {
savegame->setSavegameFileName(newSgdPath); savegame->setSavegameFileName(newSgdPath);
#if QT_VERSION >= 0x050000
savegameFiles << newSgdPath; savegameFiles << newSgdPath;
#endif
savegameLoaded(savegame, newSgdPath, true); savegameLoaded(savegame, newSgdPath, true);
return true; return true;
} }
@ -2374,8 +2389,7 @@ preSelectionTitle:
} }
} }
int ProfileInterface::getRandomUid() quint32 ProfileInterface::getRandomUid()
{ {
int random_int = pcg32_boundedrand_r(&rng, 2147483647); return pcg32_boundedrand_r(&rng, 2147483647UL);
return random_int;
} }

View file

@ -49,7 +49,7 @@ class ProfileInterface : public QWidget
Q_OBJECT Q_OBJECT
public: public:
explicit ProfileInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent = 0); explicit ProfileInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent = 0);
void setProfileFolder(QString folder, QString profile); void setProfileFolder(QString folder, QString profile, quint32 defaultPhotoFormat);
void settingsApplied(int contentMode, bool languageChanged); void settingsApplied(int contentMode, bool languageChanged);
void setupProfileInterface(); void setupProfileInterface();
void massTool(MassTool tool); void massTool(MassTool tool);
@ -90,10 +90,8 @@ private slots:
void dialogNextPictureRequested(QWidget *dialog); void dialogNextPictureRequested(QWidget *dialog);
void dialogPreviousPictureRequested(QWidget *dialog); void dialogPreviousPictureRequested(QWidget *dialog);
void on_saProfileContent_dropped(const QMimeData *mimeData); void on_saProfileContent_dropped(const QMimeData *mimeData);
#if QT_VERSION >= 0x050000
void directoryChanged(const QString &path); void directoryChanged(const QString &path);
void directoryScanned(QVector<QString> savegameFiles, QVector<QString> snapmaticPics); void directoryScanned(QVector<QString> savegameFiles, QVector<QString> snapmaticPics);
#endif
protected: protected:
bool eventFilter(QObject *watched, QEvent *event); bool eventFilter(QObject *watched, QEvent *event);
@ -109,11 +107,9 @@ private:
QList<SavegameData*> savegames; QList<SavegameData*> savegames;
QList<SnapmaticPicture*> pictures; QList<SnapmaticPicture*> pictures;
QMap<ProfileWidget*,QString> widgets; QMap<ProfileWidget*,QString> widgets;
#if QT_VERSION >= 0x050000
QFileSystemWatcher fileSystemWatcher; QFileSystemWatcher fileSystemWatcher;
QVector<QString> savegameFiles; QVector<QString> savegameFiles;
QVector<QString> snapmaticPics; QVector<QString> snapmaticPics;
#endif
QSpacerItem *saSpacerItem; QSpacerItem *saSpacerItem;
QStringList fixedPictures; QStringList fixedPictures;
QString enabledPicStr; QString enabledPicStr;
@ -121,6 +117,7 @@ private:
QString profileName; QString profileName;
QString loadingStr; QString loadingStr;
QString language; QString language;
quint32 photoFormat;
pcg32_random_t rng; pcg32_random_t rng;
bool contextMenuOpened; bool contextMenuOpened;
bool isProfileLoaded; bool isProfileLoaded;
@ -143,7 +140,7 @@ private:
void insertSnapmaticIPI(QWidget *widget); void insertSnapmaticIPI(QWidget *widget);
void insertSavegameIPI(QWidget *widget); void insertSavegameIPI(QWidget *widget);
void sortingProfileInterface(); void sortingProfileInterface();
int getRandomUid(); quint32 getRandomUid();
signals: signals:
void profileLoaded(); void profileLoaded();

View file

@ -1250,7 +1250,13 @@ bool SnapmaticPicture::exportPicture(const QString &fileName, SnapmaticFormat fo
} }
else { else {
bool ok; bool ok;
const std::string photo = p_ragePhoto.save(&ok); std::string photo;
if (format == SnapmaticFormat::PGTA5_Format)
photo = p_ragePhoto.save(RagePhoto::PhotoFormat::GTA5, &ok);
else if (format == SnapmaticFormat::PRDR3_Format)
photo = p_ragePhoto.save(RagePhoto::PhotoFormat::RDR2, &ok);
else
photo = p_ragePhoto.save(&ok);
if (ok) if (ok)
picFile.write(photo.data(), photo.size()); picFile.write(photo.data(), photo.size());
saveSuccess = picFile.commit(); saveSuccess = picFile.commit();

View file

@ -425,7 +425,7 @@ void UserInterface::openProfile(const QString &profileName_)
profileUI = new ProfileInterface(profileDB, crewDB, threadDB); profileUI = new ProfileInterface(profileDB, crewDB, threadDB);
ui->swProfile->addWidget(profileUI); ui->swProfile->addWidget(profileUI);
ui->swProfile->setCurrentWidget(profileUI); ui->swProfile->setCurrentWidget(profileUI);
profileUI->setProfileFolder(GTAV_ProfilesFolder % QDir::separator() % profileName, profileName); profileUI->setProfileFolder(GTAV_ProfilesFolder % "/" % profileName, profileName, RagePhoto::PhotoFormat::GTA5); // TODO: do not assume GTA V
profileUI->settingsApplied(contentMode, false); profileUI->settingsApplied(contentMode, false);
profileUI->setupProfileInterface(); profileUI->setupProfileInterface();
QObject::connect(profileUI, SIGNAL(profileClosed()), this, SLOT(closeProfile())); QObject::connect(profileUI, SIGNAL(profileClosed()), this, SLOT(closeProfile()));