id
int64
0
755k
file_name
stringlengths
3
109
file_path
stringlengths
13
185
content
stringlengths
31
9.38M
size
int64
31
9.38M
language
stringclasses
1 value
extension
stringclasses
11 values
total_lines
int64
1
340k
avg_line_length
float64
2.18
149k
max_line_length
int64
7
2.22M
alphanum_fraction
float64
0
1
repo_name
stringlengths
6
65
repo_stars
int64
100
47.3k
repo_forks
int64
0
12k
repo_open_issues
int64
0
3.4k
repo_license
stringclasses
9 values
repo_extraction_date
stringclasses
92 values
exact_duplicates_redpajama
bool
2 classes
near_duplicates_redpajama
bool
2 classes
exact_duplicates_githubcode
bool
2 classes
exact_duplicates_stackv2
bool
1 class
exact_duplicates_stackv1
bool
2 classes
near_duplicates_githubcode
bool
2 classes
near_duplicates_stackv1
bool
2 classes
near_duplicates_stackv2
bool
1 class
29,558
QuitAfterGameStop.h
PrismLauncher_PrismLauncher/launcher/launch/steps/QuitAfterGameStop.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (C) 2022 dada513 <dada513@protonmail.com> * * 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/>. */ #pragma once #include <launch/LaunchStep.h> class QuitAfterGameStop : public LaunchStep { Q_OBJECT public: explicit QuitAfterGameStop(LaunchTask* parent) : LaunchStep(parent) {}; virtual ~QuitAfterGameStop() = default; virtual void executeTask(); virtual bool canAbort() const { return false; } };
1,064
C++
.h
27
36.851852
75
0.74637
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,559
PreLaunchCommand.h
PrismLauncher_PrismLauncher/launcher/launch/steps/PreLaunchCommand.h
/* 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. */ #pragma once #include "LoggedProcess.h" #include "launch/LaunchStep.h" class PreLaunchCommand : public LaunchStep { Q_OBJECT public: explicit PreLaunchCommand(LaunchTask* parent); virtual ~PreLaunchCommand() {}; virtual void executeTask(); virtual bool abort(); virtual bool canAbort() const { return true; } void setWorkingDirectory(const QString& wd); private slots: void on_state(LoggedProcess::State state); private: LoggedProcess m_process; QString m_command; };
1,128
C++
.h
32
32.15625
75
0.749771
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,560
PostLaunchCommand.h
PrismLauncher_PrismLauncher/launcher/launch/steps/PostLaunchCommand.h
/* 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. */ #pragma once #include <LoggedProcess.h> #include <launch/LaunchStep.h> class PostLaunchCommand : public LaunchStep { Q_OBJECT public: explicit PostLaunchCommand(LaunchTask* parent); virtual ~PostLaunchCommand() {}; virtual void executeTask(); virtual bool abort(); virtual bool canAbort() const { return true; } void setWorkingDirectory(const QString& wd); private slots: void on_state(LoggedProcess::State state); private: LoggedProcess m_process; QString m_command; };
1,131
C++
.h
32
32.25
75
0.750457
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,561
PrintServers.h
PrismLauncher_PrismLauncher/launcher/launch/steps/PrintServers.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2024 Leia uwu <leia@tutamail.com> * * 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/>. */ #pragma once #include <LoggedProcess.h> #include <java/JavaChecker.h> #include <launch/LaunchStep.h> #include <QHostInfo> class PrintServers : public LaunchStep { Q_OBJECT public: PrintServers(LaunchTask* parent, const QStringList& servers); virtual void executeTask(); virtual bool canAbort() const; private: void resolveServer(const QHostInfo& host_info); QMap<QString, QString> m_server_to_address; QStringList m_servers; };
1,201
C++
.h
33
33.787879
74
0.749141
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,562
FileLink.h
PrismLauncher_PrismLauncher/launcher/filelink/FileLink.h
// SPDX-FileCopyrightText: 2022 Rachel Powers <508861+Ryex@users.noreply.github.com> // // SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (C) 2022 Rachel Powers <508861+Ryex@users.noreply.github.com> * * 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/>. * */ #pragma once #include <QtCore> #include <QApplication> #include <QDataStream> #include <QDateTime> #include <QDebug> #include <QFlag> #include <QIcon> #include <QLocalSocket> #include <QUrl> #include <memory> #define PRISM_EXTERNAL_EXE #include "FileSystem.h" class FileLinkApp : public QCoreApplication { // friends for the purpose of limiting access to deprecated stuff Q_OBJECT public: enum Status { Starting, Failed, Succeeded, Initialized }; FileLinkApp(int& argc, char** argv); virtual ~FileLinkApp(); Status status() const { return m_status; } private: void joinServer(QString server); void readPathPairs(); void runLink(); void sendResults(); Status m_status = Status::Starting; bool m_useHardLinks = false; QDateTime m_startTime; QLocalSocket socket; QDataStream in; quint32 blockSize; QList<FS::LinkPair> m_links_to_make; QList<FS::LinkResult> m_path_results; #if defined Q_OS_WIN32 // used on Windows to attach the standard IO streams bool consoleAttached = false; #endif };
1,934
C++
.h
59
29.847458
84
0.739667
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,563
JavaInstallList.h
PrismLauncher_PrismLauncher/launcher/java/JavaInstallList.h
/* 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. */ #pragma once #include <QAbstractListModel> #include <QObject> #include "BaseVersionList.h" #include "java/JavaChecker.h" #include "tasks/Task.h" #include "JavaInstall.h" #include "QObjectPtr.h" class JavaListLoadTask; class JavaInstallList : public BaseVersionList { Q_OBJECT enum class Status { NotDone, InProgress, Done }; public: explicit JavaInstallList(QObject* parent = 0, bool onlyManagedVersions = false); [[nodiscard]] Task::Ptr getLoadTask() override; bool isLoaded() override; const BaseVersion::Ptr at(int i) const override; int count() const override; void sortVersions() override; QVariant data(const QModelIndex& index, int role) const override; RoleList providesRoles() const override; public slots: void updateListData(QList<BaseVersion::Ptr> versions) override; protected: void load(); Task::Ptr getCurrentTask(); protected: Status m_status = Status::NotDone; shared_qobject_ptr<JavaListLoadTask> m_load_task; QList<BaseVersion::Ptr> m_vlist; bool m_only_managed_versions; }; class JavaListLoadTask : public Task { Q_OBJECT public: explicit JavaListLoadTask(JavaInstallList* vlist, bool onlyManagedVersions = false); virtual ~JavaListLoadTask() = default; protected: void executeTask() override; public slots: void javaCheckerFinished(); protected: Task::Ptr m_job; JavaInstallList* m_list; JavaInstall* m_current_recommended; QList<JavaChecker::Result> m_results; bool m_only_managed_versions; };
2,171
C++
.h
62
31.403226
88
0.748088
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,564
JavaVersion.h
PrismLauncher_PrismLauncher/launcher/java/JavaVersion.h
#pragma once #include <QString> // NOTE: apparently the GNU C library pollutes the global namespace with these... undef them. #ifdef major #undef major #endif #ifdef minor #undef minor #endif class JavaVersion { friend class JavaVersionTest; public: JavaVersion() {} JavaVersion(const QString& rhs); JavaVersion(int major, int minor, int security, int build = 0, QString name = ""); JavaVersion& operator=(const QString& rhs); bool operator<(const JavaVersion& rhs); bool operator==(const JavaVersion& rhs); bool operator>(const JavaVersion& rhs); bool requiresPermGen() const; bool defaultsToUtf8() const; bool isModular() const; QString toString() const; int major() const { return m_major; } int minor() const { return m_minor; } int security() const { return m_security; } QString build() const { return m_prerelease; } QString name() const { return m_name; } private: QString m_string; int m_major = 0; int m_minor = 0; int m_security = 0; QString m_name = ""; bool m_parseable = false; QString m_prerelease; };
1,129
C++
.h
37
26.486486
93
0.689464
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,565
JavaChecker.h
PrismLauncher_PrismLauncher/launcher/java/JavaChecker.h
#pragma once #include <QProcess> #include <QTimer> #include "JavaVersion.h" #include "QObjectPtr.h" #include "tasks/Task.h" class JavaChecker : public Task { Q_OBJECT public: using QProcessPtr = shared_qobject_ptr<QProcess>; using Ptr = shared_qobject_ptr<JavaChecker>; struct Result { QString path; int id; QString mojangPlatform; QString realPlatform; JavaVersion javaVersion; QString javaVendor; QString outLog; QString errorLog; bool is_64bit = false; enum class Validity { Errored, ReturnedInvalidData, Valid } validity = Validity::Errored; }; explicit JavaChecker(QString path, QString args, int minMem = 0, int maxMem = 0, int permGen = 0, int id = 0); signals: void checkFinished(const Result& result); protected: virtual void executeTask() override; private: QProcessPtr process; QTimer killTimer; QString m_stdout; QString m_stderr; QString m_path; QString m_args; int m_minMem = 0; int m_maxMem = 0; int m_permGen = 64; int m_id = 0; private slots: void timeout(); void finished(int exitcode, QProcess::ExitStatus); void error(QProcess::ProcessError); void stdoutReady(); void stderrReady(); };
1,302
C++
.h
46
23.043478
114
0.676022
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,566
JavaMetadata.h
PrismLauncher_PrismLauncher/launcher/java/JavaMetadata.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2023-2024 Trial97 <alexandru.tripon97@gmail.com> * * 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/>. */ #pragma once #include <QDateTime> #include <QJsonObject> #include <QString> #include <memory> #include "BaseVersion.h" #include "java/JavaVersion.h" namespace Java { enum class DownloadType { Manifest, Archive, Unknown }; class Metadata : public BaseVersion { public: virtual QString descriptor() override { return version.toString(); } virtual QString name() override { return m_name; } virtual QString typeString() const override { return vendor; } virtual bool operator<(BaseVersion& a) override; virtual bool operator>(BaseVersion& a) override; bool operator<(const Metadata& rhs); bool operator==(const Metadata& rhs); bool operator>(const Metadata& rhs); QString m_name; QString vendor; QString url; QDateTime releaseTime; QString checksumType; QString checksumHash; DownloadType downloadType; QString packageType; JavaVersion version; QString runtimeOS; }; using MetadataPtr = std::shared_ptr<Metadata>; DownloadType parseDownloadType(QString javaDownload); QString downloadTypeToString(DownloadType javaDownload); MetadataPtr parseJavaMeta(const QJsonObject& libObj); } // namespace Java
1,933
C++
.h
52
34.230769
74
0.758824
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,567
JavaInstall.h
PrismLauncher_PrismLauncher/launcher/java/JavaInstall.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2023-2024 Trial97 <alexandru.tripon97@gmail.com> * * 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/>. */ #pragma once #include "BaseVersion.h" #include "JavaVersion.h" struct JavaInstall : public BaseVersion { JavaInstall() {} JavaInstall(QString id, QString arch, QString path) : id(id), arch(arch), path(path) {} virtual QString descriptor() override { return id.toString(); } virtual QString name() override { return id.toString(); } virtual QString typeString() const override { return arch; } virtual bool operator<(BaseVersion& a) override; virtual bool operator>(BaseVersion& a) override; bool operator<(const JavaInstall& rhs); bool operator==(const JavaInstall& rhs); bool operator>(const JavaInstall& rhs); JavaVersion id; QString arch; QString path; bool recommended = false; bool is_64bit = false; }; using JavaInstallPtr = std::shared_ptr<JavaInstall>;
1,579
C++
.h
38
38.368421
91
0.734508
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,568
JavaUtils.h
PrismLauncher_PrismLauncher/launcher/java/JavaUtils.h
/* 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. */ #pragma once #include <QProcess> #include <QStringList> #include "java/JavaInstall.h" #ifdef Q_OS_WIN #include <windows.h> #endif QString stripVariableEntries(QString name, QString target, QString remove); QProcessEnvironment CleanEnviroment(); QStringList getMinecraftJavaBundle(); QStringList getPrismJavaBundle(); class JavaUtils : public QObject { Q_OBJECT public: JavaUtils(); JavaInstallPtr MakeJavaPtr(QString path, QString id = "unknown", QString arch = "unknown"); QList<QString> FindJavaPaths(); JavaInstallPtr GetDefaultJava(); #ifdef Q_OS_WIN QList<JavaInstallPtr> FindJavaFromRegistryKey(DWORD keyType, QString keyName, QString keyJavaDir, QString subkeySuffix = ""); #endif static QString getJavaCheckPath(); static const QString javaExecutable; };
1,412
C++
.h
38
34.684211
129
0.777452
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,569
ArchiveDownloadTask.h
PrismLauncher_PrismLauncher/launcher/java/download/ArchiveDownloadTask.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2023-2024 Trial97 <alexandru.tripon97@gmail.com> * * 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/>. */ #pragma once #include <QUrl> #include "tasks/Task.h" namespace Java { class ArchiveDownloadTask : public Task { Q_OBJECT public: ArchiveDownloadTask(QUrl url, QString final_path, QString checksumType = "", QString checksumHash = ""); virtual ~ArchiveDownloadTask() = default; [[nodiscard]] bool canAbort() const override { return true; } void executeTask() override; virtual bool abort() override; private slots: void extractJava(QString input); protected: QUrl m_url; QString m_final_path; QString m_checksum_type; QString m_checksum_hash; Task::Ptr m_task; }; } // namespace Java
1,395
C++
.h
39
32.794872
108
0.732791
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,570
ManifestDownloadTask.h
PrismLauncher_PrismLauncher/launcher/java/download/ManifestDownloadTask.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2023-2024 Trial97 <alexandru.tripon97@gmail.com> * * 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/>. */ #pragma once #include <QUrl> #include "tasks/Task.h" namespace Java { class ManifestDownloadTask : public Task { Q_OBJECT public: ManifestDownloadTask(QUrl url, QString final_path, QString checksumType = "", QString checksumHash = ""); virtual ~ManifestDownloadTask() = default; [[nodiscard]] bool canAbort() const override { return true; } void executeTask() override; virtual bool abort() override; private slots: void downloadJava(const QJsonDocument& doc); protected: QUrl m_url; QString m_final_path; QString m_checksum_type; QString m_checksum_hash; Task::Ptr m_task; }; } // namespace Java
1,411
C++
.h
39
33.179487
109
0.734261
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,571
SymlinkTask.h
PrismLauncher_PrismLauncher/launcher/java/download/SymlinkTask.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2023-2024 Trial97 <alexandru.tripon97@gmail.com> * * 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/>. */ #pragma once #include "tasks/Task.h" namespace Java { class SymlinkTask : public Task { Q_OBJECT public: SymlinkTask(QString final_path); virtual ~SymlinkTask() = default; void executeTask() override; protected: QString m_path; Task::Ptr m_task; }; } // namespace Java
1,054
C++
.h
31
31.419355
74
0.736016
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,572
Index.h
PrismLauncher_PrismLauncher/launcher/meta/Index.h
/* Copyright 2015-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. */ #pragma once #include <QAbstractListModel> #include "BaseEntity.h" #include "meta/VersionList.h" #include "net/Mode.h" class Task; namespace Meta { class Index : public QAbstractListModel, public BaseEntity { Q_OBJECT public: explicit Index(QObject* parent = nullptr); explicit Index(const QVector<VersionList::Ptr>& lists, QObject* parent = nullptr); virtual ~Index() = default; enum { UidRole = Qt::UserRole, NameRole, ListPtrRole }; QVariant data(const QModelIndex& index, int role) const override; int rowCount(const QModelIndex& parent) const override; int columnCount(const QModelIndex& parent) const override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; QString localFilename() const override { return "index.json"; } // queries VersionList::Ptr get(const QString& uid); Version::Ptr get(const QString& uid, const QString& version); bool hasUid(const QString& uid) const; QVector<VersionList::Ptr> lists() const { return m_lists; } Task::Ptr loadVersion(const QString& uid, const QString& version = {}, Net::Mode mode = Net::Mode::Online, bool force = false); // this blocks until the version is loaded Version::Ptr getLoadedVersion(const QString& uid, const QString& version); public: // for usage by parsers only void merge(const std::shared_ptr<Index>& other); protected: void parse(const QJsonObject& obj) override; private: QVector<VersionList::Ptr> m_lists; QHash<QString, VersionList::Ptr> m_uids; void connectVersionList(int row, const VersionList::Ptr& list); }; } // namespace Meta
2,272
C++
.h
51
40.921569
131
0.740018
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,573
VersionList.h
PrismLauncher_PrismLauncher/launcher/meta/VersionList.h
/* Copyright 2015-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. */ #pragma once #include <QJsonObject> #include <memory> #include "BaseEntity.h" #include "BaseVersionList.h" #include "meta/Version.h" namespace Meta { class VersionList : public BaseVersionList, public BaseEntity { Q_OBJECT Q_PROPERTY(QString uid READ uid CONSTANT) Q_PROPERTY(QString name READ name NOTIFY nameChanged) public: explicit VersionList(const QString& uid, QObject* parent = nullptr); virtual ~VersionList() = default; using Ptr = std::shared_ptr<VersionList>; enum Roles { UidRole = Qt::UserRole + 100, TimeRole, RequiresRole, VersionPtrRole }; bool isLoaded() override; [[nodiscard]] Task::Ptr getLoadTask() override; const BaseVersion::Ptr at(int i) const override; int count() const override; void sortVersions() override; BaseVersion::Ptr getRecommended() const override; Version::Ptr getRecommendedForParent(const QString& uid, const QString& version); Version::Ptr getLatestForParent(const QString& uid, const QString& version); QVariant data(const QModelIndex& index, int role) const override; RoleList providesRoles() const override; QHash<int, QByteArray> roleNames() const override; void setProvidedRoles(RoleList roles); QString localFilename() const override; QString uid() const { return m_uid; } QString name() const { return m_name; } QString humanReadable() const; Version::Ptr getVersion(const QString& version); bool hasVersion(QString version) const; QVector<Version::Ptr> versions() const { return m_versions; } // this blocks until the version list is loaded void waitToLoad(); public: // for usage only by parsers void setName(const QString& name); void setVersions(const QVector<Version::Ptr>& versions); void merge(const VersionList::Ptr& other); void mergeFromIndex(const VersionList::Ptr& other); void parse(const QJsonObject& obj) override; void addExternalRecommends(const QStringList& recommends); void clearExternalRecommends(); signals: void nameChanged(const QString& name); protected slots: void updateListData(QList<BaseVersion::Ptr>) override {} private: QVector<Version::Ptr> m_versions; QStringList m_externalRecommendsVersions; QHash<QString, Version::Ptr> m_lookup; QString m_uid; QString m_name; Version::Ptr m_recommended; RoleList m_provided_roles = { VersionPointerRole, VersionRole, VersionIdRole, ParentVersionRole, TypeRole, UidRole, TimeRole, RequiresRole, SortRole, RecommendedRole, LatestRole, VersionPtrRole }; void setupAddedVersion(int row, const Version::Ptr& version); }; } // namespace Meta Q_DECLARE_METATYPE(Meta::VersionList::Ptr)
3,381
C++
.h
76
40
131
0.737051
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,574
JsonFormat.h
PrismLauncher_PrismLauncher/launcher/meta/JsonFormat.h
/* Copyright 2015-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. */ #pragma once #include <QJsonObject> #include <set> #include "Exception.h" namespace Meta { class Index; class Version; class VersionList; enum class MetadataVersion { Invalid = -1, InitialRelease = 1 }; class ParseException : public Exception { public: using Exception::Exception; }; struct Require { bool operator==(const Require& rhs) const { return uid == rhs.uid; } bool operator<(const Require& rhs) const { return uid < rhs.uid; } bool deepEquals(const Require& rhs) const { return uid == rhs.uid && equalsVersion == rhs.equalsVersion && suggests == rhs.suggests; } QString uid; QString equalsVersion; QString suggests; }; using RequireSet = std::set<Require>; void parseIndex(const QJsonObject& obj, Index* ptr); void parseVersion(const QJsonObject& obj, Version* ptr); void parseVersionList(const QJsonObject& obj, VersionList* ptr); MetadataVersion parseFormatVersion(const QJsonObject& obj, bool required = true); void serializeFormatVersion(QJsonObject& obj, MetadataVersion version); // FIXME: this has a different shape than the others...FIX IT!? void parseRequires(const QJsonObject& obj, RequireSet* ptr, const char* keyName = "requires"); void serializeRequires(QJsonObject& objOut, RequireSet* ptr, const char* keyName = "requires"); MetadataVersion currentFormatVersion(); } // namespace Meta Q_DECLARE_METATYPE(std::set<Meta::Require>)
2,004
C++
.h
47
40.468085
138
0.764645
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,575
Version.h
PrismLauncher_PrismLauncher/launcher/meta/Version.h
/* Copyright 2015-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. */ #pragma once #include "../Version.h" #include "BaseVersion.h" #include <QJsonObject> #include <QStringList> #include <QVector> #include <memory> #include "minecraft/VersionFile.h" #include "BaseEntity.h" #include "JsonFormat.h" namespace Meta { class Version : public QObject, public BaseVersion, public BaseEntity { Q_OBJECT public: using Ptr = std::shared_ptr<Version>; explicit Version(const QString& uid, const QString& version); virtual ~Version() = default; QString descriptor() override; QString name() override; QString typeString() const override; QString uid() const { return m_uid; } QString version() const { return m_version; } QString type() const { return m_type; } QDateTime time() const; qint64 rawTime() const { return m_time; } const Meta::RequireSet& requiredSet() const { return m_requires; } VersionFilePtr data() const { return m_data; } bool isRecommended() const { return m_recommended; } bool isLoaded() const { return m_data != nullptr && BaseEntity::isLoaded(); } void merge(const Version::Ptr& other); void mergeFromList(const Version::Ptr& other); void parse(const QJsonObject& obj) override; QString localFilename() const override; [[nodiscard]] ::Version toComparableVersion() const; public: // for usage by format parsers only void setType(const QString& type); void setTime(qint64 time); void setRequires(const Meta::RequireSet& reqs, const Meta::RequireSet& conflicts); void setVolatile(bool volatile_); void setRecommended(bool recommended); void setProvidesRecommendations(); void setData(const VersionFilePtr& data); signals: void typeChanged(); void timeChanged(); void requiresChanged(); private: bool m_providesRecommendations = false; bool m_recommended = false; QString m_name; QString m_uid; QString m_version; QString m_type; qint64 m_time = 0; Meta::RequireSet m_requires; Meta::RequireSet m_conflicts; bool m_volatile = false; VersionFilePtr m_data; }; } // namespace Meta Q_DECLARE_METATYPE(Meta::Version::Ptr)
2,766
C++
.h
75
33.053333
86
0.725674
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,576
BaseEntity.h
PrismLauncher_PrismLauncher/launcher/meta/BaseEntity.h
/* Copyright 2015-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. */ #pragma once #include <QJsonObject> #include <QObject> #include "net/Mode.h" #include "net/NetJob.h" #include "tasks/Task.h" namespace Meta { class BaseEntityLoadTask; class BaseEntity { friend BaseEntityLoadTask; public: /* types */ using Ptr = std::shared_ptr<BaseEntity>; enum class LoadStatus { NotLoaded, Local, Remote }; public: virtual ~BaseEntity() = default; virtual QString localFilename() const = 0; virtual QUrl url() const; bool isLoaded() const; LoadStatus status() const; /* for parsers */ void setSha256(QString sha256); virtual void parse(const QJsonObject& obj) = 0; [[nodiscard]] Task::Ptr loadTask(Net::Mode loadType = Net::Mode::Online); protected: QString m_sha256; // the expected sha256 QString m_file_sha256; // the file sha256 private: LoadStatus m_load_status = LoadStatus::NotLoaded; Task::Ptr m_task; }; class BaseEntityLoadTask : public Task { Q_OBJECT public: explicit BaseEntityLoadTask(BaseEntity* parent, Net::Mode mode); ~BaseEntityLoadTask() override = default; virtual void executeTask() override; virtual bool canAbort() const override; virtual bool abort() override; private: BaseEntity* m_entity; Net::Mode m_mode; NetJob::Ptr m_task; }; } // namespace Meta
1,945
C++
.h
58
30.017241
77
0.722756
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,577
WorldList.h
PrismLauncher_PrismLauncher/launcher/minecraft/WorldList.h
/* Copyright 2015-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. */ #pragma once #include <QAbstractListModel> #include <QDir> #include <QList> #include <QMimeData> #include <QString> #include "BaseInstance.h" #include "minecraft/World.h" class QFileSystemWatcher; class WorldList : public QAbstractListModel { Q_OBJECT public: enum Columns { NameColumn, GameModeColumn, LastPlayedColumn, SizeColumn, InfoColumn }; enum Roles { ObjectRole = Qt::UserRole + 1, FolderRole, SeedRole, NameRole, GameModeRole, LastPlayedRole, SizeRole, IconFileRole }; WorldList(const QString& dir, BaseInstance* instance); virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; virtual int rowCount(const QModelIndex& parent = QModelIndex()) const { return parent.isValid() ? 0 : static_cast<int>(size()); }; virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; virtual int columnCount(const QModelIndex& parent) const; size_t size() const { return worlds.size(); }; bool empty() const { return size() == 0; } World& operator[](size_t index) { return worlds[index]; } /// Reloads the mod list and returns true if the list changed. virtual bool update(); /// Install a world from location void installWorld(QFileInfo filename); /// Deletes the mod at the given index. virtual bool deleteWorld(int index); /// Removes the world icon, if any virtual bool resetIcon(int index); /// Deletes all the selected mods virtual bool deleteWorlds(int first, int last); /// flags, mostly to support drag&drop virtual Qt::ItemFlags flags(const QModelIndex& index) const; /// get data for drag action virtual QMimeData* mimeData(const QModelIndexList& indexes) const; /// get the supported mime types virtual QStringList mimeTypes() const; /// process data from drop action virtual bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent); /// what drag actions do we support? virtual Qt::DropActions supportedDragActions() const; /// what drop actions do we support? virtual Qt::DropActions supportedDropActions() const; void startWatching(); void stopWatching(); virtual bool isValid(); QDir dir() const { return m_dir; } QString instDirPath() const; const QList<World>& allWorlds() const { return worlds; } private slots: void directoryChanged(QString path); signals: void changed(); protected: BaseInstance* m_instance; QFileSystemWatcher* m_watcher; bool is_watching; QDir m_dir; QList<World> worlds; };
3,265
C++
.h
75
39.426667
135
0.731838
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,578
OneSixVersionFormat.h
PrismLauncher_PrismLauncher/launcher/minecraft/OneSixVersionFormat.h
#pragma once #include <ProblemProvider.h> #include <minecraft/Library.h> #include <minecraft/PackProfile.h> #include <minecraft/VersionFile.h> #include <QJsonDocument> class OneSixVersionFormat { public: // version files / profile patches static VersionFilePtr versionFileFromJson(const QJsonDocument& doc, const QString& filename, bool requireOrder); static QJsonDocument versionFileToJson(const VersionFilePtr& patch); // libraries static LibraryPtr libraryFromJson(ProblemContainer& problems, const QJsonObject& libObj, const QString& filename); static QJsonObject libraryToJson(Library* library); // DEPRECATED: old 'plus' jar mods generated by the application static LibraryPtr plusJarModFromJson(ProblemContainer& problems, const QJsonObject& libObj, const QString& filename, const QString& originalName); // new jar mods derived from libraries static LibraryPtr jarModFromJson(ProblemContainer& problems, const QJsonObject& libObj, const QString& filename); static QJsonObject jarModtoJson(Library* jarmod); // mods, also derived from libraries static LibraryPtr modFromJson(ProblemContainer& problems, const QJsonObject& libObj, const QString& filename); static QJsonObject modtoJson(Library* jarmod); };
1,401
C++
.h
26
45.653846
118
0.727538
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,579
ProfileUtils.h
PrismLauncher_PrismLauncher/launcher/minecraft/ProfileUtils.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * 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. */ #pragma once #include "Library.h" #include "VersionFile.h" namespace ProfileUtils { using PatchOrder = QStringList; /// Read and parse a OneSix format order file bool readOverrideOrders(QString path, PatchOrder& order); /// Write a OneSix format order file bool writeOverrideOrders(QString path, const PatchOrder& order); /// Parse a version file in JSON format VersionFilePtr parseJsonFile(const QFileInfo& fileInfo, bool requireOrder); /// Save a JSON file (in any format) bool saveJsonFile(const QJsonDocument& doc, const QString& filename); /// Remove LWJGL from a patch file. This is applied to all Mojang-like profile files. void removeLwjglFromPatch(VersionFilePtr patch); } // namespace ProfileUtils
2,210
C++
.h
50
42.4
85
0.756041
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,580
MinecraftLoadAndCheck.h
PrismLauncher_PrismLauncher/launcher/minecraft/MinecraftLoadAndCheck.h
/* 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. */ #pragma once #include "net/Mode.h" #include "tasks/Task.h" class MinecraftInstance; class MinecraftLoadAndCheck : public Task { Q_OBJECT public: explicit MinecraftLoadAndCheck(MinecraftInstance* inst, Net::Mode netmode); virtual ~MinecraftLoadAndCheck() = default; void executeTask() override; bool canAbort() const override; public slots: bool abort() override; private: MinecraftInstance* m_inst = nullptr; Task::Ptr m_task; Net::Mode m_netmode; };
1,108
C++
.h
32
31.625
79
0.750467
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,581
Agent.h
PrismLauncher_PrismLauncher/launcher/minecraft/Agent.h
#pragma once #include <QString> #include "Library.h" class Agent; using AgentPtr = std::shared_ptr<Agent>; class Agent { public: Agent(LibraryPtr library, const QString& argument) { m_library = library; m_argument = argument; } public: /* methods */ LibraryPtr library() { return m_library; } QString argument() { return m_argument; } protected: /* data */ /// The library pointing to the jar this Java agent is contained within LibraryPtr m_library; /// The argument to the Java agent, passed after an = if present QString m_argument; };
608
C++
.h
21
24.666667
75
0.678756
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,582
World.h
PrismLauncher_PrismLauncher/launcher/minecraft/World.h
/* Copyright 2015-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. */ #pragma once #include <QDateTime> #include <QFileInfo> #include <optional> struct GameType { GameType() = default; GameType(std::optional<int> original); QString toTranslatedString() const; QString toLogString() const; enum { Unknown = -1, Survival, Creative, Adventure, Spectator } type = Unknown; std::optional<int> original; }; class World { public: World(const QFileInfo& file); QString folderName() const { return m_folderName; } QString name() const { return m_actualName; } QString iconFile() const { return m_iconFile; } int64_t bytes() const { return m_size; } QDateTime lastPlayed() const { return m_lastPlayed; } GameType gameType() const { return m_gameType; } int64_t seed() const { return m_randomSeed; } bool isValid() const { return is_valid; } bool isOnFS() const { return m_containerFile.isDir(); } QFileInfo container() const { return m_containerFile; } // delete all the files of this world bool destroy(); // replace this world with a copy of the other bool replace(World& with); // change the world's filesystem path (used by world lists for *MAGIC* purposes) void repath(const QFileInfo& file); // remove the icon file, if any bool resetIcon(); bool rename(const QString& to); bool install(const QString& to, const QString& name = QString()); // WEAK compare operator - used for replacing worlds bool operator==(const World& other) const; [[nodiscard]] auto isSymLink() const -> bool { return m_containerFile.isSymLink(); } /** * @brief Take a instance path, checks if the file pointed to by the resource is a symlink or under a symlink in that instance * * @param instPath path to an instance directory * @return true * @return false */ [[nodiscard]] bool isSymLinkUnder(const QString& instPath) const; [[nodiscard]] bool isMoreThanOneHardLink() const; QString canonicalFilePath() const { return m_containerFile.canonicalFilePath(); } private: void readFromZip(const QFileInfo& file); void readFromFS(const QFileInfo& file); void loadFromLevelDat(QByteArray data); protected: QFileInfo m_containerFile; QString m_containerOffsetPath; QString m_folderName; QString m_actualName; QString m_iconFile; QDateTime levelDatTime; QDateTime m_lastPlayed; int64_t m_size; int64_t m_randomSeed = 0; GameType m_gameType; bool is_valid = false; };
3,109
C++
.h
79
35.101266
130
0.71296
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,583
Logging.h
PrismLauncher_PrismLauncher/launcher/minecraft/Logging.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (C) 2023 Rachel Powers <508861+Ryex@users.noreply.github.com> * * 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/>. * */ #pragma once #include <QLoggingCategory> Q_DECLARE_LOGGING_CATEGORY(instanceProfileC) Q_DECLARE_LOGGING_CATEGORY(instanceProfileResolveC)
930
C++
.h
22
39.181818
76
0.75
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,584
VanillaInstanceCreationTask.h
PrismLauncher_PrismLauncher/launcher/minecraft/VanillaInstanceCreationTask.h
#pragma once #include "InstanceCreationTask.h" #include <utility> class VanillaCreationTask final : public InstanceCreationTask { Q_OBJECT public: VanillaCreationTask(BaseVersion::Ptr version) : InstanceCreationTask(), m_version(std::move(version)) {} VanillaCreationTask(BaseVersion::Ptr version, QString loader, BaseVersion::Ptr loader_version); bool createInstance() override; private: // Version to update to / create of the instance. BaseVersion::Ptr m_version; bool m_using_loader = false; QString m_loader; BaseVersion::Ptr m_loader_version; };
600
C++
.h
16
33.5
108
0.754325
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,585
ComponentUpdateTask.h
PrismLauncher_PrismLauncher/launcher/minecraft/ComponentUpdateTask.h
#pragma once #include "minecraft/Component.h" #include "net/Mode.h" #include "tasks/Task.h" #include <memory> class PackProfile; struct ComponentUpdateTaskData; class ComponentUpdateTask : public Task { Q_OBJECT public: enum class Mode { Launch, Resolution }; public: explicit ComponentUpdateTask(Mode mode, Net::Mode netmode, PackProfile* list); virtual ~ComponentUpdateTask(); protected: void executeTask(); private: void loadComponents(); /// collects components that are dependent on or dependencies of the component QList<ComponentPtr> collectTreeLinked(const QString& uid); void resolveDependencies(bool checkOnly); void performUpdateActions(); void finalizeComponents(); void remoteLoadSucceeded(size_t index); void remoteLoadFailed(size_t index, const QString& msg); void checkIfAllFinished(); private: std::unique_ptr<ComponentUpdateTaskData> d; };
941
C++
.h
29
28.586207
82
0.757743
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,586
ComponentUpdateTask_p.h
PrismLauncher_PrismLauncher/launcher/minecraft/ComponentUpdateTask_p.h
#pragma once #include <QList> #include <QString> #include <cstddef> #include "net/Mode.h" #include "tasks/Task.h" #include "minecraft/ComponentUpdateTask.h" class PackProfile; struct RemoteLoadStatus { enum class Type { Index, List, Version } type = Type::Version; size_t PackProfileIndex = 0; bool finished = false; bool succeeded = false; QString error; Task::Ptr task; }; struct ComponentUpdateTaskData { PackProfile* m_profile = nullptr; QList<RemoteLoadStatus> remoteLoadStatusList; bool remoteLoadSuccessful = true; size_t remoteTasksInProgress = 0; ComponentUpdateTask::Mode mode; Net::Mode netmode; };
663
C++
.h
24
24.416667
66
0.744479
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,587
VersionFile.h
PrismLauncher_PrismLauncher/launcher/minecraft/VersionFile.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * 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. */ #pragma once #include <QDateTime> #include <QHash> #include <QList> #include <QSet> #include <QString> #include <QStringList> #include <meta/JsonFormat.h> #include <memory> #include "Agent.h" #include "Library.h" #include "ProblemProvider.h" #include "java/JavaMetadata.h" #include "minecraft/Rule.h" class PackProfile; class VersionFile; class LaunchProfile; struct MojangDownloadInfo; struct MojangAssetIndexInfo; using VersionFilePtr = std::shared_ptr<VersionFile>; class VersionFile : public ProblemContainer { friend class MojangVersionFormat; friend class OneSixVersionFormat; public: /* methods */ void applyTo(LaunchProfile* profile, const RuntimeContext& runtimeContext); public: /* data */ /// Prism Launcher: order hint for this version file if no explicit order is set int order = 0; /// Prism Launcher: human readable name of this package QString name; /// Prism Launcher: package ID of this package QString uid; /// Prism Launcher: version of this package QString version; /// Prism Launcher: DEPRECATED dependency on a Minecraft version QString dependsOnMinecraftVersion; /// Mojang: DEPRECATED used to version the Mojang version format int minimumLauncherVersion = -1; /// Mojang: DEPRECATED version of Minecraft this is QString minecraftVersion; /// Mojang: class to launch Minecraft with QString mainClass; /// Prism Launcher: class to launch legacy Minecraft with (embed in a custom window) QString appletClass; /// Mojang: Minecraft launch arguments (may contain placeholders for variable substitution) QString minecraftArguments; /// Prism Launcher: Additional JVM launch arguments QStringList addnJvmArguments; /// Mojang: list of compatible java majors QList<int> compatibleJavaMajors; /// Mojang: the name of recommended java version QString compatibleJavaName; /// Mojang: type of the Minecraft version QString type; /// Mojang: the time this version was actually released by Mojang QDateTime releaseTime; /// Mojang: DEPRECATED the time this version was last updated by Mojang QDateTime updateTime; /// Mojang: DEPRECATED asset group to be used with Minecraft QString assets; /// Prism Launcher: list of tweaker mod arguments for launchwrapper QStringList addTweakers; /// Mojang: list of libraries to add to the version QList<LibraryPtr> libraries; /// Prism Launcher: list of maven files to put in the libraries folder, but not in classpath QList<LibraryPtr> mavenFiles; /// Prism Launcher: list of agents to add to JVM arguments QList<AgentPtr> agents; /// The main jar (Minecraft version library, normally) LibraryPtr mainJar; /// Prism Launcher: list of attached traits of this version file - used to enable features QSet<QString> traits; /// Prism Launcher: list of jar mods added to this version QList<LibraryPtr> jarMods; /// Prism Launcher: list of mods added to this version QList<LibraryPtr> mods; /** * Prism Launcher: set of packages this depends on * NOTE: this is shared with the meta format!!! */ Meta::RequireSet m_requires; /** * Prism Launcher: set of packages this conflicts with * NOTE: this is shared with the meta format!!! */ Meta::RequireSet conflicts; /// is volatile -- may be removed as soon as it is no longer needed by something else bool m_volatile = false; QList<Java::MetadataPtr> runtimes; public: // Mojang: DEPRECATED list of 'downloads' - client jar, server jar, windows server exe, maybe more. QMap<QString, std::shared_ptr<MojangDownloadInfo>> mojangDownloads; // Mojang: extended asset index download information std::shared_ptr<MojangAssetIndexInfo> mojangAssetIndex; };
5,363
C++
.h
129
37.751938
103
0.736579
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,588
VersionFilterData.h
PrismLauncher_PrismLauncher/launcher/minecraft/VersionFilterData.h
#pragma once #include <QDateTime> #include <QMap> #include <QSet> #include <QString> struct FMLlib { QString filename; QString checksum; }; struct VersionFilterData { VersionFilterData(); // mapping between minecraft versions and FML libraries required QMap<QString, QList<FMLlib>> fmlLibsMapping; // set of minecraft versions for which using forge installers is blacklisted QSet<QString> forgeInstallerBlacklist; // no new versions below this date will be accepted from Mojang servers QDateTime legacyCutoffDate; // Libraries that belong to LWJGL QSet<QString> lwjglWhitelist; // release date of first version to require Java 8 (17w13a) QDateTime java8BeginsDate; // release data of first version to require Java 16 (21w19a) QDateTime java16BeginsDate; // release data of first version to require Java 17 (1.18 Pre Release 2) QDateTime java17BeginsDate; }; extern VersionFilterData g_VersionFilterData;
974
C++
.h
27
32.481481
80
0.766138
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,589
LaunchProfile.h
PrismLauncher_PrismLauncher/launcher/minecraft/LaunchProfile.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * 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. */ #pragma once #include <ProblemProvider.h> #include <QString> #include "Agent.h" #include "Library.h" class LaunchProfile : public ProblemProvider { public: virtual ~LaunchProfile() {} public: /* application of profile variables from patches */ void applyMinecraftVersion(const QString& id); void applyMainClass(const QString& mainClass); void applyAppletClass(const QString& appletClass); void applyMinecraftArguments(const QString& minecraftArguments); void applyAddnJvmArguments(const QStringList& minecraftArguments); void applyMinecraftVersionType(const QString& type); void applyMinecraftAssets(MojangAssetIndexInfo::Ptr assets); void applyTraits(const QSet<QString>& traits); void applyTweakers(const QStringList& tweakers); void applyJarMods(const QList<LibraryPtr>& jarMods); void applyMods(const QList<LibraryPtr>& jarMods); void applyLibrary(LibraryPtr library, const RuntimeContext& runtimeContext); void applyMavenFile(LibraryPtr library, const RuntimeContext& runtimeContext); void applyAgent(AgentPtr agent, const RuntimeContext& runtimeContext); void applyCompatibleJavaMajors(QList<int>& javaMajor); void applyCompatibleJavaName(QString javaName); void applyMainJar(LibraryPtr jar); void applyProblemSeverity(ProblemSeverity severity); /// clear the profile void clear(); public: /* getters for profile variables */ QString getMinecraftVersion() const; QString getMainClass() const; QString getAppletClass() const; QString getMinecraftVersionType() const; MojangAssetIndexInfo::Ptr getMinecraftAssets() const; QString getMinecraftArguments() const; const QStringList& getAddnJvmArguments() const; const QSet<QString>& getTraits() const; const QStringList& getTweakers() const; const QList<LibraryPtr>& getJarMods() const; const QList<LibraryPtr>& getLibraries() const; const QList<LibraryPtr>& getNativeLibraries() const; const QList<LibraryPtr>& getMavenFiles() const; const QList<AgentPtr>& getAgents() const; const QList<int>& getCompatibleJavaMajors() const; const QString getCompatibleJavaName() const; const LibraryPtr getMainJar() const; void getLibraryFiles(const RuntimeContext& runtimeContext, QStringList& jars, QStringList& nativeJars, const QString& overridePath, const QString& tempPath) const; bool hasTrait(const QString& trait) const; ProblemSeverity getProblemSeverity() const override; const QList<PatchProblem> getProblems() const override; private: /// the version of Minecraft - jar to use QString m_minecraftVersion; /// Release type - "release" or "snapshot" QString m_minecraftVersionType; /// Assets type - "legacy" or a version ID MojangAssetIndexInfo::Ptr m_minecraftAssets; /** * arguments that should be used for launching minecraft * * ex: "--username ${auth_player_name} --session ${auth_session} * --version ${version_name} --gameDir ${game_directory} --assetsDir ${game_assets}" */ QString m_minecraftArguments; /** * Additional arguments to pass to the JVM in addition to those the user has configured, * memory settings, etc. */ QStringList m_addnJvmArguments; /// A list of all tweaker classes QStringList m_tweakers; /// The main class to load first QString m_mainClass; /// The applet class, for some very old minecraft releases QString m_appletClass; /// 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 list of java agents to add to JVM arguments QList<AgentPtr> m_agents; /// the main jar LibraryPtr m_mainJar; /// the list of native libraries QList<LibraryPtr> m_nativeLibraries; /// traits, collected from all the version files (version files can only add) QSet<QString> m_traits; /// A list of jar mods. version files can add those. QList<LibraryPtr> m_jarMods; /// the list of mods QList<LibraryPtr> m_mods; /// compatible java major versions QList<int> m_compatibleJavaMajors; QString m_compatibleJavaName; ProblemSeverity m_problemSeverity = ProblemSeverity::None; };
5,946
C++
.h
135
39.2
93
0.727713
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,590
MojangVersionFormat.h
PrismLauncher_PrismLauncher/launcher/minecraft/MojangVersionFormat.h
#pragma once #include <ProblemProvider.h> #include <minecraft/Library.h> #include <minecraft/VersionFile.h> #include <QJsonDocument> class MojangVersionFormat { friend class OneSixVersionFormat; protected: // does not include libraries static void readVersionProperties(const QJsonObject& in, VersionFile* out); // does not include libraries static void writeVersionProperties(const VersionFile* in, QJsonObject& out); public: // version files / profile patches static VersionFilePtr versionFileFromJson(const QJsonDocument& doc, const QString& filename); static QJsonDocument versionFileToJson(const VersionFilePtr& patch); // libraries static LibraryPtr libraryFromJson(ProblemContainer& problems, const QJsonObject& libObj, const QString& filename); static QJsonObject libraryToJson(Library* library); };
863
C++
.h
20
39.4
118
0.791169
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,591
PackProfile_p.h
PrismLauncher_PrismLauncher/launcher/minecraft/PackProfile_p.h
#pragma once #include <QList> #include <QMap> #include <QTimer> #include "Component.h" #include "tasks/Task.h" class MinecraftInstance; using ComponentContainer = QList<ComponentPtr>; using ComponentIndex = QMap<QString, ComponentPtr>; struct PackProfileData { // the instance this belongs to MinecraftInstance* m_instance; // the launch profile (volatile, temporary thing created on demand) std::shared_ptr<LaunchProfile> m_profile; // persistent list of components and related machinery ComponentContainer components; ComponentIndex componentIndex; bool dirty = false; QTimer m_saveTimer; Task::Ptr m_updateTask; bool loaded = false; bool interactionDisabled = true; };
725
C++
.h
23
28.217391
71
0.763271
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,592
Library.h
PrismLauncher_PrismLauncher/launcher/minecraft/Library.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * 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. */ #pragma once #include <QDir> #include <QList> #include <QMap> #include <QPair> #include <QString> #include <QStringList> #include <QUrl> #include <memory> #include "GradleSpecifier.h" #include "MojangDownloadInfo.h" #include "Rule.h" #include "RuntimeContext.h" #include "net/NetRequest.h" class Library; class MinecraftInstance; using LibraryPtr = std::shared_ptr<Library>; class Library { friend class OneSixVersionFormat; friend class MojangVersionFormat; friend class LibraryTest; public: Library() {} Library(const QString& name) { m_name = name; } /// limited copy without some data. TODO: why? static LibraryPtr limitedCopy(LibraryPtr base) { auto newlib = std::make_shared<Library>(); newlib->m_name = base->m_name; newlib->m_repositoryURL = base->m_repositoryURL; newlib->m_hint = base->m_hint; newlib->m_absoluteURL = base->m_absoluteURL; newlib->m_extractExcludes = base->m_extractExcludes; newlib->m_nativeClassifiers = base->m_nativeClassifiers; newlib->m_rules = base->m_rules; newlib->m_storagePrefix = base->m_storagePrefix; newlib->m_mojangDownloads = base->m_mojangDownloads; newlib->m_filename = base->m_filename; return newlib; } public: /* methods */ /// Returns the raw name field const GradleSpecifier& rawName() const { return m_name; } void setRawName(const GradleSpecifier& spec) { m_name = spec; } void setClassifier(const QString& spec) { m_name.setClassifier(spec); } /// returns the full group and artifact prefix QString artifactPrefix() const { return m_name.artifactPrefix(); } /// get the artifact ID QString artifactId() const { return m_name.artifactId(); } /// get the artifact version QString version() const { return m_name.version(); } /// Returns true if the library is native bool isNative() const { return m_nativeClassifiers.size() != 0; } void setStoragePrefix(QString prefix = QString()); /// Set the url base for downloads void setRepositoryURL(const QString& base_url) { m_repositoryURL = base_url; } void getApplicableFiles(const RuntimeContext& runtimeContext, QStringList& jar, QStringList& native, QStringList& native32, QStringList& native64, const QString& overridePath) const; void setAbsoluteUrl(const QString& absolute_url) { m_absoluteURL = absolute_url; } void setFilename(const QString& filename) { m_filename = filename; } /// Get the file name of the library QString filename(const RuntimeContext& runtimeContext) const; // DEPRECATED: set a display name, used by jar mods only void setDisplayName(const QString& displayName) { m_displayname = displayName; } /// Get the file name of the library QString displayName(const RuntimeContext& runtimeContext) const; void setMojangDownloadInfo(MojangLibraryDownloadInfo::Ptr info) { m_mojangDownloads = info; } void setHint(const QString& hint) { m_hint = hint; } /// Set the load rules void setRules(QList<std::shared_ptr<Rule>> rules) { m_rules = rules; } /// Returns true if the library should be loaded (or extracted, in case of natives) bool isActive(const RuntimeContext& runtimeContext) const; /// Returns true if the library is contained in an instance and false if it is shared bool isLocal() const; /// Returns true if the library is to always be checked for updates bool isAlwaysStale() const; /// Return true if the library requires forge XZ hacks bool isForge() const; // Get a list of downloads for this library QList<Net::NetRequest::Ptr> getDownloads(const RuntimeContext& runtimeContext, class HttpMetaCache* cache, QStringList& failedLocalFiles, const QString& overridePath) const; QString getCompatibleNative(const RuntimeContext& runtimeContext) const; private: /* methods */ /// the default storage prefix used by Prism Launcher static QString defaultStoragePrefix(); /// Get the prefix - root of the storage to be used QString storagePrefix() const; /// Get the relative file path where the library should be saved QString storageSuffix(const RuntimeContext& runtimeContext) const; QString hint() const { return m_hint; } protected: /* data */ /// the basic gradle dependency specifier. GradleSpecifier m_name; /// DEPRECATED URL prefix of the maven repo where the file can be downloaded QString m_repositoryURL; /// DEPRECATED: Prism Launcher-specific absolute URL. takes precedence over the implicit maven repo URL, if defined QString m_absoluteURL; /// Prism Launcher extension - filename override QString m_filename; /// DEPRECATED Prism Launcher extension - display name QString m_displayname; /** * Prism Launcher-specific type hint - modifies how the library is treated */ QString m_hint; /** * storage - by default the local libraries folder in Prism Launcher, but could be elsewhere * Prism Launcher specific, because of FTB. */ QString m_storagePrefix; /// true if the library had an extract/excludes section (even empty) bool m_hasExcludes = false; /// a list of files that shouldn't be extracted from the library QStringList m_extractExcludes; /// native suffixes per OS QMap<QString, QString> m_nativeClassifiers; /// true if the library had a rules section (even empty) bool applyRules = false; /// rules associated with the library QList<std::shared_ptr<Rule>> m_rules; /// MOJANG: container with Mojang style download info MojangLibraryDownloadInfo::Ptr m_mojangDownloads; };
7,492
C++
.h
163
39.98773
119
0.696237
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,593
Rule.h
PrismLauncher_PrismLauncher/launcher/minecraft/Rule.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * 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. */ #pragma once #include <QJsonObject> #include <QList> #include <QString> #include <memory> #include "RuntimeContext.h" class Library; class Rule; enum RuleAction { Allow, Disallow, Defer }; QList<std::shared_ptr<Rule>> rulesFromJsonV4(const QJsonObject& objectWithRules); class Rule { protected: RuleAction m_result; virtual bool applies(const Library* parent, const RuntimeContext& runtimeContext) = 0; public: Rule(RuleAction result) : m_result(result) {} virtual ~Rule() {} virtual QJsonObject toJson() = 0; RuleAction apply(const Library* parent, const RuntimeContext& runtimeContext) { if (applies(parent, runtimeContext)) return m_result; else return Defer; } }; class OsRule : public Rule { private: // the OS QString m_system; // the OS version regexp QString m_version_regexp; protected: virtual bool applies(const Library*, const RuntimeContext& runtimeContext) { return runtimeContext.classifierMatches(m_system); } OsRule(RuleAction result, QString system, QString version_regexp) : Rule(result), m_system(system), m_version_regexp(version_regexp) {} public: virtual QJsonObject toJson(); static std::shared_ptr<OsRule> create(RuleAction result, QString system, QString version_regexp) { return std::shared_ptr<OsRule>(new OsRule(result, system, version_regexp)); } }; class ImplicitRule : public Rule { protected: virtual bool applies(const Library*, [[maybe_unused]] const RuntimeContext& runtimeContext) { return true; } ImplicitRule(RuleAction result) : Rule(result) {} public: virtual QJsonObject toJson(); static std::shared_ptr<ImplicitRule> create(RuleAction result) { return std::shared_ptr<ImplicitRule>(new ImplicitRule(result)); } };
3,319
C++
.h
84
36.119048
139
0.727893
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,594
MinecraftInstance.h
PrismLauncher_PrismLauncher/launcher/minecraft/MinecraftInstance.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net> * Copyright (C) 2023 TheKodeToad <TheKodeToad@proton.me> * * 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. */ #pragma once #include <java/JavaVersion.h> #include <QDir> #include <QProcess> #include "BaseInstance.h" #include "minecraft/launch/MinecraftTarget.h" #include "minecraft/mod/Mod.h" class ModFolderModel; class ResourceFolderModel; class ResourcePackFolderModel; class ShaderPackFolderModel; class TexturePackFolderModel; class WorldList; class GameOptions; class LaunchStep; class PackProfile; class MinecraftInstance : public BaseInstance { Q_OBJECT public: MinecraftInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr settings, const QString& rootDir); virtual ~MinecraftInstance() = default; virtual void saveNow() override; void loadSpecificSettings() override; // FIXME: remove QString typeName() const override; // FIXME: remove QSet<QString> traits() const override; bool canEdit() const override { return true; } bool canExport() const override { return true; } void populateLaunchMenu(QMenu* menu) override; ////// Directories and files ////// QString jarModsDir() const; QString resourcePacksDir() const; QString texturePacksDir() const; QString shaderPacksDir() const; QString modsRoot() const override; QString coreModsDir() const; QString nilModsDir() const; QString modsCacheLocation() const; QString libDir() const; QString worldDir() const; QString resourcesDir() const; QDir jarmodsPath() const; QDir librariesPath() const; QDir versionsPath() const; QString instanceConfigFolder() const override; // Path to the instance's minecraft directory. QString gameRoot() const override; // Path to the instance's minecraft bin directory. QString binRoot() const; // where to put the natives during/before launch QString getNativePath() const; // where the instance-local libraries should be QString getLocalLibraryPath() const; /** Returns whether the instance, with its version, has support for demo mode. */ [[nodiscard]] bool supportsDemo() const; void updateRuntimeContext() override; ////// Profile management ////// std::shared_ptr<PackProfile> getPackProfile() const; ////// Mod Lists ////// std::shared_ptr<ModFolderModel> loaderModList(); std::shared_ptr<ModFolderModel> coreModList(); std::shared_ptr<ModFolderModel> nilModList(); std::shared_ptr<ResourcePackFolderModel> resourcePackList(); std::shared_ptr<TexturePackFolderModel> texturePackList(); std::shared_ptr<ShaderPackFolderModel> shaderPackList(); QList<std::shared_ptr<ResourceFolderModel>> resourceLists(); std::shared_ptr<WorldList> worldList(); std::shared_ptr<GameOptions> gameOptionsModel(); ////// Launch stuff ////// QList<Task::Ptr> createUpdateTask() override; shared_qobject_ptr<LaunchTask> createLaunchTask(AuthSessionPtr account, MinecraftTarget::Ptr targetToJoin) override; QStringList extraArguments() override; QStringList verboseDescription(AuthSessionPtr session, MinecraftTarget::Ptr targetToJoin) override; QList<Mod*> getJarMods() const; QString createLaunchScript(AuthSessionPtr session, MinecraftTarget::Ptr targetToJoin); /// get arguments passed to java QStringList javaArguments(); QString getLauncher(); bool shouldApplyOnlineFixes(); /// get variables for launch command variable substitution/environment QMap<QString, QString> getVariables() override; /// create an environment for launching processes QProcessEnvironment createEnvironment() override; QProcessEnvironment createLaunchEnvironment() override; /// guess log level from a line of minecraft log MessageLevel::Enum guessLevel(const QString& line, MessageLevel::Enum level) override; IPathMatcher::Ptr getLogFileMatcher() override; QString getLogFileRoot() override; QString getStatusbarDescription() override; // FIXME: remove virtual QStringList getClassPath(); // FIXME: remove virtual QStringList getNativeJars(); // FIXME: remove virtual QString getMainClass() const; // FIXME: remove virtual QStringList processMinecraftArgs(AuthSessionPtr account, MinecraftTarget::Ptr targetToJoin) const; virtual JavaVersion getJavaVersion(); protected: QMap<QString, QString> createCensorFilterFromSession(AuthSessionPtr session); protected: // data std::shared_ptr<PackProfile> m_components; mutable std::shared_ptr<ModFolderModel> m_loader_mod_list; mutable std::shared_ptr<ModFolderModel> m_core_mod_list; mutable std::shared_ptr<ModFolderModel> m_nil_mod_list; mutable std::shared_ptr<ResourcePackFolderModel> m_resource_pack_list; mutable std::shared_ptr<ShaderPackFolderModel> m_shader_pack_list; mutable std::shared_ptr<TexturePackFolderModel> m_texture_pack_list; mutable std::shared_ptr<WorldList> m_world_list; mutable std::shared_ptr<GameOptions> m_game_options; }; using MinecraftInstancePtr = std::shared_ptr<MinecraftInstance>;
6,573
C++
.h
148
40.466216
120
0.750899
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,595
Component.h
PrismLauncher_PrismLauncher/launcher/minecraft/Component.h
#pragma once #include <QDateTime> #include <QJsonDocument> #include <QList> #include <memory> #include <optional> #include <variant> #include "ProblemProvider.h" #include "QObjectPtr.h" #include "meta/JsonFormat.h" #include "modplatform/ModIndex.h" class PackProfile; class LaunchProfile; namespace Meta { class Version; class VersionList; } // namespace Meta class VersionFile; struct UpdateActionChangeVersion { /// version to change to QString targetVersion; }; struct UpdateActionLatestRecommendedCompatible { /// Parent uid QString parentUid; QString parentName; /// Parent version QString version; /// }; struct UpdateActionRemove {}; struct UpdateActionImportantChanged { QString oldVersion; }; using UpdateActionNone = std::monostate; using UpdateAction = std::variant<UpdateActionNone, UpdateActionChangeVersion, UpdateActionLatestRecommendedCompatible, UpdateActionRemove, UpdateActionImportantChanged>; struct ModloaderMapEntry { ModPlatform::ModLoaderType type; QStringList knownConflictingComponents; }; class Component : public QObject, public ProblemProvider { Q_OBJECT public: Component(PackProfile* parent, const QString& uid); // DEPRECATED: remove these constructors? Component(PackProfile* parent, const QString& uid, std::shared_ptr<VersionFile> file); virtual ~Component() {} static const QMap<QString, ModloaderMapEntry> KNOWN_MODLOADERS; void applyTo(LaunchProfile* profile); bool isEnabled(); bool setEnabled(bool state); bool canBeDisabled(); bool isMoveable(); bool isCustomizable(); bool isRevertible(); bool isRemovable(); bool isCustom(); bool isVersionChangeable(bool wait = true); bool isKnownModloader(); QStringList knownConflictingComponents(); // DEPRECATED: explicit numeric order values, used for loading old non-component config. TODO: refactor and move to migration code void setOrder(int order); int getOrder(); QString getID(); QString getName(); QString getVersion(); std::shared_ptr<Meta::Version> getMeta(); QDateTime getReleaseDateTime(); QString getFilename(); std::shared_ptr<class VersionFile> getVersionFile() const; std::shared_ptr<class Meta::VersionList> getVersionList() const; void setImportant(bool state); const QList<PatchProblem> getProblems() const override; ProblemSeverity getProblemSeverity() const override; void addComponentProblem(ProblemSeverity severity, const QString& description); void resetComponentProblems(); void setVersion(const QString& version); bool customize(); bool revert(); void updateCachedData(); void waitLoadMeta(); void setUpdateAction(UpdateAction action); void clearUpdateAction(); UpdateAction getUpdateAction(); signals: void dataChanged(); public: /* data */ PackProfile* m_parent; // BEGIN: persistent component list properties /// ID of the component QString m_uid; /// version of the component - when there's a custom json override, this is also the version the component reverts to QString m_version; /// if true, this has been added automatically to satisfy dependencies and may be automatically removed bool m_dependencyOnly = false; /// if true, the component is either the main component of the instance, or otherwise important and cannot be removed. bool m_important = false; /// if true, the component is disabled bool m_disabled = false; /// cached name for display purposes, taken from the version file (meta or local override) QString m_cachedName; /// cached version for display AND other purposes, taken from the version file (meta or local override) QString m_cachedVersion; /// cached set of requirements, taken from the version file (meta or local override) Meta::RequireSet m_cachedRequires; Meta::RequireSet m_cachedConflicts; /// if true, the component is volatile and may be automatically removed when no longer needed bool m_cachedVolatile = false; // END: persistent component list properties // DEPRECATED: explicit numeric order values, used for loading old non-component config. TODO: refactor and move to migration code bool m_orderOverride = false; int m_order = 0; // load state std::shared_ptr<Meta::Version> m_metaVersion; std::shared_ptr<VersionFile> m_file; bool m_loaded = false; private: QList<PatchProblem> m_componentProblems; ProblemSeverity m_componentProblemSeverity = ProblemSeverity::None; UpdateAction m_updateAction = UpdateAction{ UpdateActionNone{} }; }; using ComponentPtr = shared_qobject_ptr<Component>;
4,871
C++
.h
126
33.507937
134
0.731226
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,596
PackProfile.h
PrismLauncher_PrismLauncher/launcher/minecraft/PackProfile.h
// SPDX-FileCopyrightText: 2022-2023 Sefa Eyeoglu <contact@scrumplex.net> // // SPDX-License-Identifier: GPL-3.0-only AND Apache-2.0 /* * Prism Launcher - Minecraft Launcher * Copyright (C) 2022-2023 Sefa Eyeoglu <contact@scrumplex.net> * Copyright (C) 2022 TheKodeToad <TheKodeToad@proton.me> * * 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. */ #pragma once #include <QAbstractListModel> #include <QList> #include <QString> #include <memory> #include <optional> #include "Component.h" #include "LaunchProfile.h" #include "modplatform/ModIndex.h" #include "net/Mode.h" class MinecraftInstance; struct PackProfileData; class ComponentUpdateTask; class PackProfile : public QAbstractListModel { Q_OBJECT friend ComponentUpdateTask; public: enum Columns { NameColumn = 0, VersionColumn, NUM_COLUMNS }; explicit PackProfile(MinecraftInstance* instance); virtual ~PackProfile(); virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override; virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const override; virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override; virtual int columnCount(const QModelIndex& parent) const override; virtual Qt::ItemFlags flags(const QModelIndex& index) const override; /// call this to explicitly mark the component list as loaded - this is used to build a new component list from scratch. void buildingFromScratch(); /// install more jar mods void installJarMods(QStringList selectedFiles); /// install a jar/zip as a replacement for the main jar void installCustomJar(QString selectedFile); /// install MMC/Prism component files bool installComponents(QStringList selectedFiles); /// install Java agent files void installAgents(QStringList selectedFiles); enum MoveDirection { MoveUp, MoveDown }; /// move component file # up or down the list void move(int index, MoveDirection direction); /// remove component file # - including files/records bool remove(int index); /// remove component file by id - including files/records bool remove(const QString& id); bool customize(int index); bool revertToBase(int index); /// reload the list, reload all components, resolve dependencies void reload(Net::Mode netmode); // reload all components, resolve dependencies void resolve(Net::Mode netmode); /// get current running task... Task::Ptr getCurrentTask(); std::shared_ptr<LaunchProfile> getProfile() const; // NOTE: used ONLY by MinecraftInstance to provide legacy version mappings from instance config void setOldConfigVersion(const QString& uid, const QString& version); QString getComponentVersion(const QString& uid) const; bool setComponentVersion(const QString& uid, const QString& version, bool important = false); bool installEmpty(const QString& uid, const QString& name); QString patchFilePathForUid(const QString& uid) const; /// if there is a save scheduled, do it now. void saveNow(); /// helper method, returns RuntimeContext of instance RuntimeContext runtimeContext(); signals: void minecraftChanged(); public: /// get the profile component by id ComponentPtr getComponent(const QString& id); /// get the profile component by index ComponentPtr getComponent(size_t index); /// Add the component to the internal list of patches // todo(merged): is this the best approach void appendComponent(ComponentPtr component); std::optional<ModPlatform::ModLoaderTypes> getModLoaders(); // this returns aditional loaders(Quilt supports fabric and NeoForge supports Forge) std::optional<ModPlatform::ModLoaderTypes> getSupportedModLoaders(); QList<ModPlatform::ModLoaderType> getModLoadersList(); /// apply the component patches. Catches all the errors and returns true/false for success/failure void invalidateLaunchProfile(); private: void scheduleSave(); bool saveIsScheduled() const; /// insert component so that its index is ideally the specified one (returns real index) void insertComponent(size_t index, ComponentPtr component); QString componentsFilePath() const; QString patchesPattern() const; private slots: void save_internal(); void updateSucceeded(); void updateFailed(const QString& error); void componentDataChanged(); void disableInteraction(bool disable); private: bool load(); bool installJarMods_internal(QStringList filepaths); bool installCustomJar_internal(QString filepath); bool installAgents_internal(QStringList filepaths); bool removeComponent_internal(ComponentPtr patch); private: /* data */ std::unique_ptr<PackProfileData> d; };
6,258
C++
.h
137
41.693431
124
0.749753
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,597
MojangDownloadInfo.h
PrismLauncher_PrismLauncher/launcher/minecraft/MojangDownloadInfo.h
#pragma once #include <QMap> #include <QString> #include <memory> struct MojangDownloadInfo { // types using Ptr = std::shared_ptr<MojangDownloadInfo>; // data /// Local filesystem path. WARNING: not used, only here so we can pass through mojang files unmolested! QString path; /// absolute URL of this file QString url; /// sha-1 checksum of the file QString sha1; /// size of the file in bytes int size; }; struct MojangLibraryDownloadInfo { MojangLibraryDownloadInfo(MojangDownloadInfo::Ptr artifact_) : artifact(artifact_) {} MojangLibraryDownloadInfo() {} // types using Ptr = std::shared_ptr<MojangLibraryDownloadInfo>; // methods MojangDownloadInfo* getDownloadInfo(QString classifier) { if (classifier.isNull()) { return artifact.get(); } return classifiers[classifier].get(); } // data MojangDownloadInfo::Ptr artifact; QMap<QString, MojangDownloadInfo::Ptr> classifiers; }; struct MojangAssetIndexInfo : public MojangDownloadInfo { // types using Ptr = std::shared_ptr<MojangAssetIndexInfo>; // methods MojangAssetIndexInfo() {} MojangAssetIndexInfo(QString id_) { this->id = id_; // HACK: ignore assets from other version files than Minecraft // workaround for stupid assets issue caused by amazon: // https://www.theregister.co.uk/2017/02/28/aws_is_awol_as_s3_goes_haywire/ if (id_ == "legacy") { url = "https://piston-meta.mojang.com/mc/assets/legacy/c0fd82e8ce9fbc93119e40d96d5a4e62cfa3f729/legacy.json"; } // HACK else { url = "https://s3.amazonaws.com/Minecraft.Download/indexes/" + id_ + ".json"; } known = false; } // data int totalSize; QString id; bool known = true; };
1,873
C++
.h
59
25.949153
121
0.660566
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,598
AssetsUtils.h
PrismLauncher_PrismLauncher/launcher/minecraft/AssetsUtils.h
/* 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. */ #pragma once #include <QMap> #include <QString> #include "net/NetJob.h" #include "net/NetRequest.h" struct AssetObject { QString getRelPath(); QUrl getUrl(); QString getLocalPath(); Net::NetRequest::Ptr getDownloadAction(); QString hash; qint64 size; }; struct AssetsIndex { NetJob::Ptr getDownloadJob(); QString id; QMap<QString, AssetObject> objects; bool isVirtual = false; bool mapToResources = false; }; /// FIXME: this is absolutely horrendous. REDO!!!! namespace AssetsUtils { bool loadAssetsIndexJson(const QString& id, const QString& file, AssetsIndex& index); QDir getAssetsDir(const QString& assetsId, const QString& resourcesFolder); /// Reconstruct a virtual assets folder for the given assets ID and return the folder bool reconstructAssets(QString assetsId, QString resourcesFolder); } // namespace AssetsUtils
1,486
C++
.h
41
33.634146
85
0.761838
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,599
GradleSpecifier.h
PrismLauncher_PrismLauncher/launcher/minecraft/GradleSpecifier.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * 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. */ #pragma once #include <QRegularExpression> #include <QString> #include <QStringList> #include "DefaultVariable.h" struct GradleSpecifier { GradleSpecifier() { m_valid = false; } GradleSpecifier(QString value) { operator=(value); } GradleSpecifier& operator=(const QString& value) { /* org.gradle.test.classifiers : service : 1.0 : jdk15 @ jar 0 "org.gradle.test.classifiers:service:1.0:jdk15@jar" 1 "org.gradle.test.classifiers" 2 "service" 3 "1.0" 4 "jdk15" 5 "jar" */ QRegularExpression matcher( QRegularExpression::anchoredPattern("([^:@]+):([^:@]+):([^:@]+)" "(?::([^:@]+))?" "(?:@([^:@]+))?")); QRegularExpressionMatch match = matcher.match(value); m_valid = match.hasMatch(); if (!m_valid) { m_invalidValue = value; return *this; } auto elements = match.captured(); m_groupId = match.captured(1); m_artifactId = match.captured(2); m_version = match.captured(3); m_classifier = match.captured(4); if (match.lastCapturedIndex() >= 5) { m_extension = match.captured(5); } return *this; } QString serialize() const { if (!m_valid) { return m_invalidValue; } QString retval = m_groupId + ":" + m_artifactId + ":" + m_version; if (!m_classifier.isEmpty()) { retval += ":" + m_classifier; } if (m_extension.isExplicit()) { retval += "@" + m_extension; } return retval; } QString getFileName() const { if (!m_valid) { return QString(); } QString filename = m_artifactId + '-' + m_version; if (!m_classifier.isEmpty()) { filename += "-" + m_classifier; } filename += "." + m_extension; return filename; } QString toPath(const QString& filenameOverride = QString()) const { if (!m_valid) { return QString(); } QString filename; if (filenameOverride.isEmpty()) { filename = getFileName(); } else { filename = filenameOverride; } QString path = m_groupId; path.replace('.', '/'); path += '/' + m_artifactId + '/' + m_version + '/' + filename; return path; } inline bool valid() const { return m_valid; } inline QString version() const { return m_version; } inline QString groupId() const { return m_groupId; } inline QString artifactId() const { return m_artifactId; } inline void setClassifier(const QString& classifier) { m_classifier = classifier; } inline QString classifier() const { return m_classifier; } inline QString extension() const { return m_extension; } inline QString artifactPrefix() const { return m_groupId + ":" + m_artifactId; } bool matchName(const GradleSpecifier& other) const { return other.artifactId() == artifactId() && other.groupId() == groupId() && other.classifier() == classifier(); } bool operator==(const GradleSpecifier& other) const { if (m_groupId != other.m_groupId) return false; if (m_artifactId != other.m_artifactId) return false; if (m_version != other.m_version) return false; if (m_classifier != other.m_classifier) return false; if (m_extension != other.m_extension) return false; return true; } private: QString m_invalidValue; QString m_groupId; QString m_artifactId; QString m_version; QString m_classifier; DefaultVariable<QString> m_extension = DefaultVariable<QString>("jar"); bool m_valid = false; };
5,427
C++
.h
150
29.066667
120
0.605727
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,600
ParseUtils.h
PrismLauncher_PrismLauncher/launcher/minecraft/ParseUtils.h
#pragma once #include <QDateTime> #include <QString> /// take the timestamp used by S3 and turn it into QDateTime QDateTime timeFromS3Time(QString str); /// take a timestamp and convert it into an S3 timestamp QString timeToS3Time(QDateTime);
245
C++
.h
7
33.714286
60
0.805085
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,601
SkinDelete.h
PrismLauncher_PrismLauncher/launcher/minecraft/skins/SkinDelete.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com> * * 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/>. */ #pragma once #include "net/NetRequest.h" class SkinDelete : public Net::NetRequest { Q_OBJECT public: using Ptr = shared_qobject_ptr<SkinDelete>; SkinDelete(); virtual ~SkinDelete() = default; static SkinDelete::Ptr make(QString token); protected: virtual QNetworkReply* getReply(QNetworkRequest&) override; };
1,091
C++
.h
29
34.896552
74
0.74456
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,602
SkinList.h
PrismLauncher_PrismLauncher/launcher/minecraft/skins/SkinList.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com> * * 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/>. */ #pragma once #include <QAbstractListModel> #include <QDir> #include <QFileSystemWatcher> #include "QObjectPtr.h" #include "SkinModel.h" #include "minecraft/auth/MinecraftAccount.h" class SkinList : public QAbstractListModel { Q_OBJECT public: explicit SkinList(QObject* parent, QString path, MinecraftAccountPtr acct); virtual ~SkinList() { save(); }; int getSkinIndex(const QString& key) const; virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; bool setData(const QModelIndex& idx, const QVariant& value, int role) override; virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override; virtual QStringList mimeTypes() const override; virtual Qt::DropActions supportedDropActions() const override; virtual bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override; virtual Qt::ItemFlags flags(const QModelIndex& index) const override; bool deleteSkin(const QString& key, const bool trash); void installSkins(const QStringList& iconFiles); QString installSkin(const QString& file, const QString& name = {}); const SkinModel* skin(const QString& key) const; SkinModel* skin(const QString& key); void startWatching(); void stopWatching(); QString getDir() const { return m_dir.absolutePath(); } void save(); int getSelectedAccountSkin(); void updateSkin(SkinModel* s); private: // hide copy constructor SkinList(const SkinList&) = delete; // hide assign op SkinList& operator=(const SkinList&) = delete; protected slots: void directoryChanged(const QString& path); void fileChanged(const QString& path); bool update(); private: shared_qobject_ptr<QFileSystemWatcher> m_watcher; bool is_watching; QVector<SkinModel> m_skin_list; QDir m_dir; MinecraftAccountPtr m_acct; };
2,700
C++
.h
64
38.40625
133
0.744372
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,603
CapeChange.h
PrismLauncher_PrismLauncher/launcher/minecraft/skins/CapeChange.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com> * * 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/>. */ #pragma once #include "net/NetRequest.h" class CapeChange : public Net::NetRequest { Q_OBJECT public: using Ptr = shared_qobject_ptr<CapeChange>; CapeChange(QString capeId); virtual ~CapeChange() = default; static CapeChange::Ptr make(QString token, QString capeId); protected: virtual QNetworkReply* getReply(QNetworkRequest&) override; private: QString m_capeId; };
1,156
C++
.h
31
34.419355
74
0.745308
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,604
SkinModel.h
PrismLauncher_PrismLauncher/launcher/minecraft/skins/SkinModel.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com> * * 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/>. */ #pragma once #include <QDir> #include <QJsonObject> #include <QPixmap> class SkinModel { public: enum Model { CLASSIC, SLIM }; SkinModel() = default; SkinModel(QString path); SkinModel(QDir skinDir, QJsonObject obj); virtual ~SkinModel() = default; QString name() const; QString getModelString() const; bool isValid() const; QString getPath() const { return m_path; } QPixmap getTexture() const { return m_texture; } QString getCapeId() const { return m_cape_id; } Model getModel() const { return m_model; } QString getURL() const { return m_url; } bool rename(QString newName); void setCapeId(QString capeID) { m_cape_id = capeID; } void setModel(Model model) { m_model = model; } void setURL(QString url) { m_url = url; } void refresh() { m_texture = QPixmap(m_path); } QJsonObject toJSON() const; private: QString m_path; QPixmap m_texture; QString m_cape_id; Model m_model; QString m_url; };
1,750
C++
.h
49
32.183673
74
0.704841
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,605
SkinUpload.h
PrismLauncher_PrismLauncher/launcher/minecraft/skins/SkinUpload.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com> * * 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/>. */ #pragma once #include "net/NetRequest.h" class SkinUpload : public Net::NetRequest { Q_OBJECT public: using Ptr = shared_qobject_ptr<SkinUpload>; // Note this class takes ownership of the file. SkinUpload(QString path, QString variant); virtual ~SkinUpload() = default; static SkinUpload::Ptr make(QString token, QString path, QString variant); protected: virtual QNetworkReply* getReply(QNetworkRequest&) override; private: QString m_path; QString m_variant; };
1,260
C++
.h
33
35.151515
78
0.743443
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,606
ShaderPackFolderModel.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/ShaderPackFolderModel.h
#pragma once #include "ResourceFolderModel.h" #include "minecraft/mod/ShaderPack.h" #include "minecraft/mod/tasks/LocalShaderPackParseTask.h" class ShaderPackFolderModel : public ResourceFolderModel { Q_OBJECT public: explicit ShaderPackFolderModel(const QDir& dir, BaseInstance* instance, bool is_indexed, bool create_dir, QObject* parent = nullptr) : ResourceFolderModel(dir, instance, is_indexed, create_dir, parent) {} virtual QString id() const override { return "shaderpacks"; } [[nodiscard]] Resource* createResource(const QFileInfo& info) override { return new ShaderPack(info); } [[nodiscard]] Task* createParseTask(Resource& resource) override { return new LocalShaderPackParseTask(m_next_resolution_ticket, static_cast<ShaderPack&>(resource)); } RESOURCE_HELPERS(ShaderPack); };
852
C++
.h
18
42.888889
136
0.756953
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,607
ResourcePackFolderModel.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/ResourcePackFolderModel.h
#pragma once #include "ResourceFolderModel.h" #include "ResourcePack.h" class ResourcePackFolderModel : public ResourceFolderModel { Q_OBJECT public: enum Columns { ActiveColumn = 0, ImageColumn, NameColumn, PackFormatColumn, DateColumn, ProviderColumn, SizeColumn, NUM_COLUMNS }; explicit ResourcePackFolderModel(const QDir& dir, BaseInstance* instance, bool is_indexed, bool create_dir, QObject* parent = nullptr); QString id() const override { return "resourcepacks"; } [[nodiscard]] QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; [[nodiscard]] QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; [[nodiscard]] int columnCount(const QModelIndex& parent) const override; [[nodiscard]] Resource* createResource(const QFileInfo& file) override { return new ResourcePack(file); } [[nodiscard]] Task* createParseTask(Resource&) override; RESOURCE_HELPERS(ResourcePack) };
1,013
C++
.h
16
59.0625
139
0.767206
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,608
ModFolderModel.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/ModFolderModel.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2022 flowln <flowlnlnln@gmail.com> * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net> * Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com> * * 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. */ #pragma once #include <QAbstractListModel> #include <QDir> #include <QList> #include <QMap> #include <QSet> #include <QString> #include "Mod.h" #include "ResourceFolderModel.h" class BaseInstance; class QFileSystemWatcher; /** * A legacy mod list. * Backed by a folder. */ class ModFolderModel : public ResourceFolderModel { Q_OBJECT public: enum Columns { ActiveColumn = 0, ImageColumn, NameColumn, VersionColumn, DateColumn, ProviderColumn, SizeColumn, SideColumn, LoadersColumn, McVersionsColumn, ReleaseTypeColumn, NUM_COLUMNS }; ModFolderModel(const QDir& dir, BaseInstance* instance, bool is_indexed, bool create_dir, QObject* parent = nullptr); virtual QString id() const override { return "mods"; } QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; int columnCount(const QModelIndex& parent) const override; [[nodiscard]] Resource* createResource(const QFileInfo& file) override { return new Mod(file); } [[nodiscard]] Task* createParseTask(Resource&) override; bool isValid(); RESOURCE_HELPERS(Mod) private slots: void onParseSucceeded(int ticket, QString resource_id) override; };
3,008
C++
.h
80
34.0625
121
0.72428
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,609
TexturePack.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/TexturePack.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2022 flowln <flowlnlnln@gmail.com> * 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/>. */ #pragma once #include "Resource.h" #include <QImage> #include <QMutex> #include <QPixmap> #include <QPixmapCache> class Version; class TexturePack : public Resource { Q_OBJECT public: using Ptr = shared_qobject_ptr<Resource>; TexturePack(QObject* parent = nullptr) : Resource(parent) {} TexturePack(QFileInfo file_info) : Resource(file_info) {} /** Gets the description of the texture pack. */ [[nodiscard]] QString description() const { return m_description; } /** Gets the image of the texture pack, converted to a QPixmap for drawing, and scaled to size. */ [[nodiscard]] QPixmap image(QSize size, Qt::AspectRatioMode mode = Qt::AspectRatioMode::IgnoreAspectRatio) const; /** Thread-safe. */ void setDescription(QString new_description); /** Thread-safe. */ void setImage(QImage new_image) const; bool valid() const override; protected: mutable QMutex m_data_lock; /** The texture pack's description, as defined in the pack.txt file. */ QString m_description; /** The texture pack's image file cache key, for access in the QPixmapCache global instance. * * The 'was_ever_used' state simply identifies whether the key was never inserted on the cache (true), * so as to tell whether a cache entry is inexistent or if it was just evicted from the cache. */ struct { QPixmapCache::Key key; bool was_ever_used = false; } mutable m_pack_image_cache_key; };
2,289
C++
.h
55
37.836364
117
0.717568
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,610
WorldSave.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/WorldSave.h
// SPDX-FileCopyrightText: 2022 Rachel Powers <508861+Ryex@users.noreply.github.com> // // SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (C) 2022 Rachel Powers <508861+Ryex@users.noreply.github.com> * * 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/>. */ #pragma once #include "Resource.h" #include <QMutex> class Version; enum class WorldSaveFormat { SINGLE, MULTI, INVALID }; class WorldSave : public Resource { Q_OBJECT public: using Ptr = shared_qobject_ptr<Resource>; WorldSave(QObject* parent = nullptr) : Resource(parent) {} WorldSave(QFileInfo file_info) : Resource(file_info) {} /** Gets the format of the save. */ [[nodiscard]] WorldSaveFormat saveFormat() const { return m_save_format; } /** Gets the name of the save dir (first found in multi mode). */ [[nodiscard]] QString saveDirName() const { return m_save_dir_name; } /** Thread-safe. */ void setSaveFormat(WorldSaveFormat new_save_format); /** Thread-safe. */ void setSaveDirName(QString dir_name); bool valid() const override; protected: mutable QMutex m_data_lock; /** The format in which the save file is in. * Since saves can be distributed in various slightly different ways, this allows us to treat them separately. */ WorldSaveFormat m_save_format = WorldSaveFormat::INVALID; QString m_save_dir_name; };
1,970
C++
.h
47
38.510638
115
0.725511
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,611
ModDetails.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/ModDetails.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2022 flowln <flowlnlnln@gmail.com> * * 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. */ #pragma once #include <memory> #include <QString> #include <QStringList> #include <QUrl> #include "minecraft/mod/MetadataHandler.h" struct ModLicense { QString name = {}; QString id = {}; QString url = {}; QString description = {}; ModLicense() {} ModLicense(const QString license) { // FIXME: come up with a better license parsing. // handle SPDX identifiers? https://spdx.org/licenses/ auto parts = license.split(' '); QStringList notNameParts = {}; for (auto part : parts) { auto _url = QUrl(part); if (part.startsWith("(") && part.endsWith(")")) _url = QUrl(part.mid(1, part.size() - 2)); if (_url.isValid() && !_url.scheme().isEmpty() && !_url.host().isEmpty()) { this->url = _url.toString(); notNameParts.append(part); continue; } } for (auto part : notNameParts) { parts.removeOne(part); } auto licensePart = parts.join(' '); this->name = licensePart; this->description = licensePart; if (parts.size() == 1) { this->id = parts.first(); } } ModLicense(const QString& name_, const QString& id_, const QString& url_, const QString& description_) : name(name_), id(id_), url(url_), description(description_) {} ModLicense(const ModLicense& other) : name(other.name), id(other.id), url(other.url), description(other.description) {} ModLicense& operator=(const ModLicense& other) { this->name = other.name; this->id = other.id; this->url = other.url; this->description = other.description; return *this; } ModLicense& operator=(const ModLicense&& other) { this->name = other.name; this->id = other.id; this->url = other.url; this->description = other.description; return *this; } bool isEmpty() { return this->name.isEmpty() && this->id.isEmpty() && this->url.isEmpty() && this->description.isEmpty(); } }; struct ModDetails { /* Mod ID as defined in the ModLoader-specific metadata */ QString mod_id = {}; /* Human-readable name */ QString name = {}; /* Human-readable mod version */ QString version = {}; /* Human-readable minecraft version */ QString mcversion = {}; /* URL for mod's home page */ QString homeurl = {}; /* Human-readable description */ QString description = {}; /* List of the author's names */ QStringList authors = {}; /* Issue Tracker URL */ QString issue_tracker = {}; /* License */ QList<ModLicense> licenses = {}; /* Path of mod logo */ QString icon_file = {}; ModDetails() = default; /** Metadata should be handled manually to properly set the mod status. */ ModDetails(const ModDetails& other) : mod_id(other.mod_id) , name(other.name) , version(other.version) , mcversion(other.mcversion) , homeurl(other.homeurl) , description(other.description) , authors(other.authors) , issue_tracker(other.issue_tracker) , licenses(other.licenses) , icon_file(other.icon_file) {} ModDetails& operator=(const ModDetails& other) = default; ModDetails& operator=(ModDetails&& other) = default; };
4,913
C++
.h
132
31.310606
127
0.635292
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,612
TexturePackFolderModel.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/TexturePackFolderModel.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2022 flowln <flowlnlnln@gmail.com> * 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. */ #pragma once #include "ResourceFolderModel.h" #include "TexturePack.h" class TexturePackFolderModel : public ResourceFolderModel { Q_OBJECT public: enum Columns { ActiveColumn = 0, ImageColumn, NameColumn, DateColumn, ProviderColumn, SizeColumn, NUM_COLUMNS }; explicit TexturePackFolderModel(const QDir& dir, BaseInstance* instance, bool is_indexed, bool create_dir, QObject* parent = nullptr); virtual QString id() const override { return "texturepacks"; } [[nodiscard]] QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; [[nodiscard]] QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; [[nodiscard]] int columnCount(const QModelIndex& parent) const override; [[nodiscard]] Resource* createResource(const QFileInfo& file) override { return new TexturePack(file); } [[nodiscard]] Task* createParseTask(Resource&) override; RESOURCE_HELPERS(TexturePack) };
2,545
C++
.h
51
47.196078
138
0.745066
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,613
Resource.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/Resource.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com> * * 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. */ #pragma once #include <QDateTime> #include <QFileInfo> #include <QObject> #include <QPointer> #include "MetadataHandler.h" #include "QObjectPtr.h" enum class ResourceType { UNKNOWN, //!< Indicates an unspecified resource type. ZIPFILE, //!< The resource is a zip file containing the resource's class files. SINGLEFILE, //!< The resource is a single file (not a zip file). FOLDER, //!< The resource is in a folder on the filesystem. LITEMOD, //!< The resource is a litemod }; enum class ResourceStatus { INSTALLED, // Both JAR and Metadata are present NOT_INSTALLED, // Only the Metadata is present NO_METADATA, // Only the JAR is present UNKNOWN, // Default status }; enum class SortType { NAME, DATE, VERSION, ENABLED, PACK_FORMAT, PROVIDER, SIZE, SIDE, MC_VERSIONS, LOADERS, RELEASE_TYPE }; enum class EnableAction { ENABLE, DISABLE, TOGGLE }; /** General class for managed resources. It mirrors a file in disk, with some more info * for display and house-keeping purposes. * * Subclass it to add additional data / behavior, such as Mods or Resource packs. */ class Resource : public QObject { Q_OBJECT Q_DISABLE_COPY(Resource) public: using Ptr = shared_qobject_ptr<Resource>; using WeakPtr = QPointer<Resource>; Resource(QObject* parent = nullptr); Resource(QFileInfo file_info); Resource(QString file_path) : Resource(QFileInfo(file_path)) {} ~Resource() override = default; void setFile(QFileInfo file_info); void parseFile(); [[nodiscard]] auto fileinfo() const -> QFileInfo { return m_file_info; } [[nodiscard]] auto dateTimeChanged() const -> QDateTime { return m_changed_date_time; } [[nodiscard]] auto internal_id() const -> QString { return m_internal_id; } [[nodiscard]] auto type() const -> ResourceType { return m_type; } [[nodiscard]] bool enabled() const { return m_enabled; } [[nodiscard]] auto getOriginalFileName() const -> QString; [[nodiscard]] QString sizeStr() const { return m_size_str; } [[nodiscard]] qint64 sizeInfo() const { return m_size_info; } [[nodiscard]] virtual auto name() const -> QString; [[nodiscard]] virtual bool valid() const { return m_type != ResourceType::UNKNOWN; } [[nodiscard]] auto status() const -> ResourceStatus { return m_status; }; [[nodiscard]] auto metadata() -> std::shared_ptr<Metadata::ModStruct> { return m_metadata; } [[nodiscard]] auto metadata() const -> std::shared_ptr<const Metadata::ModStruct> { return m_metadata; } [[nodiscard]] auto provider() const -> QString; [[nodiscard]] virtual auto homepage() const -> QString; void setStatus(ResourceStatus status) { m_status = status; } void setMetadata(std::shared_ptr<Metadata::ModStruct>&& metadata); void setMetadata(const Metadata::ModStruct& metadata) { setMetadata(std::make_shared<Metadata::ModStruct>(metadata)); } /** Compares two Resources, for sorting purposes, considering a ascending order, returning: * > 0: 'this' comes after 'other' * = 0: 'this' is equal to 'other' * < 0: 'this' comes before 'other' */ [[nodiscard]] virtual int compare(Resource const& other, SortType type = SortType::NAME) const; /** Returns whether the given filter should filter out 'this' (false), * or if such filter includes the Resource (true). */ [[nodiscard]] virtual bool applyFilter(QRegularExpression filter) const; /** Changes the enabled property, according to 'action'. * * Returns whether a change was applied to the Resource's properties. */ bool enable(EnableAction action); [[nodiscard]] auto shouldResolve() const -> bool { return !m_is_resolving && !m_is_resolved; } [[nodiscard]] auto isResolving() const -> bool { return m_is_resolving; } [[nodiscard]] auto isResolved() const -> bool { return m_is_resolved; } [[nodiscard]] auto resolutionTicket() const -> int { return m_resolution_ticket; } void setResolving(bool resolving, int resolutionTicket) { m_is_resolving = resolving; m_resolution_ticket = resolutionTicket; } // Delete all files of this resource. auto destroy(const QDir& index_dir, bool preserve_metadata = false, bool attempt_trash = true) -> bool; // Delete the metadata only. auto destroyMetadata(const QDir& index_dir) -> void; [[nodiscard]] auto isSymLink() const -> bool { return m_file_info.isSymLink(); } /** * @brief Take a instance path, checks if the file pointed to by the resource is a symlink or under a symlink in that instance * * @param instPath path to an instance directory * @return true * @return false */ [[nodiscard]] bool isSymLinkUnder(const QString& instPath) const; [[nodiscard]] bool isMoreThanOneHardLink() const; protected: /* The file corresponding to this resource. */ QFileInfo m_file_info; /* The cached date when this file was last changed. */ QDateTime m_changed_date_time; /* Internal ID for internal purposes. Properties such as human-readability should not be assumed. */ QString m_internal_id; /* Name as reported via the file name. In the absence of a better name, this is shown to the user. */ QString m_name; /* The type of file we're dealing with. */ ResourceType m_type = ResourceType::UNKNOWN; /* Installation status of the resource. */ ResourceStatus m_status = ResourceStatus::UNKNOWN; std::shared_ptr<Metadata::ModStruct> m_metadata = nullptr; /* Whether the resource is enabled (e.g. shows up in the game) or not. */ bool m_enabled = true; /* Used to keep trach of pending / concluded actions on the resource. */ bool m_is_resolving = false; bool m_is_resolved = false; int m_resolution_ticket = 0; QString m_size_str; qint64 m_size_info; };
7,413
C++
.h
152
44.611842
130
0.698617
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,614
DataPack.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/DataPack.h
// SPDX-FileCopyrightText: 2022 Rachel Powers <508861+Ryex@users.noreply.github.com> // // SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (C) 2022 Rachel Powers <508861+Ryex@users.noreply.github.com> * * 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/>. */ #pragma once #include "Resource.h" #include <QMutex> class Version; /* TODO: * * Store localized descriptions * */ class DataPack : public Resource { Q_OBJECT public: using Ptr = shared_qobject_ptr<Resource>; DataPack(QObject* parent = nullptr) : Resource(parent) {} DataPack(QFileInfo file_info) : Resource(file_info) {} /** Gets the numerical ID of the pack format. */ [[nodiscard]] int packFormat() const { return m_pack_format; } /** Gets, respectively, the lower and upper versions supported by the set pack format. */ [[nodiscard]] std::pair<Version, Version> compatibleVersions() const; /** Gets the description of the data pack. */ [[nodiscard]] QString description() const { return m_description; } /** Thread-safe. */ void setPackFormat(int new_format_id); /** Thread-safe. */ void setDescription(QString new_description); bool valid() const override; [[nodiscard]] int compare(Resource const& other, SortType type) const override; [[nodiscard]] bool applyFilter(QRegularExpression filter) const override; protected: mutable QMutex m_data_lock; /* The 'version' of a data pack, as defined in the pack.mcmeta file. * See https://minecraft.wiki/w/Data_pack#pack.mcmeta */ int m_pack_format = 0; /** The data pack's description, as defined in the pack.mcmeta file. */ QString m_description; };
2,277
C++
.h
56
37.089286
93
0.716425
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,615
ResourceFolderModel.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/ResourceFolderModel.h
#pragma once #include <QAbstractListModel> #include <QAction> #include <QDir> #include <QFileSystemWatcher> #include <QHeaderView> #include <QMutex> #include <QSet> #include <QSortFilterProxyModel> #include <QTreeView> #include "Resource.h" #include "BaseInstance.h" #include "tasks/ConcurrentTask.h" #include "tasks/Task.h" class QSortFilterProxyModel; /* A macro to define useful functions to handle Resource* -> T* more easily on derived classes */ #define RESOURCE_HELPERS(T) \ [[nodiscard]] T& at(int index) \ { \ return *static_cast<T*>(m_resources[index].get()); \ } \ [[nodiscard]] const T& at(int index) const \ { \ return *static_cast<const T*>(m_resources.at(index).get()); \ } \ QList<T*> selected##T##s(const QModelIndexList& indexes) \ { \ QList<T*> result; \ for (const QModelIndex& index : indexes) { \ if (index.column() != 0) \ continue; \ \ result.append(&at(index.row())); \ } \ return result; \ } \ QList<T*> all##T##s() \ { \ QList<T*> result; \ result.reserve(m_resources.size()); \ \ for (const Resource::Ptr& resource : m_resources) \ result.append(static_cast<T*>(resource.get())); \ \ return result; \ } /** A basic model for external resources. * * This model manages a list of resources. As such, external users of such resources do not own them, * and the resource's lifetime is contingent on the model's lifetime. * * TODO: Make the resources unique pointers accessible through weak pointers. */ class ResourceFolderModel : public QAbstractListModel { Q_OBJECT public: ResourceFolderModel(const QDir& dir, BaseInstance* instance, bool is_indexed, bool create_dir, QObject* parent = nullptr); ~ResourceFolderModel() override; virtual QString id() const { return "resource"; } /** Starts watching the paths for changes. * * Returns whether starting to watch all the paths was successful. * If one or more fails, it returns false. */ bool startWatching(const QStringList& paths); /** Stops watching the paths for changes. * * Returns whether stopping to watch all the paths was successful. * If one or more fails, it returns false. */ bool stopWatching(const QStringList& paths); /* Helper methods for subclasses, using a predetermined list of paths. */ virtual bool startWatching() { return startWatching({ indexDir().absolutePath(), m_dir.absolutePath() }); } virtual bool stopWatching() { return stopWatching({ indexDir().absolutePath(), m_dir.absolutePath() }); } QDir indexDir() { return { QString("%1/.index").arg(dir().absolutePath()) }; } /** Given a path in the system, install that resource, moving it to its place in the * instance file hierarchy. * * Returns whether the installation was succcessful. */ virtual bool installResource(QString path); virtual bool installResourceWithFlameMetadata(QString path, ModPlatform::IndexedVersion& vers); /** Uninstall (i.e. remove all data about it) a resource, given its file name. * * Returns whether the removal was successful. */ virtual bool uninstallResource(QString file_name, bool preserve_metadata = false); virtual bool deleteResources(const QModelIndexList&); virtual void deleteMetadata(const QModelIndexList&); /** Applies the given 'action' to the resources in 'indexes'. * * Returns whether the action was successfully applied to all resources. */ virtual bool setResourceEnabled(const QModelIndexList& indexes, EnableAction action); /** Creates a new update task and start it. Returns false if no update was done, like when an update is already underway. */ virtual bool update(); /** Creates a new parse task, if needed, for 'res' and start it.*/ virtual void resolveResource(Resource::Ptr res); [[nodiscard]] qsizetype size() const { return m_resources.size(); } [[nodiscard]] bool empty() const { return size() == 0; } [[nodiscard]] Resource& at(int index) { return *m_resources[index].get(); } [[nodiscard]] const Resource& at(int index) const { return *m_resources.at(index).get(); } QList<Resource*> selectedResources(const QModelIndexList& indexes); QList<Resource*> allResources(); [[nodiscard]] Resource::Ptr find(QString id); [[nodiscard]] QDir const& dir() const { return m_dir; } /** Checks whether there's any parse tasks being done. * * Since they can be quite expensive, and are usually done in a separate thread, if we were to destroy the model while having * such tasks would introduce an undefined behavior, most likely resulting in a crash. */ [[nodiscard]] bool hasPendingParseTasks() const; /* Qt behavior */ /* Basic columns */ enum Columns { ActiveColumn = 0, NameColumn, DateColumn, ProviderColumn, SizeColumn, NUM_COLUMNS }; QStringList columnNames(bool translated = true) const { return translated ? m_column_names_translated : m_column_names; } [[nodiscard]] int rowCount(const QModelIndex& parent = {}) const override { return parent.isValid() ? 0 : static_cast<int>(size()); } [[nodiscard]] int columnCount(const QModelIndex& parent = {}) const override { return parent.isValid() ? 0 : NUM_COLUMNS; } [[nodiscard]] Qt::DropActions supportedDropActions() const override; /// flags, mostly to support drag&drop [[nodiscard]] Qt::ItemFlags flags(const QModelIndex& index) const override; [[nodiscard]] QStringList mimeTypes() const override; bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override; [[nodiscard]] bool validateIndex(const QModelIndex& index) const; [[nodiscard]] QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override; [[nodiscard]] QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; void setupHeaderAction(QAction* act, int column); void saveColumns(QTreeView* tree); void loadColumns(QTreeView* tree); QMenu* createHeaderContextMenu(QTreeView* tree); /** This creates a proxy model to filter / sort the model for a UI. * * The actual comparisons and filtering are done directly by the Resource, so to modify behavior go there instead! */ QSortFilterProxyModel* createFilterProxyModel(QObject* parent = nullptr); [[nodiscard]] SortType columnToSortKey(size_t column) const; [[nodiscard]] QList<QHeaderView::ResizeMode> columnResizeModes() const { return m_column_resize_modes; } class ProxyModel : public QSortFilterProxyModel { public: explicit ProxyModel(QObject* parent = nullptr) : QSortFilterProxyModel(parent) {} protected: [[nodiscard]] bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override; [[nodiscard]] bool lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const override; }; QString instDirPath() const; signals: void updateFinished(); void parseFinished(); protected: /** This creates a new update task to be executed by update(). * * The task should load and parse all resources necessary, and provide a way of accessing such results. * * This Task is normally executed when opening a page, so it shouldn't contain much heavy work. * If such work is needed, try using it in the Task create by createParseTask() instead! */ [[nodiscard]] Task* createUpdateTask(); [[nodiscard]] virtual Resource* createResource(const QFileInfo& info) { return new Resource(info); } /** This creates a new parse task to be executed by onUpdateSucceeded(). * * This task should load and parse all heavy info needed by a resource, such as parsing a manifest. It gets executed * in the background, so it slowly updates the UI as tasks get done. */ [[nodiscard]] virtual Task* createParseTask(Resource&) { return nullptr; } /** Standard implementation of the model update logic. * * It uses set operations to find differences between the current state and the updated state, * to act only on those disparities. * */ void applyUpdates(QSet<QString>& current_set, QSet<QString>& new_set, QMap<QString, Resource::Ptr>& new_resources); protected slots: void directoryChanged(QString); /** Called when the update task is successful. * * This usually calls static_cast on the specific Task type returned by createUpdateTask, * so care must be taken in such cases. * TODO: Figure out a way to express this relationship better without templated classes (Q_OBJECT macro disallows that). */ virtual void onUpdateSucceeded(); virtual void onUpdateFailed() {} /** Called when the parse task with the given ticket is successful. * * This is just a simple reference implementation. You probably want to override it with your own logic in a subclass * if the resource is complex and has more stuff to parse. */ virtual void onParseSucceeded(int ticket, QString resource_id); virtual void onParseFailed(int ticket, QString resource_id); protected: // Represents the relationship between a column's index (represented by the list index), and it's sorting key. // As such, the order in with they appear is very important! QList<SortType> m_column_sort_keys = { SortType::ENABLED, SortType::NAME, SortType::DATE, SortType::PROVIDER, SortType::SIZE }; QStringList m_column_names = { "Enable", "Name", "Last Modified", "Provider", "Size" }; QStringList m_column_names_translated = { tr("Enable"), tr("Name"), tr("Last Modified"), tr("Provider"), tr("Size") }; QList<QHeaderView::ResizeMode> m_column_resize_modes = { QHeaderView::Interactive, QHeaderView::Stretch, QHeaderView::Interactive, QHeaderView::Interactive, QHeaderView::Interactive }; QList<bool> m_columnsHideable = { false, false, true, true, true }; QList<bool> m_columnsHiddenByDefault = { false, false, false, false, true }; QDir m_dir; BaseInstance* m_instance; QFileSystemWatcher m_watcher; bool m_is_watching = false; bool m_is_indexed; bool m_first_folder_load = true; Task::Ptr m_current_update_task = nullptr; bool m_scheduled_update = false; QList<Resource::Ptr> m_resources; // Represents the relationship between a resource's internal ID and it's row position on the model. QMap<QString, int> m_resources_index; ConcurrentTask m_helper_thread_task; QMap<int, Task::Ptr> m_active_parse_tasks; std::atomic<int> m_next_resolution_ticket = 0; };
12,224
C++
.h
214
50.523364
137
0.630091
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,616
ResourcePack.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/ResourcePack.h
#pragma once #include "Resource.h" #include <QImage> #include <QMutex> #include <QPixmap> #include <QPixmapCache> class Version; /* TODO: * * Store localized descriptions * */ class ResourcePack : public Resource { Q_OBJECT public: using Ptr = shared_qobject_ptr<Resource>; ResourcePack(QObject* parent = nullptr) : Resource(parent) {} ResourcePack(QFileInfo file_info) : Resource(file_info) {} /** Gets the numerical ID of the pack format. */ [[nodiscard]] int packFormat() const { return m_pack_format; } /** Gets, respectively, the lower and upper versions supported by the set pack format. */ [[nodiscard]] std::pair<Version, Version> compatibleVersions() const; /** Gets the description of the resource pack. */ [[nodiscard]] QString description() const { return m_description; } /** Gets the image of the resource pack, converted to a QPixmap for drawing, and scaled to size. */ [[nodiscard]] QPixmap image(QSize size, Qt::AspectRatioMode mode = Qt::AspectRatioMode::IgnoreAspectRatio) const; /** Thread-safe. */ void setPackFormat(int new_format_id); /** Thread-safe. */ void setDescription(QString new_description); /** Thread-safe. */ void setImage(QImage new_image) const; bool valid() const override; [[nodiscard]] int compare(Resource const& other, SortType type) const override; [[nodiscard]] bool applyFilter(QRegularExpression filter) const override; protected: mutable QMutex m_data_lock; /* The 'version' of a resource pack, as defined in the pack.mcmeta file. * See https://minecraft.wiki/w/Tutorials/Creating_a_resource_pack#Formatting_pack.mcmeta */ int m_pack_format = 0; /** The resource pack's description, as defined in the pack.mcmeta file. */ QString m_description; /** The resource pack's image file cache key, for access in the QPixmapCache global instance. * * The 'was_ever_used' state simply identifies whether the key was never inserted on the cache (true), * so as to tell whether a cache entry is inexistent or if it was just evicted from the cache. */ struct { QPixmapCache::Key key; bool was_ever_used = false; } mutable m_pack_image_cache_key; };
2,280
C++
.h
53
38.358491
117
0.70258
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,617
Mod.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/Mod.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2022 flowln <flowlnlnln@gmail.com> * Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com> * * 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. */ #pragma once #include <QDateTime> #include <QFileInfo> #include <QImage> #include <QList> #include <QMutex> #include <QPixmap> #include <QPixmapCache> #include <optional> #include "ModDetails.h" #include "Resource.h" class Mod : public Resource { Q_OBJECT public: using Ptr = shared_qobject_ptr<Mod>; using WeakPtr = QPointer<Mod>; Mod() = default; Mod(const QFileInfo& file); Mod(QString file_path) : Mod(QFileInfo(file_path)) {} auto details() const -> const ModDetails&; auto name() const -> QString override; auto version() const -> QString; auto homepage() const -> QString override; auto description() const -> QString; auto authors() const -> QStringList; auto licenses() const -> const QList<ModLicense>&; auto issueTracker() const -> QString; auto side() const -> QString; auto loaders() const -> QString; auto mcVersions() const -> QString; auto releaseType() const -> QString; /** Get the intneral path to the mod's icon file*/ QString iconPath() const { return m_local_details.icon_file; } /** Gets the icon of the mod, converted to a QPixmap for drawing, and scaled to size. */ [[nodiscard]] QPixmap icon(QSize size, Qt::AspectRatioMode mode = Qt::AspectRatioMode::IgnoreAspectRatio) const; /** Thread-safe. */ QPixmap setIcon(QImage new_image) const; void setDetails(const ModDetails& details); bool valid() const override; [[nodiscard]] int compare(const Resource & other, SortType type) const override; [[nodiscard]] bool applyFilter(QRegularExpression filter) const override; // Delete all the files of this mod auto destroy(QDir& index_dir, bool preserve_metadata = false, bool attempt_trash = true) -> bool; // Delete the metadata only void destroyMetadata(QDir& index_dir); void finishResolvingWithDetails(ModDetails&& details); protected: ModDetails m_local_details; mutable QMutex m_data_lock; struct { QPixmapCache::Key key; bool wasEverUsed = false; bool wasReadAttempt = false; } mutable m_packImageCacheKey; };
3,679
C++
.h
90
37.355556
116
0.715085
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,618
MetadataHandler.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/MetadataHandler.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2022 flowln <flowlnlnln@gmail.com> * Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com> * * 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/>. */ #pragma once #include <memory> #include "modplatform/packwiz/Packwiz.h" // launcher/minecraft/mod/Mod.h class Mod; namespace Metadata { using ModStruct = Packwiz::V1::Mod; using ModSide = Packwiz::V1::Side; inline auto create(const QDir& index_dir, ModPlatform::IndexedPack& mod_pack, ModPlatform::IndexedVersion& mod_version) -> ModStruct { return Packwiz::V1::createModFormat(index_dir, mod_pack, mod_version); } inline auto create(const QDir& index_dir, Mod& internal_mod, QString mod_slug) -> ModStruct { return Packwiz::V1::createModFormat(index_dir, internal_mod, std::move(mod_slug)); } inline void update(const QDir& index_dir, ModStruct& mod) { Packwiz::V1::updateModIndex(index_dir, mod); } inline void remove(const QDir& index_dir, QString mod_slug) { Packwiz::V1::deleteModIndex(index_dir, mod_slug); } inline void remove(const QDir& index_dir, QVariant& mod_id) { Packwiz::V1::deleteModIndex(index_dir, mod_id); } inline auto get(const QDir& index_dir, QString mod_slug) -> ModStruct { return Packwiz::V1::getIndexForMod(index_dir, std::move(mod_slug)); } inline auto get(const QDir& index_dir, QVariant& mod_id) -> ModStruct { return Packwiz::V1::getIndexForMod(index_dir, mod_id); } inline auto modSideToString(ModSide side) -> QString { return Packwiz::V1::sideToString(side); } }; // namespace Metadata
2,165
C++
.h
59
34.644068
132
0.75
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,619
ShaderPack.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/ShaderPack.h
// SPDX-FileCopyrightText: 2022 Rachel Powers <508861+Ryex@users.noreply.github.com> // // SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (C) 2022 Rachel Powers <508861+Ryex@users.noreply.github.com> * * 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/>. */ #pragma once #include "Resource.h" /* Info: * Currently For Optifine / Iris shader packs, * could be expanded to support others should they exist? * * This class and enum are mostly here as placeholders for validating * that a shaderpack exists and is in the right format, * namely that they contain a folder named 'shaders'. * * In the technical sense it would be possible to parse files like `shaders/shaders.properties` * to get information like the available profiles but this is not all that useful without more knowledge of the * shader mod used to be able to change settings. */ #include <QMutex> enum class ShaderPackFormat { VALID, INVALID }; class ShaderPack : public Resource { Q_OBJECT public: using Ptr = shared_qobject_ptr<Resource>; [[nodiscard]] ShaderPackFormat packFormat() const { return m_pack_format; } ShaderPack(QObject* parent = nullptr) : Resource(parent) {} ShaderPack(QFileInfo file_info) : Resource(file_info) {} /** Thread-safe. */ void setPackFormat(ShaderPackFormat new_format); bool valid() const override; protected: mutable QMutex m_data_lock; ShaderPackFormat m_pack_format = ShaderPackFormat::INVALID; };
2,058
C++
.h
49
39.265306
111
0.751002
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,620
LocalModParseTask.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/tasks/LocalModParseTask.h
#pragma once #include <QDebug> #include <QObject> #include "minecraft/mod/Mod.h" #include "minecraft/mod/ModDetails.h" #include "tasks/Task.h" namespace ModUtils { ModDetails ReadFabricModInfo(QByteArray contents); ModDetails ReadQuiltModInfo(QByteArray contents); ModDetails ReadForgeInfo(QByteArray contents); ModDetails ReadLiteModInfo(QByteArray contents); enum class ProcessingLevel { Full, BasicInfoOnly }; bool process(Mod& mod, ProcessingLevel level = ProcessingLevel::Full); bool processZIP(Mod& mod, ProcessingLevel level = ProcessingLevel::Full); bool processFolder(Mod& mod, ProcessingLevel level = ProcessingLevel::Full); bool processLitemod(Mod& mod, ProcessingLevel level = ProcessingLevel::Full); /** Checks whether a file is valid as a mod or not. */ bool validate(QFileInfo file); bool processIconPNG(const Mod& mod, QByteArray&& raw_data, QPixmap* pixmap); bool loadIconFile(const Mod& mod, QPixmap* pixmap); } // namespace ModUtils class LocalModParseTask : public Task { Q_OBJECT public: struct Result { ModDetails details; }; using ResultPtr = std::shared_ptr<Result>; ResultPtr result() const { return m_result; } [[nodiscard]] bool canAbort() const override { return true; } bool abort() override; LocalModParseTask(int token, ResourceType type, const QFileInfo& modFile); void executeTask() override; [[nodiscard]] int token() const { return m_token; } private: int m_token; ResourceType m_type; QFileInfo m_modFile; ResultPtr m_result; std::atomic<bool> m_aborted = false; };
1,593
C++
.h
41
35.658537
78
0.759115
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,621
LocalWorldSaveParseTask.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/tasks/LocalWorldSaveParseTask.h
// SPDX-FileCopyrightText: 2022 Rachel Powers <508861+Ryex@users.noreply.github.com> // // SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (C) 2022 Rachel Powers <508861+Ryex@users.noreply.github.com> * * 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/>. */ #pragma once #include <QDebug> #include <QObject> #include "minecraft/mod/WorldSave.h" #include "tasks/Task.h" namespace WorldSaveUtils { enum class ProcessingLevel { Full, BasicInfoOnly }; bool process(WorldSave& save, ProcessingLevel level = ProcessingLevel::Full); bool processZIP(WorldSave& pack, ProcessingLevel level = ProcessingLevel::Full); bool processFolder(WorldSave& pack, ProcessingLevel level = ProcessingLevel::Full); bool validate(QFileInfo file); } // namespace WorldSaveUtils class LocalWorldSaveParseTask : public Task { Q_OBJECT public: LocalWorldSaveParseTask(int token, WorldSave& save); [[nodiscard]] bool canAbort() const override { return true; } bool abort() override; void executeTask() override; [[nodiscard]] int token() const { return m_token; } private: int m_token; WorldSave& m_save; bool m_aborted = false; };
1,752
C++
.h
44
37.113636
84
0.756213
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,622
LocalResourcePackParseTask.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/tasks/LocalResourcePackParseTask.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2022 flowln <flowlnlnln@gmail.com> * * 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/>. */ #pragma once #include <QDebug> #include <QObject> #include "minecraft/mod/ResourcePack.h" #include "tasks/Task.h" namespace ResourcePackUtils { enum class ProcessingLevel { Full, BasicInfoOnly }; bool process(ResourcePack& pack, ProcessingLevel level = ProcessingLevel::Full); bool processZIP(ResourcePack& pack, ProcessingLevel level = ProcessingLevel::Full); bool processFolder(ResourcePack& pack, ProcessingLevel level = ProcessingLevel::Full); QString processComponent(const QJsonValue& value, bool strikethrough = false, bool underline = false); bool processMCMeta(ResourcePack& pack, QByteArray&& raw_data); bool processPackPNG(const ResourcePack& pack, QByteArray&& raw_data); /// processes ONLY the pack.png (rest of the pack may be invalid) bool processPackPNG(const ResourcePack& pack); /** Checks whether a file is valid as a resource pack or not. */ bool validate(QFileInfo file); } // namespace ResourcePackUtils class LocalResourcePackParseTask : public Task { Q_OBJECT public: LocalResourcePackParseTask(int token, ResourcePack& rp); [[nodiscard]] bool canAbort() const override { return true; } bool abort() override; void executeTask() override; [[nodiscard]] int token() const { return m_token; } private: int m_token; ResourcePack& m_resource_pack; bool m_aborted = false; };
2,092
C++
.h
48
41.020833
102
0.764067
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,623
LocalResourceParse.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/tasks/LocalResourceParse.h
// SPDX-FileCopyrightText: 2022 Rachel Powers <508861+Ryex@users.noreply.github.com> // // SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (C) 2022 Rachel Powers <508861+Ryex@users.noreply.github.com> * * 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/>. */ #pragma once #include <set> #include <QDebug> #include <QFileInfo> #include <QObject> enum class PackedResourceType { DataPack, ResourcePack, TexturePack, ShaderPack, WorldSave, Mod, UNKNOWN }; namespace ResourceUtils { static const std::set<PackedResourceType> ValidResourceTypes = { PackedResourceType::DataPack, PackedResourceType::ResourcePack, PackedResourceType::TexturePack, PackedResourceType::ShaderPack, PackedResourceType::WorldSave, PackedResourceType::Mod }; PackedResourceType identify(QFileInfo file); QString getPackedTypeName(PackedResourceType type); } // namespace ResourceUtils
1,586
C++
.h
32
43.875
131
0.721756
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,624
GetModDependenciesTask.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/tasks/GetModDependenciesTask.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com> * * 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/>. */ #pragma once #include <QDir> #include <QEventLoop> #include <QList> #include <QVariant> #include <functional> #include <memory> #include "minecraft/mod/MetadataHandler.h" #include "minecraft/mod/ModFolderModel.h" #include "modplatform/ModIndex.h" #include "modplatform/ResourceAPI.h" #include "tasks/SequentialTask.h" #include "tasks/Task.h" #include "ui/pages/modplatform/ModModel.h" class GetModDependenciesTask : public SequentialTask { Q_OBJECT public: using Ptr = shared_qobject_ptr<GetModDependenciesTask>; struct PackDependency { ModPlatform::Dependency dependency; ModPlatform::IndexedPack::Ptr pack; ModPlatform::IndexedVersion version; PackDependency() = default; PackDependency(const ModPlatform::IndexedPack::Ptr p, const ModPlatform::IndexedVersion& v) { pack = p; version = v; } }; struct PackDependencyExtraInfo { bool maybe_installed; QStringList required_by; }; struct Provider { ModPlatform::ResourceProvider name; std::shared_ptr<ResourceDownload::ModModel> mod; std::shared_ptr<ResourceAPI> api; }; explicit GetModDependenciesTask(BaseInstance* instance, ModFolderModel* folder, QList<std::shared_ptr<PackDependency>> selected); auto getDependecies() const -> QList<std::shared_ptr<PackDependency>> { return m_pack_dependencies; } QHash<QString, PackDependencyExtraInfo> getExtraInfo(); protected slots: Task::Ptr prepareDependencyTask(const ModPlatform::Dependency&, ModPlatform::ResourceProvider, int); QList<ModPlatform::Dependency> getDependenciesForVersion(const ModPlatform::IndexedVersion&, ModPlatform::ResourceProvider providerName); void prepare(); Task::Ptr getProjectInfoTask(std::shared_ptr<PackDependency> pDep); ModPlatform::Dependency getOverride(const ModPlatform::Dependency&, ModPlatform::ResourceProvider providerName); void removePack(const QVariant& addonId); bool isLocalyInstalled(std::shared_ptr<PackDependency> pDep); bool maybeInstalled(std::shared_ptr<PackDependency> pDep); private: QList<std::shared_ptr<PackDependency>> m_pack_dependencies; QList<std::shared_ptr<Metadata::ModStruct>> m_mods; QList<std::shared_ptr<PackDependency>> m_selected; QStringList m_mods_file_names; Provider m_flame_provider; Provider m_modrinth_provider; Version m_version; ModPlatform::ModLoaderTypes m_loaderType; };
3,303
C++
.h
78
37.166667
133
0.733188
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,625
LocalResourceUpdateTask.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/tasks/LocalResourceUpdateTask.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2022 flowln <flowlnlnln@gmail.com> * * 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/>. */ #pragma once #include <QDir> #include "modplatform/ModIndex.h" #include "tasks/Task.h" class LocalResourceUpdateTask : public Task { Q_OBJECT public: using Ptr = shared_qobject_ptr<LocalResourceUpdateTask>; explicit LocalResourceUpdateTask(QDir index_dir, ModPlatform::IndexedPack& project, ModPlatform::IndexedVersion& version); auto canAbort() const -> bool override { return true; } auto abort() -> bool override; protected slots: //! Entry point for tasks. void executeTask() override; signals: void hasOldResource(QString name, QString filename); private: QDir m_index_dir; ModPlatform::IndexedPack m_project; ModPlatform::IndexedVersion m_version; };
1,458
C++
.h
38
35.263158
126
0.746988
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,626
LocalTexturePackParseTask.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/tasks/LocalTexturePackParseTask.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2022 flowln <flowlnlnln@gmail.com> * 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/>. */ #pragma once #include <QDebug> #include <QObject> #include "minecraft/mod/TexturePack.h" #include "tasks/Task.h" namespace TexturePackUtils { enum class ProcessingLevel { Full, BasicInfoOnly }; bool process(TexturePack& pack, ProcessingLevel level = ProcessingLevel::Full); bool processZIP(TexturePack& pack, ProcessingLevel level = ProcessingLevel::Full); bool processFolder(TexturePack& pack, ProcessingLevel level = ProcessingLevel::Full); bool processPackTXT(TexturePack& pack, QByteArray&& raw_data); bool processPackPNG(const TexturePack& pack, QByteArray&& raw_data); /// processes ONLY the pack.png (rest of the pack may be invalid) bool processPackPNG(const TexturePack& pack); /** Checks whether a file is valid as a texture pack or not. */ bool validate(QFileInfo file); } // namespace TexturePackUtils class LocalTexturePackParseTask : public Task { Q_OBJECT public: LocalTexturePackParseTask(int token, TexturePack& rp); [[nodiscard]] bool canAbort() const override { return true; } bool abort() override; void executeTask() override; [[nodiscard]] int token() const { return m_token; } private: int m_token; TexturePack& m_texture_pack; bool m_aborted = false; };
2,035
C++
.h
48
39.8125
85
0.759269
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,627
LocalDataPackParseTask.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/tasks/LocalDataPackParseTask.h
// SPDX-FileCopyrightText: 2022 Rachel Powers <508861+Ryex@users.noreply.github.com> // // SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (C) 2022 Rachel Powers <508861+Ryex@users.noreply.github.com> * * 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/>. */ #pragma once #include <QDebug> #include <QObject> #include "minecraft/mod/DataPack.h" #include "tasks/Task.h" namespace DataPackUtils { enum class ProcessingLevel { Full, BasicInfoOnly }; bool process(DataPack& pack, ProcessingLevel level = ProcessingLevel::Full); bool processZIP(DataPack& pack, ProcessingLevel level = ProcessingLevel::Full); bool processFolder(DataPack& pack, ProcessingLevel level = ProcessingLevel::Full); bool processMCMeta(DataPack& pack, QByteArray&& raw_data); /** Checks whether a file is valid as a data pack or not. */ bool validate(QFileInfo file); } // namespace DataPackUtils class LocalDataPackParseTask : public Task { Q_OBJECT public: LocalDataPackParseTask(int token, DataPack& dp); [[nodiscard]] bool canAbort() const override { return true; } bool abort() override; void executeTask() override; [[nodiscard]] int token() const { return m_token; } private: int m_token; DataPack& m_data_pack; bool m_aborted = false; };
1,866
C++
.h
46
37.913043
84
0.75347
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,628
LocalShaderPackParseTask.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/tasks/LocalShaderPackParseTask.h
// SPDX-FileCopyrightText: 2022 Rachel Powers <508861+Ryex@users.noreply.github.com> // // SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (C) 2022 Rachel Powers <508861+Ryex@users.noreply.github.com> * * 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/>. */ #pragma once #include <QDebug> #include <QObject> #include "minecraft/mod/ShaderPack.h" #include "tasks/Task.h" namespace ShaderPackUtils { enum class ProcessingLevel { Full, BasicInfoOnly }; bool process(ShaderPack& pack, ProcessingLevel level = ProcessingLevel::Full); bool processZIP(ShaderPack& pack, ProcessingLevel level = ProcessingLevel::Full); bool processFolder(ShaderPack& pack, ProcessingLevel level = ProcessingLevel::Full); /** Checks whether a file is valid as a shader pack or not. */ bool validate(QFileInfo file); } // namespace ShaderPackUtils class LocalShaderPackParseTask : public Task { Q_OBJECT public: LocalShaderPackParseTask(int token, ShaderPack& sp); [[nodiscard]] bool canAbort() const override { return true; } bool abort() override; void executeTask() override; [[nodiscard]] int token() const { return m_token; } private: int m_token; ShaderPack& m_shader_pack; bool m_aborted = false; };
1,829
C++
.h
45
38
84
0.755518
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,629
ResourceFolderLoadTask.h
PrismLauncher_PrismLauncher/launcher/minecraft/mod/tasks/ResourceFolderLoadTask.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2022 flowln <flowlnlnln@gmail.com> * 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. */ #pragma once #include <QDir> #include <QMap> #include <QObject> #include <QRunnable> #include <memory> #include "minecraft/mod/Mod.h" #include "tasks/Task.h" class ResourceFolderLoadTask : public Task { Q_OBJECT public: struct Result { QMap<QString, Resource::Ptr> resources; }; using ResultPtr = std::shared_ptr<Result>; ResultPtr result() const { return m_result; } public: ResourceFolderLoadTask(const QDir& resource_dir, const QDir& index_dir, bool is_indexed, bool clean_orphan, std::function<Resource*(const QFileInfo&)> create_function); [[nodiscard]] bool canAbort() const override { return true; } bool abort() override { m_aborted.store(true); return true; } void executeTask() override; private: void getFromMetadata(); private: QDir m_resource_dir, m_index_dir; bool m_is_indexed; bool m_clean_orphan; std::function<Resource*(QFileInfo const&)> m_create_func; ResultPtr m_result; std::atomic<bool> m_aborted = false; /** This is the thread in which we should put new mod objects */ QThread* m_thread_to_spawn_into; };
2,810
C++
.h
76
32.460526
87
0.688693
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,630
GameOptions.h
PrismLauncher_PrismLauncher/launcher/minecraft/gameoptions/GameOptions.h
#pragma once #include <QAbstractListModel> #include <QString> #include <map> struct GameOptionItem { QString key; QString value; }; class GameOptions : public QAbstractListModel { Q_OBJECT public: explicit GameOptions(const QString& path); virtual ~GameOptions() = default; int rowCount(const QModelIndex& parent = QModelIndex()) const override; int columnCount(const QModelIndex& parent) const override; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; bool isLoaded() const; bool reload(); bool save(); private: std::vector<GameOptionItem> contents; bool loaded = false; QString path; int version = 0; };
806
C++
.h
26
27.076923
91
0.73385
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,631
AuthStep.h
PrismLauncher_PrismLauncher/launcher/minecraft/auth/AuthStep.h
#pragma once #include <QList> #include <QNetworkReply> #include <QObject> #include "QObjectPtr.h" #include "minecraft/auth/AccountData.h" /** * Enum for describing the state of the current task. * Used by the getStateMessage function to determine what the status message should be. */ enum class AccountTaskState { STATE_CREATED, STATE_WORKING, STATE_SUCCEEDED, STATE_DISABLED, //!< MSA Client ID has changed. Tell user to reloginn STATE_FAILED_SOFT, //!< soft failure. authentication went through partially STATE_FAILED_HARD, //!< hard failure. main tokens are invalid STATE_FAILED_GONE, //!< hard failure. main tokens are invalid, and the account no longer exists STATE_OFFLINE //!< soft failure. authentication failed in the first step in a 'soft' way }; class AuthStep : public QObject { Q_OBJECT public: using Ptr = shared_qobject_ptr<AuthStep>; explicit AuthStep(AccountData* data) : QObject(nullptr), m_data(data) {}; virtual ~AuthStep() noexcept = default; virtual QString describe() = 0; public slots: virtual void perform() = 0; virtual void abort() {} signals: void finished(AccountTaskState resultingState, QString message); protected: AccountData* m_data; };
1,277
C++
.h
35
32.857143
100
0.722628
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,632
MinecraftAccount.h
PrismLauncher_PrismLauncher/launcher/minecraft/auth/MinecraftAccount.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * 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. */ #pragma once #include <QJsonObject> #include <QList> #include <QMap> #include <QObject> #include <QPair> #include <QPixmap> #include <QString> #include "AccountData.h" #include "AuthSession.h" #include "QObjectPtr.h" #include "Usable.h" #include "minecraft/auth/AuthFlow.h" class Task; class MinecraftAccount; using MinecraftAccountPtr = shared_qobject_ptr<MinecraftAccount>; Q_DECLARE_METATYPE(MinecraftAccountPtr) /** * A profile within someone's Mojang account. * * Currently, the profile system has not been implemented by Mojang yet, * but we might as well add some things for it in Prism Launcher right now so * we don't have to rip the code to pieces to add it later. */ struct AccountProfile { QString id; QString name; bool legacy; }; /** * Object that stores information about a certain Mojang account. * * Said information may include things such as that account's username, client token, and access * token if the user chose to stay logged in. */ class MinecraftAccount : public QObject, public Usable { Q_OBJECT public: /* construction */ //! Do not copy accounts. ever. explicit MinecraftAccount(const MinecraftAccount& other, QObject* parent) = delete; //! Default constructor explicit MinecraftAccount(QObject* parent = 0); static MinecraftAccountPtr createBlankMSA(); static MinecraftAccountPtr createOffline(const QString& username); static MinecraftAccountPtr loadFromJsonV3(const QJsonObject& json); static QUuid uuidFromUsername(QString username); //! Saves a MinecraftAccount to a JSON object and returns it. QJsonObject saveToJson() const; public: /* manipulation */ shared_qobject_ptr<AuthFlow> login(bool useDeviceCode = false); shared_qobject_ptr<AuthFlow> refresh(); shared_qobject_ptr<AuthFlow> currentTask(); public: /* queries */ QString internalId() const { return data.internalId; } QString accountDisplayString() const { return data.accountDisplayString(); } QString accessToken() const { return data.accessToken(); } QString profileId() const { return data.profileId(); } QString profileName() const { return data.profileName(); } bool isActive() const; [[nodiscard]] AccountType accountType() const noexcept { return data.type; } bool ownsMinecraft() const { return data.type != AccountType::Offline && data.minecraftEntitlement.ownsMinecraft; } bool hasProfile() const { return data.profileId().size() != 0; } QString typeString() const { switch (data.type) { case AccountType::MSA: { return "msa"; } break; case AccountType::Offline: { return "offline"; } break; default: { return "unknown"; } } } QPixmap getFace() const; //! Returns the current state of the account AccountState accountState() const; AccountData* accountData() { return &data; } bool shouldRefresh() const; void fillSession(AuthSessionPtr session); QString lastError() const { return data.lastError(); } signals: /** * This signal is emitted when the account changes */ void changed(); void activityChanged(bool active); // TODO: better signalling for the various possible state changes - especially errors protected: /* variables */ AccountData data; // current task we are executing here shared_qobject_ptr<AuthFlow> m_currentTask; protected: /* methods */ void incrementUses() override; void decrementUses() override; private slots: void authSucceeded(); void authFailed(QString reason); };
5,198
C++
.h
135
34.266667
119
0.715167
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,633
AuthFlow.h
PrismLauncher_PrismLauncher/launcher/minecraft/auth/AuthFlow.h
#pragma once #include <QImage> #include <QList> #include <QNetworkReply> #include <QObject> #include <QSet> #include <QVector> #include "minecraft/auth/AccountData.h" #include "minecraft/auth/AuthStep.h" #include "tasks/Task.h" class AuthFlow : public Task { Q_OBJECT public: enum class Action { Refresh, Login, DeviceCode }; explicit AuthFlow(AccountData* data, Action action = Action::Refresh); virtual ~AuthFlow() = default; void executeTask() override; AccountTaskState taskState() { return m_taskState; } public slots: bool abort() override; signals: void authorizeWithBrowser(const QUrl& url); void authorizeWithBrowserWithExtra(QString url, QString code, int expiresIn); protected: void succeed(); void nextStep(); private slots: // NOTE: true -> non-terminal state, false -> terminal state bool changeState(AccountTaskState newState, QString reason = QString()); void stepFinished(AccountTaskState resultingState, QString message); private: AccountTaskState m_taskState = AccountTaskState::STATE_CREATED; QList<AuthStep::Ptr> m_steps; AuthStep::Ptr m_currentStep; AccountData* m_data = nullptr; };
1,208
C++
.h
36
29.722222
81
0.739655
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,634
AuthSession.h
PrismLauncher_PrismLauncher/launcher/minecraft/auth/AuthSession.h
#pragma once #include <QMultiMap> #include <QString> #include <memory> #include "QObjectPtr.h" class MinecraftAccount; class QNetworkAccessManager; struct AuthSession { bool MakeOffline(QString offline_playername); void MakeDemo(QString name, QString uuid); QString serializeUserProperties(); enum Status { Undetermined, RequiresOAuth, RequiresPassword, RequiresProfileSetup, PlayableOffline, PlayableOnline, GoneOrMigrated } status = Undetermined; // combined session ID QString session; // volatile auth token QString access_token; // profile name QString player_name; // profile ID QString uuid; // 'legacy' or 'mojang', depending on account type QString user_type; // Did the auth server reply? bool auth_server_online = false; // Did the user request online mode? bool wants_online = true; // Is this a demo session? bool demo = false; }; using AuthSessionPtr = std::shared_ptr<AuthSession>;
1,045
C++
.h
38
22.605263
54
0.700701
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,635
AccountList.h
PrismLauncher_PrismLauncher/launcher/minecraft/auth/AccountList.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * 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. */ #pragma once #include "MinecraftAccount.h" #include "minecraft/auth/AuthFlow.h" #include <QAbstractListModel> #include <QObject> #include <QSharedPointer> #include <QVariant> /*! * List of available Mojang accounts. * This should be loaded in the background by Prism Launcher on startup. */ class AccountList : public QAbstractListModel { Q_OBJECT public: enum ModelRoles { PointerRole = 0x34B1CB48 }; enum VListColumns { // TODO: Add icon column. ProfileNameColumn = 0, NameColumn, TypeColumn, StatusColumn, NUM_COLUMNS }; explicit AccountList(QObject* parent = 0); virtual ~AccountList() noexcept; const MinecraftAccountPtr at(int i) const; int count() const; //////// List Model Functions //////// QVariant data(const QModelIndex& index, int role) const override; virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const override; virtual int rowCount(const QModelIndex& parent) const override; virtual int columnCount(const QModelIndex& parent) const override; virtual Qt::ItemFlags flags(const QModelIndex& index) const override; virtual bool setData(const QModelIndex& index, const QVariant& value, int role) override; void addAccount(MinecraftAccountPtr account); void removeAccount(QModelIndex index); int findAccountByProfileId(const QString& profileId) const; MinecraftAccountPtr getAccountByProfileName(const QString& profileName) const; QStringList profileNames() const; // requesting a refresh pushes it to the front of the queue void requestRefresh(QString accountId); // queuing a refresh will let it go to the back of the queue (unless it's somewhere inside the queue already) void queueRefresh(QString accountId); /*! * Sets the path to load/save the list file from/to. * If autosave is true, this list will automatically save to the given path whenever it changes. * THIS FUNCTION DOES NOT LOAD THE LIST. If you set autosave, be sure to call loadList() immediately * after calling this function to ensure an autosaved change doesn't overwrite the list you intended * to load. */ void setListFilePath(QString path, bool autosave = false); bool loadList(); bool loadV3(QJsonObject& root); bool saveList(); MinecraftAccountPtr defaultAccount() const; void setDefaultAccount(MinecraftAccountPtr profileId); bool anyAccountIsValid(); bool isActive() const; protected: void beginActivity(); void endActivity(); private: const char* m_name; uint32_t m_activityCount = 0; signals: void listChanged(); void listActivityChanged(); void defaultAccountChanged(); void activityChanged(bool active); public slots: /** * This is called when one of the accounts changes and the list needs to be updated */ void accountChanged(); /** * This is called when a (refresh/login) task involving the account starts or ends */ void accountActivityChanged(bool active); /** * This is initially to run background account refresh tasks, or on a hourly timer */ void fillQueue(); private slots: void tryNext(); void authSucceeded(); void authFailed(QString reason); protected: QList<QString> m_refreshQueue; QTimer* m_refreshTimer; QTimer* m_nextTimer; shared_qobject_ptr<AuthFlow> m_currentTask; /*! * Called whenever the list changes. * This emits the listChanged() signal and autosaves the list (if autosave is enabled). */ void onListChanged(); /*! * Called whenever the active account changes. * Emits the defaultAccountChanged() signal and autosaves the list if enabled. */ void onDefaultAccountChanged(); QList<MinecraftAccountPtr> m_accounts; MinecraftAccountPtr m_defaultAccount; //! Path to the account list file. Empty string if there isn't one. QString m_listFilePath; /*! * If true, the account list will automatically save to the account list path when it changes. * Ignored if m_listFilePath is blank. */ bool m_autosave = false; };
5,721
C++
.h
145
35.048276
113
0.722913
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,636
Parsers.h
PrismLauncher_PrismLauncher/launcher/minecraft/auth/Parsers.h
#pragma once #include "AccountData.h" namespace Parsers { bool getDateTime(QJsonValue value, QDateTime& out); bool getString(QJsonValue value, QString& out); bool getNumber(QJsonValue value, double& out); bool getNumber(QJsonValue value, int64_t& out); bool getBool(QJsonValue value, bool& out); bool parseXTokenResponse(QByteArray& data, Token& output, QString name); bool parseMojangResponse(QByteArray& data, Token& output); bool parseMinecraftProfile(QByteArray& data, MinecraftProfile& output); bool parseMinecraftProfileMojang(QByteArray& data, MinecraftProfile& output); bool parseMinecraftEntitlements(QByteArray& data, MinecraftEntitlement& output); bool parseRolloutResponse(QByteArray& data, bool& result); } // namespace Parsers
746
C++
.h
15
48.466667
80
0.826685
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,637
AccountData.h
PrismLauncher_PrismLauncher/launcher/minecraft/auth/AccountData.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * 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. */ #pragma once #include <QByteArray> #include <QJsonObject> #include <QString> #include <QVector> #include <QDateTime> #include <QMap> #include <QString> #include <QVariantMap> enum class Validity { None, Assumed, Certain }; struct Token { QDateTime issueInstant; QDateTime notAfter; QString token; QString refresh_token; QVariantMap extra; Validity validity = Validity::None; bool persistent = true; }; struct Skin { QString id; QString url; QString variant; QByteArray data; }; struct Cape { QString id; QString url; QString alias; QByteArray data; }; struct MinecraftEntitlement { bool ownsMinecraft = false; bool canPlayMinecraft = false; Validity validity = Validity::None; }; struct MinecraftProfile { QString id; QString name; Skin skin; QString currentCape; QMap<QString, Cape> capes; Validity validity = Validity::None; }; enum class AccountType { MSA, Offline }; enum class AccountState { Unchecked, Offline, Working, Online, Disabled, Errored, Expired, Gone }; struct AccountData { QJsonObject saveState() const; bool resumeStateFromV3(QJsonObject data); //! userName for Mojang accounts, gamertag for MSA QString accountDisplayString() const; //! Yggdrasil access token, as passed to the game. QString accessToken() const; QString profileId() const; QString profileName() const; QString lastError() const; AccountType type = AccountType::MSA; QString msaClientID; Token msaToken; Token userToken; Token xboxApiToken; Token mojangservicesToken; Token yggdrasilToken; MinecraftProfile minecraftProfile; MinecraftEntitlement minecraftEntitlement; Validity validity_ = Validity::None; // runtime only information (not saved with the account) QString internalId; QString errorString; AccountState accountState = AccountState::Unchecked; };
3,448
C++
.h
105
29.533333
98
0.736224
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,638
XboxUserStep.h
PrismLauncher_PrismLauncher/launcher/minecraft/auth/steps/XboxUserStep.h
#pragma once #include <QObject> #include <memory> #include "minecraft/auth/AuthStep.h" #include "net/NetJob.h" #include "net/Upload.h" class XboxUserStep : public AuthStep { Q_OBJECT public: explicit XboxUserStep(AccountData* data); virtual ~XboxUserStep() noexcept = default; void perform() override; QString describe() override; private slots: void onRequestDone(); private: std::shared_ptr<QByteArray> m_response; Net::Upload::Ptr m_request; NetJob::Ptr m_task; };
520
C++
.h
20
22.4
47
0.72211
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,639
EntitlementsStep.h
PrismLauncher_PrismLauncher/launcher/minecraft/auth/steps/EntitlementsStep.h
#pragma once #include <QObject> #include <memory> #include "minecraft/auth/AuthStep.h" #include "net/Download.h" #include "net/NetJob.h" class EntitlementsStep : public AuthStep { Q_OBJECT public: explicit EntitlementsStep(AccountData* data); virtual ~EntitlementsStep() noexcept = default; void perform() override; QString describe() override; private slots: void onRequestDone(); private: QString m_entitlements_request_id; std::shared_ptr<QByteArray> m_response; Net::Download::Ptr m_request; NetJob::Ptr m_task; };
575
C++
.h
21
23.714286
51
0.73309
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,640
XboxProfileStep.h
PrismLauncher_PrismLauncher/launcher/minecraft/auth/steps/XboxProfileStep.h
#pragma once #include <QObject> #include <memory> #include "minecraft/auth/AuthStep.h" #include "net/Download.h" #include "net/NetJob.h" class XboxProfileStep : public AuthStep { Q_OBJECT public: explicit XboxProfileStep(AccountData* data); virtual ~XboxProfileStep() noexcept = default; void perform() override; QString describe() override; private slots: void onRequestDone(); private: std::shared_ptr<QByteArray> m_response; Net::Download::Ptr m_request; NetJob::Ptr m_task; };
533
C++
.h
20
23.05
50
0.729249
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,641
MSAStep.h
PrismLauncher_PrismLauncher/launcher/minecraft/auth/steps/MSAStep.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * 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. */ #pragma once #include <QObject> #include "minecraft/auth/AuthStep.h" #include <QtNetworkAuth/qoauth2authorizationcodeflow.h> class MSAStep : public AuthStep { Q_OBJECT public: explicit MSAStep(AccountData* data, bool silent = false); virtual ~MSAStep() noexcept = default; void perform() override; QString describe() override; signals: void authorizeWithBrowser(const QUrl& url); private: bool m_silent; QString m_clientId; QOAuth2AuthorizationCodeFlow oauth2; };
2,009
C++
.h
52
36.019231
80
0.736923
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,642
LauncherLoginStep.h
PrismLauncher_PrismLauncher/launcher/minecraft/auth/steps/LauncherLoginStep.h
#pragma once #include <QObject> #include <memory> #include "minecraft/auth/AuthStep.h" #include "net/NetJob.h" #include "net/Upload.h" class LauncherLoginStep : public AuthStep { Q_OBJECT public: explicit LauncherLoginStep(AccountData* data); virtual ~LauncherLoginStep() noexcept = default; void perform() override; QString describe() override; private slots: void onRequestDone(); private: std::shared_ptr<QByteArray> m_response; Net::Upload::Ptr m_request; NetJob::Ptr m_task; };
535
C++
.h
20
23.15
52
0.730315
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,643
MinecraftProfileStep.h
PrismLauncher_PrismLauncher/launcher/minecraft/auth/steps/MinecraftProfileStep.h
#pragma once #include <QObject> #include <memory> #include "minecraft/auth/AuthStep.h" #include "net/Download.h" #include "net/NetJob.h" class MinecraftProfileStep : public AuthStep { Q_OBJECT public: explicit MinecraftProfileStep(AccountData* data); virtual ~MinecraftProfileStep() noexcept = default; void perform() override; QString describe() override; private slots: void onRequestDone(); private: std::shared_ptr<QByteArray> m_response; Net::Download::Ptr m_request; NetJob::Ptr m_task; };
548
C++
.h
20
23.8
55
0.737044
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,644
GetSkinStep.h
PrismLauncher_PrismLauncher/launcher/minecraft/auth/steps/GetSkinStep.h
#pragma once #include <QObject> #include <memory> #include "minecraft/auth/AuthStep.h" #include "net/Download.h" #include "net/NetJob.h" class GetSkinStep : public AuthStep { Q_OBJECT public: explicit GetSkinStep(AccountData* data); virtual ~GetSkinStep() noexcept = default; void perform() override; QString describe() override; private slots: void onRequestDone(); private: std::shared_ptr<QByteArray> m_response; Net::Download::Ptr m_request; NetJob::Ptr m_task; };
521
C++
.h
20
22.45
46
0.722672
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,645
MSADeviceCodeStep.h
PrismLauncher_PrismLauncher/launcher/minecraft/auth/steps/MSADeviceCodeStep.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * Copyright (c) 2024 Trial97 <alexandru.tripon97@gmail.com> * * 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. */ #pragma once #include <QObject> #include <QTimer> #include "minecraft/auth/AuthStep.h" #include "net/NetJob.h" #include "net/Upload.h" class MSADeviceCodeStep : public AuthStep { Q_OBJECT public: explicit MSADeviceCodeStep(AccountData* data); virtual ~MSADeviceCodeStep() noexcept = default; void perform() override; QString describe() override; public slots: void abort() override; signals: void authorizeWithBrowser(QString url, QString code, int expiresIn); private slots: void deviceAuthorizationFinished(); void startPoolTimer(); void authenticateUser(); void authenticationFinished(); private: QString m_clientId; QString m_device_code; bool m_is_aborted = false; int interval = 5; QTimer m_pool_timer; QTimer m_expiration_timer; std::shared_ptr<QByteArray> m_response; Net::Upload::Ptr m_request; NetJob::Ptr m_task; };
2,428
C++
.h
67
33.179104
80
0.729787
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,646
XboxAuthorizationStep.h
PrismLauncher_PrismLauncher/launcher/minecraft/auth/steps/XboxAuthorizationStep.h
#pragma once #include <QObject> #include <memory> #include "minecraft/auth/AuthStep.h" #include "net/NetJob.h" #include "net/Upload.h" class XboxAuthorizationStep : public AuthStep { Q_OBJECT public: explicit XboxAuthorizationStep(AccountData* data, Token* token, QString relyingParty, QString authorizationKind); virtual ~XboxAuthorizationStep() noexcept = default; void perform() override; QString describe() override; private: bool processSTSError(); private slots: void onRequestDone(); private: Token* m_token; QString m_relyingParty; QString m_authorizationKind; std::shared_ptr<QByteArray> m_response; Net::Upload::Ptr m_request; NetJob::Ptr m_task; };
733
C++
.h
25
25.4
117
0.741059
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,647
AssetUpdateTask.h
PrismLauncher_PrismLauncher/launcher/minecraft/update/AssetUpdateTask.h
#pragma once #include "net/NetJob.h" #include "tasks/Task.h" class MinecraftInstance; class AssetUpdateTask : public Task { Q_OBJECT public: AssetUpdateTask(MinecraftInstance* inst); virtual ~AssetUpdateTask() = default; void executeTask() override; bool canAbort() const override; private slots: void assetIndexFinished(); void assetIndexFailed(QString reason); void assetsFailed(QString reason); public slots: bool abort() override; private: MinecraftInstance* m_inst; NetJob::Ptr downloadJob; };
561
C++
.h
21
22.761905
45
0.7397
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,648
FMLLibrariesTask.h
PrismLauncher_PrismLauncher/launcher/minecraft/update/FMLLibrariesTask.h
#pragma once #include "minecraft/VersionFilterData.h" #include "net/NetJob.h" #include "tasks/Task.h" class MinecraftInstance; class FMLLibrariesTask : public Task { Q_OBJECT public: FMLLibrariesTask(MinecraftInstance* inst); virtual ~FMLLibrariesTask() = default; void executeTask() override; bool canAbort() const override; private slots: void fmllibsFinished(); void fmllibsFailed(QString reason); public slots: bool abort() override; private: MinecraftInstance* m_inst; NetJob::Ptr downloadJob; QList<FMLlib> fmlLibsToProcess; };
597
C++
.h
22
23.272727
46
0.746479
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,649
FoldersTask.h
PrismLauncher_PrismLauncher/launcher/minecraft/update/FoldersTask.h
#pragma once #include "tasks/Task.h" class MinecraftInstance; class FoldersTask : public Task { Q_OBJECT public: FoldersTask(MinecraftInstance* inst); virtual ~FoldersTask() = default; void executeTask() override; private: MinecraftInstance* m_inst; };
283
C++
.h
12
20.083333
41
0.737828
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,650
LibrariesTask.h
PrismLauncher_PrismLauncher/launcher/minecraft/update/LibrariesTask.h
#pragma once #include "net/NetJob.h" #include "tasks/Task.h" class MinecraftInstance; class LibrariesTask : public Task { Q_OBJECT public: LibrariesTask(MinecraftInstance* inst); virtual ~LibrariesTask() = default; void executeTask() override; bool canAbort() const override; private slots: void jarlibFailed(QString reason); public slots: bool abort() override; private: MinecraftInstance* m_inst; NetJob::Ptr downloadJob; };
481
C++
.h
19
21.473684
43
0.732456
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,651
CreateGameFolders.h
PrismLauncher_PrismLauncher/launcher/minecraft/launch/CreateGameFolders.h
/* 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. */ #pragma once #include <LoggedProcess.h> #include <launch/LaunchStep.h> #include <minecraft/auth/AuthSession.h> // Create the main .minecraft for the instance and any other necessary folders class CreateGameFolders : public LaunchStep { Q_OBJECT public: explicit CreateGameFolders(LaunchTask* parent); virtual ~CreateGameFolders() {}; virtual void executeTask(); virtual bool canAbort() const { return false; } };
1,046
C++
.h
27
36.259259
78
0.763547
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,652
ClaimAccount.h
PrismLauncher_PrismLauncher/launcher/minecraft/launch/ClaimAccount.h
/* 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. */ #pragma once #include <launch/LaunchStep.h> #include <minecraft/auth/MinecraftAccount.h> class ClaimAccount : public LaunchStep { Q_OBJECT public: explicit ClaimAccount(LaunchTask* parent, AuthSessionPtr session); virtual ~ClaimAccount() = default; void executeTask() override; void finalize() override; bool canAbort() const override { return false; } private: std::unique_ptr<UseLock> lock; MinecraftAccountPtr m_account; };
1,076
C++
.h
29
34.172414
75
0.756238
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,653
ScanModFolders.h
PrismLauncher_PrismLauncher/launcher/minecraft/launch/ScanModFolders.h
/* 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. */ #pragma once #include <launch/LaunchStep.h> #include <memory> class ScanModFolders : public LaunchStep { Q_OBJECT public: explicit ScanModFolders(LaunchTask* parent) : LaunchStep(parent) {}; virtual ~ScanModFolders() {}; virtual void executeTask() override; virtual bool canAbort() const override { return false; } private slots: void coreModsDone(); void modsDone(); void nilModsDone(); private: void checkDone(); private: // DATA bool m_modsDone = false; bool m_nilModsDone = false; bool m_coreModsDone = false; };
1,190
C++
.h
35
30.742857
75
0.732811
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,654
ModMinecraftJar.h
PrismLauncher_PrismLauncher/launcher/minecraft/launch/ModMinecraftJar.h
/* 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. */ #pragma once #include <launch/LaunchStep.h> #include <memory> class ModMinecraftJar : public LaunchStep { Q_OBJECT public: explicit ModMinecraftJar(LaunchTask* parent) : LaunchStep(parent) {}; virtual ~ModMinecraftJar() {}; virtual void executeTask() override; virtual bool canAbort() const override { return false; } void finalize() override; private: bool removeJar(); };
1,019
C++
.h
28
33.535714
75
0.748479
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,655
ExtractNatives.h
PrismLauncher_PrismLauncher/launcher/minecraft/launch/ExtractNatives.h
/* 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. */ #pragma once #include <launch/LaunchStep.h> // FIXME: temporary wrapper for existing task. class ExtractNatives : public LaunchStep { Q_OBJECT public: explicit ExtractNatives(LaunchTask* parent) : LaunchStep(parent) {}; virtual ~ExtractNatives() {}; void executeTask() override; bool canAbort() const override { return false; } void finalize() override; };
994
C++
.h
26
35.538462
75
0.751037
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,656
VerifyJavaInstall.h
PrismLauncher_PrismLauncher/launcher/minecraft/launch/VerifyJavaInstall.h
// SPDX-License-Identifier: GPL-3.0-only /* * Prism Launcher - Minecraft Launcher * 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. */ #pragma once #include <launch/LaunchStep.h> #include <launch/LaunchTask.h> class VerifyJavaInstall : public LaunchStep { Q_OBJECT public: explicit VerifyJavaInstall(LaunchTask* parent) : LaunchStep(parent) {}; ~VerifyJavaInstall() override = default; void executeTask() override; bool canAbort() const override { return false; } };
1,853
C++
.h
45
38.844444
80
0.735441
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
29,657
ReconstructAssets.h
PrismLauncher_PrismLauncher/launcher/minecraft/launch/ReconstructAssets.h
/* 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. */ #pragma once #include <launch/LaunchStep.h> #include <memory> class ReconstructAssets : public LaunchStep { Q_OBJECT public: explicit ReconstructAssets(LaunchTask* parent) : LaunchStep(parent) {}; virtual ~ReconstructAssets() {}; void executeTask() override; bool canAbort() const override { return false; } };
944
C++
.h
25
35.16
75
0.754098
PrismLauncher/PrismLauncher
5,558
625
571
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false