summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-03-13 00:23:45 +0100
committerPetr Mrázek <peterix@gmail.com>2016-03-26 17:05:27 +0100
commit02c1df2c3c260fe625b9c3314e9eed2885a97456 (patch)
tree1ca64f44fc609ba47a6a1fde4b9e93fe15b1e618
parent1854e05e1bb14d8f2bbc4676f44024a83e972f6f (diff)
downloadMultiMC-02c1df2c3c260fe625b9c3314e9eed2885a97456.tar
MultiMC-02c1df2c3c260fe625b9c3314e9eed2885a97456.tar.gz
MultiMC-02c1df2c3c260fe625b9c3314e9eed2885a97456.tar.lz
MultiMC-02c1df2c3c260fe625b9c3314e9eed2885a97456.tar.xz
MultiMC-02c1df2c3c260fe625b9c3314e9eed2885a97456.zip
NOISSUE continue version file format refactors
-rw-r--r--CMakeLists.txt12
-rw-r--r--application/pages/ModFolderPage.cpp13
-rw-r--r--application/pages/VersionPage.cpp9
-rw-r--r--application/resources/versions/minecraft.json81
-rw-r--r--logic/CMakeLists.txt1
-rw-r--r--logic/minecraft/Library.h2
-rw-r--r--logic/minecraft/MinecraftProfile.cpp228
-rw-r--r--logic/minecraft/MinecraftProfile.h66
-rw-r--r--logic/minecraft/MinecraftVersion.cpp67
-rw-r--r--logic/minecraft/MinecraftVersion.h20
-rw-r--r--logic/minecraft/MinecraftVersionList.cpp3
-rw-r--r--logic/minecraft/MojangVersionFormat.cpp9
-rw-r--r--logic/minecraft/ProfilePatch.h20
-rw-r--r--logic/minecraft/ProfileUtils.cpp1
-rw-r--r--logic/minecraft/VersionFile.cpp126
-rw-r--r--logic/minecraft/VersionFile.h39
-rw-r--r--logic/minecraft/VersionSource.h9
-rw-r--r--logic/minecraft/forge/ForgeInstaller.cpp38
-rw-r--r--logic/minecraft/ftb/FTBProfileStrategy.cpp5
-rw-r--r--logic/minecraft/onesix/OneSixInstance.cpp44
-rw-r--r--logic/minecraft/onesix/OneSixProfileStrategy.cpp8
-rw-r--r--logic/minecraft/onesix/OneSixUpdate.cpp11
-rw-r--r--logic/minecraft/onesix/OneSixVersionFormat.cpp97
23 files changed, 421 insertions, 488 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9cd3cf47..0456a293 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,13 +24,13 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/")
set(MMC_SRC "${PROJECT_SOURCE_DIR}")
set(MMC_BIN "${PROJECT_BINARY_DIR}")
-# Output all executables and shared libs in the main build folder, not in subfolders.
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
-if(UNIX)
- set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
-endif()
+# # Output all executables and shared libs in the main build folder, not in subfolders.
+# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
+# if(UNIX)
+# set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
+# endif()
-set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${PROJECT_BINARY_DIR}/jars)
+set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${PROJECT_BINARY_DIR}/application/jars)
######## Set compiler flags ########
set(CMAKE_CXX_STANDARD_REQUIRED true)
diff --git a/application/pages/ModFolderPage.cpp b/application/pages/ModFolderPage.cpp
index bbe16671..cef4ed73 100644
--- a/application/pages/ModFolderPage.cpp
+++ b/application/pages/ModFolderPage.cpp
@@ -47,8 +47,7 @@ ModFolderPage::ModFolderPage(BaseInstance *inst, std::shared_ptr<ModList> mods,
ui->modTreeView->setModel(m_mods.get());
ui->modTreeView->installEventFilter(this);
auto smodel = ui->modTreeView->selectionModel();
- connect(smodel, SIGNAL(currentChanged(QModelIndex, QModelIndex)),
- SLOT(modCurrent(QModelIndex, QModelIndex)));
+ connect(smodel, &QItemSelectionModel::currentChanged, this, &ModFolderPage::modCurrent);
}
void ModFolderPage::opened()
@@ -91,7 +90,15 @@ bool CoreModFolderPage::shouldDisplay() const
auto version = inst->getMinecraftProfile();
if (!version)
return true;
- if (version->m_releaseTime < g_VersionFilterData.legacyCutoffDate)
+ if(!version->versionPatch("net.minecraftforge"))
+ {
+ return false;
+ }
+ if(!version->versionPatch("net.minecraft"))
+ {
+ return false;
+ }
+ if(version->versionPatch("net.minecraft")->getReleaseDateTime() < g_VersionFilterData.legacyCutoffDate)
{
return true;
}
diff --git a/application/pages/VersionPage.cpp b/application/pages/VersionPage.cpp
index 42e4a9bf..137abcfc 100644
--- a/application/pages/VersionPage.cpp
+++ b/application/pages/VersionPage.cpp
@@ -156,10 +156,10 @@ void VersionPage::packageCurrent(const QModelIndex &current, const QModelIndex &
switch(severity)
{
case PROBLEM_WARNING:
- ui->frame->setModText(tr("%1 possibly has issues.").arg(patch->getPatchName()));
+ ui->frame->setModText(tr("%1 possibly has issues.").arg(patch->getName()));
break;
case PROBLEM_ERROR:
- ui->frame->setModText(tr("%1 has issues!").arg(patch->getPatchName()));
+ ui->frame->setModText(tr("%1 has issues!").arg(patch->getName()));
break;
default:
case PROBLEM_NONE:
@@ -251,8 +251,7 @@ void VersionPage::on_modBtn_clicked()
void VersionPage::on_jarmodBtn_clicked()
{
bool nagShown = false;
- auto traits = m_version->traits;
- if (!traits.contains("legacyLaunch") && !traits.contains("alphaLaunch"))
+ if (!m_version->hasTrait("legacyLaunch") && !m_version->hasTrait("alphaLaunch"))
{
// not legacy launch... nag
auto seenNag = MMC->settings()->get("JarModNagSeen").toBool();
@@ -513,7 +512,7 @@ void VersionPage::on_editBtn_clicked()
{
return;
}
- auto filename = version->getPatchFilename();
+ auto filename = version->getFilename();
if(!QFileInfo::exists(filename))
{
qWarning() << "file" << filename << "can't be opened for editing, doesn't exist!";
diff --git a/application/resources/versions/minecraft.json b/application/resources/versions/minecraft.json
index 58b153c2..9c08a83f 100644
--- a/application/resources/versions/minecraft.json
+++ b/application/resources/versions/minecraft.json
@@ -5,7 +5,6 @@
"checksum": "6897c3287fb971c9f362eb3ab20f5ddd",
"releaseTime": "2013-04-25T17:45:00+02:00",
"type": "release",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -13,7 +12,6 @@
"checksum": "5c1219d869b87d233de3033688ec7567",
"releaseTime": "2013-03-20T12:00:00+02:00",
"type": "release",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -21,7 +19,6 @@
"checksum": "fd11cbc5b01aae1d62cff0145171f3d9",
"releaseTime": "2013-03-07T00:00:00+02:00",
"type": "snapshot",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -29,7 +26,6 @@
"checksum": "8e80fb01b321c6b3c7efca397a3eea35",
"releaseTime": "2012-12-28T00:00:00+02:00",
"type": "release",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -37,7 +33,6 @@
"checksum": "48677dc4c2b98c29918722b5ab27b4fd",
"releaseTime": "2012-12-20T00:00:00+02:00",
"type": "release",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -45,7 +40,6 @@
"checksum": "b15e2b2b6b4629f0d99a95b6b44412a0",
"releaseTime": "2012-11-20T00:00:00+02:00",
"type": "release",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -53,7 +47,6 @@
"checksum": "7aa46c8058cba2f38e9d2ddddcc77c72",
"releaseTime": "2012-11-14T00:00:00+02:00",
"type": "release",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -61,7 +54,6 @@
"checksum": "9cc3295931edb6339f22989fe1b612a6",
"releaseTime": "2012-11-01T00:00:00+02:00",
"type": "snapshot",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -69,7 +61,6 @@
"checksum": "771175c01778ea67395bc6919a5a9dc5",
"releaseTime": "2012-10-25T00:00:00+02:00",
"type": "release",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -77,7 +68,6 @@
"checksum": "542621a5298659dc65f383f35170fc4c",
"releaseTime": "2012-10-23T00:00:00+02:00",
"type": "snapshot",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -85,7 +75,6 @@
"checksum": "32a654388b54d3e4bb29c1a46e7d6a12",
"releaseTime": "2012-10-19T00:00:00+02:00",
"type": "snapshot",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -93,7 +82,6 @@
"checksum": "969699f13e5bbe7f12e40ac4f32b7d9a",
"releaseTime": "2012-08-16T00:00:00+02:00",
"type": "release",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -101,7 +89,6 @@
"checksum": "266ccbc9798afd2eadf3d6c01b4c562a",
"releaseTime": "2012-08-01T00:00:00+02:00",
"type": "release",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -109,7 +96,6 @@
"checksum": "a6effac1eaccf5d429aae340cf95ed5d",
"releaseTime": "2012-07-26T00:00:00+02:00",
"type": "snapshot",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -117,7 +103,6 @@
"checksum": "8e8778078a175a33603a585257f28563",
"releaseTime": "2012-03-30T00:00:00+02:00",
"type": "release",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -125,7 +110,6 @@
"checksum": "25423eab6d8707f96cc6ad8a21a7250a",
"releaseTime": "2012-03-22T00:00:00+02:00",
"type": "release",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -133,7 +117,6 @@
"checksum": "12f6c4b1bdcc63f029e3c088a364b8e4",
"releaseTime": "2012-03-02T00:00:00+02:00",
"type": "release",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -141,7 +124,6 @@
"checksum": "6189e96efaea11e5164b4a4755574324",
"releaseTime": "2012-03-01T00:00:01+02:00",
"type": "release",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -149,7 +131,6 @@
"checksum": "97067a603eba2b6eb75d3194f81f6bcd",
"releaseTime": "2012-03-01T00:00:00+02:00",
"type": "release",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -157,7 +138,6 @@
"checksum": "e92302d2acdba7c97e0d8df1e10d2006",
"releaseTime": "2012-01-12T00:00:00+02:00",
"type": "release",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -165,7 +145,6 @@
"checksum": "3820d222b95d0b8c520d9596a756a6e6",
"releaseTime": "2011-11-18T00:00:00+02:00",
"type": "release",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -173,7 +152,6 @@
"checksum": "f8c5a2ccd3bc996792bbe436d8cc08bc",
"releaseTime": "2011-09-19T00:00:00+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -181,7 +159,6 @@
"checksum": "a59a9fd4c726a573b0a2bdd10d857f59",
"releaseTime": "2011-09-15T00:00:00+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -189,7 +166,6 @@
"checksum": "eae3353fdaa7e10a59b4cb5b45bfa10d",
"releaseTime": "2011-07-08T00:00:00+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -197,7 +173,6 @@
"checksum": "dd9215ab1141170d4871f42bff4ab302",
"releaseTime": "2011-07-01T00:00:00+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -205,7 +180,6 @@
"checksum": "682419e9ed1a236c3067822d53cda1e4",
"releaseTime": "2011-06-30T00:00:00+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -213,7 +187,6 @@
"checksum": "ce80072464433cd5b05d505aa8ff29d1",
"releaseTime": "2011-05-31T00:00:00+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -221,7 +194,6 @@
"checksum": "2aba888864b32038c8d22ee5df71b7c8",
"releaseTime": "2011-05-28T00:00:00+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -229,7 +201,6 @@
"checksum": "5c4df6f120336f113180698613853dba",
"releaseTime": "2011-05-26T00:00:04+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -237,7 +208,6 @@
"checksum": "efc2becca965e4f8feb5b4210c6a4fd1",
"releaseTime": "2011-05-26T00:00:03+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -245,7 +215,6 @@
"checksum": "01330b1c930102a683a4dd8d792e632e",
"releaseTime": "2011-05-26T00:00:02+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -253,7 +222,6 @@
"checksum": "a7e82c441a57ef4068c533f4d777336a",
"releaseTime": "2011-05-26T00:00:01+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -261,7 +229,6 @@
"checksum": "d531e221227a65392259d3141893280d",
"releaseTime": "2011-05-26T00:00:00+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -269,7 +236,6 @@
"checksum": "d02fa9998e30693d8d989d5f88cf0040",
"releaseTime": "2011-04-20T00:00:00+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -277,7 +243,6 @@
"checksum": "24289130902822d73f8722b52bc07cdb",
"releaseTime": "2011-04-19T00:00:00+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -285,7 +250,6 @@
"checksum": "9379e54b581ba4ef3acc3e326e87db91",
"releaseTime": "2011-04-05T00:00:00+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -293,7 +257,6 @@
"checksum": "71e64b61175b371ed148b385f2d14ebf",
"releaseTime": "2011-03-31T00:00:00+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -301,7 +264,6 @@
"checksum": "4203826f35e1036f089919032c3d19d1",
"releaseTime": "2011-02-23T00:00:00+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -309,7 +271,6 @@
"checksum": "de2164df461d028229ed2e101181bbd4",
"releaseTime": "2011-02-22T00:00:00+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -317,7 +278,6 @@
"checksum": "1736c5ba4f63a981220c2a18a4120180",
"releaseTime": "2011-01-21T00:00:00+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -325,7 +285,6 @@
"checksum": "486d83ec00554b45ffa21af2faa0116a",
"releaseTime": "2011-01-14T00:00:00+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -333,7 +292,6 @@
"checksum": "6426223efe23c3931a4ef89685be3349",
"releaseTime": "2011-01-13T00:00:00+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -341,7 +299,6 @@
"checksum": "7d547e495a770c62054ef136add43034",
"releaseTime": "2010-12-22T00:00:01+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -349,7 +306,6 @@
"checksum": "1f9331f2bfca81b6ce2acdfc1f105837",
"releaseTime": "2010-12-22T00:00:00+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -357,7 +313,6 @@
"checksum": "d200c465b8c167cc8df6537531fc9a48",
"releaseTime": "2010-12-21T00:00:00+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -365,7 +320,6 @@
"checksum": "03bd20b870dbbd121de5dca98af4e1ce",
"releaseTime": "2010-12-20T00:00:01+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -373,7 +327,6 @@
"checksum": "5f8733dbbf09b4e7c874661a3c29c239",
"releaseTime": "2010-12-20T00:00:00+02:00",
"type": "old_beta",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -381,7 +334,6 @@
"checksum": "ddd5e39467f28d1ea1a03b4d9e790867",
"releaseTime": "2010-12-03T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -389,7 +341,6 @@
"checksum": "7d3a43037190970ff2e11153b5718b74",
"releaseTime": "2010-12-01T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -397,7 +348,6 @@
"checksum": "0a1cc8c668faa6dc93fc418e8b4b097a",
"releaseTime": "2010-11-30T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -405,7 +355,6 @@
"checksum": "b2c25a753c82a1cd228ce71469829dc1",
"releaseTime": "2010-11-26T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -413,7 +362,6 @@
"checksum": "3ad4808ef2ac3b65d10305315260da03",
"releaseTime": "2010-11-25T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -421,7 +369,6 @@
"checksum": "70cbab762b17c5b11fefea9b12564119",
"releaseTime": "2010-11-24T00:00:01+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -429,7 +376,6 @@
"checksum": "25f053114e34b915e675f82d58f08711",
"releaseTime": "2010-11-24T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -437,7 +383,6 @@
"checksum": "6250fb17f8898c4d970d6bd03c229177",
"releaseTime": "2010-11-10T00:00:01+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -445,7 +390,6 @@
"checksum": "0f9fe018b344fd9dd849005f9bdca803",
"releaseTime": "2010-11-10T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "texturepacks"]
},
{
@@ -453,7 +397,6 @@
"checksum": "0a496e44a7b4e2f493b5893d8e5845bd",
"releaseTime": "2010-11-05T00:00:01+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "no-texturepacks"]
},
{
@@ -461,7 +404,6 @@
"checksum": "0a496e44a7b4e2f493b5893d8e5845bd",
"releaseTime": "2010-11-05T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "no-texturepacks"]
},
{
@@ -469,7 +411,6 @@
"checksum": "f5bcb4d0c0e78bc220f164b89ae9bd60",
"releaseTime": "2010-11-04T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "no-texturepacks"]
},
{
@@ -477,7 +418,6 @@
"checksum": "b2e9333e967cb89488884c2e5c715d4f",
"releaseTime": "2010-10-31T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "no-texturepacks"]
},
{
@@ -485,7 +425,6 @@
"checksum": "44c384dae02390f700458b95d82c3e2a",
"releaseTime": "2010-10-30T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "no-texturepacks"]
},
{
@@ -493,7 +432,6 @@
"checksum": "94346e1b8f6ad0e4a284314f0e29207b",
"releaseTime": "2010-09-23T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "no-texturepacks"]
},
{
@@ -501,7 +439,6 @@
"checksum": "72ba1f834327805cb44164a42b331522",
"releaseTime": "2010-09-20T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "no-texturepacks"]
},
{
@@ -509,7 +446,6 @@
"checksum": "891fd93e04f5daaf35d73c58e45c01b1",
"releaseTime": "2010-09-13T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "no-texturepacks"]
},
{
@@ -517,7 +453,6 @@
"checksum": "16ed7dc58244772847991e504afcf02f",
"releaseTime": "2010-08-23T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "no-texturepacks"]
},
{
@@ -525,7 +460,6 @@
"checksum": "d89760b0871ef61a55c9f336c0439d58",
"releaseTime": "2010-08-20T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "no-texturepacks"]
},
{
@@ -533,7 +467,6 @@
"checksum": "6bbde02c13aed5766275f4398ede6aae",
"releaseTime": "2010-08-12T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "no-texturepacks"]
},
{
@@ -541,7 +474,6 @@
"checksum": "ade257d2080d56fa983763f9c701fa14",
"releaseTime": "2010-08-04T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "no-texturepacks"]
},
{
@@ -549,7 +481,6 @@
"checksum": "227d0c6fa896a231de6269a074c9a458",
"releaseTime": "2010-07-30T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "no-texturepacks"]
},
{
@@ -557,7 +488,6 @@
"checksum": "6f1b1dd157fa0df39760f5be3eab01b0",
"releaseTime": "2010-07-23T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"+traits": ["legacyLaunch", "no-texturepacks"]
},
{
@@ -565,7 +495,6 @@
"checksum": "ae5f606caa18222e7568819c910ee423",
"releaseTime": "2010-07-13T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"mainClass": "y",
"+traits": ["legacyLaunch", "no-texturepacks"]
},
@@ -574,7 +503,6 @@
"checksum": "13ce7935c3670e7494e26b2704bfa3e9",
"releaseTime": "2010-07-09T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"mainClass": "ax",
"+traits": ["legacyLaunch", "no-texturepacks"]
},
@@ -583,7 +511,6 @@
"checksum": "f5f5aa34760facc10486e906a7c60196",
"releaseTime": "2010-06-16T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"mainClass": "net.minecraft.client.d",
"appletClass": "net.minecraft.client.MinecraftApplet",
"+traits": ["legacyLaunch", "no-texturepacks"]
@@ -593,7 +520,6 @@
"checksum": "fcfd7f83a6b27503cf48202381a5adf2",
"releaseTime": "2009-12-22T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"mainClass": "com.mojang.minecraft.l",
"appletClass": "com.mojang.minecraft.MinecraftApplet",
"+traits": ["legacyLaunch", "no-texturepacks"]
@@ -603,7 +529,6 @@
"checksum": "a9527cb5aef198e0f53e235ebe13dc75",
"releaseTime": "2009-05-22T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"mainClass": "com.mojang.minecraft.c",
"appletClass": "com.mojang.minecraft.MinecraftApplet",
"+traits": ["legacyLaunch", "no-texturepacks"]
@@ -613,7 +538,6 @@
"checksum": "3617fbf5fbfd2b837ebf5ceb63584908",
"releaseTime": "2009-05-31T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"mainClass": "com.mojang.minecraft.Minecraft",
"appletClass": "com.mojang.minecraft.MinecraftApplet",
"+traits": ["legacyLaunch", "no-texturepacks"]
@@ -623,7 +547,6 @@
"checksum": "a6e03c2eaf74709facc0d2477648e999",
"releaseTime": "2009-05-17T00:00:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"mainClass": "com.mojang.minecraft.Minecraft",
"appletClass": "com.mojang.minecraft.MinecraftApplet",
"+traits": ["legacyLaunch", "no-texturepacks"]
@@ -633,7 +556,6 @@
"checksum": "80882b8936a5c8d91500838a6660b504",
"releaseTime": "2009-05-16T13:48:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"mainClass": "com.mojang.minecraft.RubyDung",
"+traits": ["no-texturepacks"]
},
@@ -642,7 +564,6 @@
"checksum": "24c5cc99a2a612697ed2f7d5d04242fe",
"releaseTime": "2009-05-16T00:52:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"mainClass": "com.mojang.rubydung.RubyDung",
"+traits": ["no-texturepacks"]
},
@@ -651,7 +572,6 @@
"checksum": "70e33a81c541b13a477e68c1207124eb",
"releaseTime": "2009-05-13T23:28:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"mainClass": "com.mojang.rubydung.RubyDung",
"+traits": ["no-texturepacks"]
},
@@ -660,7 +580,6 @@
"checksum": "99fdaea10c494b9c3c3254636b98b799",
"releaseTime": "2009-05-13T22:11:00+02:00",
"type": "old_alpha",
- "processArguments": "legacy",
"mainClass": "com.mojang.rubydung.RubyDung",
"+traits": ["no-texturepacks"]
}
diff --git a/logic/CMakeLists.txt b/logic/CMakeLists.txt
index 28c1b8fc..b8c36794 100644
--- a/logic/CMakeLists.txt
+++ b/logic/CMakeLists.txt
@@ -202,7 +202,6 @@ set(LOGIC_SOURCES
minecraft/VersionFile.cpp
minecraft/VersionFile.h
minecraft/ProfilePatch.h
- minecraft/VersionSource.h
minecraft/VersionFilterData.h
minecraft/VersionFilterData.cpp
minecraft/Mod.h
diff --git a/logic/minecraft/Library.h b/logic/minecraft/Library.h
index 891601be..35b5cb99 100644
--- a/logic/minecraft/Library.h
+++ b/logic/minecraft/Library.h
@@ -13,7 +13,7 @@
#include "GradleSpecifier.h"
#include "net/URLConstants.h"
-class MojangLibraryDownloadInfo;
+struct MojangLibraryDownloadInfo;
class Library;
typedef std::shared_ptr<Library> LibraryPtr;
diff --git a/logic/minecraft/MinecraftProfile.cpp b/logic/minecraft/MinecraftProfile.cpp
index 0cf8b548..7586c156 100644
--- a/logic/minecraft/MinecraftProfile.cpp
+++ b/logic/minecraft/MinecraftProfile.cpp
@@ -14,6 +14,7 @@
*/
#include <QFile>
+#include <Version.h>
#include <QDir>
#include <QJsonDocument>
#include <QJsonArray>
@@ -60,11 +61,8 @@ void MinecraftProfile::reload()
void MinecraftProfile::clear()
{
id.clear();
- m_updateTime = QDateTime();
- m_releaseTime = QDateTime();
type.clear();
assets.clear();
- processArguments.clear();
minecraftArguments.clear();
mainClass.clear();
appletClass.clear();
@@ -94,13 +92,13 @@ bool MinecraftProfile::remove(const int index)
auto patch = versionPatch(index);
if (!patch->isRemovable())
{
- qDebug() << "Patch" << patch->getPatchID() << "is non-removable";
+ qDebug() << "Patch" << patch->getID() << "is non-removable";
return false;
}
if(!m_strategy->removePatch(patch))
{
- qCritical() << "Patch" << patch->getPatchID() << "could not be removed";
+ qCritical() << "Patch" << patch->getID() << "could not be removed";
return false;
}
@@ -117,7 +115,7 @@ bool MinecraftProfile::remove(const QString id)
int i = 0;
for (auto patch : VersionPatches)
{
- if (patch->getPatchID() == id)
+ if (patch->getID() == id)
{
return remove(i);
}
@@ -131,12 +129,12 @@ bool MinecraftProfile::customize(int index)
auto patch = versionPatch(index);
if (!patch->isCustomizable())
{
- qDebug() << "Patch" << patch->getPatchID() << "is not customizable";
+ qDebug() << "Patch" << patch->getID() << "is not customizable";
return false;
}
if(!m_strategy->customizePatch(patch))
{
- qCritical() << "Patch" << patch->getPatchID() << "could not be customized";
+ qCritical() << "Patch" << patch->getID() << "could not be customized";
return false;
}
reapplySafe();
@@ -151,12 +149,12 @@ bool MinecraftProfile::revertToBase(int index)
auto patch = versionPatch(index);
if (!patch->isRevertible())
{
- qDebug() << "Patch" << patch->getPatchID() << "is not revertible";
+ qDebug() << "Patch" << patch->getID() << "is not revertible";
return false;
}
if(!m_strategy->revertPatch(patch))
{
- qCritical() << "Patch" << patch->getPatchID() << "could not be reverted";
+ qCritical() << "Patch" << patch->getID() << "could not be reverted";
return false;
}
reapplySafe();
@@ -172,14 +170,14 @@ QString MinecraftProfile::versionFileId(const int index) const
{
return QString();
}
- return VersionPatches.at(index)->getPatchID();
+ return VersionPatches.at(index)->getID();
}
ProfilePatchPtr MinecraftProfile::versionPatch(const QString &id)
{
for (auto file : VersionPatches)
{
- if (file->getPatchID() == id)
+ if (file->getID() == id)
{
return file;
}
@@ -216,9 +214,9 @@ bool MinecraftProfile::revertToVanilla()
}
if(it->isRevertible() || it->isRemovable())
{
- if(!remove(it->getPatchID()))
+ if(!remove(it->getID()))
{
- qWarning() << "Couldn't remove" << it->getPatchID() << "from profile!";
+ qWarning() << "Couldn't remove" << it->getID() << "from profile!";
reapplySafe();
saveCurrentOrder();
return false;
@@ -230,7 +228,7 @@ bool MinecraftProfile::revertToVanilla()
return true;
}
-QList<std::shared_ptr<Library> > MinecraftProfile::getActiveNormalLibs()
+QList<std::shared_ptr<Library> > MinecraftProfile::getActiveNormalLibs() const
{
QList<std::shared_ptr<Library> > output;
for (auto lib : libraries)
@@ -251,7 +249,7 @@ QList<std::shared_ptr<Library> > MinecraftProfile::getActiveNormalLibs()
return output;
}
-QList<std::shared_ptr<Library> > MinecraftProfile::getActiveNativeLibs()
+QList<std::shared_ptr<Library> > MinecraftProfile::getActiveNativeLibs() const
{
QList<std::shared_ptr<Library> > output;
for (auto lib : libraries)
@@ -282,16 +280,16 @@ QVariant MinecraftProfile::data(const QModelIndex &index, int role) const
switch (column)
{
case 0:
- return VersionPatches.at(row)->getPatchName();
+ return VersionPatches.at(row)->getName();
case 1:
{
if(patch->isCustom())
{
- return QString("%1 (Custom)").arg(patch->getPatchVersion());
+ return QString("%1 (Custom)").arg(patch->getVersion());
}
else
{
- return patch->getPatchVersion();
+ return patch->getVersion();
}
}
default:
@@ -366,7 +364,7 @@ void MinecraftProfile::saveCurrentOrder() const
{
if(!item->isMoveable())
continue;
- order.append(item->getPatchID());
+ order.append(item->getID());
}
m_strategy->saveOrder(order);
}
@@ -419,7 +417,6 @@ void MinecraftProfile::reapply()
{
file->applyTo(this);
}
- finalize();
}
bool MinecraftProfile::reapplySafe()
@@ -437,41 +434,186 @@ bool MinecraftProfile::reapplySafe()
return true;
}
-void MinecraftProfile::finalize()
+static void applyString(const QString & from, QString & to)
{
- // HACK: deny april fools. my head hurts enough already.
- QDate now = QDate::currentDate();
- bool isAprilFools = now.month() == 4 && now.day() == 1;
- if (assets.endsWith("_af") && !isAprilFools)
+ if(from.isEmpty())
+ return;
+ to = from;
+}
+
+void MinecraftProfile::applyMinecraftVersion(const QString& id)
+{
+ applyString(id, this->id);
+}
+
+void MinecraftProfile::applyAppletClass(const QString& appletClass)
+{
+ applyString(appletClass, this->appletClass);
+}
+
+void MinecraftProfile::applyMainClass(const QString& mainClass)
+{
+ applyString(mainClass, this->mainClass);
+}
+
+void MinecraftProfile::applyMinecraftArguments(const QString& minecraftArguments, bool isMinecraft)
+{
+ applyString(minecraftArguments, this->minecraftArguments);
+ if(isMinecraft)
{
- assets = assets.left(assets.length() - 3);
+ applyString(minecraftArguments, this->vanillaMinecraftArguments);
}
- if (assets.isEmpty())
+}
+
+void MinecraftProfile::applyMinecraftVersionType(const QString& type)
+{
+ applyString(type, this->type);
+}
+
+void MinecraftProfile::applyMinecraftAssets(const QString& assets)
+{
+ applyString(assets, this->assets);
+}
+
+void MinecraftProfile::applyTraits(const QSet<QString>& traits)
+{
+ this->traits.unite(traits);
+}
+
+void MinecraftProfile::applyTweakers(const QStringList& tweakers)
+{
+ // FIXME: check for dupes?
+ // FIXME: does order matter?
+ for (auto tweaker : tweakers)
{
- assets = "legacy";
+ this->tweakers += tweaker;
}
- auto finalizeArguments = [&]( QString & minecraftArguments, const QString & processArguments ) -> void
+}
+
+void MinecraftProfile::applyJarMods(const QList<JarmodPtr>& jarMods)
+{
+ this->jarMods.append(jarMods);
+}
+
+static int findLibraryByName(QList<LibraryPtr> haystack, const GradleSpecifier &needle)
+{
+ int retval = -1;
+ for (int i = 0; i < haystack.size(); ++i)
{
- if (!minecraftArguments.isEmpty())
- return;
- QString toCompare = processArguments.toLower();
- if (toCompare == "legacy")
+ if (haystack.at(i)->rawName().matchName(needle))
{
- minecraftArguments = " ${auth_player_name} ${auth_session}";
+ // only one is allowed.
+ if (retval != -1)
+ return -1;
+ retval = i;
}
- else if (toCompare == "username_session")
+ }
+ return retval;
+}
+
+void MinecraftProfile::applyLibrary(LibraryPtr library, bool isMinecraft)
+{
+ auto insert = [&](QList<LibraryPtr> & into)
+ {
+ // find the library by name.
+ const int index = findLibraryByName(into, library->rawName());
+ // library not found? just add it.
+ if (index < 0)
{
- minecraftArguments = "--username ${auth_player_name} --session ${auth_session}";
+ into.append(Library::limitedCopy(library));
+ return;
}
- else if (toCompare == "username_session_version")
+ auto existingLibrary = into.at(index);
+ // if we are higher it means we should update
+ if (Version(library->version()) > Version(existingLibrary->version()))
{
- minecraftArguments = "--username ${auth_player_name} "
- "--session ${auth_session} "
- "--version ${profile_name}";
+ auto libraryCopy = Library::limitedCopy(library);
+ into.replace(index, libraryCopy);
}
};
- finalizeArguments(vanillaMinecraftArguments, vanillaProcessArguments);
- finalizeArguments(minecraftArguments, processArguments);
+ insert(libraries);
+ if(isMinecraft)
+ {
+ insert(vanillaLibraries);
+ }
+}
+
+
+QString MinecraftProfile::getMinecraftVersion() const
+{
+ return id;
+}
+
+QString MinecraftProfile::getAppletClass() const
+{
+ return appletClass;
+}
+
+QString MinecraftProfile::getMainClass() const
+{
+ return mainClass;
+}
+
+const QSet<QString> &MinecraftProfile::getTraits() const
+{
+ return traits;
+}
+
+const QStringList & MinecraftProfile::getTweakers() const
+{
+ return tweakers;
+}
+
+bool MinecraftProfile::hasTrait(const QString& trait) const
+{
+ return traits.contains(trait);
+}
+
+
+QString MinecraftProfile::getMinecraftVersionType() const
+{
+ return type;
+}
+
+QString MinecraftProfile::getMinecraftAssets() const
+{
+ // HACK: deny april fools. my head hurts enough already.
+ QDate now = QDate::currentDate();
+ bool isAprilFools = now.month() == 4 && now.day() == 1;
+ if (assets.endsWith("_af") && !isAprilFools)
+ {
+ return assets.left(assets.length() - 3);
+ }
+ if (assets.isEmpty())
+ {
+ return QLatin1Literal("legacy");
+ }
+ return assets;
+}
+
+QString MinecraftProfile::getMinecraftArguments() const
+{
+ return minecraftArguments;
+}
+
+QString MinecraftProfile::getVanillaMinecraftArguments() const
+{
+ return vanillaMinecraftArguments;
+}
+
+const QList<JarmodPtr> & MinecraftProfile::getJarMods() const
+{
+ return jarMods;
+}
+
+const QList<LibraryPtr> & MinecraftProfile::getLibraries() const
+{
+ return libraries;
+}
+
+const QList<LibraryPtr> & MinecraftProfile::getVanillaLibraries() const
+{
+ return vanillaLibraries;
}
void MinecraftProfile::installJarMods(QStringList selectedFiles)
diff --git a/logic/minecraft/MinecraftProfile.h b/logic/minecraft/MinecraftProfile.h
index 84d3ce3b..24d13609 100644
--- a/logic/minecraft/MinecraftProfile.h
+++ b/logic/minecraft/MinecraftProfile.h
@@ -88,16 +88,40 @@ public:
/// apply the patches. Catches all the errors and returns true/false for success/failure
bool reapplySafe();
- /// do a finalization step (should always be done after applying all patches to profile)
- void finalize();
+public:
+ void applyMinecraftVersion(const QString& id);
+ void applyMainClass(const QString& mainClass);
+ void applyAppletClass(const QString& appletClass);
+ void applyMinecraftArguments(const QString& minecraftArguments, bool isMinecraft);
+ void applyMinecraftVersionType(const QString& type);
+ void applyMinecraftAssets(const QString& assets);
+ void applyTraits(const QSet<QString> &traits);
+ void applyTweakers(const QStringList &tweakers);
+ void applyJarMods(const QList<JarmodPtr>&jarMods);
+ void applyLibrary(LibraryPtr library, bool isMinecraft);
public:
/// get all java libraries that belong to the classpath
- QList<LibraryPtr> getActiveNormalLibs();
+ QList<LibraryPtr> getActiveNormalLibs() const;
/// get all native libraries that need to be available to the process
- QList<LibraryPtr> getActiveNativeLibs();
+ QList<LibraryPtr> getActiveNativeLibs() const;
+
+ QString getMinecraftVersion() const;
+ QString getMainClass() const;
+ QString getAppletClass() const;
+ QString getMinecraftVersionType() const;
+ QString getMinecraftAssets() const;
+ QString getMinecraftArguments() const;
+ QString getVanillaMinecraftArguments() const;
+ const QSet<QString> & getTraits() const;
+ const QStringList & getTweakers() const;
+ const QList<JarmodPtr> & getJarMods() const;
+ const QList<LibraryPtr> & getLibraries() const;
+ const QList<LibraryPtr> & getVanillaLibraries() const;
+ bool hasTrait(const QString & trait) const;
+public:
/// get file ID of the patch file at #
QString versionFileId(const int index) const;
@@ -110,34 +134,22 @@ public:
/// save the current patch order
void saveCurrentOrder() const;
-public: /* only use in ProfileStrategy */
/// Remove all the patches
void clearPatches();
/// Add the patch object to the internal list of patches
void appendPatch(ProfilePatchPtr patch);
-public: /* data */
+protected: /* data */
/// the ID - determines which jar to use! ACTUALLY IMPORTANT!
QString id;
- /// the time this version was actually released by Mojang
- QDateTime m_releaseTime;
-
- /// the time this version was last updated by Mojang
- QDateTime m_updateTime;
-
/// Release type - "release" or "snapshot"
QString type;
+
/// Assets type - "legacy" or a version ID
QString assets;
- /**
- * DEPRECATED: Old versions of the new vanilla launcher used this
- * ex: "username_session_version"
- */
- QString processArguments;
- /// Same as above, but only for vanilla
- QString vanillaProcessArguments;
+
/**
* arguments that should be used for launching minecraft
*
@@ -145,19 +157,17 @@ public: /* data */
* --version ${version_name} --gameDir ${game_directory} --assetsDir ${game_assets}"
*/
QString minecraftArguments;
+
/// Same as above, but only for vanilla
QString vanillaMinecraftArguments;
- /**
- * A list of all tweaker classes
- */
+
+ /// A list of all tweaker classes
QStringList tweakers;
- /**
- * The main class to load first
- */
+
+ /// The main class to load first
QString mainClass;
- /**
- * The applet class, for some very old minecraft releases
- */
+
+ /// The applet class, for some very old minecraft releases
QString appletClass;
/// the list of libs - both active and inactive, native and java
diff --git a/logic/minecraft/MinecraftVersion.cpp b/logic/minecraft/MinecraftVersion.cpp
index 8a1ac501..3224de4c 100644
--- a/logic/minecraft/MinecraftVersion.cpp
+++ b/logic/minecraft/MinecraftVersion.cpp
@@ -43,6 +43,11 @@ QString MinecraftVersion::typeString() const
}
}
+VersionSource MinecraftVersion::getVersionSource()
+{
+ return m_versionSource;
+}
+
bool MinecraftVersion::hasJarMods()
{
return false;
@@ -64,19 +69,6 @@ void MinecraftVersion::applyFileTo(MinecraftProfile *version)
throw VersionIncomplete(QObject::tr("Can't apply incomplete/builtin Minecraft version %1").arg(m_name));
}
}
-/*
-QJsonDocument MinecraftVersion::toJson(bool saveOrder)
-{
- if(m_versionSource == Local && getVersionFile())
- {
- return getVersionFile()->toJson(saveOrder);
- }
- else
- {
- throw VersionIncomplete(QObject::tr("Can't write incomplete/builtin Minecraft version %1").arg(m_name));
- }
-}
-*/
QString MinecraftVersion::getUrl() const
{
@@ -171,36 +163,12 @@ void MinecraftVersion::applyTo(MinecraftProfile *version)
throw VersionIncomplete(QObject::tr(
"Minecraft version %1 could not be applied: version files are missing.").arg(m_descriptor));
}
- if (!m_descriptor.isNull())
- {
- version->id = m_descriptor;
- }
- if (!m_mainClass.isNull())
- {
- version->mainClass = m_mainClass;
- }
- if (!m_appletClass.isNull())
- {
- version->appletClass = m_appletClass;
- }
- if (!m_processArguments.isNull())
- {
- version->vanillaProcessArguments = m_processArguments;
- version->processArguments = m_processArguments;
- }
- if (!m_type.isNull())
- {
- version->type = m_type;
- }
- if (!m_releaseTime.isNull())
- {
- version->m_releaseTime = m_releaseTime;
- }
- if (!m_updateTime.isNull())
- {
- version->m_updateTime = m_updateTime;
- }
- version->traits.unite(m_traits);
+ version->applyMinecraftVersion(m_descriptor);
+ version->applyMainClass(m_mainClass);
+ version->applyAppletClass(m_appletClass);
+ version->applyMinecraftArguments(" ${auth_player_name} ${auth_session}", true); // all builtin versions are legacy
+ version->applyMinecraftVersionType(m_type);
+ version->applyTraits(m_traits);
}
int MinecraftVersion::getOrder()
@@ -218,22 +186,27 @@ QList<JarmodPtr> MinecraftVersion::getJarMods()
return QList<JarmodPtr>();
}
-QString MinecraftVersion::getPatchName()
+QString MinecraftVersion::getName()
{
return "Minecraft";
}
-QString MinecraftVersion::getPatchVersion()
+QString MinecraftVersion::getVersion()
{
return m_descriptor;
}
-QString MinecraftVersion::getPatchID()
+QString MinecraftVersion::getID()
{
return "net.minecraft";
}
-QString MinecraftVersion::getPatchFilename()
+QString MinecraftVersion::getFilename()
{
return QString();
}
+QDateTime MinecraftVersion::getReleaseDateTime()
+{
+ return m_releaseTime;
+}
+
bool MinecraftVersion::needsUpdate()
{
diff --git a/logic/minecraft/MinecraftVersion.h b/logic/minecraft/MinecraftVersion.h
index 33ca2899..aca9c08d 100644
--- a/logic/minecraft/MinecraftVersion.h
+++ b/logic/minecraft/MinecraftVersion.h
@@ -22,7 +22,6 @@
#include "BaseVersion.h"
#include "ProfilePatch.h"
#include "VersionFile.h"
-#include "VersionSource.h"
#include "multimc_logic_export.h"
@@ -32,6 +31,8 @@ typedef std::shared_ptr<MinecraftVersion> MinecraftVersionPtr;
class MULTIMC_LOGIC_EXPORT MinecraftVersion : public BaseVersion, public ProfilePatch
{
+friend class MinecraftVersionList;
+
public: /* methods */
bool usesLegacyLauncher();
virtual QString descriptor() override;
@@ -43,10 +44,13 @@ public: /* methods */
virtual int getOrder() override;
virtual void setOrder(int order) override;
virtual QList<JarmodPtr> getJarMods() override;
- virtual QString getPatchID() override;
- virtual QString getPatchVersion() override;
- virtual QString getPatchName() override;
- virtual QString getPatchFilename() override;
+ virtual QString getID() override;
+ virtual QString getVersion() override;
+ virtual QString getName() override;
+ virtual QString getFilename() override;
+ QDateTime getReleaseDateTime() override;
+ VersionSource getVersionSource() override;
+
bool needsUpdate();
bool hasUpdate();
virtual bool isCustom() override;
@@ -84,7 +88,7 @@ public: /* methods */
private: /* methods */
void applyFileTo(MinecraftProfile *version);
-public: /* data */
+protected: /* data */
VersionSource m_versionSource = Builtin;
/// The URL that this version will be downloaded from.
@@ -105,9 +109,6 @@ public: /* data */
/// The applet class this version uses (if any, can be empty).
QString m_appletClass;
- /// The process arguments used by this version
- QString m_processArguments;
-
/// The type of this release
QString m_type;
@@ -126,7 +127,6 @@ public: /* data */
/// an update available from Mojang
MinecraftVersionPtr upstreamUpdate;
-private: /* data */
QDateTime m_loadedVersionFileTimestamp;
mutable VersionFilePtr m_loadedVersionFile;
};
diff --git a/logic/minecraft/MinecraftVersionList.cpp b/logic/minecraft/MinecraftVersionList.cpp
index 507d8254..f219c782 100644
--- a/logic/minecraft/MinecraftVersionList.cpp
+++ b/logic/minecraft/MinecraftVersionList.cpp
@@ -111,7 +111,7 @@ static bool cmpVersions(BaseVersionPtr first, BaseVersionPtr second)
{
auto left = std::dynamic_pointer_cast<MinecraftVersion>(first);
auto right = std::dynamic_pointer_cast<MinecraftVersion>(second);
- return left->m_releaseTime > right->m_releaseTime;
+ return left->getReleaseDateTime() > right->getReleaseDateTime();
}
void MinecraftVersionList::sortInternal()
@@ -191,7 +191,6 @@ void MinecraftVersionList::loadBuiltinList()
mcVersion->m_appletClass = versionObj.value("appletClass").toString("");
mcVersion->m_mainClass = versionObj.value("mainClass").toString("");
mcVersion->m_jarChecksum = versionObj.value("checksum").toString("");
- mcVersion->m_processArguments = versionObj.value("processArguments").toString("legacy");
if (versionObj.contains("+traits"))
{
for (auto traitVal : Json::requireArray(versionObj.value("+traits")))
diff --git a/logic/minecraft/MojangVersionFormat.cpp b/logic/minecraft/MojangVersionFormat.cpp
index def388bf..2d4f26c5 100644
--- a/logic/minecraft/MojangVersionFormat.cpp
+++ b/logic/minecraft/MojangVersionFormat.cpp
@@ -150,7 +150,7 @@ VersionFilePtr MojangVersionFormat::versionFileFromJson(const QJsonDocument &doc
Bits::readString(root, "id", out->id);
Bits::readString(root, "mainClass", out->mainClass);
- Bits::readString(root, "minecraftArguments", out->overwriteMinecraftArguments);
+ Bits::readString(root, "minecraftArguments", out->minecraftArguments);
Bits::readString(root, "type", out->type);
if(root.contains("assetIndex"))
@@ -203,8 +203,7 @@ QJsonDocument versionFileToJson(VersionFilePtr patch)
QJsonObject root;
writeString(root, "id", patch->id);
writeString(root, "mainClass", patch->mainClass);
- writeString(root, "processArguments", patch->processArguments);
- writeString(root, "minecraftArguments", patch->overwriteMinecraftArguments);
+ writeString(root, "minecraftArguments", patch->minecraftArguments);
writeString(root, "type", patch->type);
writeString(root, "assets", patch->assets);
writeString(root, "releaseTime", timeToS3Time(patch->m_releaseTime));
@@ -246,7 +245,7 @@ QJsonDocument versionFileToJson(VersionFilePtr patch)
static QJsonDocument minecraftVersionToJson(MinecraftVersionPtr patch)
{
- if(patch->m_versionSource == Local && patch->getVersionFile())
+ if(patch->getVersionSource() == Local && patch->getVersionFile())
{
return MojangVersionFormat::profilePatchToJson(patch->getVersionFile());
}
@@ -268,7 +267,7 @@ QJsonDocument MojangVersionFormat::profilePatchToJson(const ProfilePatchPtr &pat
{
return minecraftVersionToJson(mversion);
}
- throw VersionIncomplete(QObject::tr("Unhandled object type while processing %1").arg(patch->getPatchName()));
+ throw VersionIncomplete(QObject::tr("Unhandled object type while processing %1").arg(patch->getName()));
}
LibraryPtr MojangVersionFormat::libraryFromJson(const QJsonObject &libObj, const QString &filename)
diff --git a/logic/minecraft/ProfilePatch.h b/logic/minecraft/ProfilePatch.h
index cf7a1904..0d01ba87 100644
--- a/logic/minecraft/ProfilePatch.h
+++ b/logic/minecraft/ProfilePatch.h
@@ -14,6 +14,14 @@ enum ProblemSeverity
PROBLEM_ERROR
};
+/// where is a version from?
+enum VersionSource
+{
+ Builtin, //!< version loaded from the internal resources.
+ Local, //!< version loaded from a file in the cache.
+ Remote, //!< incomplete version on a remote server.
+};
+
class PatchProblem
{
public:
@@ -56,10 +64,14 @@ public:
virtual void setOrder(int order) = 0;
virtual int getOrder() = 0;
- virtual QString getPatchID() = 0;
- virtual QString getPatchName() = 0;
- virtual QString getPatchVersion() = 0;
- virtual QString getPatchFilename() = 0;
+ virtual QString getID() = 0;
+ virtual QString getName() = 0;
+ virtual QString getVersion() = 0;
+ virtual QDateTime getReleaseDateTime() = 0;
+
+ virtual QString getFilename() = 0;
+
+ virtual VersionSource getVersionSource() = 0;
virtual const QList<PatchProblem>& getProblems()
{
diff --git a/logic/minecraft/ProfileUtils.cpp b/logic/minecraft/ProfileUtils.cpp
index 30e83a1f..dfff7956 100644
--- a/logic/minecraft/ProfileUtils.cpp
+++ b/logic/minecraft/ProfileUtils.cpp
@@ -166,6 +166,5 @@ void removeLwjglFromPatch(VersionFilePtr patch)
libs = filteredLibs;
};
filter(patch->addLibs);
- filter(patch->overwriteLibs);
}
}
diff --git a/logic/minecraft/VersionFile.cpp b/logic/minecraft/VersionFile.cpp
index 410f6659..9cd8dd5e 100644
--- a/logic/minecraft/VersionFile.cpp
+++ b/logic/minecraft/VersionFile.cpp
@@ -12,22 +12,6 @@
#include "VersionBuildError.h"
#include <Version.h>
-int findLibraryByName(QList<LibraryPtr> haystack, const GradleSpecifier &needle)
-{
- int retval = -1;
- for (int i = 0; i < haystack.size(); ++i)
- {
- if (haystack.at(i)->rawName().matchName(needle))
- {
- // only one is allowed.
- if (retval != -1)
- return -1;
- retval = i;
- }
- }
- return retval;
-}
-
bool VersionFile::isMinecraftVersion()
{
return fileId == "net.minecraft";
@@ -40,105 +24,31 @@ bool VersionFile::hasJarMods()
void VersionFile::applyTo(MinecraftProfile *version)
{
- if (!version->id.isNull() && !mcVersion.isNull())
- {
- if (QRegExp(mcVersion, Qt::CaseInsensitive, QRegExp::Wildcard).indexIn(version->id) ==
- -1)
- {
- throw MinecraftVersionMismatch(fileId, mcVersion, version->id);
- }
- }
-
- if (!id.isNull())
- {
- version->id = id;
- }
- if (!mainClass.isNull())
- {
- version->mainClass = mainClass;
- }
- if (!appletClass.isNull())
- {
- version->appletClass = appletClass;
- }
- if (!processArguments.isNull())
- {
- if (isMinecraftVersion())
- {
- version->vanillaProcessArguments = processArguments;
- }
- version->processArguments = processArguments;
- }
- if (isMinecraftVersion())
- {
- if (!type.isNull())
- {
- version->type = type;
- }
- if (!m_releaseTime.isNull())
- {
- version->m_releaseTime = m_releaseTime;
- }
- if (!m_updateTime.isNull())
- {
- version->m_updateTime = m_updateTime;
- }
- }
- if (!assets.isNull())
+ auto theirVersion = version->getMinecraftVersion();
+ if (!theirVersion.isNull() && !mcVersion.isNull())
{
- version->assets = assets;
- }
- if (!overwriteMinecraftArguments.isNull())
- {
- if (isMinecraftVersion())
+ if (QRegExp(mcVersion, Qt::CaseInsensitive, QRegExp::Wildcard).indexIn(theirVersion) == -1)
{
- version->vanillaMinecraftArguments = overwriteMinecraftArguments;
+ throw MinecraftVersionMismatch(fileId, mcVersion, theirVersion);
}
- version->minecraftArguments = overwriteMinecraftArguments;
- }
- if (!addMinecraftArguments.isNull())
- {
- version->minecraftArguments += addMinecraftArguments;
- }
- if (shouldOverwriteTweakers)
- {
- version->tweakers = overwriteTweakers;
}
- for (auto tweaker : addTweakers)
+ bool is_minecraft = isMinecraftVersion();
+ version->applyMinecraftVersion(id);
+ version->applyMainClass(mainClass);
+ version->applyAppletClass(appletClass);
+ version->applyMinecraftArguments(minecraftArguments, is_minecraft);
+ if (is_minecraft)
{
- version->tweakers += tweaker;
- }
- version->jarMods.append(jarMods);
- version->traits.unite(traits);
- if (shouldOverwriteLibs)
- {
- QList<LibraryPtr> libs;
- for (auto lib : overwriteLibs)
- {
- libs.append(Library::limitedCopy(lib));
- }
- if (isMinecraftVersion())
- {
- version->vanillaLibraries = libs;
- }
- version->libraries = libs;
+ version->applyMinecraftVersionType(type);
}
+ version->applyMinecraftAssets(assets);
+ version->applyTweakers(addTweakers);
+
+ version->applyJarMods(jarMods);
+ version->applyTraits(traits);
+
for (auto addedLibrary : addLibs)
{
- // find the library by name.
- const int index = findLibraryByName(version->libraries, addedLibrary->rawName());
- // library not found? just add it.
- if (index < 0)
- {
- version->libraries.append(Library::limitedCopy(addedLibrary));
- continue;
- }
- auto existingLibrary = version->libraries.at(index);
- // if we are higher it means we should update
- if (Version(addedLibrary->version()) > Version(existingLibrary->version()))
- {
- auto library = Library::limitedCopy(addedLibrary);
- version->libraries.replace(index, library);
- }
+ version->applyLibrary(addedLibrary, isMinecraftVersion());
}
}
diff --git a/logic/minecraft/VersionFile.h b/logic/minecraft/VersionFile.h
index 6c0225b0..69866fc5 100644
--- a/logic/minecraft/VersionFile.h
+++ b/logic/minecraft/VersionFile.h
@@ -20,6 +20,8 @@ struct MojangAssetIndexInfo;
typedef std::shared_ptr<VersionFile> VersionFilePtr;
class VersionFile : public ProfilePatch
{
+ friend class MojangVersionFormat;
+ friend class OneSixVersionFormat;
public: /* methods */
virtual void applyTo(MinecraftProfile *version) override;
virtual bool isMinecraftVersion() override;
@@ -36,22 +38,32 @@ public: /* methods */
{
return jarMods;
}
- virtual QString getPatchID() override
+ virtual QString getID() override
{
return fileId;
}
- virtual QString getPatchName() override
+ virtual QString getName() override
{
return name;
}
- virtual QString getPatchVersion() override
+ virtual QString getVersion() override
{
return version;
}
- virtual QString getPatchFilename() override
+ virtual QString getFilename() override
{
return filename;
}
+ virtual QDateTime getReleaseDateTime() override
+ {
+ return m_releaseTime;
+ }
+ VersionSource getVersionSource() override
+ {
+ return Local;
+ }
+
+
virtual bool isCustom() override
{
return !m_isVanilla;
@@ -138,17 +150,11 @@ public: /* data */
/// Mojang: class to launch Minecraft with
QString mainClass;
- /// MultiMC: class to launch legacy Minecraft with (ambed in a custom window)
+ /// MultiMC: DEPRECATED class to launch legacy Minecraft with (ambed in a custom window)
QString appletClass;
/// Mojang: Minecraft launch arguments (may contain placeholders for variable substitution)
- QString overwriteMinecraftArguments;
-
- /// MultiMC: Minecraft launch arguments, additive variant
- QString addMinecraftArguments;
-
- /// Mojang: DEPRECATED variant of the Minecraft arguments, hardcoded, do not use!
- QString processArguments;
+ QString minecraftArguments;
/// Mojang: type of the Minecraft version
QString type;
@@ -162,17 +168,9 @@ public: /* data */
/// Mojang: DEPRECATED asset group to be used with Minecraft
QString assets;
- /// MultiMC: override list of tweaker mod arguments for launchwrapper (replaces the previously assembled lists)
- bool shouldOverwriteTweakers = false;
- QStringList overwriteTweakers;
-
/// MultiMC: list of tweaker mod arguments for launchwrapper
QStringList addTweakers;
- /// MultiMC: override list of libraries (replaces the previously assembled lists)
- bool shouldOverwriteLibs = false;
- QList<LibraryPtr> overwriteLibs;
-
/// Mojang: list of libraries to add to the version
QList<LibraryPtr> addLibs;
@@ -182,6 +180,7 @@ public: /* data */
/// MultiMC: list of jar mods added to this version
QList<JarmodPtr> jarMods;
+public:
// Mojang: list of 'downloads' - client jar, server jar, windows server exe, maybe more.
QMap <QString, std::shared_ptr<MojangDownloadInfo>> mojangDownloads;
diff --git a/logic/minecraft/VersionSource.h b/logic/minecraft/VersionSource.h
deleted file mode 100644
index 75b2c24b..00000000
--- a/logic/minecraft/VersionSource.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#pragma once
-
-/// where is a version from?
-enum VersionSource
-{
- Builtin, //!< version loaded from the internal resources.
- Local, //!< version loaded from a file in the cache.
- Remote, //!< incomplete version on a remote server.
-}; \ No newline at end of file
diff --git a/logic/minecraft/forge/ForgeInstaller.cpp b/logic/minecraft/forge/ForgeInstaller.cpp
index bc0a967e..a72160a2 100644
--- a/logic/minecraft/forge/ForgeInstaller.cpp
+++ b/logic/minecraft/forge/ForgeInstaller.cpp
@@ -119,7 +119,7 @@ void ForgeInstaller::prepare(const QString &filename, const QString &universalUr
file.close();
m_forge_json = newVersion;
- m_forge_json->id = installObj.value("minecraft").toString();
+ //m_forge_json->id = installObj.value("minecraft").toString();
}
bool ForgeInstaller::add(OneSixInstance *to)
@@ -134,15 +134,14 @@ bool ForgeInstaller::add(OneSixInstance *to)
if (!m_forge_json)
return false;
- int sliding_insert_window = 0;
{
- QJsonArray librariesPlus;
+ QJsonArray libraries;
// A blacklist
QSet<QString> blacklist{"authlib", "realms"};
//
QList<QString> xzlist{"org.scala-lang", "com.typesafe"};
// for each library in the version we are adding (except for the blacklisted)
- for (auto lib : m_forge_json->libraries)
+ for (auto lib : m_forge_json->getLibraries())
{
QString libName = lib->artifactId();
QString rawName = lib->rawName();
@@ -194,41 +193,27 @@ bool ForgeInstaller::add(OneSixInstance *to)
QJsonObject libObj = OneSixVersionFormat::libraryToJson(lib.get());
- bool found = false;
bool equals = false;
// find an entry that matches this one
- for (auto tolib : to->getMinecraftProfile()->vanillaLibraries)
+ for (auto tolib : to->getMinecraftProfile()->getVanillaLibraries())
{
if (tolib->artifactId() != libName)
continue;
- found = true;
if (OneSixVersionFormat::libraryToJson(tolib.get()) == libObj)
{
equals = true;
}
- // replace lib
- libObj.insert("insert", QString("replace"));
break;
}
if (equals)
{
continue;
}
- if (!found)
- {
- // add lib
- libObj.insert("insert", QString("prepend"));
- if (lib->artifactId() == "minecraftforge" || lib->artifactId() == "forge")
- {
- libObj.insert("MMC-depend", QString("hard"));
- }
- sliding_insert_window++;
- }
- librariesPlus.prepend(libObj);
+ libraries.append(libObj);
}
- obj.insert("+libraries", librariesPlus);
- obj.insert("mainClass", m_forge_json->mainClass);
- QString args = m_forge_json->minecraftArguments;
+ obj.insert("libraries", libraries);
+ obj.insert("mainClass", m_forge_json->getMainClass());
+ QString args = m_forge_json->getMinecraftArguments();
QStringList tweakers;
{
QRegularExpression expression("--tweakClass ([a-zA-Z0-9\\.]*)");
@@ -240,7 +225,7 @@ bool ForgeInstaller::add(OneSixInstance *to)
match = expression.match(args);
}
}
- if (!args.isEmpty() && args != to->getMinecraftProfile()->vanillaMinecraftArguments)
+ if (!args.isEmpty() && args != to->getMinecraftProfile()->getVanillaMinecraftArguments())
{
obj.insert("minecraftArguments", args);
}
@@ -248,11 +233,6 @@ bool ForgeInstaller::add(OneSixInstance *to)
{
obj.insert("+tweakers", QJsonArray::fromStringList(tweakers));
}
- if (!m_forge_json->processArguments.isEmpty() &&
- m_forge_json->processArguments != to->getMinecraftProfile()->vanillaProcessArguments)
- {
- obj.insert("processArguments", m_forge_json->processArguments);
- }
}
obj.insert("name", QString("Forge"));
diff --git a/logic/minecraft/ftb/FTBProfileStrategy.cpp b/logic/minecraft/ftb/FTBProfileStrategy.cpp
index a86cdee3..6f635fe8 100644
--- a/logic/minecraft/ftb/FTBProfileStrategy.cpp
+++ b/logic/minecraft/ftb/FTBProfileStrategy.cpp
@@ -54,9 +54,6 @@ void FTBProfileStrategy::loadDefaultBuiltinPatches()
auto file = ProfileUtils::parseJsonFile(QFileInfo(mcJson), false);
// adapt the loaded file - the FTB patch file format is different than ours.
- file->addLibs = file->overwriteLibs;
- file->overwriteLibs.clear();
- file->shouldOverwriteLibs = false;
file->id.clear();
for(auto addLib: file->addLibs)
{
@@ -98,8 +95,6 @@ void FTBProfileStrategy::load()
loadDefaultBuiltinPatches();
loadUserPatches();
-
- profile->finalize();
}
bool FTBProfileStrategy::saveOrder(ProfileUtils::PatchOrder order)
diff --git a/logic/minecraft/onesix/OneSixInstance.cpp b/logic/minecraft/onesix/OneSixInstance.cpp
index 2846640c..93034925 100644
--- a/logic/minecraft/onesix/OneSixInstance.cpp
+++ b/logic/minecraft/onesix/OneSixInstance.cpp
@@ -61,7 +61,7 @@ QSet<QString> OneSixInstance::traits()
return {"version-incomplete"};
}
else
- return version->traits;
+ return version->getTraits();
}
std::shared_ptr<Task> OneSixInstance::createUpdateTask()
@@ -95,8 +95,8 @@ QString replaceTokensIn(QString text, QMap<QString, QString> with)
QStringList OneSixInstance::processMinecraftArgs(AuthSessionPtr session)
{
- QString args_pattern = m_version->minecraftArguments;
- for (auto tweaker : m_version->tweakers)
+ QString args_pattern = m_version->getMinecraftArguments();
+ for (auto tweaker : m_version->getTweakers())
{
args_pattern += " --tweakClass " + tweaker;
}
@@ -113,7 +113,7 @@ QStringList OneSixInstance::processMinecraftArgs(AuthSessionPtr session)
token_mapping["profile_name"] = token_mapping["version_name"] = "MultiMC5";
if(m_version->isVanilla())
{
- token_mapping["version_type"] = m_version->type;
+ token_mapping["version_type"] = m_version->getMinecraftVersionType();
}
else
{
@@ -123,24 +123,14 @@ QStringList OneSixInstance::processMinecraftArgs(AuthSessionPtr session)
QString absRootDir = QDir(minecraftRoot()).absolutePath();
token_mapping["game_directory"] = absRootDir;
QString absAssetsDir = QDir("assets/").absolutePath();
- token_mapping["game_assets"] = AssetsUtils::reconstructAssets(m_version->assets).absolutePath();
+ token_mapping["game_assets"] = AssetsUtils::reconstructAssets(m_version->getMinecraftAssets()).absolutePath();
token_mapping["user_properties"] = session->serializeUserProperties();
token_mapping["user_type"] = session->user_type;
// 1.7.3+ assets tokens
token_mapping["assets_root"] = absAssetsDir;
- token_mapping["assets_index_name"] = m_version->assets;
-
- // 1.9+ version type token
- if(m_version->isVanilla())
- {
- token_mapping["version_type"] = m_version->type;
- }
- else
- {
- token_mapping["version_type"] = "custom";
- }
+ token_mapping["assets_index_name"] = m_version->getMinecraftAssets();
QStringList parts = args_pattern.split(' ', QString::SkipEmptyParts);
for (int i = 0; i < parts.length(); i++)
@@ -182,7 +172,7 @@ QString OneSixInstance::createLaunchScript(AuthSessionPtr session)
launchScript += "coremod " + coremod.filename().completeBaseName() + "\n";;
}
- for(auto & jarmod: m_version->jarMods)
+ for(auto & jarmod: m_version->getJarMods())
{
launchScript += "jarmod " + jarmod->originalName + " (" + jarmod->name + ")\n";
}
@@ -201,17 +191,19 @@ QString OneSixInstance::createLaunchScript(AuthSessionPtr session)
}
else
{
- QString relpath = m_version->id + "/" + m_version->id + ".jar";
+ QString relpath = m_version->getMinecraftVersion() + "/" + m_version->getMinecraftVersion() + ".jar";
launchScript += "cp " + versionsPath().absoluteFilePath(relpath) + "\n";
}
}
- if (!m_version->mainClass.isEmpty())
+ auto mainClass = m_version->getMainClass();
+ if (!mainClass.isEmpty())
{
- launchScript += "mainClass " + m_version->mainClass + "\n";
+ launchScript += "mainClass " + mainClass + "\n";
}
- if (!m_version->appletClass.isEmpty())
+ auto appletClass = m_version->getAppletClass();
+ if (!appletClass.isEmpty())
{
- launchScript += "appletClass " + m_version->appletClass + "\n";
+ launchScript += "appletClass " + appletClass + "\n";
}
// generic minecraft params
@@ -251,7 +243,7 @@ QString OneSixInstance::createLaunchScript(AuthSessionPtr session)
}
// traits. including legacyLaunch and others ;)
- for (auto trait : m_version->traits)
+ for (auto trait : m_version->getTraits())
{
launchScript += "traits " + trait + "\n";
}
@@ -323,7 +315,7 @@ std::shared_ptr<Task> OneSixInstance::createJarModdingTask()
{
std::shared_ptr<MinecraftProfile> version = m_inst->getMinecraftProfile();
// nuke obsolete stripped jar(s) if needed
- QString version_id = version->id;
+ QString version_id = version->getMinecraftVersion();
QString strippedPath = version_id + "/" + version_id + "-stripped.jar";
QFile strippedJar(strippedPath);
if(strippedJar.exists())
@@ -351,7 +343,7 @@ std::shared_ptr<Task> OneSixInstance::createJarModdingTask()
auto jarMods = m_inst->getJarMods();
if(jarMods.size())
{
- auto sourceJarPath = m_inst->versionsPath().absoluteFilePath(version->id + "/" + version->id + ".jar");
+ auto sourceJarPath = m_inst->versionsPath().absoluteFilePath(version_id + "/" + version_id + ".jar");
QString localPath = version_id + "/" + version_id + ".jar";
auto metacache = ENV.metacache();
auto entry = metacache->resolveEntry("versions", localPath);
@@ -439,7 +431,7 @@ bool OneSixInstance::setIntendedVersionId(QString version)
QList< Mod > OneSixInstance::getJarMods() const
{
QList<Mod> mods;
- for (auto jarmod : m_version->jarMods)
+ for (auto jarmod : m_version->getJarMods())
{
QString filePath = jarmodsPath().absoluteFilePath(jarmod->name);
mods.push_back(Mod(QFileInfo(filePath)));
diff --git a/logic/minecraft/onesix/OneSixProfileStrategy.cpp b/logic/minecraft/onesix/OneSixProfileStrategy.cpp
index fe4e0d26..baec635e 100644
--- a/logic/minecraft/onesix/OneSixProfileStrategy.cpp
+++ b/logic/minecraft/onesix/OneSixProfileStrategy.cpp
@@ -228,8 +228,6 @@ void OneSixProfileStrategy::load()
upgradeDeprecatedFiles();
loadDefaultBuiltinPatches();
loadUserPatches();
-
- profile->finalize();
}
bool OneSixProfileStrategy::saveOrder(ProfileUtils::PatchOrder order)
@@ -246,7 +244,7 @@ bool OneSixProfileStrategy::removePatch(ProfilePatchPtr patch)
{
bool ok = true;
// first, remove the patch file. this ensures it's not used anymore
- auto fileName = patch->getPatchFilename();
+ auto fileName = patch->getFilename();
if(fileName.size())
{
QFile patchFile(fileName);
@@ -289,7 +287,7 @@ bool OneSixProfileStrategy::customizePatch(ProfilePatchPtr patch)
return false;
}
- auto filename = FS::PathCombine(m_instance->instanceRoot(), "patches" , patch->getPatchID() + ".json");
+ auto filename = FS::PathCombine(m_instance->instanceRoot(), "patches" , patch->getID() + ".json");
if(!FS::ensureFilePathExists(filename))
{
return false;
@@ -327,7 +325,7 @@ bool OneSixProfileStrategy::revertPatch(ProfilePatchPtr patch)
// already not custom
return true;
}
- auto filename = patch->getPatchFilename();
+ auto filename = patch->getFilename();
if(!QFile::exists(filename))
{
// already gone / not custom
diff --git a/logic/minecraft/onesix/OneSixUpdate.cpp b/logic/minecraft/onesix/OneSixUpdate.cpp
index da3bd504..c12674d4 100644
--- a/logic/minecraft/onesix/OneSixUpdate.cpp
+++ b/logic/minecraft/onesix/OneSixUpdate.cpp
@@ -51,8 +51,7 @@ void OneSixUpdate::executeTask()
}
// Get a pointer to the version object that corresponds to the instance's version.
- targetVersion = std::dynamic_pointer_cast<MinecraftVersion>(
- ENV.getVersion("net.minecraft", m_inst->intendedVersionId()));
+ targetVersion = std::dynamic_pointer_cast<MinecraftVersion>(ENV.getVersion("net.minecraft", m_inst->intendedVersionId()));
if (targetVersion == nullptr)
{
// don't do anything if it was invalid
@@ -89,7 +88,7 @@ void OneSixUpdate::assetIndexStart()
setStatus(tr("Updating assets index..."));
OneSixInstance *inst = (OneSixInstance *)m_inst;
std::shared_ptr<MinecraftProfile> version = inst->getMinecraftProfile();
- QString assetName = version->assets;
+ QString assetName = version->getMinecraftAssets();
QUrl indexUrl = "http://" + URLConstants::AWS_DOWNLOAD_INDEXES + assetName + ".json";
QString localPath = assetName + ".json";
auto job = new NetJob(tr("Asset index for %1").arg(inst->name()));
@@ -115,7 +114,7 @@ void OneSixUpdate::assetIndexFinished()
OneSixInstance *inst = (OneSixInstance *)m_inst;
std::shared_ptr<MinecraftProfile> version = inst->getMinecraftProfile();
- QString assetName = version->assets;
+ QString assetName = version->getMinecraftAssets();
QString asset_fname = "assets/indexes/" + assetName + ".json";
if (!AssetsUtils::loadAssetsIndexJson(asset_fname, &index))
@@ -194,7 +193,7 @@ void OneSixUpdate::jarlibStart()
std::shared_ptr<MinecraftProfile> version = inst->getMinecraftProfile();
// minecraft.jar for this version
{
- QString version_id = version->id;
+ QString version_id = version->getMinecraftVersion();
QString localPath = version_id + "/" + version_id + ".jar";
QString urlstr = "http://" + URLConstants::AWS_DOWNLOAD_VERSIONS + localPath;
@@ -292,7 +291,7 @@ void OneSixUpdate::jarlibFinished()
OneSixInstance *inst = (OneSixInstance *)m_inst;
std::shared_ptr<MinecraftProfile> version = inst->getMinecraftProfile();
- if (version->traits.contains("legacyFML"))
+ if (version->hasTrait("legacyFML"))
{
fmllibsStart();
}
diff --git a/logic/minecraft/onesix/OneSixVersionFormat.cpp b/logic/minecraft/onesix/OneSixVersionFormat.cpp
index 4ccf6e78..ff26ab92 100644
--- a/logic/minecraft/onesix/OneSixVersionFormat.cpp
+++ b/logic/minecraft/onesix/OneSixVersionFormat.cpp
@@ -81,9 +81,30 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc
readString(root, "mainClass", out->mainClass);
readString(root, "appletClass", out->appletClass);
- readString(root, "processArguments", out->processArguments);
- readString(root, "minecraftArguments", out->overwriteMinecraftArguments);
- readString(root, "+minecraftArguments", out->addMinecraftArguments);
+ readString(root, "minecraftArguments", out->minecraftArguments);
+ if(out->minecraftArguments.isEmpty())
+ {
+ QString processArguments;
+ readString(root, "processArguments", processArguments);
+ QString toCompare = processArguments.toLower();
+ if (toCompare == "legacy")
+ {
+ out->minecraftArguments = " ${auth_player_name} ${auth_session}";
+ }
+ else if (toCompare == "username_session")
+ {
+ out->minecraftArguments = "--username ${auth_player_name} --session ${auth_session}";
+ }
+ else if (toCompare == "username_session_version")
+ {
+ out->minecraftArguments = "--username ${auth_player_name} --session ${auth_session} --version ${profile_name}";
+ }
+ else if (!toCompare.isEmpty())
+ {
+ out->addProblem(PROBLEM_ERROR, QObject::tr("processArguments is set to unknown value '%1'").arg(processArguments));
+ }
+ }
+
readString(root, "type", out->type);
out->m_releaseTime = timeFromS3Time(readStringRet(root, "releaseTime"));
@@ -91,15 +112,6 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc
readString(root, "assets", out->assets);
- if (root.contains("tweakers"))
- {
- out->shouldOverwriteTweakers = true;
- for (auto tweakerVal : requireArray(root.value("tweakers")))
- {
- out->overwriteTweakers.append(requireString(tweakerVal));
- }
- }
-
if (root.contains("+tweakers"))
{
for (auto tweakerVal : requireArray(root.value("+tweakers")))
@@ -108,7 +120,6 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc
}
}
-
if (root.contains("+traits"))
{
for (auto tweakerVal : requireArray(root.value("+traits")))
@@ -117,18 +128,6 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc
}
}
- if (root.contains("libraries"))
- {
- out->shouldOverwriteLibs = true;
- for (auto libVal : requireArray(root.value("libraries")))
- {
- auto libObj = requireObject(libVal);
-
- auto lib = libraryFromJson(libObj, filename);
- out->overwriteLibs.append(lib);
- }
- }
-
if (root.contains("+jarMods"))
{
for (auto libVal : requireArray(root.value("+jarMods")))
@@ -147,18 +146,38 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc
}
}
- if (root.contains("+libraries"))
+ auto readLibs = [&](const char * which)
{
- for (auto libVal : requireArray(root.value("+libraries")))
+ for (auto libVal : requireArray(root.value(which)))
{
QJsonObject libObj = requireObject(libVal);
// parse the library
auto lib = libraryFromJson(libObj, filename);
out->addLibs.append(lib);
}
+ };
+ bool hasPlusLibs = root.contains("+libraries");
+ bool hasLibs = root.contains("libraries");
+ if (hasPlusLibs && hasLibs)
+ {
+ out->addProblem(PROBLEM_WARNING, QObject::tr("Version file has both '+libraries' and 'libraries'. This is no longer supported."));
+ readLibs("libraries");
+ readLibs("+libraries");
+ }
+ else if (hasLibs)
+ {
+ readLibs("libraries");
+ }
+ else if(hasPlusLibs)
+ {
+ readLibs("+libraries");
}
/* removed features that shouldn't be used */
+ if (root.contains("tweakers"))
+ {
+ out->addProblem(PROBLEM_ERROR, QObject::tr("Version file contains unsupported element 'tweakers'"));
+ }
if (root.contains("-libraries"))
{
out->addProblem(PROBLEM_ERROR, QObject::tr("Version file contains unsupported element '-libraries'"));
@@ -171,6 +190,10 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc
{
out->addProblem(PROBLEM_ERROR, QObject::tr("Version file contains unsupported element '-minecraftArguments'"));
}
+ if (root.contains("+minecraftArguments"))
+ {
+ out->addProblem(PROBLEM_ERROR, QObject::tr("Version file contains unsupported element '+minecraftArguments'"));
+ }
return out;
}
@@ -197,9 +220,7 @@ static QJsonDocument versionFileToJson(VersionFilePtr patch, bool saveOrder)
writeString(root, "id", patch->id);
writeString(root, "mainClass", patch->mainClass);
writeString(root, "appletClass", patch->appletClass);
- writeString(root, "processArguments", patch->processArguments);
- writeString(root, "minecraftArguments", patch->overwriteMinecraftArguments);
- writeString(root, "+minecraftArguments", patch->addMinecraftArguments);
+ writeString(root, "minecraftArguments", patch->minecraftArguments);
writeString(root, "type", patch->type);
writeString(root, "assets", patch->assets);
if (patch->isMinecraftVersion())
@@ -207,18 +228,8 @@ static QJsonDocument versionFileToJson(VersionFilePtr patch, bool saveOrder)
writeString(root, "releaseTime", timeToS3Time(patch->m_releaseTime));
writeString(root, "time", timeToS3Time(patch->m_updateTime));
}
- writeStringList(root, "tweakers", patch->overwriteTweakers);
writeStringList(root, "+tweakers", patch->addTweakers);
writeStringList(root, "+traits", patch->traits.toList());
- if (!patch->overwriteLibs.isEmpty())
- {
- QJsonArray array;
- for (auto value: patch->overwriteLibs)
- {
- array.append(OneSixVersionFormat::libraryToJson(value.get()));
- }
- root.insert("libraries", array);
- }
if (!patch->addLibs.isEmpty())
{
QJsonArray array;
@@ -226,7 +237,7 @@ static QJsonDocument versionFileToJson(VersionFilePtr patch, bool saveOrder)
{
array.append(OneSixVersionFormat::libraryToJson(value.get()));
}
- root.insert("+libraries", array);
+ root.insert("libraries", array);
}
if (!patch->jarMods.isEmpty())
{
@@ -247,7 +258,7 @@ static QJsonDocument versionFileToJson(VersionFilePtr patch, bool saveOrder)
static QJsonDocument minecraftVersionToJson(MinecraftVersionPtr patch, bool saveOrder)
{
- if(patch->m_versionSource == Local && patch->getVersionFile())
+ if(patch->getVersionSource() == Local && patch->getVersionFile())
{
return OneSixVersionFormat::profilePatchToJson(patch->getVersionFile(), saveOrder);
}
@@ -269,7 +280,7 @@ QJsonDocument OneSixVersionFormat::profilePatchToJson(const ProfilePatchPtr &pat
{
return minecraftVersionToJson(mversion, saveOrder);
}
- throw VersionIncomplete(QObject::tr("Unhandled object type while processing %1").arg(patch->getPatchName()));
+ throw VersionIncomplete(QObject::tr("Unhandled object type while processing %1").arg(patch->getName()));
}
std::shared_ptr<MinecraftProfile> OneSixVersionFormat::profileFromSingleJson(const QJsonObject &obj)