| 81 | } |
| 82 | |
| 83 | void ExtractNatives::executeTask() |
| 84 | { |
| 85 | auto instance = m_parent->instance(); |
| 86 | std::shared_ptr<MinecraftInstance> minecraftInstance = std::dynamic_pointer_cast<MinecraftInstance>(instance); |
| 87 | auto toExtract = minecraftInstance->getNativeJars(); |
| 88 | if(toExtract.isEmpty()) |
| 89 | { |
| 90 | emitSucceeded(); |
| 91 | return; |
| 92 | } |
| 93 | auto settings = minecraftInstance->settings(); |
| 94 | bool nativeOpenAL = settings->get("UseNativeOpenAL").toBool(); |
| 95 | bool nativeGLFW = settings->get("UseNativeGLFW").toBool(); |
| 96 | |
| 97 | auto outputPath = minecraftInstance->getNativePath(); |
| 98 | auto javaVersion = minecraftInstance->getJavaVersion(); |
| 99 | bool jniHackEnabled = javaVersion.major() >= 8; |
| 100 | for(const auto &source: toExtract) |
| 101 | { |
| 102 | if(!unzipNatives(source, outputPath, jniHackEnabled, nativeOpenAL, nativeGLFW)) |
| 103 | { |
| 104 | const char *reason = QT_TR_NOOP("Couldn't extract native jar '%1' to destination '%2'"); |
| 105 | emit logLine(QString(reason).arg(source, outputPath), MessageLevel::Fatal); |
| 106 | emitFailed(tr(reason).arg(source, outputPath)); |
| 107 | } |
| 108 | } |
| 109 | emitSucceeded(); |
| 110 | } |
| 111 | |
| 112 | void ExtractNatives::finalize() |
| 113 | { |
nothing calls this directly
no test coverage detected