aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/launch
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/minecraft/launch')
-rw-r--r--launcher/minecraft/launch/DirectJavaLaunch.cpp22
-rw-r--r--launcher/minecraft/launch/LauncherPartLaunch.cpp30
2 files changed, 46 insertions, 6 deletions
diff --git a/launcher/minecraft/launch/DirectJavaLaunch.cpp b/launcher/minecraft/launch/DirectJavaLaunch.cpp
index 742170fa..152485b3 100644
--- a/launcher/minecraft/launch/DirectJavaLaunch.cpp
+++ b/launcher/minecraft/launch/DirectJavaLaunch.cpp
@@ -12,13 +12,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
#include "DirectJavaLaunch.h"
+
+#include <QStandardPaths>
+
#include <launch/LaunchTask.h>
#include <minecraft/MinecraftInstance.h>
#include <FileSystem.h>
#include <Commandline.h>
-#include <QStandardPaths>
+
+#ifdef Q_OS_LINUX
+#include "gamemode_client.h"
+#endif
DirectJavaLaunch::DirectJavaLaunch(LaunchTask *parent) : LaunchStep(parent)
{
@@ -50,7 +55,7 @@ void DirectJavaLaunch::executeTask()
auto javaPath = FS::ResolveExecutable(instance->settings()->get("JavaPath").toString());
- m_process.setProcessEnvironment(instance->createEnvironment());
+ m_process.setProcessEnvironment(instance->createLaunchEnvironment());
// make detachable - this will keep the process running even if the object is destroyed
m_process.setDetachable(true);
@@ -79,6 +84,17 @@ void DirectJavaLaunch::executeTask()
{
m_process.start(javaPath, args);
}
+
+#ifdef Q_OS_LINUX
+ if (instance->settings()->get("EnableFeralGamemode").toBool())
+ {
+ auto pid = m_process.processId();
+ if (pid)
+ {
+ gamemode_request_start_for(pid);
+ }
+ }
+#endif
}
void DirectJavaLaunch::on_state(LoggedProcess::State state)
diff --git a/launcher/minecraft/launch/LauncherPartLaunch.cpp b/launcher/minecraft/launch/LauncherPartLaunch.cpp
index 427bc32b..9965ef89 100644
--- a/launcher/minecraft/launch/LauncherPartLaunch.cpp
+++ b/launcher/minecraft/launch/LauncherPartLaunch.cpp
@@ -44,6 +44,10 @@
#include "Commandline.h"
#include "Application.h"
+#ifdef Q_OS_LINUX
+#include "gamemode_client.h"
+#endif
+
LauncherPartLaunch::LauncherPartLaunch(LaunchTask *parent) : LaunchStep(parent)
{
auto instance = parent->instance();
@@ -92,6 +96,15 @@ bool fitsInLocal8bit(const QString & string)
void LauncherPartLaunch::executeTask()
{
+ QString jarPath = APPLICATION->getJarPath("NewLaunch.jar");
+ if (jarPath.isEmpty())
+ {
+ const char *reason = QT_TR_NOOP("Launcher library could not be found. Please check your installation.");
+ emit logLine(tr(reason), MessageLevel::Fatal);
+ emitFailed(tr(reason));
+ return;
+ }
+
auto instance = m_parent->instance();
std::shared_ptr<MinecraftInstance> minecraftInstance = std::dynamic_pointer_cast<MinecraftInstance>(instance);
@@ -102,13 +115,13 @@ void LauncherPartLaunch::executeTask()
auto javaPath = FS::ResolveExecutable(instance->settings()->get("JavaPath").toString());
- m_process.setProcessEnvironment(instance->createEnvironment());
+ m_process.setProcessEnvironment(instance->createLaunchEnvironment());
// make detachable - this will keep the process running even if the object is destroyed
m_process.setDetachable(true);
auto classPath = minecraftInstance->getClassPath();
- classPath.prepend(FS::PathCombine(APPLICATION->getJarsPath(), "NewLaunch.jar"));
+ classPath.prepend(jarPath);
auto natPath = minecraftInstance->getNativePath();
#ifdef Q_OS_WIN
@@ -142,7 +155,7 @@ void LauncherPartLaunch::executeTask()
#else
args << classPath.join(':');
#endif
- args << "org.multimc.EntryPoint";
+ args << "org.polymc.EntryPoint";
qDebug() << args.join(' ');
@@ -167,6 +180,17 @@ void LauncherPartLaunch::executeTask()
{
m_process.start(javaPath, args);
}
+
+#ifdef Q_OS_LINUX
+ if (instance->settings()->get("EnableFeralGamemode").toBool())
+ {
+ auto pid = m_process.processId();
+ if (pid)
+ {
+ gamemode_request_start_for(pid);
+ }
+ }
+#endif
}
void LauncherPartLaunch::on_state(LoggedProcess::State state)