diff options
author | Steve Wills <swills@FreeBSD.org> | 2019-03-18 17:53:39 +0000 |
---|---|---|
committer | Steve Wills <swills@FreeBSD.org> | 2019-03-18 17:53:39 +0000 |
commit | 63bab8f70465940b841c3a24aeed2db14ad5fb3a (patch) | |
tree | 846e0cab2d6d95a550c27ac3a743fcbe6963f298 /games/multimc/files/patch-api_logic_minecraft_launch_PrintInstanceInfo.cpp | |
parent | sysutils/fusefs-s3fs: Update to 1.85 (diff) |
games/multimc: update to 0.6.5
PR: 236488
Submitted by: tsundoku <me@tsundoku.ne.jp> (maintainer)
Diffstat (limited to 'games/multimc/files/patch-api_logic_minecraft_launch_PrintInstanceInfo.cpp')
-rw-r--r-- | games/multimc/files/patch-api_logic_minecraft_launch_PrintInstanceInfo.cpp | 112 |
1 files changed, 62 insertions, 50 deletions
diff --git a/games/multimc/files/patch-api_logic_minecraft_launch_PrintInstanceInfo.cpp b/games/multimc/files/patch-api_logic_minecraft_launch_PrintInstanceInfo.cpp index 409aa64c3c5f..be5c158fa55a 100644 --- a/games/multimc/files/patch-api_logic_minecraft_launch_PrintInstanceInfo.cpp +++ b/games/multimc/files/patch-api_logic_minecraft_launch_PrintInstanceInfo.cpp @@ -1,62 +1,74 @@ ---- api/logic/minecraft/launch/PrintInstanceInfo.cpp.orig 2017-12-18 00:19:43 UTC +--- api/logic/minecraft/launch/PrintInstanceInfo.cpp.orig 2019-03-07 21:42:07 UTC +++ api/logic/minecraft/launch/PrintInstanceInfo.cpp -@@ -24,6 +24,10 @@ void PrintInstanceInfo::executeTask() - auto instance = m_parent->instance(); - auto lines = instance->verboseDescription(m_session); - +@@ -19,8 +19,9 @@ + #include "PrintInstanceInfo.h" + #include <launch/LaunchTask.h> + +-#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) -+ -+ char buff[512]; -+ - #ifdef Q_OS_LINUX + namespace { ++#if defined(Q_OS_LINUX) + void probeProcCpuinfo(QStringList &log) + { std::ifstream cpuin("/proc/cpuinfo"); - for (std::string line; std::getline(cpuin, line);) -@@ -36,7 +40,6 @@ void PrintInstanceInfo::executeTask() - } - } - -- char buff[512]; - int gpuline = -1; - int cline = 0; - FILE *fp = popen("lspci -k", "r"); -@@ -64,6 +67,40 @@ void PrintInstanceInfo::executeTask() - cline++; - } +@@ -66,7 +67,44 @@ void runLspci(QStringList &log) } + pclose(lspci); + } +#elif defined(Q_OS_FREEBSD) -+ -+ std::string strcard; -+ -+ FILE *fp3 = popen("sysctl hw.model", "r"); -+ if (fp3 != NULL) ++void runSysctlHwModel(QStringList &log) ++{ ++ char buff[512]; ++ FILE *hwmodel = popen("sysctl hw.model", "r"); ++ while (fgets(buff, 512, hwmodel) != NULL) + { -+ fgets(buff, 512, fp3); -+ std::string str(buff); -+ QStringList clines = (QStringList() << QString::fromStdString(str.substr(10, std::string::npos))); -+ logLines(clines, MessageLevel::MultiMC); ++ log << QString::fromUtf8(buff); ++ break; + } -+ -+ FILE *fp4 = popen("pciconf -lv -a vgapci0", "r"); -+ if (fp4 != NULL) ++ 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) + { -+ while (fgets(buff, 512, fp4) != 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) + { -+ 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))); -+ QStringList glines = (QStringList() << QString::fromStdString(strcard)); -+ logLines(glines, MessageLevel::MultiMC); -+ } ++ 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 - - FILE *fp2 = popen("glxinfo", "r"); - if (fp2 != NULL) ++ + void runGlxinfo(QStringList & log) + { + // FIXME: fixed size buffers... +@@ -94,10 +132,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::MultiMC); |