| 576 | } |
| 577 | |
| 578 | QStringList MinecraftInstance::javaArguments() |
| 579 | { |
| 580 | QStringList args; |
| 581 | |
| 582 | args << "-Duser.language=en"; |
| 583 | |
| 584 | // custom args go first. we want to override them if we have our own here. |
| 585 | args.append(extraArguments()); |
| 586 | |
| 587 | // OSX dock icon and name |
| 588 | #ifdef Q_OS_MAC |
| 589 | args << "-Xdock:icon=icon.png"; |
| 590 | args << QString("-Xdock:name=\"%1\"").arg(windowTitle()); |
| 591 | #endif |
| 592 | auto traits_ = traits(); |
| 593 | // HACK: fix issues on macOS with 1.13 snapshots |
| 594 | // NOTE: Oracle Java option. if there are alternate jvm implementations, this would be the place to customize this for them |
| 595 | #ifdef Q_OS_MAC |
| 596 | if (traits_.contains("FirstThreadOnMacOS")) { |
| 597 | args << QString("-XstartOnFirstThread"); |
| 598 | } |
| 599 | #endif |
| 600 | |
| 601 | // HACK: Stupid hack for Intel drivers. See: https://mojang.atlassian.net/browse/MCL-767 |
| 602 | #ifdef Q_OS_WIN32 |
| 603 | args << QString( |
| 604 | "-XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_" |
| 605 | "minecraft.exe.heapdump"); |
| 606 | #endif |
| 607 | |
| 608 | // LWJGL2 reads `LWJGL_DISABLE_XRANDR` to force disable xrandr usage and fall back to xf86videomode. |
| 609 | // It *SHOULD* check for the executable to exist before trying to use it for queries but it doesnt, |
| 610 | // so WE can and force disable xrandr if it is not available. |
| 611 | #ifdef Q_OS_LINUX |
| 612 | // LWJGL2 is "org.lwjgl" LWJGL3 is "org.lwjgl3" |
| 613 | if (m_components->getComponent("org.lwjgl") != nullptr && QStandardPaths::findExecutable("xrandr").isEmpty()) { |
| 614 | args << QString("-DLWJGL_DISABLE_XRANDR=true"); |
| 615 | } |
| 616 | #endif |
| 617 | |
| 618 | int min = settings()->get("MinMemAlloc").toInt(); |
| 619 | int max = settings()->get("MaxMemAlloc").toInt(); |
| 620 | if (min < max) { |
| 621 | args << QString("-Xms%1m").arg(min); |
| 622 | args << QString("-Xmx%1m").arg(max); |
| 623 | } else { |
| 624 | args << QString("-Xms%1m").arg(max); |
| 625 | args << QString("-Xmx%1m").arg(min); |
| 626 | } |
| 627 | |
| 628 | // No PermGen in newer java. |
| 629 | JavaVersion javaVersion = getJavaVersion(); |
| 630 | if (javaVersion.requiresPermGen()) { |
| 631 | auto permgen = settings()->get("PermGen").toInt(); |
| 632 | if (permgen != 64) { |
| 633 | args << QString("-XX:PermSize=%1m").arg(permgen); |
| 634 | } |
| 635 | } |
no test coverage detected