Disable sound and curl, add freetype

This commit is contained in:
Lucas Baudin 2016-02-24 22:24:33 +01:00
parent c7c5788086
commit d4d3817d63
17 changed files with 104 additions and 11 deletions

View File

@ -3,7 +3,7 @@ NDK_PATH=android-ndk-r10e/
all: build apk
# target: build - Build the native code
build:
build: obj/freetype.stamp
NDK_CCACHE=ccache ${NDK_PATH}/ndk-build -j3
# target: apk - Make a debug APK
@ -20,3 +20,11 @@ help:
run:
adb shell am start -n org.supertuxkart.stk/android.app.NativeActivity
obj/freetype.stamp:
mkdir -p obj/freetype
cd jni/freetype && \
./configure --host=arm-linux-androideabi --prefix=/freetype --without-zlib --with-png=no --with-harfbuzz=no && \
make -j4 && \
make install DESTDIR=`pwd`/../../obj/freetype
touch obj/freetype.stamp

View File

@ -151,6 +151,16 @@ LOCAL_CFLAGS := -Ijni/bullet/src/ -I../include -I../../include
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
# Freetype
LOCAL_MODULE := freetype
LOCAL_PATH := .
LOCAL_SRC_FILES := obj/freetype/freetype/lib/libfreetype.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/include/freetype2
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_CPP_FEATURES += rtti
LOCAL_PATH:= jni
@ -162,12 +172,25 @@ LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv1_CM -lGLESv2
LOCAL_CFLAGS := -Ijni/irrlicht/source/Irrlicht/ -Ijni/irrlicht/include/ -Ijni/jpeglib/ -Ijni/libpng/ -Ijni/ -Iinclude/ -I$(call my-dir)/../../sources/android/native_app_glue/ -DBUILD_OGLES2 -DNO_IRR_COMPILE_WITH_SOFTWARE_ -DNO_IRR_COMPILE_WITH_BURNINGSVIDEO_
LOCAL_STATIC_LIBRARIES := jpeglib png
$(warning I$(call my-dir)/../../sources/android/native_app_glue/)
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_PATH:= jni
LOCAL_CPP_FEATURES += rtti exceptions
# STK
LOCAL_SRC_FILES := $(wildcard jni/src/*.cpp) $(wildcard jni/src/*/*.cpp) $(wildcard jni/src/*/*/*.cpp)
LOCAL_PATH:=.
LOCAL_MODULE := stk
LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv1_CM -lGLESv2
LOCAL_CFLAGS := -Ijni/irrlicht/source/Irrlicht/ -Ijni/irrlicht/include/ -Ijni/jpeglib/ -Ijni/libpng/ -Ijni/ -Iinclude/ -I$(call my-dir)/../../sources/android/native_app_glue/ -DBUILD_OGLES2 -DNO_IRR_COMPILE_WITH_SOFTWARE_ -DNO_IRR_COMPILE_WITH_BURNINGSVIDEO_ -DSUPERTUXKART_DATADIR=\"/sdcard/stk/\" -DANDROID -Ijni/src/ -Ijni/bullet/src -DNO_CURL -std=c++11 -Iobj/freetype/freetype/include/freetype2/ -Ijni/enet/include/ -Ijni/angelscript/include/ -DDEBUG -DNO_SOUND
LOCAL_SHARED_LIBRARIES := irrlicht
LOCAL_STATIC_LIBRARIES := bullet enet freetype
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_PATH:= jni
LOCAL_MODULE := irrlicht2
LOCAL_SRC_FILES := main.c

View File

@ -2201,7 +2201,6 @@ bool CIrrDeviceLinux::activateJoysticks(core::array<SJoystickInfo> & joystickInf
ActiveJoysticks.push_back(info);
returnInfo.HasGenericName = false;
returnInfo.Joystick = joystick;
returnInfo.PovHat = SJoystickInfo::POV_HAT_UNKNOWN;
returnInfo.Axes = info.axes;

View File

@ -142,7 +142,10 @@ namespace os
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#ifdef _IRR_ANDROID_PLATFORM_
#include <android/log.h>
#endif
namespace irr
{
@ -177,30 +180,38 @@ namespace os
void Printer::log(const c8* message, ELOG_LEVEL ll)
{
#ifdef _IRR_ANDROID_PLATFORM_
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "%s", message);
#endif
if (Logger)
Logger->log(message, ll);
}
void Printer::log(const wchar_t* message, ELOG_LEVEL ll)
{
#ifdef _IRR_ANDROID_PLATFORM_
char test[200];
wcstombs(test, message, 200);
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "%s", test);
#endif
if (Logger)
Logger->log(message, ll);
}
void Printer::log(const c8* message, const c8* hint, ELOG_LEVEL ll)
{
#ifdef _IRR_ANDROID_PLATFORM_
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "%s %s", message, hint);
#endif
if (Logger)
Logger->log(message, hint, ll);
}
void Printer::log(const c8* message, const io::path& hint, ELOG_LEVEL ll)
{
#ifdef _IRR_ANDROID_PLATFORM_
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "%s %s", message, core::stringc(hint).c_str());
#endif
if (Logger)
Logger->log(message, hint.c_str(), ll);
}

