1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00

Merge pull request #453 from nullkiller/develop

Android build fix
This commit is contained in:
Alexander Shishkin 2018-05-26 18:06:44 +03:00 committed by GitHub
commit 8798e6e52b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 26 additions and 10 deletions

1
.gitignore vendored
View File

@ -52,3 +52,4 @@ VCMI_VS11.opensdf
/VCMI_VS11.VC.opendb
/AI/FuzzyLite.lib
/deps
.vs/

View File

@ -32,6 +32,8 @@ matrix:
env: VCMI_PLATFORM='mac'
addons:
apt:
update: true
coverity_scan:
project:
name: vcmi/vcmi

View File

@ -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:
@ -149,8 +155,10 @@ void CServerHandler::startLocalServerAndConnect()
th->update();
#ifdef VCMI_ANDROID
{
CAndroidVMHelper envHelper;
envHelper.callStaticVoidMethod(CAndroidVMHelper::NATIVE_METHODS_DEFAULT_CLASS, "startServer", true);
}
#else
threadRunLocalServer = std::make_shared<boost::thread>(&CServerHandler::threadRunServer, this); //runs server executable;
#endif

View File

@ -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

View File

@ -42,7 +42,6 @@ CAndroidVMHelper::CAndroidVMHelper()
detachInDestructor = false;
}
}
CAndroidVMHelper::~CAndroidVMHelper()
{
if(envPtr && detachInDestructor)

View File

@ -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

View File

@ -170,10 +170,16 @@ 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");
#endif
}
while(state == EServerState::LOBBY || state == EServerState::GAMEPLAY_STARTING)