blob: 9fa4e6a165106c4afd6d2459cdaad8f357382905 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
#include "FTBProfileStrategy.h"
#include "OneSixFTBInstance.h"
#include <FileSystem.h>
#include <QDir>
#include <QUuid>
#include <QJsonDocument>
#include <QJsonArray>
FTBProfileStrategy::FTBProfileStrategy(OneSixFTBInstance* instance) : OneSixProfileStrategy(instance)
{
}
void FTBProfileStrategy::loadDefaultBuiltinPatches()
{
// FIXME: this should be here, but it needs us to be able to deal with multiple libraries paths
// OneSixProfileStrategy::loadDefaultBuiltinPatches();
auto mcVersion = m_instance->intendedVersionId();
auto nativeInstance = dynamic_cast<OneSixFTBInstance *>(m_instance);
ProfilePatchPtr minecraftPatch;
{
std::shared_ptr< VersionFile > file;
auto mcJson = m_instance->versionsPath().absoluteFilePath(mcVersion + "/" + mcVersion + ".json");
// load up the base minecraft patch
if(QFile::exists(mcJson))
{
file = ProfileUtils::parseJsonFile(QFileInfo(mcJson), false);
for(auto addLib: file->libraries)
{
addLib->setHint("local");
addLib->setStoragePrefix(nativeInstance->librariesPath().absolutePath());
}
}
else
{
file = std::make_shared<VersionFile>();
file->addProblem(ProblemSeverity::Error, QObject::tr("Minecraft version is missing in the FTB data."));
}
file->uid = "net.minecraft";
file->name = QObject::tr("Minecraft (tracked)");
if(file->version.isEmpty())
{
file->version = mcVersion;
}
minecraftPatch = std::make_shared<ProfilePatch>(file);
minecraftPatch->setVanilla(true);
minecraftPatch->setOrder(-2);
}
profile->appendPatch(minecraftPatch);
ProfilePatchPtr packPatch;
{
std::shared_ptr< VersionFile > file;
auto mcJson = m_instance->minecraftRoot() + "/pack.json";
// load up the base minecraft patch, if it's there...
if(QFile::exists(mcJson))
{
file = ProfileUtils::parseJsonFile(QFileInfo(mcJson), false);
// adapt the loaded file - the FTB patch file format is different than ours.
file->minecraftVersion.clear();
file->mainJar = nullptr;
for(auto addLib: file->libraries)
{
addLib->setHint("local");
addLib->setStoragePrefix(nativeInstance->librariesPath().absolutePath());
}
}
else
{
file = std::make_shared<VersionFile>();
file->addProblem(ProblemSeverity::Error, QObject::tr("Modpack version file is missing."));
}
file->uid = "org.multimc.ftb.pack";
file->name = QObject::tr("%1 (FTB pack)").arg(m_instance->name());
if(file->version.isEmpty())
{
file->version = QObject::tr("Unknown");
QFile versionFile (FS::PathCombine(m_instance->instanceRoot(), "version"));
if(versionFile.exists())
{
if(versionFile.open(QIODevice::ReadOnly))
{
// FIXME: just guessing the encoding/charset here.
auto version = QString::fromUtf8(versionFile.readAll());
file->version = version;
}
}
}
packPatch = std::make_shared<ProfilePatch>(file);
packPatch->setVanilla(true);
packPatch->setOrder(1);
}
profile->appendPatch(packPatch);
}
void FTBProfileStrategy::load()
{
profile->clearPatches();
loadDefaultBuiltinPatches();
loadUserPatches();
}
bool FTBProfileStrategy::saveOrder(ProfileUtils::PatchOrder order)
{
return false;
}
bool FTBProfileStrategy::resetOrder()
{
return false;
}
bool FTBProfileStrategy::installJarMods(QStringList filepaths)
{
return false;
}
bool FTBProfileStrategy::customizePatch(ProfilePatchPtr patch)
{
return false;
}
bool FTBProfileStrategy::revertPatch(ProfilePatchPtr patch)
{
return false;
}
|