diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/SCsub | 1 | ||||
-rw-r--r-- | platform/android/ifaddrs_android.cpp | 221 | ||||
-rw-r--r-- | platform/android/ifaddrs_android.h | 46 | ||||
-rw-r--r-- | platform/android/java/src/com/android/godot/Godot.java | 33 | ||||
-rw-r--r-- | platform/android/java/src/com/android/godot/GodotPaymentV3.java | 37 | ||||
-rw-r--r-- | platform/android/java/src/com/android/godot/payments/ConsumeTask.java | 3 | ||||
-rw-r--r-- | platform/android/java/src/com/android/godot/payments/HandlePurchaseTask.java | 10 | ||||
-rw-r--r-- | platform/android/java/src/com/android/godot/payments/PaymentsCache.java | 3 | ||||
-rw-r--r-- | platform/android/java/src/com/android/godot/payments/PaymentsManager.java | 12 | ||||
-rw-r--r-- | platform/android/java/src/com/android/godot/payments/PurchaseTask.java | 6 | ||||
-rwxr-xr-x | platform/android/sign.sh | 2 | ||||
-rw-r--r-- | platform/iphone/detect.py | 6 | ||||
-rwxr-xr-x | platform/iphone/gl_view.mm | 13 | ||||
-rw-r--r-- | platform/windows/detect.py | 4 | ||||
-rw-r--r-- | platform/x11/os_x11.cpp | 36 | ||||
-rw-r--r-- | platform/x11/os_x11.h | 2 |
16 files changed, 385 insertions, 50 deletions
diff --git a/platform/android/SCsub b/platform/android/SCsub index 5464376c31..8e61b7d8e0 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -13,6 +13,7 @@ android_files = [ 'dir_access_jandroid.cpp', 'thread_jandroid.cpp', 'audio_driver_jandroid.cpp', + 'ifaddrs_android.cpp', 'android_native_app_glue.c', 'java_glue.cpp' ] diff --git a/platform/android/ifaddrs_android.cpp b/platform/android/ifaddrs_android.cpp new file mode 100644 index 0000000000..c1e9eb3584 --- /dev/null +++ b/platform/android/ifaddrs_android.cpp @@ -0,0 +1,221 @@ +/* + * libjingle + * Copyright 2012, Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ifaddrs_android.h" +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/utsname.h> +#include <sys/ioctl.h> +#include <netinet/in.h> +#include <net/if.h> +#include <unistd.h> +#include <errno.h> +#include <linux/netlink.h> +#include <linux/rtnetlink.h> +struct netlinkrequest { + nlmsghdr header; + ifaddrmsg msg; +}; +namespace { +const int kMaxReadSize = 4096; +}; +static int set_ifname(struct ifaddrs* ifaddr, int interface) { + char buf[IFNAMSIZ] = {0}; + char* name = if_indextoname(interface, buf); + if (name == NULL) { + return -1; + } + ifaddr->ifa_name = new char[strlen(name) + 1]; + strncpy(ifaddr->ifa_name, name, strlen(name) + 1); + return 0; +} +static int set_flags(struct ifaddrs* ifaddr) { + int fd = socket(AF_INET, SOCK_DGRAM, 0); + if (fd == -1) { + return -1; + } + ifreq ifr; + memset(&ifr, 0, sizeof(ifr)); + strncpy(ifr.ifr_name, ifaddr->ifa_name, IFNAMSIZ - 1); + int rc = ioctl(fd, SIOCGIFFLAGS, &ifr); + close(fd); + if (rc == -1) { + return -1; + } + ifaddr->ifa_flags = ifr.ifr_flags; + return 0; +} +static int set_addresses(struct ifaddrs* ifaddr, ifaddrmsg* msg, void* data, + size_t len) { + if (msg->ifa_family == AF_INET) { + sockaddr_in* sa = new sockaddr_in; + sa->sin_family = AF_INET; + memcpy(&sa->sin_addr, data, len); + ifaddr->ifa_addr = reinterpret_cast<sockaddr*>(sa); + } else if (msg->ifa_family == AF_INET6) { + sockaddr_in6* sa = new sockaddr_in6; + sa->sin6_family = AF_INET6; + sa->sin6_scope_id = msg->ifa_index; + memcpy(&sa->sin6_addr, data, len); + ifaddr->ifa_addr = reinterpret_cast<sockaddr*>(sa); + } else { + return -1; + } + return 0; +} +static int make_prefixes(struct ifaddrs* ifaddr, int family, int prefixlen) { + char* prefix = NULL; + if (family == AF_INET) { + sockaddr_in* mask = new sockaddr_in; + mask->sin_family = AF_INET; + memset(&mask->sin_addr, 0, sizeof(in_addr)); + ifaddr->ifa_netmask = reinterpret_cast<sockaddr*>(mask); + if (prefixlen > 32) { + prefixlen = 32; + } + prefix = reinterpret_cast<char*>(&mask->sin_addr); + } else if (family == AF_INET6) { + sockaddr_in6* mask = new sockaddr_in6; + mask->sin6_family = AF_INET6; + memset(&mask->sin6_addr, 0, sizeof(in6_addr)); + ifaddr->ifa_netmask = reinterpret_cast<sockaddr*>(mask); + if (prefixlen > 128) { + prefixlen = 128; + } + prefix = reinterpret_cast<char*>(&mask->sin6_addr); + } else { + return -1; + } + for (int i = 0; i < (prefixlen / 8); i++) { + *prefix++ = 0xFF; + } + char remainder = 0xff; + remainder <<= (8 - prefixlen % 8); + *prefix = remainder; + return 0; +} +static int populate_ifaddrs(struct ifaddrs* ifaddr, ifaddrmsg* msg, void* bytes, + size_t len) { + if (set_ifname(ifaddr, msg->ifa_index) != 0) { + return -1; + } + if (set_flags(ifaddr) != 0) { + return -1; + } + if (set_addresses(ifaddr, msg, bytes, len) != 0) { + return -1; + } + if (make_prefixes(ifaddr, msg->ifa_family, msg->ifa_prefixlen) != 0) { + return -1; + } + return 0; +} +int getifaddrs(struct ifaddrs** result) { + int fd = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE); + if (fd < 0) { + return -1; + } + netlinkrequest ifaddr_request; + memset(&ifaddr_request, 0, sizeof(ifaddr_request)); + ifaddr_request.header.nlmsg_flags = NLM_F_ROOT | NLM_F_REQUEST; + ifaddr_request.header.nlmsg_type = RTM_GETADDR; + ifaddr_request.header.nlmsg_len = NLMSG_LENGTH(sizeof(ifaddrmsg)); + ssize_t count = send(fd, &ifaddr_request, ifaddr_request.header.nlmsg_len, 0); + if (static_cast<size_t>(count) != ifaddr_request.header.nlmsg_len) { + close(fd); + return -1; + } + struct ifaddrs* start = NULL; + struct ifaddrs* current = NULL; + char buf[kMaxReadSize]; + ssize_t amount_read = recv(fd, &buf, kMaxReadSize, 0); + while (amount_read > 0) { + nlmsghdr* header = reinterpret_cast<nlmsghdr*>(&buf[0]); + size_t header_size = static_cast<size_t>(amount_read); + for ( ; NLMSG_OK(header, header_size); + header = NLMSG_NEXT(header, header_size)) { + switch (header->nlmsg_type) { + case NLMSG_DONE: + // Success. Return. + *result = start; + close(fd); + return 0; + case NLMSG_ERROR: + close(fd); + freeifaddrs(start); + return -1; + case RTM_NEWADDR: { + ifaddrmsg* address_msg = + reinterpret_cast<ifaddrmsg*>(NLMSG_DATA(header)); + rtattr* rta = IFA_RTA(address_msg); + ssize_t payload_len = IFA_PAYLOAD(header); + while (RTA_OK(rta, payload_len)) { + if (rta->rta_type == IFA_ADDRESS) { + int family = address_msg->ifa_family; + if (family == AF_INET || family == AF_INET6) { + ifaddrs* newest = new ifaddrs; + memset(newest, 0, sizeof(ifaddrs)); + if (current) { + current->ifa_next = newest; + } else { + start = newest; + } + if (populate_ifaddrs(newest, address_msg, RTA_DATA(rta), + RTA_PAYLOAD(rta)) != 0) { + freeifaddrs(start); + *result = NULL; + return -1; + } + current = newest; + } + } + rta = RTA_NEXT(rta, payload_len); + } + break; + } + } + } + amount_read = recv(fd, &buf, kMaxReadSize, 0); + } + close(fd); + freeifaddrs(start); + return -1; +} +void freeifaddrs(struct ifaddrs* addrs) { + struct ifaddrs* last = NULL; + struct ifaddrs* cursor = addrs; + while (cursor) { + delete[] cursor->ifa_name; + delete cursor->ifa_addr; + delete cursor->ifa_netmask; + last = cursor; + cursor = cursor->ifa_next; + delete last; + } +} diff --git a/platform/android/ifaddrs_android.h b/platform/android/ifaddrs_android.h new file mode 100644 index 0000000000..539fa40455 --- /dev/null +++ b/platform/android/ifaddrs_android.h @@ -0,0 +1,46 @@ +/* + * libjingle + * Copyright 2013, Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef TALK_BASE_IFADDRS_ANDROID_H_ +#define TALK_BASE_IFADDRS_ANDROID_H_ +#include <stdio.h> +#include <sys/socket.h> +// Implementation of getifaddrs for Android. +// Fills out a list of ifaddr structs (see below) which contain information +// about every network interface available on the host. +// See 'man getifaddrs' on Linux or OS X (nb: it is not a POSIX function). +struct ifaddrs { + struct ifaddrs* ifa_next; + char* ifa_name; + unsigned int ifa_flags; + struct sockaddr* ifa_addr; + struct sockaddr* ifa_netmask; + // Real ifaddrs has broadcast, point to point and data members. + // We don't need them (yet?). +}; +int getifaddrs(struct ifaddrs** result); +void freeifaddrs(struct ifaddrs* addrs); +#endif // TALK_BASE_IFADDRS_ANDROID_H_ diff --git a/platform/android/java/src/com/android/godot/Godot.java b/platform/android/java/src/com/android/godot/Godot.java index 35ecdc818e..bd973ce49b 100644 --- a/platform/android/java/src/com/android/godot/Godot.java +++ b/platform/android/java/src/com/android/godot/Godot.java @@ -65,6 +65,9 @@ import java.io.InputStream; public class Godot extends Activity implements SensorEventListener { + + static final int MAX_SINGLETONS = 64; + static public class SingletonBase { protected void registerClass(String p_name, String[] p_methods) { @@ -104,8 +107,21 @@ public class Godot extends Activity implements SensorEventListener } + + Godot.singletons[Godot.singleton_count++]=this; + } + + protected void onMainActivityResult(int requestCode, int resultCode, Intent data) { + + + } + + protected void onMainResume() { + + } + public void registerMethods() {} } @@ -133,6 +149,12 @@ public class Godot extends Activity implements SensorEventListener //setTitle(title); } + + static SingletonBase singletons[] = new SingletonBase[MAX_SINGLETONS]; + static int singleton_count=0; + + + public interface ResultCallback { public void callback(int requestCode, int resultCode, Intent data); }; @@ -147,6 +169,11 @@ public class Godot extends Activity implements SensorEventListener result_callback.callback(requestCode, resultCode, data); result_callback = null; }; + + for(int i=0;i<singleton_count;i++) { + + singletons[i].onMainActivityResult(requestCode,resultCode,data); + } }; public void onVideoInit(boolean use_gl2) { @@ -271,6 +298,12 @@ public class Godot extends Activity implements SensorEventListener mView.onResume(); mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL); GodotLib.focusin(); + + for(int i=0;i<singleton_count;i++) { + + singletons[i].onMainResume(); + } + } @Override public void onSensorChanged(SensorEvent event) { diff --git a/platform/android/java/src/com/android/godot/GodotPaymentV3.java b/platform/android/java/src/com/android/godot/GodotPaymentV3.java index 23f5bf34d3..dba4a9a774 100644 --- a/platform/android/java/src/com/android/godot/GodotPaymentV3.java +++ b/platform/android/java/src/com/android/godot/GodotPaymentV3.java @@ -1,7 +1,10 @@ package com.android.godot; +import org.json.JSONObject; + import android.app.Activity; +import android.util.Log; public class GodotPaymentV3 extends Godot.SingletonBase { @@ -13,14 +16,17 @@ public class GodotPaymentV3 extends Godot.SingletonBase { private String accessToken; private String purchaseValidationUrlPrefix; + + private String transactionId; - public void purchase( String _sku) { + public void purchase( String _sku, String _transactionId) { final String sku = _sku; + final String transactionId = _transactionId; activity.getPaymentsManager().setBaseSingleton(this); activity.runOnUiThread(new Runnable() { @Override public void run() { - activity.getPaymentsManager().requestPurchase(sku); + activity.getPaymentsManager().requestPurchase(sku, transactionId); } }); }; @@ -38,22 +44,31 @@ public class GodotPaymentV3 extends Godot.SingletonBase { public GodotPaymentV3(Activity p_activity) { - registerClass("GodotPayments", new String[] {"purchase", "setPurchaseCallbackId", "setPurchaseValidationUrlPrefix"}); + registerClass("GodotPayments", new String[] {"purchase", "setPurchaseCallbackId", "setPurchaseValidationUrlPrefix", "setTransactionId", "getSignature"}); activity=(Godot) p_activity; } + private String signature; + public String getSignature(){ + return this.signature; + } + - public void callbackSuccess(String ticket){ - GodotLib.callobject(purchaseCallbackId, "purchase_success", new Object[]{ticket}); + public void callbackSuccess(String ticket, String signature){ + Log.d(this.getClass().getName(), "PRE-Send callback to purchase success"); + GodotLib.calldeferred(purchaseCallbackId, "purchase_success", new Object[]{ticket, signature}); + Log.d(this.getClass().getName(), "POST-Send callback to purchase success"); } public void callbackFail(){ - GodotLib.callobject(purchaseCallbackId, "purchase_fail", new Object[]{}); + GodotLib.calldeferred(purchaseCallbackId, "purchase_fail", new Object[]{}); +// GodotLib.callobject(purchaseCallbackId, "purchase_fail", new Object[]{}); } public void callbackCancel(){ - GodotLib.callobject(purchaseCallbackId, "purchase_cancel", new Object[]{}); + GodotLib.calldeferred(purchaseCallbackId, "purchase_cancel", new Object[]{}); +// GodotLib.callobject(purchaseCallbackId, "purchase_cancel", new Object[]{}); } public int getPurchaseCallbackId() { @@ -84,4 +99,12 @@ public class GodotPaymentV3 extends Godot.SingletonBase { this.accessToken = accessToken; } + public void setTransactionId(String transactionId){ + this.transactionId = transactionId; + } + + public String getTransactionId(){ + return this.transactionId; + } + } diff --git a/platform/android/java/src/com/android/godot/payments/ConsumeTask.java b/platform/android/java/src/com/android/godot/payments/ConsumeTask.java index 855bc0578d..c983960770 100644 --- a/platform/android/java/src/com/android/godot/payments/ConsumeTask.java +++ b/platform/android/java/src/com/android/godot/payments/ConsumeTask.java @@ -56,8 +56,7 @@ abstract public class ConsumeTask { protected void onPostExecute(String param){ if(param == null){ - - success(new PaymentsCache(context).getConsumableValue("ticket", sku)); + success( new PaymentsCache(context).getConsumableValue("ticket", sku) ); }else{ error(param); } diff --git a/platform/android/java/src/com/android/godot/payments/HandlePurchaseTask.java b/platform/android/java/src/com/android/godot/payments/HandlePurchaseTask.java index a32ecf2895..a810ac40ae 100644 --- a/platform/android/java/src/com/android/godot/payments/HandlePurchaseTask.java +++ b/platform/android/java/src/com/android/godot/payments/HandlePurchaseTask.java @@ -34,7 +34,8 @@ abstract public class HandlePurchaseTask { String purchaseData = data.getStringExtra("INAPP_PURCHASE_DATA"); Log.d("XXX", "Purchase data:" + purchaseData); -// String dataSignature = data.getStringExtra("INAPP_DATA_SIGNATURE"); + String dataSignature = data.getStringExtra("INAPP_DATA_SIGNATURE"); + Log.d("XXX", "Purchase signature:" + dataSignature); if (resultCode == Activity.RESULT_OK) { @@ -57,12 +58,13 @@ abstract public class HandlePurchaseTask { error("Untrusted callback"); return; } - + Log.d("XXX", "Este es el product ID:" + productId); + pc.setConsumableValue("ticket_signautre", productId, dataSignature); pc.setConsumableValue("ticket", productId, purchaseData); pc.setConsumableFlag("block", productId, true); pc.setConsumableValue("token", productId, purchaseToken); - success(productId); + success(productId, dataSignature); return; } catch (JSONException e) { error(e.getMessage()); @@ -72,7 +74,7 @@ abstract public class HandlePurchaseTask { } } - abstract protected void success(String ticket); + abstract protected void success(String ticket, String signature); abstract protected void error(String message); abstract protected void canceled(); diff --git a/platform/android/java/src/com/android/godot/payments/PaymentsCache.java b/platform/android/java/src/com/android/godot/payments/PaymentsCache.java index ba84097732..7337acc0b8 100644 --- a/platform/android/java/src/com/android/godot/payments/PaymentsCache.java +++ b/platform/android/java/src/com/android/godot/payments/PaymentsCache.java @@ -2,6 +2,7 @@ package com.android.godot.payments; import android.content.Context; import android.content.SharedPreferences; +import android.util.Log; public class PaymentsCache { @@ -30,12 +31,14 @@ public class PaymentsCache { SharedPreferences sharedPref = context.getSharedPreferences("consumables_" + set, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); editor.putString(sku, value); + Log.d("XXX", "Setting asset: consumables_" + set + ":" + sku); editor.commit(); } public String getConsumableValue(String set, String sku){ SharedPreferences sharedPref = context.getSharedPreferences( "consumables_" + set, Context.MODE_PRIVATE); + Log.d("XXX", "Getting asset: consumables_" + set + ":" + sku); return sharedPref.getString(sku, null); } diff --git a/platform/android/java/src/com/android/godot/payments/PaymentsManager.java b/platform/android/java/src/com/android/godot/payments/PaymentsManager.java index e8c487dbd8..d85a8ea8ea 100644 --- a/platform/android/java/src/com/android/godot/payments/PaymentsManager.java +++ b/platform/android/java/src/com/android/godot/payments/PaymentsManager.java @@ -6,6 +6,7 @@ import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.IBinder; +import android.util.Log; import com.android.godot.Godot; import com.android.godot.GodotPaymentV3; @@ -63,7 +64,7 @@ public class PaymentsManager { } }; - public void requestPurchase(String sku){ + public void requestPurchase(String sku, String transactionId){ new PurchaseTask(mService, Godot.getInstance()) { @Override @@ -76,7 +77,7 @@ public class PaymentsManager { protected void canceled() { godotPaymentV3.callbackCancel(); } - }.purchase(sku); + }.purchase(sku, transactionId); } @@ -84,13 +85,14 @@ public class PaymentsManager { new HandlePurchaseTask(activity){ @Override - protected void success(final String sku) { + protected void success(final String sku, final String signature) { new ConsumeTask(mService, activity) { @Override protected void success(String ticket) { // godotPaymentV3.callbackSuccess(""); - godotPaymentV3.callbackSuccess(ticket); + Log.d("XXX", "calling success:" + signature); + godotPaymentV3.callbackSuccess(ticket, signature); } @Override @@ -131,7 +133,7 @@ public class PaymentsManager { @Override protected void success(String ticket) { - godotPaymentV3.callbackSuccess(ticket); + godotPaymentV3.callbackSuccess(ticket, null); } diff --git a/platform/android/java/src/com/android/godot/payments/PurchaseTask.java b/platform/android/java/src/com/android/godot/payments/PurchaseTask.java index f5d8a0298a..0856b4e900 100644 --- a/platform/android/java/src/com/android/godot/payments/PurchaseTask.java +++ b/platform/android/java/src/com/android/godot/payments/PurchaseTask.java @@ -31,7 +31,7 @@ abstract public class PurchaseTask { private boolean isLooping = false; - public void purchase(final String sku){ + public void purchase(final String sku, final String transactionId){ Log.d("XXX", "Starting purchase for: " + sku); PaymentsCache pc = new PaymentsCache(context); Boolean isBlocked = pc.getConsumableFlag("block", sku); @@ -40,7 +40,7 @@ abstract public class PurchaseTask { // error("Awaiting payment confirmation"); // return; // } - final String hash = Crypt.createRandomHash() + Crypt.createRandomHash(); + final String hash = transactionId; Bundle buyIntentBundle; try { @@ -76,7 +76,7 @@ abstract public class PurchaseTask { return; } isLooping=true; - PurchaseTask.this.purchase(sku); + PurchaseTask.this.purchase(sku, transactionId); } diff --git a/platform/android/sign.sh b/platform/android/sign.sh index 8f760e6312..830da05a37 100755 --- a/platform/android/sign.sh +++ b/platform/android/sign.sh @@ -1,6 +1,6 @@ #!/bin/bash -jarsigner -digestalg SHA1 -sigalg MD5withRSA -verbose -keystore /home/luis/Downloads/carnavalguachin.keystore -storepass 12345678 "$1" momoselacome +jarsigner -digestalg SHA1 -sigalg MD5withRSA -verbose -keystore my-release-key.keystore "$1" reduz echo "" echo "" diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py index a02891e817..ec6e4c98f1 100644 --- a/platform/iphone/detect.py +++ b/platform/iphone/detect.py @@ -21,7 +21,8 @@ def get_opts(): return [ ('IPHONEPLATFORM', 'name of the iphone platform', 'iPhoneOS'), ('IPHONEPATH', 'the path to iphone toolchain', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain'), - ('IPHONESDK', 'path to the iphone SDK', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/'), + ('IOS_SDK_VERSION', 'The SDK version', 'iPhoneOS7.0'), + ('IPHONESDK', 'path to the iphone SDK', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/${IOS_SDK_VERSION}.sdk/'), ('game_center', 'Support for game center', 'yes'), ('store_kit', 'Support for in-app store', 'yes'), ('ios_gles22_override', 'Force GLES2.0 on iOS', 'yes'), @@ -37,6 +38,7 @@ def get_flags(): ('tools', 'yes'), ('nedmalloc', 'no'), ('webp', 'yes'), + ('openssl','builtin'), #use builtin openssl ] @@ -81,7 +83,7 @@ def configure(env): '-framework', 'AudioToolbox', '-framework', 'SystemConfiguration', '-framework', 'Security', - '-framework', 'AdSupport', + #'-framework', 'AdSupport', '-framework', 'MediaPlayer', ]) diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm index c482c36a30..500c7c7174 100755 --- a/platform/iphone/gl_view.mm +++ b/platform/iphone/gl_view.mm @@ -50,6 +50,7 @@ static String keyboard_text; static GLView* _instance = NULL; static bool video_found_error = false; +static bool video_playing = false; static float video_previous_volume = 0.0f; void _show_keyboard(String p_existing) { @@ -91,24 +92,29 @@ bool _play_video(String p_path, float p_volume) { [_instance addSubview:_instance.moviePlayerController.view]; [_instance.moviePlayerController play]; + video_playing = true; + return true; } bool _is_video_playing() { //NSInteger playback_state = _instance.moviePlayerController.playbackState; - if (video_found_error) - return false; - return (_instance.moviePlayerController.playbackState == MPMoviePlaybackStatePlaying); + return video_playing || _instance.moviePlayerController.playbackState == MPMoviePlaybackStatePlaying; + //if (video_found_error) + // return false; + //return (_instance.moviePlayerController.playbackState == MPMoviePlaybackStatePlaying); } void _pause_video() { [_instance.moviePlayerController pause]; + video_playing = false; } void _stop_video() { [_instance.moviePlayerController stop]; [_instance.moviePlayerController.view removeFromSuperview]; [[MPMusicPlayerController applicationMusicPlayer] setVolume: video_previous_volume]; + video_playing = false; } @implementation GLView @@ -549,6 +555,7 @@ static void clear_touches() { [_instance.moviePlayerController.view removeFromSuperview]; [[MPMusicPlayerController applicationMusicPlayer] setVolume: video_previous_volume]; + video_playing = false; } @end diff --git a/platform/windows/detect.py b/platform/windows/detect.py index d1c5e96d32..7f71332517 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -117,7 +117,7 @@ def configure(env): env.Append(CCFLAGS=['/DGLES2_ENABLED'])
env.Append(CCFLAGS=['/DGLES1_ENABLED'])
env.Append(CCFLAGS=['/DGLEW_ENABLED'])
- env.Append(LIBS=['winmm','opengl32','dsound','kernel32','ole32','user32','gdi32','wsock32', 'shell32','advapi32'])
+ env.Append(LIBS=['winmm','opengl32','dsound','kernel32','ole32','user32','gdi32', 'IPHLPAPI', 'wsock32', 'shell32','advapi32'])
env.Append(LIBPATH=[os.getenv("WindowsSdkDir")+"/Lib"])
if (os.getenv("DXSDK_DIR")):
@@ -196,7 +196,7 @@ def configure(env): env.Append(CCFLAGS=['-DWINDOWS_ENABLED','-mwindows'])
env.Append(CPPFLAGS=['-DRTAUDIO_ENABLED'])
env.Append(CCFLAGS=['-DGLES2_ENABLED','-DGLES1_ENABLED','-DGLEW_ENABLED'])
- env.Append(LIBS=['mingw32','opengl32', 'dsound', 'ole32', 'd3d9','winmm','gdi32','wsock32','kernel32'])
+ env.Append(LIBS=['mingw32','opengl32', 'dsound', 'ole32', 'd3d9','winmm','gdi32','iphlpapi','wsock32','kernel32'])
#'d3dx9d'
env.Append(CPPFLAGS=['-DMINGW_ENABLED'])
env.Append(LINKFLAGS=['-g'])
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 2cb8247799..14d31b864c 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -480,7 +480,7 @@ unsigned int OS_X11::get_mouse_button_state(unsigned int p_x11_state) { return state; } -void OS_X11::handle_key_event(XKeyEvent *p_event) { +void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) { // X11 functions don't know what const is @@ -591,17 +591,9 @@ void OS_X11::handle_key_event(XKeyEvent *p_event) { // To detect them, i use XPeekEvent and check that their // difference in time is below a treshold. - bool echo=false; - - if (xkeyevent->type == KeyPress) { - - // saved the time of the last keyrelease to see - // if it's the same as this keypress. - if (xkeyevent->time==last_keyrelease_time) - echo=true; - } else { - + if (xkeyevent->type != KeyPress) { + // make sure there are events pending, // so this call won't block. if (XPending(x11_display)>0) { @@ -615,17 +607,21 @@ void OS_X11::handle_key_event(XKeyEvent *p_event) { // not very helpful today. ::Time tresh=ABS(peek_event.xkey.time-xkeyevent->time); - if (peek_event.type == KeyPress && tresh<5 ) - echo=true; + if (peek_event.type == KeyPress && tresh<5 ) { + KeySym rk; + nbytes=XLookupString((XKeyEvent*)&peek_event, str, 256, &rk, NULL); + if (rk==keysym_keycode) { + XEvent event; + XNextEvent(x11_display, &event); //erase next event + handle_key_event( (XKeyEvent*)&event,true ); + return; //ignore current, echo next + } + } // use the time from peek_event so it always works - last_keyrelease_time=peek_event.xkey.time; - } else { - last_keyrelease_time=xkeyevent->time; } - // save the time to check for echo when keypress happens - + // save the time to check for echo when keypress happens } @@ -643,7 +639,7 @@ void OS_X11::handle_key_event(XKeyEvent *p_event) { event.key.scancode=keycode; event.key.unicode=unicode; - event.key.echo=echo; + event.key.echo=p_echo; if (event.key.scancode==KEY_BACKTAB) { //make it consistent accross platforms. @@ -1017,7 +1013,7 @@ String OS_X11::get_name() { Error OS_X11::shell_open(String p_uri) { - + return ERR_UNAVAILABLE; } diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index 491b8fa00d..77ef37f6f4 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -90,7 +90,7 @@ class OS_X11 : public OS_Unix { MouseMode mouse_mode; Point2i center; - void handle_key_event(XKeyEvent *p_event); + void handle_key_event(XKeyEvent *p_event,bool p_echo=false); void process_xevents(); virtual void delete_main_loop(); IP_Unix *ip_unix; |