Prepare for rework of instance launch/update

Added missing licenses
Added a Java functionality checker (detects 32/64bit java)
Refactor of *Update - no longer based on BaseUpdate, but Task directly
Fixed runner script to not derp up on 32bit linux. Could add more detection and error reporting there.
Resources are now split into graphics and generated. Generated resources are placed in the build tree and included from there.
Used the Java checker in the main settings dialog (TODO: instance settings).
Partial support for ${arch}-using libraries - both 32 and 64 variants of ${arch} are downloaded.
This commit is contained in:
Petr Mrázek
2013-11-24 06:36:16 +01:00
parent 4124faf474
commit ca297fca79
34 changed files with 451 additions and 234 deletions

View File

@@ -44,7 +44,7 @@ LegacyInstance::LegacyInstance(const QString &rootDir, SettingsObject *settings,
settings->registerSetting(new Setting("IntendedJarVersion", ""));
}
BaseUpdate *LegacyInstance::doUpdate()
Task *LegacyInstance::doUpdate()
{
auto list = jarModList();
return new LegacyUpdate(this, this);
@@ -59,7 +59,7 @@ MinecraftProcess *LegacyInstance::prepareForLaunch(LoginResponse response)
pixmap.save(PathCombine(minecraftRoot(), "icon.png"), "PNG");
// extract the legacy launcher
QFile(":/launcher/launcher.jar").copy(PathCombine(minecraftRoot(), LAUNCHER_FILE));
QFile(":/java/launcher.jar").copy(PathCombine(minecraftRoot(), LAUNCHER_FILE));
// set the process arguments
{
@@ -108,11 +108,11 @@ MinecraftProcess *LegacyInstance::prepareForLaunch(LoginResponse response)
args << windowTitle;
args << windowSize;
args << lwjgl;
proc->setMinecraftArguments(args);
proc->setArguments(args);
}
// set the process work path
proc->setMinecraftWorkdir(minecraftRoot());
proc->setWorkdir(minecraftRoot());
return proc;
}
@@ -227,56 +227,18 @@ QString LegacyInstance::instanceConfigFolder() const
return PathCombine(minecraftRoot(), "config");
}
/*
bool LegacyInstance::shouldUpdateCurrentVersion() const
{
QFileInfo jar(runnableJar());
return jar.lastModified().toUTC().toMSecsSinceEpoch() != lastCurrentVersionUpdate();
}
void LegacyInstance::updateCurrentVersion(bool keepCurrent)
{
QFileInfo jar(runnableJar());
if(!jar.exists())
{
setLastCurrentVersionUpdate(0);
setCurrentVersionId("Unknown");
return;
}
qint64 time = jar.lastModified().toUTC().toMSecsSinceEpoch();
setLastCurrentVersionUpdate(time);
if (!keepCurrent)
{
// TODO: Implement GetMinecraftJarVersion function.
QString newVersion =
"Unknown";//javautils::GetMinecraftJarVersion(jar.absoluteFilePath());
setCurrentVersionId(newVersion);
}
}
qint64 LegacyInstance::lastCurrentVersionUpdate() const
{
I_D(LegacyInstance);
return d->m_settings->get ( "lastVersionUpdate" ).value<qint64>();
}
void LegacyInstance::setLastCurrentVersionUpdate ( qint64 val )
{
I_D(LegacyInstance);
d->m_settings->set ( "lastVersionUpdate", val );
}
*/
bool LegacyInstance::shouldRebuild() const
{
I_D(LegacyInstance);
return d->m_settings->get("NeedsRebuild").toBool();
}
void LegacyInstance::setShouldRebuild(bool val)
{
I_D(LegacyInstance);
d->m_settings->set("NeedsRebuild", val);
}
QString LegacyInstance::currentVersionId() const
{
I_D(LegacyInstance);
@@ -294,22 +256,26 @@ QString LegacyInstance::lwjglVersion() const
I_D(LegacyInstance);
return d->m_settings->get("LwjglVersion").toString();
}
void LegacyInstance::setLWJGLVersion(QString val)
{
I_D(LegacyInstance);
d->m_settings->set("LwjglVersion", val);
}
QString LegacyInstance::intendedVersionId() const
{
I_D(LegacyInstance);
return d->m_settings->get("IntendedJarVersion").toString();
}
bool LegacyInstance::setIntendedVersionId(QString version)
{
settings().set("IntendedJarVersion", version);
setShouldUpdate(true);
return true;
}
bool LegacyInstance::shouldUpdate() const
{
I_D(LegacyInstance);
@@ -320,6 +286,7 @@ bool LegacyInstance::shouldUpdate() const
}
return true;
}
void LegacyInstance::setShouldUpdate(bool val)
{
settings().set("ShouldUpdate", val);