View File

@ -60,6 +60,7 @@ void NewsManager::init(bool force_refresh)
{
m_force_refresh = force_refresh;
#ifndef ANDROID
// The rest (which potentially involves downloading news.xml) is handled
// in a separate thread, so that the GUI remains responsive. It is only
// started if internet access is enabled, else nothing is done in the
@ -83,6 +84,7 @@ void NewsManager::init(bool force_refresh)
}
pthread_attr_destroy(&attr);
}
#endif
} //init

View File

@ -34,6 +34,7 @@
#include "audio/music_ogg.hpp"
#include "audio/sfx_openal.hpp"
#include "audio/sfx_manager.hpp"
#include "config/user_config.hpp"
#include "io/file_manager.hpp"
#include "utils/string_utils.hpp"

View File

@ -85,6 +85,7 @@ SFXManager::SFXManager()
loadSfx();
#ifndef NO_SOUND
pthread_cond_init(&m_cond_request, NULL);
pthread_attr_t attr;
@ -109,6 +110,7 @@ SFXManager::SFXManager()
errno);
}
pthread_attr_destroy(&attr);
#endif
setMasterSFXVolume( UserConfigParams::m_sfx_volume );
m_sfx_commands.lock();
@ -122,6 +124,7 @@ SFXManager::SFXManager()
*/
SFXManager::~SFXManager()
{
#ifndef NO_SOUND
m_thread_id.lock();
pthread_join(*m_thread_id.getData(), NULL);
delete m_thread_id.getData();
@ -164,6 +167,7 @@ SFXManager::~SFXManager()
m_all_sfx_types.clear();
}
m_all_sfx_types.clear();
#endif
} // ~SFXManager
@ -283,9 +287,11 @@ void SFXManager::queueCommand(SFXCommand *command)
*/
void SFXManager::stopThread()
{
#ifndef NO_SOUND
queue(SFX_EXIT);
// Make sure the thread wakes up.
pthread_cond_signal(&m_cond_request);
#endif
} // stopThread
//----------------------------------------------------------------------------
@ -296,6 +302,7 @@ void SFXManager::stopThread()
*/
void* SFXManager::mainLoop(void *obj)
{
#ifndef NO_SOUND
VS::setThreadName("SFXManager");
SFXManager *me = (SFXManager*)obj;
@ -414,6 +421,7 @@ void* SFXManager::mainLoop(void *obj)
delete me->m_sfx_commands.getData().front();
me->m_sfx_commands.getData().erase(me->m_sfx_commands.getData().begin());
}
#endif
return NULL;
} // mainLoop
@ -632,7 +640,7 @@ SFXBase* SFXManager::createSoundSource(SFXBuffer* buffer,
//assert( alIsBuffer(buffer->getBufferID()) ); crashes on server
SFXBase* sfx = new SFXOpenAL(buffer, positional, buffer->getGain(), owns_buffer);
#else
SFXBase* sfx = new DummySFX(buffer, positional, buffer->getGain(), owns_buffer);
SFXBase* sfx = new DummySFX(buffer, positional, buffer->getGain());
#endif
sfx->setMasterVolume(m_master_gain);
@ -701,9 +709,11 @@ void SFXManager::deleteSFXMapping(const std::string &name)
*/
void SFXManager::update()
{
#ifndef NO_SOUND
queue(SFX_UPDATE, (SFXBase*)NULL);
// Wake up the sfx thread to handle all queued up audio commands.
pthread_cond_signal(&m_cond_request);
#endif
} // update
//----------------------------------------------------------------------------

View File

@ -21,7 +21,9 @@
#define GLEW_STATIC
extern "C" {
#include <GL/glew.h>
#ifndef ANDROID
# include <GL/glew.h>
#endif
}
#include <cinttypes>

View File

@ -46,6 +46,10 @@
#include "utils/ptr_vector.hpp"
#include "utils/vec3.hpp"
#ifdef ANDROID
# include <GLES2/gl2ext.h>
#endif
namespace irr
{
namespace scene { class ISceneManager; class IMesh; class IAnimatedMeshSceneNode; class IAnimatedMesh;

View File

@ -1117,6 +1117,9 @@ void initUserConfig()
//=============================================================================
void initRest()
{
UserConfigParams::m_no_start_screen = true;
stk_config->load(file_manager->getAsset("stk_config.xml"));
irr_driver = new IrrDriver();

View File

@ -25,7 +25,9 @@
# include <winsock2.h>
#endif
#include <curl/curl.h>
#ifndef NO_CURL
# include <curl/curl.h>
#endif
#include <assert.h>
namespace Online
@ -92,7 +94,9 @@ namespace Online
m_string_buffer = "";
m_filename = "";
m_parameters = "";
#ifndef NO_CURL
m_curl_code = CURLE_OK;
#endif
m_progress.setAtomic(0);
} // init
@ -153,6 +157,7 @@ namespace Online
*/
void HTTPRequest::prepareOperation()
{
#ifndef NO_CURL
m_curl_session = curl_easy_init();
if (!m_curl_session)
{
@ -193,6 +198,7 @@ namespace Online
curl_easy_setopt(m_curl_session, CURLOPT_SSL_VERIFYHOST, 1L);
#endif
}
#endif
} // prepareOperation
// ------------------------------------------------------------------------
@ -200,6 +206,7 @@ namespace Online
*/
void HTTPRequest::operation()
{
#ifndef NO_CURL
if (!m_curl_session)
return;
@ -312,6 +319,7 @@ namespace Online
}
} // m_curl_code ==CURLE_OK
} // if fout
#endif
} // operation
// ------------------------------------------------------------------------
@ -321,6 +329,7 @@ namespace Online
*/
void HTTPRequest::afterOperation()
{
#ifndef NO_CURL
if (m_curl_code == CURLE_OK)
setProgress(1.0f);
else
@ -328,6 +337,7 @@ namespace Online
Request::afterOperation();
curl_easy_cleanup(m_curl_session);
#endif
} // afterOperation
// ------------------------------------------------------------------------

