Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into update_file2

This commit is contained in:
Trial97 2023-11-23 23:57:20 +02:00
commit ff5a968de0
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
6 changed files with 39 additions and 17 deletions

View File

@ -601,11 +601,17 @@ QProcessEnvironment MinecraftInstance::createLaunchEnvironment()
auto mangoHudLibString = MangoHud::getLibraryString(); auto mangoHudLibString = MangoHud::getLibraryString();
if (!mangoHudLibString.isEmpty()) { if (!mangoHudLibString.isEmpty()) {
QFileInfo mangoHudLib(mangoHudLibString); QFileInfo mangoHudLib(mangoHudLibString);
QString libPath = mangoHudLib.absolutePath();
auto appendLib = [libPath, &preloadList](QString fileName) {
if (QFileInfo(FS::PathCombine(libPath, fileName)).exists())
preloadList << fileName;
};
// dlsym variant is only needed for OpenGL and not included in the vulkan layer // dlsym variant is only needed for OpenGL and not included in the vulkan layer
preloadList << "libMangoHud_dlsym.so" appendLib("libMangoHud_dlsym.so");
<< "libMangoHud_opengl.so" << mangoHudLib.fileName(); appendLib("libMangoHud_opengl.so");
libPaths << mangoHudLib.absolutePath(); appendLib(mangoHudLib.fileName());
libPaths << libPath;
} }
env.insert("LD_PRELOAD", preloadList.join(QLatin1String(":"))); env.insert("LD_PRELOAD", preloadList.join(QLatin1String(":")));

View File

