summaryrefslogtreecommitdiff
path: root/games/multimc/files/patch-api_logic_minecraft_launch_PrintInstanceInfo.cpp
diff options
context:
space:
mode:
authorTobias Kortkamp <tobik@FreeBSD.org>2018-06-06 15:54:57 +0000
committerTobias Kortkamp <tobik@FreeBSD.org>2018-06-06 15:54:57 +0000
commit0ab76735dc6b38ccc38049f466bfd5912fea688e (patch)
tree266fef7eff13f5868b58ec455ad6d545e4c40ad0 /games/multimc/files/patch-api_logic_minecraft_launch_PrintInstanceInfo.cpp
parentRemove expired port: (diff)
New port: games/multimc
MultiMC is a custom launcher for Minecraft that allows you to easily manage multiple installations of Minecraft at once. It also allows you to easily install and remove mods by simply dragging and dropping. WWW: https://multimc.org PR: 224823 Submitted by: tsundoku <me@tsundoku.ne.jp> (based on)
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.cpp62
1 files changed, 62 insertions, 0 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
new file mode 100644
index 000000000000..409aa64c3c5f
--- /dev/null
+++ b/games/multimc/files/patch-api_logic_minecraft_launch_PrintInstanceInfo.cpp
@@ -0,0 +1,62 @@
+--- api/logic/minecraft/launch/PrintInstanceInfo.cpp.orig 2017-12-18 00:19:43 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);
+
++#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
++
++ char buff[512];
++
+ #ifdef Q_OS_LINUX
+ 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++;
+ }
+ }
++#elif defined(Q_OS_FREEBSD)
++
++ std::string strcard;
++
++ FILE *fp3 = popen("sysctl hw.model", "r");
++ if (fp3 != NULL)
++ {
++ fgets(buff, 512, fp3);
++ std::string str(buff);
++ QStringList clines = (QStringList() << QString::fromStdString(str.substr(10, std::string::npos)));
++ logLines(clines, MessageLevel::MultiMC);
++ }
++
++ FILE *fp4 = popen("pciconf -lv -a vgapci0", "r");
++ if (fp4 != 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)
++ {
++ 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);
++ }
++ }
++ }
++#endif
+
+ FILE *fp2 = popen("glxinfo", "r");
+ if (fp2 != NULL)