OpenTTD Source: src/os/macosx/survey_osx.cpp Source File

OpenTTD Source 14.0-RC3

survey_osx.cpp
Go to the documentation of this file.
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
10 #include "../../stdafx.h"
11
12 #include "../../3rdparty/fmt/format.h"
13 #include "../../survey.h"
14 #include "macos.h"
15
16 #include <mach-o/arch.h>
17 #include <thread>
18
19 #include "../../safeguards.h"
20
21 void SurveyOS(nlohmann::json &json)
22 {
23 int ver_maj, ver_min, ver_bug;
24 GetMacOSVersion(&ver_maj, &ver_min, &ver_bug);
25
26 const NXArchInfo *arch = NXGetLocalArchInfo();
27
28 json["os"] = "MacOS";
29 json["release"] = fmt::format("{}.{}.{}", ver_maj, ver_min, ver_bug);
30 json["machine"] = arch != nullptr ? arch->description : "unknown";
31 json["min_ver"] = MAC_OS_X_VERSION_MIN_REQUIRED;
32 json["max_ver"] = MAC_OS_X_VERSION_MAX_ALLOWED;
33
34 json["memory"] = SurveyMemoryToText(MacOSGetPhysicalMemory());
35 json["hardware_concurrency"] = std::thread::hardware_concurrency();
36 }
SurveyMemoryToText
std::string SurveyMemoryToText(uint64_t memory)
Change the bytes of memory into a textual version rounded up to the biggest unit.
Definition: survey.cpp:492
macos.h