diff options
author | Petr Mrázek <peterix@gmail.com> | 2020-09-10 23:10:17 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2020-09-10 23:10:17 +0200 |
commit | 5180536cc3a96ab2e6894fb1a8a5922dae6bcd21 (patch) | |
tree | a3d0d1c36f479ebf48bfa268fbf7d6e487d839b2 /api | |
parent | 27e43d037e3b75862542c6437ccb59e1d42452d5 (diff) | |
download | MultiMC-5180536cc3a96ab2e6894fb1a8a5922dae6bcd21.tar MultiMC-5180536cc3a96ab2e6894fb1a8a5922dae6bcd21.tar.gz MultiMC-5180536cc3a96ab2e6894fb1a8a5922dae6bcd21.tar.lz MultiMC-5180536cc3a96ab2e6894fb1a8a5922dae6bcd21.tar.xz MultiMC-5180536cc3a96ab2e6894fb1a8a5922dae6bcd21.zip |
NOISSUE add a way to use native system versions of OpenAL and GLFW
If your OS comes with patched/fixed/newer versions of those,
you can now check the checkboxes and stop using the old ones
shipped by Mojang.
Diffstat (limited to 'api')
-rw-r--r-- | api/logic/minecraft/MinecraftInstance.cpp | 5 | ||||
-rw-r--r-- | api/logic/minecraft/launch/ExtractNatives.cpp | 15 |
2 files changed, 18 insertions, 2 deletions
diff --git a/api/logic/minecraft/MinecraftInstance.cpp b/api/logic/minecraft/MinecraftInstance.cpp index db259395..5fda2f4b 100644 --- a/api/logic/minecraft/MinecraftInstance.cpp +++ b/api/logic/minecraft/MinecraftInstance.cpp @@ -100,6 +100,11 @@ MinecraftInstance::MinecraftInstance(SettingsObjectPtr globalSettings, SettingsO auto launchMethodOverride = m_settings->registerSetting("OverrideMCLaunchMethod", false); m_settings->registerOverride(globalSettings->getSetting("MCLaunchMethod"), launchMethodOverride); + // Native library workarounds + auto nativeLibraryWorkaroundsOverride = m_settings->registerSetting("OverrideNativeWorkarounds", false); + m_settings->registerOverride(globalSettings->getSetting("UseNativeOpenAL"), nativeLibraryWorkaroundsOverride); + m_settings->registerOverride(globalSettings->getSetting("UseNativeGLFW"), nativeLibraryWorkaroundsOverride); + // DEPRECATED: Read what versions the user configuration thinks should be used m_settings->registerSetting({"IntendedVersion", "MinecraftVersion"}, ""); m_settings->registerSetting("LWJGLVersion", ""); diff --git a/api/logic/minecraft/launch/ExtractNatives.cpp b/api/logic/minecraft/launch/ExtractNatives.cpp index 253d13bc..31fd01f8 100644 --- a/api/logic/minecraft/launch/ExtractNatives.cpp +++ b/api/logic/minecraft/launch/ExtractNatives.cpp @@ -33,7 +33,7 @@ static QString replaceSuffix (QString target, const QString &suffix, const QStri return target + replacement; } -static bool unzipNatives(QString source, QString targetFolder, bool applyJnilibHack) +static bool unzipNatives(QString source, QString targetFolder, bool applyJnilibHack, bool nativeOpenAL, bool nativeGLFW) { QuaZip zip(source); if(!zip.open(QuaZip::mdUnzip)) @@ -48,6 +48,13 @@ static bool unzipNatives(QString source, QString targetFolder, bool applyJnilibH do { QString name = zip.getCurrentFileName(); + auto lowercase = name.toLower(); + if (nativeGLFW && name.contains("glfw")) { + continue; + } + if (nativeOpenAL && name.contains("openal")) { + continue; + } if(applyJnilibHack) { name = replaceSuffix(name, ".jnilib", ".dylib"); @@ -76,12 +83,16 @@ void ExtractNatives::executeTask() emitSucceeded(); return; } + auto settings = minecraftInstance->settings(); + bool nativeOpenAL = settings->get("UseNativeOpenAL").toBool(); + bool nativeGLFW = settings->get("UseNativeGLFW").toBool(); + auto outputPath = minecraftInstance->getNativePath(); auto javaVersion = minecraftInstance->getJavaVersion(); bool jniHackEnabled = javaVersion.major() >= 8; for(const auto &source: toExtract) { - if(!unzipNatives(source, outputPath, jniHackEnabled)) + if(!unzipNatives(source, outputPath, jniHackEnabled, nativeOpenAL, nativeGLFW)) { auto reason = tr("Couldn't extract native jar '%1' to destination '%2'").arg(source, outputPath); emit logLine(reason, MessageLevel::Fatal); |