Merge remote-tracking branch 'upstream/develop' into upstream_update
This commit is contained in:
@ -29,6 +29,8 @@
|
||||
#include "net/ChecksumValidator.h"
|
||||
#include "BuildConfig.h"
|
||||
|
||||
#include "Application.h"
|
||||
|
||||
namespace {
|
||||
QSet<QString> collectPathsFromDir(QString dirPath)
|
||||
{
|
||||
@ -318,7 +320,7 @@ QString AssetObject::getRelPath()
|
||||
|
||||
NetJob::Ptr AssetsIndex::getDownloadJob()
|
||||
{
|
||||
auto job = new NetJob(QObject::tr("Assets for %1").arg(id));
|
||||
auto job = new NetJob(QObject::tr("Assets for %1").arg(id), APPLICATION->network());
|
||||
for (auto &object : objects.values())
|
||||
{
|
||||
auto dl = object.getDownloadAction();
|
||||
|
@ -431,8 +431,7 @@ QStringList MinecraftInstance::processMinecraftArgs(
|
||||
|
||||
QMap<QString, QString> token_mapping;
|
||||
// yggdrasil!
|
||||
if(session)
|
||||
{
|
||||
if(session) {
|
||||
// token_mapping["auth_username"] = session->username;
|
||||
token_mapping["auth_session"] = session->session;
|
||||
token_mapping["auth_access_token"] = session->access_token;
|
||||
@ -440,6 +439,9 @@ QStringList MinecraftInstance::processMinecraftArgs(
|
||||
token_mapping["auth_uuid"] = session->uuid;
|
||||
token_mapping["user_properties"] = session->serializeUserProperties();
|
||||
token_mapping["user_type"] = session->user_type;
|
||||
if(session->demo) {
|
||||
args_pattern += " --demo";
|
||||
}
|
||||
}
|
||||
|
||||
// blatant self-promotion.
|
||||
@ -872,7 +874,9 @@ shared_qobject_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPt
|
||||
// if we aren't in offline mode,.
|
||||
if(session->status != AuthSession::PlayableOffline)
|
||||
{
|
||||
process->appendStep(new ClaimAccount(pptr, session));
|
||||
if(!session->demo) {
|
||||
process->appendStep(new ClaimAccount(pptr, session));
|
||||
}
|
||||
process->appendStep(new Update(pptr, Net::Mode::Online));
|
||||
}
|
||||
else
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
OpSys OpSys_fromString(QString name)
|
||||
{
|
||||
if (name == "freebsd")
|
||||
return Os_FreeBSD;
|
||||
if (name == "linux")
|
||||
return Os_Linux;
|
||||
if (name == "windows")
|
||||
@ -30,6 +32,8 @@ QString OpSys_toString(OpSys name)
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case Os_FreeBSD:
|
||||
return "freebsd";
|
||||
case Os_Linux:
|
||||
return "linux";
|
||||
case Os_OSX:
|
||||
|
@ -18,6 +18,7 @@
|
||||
enum OpSys
|
||||
{
|
||||
Os_Windows,
|
||||
Os_FreeBSD,
|
||||
Os_Linux,
|
||||
Os_OSX,
|
||||
Os_Other
|
||||
@ -27,11 +28,11 @@ OpSys OpSys_fromString(QString);
|
||||
QString OpSys_toString(OpSys);
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
#define currentSystem Os_Windows
|
||||
#define currentSystem Os_Windows
|
||||
#elif defined Q_OS_MAC
|
||||
#define currentSystem Os_OSX
|
||||
#elif defined Q_OS_FREEBSD
|
||||
#define currentSystem Os_FreeBSD
|
||||
#else
|
||||
#ifdef Q_OS_MAC
|
||||
#define currentSystem Os_OSX
|
||||
#else
|
||||
#define currentSystem Os_Linux
|
||||
#define currentSystem Os_Linux
|
||||
#endif
|
||||
#endif
|
@ -30,3 +30,8 @@ bool AuthSession::MakeOffline(QString offline_playername)
|
||||
status = PlayableOffline;
|
||||
return true;
|
||||
}
|
||||
|
||||
void AuthSession::MakeDemo() {
|
||||
player_name = "Player";
|
||||
demo = true;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ class QNetworkAccessManager;
|
||||
struct AuthSession
|
||||
{
|
||||
bool MakeOffline(QString offline_playername);
|
||||
void MakeDemo();
|
||||
|
||||
QString serializeUserProperties();
|
||||
|
||||
@ -43,6 +44,9 @@ struct AuthSession
|
||||
bool auth_server_online = false;
|
||||
// Did the user request online mode?
|
||||
bool wants_online = true;
|
||||
|
||||
//Is this a demo session?
|
||||
bool demo = false;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<AuthSession> AuthSessionPtr;
|
||||
|
@ -226,6 +226,8 @@ bool parseMinecraftEntitlements(QByteArray & data, MinecraftEntitlement &output)
|
||||
}
|
||||
|
||||
auto obj = doc.object();
|
||||
output.canPlayMinecraft = false;
|
||||
output.ownsMinecraft = false;
|
||||
|
||||
auto itemsArray = obj.value("items").toArray();
|
||||
for(auto item: itemsArray) {
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
ClaimAccount::ClaimAccount(LaunchTask* parent, AuthSessionPtr session): LaunchStep(parent)
|
||||
{
|
||||
if(session->status == AuthSession::Status::PlayableOnline)
|
||||
if(session->status == AuthSession::Status::PlayableOnline && !session->demo)
|
||||
{
|
||||
auto accounts = APPLICATION->accounts();
|
||||
m_account = accounts->getAccountByProfileName(session->player_name);
|
||||
|
@ -23,6 +23,13 @@
|
||||
#include "FileSystem.h"
|
||||
#include <QDir>
|
||||
|
||||
#ifdef major
|
||||
#undef major
|
||||
#endif
|
||||
#ifdef minor
|
||||
#undef minor
|
||||
#endif
|
||||
|
||||
static QString replaceSuffix (QString target, const QString &suffix, const QString &replacement)
|
||||
{
|
||||
if (!target.endsWith(suffix))
|
||||
|
@ -19,8 +19,9 @@
|
||||
#include "PrintInstanceInfo.h"
|
||||
#include <launch/LaunchTask.h>
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
|
||||
namespace {
|
||||
#if defined(Q_OS_LINUX)
|
||||
void probeProcCpuinfo(QStringList &log)
|
||||
{
|
||||
std::ifstream cpuin("/proc/cpuinfo");
|
||||
@ -66,7 +67,43 @@ void runLspci(QStringList &log)
|
||||
}
|
||||
pclose(lspci);
|
||||
}
|
||||
#elif defined(Q_OS_FREEBSD)
|
||||
void runSysctlHwModel(QStringList &log)
|
||||
{
|
||||
char buff[512];
|
||||
FILE *hwmodel = popen("sysctl hw.model", "r");
|
||||
while (fgets(buff, 512, hwmodel) != NULL)
|
||||
{
|
||||
log << QString::fromUtf8(buff);
|
||||
break;
|
||||
}
|
||||
pclose(hwmodel);
|
||||
}
|
||||
|
||||
void runPciconf(QStringList &log)
|
||||
{
|
||||
char buff[512];
|
||||
std::string strcard;
|
||||
FILE *pciconf = popen("pciconf -lv -a vgapci0", "r");
|
||||
while (fgets(buff, 512, pciconf) != NULL)
|
||||
{
|
||||
if (strncmp(buff, " vendor", 10) == 0)
|
||||
{
|
||||
std::string str(buff);
|
||||
strcard.append(str.substr(str.find_first_of("'") + 1, str.find_last_not_of("'") - (str.find_first_of("'") + 2)));
|
||||
strcard.append(" ");
|
||||
}
|
||||
else if (strncmp(buff, " device", 10) == 0)
|
||||
{
|
||||
std::string str2(buff);
|
||||
strcard.append(str2.substr(str2.find_first_of("'") + 1, str2.find_last_not_of("'") - (str2.find_first_of("'") + 2)));
|
||||
}
|
||||
log << QString::fromStdString(strcard);
|
||||
break;
|
||||
}
|
||||
pclose(pciconf);
|
||||
}
|
||||
#endif
|
||||
void runGlxinfo(QStringList & log)
|
||||
{
|
||||
// FIXME: fixed size buffers...
|
||||
@ -94,10 +131,14 @@ void PrintInstanceInfo::executeTask()
|
||||
auto instance = m_parent->instance();
|
||||
QStringList log;
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#if defined(Q_OS_LINUX)
|
||||
::probeProcCpuinfo(log);
|
||||
::runLspci(log);
|
||||
::runGlxinfo(log);
|
||||
#elif defined(Q_OS_FREEBSD)
|
||||
::runSysctlHwModel(log);
|
||||
::runPciconf(log);
|
||||
::runGlxinfo(log);
|
||||
#endif
|
||||
|
||||
logLines(log, MessageLevel::Launcher);
|
||||
|
@ -5,6 +5,13 @@
|
||||
#include <minecraft/PackProfile.h>
|
||||
#include <minecraft/VersionFilterData.h>
|
||||
|
||||
#ifdef major
|
||||
#undef major
|
||||
#endif
|
||||
#ifdef minor
|
||||
#undef minor
|
||||
#endif
|
||||
|
||||
void VerifyJavaInstall::executeTask() {
|
||||
auto m_inst = std::dynamic_pointer_cast<MinecraftInstance>(m_parent->instance());
|
||||
|
||||
|
@ -24,7 +24,10 @@ void AssetUpdateTask::executeTask()
|
||||
auto assets = profile->getMinecraftAssets();
|
||||
QUrl indexUrl = assets->url;
|
||||
QString localPath = assets->id + ".json";
|
||||
auto job = new NetJob(tr("Asset index for %1").arg(m_inst->name()));
|
||||
auto job = new NetJob(
|
||||
tr("Asset index for %1").arg(m_inst->name()),
|
||||
APPLICATION->network()
|
||||
);
|
||||
|
||||
auto metacache = APPLICATION->metacache();
|
||||
auto entry = metacache->resolveEntry("asset_indexes", localPath);
|
||||
@ -43,7 +46,7 @@ void AssetUpdateTask::executeTask()
|
||||
connect(downloadJob.get(), &NetJob::progress, this, &AssetUpdateTask::progress);
|
||||
|
||||
qDebug() << m_inst->name() << ": Starting asset index download";
|
||||
downloadJob->start(APPLICATION->network());
|
||||
downloadJob->start();
|
||||
}
|
||||
|
||||
bool AssetUpdateTask::canAbort() const
|
||||
@ -78,7 +81,7 @@ void AssetUpdateTask::assetIndexFinished()
|
||||
connect(downloadJob.get(), &NetJob::succeeded, this, &AssetUpdateTask::emitSucceeded);
|
||||
connect(downloadJob.get(), &NetJob::failed, this, &AssetUpdateTask::assetsFailed);
|
||||
connect(downloadJob.get(), &NetJob::progress, this, &AssetUpdateTask::progress);
|
||||
downloadJob->start(APPLICATION->network());
|
||||
downloadJob->start();
|
||||
return;
|
||||
}
|
||||
emitSucceeded();
|
||||
|
@ -61,7 +61,7 @@ void FMLLibrariesTask::executeTask()
|
||||
|
||||
// download missing libs to our place
|
||||
setStatus(tr("Downloading FML libraries..."));
|
||||
auto dljob = new NetJob("FML libraries");
|
||||
auto dljob = new NetJob("FML libraries", APPLICATION->network());
|
||||
auto metacache = APPLICATION->metacache();
|
||||
for (auto &lib : fmlLibsToProcess)
|
||||
{
|
||||
@ -74,7 +74,7 @@ void FMLLibrariesTask::executeTask()
|
||||
connect(dljob, &NetJob::failed, this, &FMLLibrariesTask::fmllibsFailed);
|
||||
connect(dljob, &NetJob::progress, this, &FMLLibrariesTask::progress);
|
||||
downloadJob.reset(dljob);
|
||||
downloadJob->start(APPLICATION->network());
|
||||
downloadJob->start();
|
||||
}
|
||||
|
||||
bool FMLLibrariesTask::canAbort() const
|
||||
|
@ -20,7 +20,7 @@ void LibrariesTask::executeTask()
|
||||
auto components = inst->getPackProfile();
|
||||
auto profile = components->getProfile();
|
||||
|
||||
auto job = new NetJob(tr("Libraries for instance %1").arg(inst->name()));
|
||||
auto job = new NetJob(tr("Libraries for instance %1").arg(inst->name()), APPLICATION->network());
|
||||
downloadJob.reset(job);
|
||||
|
||||
auto metacache = APPLICATION->metacache();
|
||||
@ -65,7 +65,7 @@ void LibrariesTask::executeTask()
|
||||
connect(downloadJob.get(), &NetJob::succeeded, this, &LibrariesTask::emitSucceeded);
|
||||
connect(downloadJob.get(), &NetJob::failed, this, &LibrariesTask::jarlibFailed);
|
||||
connect(downloadJob.get(), &NetJob::progress, this, &LibrariesTask::progress);
|
||||
downloadJob->start(APPLICATION->network());
|
||||
downloadJob->start();
|
||||
}
|
||||
|
||||
bool LibrariesTask::canAbort() const
|
||||
|
Reference in New Issue
Block a user