summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/logic/minecraft/Library.cpp13
-rw-r--r--api/logic/minecraft/Library_test.cpp2
-rw-r--r--api/logic/minecraft/MinecraftProfile.cpp28
-rw-r--r--api/logic/minecraft/MinecraftProfile.h4
-rw-r--r--api/logic/minecraft/onesix/OneSixInstance.cpp2
-rw-r--r--api/logic/minecraft/onesix/update/LibrariesTask.cpp18
6 files changed, 48 insertions, 19 deletions
diff --git a/api/logic/minecraft/Library.cpp b/api/logic/minecraft/Library.cpp
index ad0a64cf..7521a049 100644
--- a/api/logic/minecraft/Library.cpp
+++ b/api/logic/minecraft/Library.cpp
@@ -30,14 +30,15 @@ void Library::getApplicableFiles(OpSys system, QStringList& jar, QStringList& na
};
if(m_mojangDownloads)
{
- if(m_mojangDownloads->artifact)
+ if(!isNative())
{
- auto artifact = m_mojangDownloads->artifact;
- jar += actualPath(artifact->path);
+ if(m_mojangDownloads->artifact)
+ {
+ auto artifact = m_mojangDownloads->artifact;
+ jar += actualPath(artifact->path);
+ }
}
- if(!isNative())
- return;
- if(m_nativeClassifiers.contains(system))
+ else if(m_nativeClassifiers.contains(system))
{
auto nativeClassifier = m_nativeClassifiers[system];
if(nativeClassifier.contains("${arch}"))
diff --git a/api/logic/minecraft/Library_test.cpp b/api/logic/minecraft/Library_test.cpp
index fe61d305..3f4828c9 100644
--- a/api/logic/minecraft/Library_test.cpp
+++ b/api/logic/minecraft/Library_test.cpp
@@ -234,7 +234,7 @@ slots:
auto test = readMojangJson("data/lib-native.json");
QStringList jar, native, native32, native64;
test->getApplicableFiles(Os_OSX, jar, native, native32, native64, QString());
- QCOMPARE(jar, getStorage("org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209.jar"));
+ QCOMPARE(jar, QStringList());
QCOMPARE(native, getStorage("org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209-natives-osx.jar"));
QCOMPARE(native32, {});
QCOMPARE(native64, {});
diff --git a/api/logic/minecraft/MinecraftProfile.cpp b/api/logic/minecraft/MinecraftProfile.cpp
index 8638f5fa..c04669c1 100644
--- a/api/logic/minecraft/MinecraftProfile.cpp
+++ b/api/logic/minecraft/MinecraftProfile.cpp
@@ -491,20 +491,29 @@ void MinecraftProfile::applyLibrary(LibraryPtr library)
{
return;
}
+
+ QList<LibraryPtr> * list = &m_libraries;
+ if(library->isNative())
+ {
+ list = &m_nativeLibraries;
+ }
+
+ auto libraryCopy = Library::limitedCopy(library);
+
// find the library by name.
- const int index = findLibraryByName(m_libraries, library->rawName());
+ const int index = findLibraryByName(*list, library->rawName());
// library not found? just add it.
if (index < 0)
{
- m_libraries.append(Library::limitedCopy(library));
+ list->append(libraryCopy);
return;
}
- auto existingLibrary = m_libraries.at(index);
+
+ auto existingLibrary = list->at(index);
// if we are higher it means we should update
if (Version(library->version()) > Version(existingLibrary->version()))
{
- auto libraryCopy = Library::limitedCopy(library);
- m_libraries.replace(index, libraryCopy);
+ list->replace(index, libraryCopy);
}
}
@@ -581,6 +590,11 @@ const QList<LibraryPtr> & MinecraftProfile::getLibraries() const
return m_libraries;
}
+const QList<LibraryPtr> & MinecraftProfile::getNativeLibraries() const
+{
+ return m_nativeLibraries;
+}
+
void MinecraftProfile::getLibraryFiles(const QString& architecture, QStringList& jars, QStringList& nativeJars, const QString& overridePath) const
{
QStringList native32, native64;
@@ -590,6 +604,10 @@ void MinecraftProfile::getLibraryFiles(const QString& architecture, QStringList&
{
lib->getApplicableFiles(currentSystem, jars, nativeJars, native32, native64, overridePath);
}
+ for (auto lib : getNativeLibraries())
+ {
+ lib->getApplicableFiles(currentSystem, jars, nativeJars, native32, native64, overridePath);
+ }
if(architecture == "32")
{
nativeJars.append(native32);
diff --git a/api/logic/minecraft/MinecraftProfile.h b/api/logic/minecraft/MinecraftProfile.h
index a3b8fb61..5b1ea539 100644
--- a/api/logic/minecraft/MinecraftProfile.h
+++ b/api/logic/minecraft/MinecraftProfile.h
@@ -115,6 +115,7 @@ public: /* getters for profile variables */
const QStringList & getTweakers() const;
const QList<JarmodPtr> & getJarMods() const;
const QList<LibraryPtr> & getLibraries() const;
+ const QList<LibraryPtr> & getNativeLibraries() const;
void getLibraryFiles(const QString & architecture, QStringList & jars, QStringList & nativeJars, const QString & overridePath) const;
QString getMainJarUrl() const;
bool hasTrait(const QString & trait) const;
@@ -169,6 +170,9 @@ private: /* data */
/// the list of libraries
QList<LibraryPtr> m_libraries;
+ /// the list of libraries
+ QList<LibraryPtr> m_nativeLibraries;
+
/// traits, collected from all the version files (version files can only add)
QSet<QString> m_traits;
diff --git a/api/logic/minecraft/onesix/OneSixInstance.cpp b/api/logic/minecraft/onesix/OneSixInstance.cpp
index 2d50330f..fd54f544 100644
--- a/api/logic/minecraft/onesix/OneSixInstance.cpp
+++ b/api/logic/minecraft/onesix/OneSixInstance.cpp
@@ -283,6 +283,8 @@ QStringList OneSixInstance::verboseDescription(AuthSessionPtr session)
printLibFile(file);
}
printLibFile(mainJarPath());
+ out << "";
+ out << "Native libraries:";
for(auto file: nativeJars)
{
printLibFile(file);
diff --git a/api/logic/minecraft/onesix/update/LibrariesTask.cpp b/api/logic/minecraft/onesix/update/LibrariesTask.cpp
index f60c2b5e..3e6bb12a 100644
--- a/api/logic/minecraft/onesix/update/LibrariesTask.cpp
+++ b/api/logic/minecraft/onesix/update/LibrariesTask.cpp
@@ -35,19 +35,23 @@ void LibrariesTask::executeTask()
downloadJob.reset(job);
}
- auto libs = profile->getLibraries();
-
auto metacache = ENV.metacache();
QList<LibraryPtr> brokenLocalLibs;
QStringList failedFiles;
- for (auto lib : libs)
+ auto createJobs = [&](const QList<LibraryPtr> & libs)
{
- auto dls = lib->getDownloads(currentSystem, metacache.get(), failedFiles, inst->getLocalLibraryPath());
- for(auto dl : dls)
+ for (auto lib : libs)
{
- downloadJob->addNetAction(dl);
+ auto dls = lib->getDownloads(currentSystem, metacache.get(), failedFiles, inst->getLocalLibraryPath());
+ for(auto dl : dls)
+ {
+ downloadJob->addNetAction(dl);
+ }
}
- }
+ };
+ createJobs(profile->getLibraries());
+ createJobs(profile->getNativeLibraries());
+
// FIXME: this is never filled!!!!
if (!brokenLocalLibs.empty())
{