summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/android/export/export.cpp1
-rw-r--r--platform/iphone/game_center.h9
-rw-r--r--platform/iphone/game_center.mm72
-rw-r--r--platform/osx/os_osx.h3
-rw-r--r--platform/osx/os_osx.mm17
-rw-r--r--platform/uwp/SCsub1
-rw-r--r--platform/windows/detect.py1
-rw-r--r--platform/x11/detect.py3
-rw-r--r--platform/x11/os_x11.cpp6
9 files changed, 93 insertions, 20 deletions
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 9fe1f291d6..79be1501a7 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -267,7 +267,6 @@ class EditorExportAndroid : public EditorExportPlatform {
if (different) {
- print_line("DIFFERENT!");
Vector<Device> ndevices;
for (int i = 0; i < ldevices.size(); i++) {
diff --git a/platform/iphone/game_center.h b/platform/iphone/game_center.h
index c0a7830fe9..21f40fa362 100644
--- a/platform/iphone/game_center.h
+++ b/platform/iphone/game_center.h
@@ -43,11 +43,13 @@ class GameCenter : public Object {
List<Variant> pending_events;
- bool connected;
+ bool authenticated;
+
+ void return_connect_error(const char *p_error_description);
public:
- Error connect();
- bool is_connected();
+ void connect();
+ bool is_authenticated();
Error post_score(Variant p_score);
Error award_achievement(Variant p_params);
@@ -55,6 +57,7 @@ public:
void request_achievements();
void request_achievement_descriptions();
Error show_game_center(Variant p_params);
+ Error request_identity_verification_signature();
void game_center_closed();
diff --git a/platform/iphone/game_center.mm b/platform/iphone/game_center.mm
index 3955b9f0aa..531b80eee3 100644
--- a/platform/iphone/game_center.mm
+++ b/platform/iphone/game_center.mm
@@ -49,8 +49,7 @@ extern "C" {
GameCenter *GameCenter::instance = NULL;
void GameCenter::_bind_methods() {
- ClassDB::bind_method(D_METHOD("connect"), &GameCenter::connect);
- ClassDB::bind_method(D_METHOD("is_connected"), &GameCenter::is_connected);
+ ClassDB::bind_method(D_METHOD("is_authenticated"), &GameCenter::is_authenticated);
ClassDB::bind_method(D_METHOD("post_score"), &GameCenter::post_score);
ClassDB::bind_method(D_METHOD("award_achievement"), &GameCenter::award_achievement);
@@ -58,24 +57,41 @@ void GameCenter::_bind_methods() {
ClassDB::bind_method(D_METHOD("request_achievements"), &GameCenter::request_achievements);
ClassDB::bind_method(D_METHOD("request_achievement_descriptions"), &GameCenter::request_achievement_descriptions);
ClassDB::bind_method(D_METHOD("show_game_center"), &GameCenter::show_game_center);
+ ClassDB::bind_method(D_METHOD("request_identity_verification_signature"), &GameCenter::request_identity_verification_signature);
ClassDB::bind_method(D_METHOD("get_pending_event_count"), &GameCenter::get_pending_event_count);
ClassDB::bind_method(D_METHOD("pop_pending_event"), &GameCenter::pop_pending_event);
};
-Error GameCenter::connect() {
+void GameCenter::return_connect_error(const char *p_error_description) {
+ authenticated = false;
+ Dictionary ret;
+ ret["type"] = "authentication";
+ ret["result"] = "error";
+ ret["error_code"] = 0;
+ ret["error_description"] = p_error_description;
+ pending_events.push_back(ret);
+}
+
+void GameCenter::connect() {
//if this class isn't available, game center isn't implemented
if ((NSClassFromString(@"GKLocalPlayer")) == nil) {
- GameCenter::get_singleton()->connected = false;
- return ERR_UNAVAILABLE;
+ return_connect_error("GameCenter not available");
+ return;
}
GKLocalPlayer *player = [GKLocalPlayer localPlayer];
- ERR_FAIL_COND_V(![player respondsToSelector:@selector(authenticateHandler)], ERR_UNAVAILABLE);
+ if (![player respondsToSelector:@selector(authenticateHandler)]) {
+ return_connect_error("GameCenter doesn't respond to 'authenticateHandler'");
+ return;
+ }
ViewController *root_controller = (ViewController *)((AppDelegate *)[[UIApplication sharedApplication] delegate]).window.rootViewController;
- ERR_FAIL_COND_V(!root_controller, FAILED);
+ if (!root_controller) {
+ return_connect_error("Window doesn't have root ViewController");
+ return;
+ }
// This handler is called several times. First when the view needs to be shown, then again
// after the view is cancelled or the user logs in. Or if the user's already logged in, it's
@@ -90,23 +106,21 @@ Error GameCenter::connect() {
if (player.isAuthenticated) {
ret["result"] = "ok";
ret["player_id"] = [player.playerID UTF8String];
- GameCenter::get_singleton()->connected = true;
+ GameCenter::get_singleton()->authenticated = true;
} else {
ret["result"] = "error";
ret["error_code"] = error.code;
ret["error_description"] = [error.localizedDescription UTF8String];
- GameCenter::get_singleton()->connected = false;
+ GameCenter::get_singleton()->authenticated = false;
};
pending_events.push_back(ret);
};
});
-
- return OK;
};
-bool GameCenter::is_connected() {
- return connected;
+bool GameCenter::is_authenticated() {
+ return authenticated;
};
Error GameCenter::post_score(Variant p_score) {
@@ -117,7 +131,7 @@ Error GameCenter::post_score(Variant p_score) {
String category = params["category"];
NSString *cat_str = [[[NSString alloc] initWithUTF8String:category.utf8().get_data()] autorelease];
- GKScore *reporter = [[[GKScore alloc] initWithCategory:cat_str] autorelease];
+ GKScore *reporter = [[[GKScore alloc] initWithLeaderboardIdentifier:cat_str] autorelease];
reporter.value = score;
ERR_FAIL_COND_V([GKScore respondsToSelector:@selector(reportScores)], ERR_UNAVAILABLE);
@@ -326,6 +340,34 @@ Error GameCenter::show_game_center(Variant p_params) {
return OK;
};
+Error GameCenter::request_identity_verification_signature() {
+
+ ERR_FAIL_COND_V(!is_authenticated(), ERR_UNAUTHORIZED);
+
+ GKLocalPlayer *player = [GKLocalPlayer localPlayer];
+ [player generateIdentityVerificationSignatureWithCompletionHandler:^(NSURL *publicKeyUrl, NSData *signature, NSData *salt, uint64_t timestamp, NSError *error) {
+
+ Dictionary ret;
+ ret["type"] = "identity_verification_signature";
+ if (error == nil) {
+ ret["result"] = "ok";
+ ret["public_key_url"] = [publicKeyUrl.absoluteString UTF8String];
+ ret["signature"] = [[signature base64EncodedStringWithOptions:0] UTF8String];
+ ret["salt"] = [[salt base64EncodedStringWithOptions:0] UTF8String];
+ ret["timestamp"] = timestamp;
+ ret["player_id"] = [player.playerID UTF8String];
+ } else {
+ ret["result"] = "error";
+ ret["error_code"] = error.code;
+ ret["error_description"] = [error.localizedDescription UTF8String];
+ };
+
+ pending_events.push_back(ret);
+ }];
+
+ return OK;
+};
+
void GameCenter::game_center_closed() {
Dictionary ret;
@@ -354,7 +396,7 @@ GameCenter *GameCenter::get_singleton() {
GameCenter::GameCenter() {
ERR_FAIL_COND(instance != NULL);
instance = this;
- connected = false;
+ authenticated = false;
};
GameCenter::~GameCenter(){};
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index 05adfeb0f5..420bb50af9 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -219,6 +219,9 @@ public:
virtual bool _check_internal_feature_support(const String &p_feature);
+ virtual void set_use_vsync(bool p_enable);
+ virtual bool is_vsync_enabled() const;
+
void run();
void set_mouse_mode(MouseMode p_mode);
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 2c81a02014..e1a01d2b59 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -1954,6 +1954,23 @@ Error OS_OSX::move_to_trash(const String &p_path) {
return OK;
}
+void OS_OSX::set_use_vsync(bool p_enable) {
+ CGLContextObj ctx = CGLGetCurrentContext();
+ if (ctx) {
+ GLint swapInterval = p_enable ? 1 : 0;
+ CGLSetParameter(ctx, kCGLCPSwapInterval, &swapInterval);
+ }
+}
+
+bool OS_OSX::is_vsync_enabled() const {
+ GLint swapInterval = 0;
+ CGLContextObj ctx = CGLGetCurrentContext();
+ if (ctx) {
+ CGLGetParameter(ctx, kCGLCPSwapInterval, &swapInterval);
+ }
+ return swapInterval ? true : false;
+}
+
OS_OSX *OS_OSX::singleton = NULL;
OS_OSX::OS_OSX() {
diff --git a/platform/uwp/SCsub b/platform/uwp/SCsub
index 7ee5aa2ac3..bbd329a7e5 100644
--- a/platform/uwp/SCsub
+++ b/platform/uwp/SCsub
@@ -8,6 +8,7 @@ files = [
'#platform/windows/packet_peer_udp_winsock.cpp',
'#platform/windows/stream_peer_winsock.cpp',
'#platform/windows/key_mapping_win.cpp',
+ '#platform/windows/windows_terminal_logger.cpp',
'joypad_uwp.cpp',
'power_uwp.cpp',
'gl_context_egl.cpp',
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 031b397988..cd4230acd4 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -44,7 +44,6 @@ def can_build():
if (os.system(mingw64 + test) == 0 or os.system(mingw32 + test) == 0):
return True
- print("Could not detect MinGW. Ensure its binaries are in your PATH or that MINGW32_PREFIX or MINGW64_PREFIX are properly defined.")
return False
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index 1f7f67fe10..8c68c9ffd1 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -239,6 +239,9 @@ def configure(env):
if (platform.system() == "Linux"):
env.Append(LIBS=['dl'])
+ if (platform.system().find("BSD") >= 0):
+ env.Append(LIBS=['execinfo'])
+
## Cross-compilation
if (is64 and env["bits"] == "32"):
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index bc18d0c1f0..48e2d8f81e 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -35,7 +35,11 @@
#include "servers/physics/physics_server_sw.h"
#include "servers/visual/visual_server_raster.h"
#include "servers/visual/visual_server_wrap_mt.h"
+
+#ifdef HAVE_MNTENT
#include <mntent.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -2182,6 +2186,7 @@ static String get_mountpoint(const String &p_path) {
return "";
}
+#ifdef HAVE_MNTENT
dev_t dev = s.st_dev;
FILE *fd = setmntent("/proc/mounts", "r");
if (!fd) {
@@ -2199,6 +2204,7 @@ static String get_mountpoint(const String &p_path) {
}
endmntent(fd);
+#endif
return "";
}