aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build.yml12
-rw-r--r--.gitignore8
-rw-r--r--launcher/Application.cpp8
-rw-r--r--launcher/Application.h2
-rw-r--r--launcher/LoggedProcess.cpp16
-rw-r--r--launcher/LoggedProcess.h7
-rw-r--r--launcher/MangoHud.cpp23
-rw-r--r--launcher/ui/themes/ITheme.cpp2
-rw-r--r--launcher/ui/themes/ITheme.h2
-rw-r--r--launcher/ui/themes/SystemTheme.cpp8
-rw-r--r--launcher/ui/themes/SystemTheme.h2
-rw-r--r--launcher/ui/themes/ThemeManager.cpp8
-rw-r--r--launcher/ui/themes/ThemeManager.h4
-rw-r--r--nix/default.nix47
14 files changed, 94 insertions, 55 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 022a04f8..4369d249 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -68,7 +68,7 @@ jobs:
qt_ver: 6
qt_host: windows
qt_arch: ''
- qt_version: '6.4.3'
+ qt_version: '6.5.0'
qt_modules: 'qt5compat qtimageformats'
qt_tools: ''
@@ -80,7 +80,7 @@ jobs:
qt_ver: 6
qt_host: windows
qt_arch: 'win64_msvc2019_arm64'
- qt_version: '6.4.3'
+ qt_version: '6.5.0'
qt_modules: 'qt5compat qtimageformats'
qt_tools: ''
@@ -90,7 +90,7 @@ jobs:
qt_ver: 6
qt_host: mac
qt_arch: ''
- qt_version: '6.4.3'
+ qt_version: '6.5.0'
qt_modules: 'qt5compat qtimageformats'
qt_tools: ''
@@ -208,6 +208,8 @@ jobs:
if: runner.os == 'Windows' && matrix.architecture == 'arm64'
uses: jurplel/install-qt-action@v3
with:
+ aqtversion: '==3.1.*'
+ py7zrversion: '>=0.20.2'
version: ${{ matrix.qt_version }}
host: 'windows'
target: 'desktop'
@@ -223,6 +225,8 @@ jobs:
if: runner.os == 'Linux' && matrix.qt_ver == 6 || runner.os == 'macOS' || (runner.os == 'Windows' && matrix.msystem == '')
uses: jurplel/install-qt-action@v3
with:
+ aqtversion: '==3.1.*'
+ py7zrversion: '>=0.20.2'
version: ${{ matrix.qt_version }}
host: ${{ matrix.qt_host }}
target: 'desktop'
@@ -563,7 +567,7 @@ jobs:
submodules: 'true'
- name: Build Flatpak (Linux)
if: inputs.build_type == 'Debug'
- uses: flatpak/flatpak-github-actions/flatpak-builder@v5
+ uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
bundle: "Prism Launcher.flatpak"
manifest-path: flatpak/org.prismlauncher.PrismLauncher.yml
diff --git a/.gitignore b/.gitignore
index 3340670b..5c589a5f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,10 +24,6 @@ Debug
build
/build-*
-# direnv / Nix
-.direnv/
-.pre-commit-config.yaml
-
# Install dirs
install
/install-*
@@ -48,7 +44,9 @@ run/
.cache/
# Nix/NixOS
-result/
+.direnv/
+.pre-commit-config.yaml
+result
# Flatpak
.flatpak-builder
diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index 1fc31549..a7c97aa7 100644
--- a/launcher/Application.cpp
+++ b/launcher/Application.cpp
@@ -831,9 +831,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
}
});
- {
- applyCurrentlySelectedTheme();
- }
+ applyCurrentlySelectedTheme(true);
updateCapabilities();
@@ -1108,9 +1106,9 @@ QList<ITheme*> Application::getValidApplicationThemes()
return m_themeManager->getValidApplicationThemes();
}
-void Application::applyCurrentlySelectedTheme()
+void Application::applyCurrentlySelectedTheme(bool initial)
{
- m_themeManager->applyCurrentlySelectedTheme();
+ m_themeManager->applyCurrentlySelectedTheme(initial);
}
void Application::setApplicationTheme(const QString& name)
diff --git a/launcher/Application.h b/launcher/Application.h
index 91c5fc63..0d24a4e9 100644
--- a/launcher/Application.h
+++ b/launcher/Application.h
@@ -120,7 +120,7 @@ public:
void setIconTheme(const QString& name);
- void applyCurrentlySelectedTheme();
+ void applyCurrentlySelectedTheme(bool initial = false);
QList<ITheme*> getValidApplicationThemes();
diff --git a/launcher/LoggedProcess.cpp b/launcher/LoggedProcess.cpp
index 6447f5c6..c8d5c34e 100644
--- a/launcher/LoggedProcess.cpp
+++ b/launcher/LoggedProcess.cpp
@@ -1,7 +1,8 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
- * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
+ * Prism Launcher - Minecraft Launcher
+ * Copyright (C) 2022,2023 Sefa Eyeoglu <contact@scrumplex.net>
+ * Copyright (c) 2023 flowln <flowlnlnln@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -60,14 +61,23 @@ LoggedProcess::~LoggedProcess()
}
}
-QStringList reprocess(const QByteArray& data, QTextDecoder& decoder)
+QStringList LoggedProcess::reprocess(const QByteArray& data, QTextDecoder& decoder)
{
auto str = decoder.toUnicode(data);
+
+ if (!m_leftover_line.isEmpty()) {
+ str.prepend(m_leftover_line);
+ m_leftover_line = "";
+ }
+
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
auto lines = str.remove(QChar::CarriageReturn).split(QChar::LineFeed, QString::SkipEmptyParts);
#else
auto lines = str.remove(QChar::CarriageReturn).split(QChar::LineFeed, Qt::SkipEmptyParts);
#endif
+
+ if (!str.endsWith(QChar::LineFeed))
+ m_leftover_line = lines.takeLast();
return lines;
}
diff --git a/launcher/LoggedProcess.h b/launcher/LoggedProcess.h
index 2360d1ea..af3ed79f 100644
--- a/launcher/LoggedProcess.h
+++ b/launcher/LoggedProcess.h
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
- * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
+ * Prism Launcher - Minecraft Launcher
+ * Copyright (C) 2022,2023 Sefa Eyeoglu <contact@scrumplex.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -88,9 +88,12 @@ private slots:
private:
void changeState(LoggedProcess::State state);
+ QStringList reprocess(const QByteArray& data, QTextDecoder& decoder);
+
private:
QTextDecoder m_err_decoder = QTextDecoder(QTextCodec::codecForLocale());
QTextDecoder m_out_decoder = QTextDecoder(QTextCodec::codecForLocale());
+ QString m_leftover_line;
bool m_killed = false;
State m_state = NotRunning;
int m_exit_code = 0;
diff --git a/launcher/MangoHud.cpp b/launcher/MangoHud.cpp
index d635518e..90e48e29 100644
--- a/launcher/MangoHud.cpp
+++ b/launcher/MangoHud.cpp
@@ -19,6 +19,7 @@
#include <QStringList>
#include <QDir>
#include <QString>
+#include <QSysInfo>
#include <QtGlobal>
#include "MangoHud.h"
@@ -75,9 +76,27 @@ QString getLibraryString()
}
for (QString vkLayer : vkLayerList) {
- QString filePath = FS::PathCombine(vkLayer, "MangoHud.json");
- if (!QFile::exists(filePath))
+ // prefer to use architecture specific vulkan layers
+ QString currentArch = QSysInfo::currentCpuArchitecture();
+
+ if (currentArch == "arm64") {
+ currentArch = "aarch64";
+ }
+
+ QStringList manifestNames = { QString("MangoHud.%1.json").arg(currentArch), "MangoHud.json" };
+
+ QString filePath = "";
+ for (QString manifestName : manifestNames) {
+ QString tryPath = FS::PathCombine(vkLayer, manifestName);
+ if (QFile::exists(tryPath)) {
+ filePath = tryPath;
+ break;
+ }
+ }
+
+ if (filePath.isEmpty()) {
continue;
+ }
auto conf = Json::requireDocument(filePath, vkLayer);
auto confObject = Json::requireObject(conf, vkLayer);
diff --git a/launcher/ui/themes/ITheme.cpp b/launcher/ui/themes/ITheme.cpp
index 22043e44..8f0757e1 100644
--- a/launcher/ui/themes/ITheme.cpp
+++ b/launcher/ui/themes/ITheme.cpp
@@ -38,7 +38,7 @@
#include <QDir>
#include "Application.h"
-void ITheme::apply()
+void ITheme::apply(bool)
{
APPLICATION->setStyleSheet(QString());
QApplication::setStyle(QStyleFactory::create(qtTheme()));
diff --git a/launcher/ui/themes/ITheme.h b/launcher/ui/themes/ITheme.h
index 2e5b7f25..a0a638bd 100644
--- a/launcher/ui/themes/ITheme.h
+++ b/launcher/ui/themes/ITheme.h
@@ -41,7 +41,7 @@ class QStyle;
class ITheme {
public:
virtual ~ITheme() {}
- virtual void apply();
+ virtual void apply(bool initial);
virtual QString id() = 0;
virtual QString name() = 0;
virtual bool hasStyleSheet() = 0;
diff --git a/launcher/ui/themes/SystemTheme.cpp b/launcher/ui/themes/SystemTheme.cpp
index 24875e33..a95bc875 100644
--- a/launcher/ui/themes/SystemTheme.cpp
+++ b/launcher/ui/themes/SystemTheme.cpp
@@ -60,9 +60,13 @@ SystemTheme::SystemTheme()
themeDebugLog() << "System theme not found, defaulted to Fusion";
}
-void SystemTheme::apply()
+void SystemTheme::apply(bool initial)
{
- ITheme::apply();
+ // See https://github.com/MultiMC/Launcher/issues/1790
+ // or https://github.com/PrismLauncher/PrismLauncher/issues/490
+ if (initial)
+ return;
+ ITheme::apply(initial);
}
QString SystemTheme::id()
diff --git a/launcher/ui/themes/SystemTheme.h b/launcher/ui/themes/SystemTheme.h
index b5c03def..05f31233 100644
--- a/launcher/ui/themes/SystemTheme.h
+++ b/launcher/ui/themes/SystemTheme.h
@@ -40,7 +40,7 @@ class SystemTheme : public ITheme {
public:
SystemTheme();
virtual ~SystemTheme() {}
- void apply() override;
+ void apply(bool initial) override;
QString id() override;
QString name() override;
diff --git a/launcher/ui/themes/ThemeManager.cpp b/launcher/ui/themes/ThemeManager.cpp
index 13406485..94ac8a24 100644
--- a/launcher/ui/themes/ThemeManager.cpp
+++ b/launcher/ui/themes/ThemeManager.cpp
@@ -116,22 +116,22 @@ void ThemeManager::setIconTheme(const QString& name)
QIcon::setThemeName(name);
}
-void ThemeManager::applyCurrentlySelectedTheme()
+void ThemeManager::applyCurrentlySelectedTheme(bool initial)
{
setIconTheme(APPLICATION->settings()->get("IconTheme").toString());
themeDebugLog() << "<> Icon theme set.";
- setApplicationTheme(APPLICATION->settings()->get("ApplicationTheme").toString());
+ setApplicationTheme(APPLICATION->settings()->get("ApplicationTheme").toString(), initial);
themeDebugLog() << "<> Application theme set.";
}
-void ThemeManager::setApplicationTheme(const QString& name)
+void ThemeManager::setApplicationTheme(const QString& name, bool initial)
{
auto systemPalette = qApp->palette();
auto themeIter = m_themes.find(name);
if (themeIter != m_themes.end()) {
auto& theme = themeIter->second;
themeDebugLog() << "applying theme" << theme->name();
- theme->apply();
+ theme->apply(initial);
} else {
themeWarningLog() << "Tried to set invalid theme:" << name;
}
diff --git a/launcher/ui/themes/ThemeManager.h b/launcher/ui/themes/ThemeManager.h
index 9af44b5a..87f36d9c 100644
--- a/launcher/ui/themes/ThemeManager.h
+++ b/launcher/ui/themes/ThemeManager.h
@@ -37,8 +37,8 @@ class ThemeManager {
QList<ITheme*> getValidApplicationThemes();
void setIconTheme(const QString& name);
- void applyCurrentlySelectedTheme();
- void setApplicationTheme(const QString& name);
+ void applyCurrentlySelectedTheme(bool initial = false);
+ void setApplicationTheme(const QString& name, bool initial = false);
/// <summary>
/// Returns the cat based on selected cat and with events (Birthday, XMas, etc.)
diff --git a/nix/default.nix b/nix/default.nix
index 6d4f3f24..e0616b6e 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -2,6 +2,7 @@
lib,
stdenv,
cmake,
+ ninja,
jdk8,
jdk17,
zlib,
@@ -22,6 +23,8 @@
cmark,
msaClientID ? "",
jdks ? [jdk17 jdk8],
+ gamemodeSupport ? true,
+ gamemode,
# flake
self,
version,
@@ -33,7 +36,7 @@ stdenv.mkDerivation rec {
src = lib.cleanSource self;
- nativeBuildInputs = [extra-cmake-modules cmake file jdk17 wrapQtAppsHook];
+ nativeBuildInputs = [extra-cmake-modules cmake file jdk17 ninja wrapQtAppsHook];
buildInputs =
[
qtbase
@@ -44,12 +47,12 @@ stdenv.mkDerivation rec {
tomlplusplus
cmark
]
- ++ lib.optional (lib.versionAtLeast qtbase.version "6") qtwayland;
+ ++ lib.optional (lib.versionAtLeast qtbase.version "6") qtwayland
+ ++ lib.optional gamemodeSupport gamemode.dev;
cmakeFlags =
lib.optionals (msaClientID != "") ["-DLauncher_MSA_CLIENT_ID=${msaClientID}"]
++ lib.optionals (lib.versionOlder qtbase.version "6") ["-DLauncher_QT_VERSION_MAJOR=5"];
- dontWrapQtApps = true;
postUnpack = ''
rm -rf source/libraries/libnbtplusplus
@@ -59,27 +62,27 @@ stdenv.mkDerivation rec {
chown -R $USER: source/libraries/libnbtplusplus
'';
- postInstall = let
+ qtWrapperArgs = let
libpath = with xorg;
- lib.makeLibraryPath [
- libX11
- libXext
- libXcursor
- libXrandr
- libXxf86vm
- libpulseaudio
- libGL
- glfw
- openal
- stdenv.cc.cc.lib
- ];
- in ''
+ lib.makeLibraryPath ([
+ libX11
+ libXext
+ libXcursor
+ libXrandr
+ libXxf86vm
+ libpulseaudio
+ libGL
+ glfw
+ openal
+ stdenv.cc.cc.lib
+ ]
+ ++ lib.optional gamemodeSupport gamemode.lib);
+ in [
+ "--set LD_LIBRARY_PATH /run/opengl-driver/lib:${libpath}"
+ "--prefix PRISMLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}"
# xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
- wrapQtApp $out/bin/prismlauncher \
- --set LD_LIBRARY_PATH /run/opengl-driver/lib:${libpath} \
- --prefix PRISMLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks} \
- --prefix PATH : ${lib.makeBinPath [xorg.xrandr]}
- '';
+ "--prefix PATH : ${lib.makeBinPath [xorg.xrandr]}"
+ ];
meta = with lib; {
homepage = "https://prismlauncher.org/";