Merge remote-tracking branch 'origin/master' into HEAD
This commit is contained in:
+26
-1
@@ -27,7 +27,7 @@
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <sys/mount.h>
|
||||
#elif (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) || defined(__GLIBC__)
|
||||
#elif ((defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) || defined(__GLIBC__)) && !defined(__ANDROID__)
|
||||
#define HAS_STATVFS
|
||||
#endif
|
||||
|
||||
@@ -65,6 +65,10 @@ ULONG __stack = (1024*1024)*2; // maybe not that much is needed actually ;)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include "android/log.h"
|
||||
#endif
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
bool FiosIsRoot(const char *path)
|
||||
@@ -244,6 +248,9 @@ void ShowInfo(const char *str)
|
||||
#if !defined(__APPLE__)
|
||||
void ShowOSErrorBox(const char *buf, bool system)
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
__android_log_print(ANDROID_LOG_FATAL, "OpenTTD", "[ERROR] %s", buf);
|
||||
#endif
|
||||
/* All unix systems, except OSX. Only use escape codes on a TTY. */
|
||||
if (isatty(fileno(stderr))) {
|
||||
fprintf(stderr, "\033[1;31mError: %s\033[0;39m\n", buf);
|
||||
@@ -258,6 +265,11 @@ void cocoaSetupAutoreleasePool();
|
||||
void cocoaReleaseAutoreleasePool();
|
||||
#endif
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#define main SDL_main
|
||||
extern "C" int CDECL main(int, char *[]);
|
||||
#endif
|
||||
|
||||
int CDECL main(int argc, char *argv[])
|
||||
{
|
||||
/* Make sure our arguments contain only valid UTF-8 characters. */
|
||||
@@ -367,10 +379,23 @@ void OSOpenBrowser(const char *url)
|
||||
pid_t child_pid = fork();
|
||||
if (child_pid != 0) return;
|
||||
|
||||
#ifdef __ANDROID__
|
||||
const char *args[9];
|
||||
args[0] = "/system/bin/am";
|
||||
args[1] = "start";
|
||||
args[2] = "-a";
|
||||
args[3] = "android.intent.action.VIEW";
|
||||
args[4] = "--user";
|
||||
args[5] = "0";
|
||||
args[6] = "-d";
|
||||
args[7] = url;
|
||||
args[8] = NULL;
|
||||
#else
|
||||
const char *args[3];
|
||||
args[0] = "xdg-open";
|
||||
args[1] = url;
|
||||
args[2] = NULL;
|
||||
#endif
|
||||
execvp(args[0], const_cast<char * const *>(args));
|
||||
DEBUG(misc, 0, "Failed to open url: %s", url);
|
||||
exit(0);
|
||||
|
||||
Reference in New Issue
Block a user