aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILD.md10
-rw-r--r--CMakeLists.txt3
-rw-r--r--launcher/Application.cpp2
-rw-r--r--launcher/DesktopServices.cpp12
-rw-r--r--launcher/FileSystem.cpp2
-rw-r--r--launcher/InstanceImportTask.cpp8
-rw-r--r--launcher/LaunchController.cpp63
-rw-r--r--launcher/UpdateController.cpp2
-rw-r--r--launcher/Version.cpp2
-rw-r--r--launcher/java/JavaUtils.cpp4
-rw-r--r--launcher/meta/BaseEntity.cpp4
-rw-r--r--launcher/minecraft/AssetsUtils.cpp4
-rw-r--r--launcher/minecraft/MinecraftInstance.cpp10
-rw-r--r--launcher/minecraft/OpSys.cpp4
-rw-r--r--launcher/minecraft/OpSys.h13
-rw-r--r--launcher/minecraft/auth/AuthSession.cpp5
-rw-r--r--launcher/minecraft/auth/AuthSession.h4
-rw-r--r--launcher/minecraft/auth/Parsers.cpp2
-rw-r--r--launcher/minecraft/launch/ClaimAccount.cpp2
-rw-r--r--launcher/minecraft/launch/ExtractNatives.cpp7
-rw-r--r--launcher/minecraft/launch/PrintInstanceInfo.cpp45
-rw-r--r--launcher/minecraft/launch/VerifyJavaInstall.cpp7
-rw-r--r--launcher/minecraft/update/AssetUpdateTask.cpp9
-rw-r--r--launcher/minecraft/update/FMLLibrariesTask.cpp4
-rw-r--r--launcher/minecraft/update/LibrariesTask.cpp4
-rw-r--r--launcher/modplatform/atlauncher/ATLPackInstallTask.cpp12
-rw-r--r--launcher/modplatform/flame/FileResolvingTask.cpp4
-rw-r--r--launcher/modplatform/legacy_ftb/PackFetchTask.cpp8
-rw-r--r--launcher/modplatform/legacy_ftb/PackInstallTask.cpp4
-rw-r--r--launcher/modplatform/modpacksch/FTBPackInstallTask.cpp11
-rw-r--r--launcher/modplatform/technic/SingleZipPackInstallTask.cpp4
-rw-r--r--launcher/modplatform/technic/SolderPackInstallTask.cpp12
-rw-r--r--launcher/net/NetJob.h15
-rw-r--r--launcher/news/NewsChecker.cpp4
-rw-r--r--launcher/notifications/NotificationChecker.cpp4
-rw-r--r--launcher/tools/MCEditTool.cpp2
-rw-r--r--launcher/translations/TranslationsModel.cpp8
-rw-r--r--launcher/ui/dialogs/AboutDialog.cpp4
-rw-r--r--launcher/ui/dialogs/UpdateDialog.cpp4
-rw-r--r--launcher/ui/pages/instance/ScreenshotsPage.cpp13
-rw-r--r--launcher/ui/pages/modplatform/atlauncher/AtlListModel.cpp8
-rw-r--r--launcher/ui/pages/modplatform/flame/FlameModel.cpp8
-rw-r--r--launcher/ui/pages/modplatform/flame/FlamePage.cpp4
-rw-r--r--launcher/ui/pages/modplatform/ftb/FtbListModel.cpp15
-rw-r--r--launcher/ui/pages/modplatform/legacy_ftb/ListModel.cpp4
-rw-r--r--launcher/ui/pages/modplatform/technic/TechnicModel.cpp8
-rw-r--r--launcher/ui/pages/modplatform/technic/TechnicPage.cpp6
-rw-r--r--launcher/ui/widgets/JavaSettingsWidget.cpp2
-rw-r--r--launcher/updater/DownloadTask.cpp8
-rw-r--r--launcher/updater/DownloadTask_test.cpp3
-rw-r--r--launcher/updater/UpdateChecker.cpp8
-rw-r--r--libraries/iconfix/internal/qiconloader.cpp2
-rw-r--r--libraries/systeminfo/src/sys_unix.cpp14
53 files changed, 268 insertions, 163 deletions
diff --git a/BUILD.md b/BUILD.md
index 42869ecc..2345d6ad 100644
--- a/BUILD.md
+++ b/BUILD.md
@@ -193,11 +193,19 @@ zlib1.dll
# macOS
### Install prerequisites:
-- Install XCode and set it up to the point where you can build things from a terminal
+- Install XCode Command Line tools
- Install the official build of CMake (https://cmake.org/download/)
- Install JDK 8 (https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html)
- Get Qt 5.6 and install it (https://download.qt.io/new_archive/qt/5.6/5.6.3/)
+### XCode Command Line tools
+
+If you don't have XCode CommandLine tools installed, you can install them by using this command in the Terminal App
+
+```bash
+xcode-select --install
+```
+
### Build
Pick an installation path - this is where the final `.app` will be constructed when you run `make install`. Supply it as the `CMAKE_INSTALL_PREFIX` argument during CMake configuration.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 27b37c97..5b89ff6b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,6 +47,9 @@ if(UNIX AND APPLE)
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Werror=return-type")
+# Fix build with Qt 5.13
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_NO_DEPRECATED_WARNINGS=Y")
+
##################################### Set Application options #####################################
######## Set URLs ########
diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index 8e0d6c33..cbfdcbe2 100644
--- a/launcher/Application.cpp
+++ b/launcher/Application.cpp
@@ -523,7 +523,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
// Set up paths
{
// Root path is used for updates.
-#ifdef Q_OS_LINUX
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
QDir foo(FS::PathCombine(binPath, ".."));
m_rootPath = foo.absolutePath();
#elif defined(Q_OS_WIN32)
diff --git a/launcher/DesktopServices.cpp b/launcher/DesktopServices.cpp
index 5368ddc8..dcc1b0ce 100644
--- a/launcher/DesktopServices.cpp
+++ b/launcher/DesktopServices.cpp
@@ -7,7 +7,7 @@
/**
* This shouldn't exist, but until QTBUG-9328 and other unreported bugs are fixed, it needs to be a thing.
*/
-#if defined(Q_OS_LINUX)
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
#include <unistd.h>
#include <errno.h>
@@ -83,7 +83,7 @@ bool openDirectory(const QString &path, bool ensureExists)
{
return QDesktopServices::openUrl(QUrl::fromLocalFile(dir.absolutePath()));
};
-#if defined(Q_OS_LINUX)
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
return IndirectOpen(f);
#else
return f();
@@ -97,7 +97,7 @@ bool openFile(const QString &path)
{
return QDesktopServices::openUrl(QUrl::fromLocalFile(path));
};
-#if defined(Q_OS_LINUX)
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
return IndirectOpen(f);
#else
return f();
@@ -107,7 +107,7 @@ bool openFile(const QString &path)
bool openFile(const QString &application, const QString &path, const QString &workingDirectory, qint64 *pid)
{
qDebug() << "Opening file" << path << "using" << application;
-#if defined(Q_OS_LINUX)
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
// FIXME: the pid here is fake. So if something depends on it, it will likely misbehave
return IndirectOpen([&]()
{
@@ -121,7 +121,7 @@ bool openFile(const QString &application, const QString &path, const QString &wo
bool run(const QString &application, const QStringList &args, const QString &workingDirectory, qint64 *pid)
{
qDebug() << "Running" << application << "with args" << args.join(' ');
-#if defined(Q_OS_LINUX)
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
// FIXME: the pid here is fake. So if something depends on it, it will likely misbehave
return IndirectOpen([&]()
{
@@ -139,7 +139,7 @@ bool openUrl(const QUrl &url)
{
return QDesktopServices::openUrl(url);
};
-#if defined(Q_OS_LINUX)
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
return IndirectOpen(f);
#else
return f();
diff --git a/launcher/FileSystem.cpp b/launcher/FileSystem.cpp
index 13f05b86..6de20de6 100644
--- a/launcher/FileSystem.cpp
+++ b/launcher/FileSystem.cpp
@@ -403,7 +403,7 @@ QString getDesktopDir()
bool createShortCut(QString location, QString dest, QStringList args, QString name,
QString icon)
{
-#if defined Q_OS_LINUX
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
location = PathCombine(location, name + ".desktop");
QFile f(location);
diff --git a/launcher/InstanceImportTask.cpp b/launcher/InstanceImportTask.cpp
index d0a63fe3..8cd68d7b 100644
--- a/launcher/InstanceImportTask.cpp
+++ b/launcher/InstanceImportTask.cpp
@@ -55,14 +55,14 @@ void InstanceImportTask::executeTask()
const QString path = m_sourceUrl.host() + '/' + m_sourceUrl.path();
auto entry = APPLICATION->metacache()->resolveEntry("general", path);
entry->setStale(true);
- m_filesNetJob.reset(new NetJob(tr("Modpack download")));
+ m_filesNetJob = new NetJob(tr("Modpack download"), APPLICATION->network());
m_filesNetJob->addNetAction(Net::Download::makeCached(m_sourceUrl, entry));
m_archivePath = entry->getFullPath();
auto job = m_filesNetJob.get();
connect(job, &NetJob::succeeded, this, &InstanceImportTask::downloadSucceeded);
connect(job, &NetJob::progress, this, &InstanceImportTask::downloadProgressChanged);
connect(job, &NetJob::failed, this, &InstanceImportTask::downloadFailed);
- m_filesNetJob->start(APPLICATION->network());
+ m_filesNetJob->start();
}
}
@@ -337,7 +337,7 @@ void InstanceImportTask::processFlame()
connect(m_modIdResolver.get(), &Flame::FileResolvingTask::succeeded, [&]()
{
auto results = m_modIdResolver->getResults();
- m_filesNetJob.reset(new NetJob(tr("Mod download")));
+ m_filesNetJob = new NetJob(tr("Mod download"), APPLICATION->network());
for(auto result: results.files)
{
QString filename = result.fileName;
@@ -391,7 +391,7 @@ void InstanceImportTask::processFlame()
setProgress(current, total);
});
setStatus(tr("Downloading mods..."));
- m_filesNetJob->start(APPLICATION->network());
+ m_filesNetJob->start();
}
);
connect(m_modIdResolver.get(), &Flame::FileResolvingTask::failed, [&](QString reason)
diff --git a/launcher/LaunchController.cpp b/launcher/LaunchController.cpp
index be12eb79..7750be1a 100644
--- a/launcher/LaunchController.cpp
+++ b/launcher/LaunchController.cpp
@@ -16,6 +16,7 @@
#include <QHostInfo>
#include <QList>
#include <QHostAddress>
+#include <QPushButton>
#include "BuildConfig.h"
#include "JavaCommon.h"
@@ -145,36 +146,44 @@ void LaunchController::login() {
m_session->MakeOffline(usedname);
// offline flavored game from here :3
}
- if(m_accountToUse->ownsMinecraft() && !m_accountToUse->hasProfile()) {
- auto entitlement = m_accountToUse->accountData()->minecraftEntitlement;
- QString errorString;
- if(!entitlement.canPlayMinecraft) {
- errorString = tr("The account does not own Minecraft. You need to purchase the game first to play it.");
- QMessageBox::warning(
- nullptr,
- tr("Missing Minecraft profile"),
- errorString,
- QMessageBox::StandardButton::Ok,
- QMessageBox::StandardButton::Ok
- );
- emitFailed(errorString);
- return;
- }
- // Now handle setting up a profile name here...
- ProfileSetupDialog dialog(m_accountToUse, m_parentWidget);
- if (dialog.exec() == QDialog::Accepted)
- {
- tryagain = true;
- continue;
- }
- else
- {
- emitFailed(tr("Received undetermined session status during login."));
- return;
+ if(m_accountToUse->ownsMinecraft()) {
+ if(!m_accountToUse->hasProfile()) {
+ // Now handle setting up a profile name here...
+ ProfileSetupDialog dialog(m_accountToUse, m_parentWidget);
+ if (dialog.exec() == QDialog::Accepted)
+ {
+ tryagain = true;
+ continue;
+ }
+ else
+ {
+ emitFailed(tr("Received undetermined session status during login."));
+ return;
+ }
}
+ // we own Minecraft, there is a profile, it's all ready to go!
+ launchInstance();
+ return;
}
else {
- launchInstance();
+ // play demo ?
+ QMessageBox box(m_parentWidget);
+ box.setWindowTitle(tr("Play demo?"));
+ box.setText(tr("This account does not own Minecraft.\nYou need to purchase the game first to play it.\n\nDo you want to play the demo?"));
+ box.setIcon(QMessageBox::Warning);
+ auto demoButton = box.addButton(tr("Play Demo"), QMessageBox::ButtonRole::YesRole);
+ auto cancelButton = box.addButton(tr("Cancel"), QMessageBox::ButtonRole::NoRole);
+ box.setDefaultButton(cancelButton);
+
+ box.exec();
+ if(box.clickedButton() == demoButton) {
+ // play demo here
+ m_session->MakeDemo();
+ launchInstance();
+ }
+ else {
+ emitFailed(tr("Launch cancelled - account does not own Minecraft."));
+ }
}
return;
}
diff --git a/launcher/UpdateController.cpp b/launcher/UpdateController.cpp
index 136e22fd..f9b7d349 100644
--- a/launcher/UpdateController.cpp
+++ b/launcher/UpdateController.cpp
@@ -93,7 +93,7 @@ void UpdateController::installUpdates()
qDebug() << "Installing updates.";
#ifdef Q_OS_WIN
QString finishCmd = QApplication::applicationFilePath();
-#elif defined Q_OS_LINUX
+#elif defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
QString finishCmd = FS::PathCombine(m_root, BuildConfig.LAUNCHER_NAME);
#elif defined Q_OS_MAC
QString finishCmd = QApplication::applicationFilePath();
diff --git a/launcher/Version.cpp b/launcher/Version.cpp
index 6392a50f..b9090e29 100644
--- a/launcher/Version.cpp
+++ b/launcher/Version.cpp
@@ -78,7 +78,7 @@ void Version::parse()
// FIXME: this is bad. versions can contain a lot more separators...
QStringList parts = m_string.split('.');
- for (const auto &part : parts)
+ for (const auto& part : parts)
{
m_sections.append(Section(part));
}
diff --git a/launcher/java/JavaUtils.cpp b/launcher/java/JavaUtils.cpp
index 780b23f2..8249fc29 100644
--- a/launcher/java/JavaUtils.cpp
+++ b/launcher/java/JavaUtils.cpp
@@ -31,7 +31,7 @@ JavaUtils::JavaUtils()
{
}
-#ifdef Q_OS_LINUX
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
static QString processLD_LIBRARY_PATH(const QString & LD_LIBRARY_PATH)
{
QDir mmcBin(QCoreApplication::applicationDirPath());
@@ -83,7 +83,7 @@ QProcessEnvironment CleanEnviroment()
qDebug() << "Env: ignoring" << key << value;
continue;
}
-#ifdef Q_OS_LINUX
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
// Do not pass LD_* variables to java. They were intended for MultiMC
if(key.startsWith("LD_"))
{
diff --git a/launcher/meta/BaseEntity.cpp b/launcher/meta/BaseEntity.cpp
index a9d62fcd..84155922 100644
--- a/launcher/meta/BaseEntity.cpp
+++ b/launcher/meta/BaseEntity.cpp
@@ -117,7 +117,7 @@ void Meta::BaseEntity::load(Net::Mode loadType)
{
return;
}
- m_updateTask = new NetJob(QObject::tr("Download of meta file %1").arg(localFilename()));
+ m_updateTask = new NetJob(QObject::tr("Download of meta file %1").arg(localFilename()), APPLICATION->network());
auto url = this->url();
auto entry = APPLICATION->metacache()->resolveEntry("meta", localFilename());
entry->setStale(true);
@@ -140,7 +140,7 @@ void Meta::BaseEntity::load(Net::Mode loadType)
m_updateStatus = UpdateStatus::Failed;
m_updateTask.reset();
});
- m_updateTask->start(APPLICATION->network());
+ m_updateTask->start();
}
bool Meta::BaseEntity::isLoaded() const
diff --git a/launcher/minecraft/AssetsUtils.cpp b/launcher/minecraft/AssetsUtils.cpp
index 1c65a212..7290aeb4 100644
--- a/launcher/minecraft/AssetsUtils.cpp
+++ b/launcher/minecraft/AssetsUtils.cpp
@@ -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();
diff --git a/launcher/minecraft/MinecraftInstance.cpp b/launcher/minecraft/MinecraftInstance.cpp
index 2526e620..0b3c049b 100644
--- a/launcher/minecraft/MinecraftInstance.cpp
+++ b/launcher/minecraft/MinecraftInstance.cpp
@@ -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
diff --git a/launcher/minecraft/OpSys.cpp b/launcher/minecraft/OpSys.cpp
index f6a4ed1c..093ec419 100644
--- a/launcher/minecraft/OpSys.cpp
+++ b/launcher/minecraft/OpSys.cpp
@@ -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:
diff --git a/launcher/minecraft/OpSys.h b/launcher/minecraft/OpSys.h
index 63c750b1..0936f817 100644
--- a/launcher/minecraft/OpSys.h
+++ b/launcher/minecraft/OpSys.h
@@ -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 \ No newline at end of file
diff --git a/launcher/minecraft/auth/AuthSession.cpp b/launcher/minecraft/auth/AuthSession.cpp
index d44f9098..6bea74a3 100644
--- a/launcher/minecraft/auth/AuthSession.cpp
+++ b/launcher/minecraft/auth/AuthSession.cpp
@@ -30,3 +30,8 @@ bool AuthSession::MakeOffline(QString offline_playername)
status = PlayableOffline;
return true;
}
+
+void AuthSession::MakeDemo() {
+ player_name = "Player";
+ demo = true;
+}
diff --git a/launcher/minecraft/auth/AuthSession.h b/launcher/minecraft/auth/AuthSession.h
index 55fbdf39..a75df506 100644
--- a/launcher/minecraft/auth/AuthSession.h
+++ b/launcher/minecraft/auth/AuthSession.h
@@ -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;
diff --git a/launcher/minecraft/auth/Parsers.cpp b/launcher/minecraft/auth/Parsers.cpp
index 4cab78ef..ed31e934 100644
--- a/launcher/minecraft/auth/Parsers.cpp
+++ b/launcher/minecraft/auth/Parsers.cpp
@@ -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) {
diff --git a/launcher/minecraft/launch/ClaimAccount.cpp b/launcher/minecraft/launch/ClaimAccount.cpp
index bb4f6806..1cd7c0da 100644
--- a/launcher/minecraft/launch/ClaimAccount.cpp
+++ b/launcher/minecraft/launch/ClaimAccount.cpp
@@ -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);
diff --git a/launcher/minecraft/launch/ExtractNatives.cpp b/launcher/minecraft/launch/ExtractNatives.cpp
index d57499aa..8cd439b1 100644
--- a/launcher/minecraft/launch/ExtractNatives.cpp
+++ b/launcher/minecraft/launch/ExtractNatives.cpp
@@ -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))
diff --git a/launcher/minecraft/launch/PrintInstanceInfo.cpp b/launcher/minecraft/launch/PrintInstanceInfo.cpp
index 3da17902..e8fbcb9b 100644
--- a/launcher/minecraft/launch/PrintInstanceInfo.cpp
+++ b/launcher/minecraft/launch/PrintInstanceInfo.cpp
@@ -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)
+ {