diff options
| author | OverMighty <its.overmighty@gmail.com> | 2020-05-04 11:36:41 +0200 | 
|---|---|---|
| committer | OverMighty <its.overmighty@gmail.com> | 2020-05-04 11:36:41 +0200 | 
| commit | 313a6574c15e0cc0fd9bb510609b63905d1c760b (patch) | |
| tree | 02d108881481f76c6c1dd6faab0cc2b844fcf8de /api/logic | |
| parent | 381c12547fe91a7392f42337674da390841b39ed (diff) | |
| parent | 5ca5661c23050d738f1d5f9ced5e7fb71eef3fce (diff) | |
| download | PrismLauncher-313a6574c15e0cc0fd9bb510609b63905d1c760b.tar.gz PrismLauncher-313a6574c15e0cc0fd9bb510609b63905d1c760b.tar.bz2 PrismLauncher-313a6574c15e0cc0fd9bb510609b63905d1c760b.zip | |
chore: pull changes from upstream
Diffstat (limited to 'api/logic')
| -rw-r--r-- | api/logic/Env.cpp | 1 | ||||
| -rw-r--r-- | api/logic/Version.cpp | 2 | ||||
| -rw-r--r-- | api/logic/minecraft/LaunchProfile.cpp | 22 | ||||
| -rw-r--r-- | api/logic/minecraft/LaunchProfile.h | 7 | ||||
| -rw-r--r-- | api/logic/minecraft/OneSixVersionFormat.cpp | 25 | ||||
| -rw-r--r-- | api/logic/minecraft/VersionFile.cpp | 6 | ||||
| -rw-r--r-- | api/logic/minecraft/VersionFile.h | 3 | ||||
| -rw-r--r-- | api/logic/minecraft/update/LibrariesTask.cpp | 1 | 
8 files changed, 58 insertions, 9 deletions
| diff --git a/api/logic/Env.cpp b/api/logic/Env.cpp index 77546bbc..0d496d4e 100644 --- a/api/logic/Env.cpp +++ b/api/logic/Env.cpp @@ -97,6 +97,7 @@ void Env::initHttpMetaCache()      m_metacache->addBase("liteloader", QDir("mods/liteloader").absolutePath());      m_metacache->addBase("general", QDir("cache").absolutePath());      m_metacache->addBase("FTBPacks", QDir("cache/FTBPacks").absolutePath()); +    m_metacache->addBase("TwitchPacks", QDir("cache/TwitchPacks").absolutePath());      m_metacache->addBase("skins", QDir("accounts/skins").absolutePath());      m_metacache->addBase("root", QDir::currentPath());      m_metacache->addBase("translations", QDir("translations").absolutePath()); diff --git a/api/logic/Version.cpp b/api/logic/Version.cpp index 42eac669..6392a50f 100644 --- a/api/logic/Version.cpp +++ b/api/logic/Version.cpp @@ -78,7 +78,7 @@ void Version::parse()      // FIXME: this is bad. versions can contain a lot more separators...      QStringList parts = m_string.split('.'); -    for (const auto part : parts) +    for (const auto &part : parts)      {          m_sections.append(Section(part));      } diff --git a/api/logic/minecraft/LaunchProfile.cpp b/api/logic/minecraft/LaunchProfile.cpp index c39bdf04..41705187 100644 --- a/api/logic/minecraft/LaunchProfile.cpp +++ b/api/logic/minecraft/LaunchProfile.cpp @@ -11,6 +11,7 @@ void LaunchProfile::clear()      m_mainClass.clear();      m_appletClass.clear();      m_libraries.clear(); +    m_mavenFiles.clear();      m_traits.clear();      m_jarMods.clear();      m_mainJar.reset(); @@ -157,6 +158,22 @@ void LaunchProfile::applyLibrary(LibraryPtr library)      }  } +void LaunchProfile::applyMavenFile(LibraryPtr mavenFile) +{ +    if(!mavenFile->isActive()) +    { +        return; +    } + +    if(mavenFile->isNative()) +    { +        return; +    } + +    // unlike libraries, we do not keep only one version or try to dedupe them +    m_mavenFiles.append(Library::limitedCopy(mavenFile)); +} +  const LibraryPtr LaunchProfile::getMainJar() const  {      return m_mainJar; @@ -253,6 +270,11 @@ const QList<LibraryPtr> & LaunchProfile::getNativeLibraries() const      return m_nativeLibraries;  } +const QList<LibraryPtr> & LaunchProfile::getMavenFiles() const +{ +    return m_mavenFiles; +} +  void LaunchProfile::getLibraryFiles(      const QString& architecture,      QStringList& jars, diff --git a/api/logic/minecraft/LaunchProfile.h b/api/logic/minecraft/LaunchProfile.h index 77174079..c1752531 100644 --- a/api/logic/minecraft/LaunchProfile.h +++ b/api/logic/minecraft/LaunchProfile.h @@ -20,6 +20,7 @@ public: /* application of profile variables from patches */      void applyJarMods(const QList<LibraryPtr> &jarMods);      void applyMods(const QList<LibraryPtr> &jarMods);      void applyLibrary(LibraryPtr library); +    void applyMavenFile(LibraryPtr library);      void applyMainJar(LibraryPtr jar);      void applyProblemSeverity(ProblemSeverity severity);      /// clear the profile @@ -37,6 +38,7 @@ public: /* getters for profile variables */      const QList<LibraryPtr> & getJarMods() const;      const QList<LibraryPtr> & getLibraries() const;      const QList<LibraryPtr> & getNativeLibraries() const; +    const QList<LibraryPtr> & getMavenFiles() const;      const LibraryPtr getMainJar() const;      void getLibraryFiles(          const QString & architecture, @@ -79,10 +81,13 @@ private:      /// the list of libraries      QList<LibraryPtr> m_libraries; +    /// the list of maven files to be placed in the libraries folder, but not acted upon +    QList<LibraryPtr> m_mavenFiles; +      /// the main jar      LibraryPtr m_mainJar; -    /// the list of libraries +    /// the list of native libraries      QList<LibraryPtr> m_nativeLibraries;      /// traits, collected from all the version files (version files can only add) diff --git a/api/logic/minecraft/OneSixVersionFormat.cpp b/api/logic/minecraft/OneSixVersionFormat.cpp index 6f3b926b..a0b6fd0e 100644 --- a/api/logic/minecraft/OneSixVersionFormat.cpp +++ b/api/logic/minecraft/OneSixVersionFormat.cpp @@ -144,14 +144,14 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc          }      } -    auto readLibs = [&](const char * which) +    auto readLibs = [&](const char * which, QList<LibraryPtr> & out)      {          for (auto libVal : requireArray(root.value(which)))          {              QJsonObject libObj = requireObject(libVal);              // parse the library              auto lib = libraryFromJson(libObj, filename); -            out->libraries.append(lib); +            out.append(lib);          }      };      bool hasPlusLibs = root.contains("+libraries"); @@ -160,16 +160,20 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc      {          out->addProblem(ProblemSeverity::Warning,                          QObject::tr("Version file has both '+libraries' and 'libraries'. This is no longer supported.")); -        readLibs("libraries"); -        readLibs("+libraries"); +        readLibs("libraries", out->libraries); +        readLibs("+libraries", out->libraries);      }      else if (hasLibs)      { -        readLibs("libraries"); +        readLibs("libraries", out->libraries);      }      else if(hasPlusLibs)      { -        readLibs("+libraries"); +        readLibs("+libraries", out->libraries); +    } + +    if(root.contains("mavenFiles")) { +        readLibs("mavenFiles", out->mavenFiles);      }      // if we have mainJar, just use it @@ -276,6 +280,15 @@ QJsonDocument OneSixVersionFormat::versionFileToJson(const VersionFilePtr &patch          }          root.insert("libraries", array);      } +    if (!patch->mavenFiles.isEmpty()) +    { +        QJsonArray array; +        for (auto value: patch->mavenFiles) +        { +            array.append(OneSixVersionFormat::libraryToJson(value.get())); +        } +        root.insert("mavenFiles", array); +    }      if (!patch->jarMods.isEmpty())      {          QJsonArray array; diff --git a/api/logic/minecraft/VersionFile.cpp b/api/logic/minecraft/VersionFile.cpp index cfb9e504..5bad57e9 100644 --- a/api/logic/minecraft/VersionFile.cpp +++ b/api/logic/minecraft/VersionFile.cpp @@ -41,6 +41,10 @@ void VersionFile::applyTo(LaunchProfile *profile)      {          profile->applyLibrary(library);      } +    for (auto mavenFile : mavenFiles) +    { +        profile->applyMavenFile(mavenFile); +    }      profile->applyProblemSeverity(getProblemSeverity());  } @@ -53,4 +57,4 @@ void VersionFile::applyTo(LaunchProfile *profile)              throw MinecraftVersionMismatch(uid, dependsOnMinecraftVersion, theirVersion);          }      } -*/
\ No newline at end of file +*/ diff --git a/api/logic/minecraft/VersionFile.h b/api/logic/minecraft/VersionFile.h index 3dc9db96..29ddd0bc 100644 --- a/api/logic/minecraft/VersionFile.h +++ b/api/logic/minecraft/VersionFile.h @@ -75,6 +75,9 @@ public: /* data */      /// Mojang: list of libraries to add to the version      QList<LibraryPtr> libraries; +    /// MultiMC: list of maven files to put in the libraries folder, but not in classpath +    QList<LibraryPtr> mavenFiles; +      /// The main jar (Minecraft version library, normally)      LibraryPtr mainJar; diff --git a/api/logic/minecraft/update/LibrariesTask.cpp b/api/logic/minecraft/update/LibrariesTask.cpp index 912f492b..a000f77f 100644 --- a/api/logic/minecraft/update/LibrariesTask.cpp +++ b/api/logic/minecraft/update/LibrariesTask.cpp @@ -45,6 +45,7 @@ void LibrariesTask::executeTask()      QList<LibraryPtr> libArtifactPool;      libArtifactPool.append(profile->getLibraries());      libArtifactPool.append(profile->getNativeLibraries()); +    libArtifactPool.append(profile->getMavenFiles());      libArtifactPool.append(profile->getMainJar());      processArtifactPool(libArtifactPool, failedLocalLibraries, inst->getLocalLibraryPath()); | 
