2022-05-26 22:18:54 +01:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
/*
|
2023-08-04 18:41:47 +01:00
|
|
|
* Prism Launcher - Minecraft Launcher
|
2022-05-26 22:18:54 +01:00
|
|
|
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, version 3.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following copyright and
|
|
|
|
* permission notice:
|
|
|
|
*
|
|
|
|
* Copyright 2013-2021 MultiMC Contributors
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2017-04-20 04:22:04 +01:00
|
|
|
#pragma once
|
|
|
|
|
2022-07-14 20:41:49 +01:00
|
|
|
#include <QJsonObject>
|
2022-05-28 20:53:12 +01:00
|
|
|
#include <QMap>
|
2022-07-14 20:41:49 +01:00
|
|
|
#include <QString>
|
2018-01-21 02:49:54 +00:00
|
|
|
#include <QUrl>
|
2022-07-14 20:41:49 +01:00
|
|
|
#include <QVector>
|
2017-04-20 04:22:04 +01:00
|
|
|
|
2023-08-02 17:35:35 +01:00
|
|
|
namespace Flame {
|
|
|
|
struct File {
|
2019-06-30 10:03:59 +01:00
|
|
|
// NOTE: throws JSONValidationError
|
2022-07-21 20:41:44 +01:00
|
|
|
bool parseFromObject(const QJsonObject& object, bool throw_on_blocked = true);
|
2019-06-30 10:03:59 +01:00
|
|
|
|
2018-07-15 13:51:05 +01:00
|
|
|
int projectId = 0;
|
|
|
|
int fileId = 0;
|
2023-08-24 10:44:11 +01:00
|
|
|
// NOTE: the opposite to 'optional'
|
2018-07-15 13:51:05 +01:00
|
|
|
bool required = true;
|
2022-05-28 20:53:12 +01:00
|
|
|
QString hash;
|
|
|
|
// NOTE: only set on blocked files ! Empty otherwise.
|
|
|
|
QString websiteUrl;
|
2017-04-20 04:22:04 +01:00
|
|
|
|
2018-07-15 13:51:05 +01:00
|
|
|
// our
|
|
|
|
bool resolved = false;
|
|
|
|
QString fileName;
|
|
|
|
QUrl url;
|
2022-05-02 18:10:45 +01:00
|
|
|
QString targetFolder = QStringLiteral("mods");
|
2023-08-02 17:35:35 +01:00
|
|
|
enum class Type { Unknown, Folder, Ctoc, SingleFile, Cmod2, Modpack, Mod } type = Type::Mod;
|
2017-04-20 04:22:04 +01:00
|
|
|
};
|
|
|
|
|
2023-08-02 17:35:35 +01:00
|
|
|
struct Modloader {
|
2018-07-15 13:51:05 +01:00
|
|
|
QString id;
|
|
|
|
bool primary = false;
|
2017-04-20 04:22:04 +01:00
|
|
|
};
|
|
|
|
|
2023-08-02 17:35:35 +01:00
|
|
|
struct Minecraft {
|
2018-07-15 13:51:05 +01:00
|
|
|
QString version;
|
|
|
|
QString libraries;
|
|
|
|
QVector<Flame::Modloader> modLoaders;
|
2017-04-20 04:22:04 +01:00
|
|
|
};
|
|
|
|
|
2023-08-02 17:35:35 +01:00
|
|
|
struct Manifest {
|
2018-07-15 13:51:05 +01:00
|
|
|
QString manifestType;
|
|
|
|
int manifestVersion = 0;
|
|
|
|
Flame::Minecraft minecraft;
|
|
|
|
QString name;
|
|
|
|
QString version;
|
|
|
|
QString author;
|
2023-08-02 17:35:35 +01:00
|
|
|
// File id -> File
|
|
|
|
QMap<int, Flame::File> files;
|
2018-07-15 13:51:05 +01:00
|
|
|
QString overrides;
|
2022-07-14 20:41:49 +01:00
|
|
|
|
|
|
|
bool is_loaded = false;
|
2017-04-20 04:22:04 +01:00
|
|
|
};
|
|
|
|
|
2023-08-02 17:35:35 +01:00
|
|
|
void loadManifest(Flame::Manifest& m, const QString& filepath);
|
|
|
|
} // namespace Flame
|