summaryrefslogtreecommitdiffstats
path: root/logic/OneSixInstance.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'logic/OneSixInstance.cpp')
-rw-r--r--logic/OneSixInstance.cpp39
1 files changed, 12 insertions, 27 deletions
diff --git a/logic/OneSixInstance.cpp b/logic/OneSixInstance.cpp
index 88c40316..8ecbe7a0 100644
--- a/logic/OneSixInstance.cpp
+++ b/logic/OneSixInstance.cpp
@@ -46,9 +46,9 @@ OneSixInstance::OneSixInstance(const QString &rootDir, SettingsObject *settings,
}
}
-std::shared_ptr<Task> OneSixInstance::doUpdate(bool only_prepare)
+std::shared_ptr<Task> OneSixInstance::doUpdate()
{
- return std::shared_ptr<Task>(new OneSixUpdate(this, only_prepare));
+ return std::shared_ptr<Task>(new OneSixUpdate(this));
}
QString replaceTokensIn(QString text, QMap<QString, QString> with)
@@ -135,7 +135,7 @@ QDir OneSixInstance::reconstructAssets(std::shared_ptr<OneSixVersion> version)
return virtualRoot;
}
-QStringList OneSixInstance::processMinecraftArgs(MojangAccountPtr account)
+QStringList OneSixInstance::processMinecraftArgs(AuthSessionPtr session)
{
I_D(OneSixInstance);
auto version = d->version;
@@ -147,17 +147,11 @@ QStringList OneSixInstance::processMinecraftArgs(MojangAccountPtr account)
QMap<QString, QString> token_mapping;
// yggdrasil!
- token_mapping["auth_username"] = account->username();
- token_mapping["auth_session"] = account->sessionId();
- token_mapping["auth_access_token"] = account->accessToken();
- token_mapping["auth_player_name"] = account->currentProfile()->name;
- token_mapping["auth_uuid"] = account->currentProfile()->id;
-
- // this is for offline?:
- /*
- map["auth_player_name"] = "Player";
- map["auth_player_name"] = "00000000-0000-0000-0000-000000000000";
- */
+ token_mapping["auth_username"] = session->username;
+ token_mapping["auth_session"] = session->session;
+ token_mapping["auth_access_token"] = session->access_token;
+ token_mapping["auth_player_name"] = session->player_name;
+ token_mapping["auth_uuid"] = session->uuid;
// these do nothing and are stupid.
token_mapping["profile_name"] = name();
@@ -168,17 +162,8 @@ QStringList OneSixInstance::processMinecraftArgs(MojangAccountPtr account)
QString absAssetsDir = QDir("assets/").absolutePath();
token_mapping["game_assets"] = reconstructAssets(d->version).absolutePath();
- auto user = account->user();
- QJsonObject userAttrs;
- for (auto key : user.properties.keys())
- {
- auto array = QJsonArray::fromStringList(user.properties.values(key));
- userAttrs.insert(key, array);
- }
- QJsonDocument value(userAttrs);
-
- token_mapping["user_properties"] = value.toJson(QJsonDocument::Compact);
- token_mapping["user_type"] = account->currentProfile()->legacy ? "legacy" : "mojang";
+ 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"] = version->assets;
@@ -191,7 +176,7 @@ QStringList OneSixInstance::processMinecraftArgs(MojangAccountPtr account)
return parts;
}
-MinecraftProcess *OneSixInstance::prepareForLaunch(MojangAccountPtr account)
+MinecraftProcess *OneSixInstance::prepareForLaunch(AuthSessionPtr session)
{
I_D(OneSixInstance);
@@ -216,7 +201,7 @@ MinecraftProcess *OneSixInstance::prepareForLaunch(MojangAccountPtr account)
}
launchScript += "mainClass " + version->mainClass + "\n";
- for (auto param : processMinecraftArgs(account))
+ for (auto param : processMinecraftArgs(session))
{
launchScript += "param " + param + "\n";
}