OpenTTD Source 20260129-master-g2bb01bd0e4
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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
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
21void SurveyOS(nlohmann::json &json)
22{
23 auto [ver_major, ver_minor, ver_patch] = GetMacOSVersion();
24
25 const NXArchInfo *arch = NXGetLocalArchInfo();
26
27 json["os"] = "MacOS";
28 json["release"] = fmt::format("{}.{}.{}", ver_major, ver_minor, ver_patch);
29 json["machine"] = arch != nullptr ? arch->description : "unknown";
30 json["min_ver"] = MAC_OS_X_VERSION_MIN_REQUIRED;
31 json["max_ver"] = MAC_OS_X_VERSION_MAX_ALLOWED;
32
34 json["hardware_concurrency"] = std::thread::hardware_concurrency();
35}
Functions related to MacOS support.
std::tuple< int, int, int > GetMacOSVersion()
Get the version of the MacOS we are running under.
Definition macos.mm:32
uint64_t MacOSGetPhysicalMemory()
Ask OS how much RAM it has physically attached.
Definition macos.mm:192
std::string SurveyMemoryToText(uint64_t memory)
Change the bytes of memory into a textual version rounded up to the biggest unit.
Definition survey.cpp:488