View File

@ -28,7 +28,9 @@
#ifdef WIN32
# include <winsock2.h>
#endif
#include <curl/curl.h>
#ifndef NO_CURL
# include <curl/curl.h>
#endif
#include <assert.h>
#include <string>
@ -62,11 +64,13 @@ namespace Online
* instead of being kept in in memory. Otherwise this is "". */
std::string m_filename;
#ifndef NO_CURL
/** Pointer to the curl data structure for this request. */
CURL *m_curl_session;
/** curl return code. */
CURLcode m_curl_code;
#endif
/** String to store the received data in. */
std::string m_string_buffer;
@ -97,7 +101,11 @@ namespace Online
// ------------------------------------------------------------------------
/** Returns true if there was an error downloading the file. */
#ifndef NO_CURL
bool hadDownloadError() const { return m_curl_code != CURLE_OK; }
#else
bool hadDownloadError() const { return true; }
#endif
// ------------------------------------------------------------------------
/** Returns the curl error message if an error has occurred.
@ -106,7 +114,11 @@ namespace Online
const char* getDownloadErrorMessage() const
{
assert(hadDownloadError());
#ifndef NO_CURL
return curl_easy_strerror(m_curl_code);
#else
return "cURL not available";
#endif
} // getDownloadErrorMessage
// ------------------------------------------------------------------------
@ -144,6 +156,7 @@ namespace Online
template <typename T>
void addParameter(const std::string &name, const T& value)
{
#ifndef NO_CURL
assert(isPreparing());
std::string s = StringUtils::toString(value);
@ -152,6 +165,7 @@ namespace Online
m_parameters.append(std::string(s1) + "=" + s2 + "&");
curl_free(s1);
curl_free(s2);
#endif
} // addParameter
// --------------------------------------------------------------------

View File

@ -29,7 +29,9 @@
#ifdef WIN32
# include <winsock2.h>
#endif
#include <curl/curl.h>
#ifndef NO_CURL
# include <curl/curl.h>
#endif
#include <assert.h>
#include <string>

View File

@ -72,7 +72,9 @@ namespace Online
m_menu_polling_interval = 60; // Default polling: every 60 seconds.
m_game_polling_interval = 60; // same for game polling
m_time_since_poll = m_menu_polling_interval;
#ifndef NO_CURL
curl_global_init(CURL_GLOBAL_DEFAULT);
#endif
pthread_cond_init(&m_cond_request, NULL);
m_abort.setAtomic(false);
} // RequestManager
@ -85,7 +87,9 @@ namespace Online
delete m_thread_id.getData();
m_thread_id.unlock();
pthread_cond_destroy(&m_cond_request);
#ifndef NO_CURL
curl_global_cleanup();
#endif
} // ~RequestManager
// ------------------------------------------------------------------------

View File

@ -35,7 +35,9 @@
# include <winsock2.h>
#endif
#include <curl/curl.h>
#ifndef NO_CURL
# include <curl/curl.h>
#endif
#include <queue>
#include <pthread.h>

View File

@ -24,7 +24,6 @@
#ifdef WIN32
# include <winsock2.h>
#endif
#include <curl/curl.h>
#include <assert.h>

View File

@ -28,7 +28,6 @@
#ifdef WIN32
# include <winsock2.h>
#endif
#include <curl/curl.h>
#include <assert.h>
#include <string>