Improved platform detection

This commit is contained in:
WolverinDEV 2020-01-24 22:27:54 +01:00
parent 43c4277b04
commit 77a7c23a62
4 changed files with 19 additions and 2 deletions

View File

@ -11,6 +11,9 @@
#include <src/geo/GeoLocation.h>
#include <misc/strobf.h>
#define _stringify(x) #x
#define stringify(x) _stringify(x)
using namespace std;
using namespace std::chrono;
using namespace ts;
@ -1145,7 +1148,7 @@ std::deque<std::shared_ptr<EntryBinding>> config::create_bindings() {
BIND_GROUP(server)
{
CREATE_BINDING("platform", PREMIUM_ONLY | FLAG_RELOADABLE);
BIND_STRING(config::server::DefaultServerPlatform, strobf("Linux").string());
BIND_STRING(config::server::DefaultServerPlatform, build::platform());
ADD_DESCRIPTION("The displayed platform to the client");
ADD_NOTE("This option is only for the premium version.");
ADD_NOTE_RELOADABLE();

View File

@ -1,5 +1,6 @@
#include <iostream>
#include <sstream>
#include <misc/strobf.h>
#include "build.h"
#ifndef BUILD_MAJOR
@ -70,4 +71,16 @@ namespace build {
//return R"([0-9]{1,5}\.[0-9]{1,5}\.[0-9]{1,5}(\-.*)?)";
return R"([0-9]{1,5}\.[0-9]{1,5}\.[0-9]{1,5}(-\S+( \[[Bb]uild: \d+\])?)?)";
}
std::string platform() {
#if defined(__aarch64__)
return strobf("arm64v8").string(); /* no port yet */
#elseif defined(_M_ARM)
return strobf("arm32v" STR2(_M_ARM)).string();
#elseif defined(WIN32)
return strobf("Windows").string(); /* no port yet */
#else
return strobf("Linux").string();
#endif
}
}

View File

@ -60,4 +60,5 @@ namespace build {
extern int buildCount();
extern std::string pattern();
extern std::string platform();
}

2
shared

@ -1 +1 @@
Subproject commit deeba1b73ebdc4aaa07c36b9c0b97e21511356df
Subproject commit a829f705d21267f2252d5aa84fb6213460b1ea33