diff --git a/android/phoenix/AndroidManifest.xml b/android/phoenix/AndroidManifest.xml
index ad4cacef8f..3ed4416e7d 100644
--- a/android/phoenix/AndroidManifest.xml
+++ b/android/phoenix/AndroidManifest.xml
@@ -30,11 +30,11 @@
-
+
-
+
diff --git a/apple/common/main.m b/apple/common/main.m
index 0a23f247db..88623c2775 100644
--- a/apple/common/main.m
+++ b/apple/common/main.m
@@ -39,11 +39,14 @@ void apple_run_core(NSString* core, const char* file)
if (!apple_is_running)
{
#ifndef OSX
- char basedir[256];
- fill_pathname_basedir(basedir, file, sizeof(basedir));
- if (file && access(basedir, R_OK | W_OK | X_OK))
- apple_display_alert(@"The directory containing the selected file has limited permissions. This may "
- "prevent zipped content from loading, and will cause some cores to not function.", 0);
+ if (core && file)
+ {
+ char basedir[256];
+ fill_pathname_basedir(basedir, file, sizeof(basedir));
+ if (access(basedir, R_OK | W_OK | X_OK))
+ apple_display_alert(@"The directory containing the selected file has limited permissions. This may "
+ "prevent zipped content from loading, and will cause some cores to not function.", 0);
+ }
#endif
[apple_platform loadingCore:core withFile:file];
diff --git a/apple/iOS/platform.m b/apple/iOS/platform.m
index c8a3320524..b31d521d53 100644
--- a/apple/iOS/platform.m
+++ b/apple/iOS/platform.m
@@ -67,8 +67,16 @@ const void* apple_get_frontend_settings(void)
&apple_frontend_settings.logging_enabled, false);
settings[3] = setting_data_bool_setting("ios_tv_mode", "TV Mode", &apple_use_tv_mode, false);
settings[4] = setting_data_string_setting(ST_STRING, "ios_btmode", "Bluetooth Input Type", apple_frontend_settings.bluetooth_mode,
- sizeof(apple_frontend_settings.bluetooth_mode), "keyboard");
- settings[4].values = "icade|keyboard|btstack";
+ sizeof(apple_frontend_settings.bluetooth_mode), "none");
+
+ // Set ios_btmode options based on runtime environment
+ if (is_ios_7())
+ settings[4].values = "none|icade";
+ else if (btstack_try_load())
+ settings[4].values = "none|icade|keyboard|btstack";
+ else
+ settings[4].values = "none|icade|keyboard";
+
settings[5] = setting_data_string_setting(ST_STRING, "ios_orientations", "Screen Orientations", apple_frontend_settings.orientations,
sizeof(apple_frontend_settings.orientations), "both");
settings[5].values = "both|landscape|portrait";
@@ -272,7 +280,6 @@ static void handle_touch_event(NSArray* touches)
_isGameTop = [viewController isKindOfClass:[RAGameView class]];
g_extern.is_paused = !_isGameTop;
-
[[UIApplication sharedApplication] setStatusBarHidden:_isGameTop withAnimation:UIStatusBarAnimationNone];
[[UIApplication sharedApplication] setIdleTimerDisabled:_isGameTop];
diff --git a/input/udev_input.c b/input/udev_input.c
index 4a73948f87..84496a92ff 100644
--- a/input/udev_input.c
+++ b/input/udev_input.c
@@ -30,6 +30,9 @@
#include
#include
#include
+#include
+#include
+#include
#ifdef HAVE_CONFIG_H
#include "../config.h"
@@ -610,6 +613,68 @@ static bool open_devices(udev_input_t *udev, const char *type, device_handle_cb
return true;
}
+static long oldkbmd = 0xffff;
+static struct termios oldterm, newterm;
+
+static void restore_terminal_input(void)
+{
+ if (oldkbmd != 0xffff)
+ {
+ ioctl(0, KDSKBMODE, oldkbmd);
+ tcsetattr(0, TCSAFLUSH, &oldterm);
+ oldkbmd = 0xffff;
+ }
+}
+
+static void restore_terminal_signal(int sig)
+{
+ restore_terminal_input();
+ kill(getpid(), sig);
+}
+
+static void disable_terminal_input(void)
+{
+ struct sigaction sa;
+
+ // Avoid accidentally typing stuff
+ if (!isatty(0) || oldkbmd != 0xffff)
+ return;
+
+ if (tcgetattr(0, &oldterm) < 0)
+ return;
+ newterm = oldterm;
+ newterm.c_lflag &= ~(ECHO | ICANON | ISIG);
+ newterm.c_iflag &= ~(ISTRIP | IGNCR | ICRNL | INLCR | IXOFF | IXON);
+ newterm.c_cc[VMIN] = 0;
+ newterm.c_cc[VTIME] = 0;
+
+ // Be careful about recovering the terminal ...
+ if (ioctl(0, KDGKBMODE, &oldkbmd) < 0)
+ return;
+ if (tcsetattr(0, TCSAFLUSH, &newterm) < 0)
+ return;
+ if (ioctl(0, KDSKBMODE, K_MEDIUMRAW) < 0)
+ {
+ tcsetattr(0, TCSAFLUSH, &oldterm);
+ return;
+ }
+
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = restore_terminal_signal;
+ sa.sa_flags = SA_RESTART | SA_RESETHAND;
+ sigemptyset(&sa.sa_mask);
+
+ // Trap some fatal signals.
+ sigaction(SIGABRT, &sa, NULL);
+ sigaction(SIGBUS, &sa, NULL);
+ sigaction(SIGFPE, &sa, NULL);
+ sigaction(SIGILL, &sa, NULL);
+ sigaction(SIGQUIT, &sa, NULL);
+ sigaction(SIGSEGV, &sa, NULL);
+
+ atexit(restore_terminal_input);
+}
+
static void *udev_input_init(void)
{
udev_input_t *udev = (udev_input_t*)calloc(1, sizeof(*udev));
@@ -704,6 +769,8 @@ static void *udev_input_init(void)
udev->joypad = input_joypad_init_driver(g_settings.input.joypad_driver);
input_init_keyboard_lut(rarch_key_map_linux);
+
+ disable_terminal_input();
return udev;
error:
diff --git a/logger/ios_logger_override.h b/logger/ios_logger_override.h
index 469d1f876a..83a01dec9d 100644
--- a/logger/ios_logger_override.h
+++ b/logger/ios_logger_override.h
@@ -25,7 +25,7 @@ static inline void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap)
aslmsg msg = asl_new(ASL_TYPE_MSG);
asl_set(msg, ASL_KEY_READ_UID, "-1");
if (tag)
- asl_log(NULL, msg, ASL_LEVEL_NOTICE, tag);
+ asl_log(NULL, msg, ASL_LEVEL_NOTICE, "%s", tag);
asl_vlog(NULL, msg, ASL_LEVEL_NOTICE, fmt, ap);
asl_free(msg);
}
@@ -40,15 +40,7 @@ static inline void RARCH_LOG(const char *fmt, ...)
static inline void RARCH_LOG_OUTPUT_V(const char *tag, const char *fmt, va_list ap)
{
- va_list ap;
- va_start(ap, fmt);
- aslmsg msg = asl_new(ASL_TYPE_MSG);
- asl_set(msg, ASL_KEY_READ_UID, "-1");
- if (tag)
- asl_log(NULL, msg, ASL_LEVEL_NOTICE, tag);
- asl_vlog(NULL, msg, ASL_LEVEL_NOTICE, fmt, ap);
- asl_free(msg);
- va_end(ap);
+ RARCH_LOG_V(tag, fmt, ap);
}
static inline void RARCH_LOG_OUTPUT(const char *fmt, ...)
@@ -59,17 +51,9 @@ static inline void RARCH_LOG_OUTPUT(const char *fmt, ...)
va_end(ap);
}
-static inline void RARCH_WARN_V(const char *tag, const char *fmt, ...)
+static inline void RARCH_WARN_V(const char *tag, const char *fmt, va_list ap)
{
- va_list ap;
- va_start(ap, fmt);
- aslmsg msg = asl_new(ASL_TYPE_MSG);
- asl_set(msg, ASL_KEY_READ_UID, "-1");
- if (tag)
- asl_log(NULL, msg, ASL_LEVEL_NOTICE, tag);
- asl_vlog(NULL, msg, ASL_LEVEL_NOTICE, fmt, ap);
- asl_free(msg);
- va_end(ap);
+ RARCH_LOG_V(tag, fmt, ap);
}
static inline void RARCH_WARN(const char *fmt, ...)
@@ -80,17 +64,9 @@ static inline void RARCH_WARN(const char *fmt, ...)
va_end(ap);
}
-static inline void RARCH_ERR_V(const char *tag, const char *fmt, ...)
+static inline void RARCH_ERR_V(const char *tag, const char *fmt, va_list ap)
{
- va_list ap;
- va_start(ap, fmt);
- aslmsg msg = asl_new(ASL_TYPE_MSG);
- asl_set(msg, ASL_KEY_READ_UID, "-1");
- if (tag)
- asl_log(NULL, msg, ASL_LEVEL_NOTICE, tag);
- asl_vlog(NULL, msg, ASL_LEVEL_NOTICE, fmt, ap);
- asl_free(msg);
- va_end(ap);
+ RARCH_LOG_V(tag, fmt, ap);
}
static inline void RARCH_ERR(const char *fmt, ...)