@ -461,9 +461,9 @@ bool ResourceFolderModel::setData(const QModelIndex& index, [[maybe_unused]] con
if (role == Qt::CheckStateRole) { if (role == Qt::CheckStateRole) {
if (m_instance != nullptr && m_instance->isRunning()) { if (m_instance != nullptr && m_instance->isRunning()) {
auto response = auto response =
CustomMessageBox::selectable(nullptr, "Confirm toggle", CustomMessageBox::selectable(nullptr, tr("Confirm toggle"),
"If you enable/disable this resource while the game is running it may crash your game.\n" tr("If you enable/disable this resource while the game is running it may crash your game.\n"
"Are you sure you want to do this?", "Are you sure you want to do this?"),
QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No) QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
->exec(); ->exec();

View File

@ -137,10 +137,11 @@ Task::Ptr GetModDependenciesTask::getProjectInfoTask(std::shared_ptr<PackDepende
auto provider = pDep->pack->provider == m_flame_provider.name ? m_flame_provider : m_modrinth_provider; auto provider = pDep->pack->provider == m_flame_provider.name ? m_flame_provider : m_modrinth_provider;
auto responseInfo = std::make_shared<QByteArray>(); auto responseInfo = std::make_shared<QByteArray>();
auto info = provider.api->getProject(pDep->pack->addonId.toString(), responseInfo); auto info = provider.api->getProject(pDep->pack->addonId.toString(), responseInfo);
QObject::connect(info.get(), &NetJob::succeeded, [responseInfo, provider, pDep] { QObject::connect(info.get(), &NetJob::succeeded, [this, responseInfo, provider, pDep] {
QJsonParseError parse_error{}; QJsonParseError parse_error{};
QJsonDocument doc = QJsonDocument::fromJson(*responseInfo, &parse_error); QJsonDocument doc = QJsonDocument::fromJson(*responseInfo, &parse_error);
if (parse_error.error != QJsonParseError::NoError) { if (parse_error.error != QJsonParseError::NoError) {
removePack(pDep->pack->addonId);
qWarning() << "Error while parsing JSON response for mod info at " << parse_error.offset qWarning() << "Error while parsing JSON response for mod info at " << parse_error.offset
<< " reason: " << parse_error.errorString(); << " reason: " << parse_error.errorString();
qDebug() << *responseInfo; qDebug() << *responseInfo;
@ -151,6 +152,7 @@ Task::Ptr GetModDependenciesTask::getProjectInfoTask(std::shared_ptr<PackDepende
: Json::requireObject(doc); : Json::requireObject(doc);
provider.mod->loadIndexedPack(*pDep->pack, obj); provider.mod->loadIndexedPack(*pDep->pack, obj);
} catch (const JSONValidationError& e) { } catch (const JSONValidationError& e) {
removePack(pDep->pack->addonId);
qDebug() << doc; qDebug() << doc;
qWarning() << "Error while reading mod info: " << e.cause(); qWarning() << "Error while reading mod info: " << e.cause();
} }
@ -211,11 +213,13 @@ Task::Ptr GetModDependenciesTask::prepareDependencyTask(const ModPlatform::Depen
pDep->pack->versionsLoaded = true; pDep->pack->versionsLoaded = true;
} catch (const JSONValidationError& e) { } catch (const JSONValidationError& e) {
removePack(dep.addonId);
qDebug() << doc; qDebug() << doc;
qWarning() << "Error while reading mod version: " << e.cause(); qWarning() << "Error while reading mod version: " << e.cause();
return; return;
} }
if (level == 0) { if (level == 0) {
removePack(dep.addonId);
qWarning() << "Dependency cycle exceeded"; qWarning() << "Dependency cycle exceeded";
return; return;
} }

View File

@ -254,9 +254,9 @@ void ExternalResourcesPage::removeItem()
void ExternalResourcesPage::removeItems(const QItemSelection& selection) void ExternalResourcesPage::removeItems(const QItemSelection& selection)
{ {
if (m_instance != nullptr && m_instance->isRunning()) { if (m_instance != nullptr && m_instance->isRunning()) {
auto response = CustomMessageBox::selectable(this, "Confirm Delete", auto response = CustomMessageBox::selectable(this, tr("Confirm Delete"),
"If you remove this resource while the game is running it may crash your game.\n" tr("If you remove this resource while the game is running it may crash your game.\n"
"Are you sure you want to do this?", "Are you sure you want to do this?"),
QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No) QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
->exec(); ->exec();
@ -275,9 +275,9 @@ void ExternalResourcesPage::enableItem()
void ExternalResourcesPage::disableItem() void ExternalResourcesPage::disableItem()
{ {
if (m_instance != nullptr && m_instance->isRunning()) { if (m_instance != nullptr && m_instance->isRunning()) {
auto response = CustomMessageBox::selectable(this, "Confirm disable", auto response = CustomMessageBox::selectable(this, tr("Confirm disable"),
"If you disable this resource while the game is running it may crash your game.\n" tr("If you disable this resource while the game is running it may crash your game.\n"
"Are you sure you want to do this?", "Are you sure you want to do this?"),
QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No) QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
->exec(); ->exec();

View File

@ -171,9 +171,9 @@ bool ModFolderPage::onSelectionChanged(const QModelIndex& current, [[maybe_unuse
void ModFolderPage::removeItems(const QItemSelection& selection) void ModFolderPage::removeItems(const QItemSelection& selection)
{ {
if (m_instance != nullptr && m_instance->isRunning()) { if (m_instance != nullptr && m_instance->isRunning()) {
auto response = CustomMessageBox::selectable(this, "Confirm Delete", auto response = CustomMessageBox::selectable(this, tr("Confirm Delete"),
"If you remove mods while the game is running it may crash your game.\n" tr("If you remove mods while the game is running it may crash your game.\n"
"Are you sure you want to do this?", "Are you sure you want to do this?"),
QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No) QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
->exec(); ->exec();
@ -239,6 +239,18 @@ void ModFolderPage::updateMods(bool includeDeps)
QMessageBox::critical(this, tr("Error"), tr("Mod updates are unavailable when metadata is disabled!")); QMessageBox::critical(this, tr("Error"), tr("Mod updates are unavailable when metadata is disabled!"));
return; return;
} }
if (m_instance != nullptr && m_instance->isRunning()) {
auto response =
CustomMessageBox::selectable(this, tr("Confirm Update"),
tr("If you update mods while the game is running may cause mod duplication and game crashes.\n"
"The old files may not be deleted as they are in use.\n"
"Are you sure you want to do this?"),
QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
->exec();
if (response != QMessageBox::Yes)
return;
}
auto selection = m_filterModel->mapSelectionToSource(ui->treeView->selectionModel()->selection()).indexes(); auto selection = m_filterModel->mapSelectionToSource(ui->treeView->selectionModel()->selection()).indexes();
auto mods_list = m_model->selectedMods(selection); auto mods_list = m_model->selectedMods(selection);

View File

@ -43,7 +43,7 @@
QString BasicCatPack::path() QString BasicCatPack::path()
{ {
const auto now = QDate::currentDate(); const auto now = QDate::currentDate();
const auto birthday = QDate(now.year(), 11, 30); const auto birthday = QDate(now.year(), 11, 1);
const auto xmas = QDate(now.year(), 12, 25); const auto xmas = QDate(now.year(), 12, 25);
const auto halloween = QDate(now.year(), 10, 31); const auto halloween = QDate(now.year(), 10, 31);