mirror of
https://github.com/UltimMC/Launcher.git
synced 2025-10-04 09:08:42 +00:00
HACK bare minimum to make forge 1.13 load
Probably introduces 100 bugs and 200 corner cases. \o/
This commit is contained in:
@@ -991,7 +991,7 @@ bool ComponentList::removeComponent_internal(ComponentPtr patch)
|
|||||||
// FIXME: we need a generic way of removing local resources, not just jar mods...
|
// FIXME: we need a generic way of removing local resources, not just jar mods...
|
||||||
auto preRemoveJarMod = [&](LibraryPtr jarMod) -> bool
|
auto preRemoveJarMod = [&](LibraryPtr jarMod) -> bool
|
||||||
{
|
{
|
||||||
if (!jarMod->isLocal())
|
if (!jarMod->isInstanceLocal())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -117,7 +117,7 @@ struct GradleSpecifier
|
|||||||
}
|
}
|
||||||
bool matchName(const GradleSpecifier & other) const
|
bool matchName(const GradleSpecifier & other) const
|
||||||
{
|
{
|
||||||
return other.artifactId() == artifactId() && other.groupId() == groupId();
|
return other.artifactId() == artifactId() && other.groupId() == groupId() && other.classifier() == classifier();
|
||||||
}
|
}
|
||||||
bool operator==(const GradleSpecifier & other) const
|
bool operator==(const GradleSpecifier & other) const
|
||||||
{
|
{
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
void Library::getApplicableFiles(OpSys system, QStringList& jar, QStringList& native, QStringList& native32,
|
void Library::getApplicableFiles(OpSys system, QStringList& jar, QStringList& native, QStringList& native32,
|
||||||
QStringList& native64, const QString &overridePath) const
|
QStringList& native64, const QString &overridePath) const
|
||||||
{
|
{
|
||||||
bool local = isLocal();
|
bool local = isInstanceLocal();
|
||||||
auto actualPath = [&](QString relPath)
|
auto actualPath = [&](QString relPath)
|
||||||
{
|
{
|
||||||
QFileInfo out(FS::PathCombine(storagePrefix(), relPath));
|
QFileInfo out(FS::PathCombine(storagePrefix(), relPath));
|
||||||
@@ -39,7 +39,7 @@ void Library::getApplicableFiles(OpSys system, QStringList& jar, QStringList& na
|
|||||||
native += actualPath(raw_storage);
|
native += actualPath(raw_storage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (!presenceOnly)
|
||||||
{
|
{
|
||||||
jar += actualPath(raw_storage);
|
jar += actualPath(raw_storage);
|
||||||
}
|
}
|
||||||
@@ -54,9 +54,10 @@ QList< std::shared_ptr< NetAction > > Library::getDownloads(
|
|||||||
{
|
{
|
||||||
QList<NetActionPtr> out;
|
QList<NetActionPtr> out;
|
||||||
bool stale = isAlwaysStale();
|
bool stale = isAlwaysStale();
|
||||||
bool local = isLocal();
|
bool instanceLocal = isInstanceLocal();
|
||||||
|
bool launcherLocal = isLocalBuilt();
|
||||||
|
|
||||||
auto check_local_file = [&](QString storage)
|
auto check_instance_local_file = [&](QString storage)
|
||||||
{
|
{
|
||||||
QFileInfo fileinfo(storage);
|
QFileInfo fileinfo(storage);
|
||||||
QString fileName = fileinfo.fileName();
|
QString fileName = fileinfo.fileName();
|
||||||
@@ -70,11 +71,26 @@ QList< std::shared_ptr< NetAction > > Library::getDownloads(
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
auto check_launcher_local_file = [&](QString storage)
|
||||||
|
{
|
||||||
|
QFileInfo localFileInfo("libraries/" + storage);
|
||||||
|
if(!localFileInfo.exists())
|
||||||
|
{
|
||||||
|
failedLocalFiles.append(localFileInfo.filePath());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
auto add_download = [&](QString storage, QString url, QString sha1)
|
auto add_download = [&](QString storage, QString url, QString sha1)
|
||||||
{
|
{
|
||||||
if(local)
|
if(instanceLocal)
|
||||||
{
|
{
|
||||||
return check_local_file(storage);
|
return check_instance_local_file(storage);
|
||||||
|
}
|
||||||
|
else if(launcherLocal)
|
||||||
|
{
|
||||||
|
return check_launcher_local_file(storage);
|
||||||
}
|
}
|
||||||
auto entry = cache->resolveEntry("libraries", storage);
|
auto entry = cache->resolveEntry("libraries", storage);
|
||||||
if(stale)
|
if(stale)
|
||||||
@@ -233,11 +249,16 @@ bool Library::isActive() const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Library::isLocal() const
|
bool Library::isInstanceLocal() const
|
||||||
{
|
{
|
||||||
return m_hint == "local";
|
return m_hint == "local";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Library::isLocalBuilt() const
|
||||||
|
{
|
||||||
|
return localBuild;
|
||||||
|
}
|
||||||
|
|
||||||
bool Library::isAlwaysStale() const
|
bool Library::isAlwaysStale() const
|
||||||
{
|
{
|
||||||
return m_hint == "always-stale";
|
return m_hint == "always-stale";
|
||||||
|
@@ -49,6 +49,8 @@ public:
|
|||||||
newlib->m_storagePrefix = base->m_storagePrefix;
|
newlib->m_storagePrefix = base->m_storagePrefix;
|
||||||
newlib->m_mojangDownloads = base->m_mojangDownloads;
|
newlib->m_mojangDownloads = base->m_mojangDownloads;
|
||||||
newlib->m_filename = base->m_filename;
|
newlib->m_filename = base->m_filename;
|
||||||
|
newlib->presenceOnly = base->presenceOnly;
|
||||||
|
newlib->localBuild = base->localBuild;
|
||||||
return newlib;
|
return newlib;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,7 +148,15 @@ public: /* methods */
|
|||||||
bool isActive() const;
|
bool isActive() const;
|
||||||
|
|
||||||
/// Returns true if the library is contained in an instance and false if it is shared
|
/// Returns true if the library is contained in an instance and false if it is shared
|
||||||
bool isLocal() const;
|
bool isInstanceLocal() const;
|
||||||
|
|
||||||
|
/// Returns true if the library cannot be downloaded (was built locally somehow)
|
||||||
|
bool isLocalBuilt() const;
|
||||||
|
|
||||||
|
bool isLocal() const
|
||||||
|
{
|
||||||
|
return isInstanceLocal() || isLocalBuilt();
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns true if the library is to always be checked for updates
|
/// Returns true if the library is to always be checked for updates
|
||||||
bool isAlwaysStale() const;
|
bool isAlwaysStale() const;
|
||||||
@@ -212,6 +222,12 @@ protected: /* data */
|
|||||||
/// true if the library had a rules section (even empty)
|
/// true if the library had a rules section (even empty)
|
||||||
bool applyRules = false;
|
bool applyRules = false;
|
||||||
|
|
||||||
|
// MultiMC-specific: the artifact must be present, but is not part of the classpath
|
||||||
|
bool presenceOnly = false;
|
||||||
|
|
||||||
|
// MultiMC-specific: the artifact must be present, but cannot be downloaded, because it was created by some other mechanism
|
||||||
|
bool localBuild = false;
|
||||||
|
|
||||||
/// rules associated with the library
|
/// rules associated with the library
|
||||||
QList<std::shared_ptr<Rule>> m_rules;
|
QList<std::shared_ptr<Rule>> m_rules;
|
||||||
|
|
||||||
|
@@ -36,7 +36,7 @@ struct MojangLibraryDownloadInfo
|
|||||||
{
|
{
|
||||||
return artifact.get();
|
return artifact.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
return classifiers[classifier].get();
|
return classifiers[classifier].get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@ static void readDownloadInfo(MojangDownloadInfo::Ptr out, const QJsonObject &obj
|
|||||||
readString(obj, "path", out->path);
|
readString(obj, "path", out->path);
|
||||||
// required!
|
// required!
|
||||||
out->sha1 = requireString(obj, "sha1");
|
out->sha1 = requireString(obj, "sha1");
|
||||||
out->url = requireString(obj, "url");
|
out->url = ensureString(obj, "url", QString());
|
||||||
out->size = requireInteger(obj, "size");
|
out->size = requireInteger(obj, "size");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -21,6 +21,14 @@ LibraryPtr OneSixVersionFormat::libraryFromJson(const QJsonObject &libObj, const
|
|||||||
readString(libObj, "MMC-absoluteUrl", out->m_absoluteURL);
|
readString(libObj, "MMC-absoluteUrl", out->m_absoluteURL);
|
||||||
readString(libObj, "MMC-filename", out->m_filename);
|
readString(libObj, "MMC-filename", out->m_filename);
|
||||||
readString(libObj, "MMC-displayname", out->m_displayname);
|
readString(libObj, "MMC-displayname", out->m_displayname);
|
||||||
|
if (libObj.contains("presenceOnly"))
|
||||||
|
{
|
||||||
|
out->presenceOnly = requireBoolean(libObj, "presenceOnly");
|
||||||
|
}
|
||||||
|
if (libObj.contains("localBuild"))
|
||||||
|
{
|
||||||
|
out->localBuild = requireBoolean(libObj, "localBuild");
|
||||||
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,6 +43,10 @@ QJsonObject OneSixVersionFormat::libraryToJson(Library *library)
|
|||||||
libRoot.insert("MMC-filename", library->m_filename);
|
libRoot.insert("MMC-filename", library->m_filename);
|
||||||
if (library->m_displayname.size())
|
if (library->m_displayname.size())
|
||||||
libRoot.insert("MMC-displayname", library->m_displayname);
|
libRoot.insert("MMC-displayname", library->m_displayname);
|
||||||
|
if (library->presenceOnly)
|
||||||
|
libRoot.insert("presenceOnly", true);
|
||||||
|
if (library->localBuild)
|
||||||
|
libRoot.insert("localBuild", true);
|
||||||
return libRoot;
|
return libRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user