mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-01-17 14:28:30 +01:00
Preprocessor purge round 8: trivial binary macros
This commit is contained in:
parent
9542f98b82
commit
1efafb8d30
24
meson.build
24
meson.build
@ -123,8 +123,6 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
conf_data = configuration_data()
|
conf_data = configuration_data()
|
||||||
conf_data.set('CURL_STATICLIB', false)
|
|
||||||
conf_data.set('ZLIB_WINAPI', false)
|
|
||||||
|
|
||||||
x86_sse_level_str = get_option('x86_sse')
|
x86_sse_level_str = get_option('x86_sse')
|
||||||
if x86_sse_level_str == 'auto'
|
if x86_sse_level_str == 'auto'
|
||||||
@ -278,13 +276,11 @@ endif
|
|||||||
|
|
||||||
if host_platform == 'windows'
|
if host_platform == 'windows'
|
||||||
args_ccomp_win = [ '-D_WIN32_WINNT=0x0501' ]
|
args_ccomp_win = [ '-D_WIN32_WINNT=0x0501' ]
|
||||||
project_c_args += args_ccomp_win
|
|
||||||
project_cpp_args += args_ccomp_win
|
|
||||||
windows_mod = import('windows')
|
windows_mod = import('windows')
|
||||||
if is_static
|
if is_static
|
||||||
conf_data.set('CURL_STATICLIB', true)
|
args_ccomp_win += [ '-DCURL_STATICLIB' ]
|
||||||
if host_arch == 'x86_64'
|
if host_arch == 'x86_64'
|
||||||
conf_data.set('ZLIB_WINAPI', true)
|
args_ccomp_win += [ '-DZLIB_WINAPI' ]
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
foreach input_output_condition : tpt_libs.get_variable('config_dlls')
|
foreach input_output_condition : tpt_libs.get_variable('config_dlls')
|
||||||
@ -302,6 +298,8 @@ if host_platform == 'windows'
|
|||||||
endif
|
endif
|
||||||
endforeach
|
endforeach
|
||||||
endif
|
endif
|
||||||
|
project_c_args += args_ccomp_win
|
||||||
|
project_cpp_args += args_ccomp_win
|
||||||
endif
|
endif
|
||||||
|
|
||||||
project_inc = include_directories([ 'src', 'resources' ])
|
project_inc = include_directories([ 'src', 'resources' ])
|
||||||
@ -329,13 +327,9 @@ conf_data.set('AND', host_platform == 'android')
|
|||||||
conf_data.set('WIN', host_platform == 'windows')
|
conf_data.set('WIN', host_platform == 'windows')
|
||||||
conf_data.set('MACOSX', host_platform == 'darwin')
|
conf_data.set('MACOSX', host_platform == 'darwin')
|
||||||
conf_data.set('X86', is_x86)
|
conf_data.set('X86', is_x86)
|
||||||
conf_data.set('X86_SSE3', x86_sse_level >= 30)
|
|
||||||
conf_data.set('X86_SSE2', x86_sse_level >= 20)
|
|
||||||
conf_data.set('X86_SSE', x86_sse_level >= 10)
|
|
||||||
conf_data.set('_64BIT', is_64bit)
|
|
||||||
conf_data.set('BETA', is_beta)
|
conf_data.set('BETA', is_beta)
|
||||||
conf_data.set('NO_INSTALL_CHECK', not get_option('install_check'))
|
conf_data.set('INSTALL_CHECK', get_option('install_check') ? 'true' : 'false')
|
||||||
conf_data.set('IGNORE_UPDATES', get_option('ignore_updates'))
|
conf_data.set('IGNORE_UPDATES', get_option('ignore_updates') ? 'true' : 'false')
|
||||||
conf_data.set('MOD_ID', mod_id)
|
conf_data.set('MOD_ID', mod_id)
|
||||||
conf_data.set('DEBUG', is_debug)
|
conf_data.set('DEBUG', is_debug)
|
||||||
conf_data.set('SNAPSHOT', is_snapshot)
|
conf_data.set('SNAPSHOT', is_snapshot)
|
||||||
@ -344,11 +338,11 @@ conf_data.set('SNAPSHOT_ID', get_option('snapshot_id'))
|
|||||||
conf_data.set('SERVER', get_option('server'))
|
conf_data.set('SERVER', get_option('server'))
|
||||||
conf_data.set('STATICSERVER', get_option('static_server'))
|
conf_data.set('STATICSERVER', get_option('static_server'))
|
||||||
conf_data.set('UPDATESERVER', update_server)
|
conf_data.set('UPDATESERVER', update_server)
|
||||||
conf_data.set('USE_UPDATESERVER', update_server != '')
|
conf_data.set('USE_UPDATESERVER', update_server != '' ? 'true' : 'false')
|
||||||
conf_data.set('IDENT_PLATFORM', ident_platform)
|
conf_data.set('IDENT_PLATFORM', ident_platform)
|
||||||
conf_data.set('IDENT', '@0@-@1@-@2@'.format(host_arch, host_platform, host_libc).to_upper())
|
conf_data.set('IDENT', '@0@-@1@-@2@'.format(host_arch, host_platform, host_libc).to_upper())
|
||||||
conf_data.set('ENFORCE_HTTPS', enforce_https)
|
conf_data.set('ENFORCE_HTTPS', enforce_https ? 'true' : 'false')
|
||||||
conf_data.set('ALLOW_FAKE_NEWER_VERSION', is_snapshot or is_beta or is_debug or is_mod)
|
conf_data.set('ALLOW_FAKE_NEWER_VERSION', (is_snapshot or is_beta or is_debug or is_mod) ? 'true' : 'false')
|
||||||
conf_data.set('APPNAME', get_option('app_name'))
|
conf_data.set('APPNAME', get_option('app_name'))
|
||||||
conf_data.set('APPCOMMENT', get_option('app_comment'))
|
conf_data.set('APPCOMMENT', get_option('app_comment'))
|
||||||
conf_data.set('APPEXE', app_exe)
|
conf_data.set('APPEXE', app_exe)
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
// Boolean macros (defined / not defined), would be great to get rid of them all.
|
// Boolean macros (defined / not defined), would be great to get rid of them all.
|
||||||
#mesondefine CURL_STATICLIB
|
|
||||||
#mesondefine ZLIB_WINAPI
|
|
||||||
#mesondefine LUACONSOLE
|
#mesondefine LUACONSOLE
|
||||||
#mesondefine NOHTTP
|
#mesondefine NOHTTP
|
||||||
#mesondefine GRAVFFT
|
#mesondefine GRAVFFT
|
||||||
@ -11,22 +9,19 @@
|
|||||||
#mesondefine FONTEDITOR
|
#mesondefine FONTEDITOR
|
||||||
#mesondefine BETA
|
#mesondefine BETA
|
||||||
#mesondefine DEBUG
|
#mesondefine DEBUG
|
||||||
#mesondefine IGNORE_UPDATES
|
|
||||||
#mesondefine LIN
|
#mesondefine LIN
|
||||||
#mesondefine AND
|
#mesondefine AND
|
||||||
#mesondefine NO_INSTALL_CHECK
|
|
||||||
#mesondefine SNAPSHOT
|
#mesondefine SNAPSHOT
|
||||||
#mesondefine MOD
|
#mesondefine MOD
|
||||||
#mesondefine WIN
|
#mesondefine WIN
|
||||||
#mesondefine MACOSX
|
#mesondefine MACOSX
|
||||||
#mesondefine X86
|
#mesondefine X86
|
||||||
#mesondefine X86_SSE
|
|
||||||
#mesondefine X86_SSE2
|
constexpr bool ALLOW_FAKE_NEWER_VERSION = @ALLOW_FAKE_NEWER_VERSION@;
|
||||||
#mesondefine X86_SSE3
|
constexpr bool USE_UPDATESERVER = @USE_UPDATESERVER@;
|
||||||
#mesondefine _64BIT
|
constexpr bool INSTALL_CHECK = @INSTALL_CHECK@;
|
||||||
#mesondefine ENFORCE_HTTPS
|
constexpr bool IGNORE_UPDATES = @IGNORE_UPDATES@;
|
||||||
#mesondefine ALLOW_FAKE_NEWER_VERSION
|
constexpr bool ENFORCE_HTTPS = @ENFORCE_HTTPS@;
|
||||||
#mesondefine USE_UPDATESERVER
|
|
||||||
|
|
||||||
constexpr char SERVER[] = "@SERVER@";
|
constexpr char SERVER[] = "@SERVER@";
|
||||||
constexpr char STATICSERVER[] = "@STATICSERVER@";
|
constexpr char STATICSERVER[] = "@STATICSERVER@";
|
||||||
@ -66,16 +61,6 @@ constexpr char IDENT_RELTYPE[] = "B";
|
|||||||
constexpr char IDENT_RELTYPE[] = "R";
|
constexpr char IDENT_RELTYPE[] = "R";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(X86_SSE3)
|
|
||||||
constexpr char IDENT_BUILD[] = "SSE3";
|
|
||||||
#elif defined(X86_SSE2)
|
|
||||||
constexpr char IDENT_BUILD[] = "SSE2";
|
|
||||||
#elif defined(X86_SSE)
|
|
||||||
constexpr char IDENT_BUILD[] = "SSE";
|
|
||||||
#else
|
|
||||||
constexpr char IDENT_BUILD[] = "NO";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
constexpr char SCHEME[] = "https://";
|
constexpr char SCHEME[] = "https://";
|
||||||
constexpr char STATICSCHEME[] = "https://";
|
constexpr char STATICSCHEME[] = "https://";
|
||||||
constexpr char LOCAL_SAVE_DIR[] = "Saves";
|
constexpr char LOCAL_SAVE_DIR[] = "Saves";
|
||||||
|
@ -5,13 +5,6 @@
|
|||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef X86_SSE
|
|
||||||
#include <xmmintrin.h>
|
|
||||||
#endif
|
|
||||||
#ifdef X86_SSE3
|
|
||||||
#include <pmmintrin.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#if defined(LIN)
|
#if defined(LIN)
|
||||||
# include "icon_exe.png.h"
|
# include "icon_exe.png.h"
|
||||||
|
@ -11,11 +11,9 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
#ifdef X86_SSE
|
#ifdef X86
|
||||||
#include <xmmintrin.h>
|
# include <xmmintrin.h>
|
||||||
#endif
|
# include <pmmintrin.h>
|
||||||
#ifdef X86_SSE3
|
|
||||||
#include <pmmintrin.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -835,10 +833,8 @@ int main(int argc, char * argv[])
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef X86_SSE
|
#ifdef X86
|
||||||
_MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
|
_MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
|
||||||
#endif
|
|
||||||
#ifdef X86_SSE3
|
|
||||||
_MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
|
_MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -142,7 +142,8 @@ void Client::Initialise(ByteString proxy, ByteString cafile, ByteString capath,
|
|||||||
}
|
}
|
||||||
versionCheckRequest->Start();
|
versionCheckRequest->Start();
|
||||||
|
|
||||||
#ifdef USE_UPDATESERVER
|
if constexpr (USE_UPDATESERVER)
|
||||||
|
{
|
||||||
// use an alternate update server
|
// use an alternate update server
|
||||||
alternateVersionCheckRequest = new http::Request(ByteString::Build(SCHEME, UPDATESERVER, "/Startup.json"));
|
alternateVersionCheckRequest = new http::Request(ByteString::Build(SCHEME, UPDATESERVER, "/Startup.json"));
|
||||||
usingAltUpdateServer = true;
|
usingAltUpdateServer = true;
|
||||||
@ -151,7 +152,7 @@ void Client::Initialise(ByteString proxy, ByteString cafile, ByteString capath,
|
|||||||
alternateVersionCheckRequest->AuthHeaders(authUser.Username, "");
|
alternateVersionCheckRequest->AuthHeaders(authUser.Username, "");
|
||||||
}
|
}
|
||||||
alternateVersionCheckRequest->Start();
|
alternateVersionCheckRequest->Start();
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Client::IsFirstRun()
|
bool Client::IsFirstRun()
|
||||||
@ -312,7 +313,8 @@ bool Client::CheckUpdate(http::Request *updateRequest, bool checkSession)
|
|||||||
this->messageOfTheDay = ByteString(objDocument["MessageOfTheDay"].asString()).FromUtf8();
|
this->messageOfTheDay = ByteString(objDocument["MessageOfTheDay"].asString()).FromUtf8();
|
||||||
notifyMessageOfTheDay();
|
notifyMessageOfTheDay();
|
||||||
|
|
||||||
#ifndef IGNORE_UPDATES
|
if constexpr (!IGNORE_UPDATES)
|
||||||
|
{
|
||||||
//Check for updates
|
//Check for updates
|
||||||
Json::Value versions = objDocument["Updates"];
|
Json::Value versions = objDocument["Updates"];
|
||||||
#ifndef SNAPSHOT
|
#ifndef SNAPSHOT
|
||||||
@ -360,7 +362,7 @@ bool Client::CheckUpdate(http::Request *updateRequest, bool checkSession)
|
|||||||
{
|
{
|
||||||
notifyUpdateAvailable();
|
notifyUpdateAvailable();
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (std::exception & e)
|
catch (std::exception & e)
|
||||||
@ -517,13 +519,11 @@ RequestStatus Client::UploadSave(SaveInfo & save)
|
|||||||
lastError = "Cannot serialize game save";
|
lastError = "Cannot serialize game save";
|
||||||
return RequestFailure;
|
return RequestFailure;
|
||||||
}
|
}
|
||||||
#ifdef ALLOW_FAKE_NEWER_VERSION
|
else if (ALLOW_FAKE_NEWER_VERSION && fromNewerVersion && save.GetPublished())
|
||||||
else if (fromNewerVersion && save.GetPublished())
|
|
||||||
{
|
{
|
||||||
lastError = "Cannot publish save, incompatible with latest release version.";
|
lastError = "Cannot publish save, incompatible with latest release version.";
|
||||||
return RequestFailure;
|
return RequestFailure;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
data = http::Request::SimpleAuth(ByteString::Build(SCHEME, SERVER, "/Save.api"), &dataStatus, userID, authUser.SessionID, {
|
data = http::Request::SimpleAuth(ByteString::Build(SCHEME, SERVER, "/Save.api"), &dataStatus, userID, authUser.SessionID, {
|
||||||
{ "Name", save.GetName().ToUtf8() },
|
{ "Name", save.GetName().ToUtf8() },
|
||||||
|
@ -675,19 +675,17 @@ void GameSave::readOPS(const std::vector<char> &data)
|
|||||||
minor = bson_iterator_int(&subiter);
|
minor = bson_iterator_int(&subiter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef ALLOW_FAKE_NEWER_VERSION
|
auto majorToCheck = ALLOW_FAKE_NEWER_VERSION ? FUTURE_SAVE_VERSION : SAVE_VERSION;
|
||||||
if (major > FUTURE_SAVE_VERSION || (major == FUTURE_SAVE_VERSION && minor > FUTURE_MINOR_VERSION))
|
auto minorToCheck = ALLOW_FAKE_NEWER_VERSION ? FUTURE_MINOR_VERSION : MINOR_VERSION;
|
||||||
#else
|
if (major > majorToCheck || (major == majorToCheck && minor > minorToCheck))
|
||||||
if (major > SAVE_VERSION || (major == SAVE_VERSION && minor > MINOR_VERSION))
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
String errorMessage = String::Build("Save from a newer version: Requires version ", major, ".", minor);
|
String errorMessage = String::Build("Save from a newer version: Requires version ", major, ".", minor);
|
||||||
throw ParseException(ParseException::WrongVersion, errorMessage);
|
throw ParseException(ParseException::WrongVersion, errorMessage);
|
||||||
}
|
}
|
||||||
#ifdef ALLOW_FAKE_NEWER_VERSION
|
else if (ALLOW_FAKE_NEWER_VERSION && (major > SAVE_VERSION || (major == SAVE_VERSION && minor > MINOR_VERSION)))
|
||||||
else if (major > SAVE_VERSION || (major == SAVE_VERSION && minor > MINOR_VERSION))
|
{
|
||||||
fakeNewerVersion = true;
|
fakeNewerVersion = true;
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2388,12 +2386,8 @@ std::pair<bool, std::vector<char>> GameSave::serialiseOPS() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fakeFromNewerVersion = false;
|
|
||||||
#ifdef ALLOW_FAKE_NEWER_VERSION
|
|
||||||
// Mark save as incompatible with latest release
|
// Mark save as incompatible with latest release
|
||||||
if (minimumMajorVersion > SAVE_VERSION || (minimumMajorVersion == SAVE_VERSION && minimumMinorVersion > MINOR_VERSION))
|
bool fakeFromNewerVersion = ALLOW_FAKE_NEWER_VERSION && (minimumMajorVersion > SAVE_VERSION || (minimumMajorVersion == SAVE_VERSION && minimumMinorVersion > MINOR_VERSION));
|
||||||
fakeFromNewerVersion = true;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bson b;
|
bson b;
|
||||||
b.data = NULL;
|
b.data = NULL;
|
||||||
@ -2411,7 +2405,6 @@ std::pair<bool, std::vector<char>> GameSave::serialiseOPS() const
|
|||||||
bson_append_int(&b, "modId", MOD_ID);
|
bson_append_int(&b, "modId", MOD_ID);
|
||||||
bson_append_string(&b, "releaseType", IDENT_RELTYPE);
|
bson_append_string(&b, "releaseType", IDENT_RELTYPE);
|
||||||
bson_append_string(&b, "platform", IDENT_PLATFORM);
|
bson_append_string(&b, "platform", IDENT_PLATFORM);
|
||||||
bson_append_string(&b, "builtType", IDENT_BUILD);
|
|
||||||
bson_append_string(&b, "ident", IDENT);
|
bson_append_string(&b, "ident", IDENT);
|
||||||
bson_append_finish_object(&b);
|
bson_append_finish_object(&b);
|
||||||
if (gravityMode == 3)
|
if (gravityMode == 3)
|
||||||
|
@ -230,23 +230,26 @@ namespace http
|
|||||||
}
|
}
|
||||||
|
|
||||||
curl_easy_setopt(easy, CURLOPT_FOLLOWLOCATION, 1L);
|
curl_easy_setopt(easy, CURLOPT_FOLLOWLOCATION, 1L);
|
||||||
|
if constexpr (ENFORCE_HTTPS)
|
||||||
|
{
|
||||||
#if defined(CURL_AT_LEAST_VERSION) && CURL_AT_LEAST_VERSION(7, 85, 0)
|
#if defined(CURL_AT_LEAST_VERSION) && CURL_AT_LEAST_VERSION(7, 85, 0)
|
||||||
# ifdef ENFORCE_HTTPS
|
|
||||||
curl_easy_setopt(easy, CURLOPT_PROTOCOLS_STR, "https");
|
curl_easy_setopt(easy, CURLOPT_PROTOCOLS_STR, "https");
|
||||||
curl_easy_setopt(easy, CURLOPT_REDIR_PROTOCOLS_STR, "https");
|
curl_easy_setopt(easy, CURLOPT_REDIR_PROTOCOLS_STR, "https");
|
||||||
# else
|
|
||||||
curl_easy_setopt(easy, CURLOPT_PROTOCOLS_STR, "https,http");
|
|
||||||
curl_easy_setopt(easy, CURLOPT_REDIR_PROTOCOLS_STR, "https,http");
|
|
||||||
# endif
|
|
||||||
#else
|
#else
|
||||||
# ifdef ENFORCE_HTTPS
|
|
||||||
curl_easy_setopt(easy, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS);
|
curl_easy_setopt(easy, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS);
|
||||||
curl_easy_setopt(easy, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS);
|
curl_easy_setopt(easy, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS);
|
||||||
# else
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#if defined(CURL_AT_LEAST_VERSION) && CURL_AT_LEAST_VERSION(7, 85, 0)
|
||||||
|
curl_easy_setopt(easy, CURLOPT_PROTOCOLS_STR, "https,http");
|
||||||
|
curl_easy_setopt(easy, CURLOPT_REDIR_PROTOCOLS_STR, "https,http");
|
||||||
|
#else
|
||||||
curl_easy_setopt(easy, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS | CURLPROTO_HTTP);
|
curl_easy_setopt(easy, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS | CURLPROTO_HTTP);
|
||||||
curl_easy_setopt(easy, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS | CURLPROTO_HTTP);
|
curl_easy_setopt(easy, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS | CURLPROTO_HTTP);
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
SetupCurlEasyCiphers(easy);
|
SetupCurlEasyCiphers(easy);
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ namespace http
|
|||||||
user_agent = ByteString::Build(
|
user_agent = ByteString::Build(
|
||||||
"PowderToy/", SAVE_VERSION, ".", MINOR_VERSION,
|
"PowderToy/", SAVE_VERSION, ".", MINOR_VERSION,
|
||||||
" (", IDENT_PLATFORM,
|
" (", IDENT_PLATFORM,
|
||||||
"; ", IDENT_BUILD,
|
"; NO", // Unused, used to be SSE level.
|
||||||
"; M", MOD_ID,
|
"; M", MOD_ID,
|
||||||
"; ", IDENT,
|
"; ", IDENT,
|
||||||
") TPTPP/", SAVE_VERSION, ".", MINOR_VERSION, ".", BUILD_NUM, IDENT_RELTYPE, ".", SNAPSHOT_ID
|
") TPTPP/", SAVE_VERSION, ".", MINOR_VERSION, ".", BUILD_NUM, IDENT_RELTYPE, ".", SNAPSHOT_ID
|
||||||
|
@ -744,11 +744,14 @@ void GameController::Tick()
|
|||||||
#ifdef LUACONSOLE
|
#ifdef LUACONSOLE
|
||||||
((LuaScriptInterface*)commandInterface)->Init();
|
((LuaScriptInterface*)commandInterface)->Init();
|
||||||
#endif
|
#endif
|
||||||
#if !defined(MACOSX) && !defined(NO_INSTALL_CHECK)
|
#if !defined(MACOSX)
|
||||||
|
if constexpr (INSTALL_CHECK)
|
||||||
|
{
|
||||||
if (Client::Ref().IsFirstRun())
|
if (Client::Ref().IsFirstRun())
|
||||||
{
|
{
|
||||||
Install();
|
Install();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
firstTick = false;
|
firstTick = false;
|
||||||
}
|
}
|
||||||
@ -1672,13 +1675,15 @@ void GameController::RunUpdater()
|
|||||||
Exit();
|
Exit();
|
||||||
new UpdateActivity();
|
new UpdateActivity();
|
||||||
#else
|
#else
|
||||||
|
ByteString file;
|
||||||
#ifdef USE_UPDATESERVER
|
if constexpr (USE_UPDATESERVER)
|
||||||
ByteString file = ByteString::Build(SCHEME, UPDATESERVER, Client::Ref().GetUpdateInfo().File);
|
{
|
||||||
#else
|
file = ByteString::Build(SCHEME, UPDATESERVER, Client::Ref().GetUpdateInfo().File);
|
||||||
ByteString file = ByteString::Build(SCHEME, SERVER, Client::Ref().GetUpdateInfo().File);
|
}
|
||||||
#endif
|
else
|
||||||
|
{
|
||||||
|
file = ByteString::Build(SCHEME, SERVER, Client::Ref().GetUpdateInfo().File);
|
||||||
|
}
|
||||||
Platform::OpenURI(file);
|
Platform::OpenURI(file);
|
||||||
#endif // MACOSX
|
#endif // MACOSX
|
||||||
}
|
}
|
||||||
|
@ -41,9 +41,6 @@ inline ByteString IntroText()
|
|||||||
#elif defined(MOD)
|
#elif defined(MOD)
|
||||||
sb << " MODVER " << SNAPSHOT_ID;
|
sb << " MODVER " << SNAPSHOT_ID;
|
||||||
#endif
|
#endif
|
||||||
#if defined(X86_SSE) || defined(X86_SSE2) || defined(X86_SSE3)
|
|
||||||
sb << " " << IDENT_BUILD;
|
|
||||||
#endif
|
|
||||||
#ifdef LUACONSOLE
|
#ifdef LUACONSOLE
|
||||||
sb << " LUACONSOLE";
|
sb << " LUACONSOLE";
|
||||||
#endif
|
#endif
|
||||||
@ -59,8 +56,9 @@ inline ByteString IntroText()
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
sb << " DEBUG";
|
sb << " DEBUG";
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENFORCE_HTTPS
|
if constexpr (ENFORCE_HTTPS)
|
||||||
|
{
|
||||||
sb << " HTTPS";
|
sb << " HTTPS";
|
||||||
#endif
|
}
|
||||||
return sb.Build();
|
return sb.Build();
|
||||||
}
|
}
|
||||||
|
@ -118,12 +118,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
UpdateActivity::UpdateActivity() {
|
UpdateActivity::UpdateActivity() {
|
||||||
ByteString file;
|
ByteString file = ByteString::Build(SCHEME, USE_UPDATESERVER ? UPDATESERVER : SERVER, Client::Ref().GetUpdateInfo().File);
|
||||||
#ifdef USE_UPDATESERVER
|
|
||||||
file = ByteString::Build(SCHEME, UPDATESERVER, Client::Ref().GetUpdateInfo().File);
|
|
||||||
#else
|
|
||||||
file = ByteString::Build(SCHEME, SERVER, Client::Ref().GetUpdateInfo().File);
|
|
||||||
#endif
|
|
||||||
updateDownloadTask = new UpdateDownloadTask(file, this);
|
updateDownloadTask = new UpdateDownloadTask(file, this);
|
||||||
updateWindow = new TaskWindow("Downloading update...", updateDownloadTask, true);
|
updateWindow = new TaskWindow("Downloading update...", updateDownloadTask, true);
|
||||||
}
|
}
|
||||||
@ -145,18 +140,23 @@ void UpdateActivity::Exit()
|
|||||||
|
|
||||||
void UpdateActivity::NotifyError(Task * sender)
|
void UpdateActivity::NotifyError(Task * sender)
|
||||||
{
|
{
|
||||||
#ifdef USE_UPDATESERVER
|
StringBuilder sb;
|
||||||
# define FIRST_LINE "Please go online to manually download a newer version.\n"
|
if constexpr (USE_UPDATESERVER)
|
||||||
#else
|
{
|
||||||
# define FIRST_LINE "Please visit the website to download a newer version.\n"
|
sb << "Please go online to manually download a newer version.\n";
|
||||||
#endif
|
}
|
||||||
new ConfirmPrompt("Autoupdate failed", FIRST_LINE "Error: " + sender->GetError(), { [this] {
|
else
|
||||||
#ifndef USE_UPDATESERVER
|
{
|
||||||
|
sb << "Please visit the website to download a newer version.\n";
|
||||||
|
}
|
||||||
|
sb << "Error: " << sender->GetError();
|
||||||
|
new ConfirmPrompt("Autoupdate failed", sb.Build(), { [this] {
|
||||||
|
if constexpr (!USE_UPDATESERVER)
|
||||||
|
{
|
||||||
Platform::OpenURI(ByteString(SCHEME) + "powdertoy.co.uk/Download.html");
|
Platform::OpenURI(ByteString(SCHEME) + "powdertoy.co.uk/Download.html");
|
||||||
#endif
|
}
|
||||||
Exit();
|
Exit();
|
||||||
}, [this] { Exit(); } });
|
}, [this] { Exit(); } });
|
||||||
#undef FIRST_LINE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4067,7 +4067,6 @@ void LuaScriptInterface::initPlatformAPI()
|
|||||||
struct luaL_Reg platformAPIMethods [] = {
|
struct luaL_Reg platformAPIMethods [] = {
|
||||||
{"platform", platform_platform},
|
{"platform", platform_platform},
|
||||||
{"ident", platform_ident},
|
{"ident", platform_ident},
|
||||||
{"build", platform_build},
|
|
||||||
{"releaseType", platform_releaseType},
|
{"releaseType", platform_releaseType},
|
||||||
{"exeName", platform_exeName},
|
{"exeName", platform_exeName},
|
||||||
{"restart", platform_restart},
|
{"restart", platform_restart},
|
||||||
@ -4095,12 +4094,6 @@ int LuaScriptInterface::platform_ident(lua_State * l)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LuaScriptInterface::platform_build(lua_State * l)
|
|
||||||
{
|
|
||||||
tpt_lua_pushByteString(l, IDENT_BUILD);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int LuaScriptInterface::platform_releaseType(lua_State * l)
|
int LuaScriptInterface::platform_releaseType(lua_State * l)
|
||||||
{
|
{
|
||||||
tpt_lua_pushByteString(l, IDENT_RELTYPE);
|
tpt_lua_pushByteString(l, IDENT_RELTYPE);
|
||||||
|
@ -174,7 +174,6 @@ class LuaScriptInterface: public CommandInterface
|
|||||||
void initPlatformAPI();
|
void initPlatformAPI();
|
||||||
static int platform_platform(lua_State * l);
|
static int platform_platform(lua_State * l);
|
||||||
static int platform_ident(lua_State * l);
|
static int platform_ident(lua_State * l);
|
||||||
static int platform_build(lua_State * l);
|
|
||||||
static int platform_releaseType(lua_State * l);
|
static int platform_releaseType(lua_State * l);
|
||||||
static int platform_exeName(lua_State * l);
|
static int platform_exeName(lua_State * l);
|
||||||
static int platform_restart(lua_State * l);
|
static int platform_restart(lua_State * l);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user