diff options
author | Petr Mrázek <peterix@gmail.com> | 2017-05-21 02:34:02 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2017-05-21 02:34:02 +0200 |
commit | 572a6026b57804cd8e9c3a4ccf4dcb1d198b46c7 (patch) | |
tree | 3ac2c164eb4a21392cf0fe44d02b32e93560865e /api/logic/minecraft | |
parent | d70c783de8ae842ea175ee92902c31c088c2ddda (diff) | |
download | MultiMC-572a6026b57804cd8e9c3a4ccf4dcb1d198b46c7.tar MultiMC-572a6026b57804cd8e9c3a4ccf4dcb1d198b46c7.tar.gz MultiMC-572a6026b57804cd8e9c3a4ccf4dcb1d198b46c7.tar.lz MultiMC-572a6026b57804cd8e9c3a4ccf4dcb1d198b46c7.tar.xz MultiMC-572a6026b57804cd8e9c3a4ccf4dcb1d198b46c7.zip |
GH-1895 update LWJGL list during legacy instance update
Diffstat (limited to 'api/logic/minecraft')
-rw-r--r-- | api/logic/minecraft/legacy/LegacyUpdate.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/api/logic/minecraft/legacy/LegacyUpdate.cpp b/api/logic/minecraft/legacy/LegacyUpdate.cpp index 337a3e4e..e263d0de 100644 --- a/api/logic/minecraft/legacy/LegacyUpdate.cpp +++ b/api/logic/minecraft/legacy/LegacyUpdate.cpp @@ -164,6 +164,20 @@ void LegacyUpdate::lwjglStart() { LegacyInstance *inst = (LegacyInstance *)m_inst; + auto list = std::dynamic_pointer_cast<LWJGLVersionList>(ENV.getVersionList("org.lwjgl.legacy")); + if (!list->isLoaded()) + { + setStatus(tr("Checking the LWJGL version list...")); + list->loadList(); + auto task = list->getLoadTask(); + connect(task.get(), &Task::succeeded, this, &LegacyUpdate::lwjglStart); + connect(task.get(), &Task::failed, this, [&](const QString & error) + { + emitFailed(tr("Failed to refresh LWJGL list: %1.").arg(error)); + }); + return; + } + lwjglVersion = inst->lwjglVersion(); lwjglTargetPath = FS::PathCombine(inst->lwjglFolder(), lwjglVersion); lwjglNativesPath = FS::PathCombine(lwjglTargetPath, "natives"); @@ -176,18 +190,11 @@ void LegacyUpdate::lwjglStart() return; } - auto list = std::dynamic_pointer_cast<LWJGLVersionList>(ENV.getVersionList("org.lwjgl.legacy")); - if (!list->isLoaded()) - { - emitFailed("Too soon! Let the LWJGL list load :)"); - return; - } - setStatus(tr("Downloading new LWJGL...")); auto version = std::dynamic_pointer_cast<LWJGLVersion>(list->findVersion(lwjglVersion)); if (!version) { - emitFailed("Game update failed: the selected LWJGL version is invalid."); + emitFailed(QString("Game update failed: the selected LWJGL version is invalid: %1").arg(lwjglVersion)); return; } |