diff options
Diffstat (limited to 'launcher/modplatform')
| -rw-r--r-- | launcher/modplatform/ResourceAPI.h | 4 | ||||
| -rw-r--r-- | launcher/modplatform/flame/FlameAPI.h | 2 | ||||
| -rw-r--r-- | launcher/modplatform/flame/FlamePackExportTask.cpp | 4 | ||||
| -rw-r--r-- | launcher/modplatform/flame/FlamePackExportTask.h | 2 | ||||
| -rw-r--r-- | launcher/modplatform/helpers/NetworkResourceAPI.cpp | 3 | ||||
| -rw-r--r-- | launcher/modplatform/modrinth/ModrinthPackExportTask.cpp | 24 | ||||
| -rw-r--r-- | launcher/modplatform/modrinth/ModrinthPackExportTask.h | 2 | 
7 files changed, 28 insertions, 13 deletions
diff --git a/launcher/modplatform/ResourceAPI.h b/launcher/modplatform/ResourceAPI.h index 7965d0f5..3b195938 100644 --- a/launcher/modplatform/ResourceAPI.h +++ b/launcher/modplatform/ResourceAPI.h @@ -105,7 +105,9 @@ class ResourceAPI {          void operator=(ProjectInfoArgs other) { pack = other.pack; }      };      struct ProjectInfoCallbacks { -        std::function<void(QJsonDocument&, ModPlatform::IndexedPack)> on_succeed; +        std::function<void(QJsonDocument&, const ModPlatform::IndexedPack&)> on_succeed; +        std::function<void(QString const& reason)> on_fail; +        std::function<void()> on_abort;      };      struct DependencySearchArgs { diff --git a/launcher/modplatform/flame/FlameAPI.h b/launcher/modplatform/flame/FlameAPI.h index 47350c33..e22d8f0d 100644 --- a/launcher/modplatform/flame/FlameAPI.h +++ b/launcher/modplatform/flame/FlameAPI.h @@ -38,6 +38,8 @@ class FlameAPI : public NetworkResourceAPI {                  return 6;              case ModPlatform::ResourceType::RESOURCE_PACK:                  return 12; +            case ModPlatform::ResourceType::SHADER_PACK: +                return 6552;          }      } diff --git a/launcher/modplatform/flame/FlamePackExportTask.cpp b/launcher/modplatform/flame/FlamePackExportTask.cpp index 0863f0b2..d86d34bf 100644 --- a/launcher/modplatform/flame/FlamePackExportTask.cpp +++ b/launcher/modplatform/flame/FlamePackExportTask.cpp @@ -43,12 +43,14 @@ const QStringList FlamePackExportTask::FILE_EXTENSIONS({ "jar", "zip" });  FlamePackExportTask::FlamePackExportTask(const QString& name,                                           const QString& version,                                           const QString& author, +                                         bool optionalFiles,                                           InstancePtr instance,                                           const QString& output,                                           MMCZip::FilterFunction filter)      : name(name)      , version(version)      , author(author) +    , optionalFiles(optionalFiles)      , instance(instance)      , mcInstance(dynamic_cast<MinecraftInstance*>(instance.get()))      , gameRoot(instance->gameRoot()) @@ -410,7 +412,7 @@ QByteArray FlamePackExportTask::generateIndex()          QJsonObject file;          file["projectID"] = mod.addonId;          file["fileID"] = mod.version; -        file["required"] = mod.enabled; +        file["required"] = mod.enabled || !optionalFiles;          files << file;      }      obj["files"] = files; diff --git a/launcher/modplatform/flame/FlamePackExportTask.h b/launcher/modplatform/flame/FlamePackExportTask.h index d3dc6281..78b46e91 100644 --- a/launcher/modplatform/flame/FlamePackExportTask.h +++ b/launcher/modplatform/flame/FlamePackExportTask.h @@ -30,6 +30,7 @@ class FlamePackExportTask : public Task {      FlamePackExportTask(const QString& name,                          const QString& version,                          const QString& author, +                        bool optionalFiles,                          InstancePtr instance,                          const QString& output,                          MMCZip::FilterFunction filter); @@ -44,6 +45,7 @@ class FlamePackExportTask : public Task {      // inputs      const QString name, version, author; +    const bool optionalFiles;      const InstancePtr instance;      MinecraftInstance* mcInstance;      const QDir gameRoot; diff --git a/launcher/modplatform/helpers/NetworkResourceAPI.cpp b/launcher/modplatform/helpers/NetworkResourceAPI.cpp index 78b39fff..dccccdc2 100644 --- a/launcher/modplatform/helpers/NetworkResourceAPI.cpp +++ b/launcher/modplatform/helpers/NetworkResourceAPI.cpp @@ -72,7 +72,8 @@ Task::Ptr NetworkResourceAPI::getProjectInfo(ProjectInfoArgs&& args, ProjectInfo          callbacks.on_succeed(doc, args.pack);      }); - +    QObject::connect(job.get(), &NetJob::failed, [callbacks](QString reason) { callbacks.on_fail(reason); }); +    QObject::connect(job.get(), &NetJob::aborted, [callbacks] { callbacks.on_abort(); });      return job;  } diff --git a/launcher/modplatform/modrinth/ModrinthPackExportTask.cpp b/launcher/modplatform/modrinth/ModrinthPackExportTask.cpp index ad8fefac..a9ddb0c9 100644 --- a/launcher/modplatform/modrinth/ModrinthPackExportTask.cpp +++ b/launcher/modplatform/modrinth/ModrinthPackExportTask.cpp @@ -33,12 +33,14 @@ const QStringList ModrinthPackExportTask::FILE_EXTENSIONS({ "jar", "litemod", "z  ModrinthPackExportTask::ModrinthPackExportTask(const QString& name,                                                 const QString& version,                                                 const QString& summary, +                                               bool optionalFiles,                                                 InstancePtr instance,                                                 const QString& output,                                                 MMCZip::FilterFunction filter)      : name(name)      , version(version)      , summary(summary) +    , optionalFiles(optionalFiles)      , instance(instance)      , mcInstance(dynamic_cast<MinecraftInstance*>(instance.get()))      , gameRoot(instance->gameRoot()) @@ -270,16 +272,18 @@ QByteArray ModrinthPackExportTask::generateIndex()          QString path = iterator.key();          const ResolvedFile& value = iterator.value(); -        // detect disabled mod -        const QFileInfo pathInfo(path); -        if (pathInfo.suffix() == "disabled") { -            // rename it -            path = pathInfo.dir().filePath(pathInfo.completeBaseName()); -            // ...and make it optional -            QJsonObject env; -            env["client"] = "optional"; -            env["server"] = "optional"; -            fileOut["env"] = env; +        if (optionalFiles) { +            // detect disabled mod +            const QFileInfo pathInfo(path); +            if (pathInfo.suffix() == "disabled") { +                // rename it +                path = pathInfo.dir().filePath(pathInfo.completeBaseName()); +                // ...and make it optional +                QJsonObject env; +                env["client"] = "optional"; +                env["server"] = "optional"; +                fileOut["env"] = env; +            }          }          fileOut["path"] = path; diff --git a/launcher/modplatform/modrinth/ModrinthPackExportTask.h b/launcher/modplatform/modrinth/ModrinthPackExportTask.h index 1f9e0eb7..83540dfa 100644 --- a/launcher/modplatform/modrinth/ModrinthPackExportTask.h +++ b/launcher/modplatform/modrinth/ModrinthPackExportTask.h @@ -31,6 +31,7 @@ class ModrinthPackExportTask : public Task {      ModrinthPackExportTask(const QString& name,                             const QString& version,                             const QString& summary, +                           bool optionalFiles,                             InstancePtr instance,                             const QString& output,                             MMCZip::FilterFunction filter); @@ -50,6 +51,7 @@ class ModrinthPackExportTask : public Task {      // inputs      const QString name, version, summary; +    const bool optionalFiles;      const InstancePtr instance;      MinecraftInstance* mcInstance;      const QDir gameRoot;  | 
