Fixed freeze in fheroes2 when separate rendering thread is used
This commit is contained in:
4
build.sh
4
build.sh
@@ -33,5 +33,5 @@ cd project && env PATH=$NDKBUILDPATH nice -n19 ndk-build -j4 V=1 && \
|
||||
`which ndk-build | sed 's@/ndk-build@@'`/toolchains/arm-linux-androideabi-4.4.3/prebuilt/$MYARCH/bin/arm-linux-androideabi-strip --strip-unneeded libs/armeabi/libapplication.so \
|
||||
|| true ; } && \
|
||||
ant debug && \
|
||||
test -z "$1" && cd bin && adb install -r DemoActivity-debug.apk
|
||||
|
||||
test -z "$1" && cd bin && adb install -r DemoActivity-debug.apk 2>&1 | grep 'Failure' && \
|
||||
adb uninstall `grep AppFullName ../../AndroidAppSettings.cfg | sed 's/.*=//'` && adb install DemoActivity-debug.apk
|
||||
|
||||
@@ -23,13 +23,12 @@ AppTouchscreenKeyboardKeysAmount=0
|
||||
AppTouchscreenKeyboardKeysAmountAutoFire=0
|
||||
RedefinedKeysScreenKb="LCTRL M T H E C SPACE C S L"
|
||||
MultiABI=n
|
||||
AppVersionCode=229312
|
||||
AppVersionName="2293.12"
|
||||
AppVersionCode=231012
|
||||
AppVersionName="2310.12"
|
||||
CompiledLibraries="sdl_net sdl_mixer sdl_image sdl_ttf png intl"
|
||||
CustomBuildScript=n
|
||||
AppCflags='-finline-functions -O2 -DWITH_ZLIB -DWITH_MIXER -DWITH_XML -DWITH_IMAGE -DWITH_TTF -DWITH_AI=simple'
|
||||
AppLdflags=''
|
||||
AppSubdirsBuild='fheroes2/src/engine/* fheroes2/src/xmlccwrap/* fheroes2/src/fheroes2/ai fheroes2/src/fheroes2/ai/simple fheroes2/src/fheroes2/agg fheroes2/src/fheroes2/algorithm fheroes2/src/fheroes2/army fheroes2/src/fheroes2/battle2 fheroes2/src/fheroes2/castle fheroes2/src/fheroes2/dialog fheroes2/src/fheroes2/editor fheroes2/src/fheroes2/game fheroes2/src/fheroes2/gui fheroes2/src/fheroes2/heroes fheroes2/src/fheroes2/image fheroes2/src/fheroes2/kingdom fheroes2/src/fheroes2/maps fheroes2/src/fheroes2/monster fheroes2/src/fheroes2/network fheroes2/src/fheroes2/objects fheroes2/src/fheroes2/pocketpc fheroes2/src/fheroes2/resource fheroes2/src/fheroes2/spell fheroes2/src/fheroes2/system fheroes2/src/fheroes2/test'
|
||||
AppUseCrystaXToolchain=n
|
||||
AppCmdline='fheroes2 -d 500'
|
||||
ReadmeText='^You may press "Home" now - the data will be downloaded in background'
|
||||
|
||||
@@ -1 +1 @@
|
||||
ballfield
|
||||
fheroes2
|
||||
@@ -1044,7 +1044,9 @@ void SDL_ANDROID_MultiThreadedVideoLoop()
|
||||
if( signalNeeded )
|
||||
SDL_CondSignal(videoThread.cond2);
|
||||
if( swapBuffersNeeded )
|
||||
{
|
||||
SDL_ANDROID_CallJavaSwapBuffers();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1069,7 +1071,6 @@ SDL_Surface *ANDROID_SetVideoModeMT(_THIS, SDL_Surface *current, int width, int
|
||||
{
|
||||
if( flags & SDL_OPENGL || flags & SDL_HWSURFACE )
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_FATAL, "libSDL", "SDL_SetVideoMode(): cannot use multi-threaded video with SDL_OPENGL or SDL_HWSURFACE flags");
|
||||
return NULL;
|
||||
}
|
||||
SDL_mutexP(videoThread.mutex);
|
||||
|
||||
@@ -1199,57 +1199,61 @@ static SDL_mutex * BufferedEventsMutex = NULL;
|
||||
|
||||
extern void SDL_ANDROID_PumpEvents()
|
||||
{
|
||||
SDL_Event ev;
|
||||
SDL_ANDROID_processAndroidTrackballDampening();
|
||||
SDL_ANDROID_processMoveMouseWithKeyboard();
|
||||
|
||||
if( !BufferedEventsMutex )
|
||||
BufferedEventsMutex = SDL_CreateMutex();
|
||||
|
||||
SDL_mutexP(BufferedEventsMutex);
|
||||
while( BufferedEventsStart != BufferedEventsEnd )
|
||||
{
|
||||
SDL_Event * ev = &BufferedEvents[BufferedEventsStart];
|
||||
ev = BufferedEvents[BufferedEventsStart];
|
||||
BufferedEvents[BufferedEventsStart].type = 0;
|
||||
BufferedEventsStart++;
|
||||
if( BufferedEventsStart >= MAX_BUFFERED_EVENTS )
|
||||
BufferedEventsStart = 0;
|
||||
SDL_mutexV(BufferedEventsMutex);
|
||||
|
||||
switch( ev->type )
|
||||
switch( ev.type )
|
||||
{
|
||||
case SDL_MOUSEMOTION:
|
||||
SDL_SendMouseMotion(NULL, 0, ev->motion.x, ev->motion.y);
|
||||
SDL_SendMouseMotion(NULL, 0, ev.motion.x, ev.motion.y);
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
if( ((oldMouseButtons & SDL_BUTTON(ev->button.button)) != 0) != ev->button.state )
|
||||
if( ((oldMouseButtons & SDL_BUTTON(ev.button.button)) != 0) != ev.button.state )
|
||||
{
|
||||
oldMouseButtons = (oldMouseButtons & ~SDL_BUTTON(ev->button.button)) | (ev->button.state ? SDL_BUTTON(ev->button.button) : 0);
|
||||
SDL_SendMouseButton( NULL, ev->button.state, ev->button.button );
|
||||
oldMouseButtons = (oldMouseButtons & ~SDL_BUTTON(ev.button.button)) | (ev.button.state ? SDL_BUTTON(ev.button.button) : 0);
|
||||
SDL_SendMouseButton( NULL, ev.button.state, ev.button.button );
|
||||
}
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "SDL_KEYDOWN: %i %i", ev->key.keysym.sym, ev->key.state);
|
||||
SDL_SendKeyboardKey( ev->key.state, &ev->key.keysym );
|
||||
SDL_SendKeyboardKey( ev.key.state, &ev.key.keysym );
|
||||
break;
|
||||
case SDL_JOYAXISMOTION:
|
||||
if( ev->jaxis.which < MAX_MULTITOUCH_POINTERS+1 && SDL_ANDROID_CurrentJoysticks[ev->jaxis.which] )
|
||||
SDL_PrivateJoystickAxis( SDL_ANDROID_CurrentJoysticks[ev->jaxis.which], ev->jaxis.axis, ev->jaxis.value );
|
||||
if( ev.jaxis.which < MAX_MULTITOUCH_POINTERS+1 && SDL_ANDROID_CurrentJoysticks[ev.jaxis.which] )
|
||||
SDL_PrivateJoystickAxis( SDL_ANDROID_CurrentJoysticks[ev.jaxis.which], ev.jaxis.axis, ev.jaxis.value );
|
||||
break;
|
||||
case SDL_JOYBUTTONDOWN:
|
||||
if( ev->jbutton.which < MAX_MULTITOUCH_POINTERS+1 && SDL_ANDROID_CurrentJoysticks[ev->jbutton.which] )
|
||||
SDL_PrivateJoystickButton( SDL_ANDROID_CurrentJoysticks[ev->jbutton.which], ev->jbutton.button, ev->jbutton.state );
|
||||
if( ev.jbutton.which < MAX_MULTITOUCH_POINTERS+1 && SDL_ANDROID_CurrentJoysticks[ev.jbutton.which] )
|
||||
SDL_PrivateJoystickButton( SDL_ANDROID_CurrentJoysticks[ev.jbutton.which], ev.jbutton.button, ev.jbutton.state );
|
||||
break;
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
case SDL_FINGERMOTION:
|
||||
SDL_SendTouchMotion(0, ev->tfinger.fingerId, 0, ev->tfinger.x, ev->tfinger.y, ev->tfinger.pressure);
|
||||
SDL_SendTouchMotion(0, ev.tfinger.fingerId, 0, ev.tfinger.x, ev.tfinger.y, ev.tfinger.pressure);
|
||||
break;
|
||||
case SDL_FINGERDOWN:
|
||||
SDL_SendFingerDown(0, ev->tfinger.fingerId, ev->tfinger.state ? 1 : 0, ev->tfinger.x, ev->tfinger.y, ev->tfinger.pressure);
|
||||
SDL_SendFingerDown(0, ev.tfinger.fingerId, ev.tfinger.state ? 1 : 0, ev.tfinger.x, ev.tfinger.y, ev.tfinger.pressure);
|
||||
break;
|
||||
case SDL_TEXTINPUT:
|
||||
SDL_SendKeyboardText(ev->text.text);
|
||||
SDL_SendKeyboardText(ev.text.text);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
ev->type = 0;
|
||||
BufferedEventsStart++;
|
||||
if( BufferedEventsStart >= MAX_BUFFERED_EVENTS )
|
||||
BufferedEventsStart = 0;
|
||||
|
||||
SDL_mutexP(BufferedEventsMutex);
|
||||
}
|
||||
SDL_mutexV(BufferedEventsMutex);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user