Fixed AI in lan multiplayer on android
This commit is contained in:
parent
c2a20e1526
commit
6b26737cd2
@ -659,10 +659,10 @@ std::string AssetsAndroid::getDataPath()
|
|||||||
{
|
{
|
||||||
Log::warn("AssetsAndroid", "Cannot use standard data dir");
|
Log::warn("AssetsAndroid", "Cannot use standard data dir");
|
||||||
|
|
||||||
if (global_android_app)
|
if (global_android_activity)
|
||||||
{
|
{
|
||||||
AndroidApplicationInfo application_info =
|
AndroidApplicationInfo application_info =
|
||||||
CIrrDeviceAndroid::getApplicationInfo(global_android_app->activity);
|
CIrrDeviceAndroid::getApplicationInfo(global_android_activity);
|
||||||
|
|
||||||
data_path = application_info.data_dir;
|
data_path = application_info.data_dir;
|
||||||
}
|
}
|
||||||
@ -688,10 +688,10 @@ std::string AssetsAndroid::getLibPath()
|
|||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
std::string lib_path;
|
std::string lib_path;
|
||||||
|
|
||||||
if (global_android_app)
|
if (global_android_activity)
|
||||||
{
|
{
|
||||||
AndroidApplicationInfo application_info =
|
AndroidApplicationInfo application_info =
|
||||||
CIrrDeviceAndroid::getApplicationInfo(global_android_app->activity);
|
CIrrDeviceAndroid::getApplicationInfo(global_android_activity);
|
||||||
|
|
||||||
lib_path = application_info.native_lib_dir;
|
lib_path = application_info.native_lib_dir;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,16 @@
|
|||||||
|
|
||||||
extern int main(int argc, char *argv[]);
|
extern int main(int argc, char *argv[]);
|
||||||
|
|
||||||
struct android_app* global_android_app;
|
struct android_app* global_android_app = NULL;
|
||||||
|
ANativeActivity* global_android_activity = NULL;
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
void set_global_android_activity(ANativeActivity* activity)
|
||||||
|
{
|
||||||
|
global_android_activity = activity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void override_default_params_for_mobile()
|
void override_default_params_for_mobile()
|
||||||
{
|
{
|
||||||
@ -92,6 +101,7 @@ void android_main(struct android_app* app)
|
|||||||
Log::info("AndroidMain", "Loading application...");
|
Log::info("AndroidMain", "Loading application...");
|
||||||
|
|
||||||
global_android_app = app;
|
global_android_app = app;
|
||||||
|
global_android_activity = app->activity;
|
||||||
|
|
||||||
// Initialize global Android window state variables
|
// Initialize global Android window state variables
|
||||||
CIrrDeviceAndroid::onCreate();
|
CIrrDeviceAndroid::onCreate();
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "../../../lib/irrlicht/source/Irrlicht/stk_android_native_app_glue.h"
|
#include "../../../lib/irrlicht/source/Irrlicht/stk_android_native_app_glue.h"
|
||||||
|
|
||||||
extern struct android_app* global_android_app;
|
extern struct android_app* global_android_app;
|
||||||
|
extern ANativeActivity* global_android_activity;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -44,6 +44,7 @@
|
|||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
#include "main_android.hpp"
|
||||||
#include "io/assets_android.hpp"
|
#include "io/assets_android.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -388,6 +389,21 @@ bool SeparateProcess::createChildProcess(const std::string& exe,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef void (*set_activity_proc_t)(ANativeActivity*);
|
||||||
|
set_activity_proc_t set_activity_proc =
|
||||||
|
(set_activity_proc_t)dlsym(m_child_handle, "set_global_android_activity");
|
||||||
|
|
||||||
|
if (set_activity_proc == NULL)
|
||||||
|
{
|
||||||
|
Log::error("SeparateProcess", "Error: Cannot get handle to "
|
||||||
|
"set_global_android_activity()");
|
||||||
|
dlclose(m_child_handle);
|
||||||
|
m_child_handle = NULL;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
set_activity_proc(global_android_activity);
|
||||||
|
|
||||||
const std::string exe_file = StringUtils::getBasename(exe);
|
const std::string exe_file = StringUtils::getBasename(exe);
|
||||||
auto rest_argv = StringUtils::split(argument, ' ');
|
auto rest_argv = StringUtils::split(argument, ' ');
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user