mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
fix android build
This commit is contained in:
parent
20161a2449
commit
ee033e9c9c
@ -22,6 +22,8 @@
|
||||
|
||||
#ifndef VCMI_ANDROID
|
||||
#include "../lib/Interprocess.h"
|
||||
#else
|
||||
#include "../lib/CAndroidVMHelper.h"
|
||||
#endif
|
||||
#include "../lib/CConfigHandler.h"
|
||||
#include "../lib/CGeneralTextHandler.h"
|
||||
@ -44,6 +46,10 @@
|
||||
|
||||
template<typename T> class CApplyOnLobby;
|
||||
|
||||
#ifdef VCMI_ANDROID
|
||||
extern std::atomic_bool androidTestServerReadyFlag;
|
||||
#endif
|
||||
|
||||
class CBaseForLobbyApply
|
||||
{
|
||||
public:
|
||||
@ -151,6 +157,7 @@ void CServerHandler::startLocalServerAndConnect()
|
||||
#ifdef VCMI_ANDROID
|
||||
CAndroidVMHelper envHelper;
|
||||
envHelper.callStaticVoidMethod(CAndroidVMHelper::NATIVE_METHODS_DEFAULT_CLASS, "startServer", true);
|
||||
envHelper.Detach();
|
||||
#else
|
||||
threadRunLocalServer = std::make_shared<boost::thread>(&CServerHandler::threadRunServer, this); //runs server executable;
|
||||
#endif
|
||||
|
@ -633,12 +633,12 @@ void CTextInput::notifyAndroidTextInputChanged(std::string & text)
|
||||
auto fun = [&text](JNIEnv * env, jclass cls, jmethodID method)
|
||||
{
|
||||
auto jtext = env->NewStringUTF(text.c_str());
|
||||
env->CallStaticObjectMethod(cls, method, jtext);
|
||||
env->CallStaticVoidMethod(cls, method, jtext);
|
||||
env->DeleteLocalRef(jtext);
|
||||
};
|
||||
CAndroidVMHelper vmHelper;
|
||||
vmHelper.callCustomMethod(CAndroidVMHelper::NATIVE_METHODS_DEFAULT_CLASS, "notifyTextInputChanged",
|
||||
"(Ljava/lang/String;)V", fun);
|
||||
"(Ljava/lang/String;)V", fun, true);
|
||||
}
|
||||
#endif //VCMI_ANDROID
|
||||
|
||||
|
@ -42,8 +42,12 @@ CAndroidVMHelper::CAndroidVMHelper()
|
||||
detachInDestructor = false;
|
||||
}
|
||||
}
|
||||
|
||||
CAndroidVMHelper::~CAndroidVMHelper()
|
||||
{
|
||||
Detach();
|
||||
}
|
||||
|
||||
void CAndroidVMHelper::Detach()
|
||||
{
|
||||
if(envPtr && detachInDestructor)
|
||||
{
|
||||
|
@ -29,6 +29,8 @@ public:
|
||||
|
||||
~CAndroidVMHelper();
|
||||
|
||||
void Detach();
|
||||
|
||||
JNIEnv * get();
|
||||
|
||||
jclass findClassloadedClass(const std::string & name);
|
||||
|
@ -168,10 +168,10 @@ set_source_files_properties(${CMAKE_BINARY_DIR}/Version.cpp
|
||||
)
|
||||
|
||||
set(lib_HEADERS
|
||||
${CMAKE_HOME_DIRECTORY}/include/vstd/CLoggerBase.h
|
||||
${CMAKE_HOME_DIRECTORY}/include/vstd/ContainerUtils.h
|
||||
${CMAKE_HOME_DIRECTORY}/include/vstd/RNG.h
|
||||
${CMAKE_HOME_DIRECTORY}/include/vstd/StringUtils.h
|
||||
../include/vstd/CLoggerBase.h
|
||||
../include/vstd/ContainerUtils.h
|
||||
../include/vstd/RNG.h
|
||||
../include/vstd/StringUtils.h
|
||||
StdInc.h
|
||||
../Global.h
|
||||
|
||||
|
@ -170,10 +170,17 @@ void CVCMIServer::run()
|
||||
#endif
|
||||
|
||||
startAsyncAccept();
|
||||
|
||||
#ifndef VCMI_ANDROID
|
||||
if(shm)
|
||||
{
|
||||
shm->sr->setToReadyAndNotify(port);
|
||||
}
|
||||
#else
|
||||
CAndroidVMHelper vmHelper;
|
||||
vmHelper.callStaticVoidMethod(CAndroidVMHelper::NATIVE_METHODS_DEFAULT_CLASS, "onServerReady");
|
||||
vmHelper.Detach();
|
||||
#endif
|
||||
}
|
||||
|
||||
while(state == EServerState::LOBBY || state == EServerState::GAMEPLAY_STARTING)
|
||||
|
Loading…
Reference in New Issue
Block a user