Disable sound and curl, add freetype
This commit is contained in:
parent
c7c5788086
commit
d4d3817d63
@ -3,7 +3,7 @@ NDK_PATH=android-ndk-r10e/
|
|||||||
all: build apk
|
all: build apk
|
||||||
|
|
||||||
# target: build - Build the native code
|
# target: build - Build the native code
|
||||||
build:
|
build: obj/freetype.stamp
|
||||||
NDK_CCACHE=ccache ${NDK_PATH}/ndk-build -j3
|
NDK_CCACHE=ccache ${NDK_PATH}/ndk-build -j3
|
||||||
|
|
||||||
# target: apk - Make a debug APK
|
# target: apk - Make a debug APK
|
||||||
@ -20,3 +20,11 @@ help:
|
|||||||
|
|
||||||
run:
|
run:
|
||||||
adb shell am start -n org.supertuxkart.stk/android.app.NativeActivity
|
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
|
||||||
|
@ -151,6 +151,16 @@ LOCAL_CFLAGS := -Ijni/bullet/src/ -I../include -I../../include
|
|||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
include $(CLEAR_VARS)
|
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_CPP_FEATURES += rtti
|
||||||
LOCAL_PATH:= jni
|
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_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
|
LOCAL_STATIC_LIBRARIES := jpeglib png
|
||||||
$(warning I$(call my-dir)/../../sources/android/native_app_glue/)
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_PATH:= jni
|
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_MODULE := irrlicht2
|
||||||
LOCAL_SRC_FILES := main.c
|
LOCAL_SRC_FILES := main.c
|
||||||
|
@ -2201,7 +2201,6 @@ bool CIrrDeviceLinux::activateJoysticks(core::array<SJoystickInfo> & joystickInf
|
|||||||
|
|
||||||
ActiveJoysticks.push_back(info);
|
ActiveJoysticks.push_back(info);
|
||||||
|
|
||||||
returnInfo.HasGenericName = false;
|
|
||||||
returnInfo.Joystick = joystick;
|
returnInfo.Joystick = joystick;
|
||||||
returnInfo.PovHat = SJoystickInfo::POV_HAT_UNKNOWN;
|
returnInfo.PovHat = SJoystickInfo::POV_HAT_UNKNOWN;
|
||||||
returnInfo.Axes = info.axes;
|
returnInfo.Axes = info.axes;
|
||||||
|
@ -142,7 +142,10 @@ namespace os
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
#ifdef _IRR_ANDROID_PLATFORM_
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
@ -177,30 +180,38 @@ namespace os
|
|||||||
|
|
||||||
void Printer::log(const c8* message, ELOG_LEVEL ll)
|
void Printer::log(const c8* message, ELOG_LEVEL ll)
|
||||||
{
|
{
|
||||||
|
#ifdef _IRR_ANDROID_PLATFORM_
|
||||||
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "%s", message);
|
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "%s", message);
|
||||||
|
#endif
|
||||||
if (Logger)
|
if (Logger)
|
||||||
Logger->log(message, ll);
|
Logger->log(message, ll);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Printer::log(const wchar_t* message, ELOG_LEVEL ll)
|
void Printer::log(const wchar_t* message, ELOG_LEVEL ll)
|
||||||
{
|
{
|
||||||
|
#ifdef _IRR_ANDROID_PLATFORM_
|
||||||
char test[200];
|
char test[200];
|
||||||
wcstombs(test, message, 200);
|
wcstombs(test, message, 200);
|
||||||
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "%s", test);
|
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "%s", test);
|
||||||
|
#endif
|
||||||
if (Logger)
|
if (Logger)
|
||||||
Logger->log(message, ll);
|
Logger->log(message, ll);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Printer::log(const c8* message, const c8* hint, ELOG_LEVEL 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);
|
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "%s %s", message, hint);
|
||||||
|
#endif
|
||||||
if (Logger)
|
if (Logger)
|
||||||
Logger->log(message, hint, ll);
|
Logger->log(message, hint, ll);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Printer::log(const c8* message, const io::path& hint, ELOG_LEVEL 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());
|
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "%s %s", message, core::stringc(hint).c_str());
|
||||||
|
#endif
|
||||||
if (Logger)
|
if (Logger)
|
||||||
Logger->log(message, hint.c_str(), ll);
|
Logger->log(message, hint.c_str(), ll);
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,7 @@ void NewsManager::init(bool force_refresh)
|
|||||||
{
|
{
|
||||||
m_force_refresh = force_refresh;
|
m_force_refresh = force_refresh;
|
||||||
|
|
||||||
|
#ifndef ANDROID
|
||||||
// The rest (which potentially involves downloading news.xml) is handled
|
// The rest (which potentially involves downloading news.xml) is handled
|
||||||
// in a separate thread, so that the GUI remains responsive. It is only
|
// 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
|
// 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);
|
pthread_attr_destroy(&attr);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
} //init
|
} //init
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#include "audio/music_ogg.hpp"
|
#include "audio/music_ogg.hpp"
|
||||||
#include "audio/sfx_openal.hpp"
|
#include "audio/sfx_openal.hpp"
|
||||||
|
#include "audio/sfx_manager.hpp"
|
||||||
#include "config/user_config.hpp"
|
#include "config/user_config.hpp"
|
||||||
#include "io/file_manager.hpp"
|
#include "io/file_manager.hpp"
|
||||||
#include "utils/string_utils.hpp"
|
#include "utils/string_utils.hpp"
|
||||||
|
@ -85,6 +85,7 @@ SFXManager::SFXManager()
|
|||||||
|
|
||||||
loadSfx();
|
loadSfx();
|
||||||
|
|
||||||
|
#ifndef NO_SOUND
|
||||||
pthread_cond_init(&m_cond_request, NULL);
|
pthread_cond_init(&m_cond_request, NULL);
|
||||||
|
|
||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
@ -109,6 +110,7 @@ SFXManager::SFXManager()
|
|||||||
errno);
|
errno);
|
||||||
}
|
}
|
||||||
pthread_attr_destroy(&attr);
|
pthread_attr_destroy(&attr);
|
||||||
|
#endif
|
||||||
|
|
||||||
setMasterSFXVolume( UserConfigParams::m_sfx_volume );
|
setMasterSFXVolume( UserConfigParams::m_sfx_volume );
|
||||||
m_sfx_commands.lock();
|
m_sfx_commands.lock();
|
||||||
@ -122,6 +124,7 @@ SFXManager::SFXManager()
|
|||||||
*/
|
*/
|
||||||
SFXManager::~SFXManager()
|
SFXManager::~SFXManager()
|
||||||
{
|
{
|
||||||
|
#ifndef NO_SOUND
|
||||||
m_thread_id.lock();
|
m_thread_id.lock();
|
||||||
pthread_join(*m_thread_id.getData(), NULL);
|
pthread_join(*m_thread_id.getData(), NULL);
|
||||||
delete m_thread_id.getData();
|
delete m_thread_id.getData();
|
||||||
@ -164,6 +167,7 @@ SFXManager::~SFXManager()
|
|||||||
m_all_sfx_types.clear();
|
m_all_sfx_types.clear();
|
||||||
}
|
}
|
||||||
m_all_sfx_types.clear();
|
m_all_sfx_types.clear();
|
||||||
|
#endif
|
||||||
|
|
||||||
} // ~SFXManager
|
} // ~SFXManager
|
||||||
|
|
||||||
@ -283,9 +287,11 @@ void SFXManager::queueCommand(SFXCommand *command)
|
|||||||
*/
|
*/
|
||||||
void SFXManager::stopThread()
|
void SFXManager::stopThread()
|
||||||
{
|
{
|
||||||
|
#ifndef NO_SOUND
|
||||||
queue(SFX_EXIT);
|
queue(SFX_EXIT);
|
||||||
// Make sure the thread wakes up.
|
// Make sure the thread wakes up.
|
||||||
pthread_cond_signal(&m_cond_request);
|
pthread_cond_signal(&m_cond_request);
|
||||||
|
#endif
|
||||||
} // stopThread
|
} // stopThread
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@ -296,6 +302,7 @@ void SFXManager::stopThread()
|
|||||||
*/
|
*/
|
||||||
void* SFXManager::mainLoop(void *obj)
|
void* SFXManager::mainLoop(void *obj)
|
||||||
{
|
{
|
||||||
|
#ifndef NO_SOUND
|
||||||
VS::setThreadName("SFXManager");
|
VS::setThreadName("SFXManager");
|
||||||
SFXManager *me = (SFXManager*)obj;
|
SFXManager *me = (SFXManager*)obj;
|
||||||
|
|
||||||
@ -414,6 +421,7 @@ void* SFXManager::mainLoop(void *obj)
|
|||||||
delete me->m_sfx_commands.getData().front();
|
delete me->m_sfx_commands.getData().front();
|
||||||
me->m_sfx_commands.getData().erase(me->m_sfx_commands.getData().begin());
|
me->m_sfx_commands.getData().erase(me->m_sfx_commands.getData().begin());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
} // mainLoop
|
} // mainLoop
|
||||||
|
|
||||||
@ -632,7 +640,7 @@ SFXBase* SFXManager::createSoundSource(SFXBuffer* buffer,
|
|||||||
//assert( alIsBuffer(buffer->getBufferID()) ); crashes on server
|
//assert( alIsBuffer(buffer->getBufferID()) ); crashes on server
|
||||||
SFXBase* sfx = new SFXOpenAL(buffer, positional, buffer->getGain(), owns_buffer);
|
SFXBase* sfx = new SFXOpenAL(buffer, positional, buffer->getGain(), owns_buffer);
|
||||||
#else
|
#else
|
||||||
SFXBase* sfx = new DummySFX(buffer, positional, buffer->getGain(), owns_buffer);
|
SFXBase* sfx = new DummySFX(buffer, positional, buffer->getGain());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sfx->setMasterVolume(m_master_gain);
|
sfx->setMasterVolume(m_master_gain);
|
||||||
@ -701,9 +709,11 @@ void SFXManager::deleteSFXMapping(const std::string &name)
|
|||||||
*/
|
*/
|
||||||
void SFXManager::update()
|
void SFXManager::update()
|
||||||
{
|
{
|
||||||
|
#ifndef NO_SOUND
|
||||||
queue(SFX_UPDATE, (SFXBase*)NULL);
|
queue(SFX_UPDATE, (SFXBase*)NULL);
|
||||||
// Wake up the sfx thread to handle all queued up audio commands.
|
// Wake up the sfx thread to handle all queued up audio commands.
|
||||||
pthread_cond_signal(&m_cond_request);
|
pthread_cond_signal(&m_cond_request);
|
||||||
|
#endif
|
||||||
} // update
|
} // update
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -21,7 +21,9 @@
|
|||||||
#define GLEW_STATIC
|
#define GLEW_STATIC
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <GL/glew.h>
|
#ifndef ANDROID
|
||||||
|
# include <GL/glew.h>
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
|
|
||||||
|
@ -46,6 +46,10 @@
|
|||||||
#include "utils/ptr_vector.hpp"
|
#include "utils/ptr_vector.hpp"
|
||||||
#include "utils/vec3.hpp"
|
#include "utils/vec3.hpp"
|
||||||
|
|
||||||
|
#ifdef ANDROID
|
||||||
|
# include <GLES2/gl2ext.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
namespace scene { class ISceneManager; class IMesh; class IAnimatedMeshSceneNode; class IAnimatedMesh;
|
namespace scene { class ISceneManager; class IMesh; class IAnimatedMeshSceneNode; class IAnimatedMesh;
|
||||||
|
@ -1117,6 +1117,9 @@ void initUserConfig()
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
void initRest()
|
void initRest()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
UserConfigParams::m_no_start_screen = true;
|
||||||
|
|
||||||
stk_config->load(file_manager->getAsset("stk_config.xml"));
|
stk_config->load(file_manager->getAsset("stk_config.xml"));
|
||||||
|
|
||||||
irr_driver = new IrrDriver();
|
irr_driver = new IrrDriver();
|
||||||
|
@ -25,7 +25,9 @@
|
|||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <curl/curl.h>
|
#ifndef NO_CURL
|
||||||
|
# include <curl/curl.h>
|
||||||
|
#endif
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
namespace Online
|
namespace Online
|
||||||
@ -92,7 +94,9 @@ namespace Online
|
|||||||
m_string_buffer = "";
|
m_string_buffer = "";
|
||||||
m_filename = "";
|
m_filename = "";
|
||||||
m_parameters = "";
|
m_parameters = "";
|
||||||
|
#ifndef NO_CURL
|
||||||
m_curl_code = CURLE_OK;
|
m_curl_code = CURLE_OK;
|
||||||
|
#endif
|
||||||
m_progress.setAtomic(0);
|
m_progress.setAtomic(0);
|
||||||
} // init
|
} // init
|
||||||
|
|
||||||
@ -153,6 +157,7 @@ namespace Online
|
|||||||
*/
|
*/
|
||||||
void HTTPRequest::prepareOperation()
|
void HTTPRequest::prepareOperation()
|
||||||
{
|
{
|
||||||
|
#ifndef NO_CURL
|
||||||
m_curl_session = curl_easy_init();
|
m_curl_session = curl_easy_init();
|
||||||
if (!m_curl_session)
|
if (!m_curl_session)
|
||||||
{
|
{
|
||||||
@ -193,6 +198,7 @@ namespace Online
|
|||||||
curl_easy_setopt(m_curl_session, CURLOPT_SSL_VERIFYHOST, 1L);
|
curl_easy_setopt(m_curl_session, CURLOPT_SSL_VERIFYHOST, 1L);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
} // prepareOperation
|
} // prepareOperation
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
@ -200,6 +206,7 @@ namespace Online
|
|||||||
*/
|
*/
|
||||||
void HTTPRequest::operation()
|
void HTTPRequest::operation()
|
||||||
{
|
{
|
||||||
|
#ifndef NO_CURL
|
||||||
if (!m_curl_session)
|
if (!m_curl_session)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -312,6 +319,7 @@ namespace Online
|
|||||||
}
|
}
|
||||||
} // m_curl_code ==CURLE_OK
|
} // m_curl_code ==CURLE_OK
|
||||||
} // if fout
|
} // if fout
|
||||||
|
#endif
|
||||||
} // operation
|
} // operation
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
@ -321,6 +329,7 @@ namespace Online
|
|||||||
*/
|
*/
|
||||||
void HTTPRequest::afterOperation()
|
void HTTPRequest::afterOperation()
|
||||||
{
|
{
|
||||||
|
#ifndef NO_CURL
|
||||||
if (m_curl_code == CURLE_OK)
|
if (m_curl_code == CURLE_OK)
|
||||||
setProgress(1.0f);
|
setProgress(1.0f);
|
||||||
else
|
else
|
||||||
@ -328,6 +337,7 @@ namespace Online
|
|||||||
|
|
||||||
Request::afterOperation();
|
Request::afterOperation();
|
||||||
curl_easy_cleanup(m_curl_session);
|
curl_easy_cleanup(m_curl_session);
|
||||||
|
#endif
|
||||||
} // afterOperation
|
} // afterOperation
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
@ -28,7 +28,9 @@
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
#endif
|
#endif
|
||||||
#include <curl/curl.h>
|
#ifndef NO_CURL
|
||||||
|
# include <curl/curl.h>
|
||||||
|
#endif
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -62,11 +64,13 @@ namespace Online
|
|||||||
* instead of being kept in in memory. Otherwise this is "". */
|
* instead of being kept in in memory. Otherwise this is "". */
|
||||||
std::string m_filename;
|
std::string m_filename;
|
||||||
|
|
||||||
|
#ifndef NO_CURL
|
||||||
/** Pointer to the curl data structure for this request. */
|
/** Pointer to the curl data structure for this request. */
|
||||||
CURL *m_curl_session;
|
CURL *m_curl_session;
|
||||||
|
|
||||||
/** curl return code. */
|
/** curl return code. */
|
||||||
CURLcode m_curl_code;
|
CURLcode m_curl_code;
|
||||||
|
#endif
|
||||||
|
|
||||||
/** String to store the received data in. */
|
/** String to store the received data in. */
|
||||||
std::string m_string_buffer;
|
std::string m_string_buffer;
|
||||||
@ -97,7 +101,11 @@ namespace Online
|
|||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Returns true if there was an error downloading the file. */
|
/** Returns true if there was an error downloading the file. */
|
||||||
|
#ifndef NO_CURL
|
||||||
bool hadDownloadError() const { return m_curl_code != CURLE_OK; }
|
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.
|
/** Returns the curl error message if an error has occurred.
|
||||||
@ -106,7 +114,11 @@ namespace Online
|
|||||||
const char* getDownloadErrorMessage() const
|
const char* getDownloadErrorMessage() const
|
||||||
{
|
{
|
||||||
assert(hadDownloadError());
|
assert(hadDownloadError());
|
||||||
|
#ifndef NO_CURL
|
||||||
return curl_easy_strerror(m_curl_code);
|
return curl_easy_strerror(m_curl_code);
|
||||||
|
#else
|
||||||
|
return "cURL not available";
|
||||||
|
#endif
|
||||||
} // getDownloadErrorMessage
|
} // getDownloadErrorMessage
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
@ -144,6 +156,7 @@ namespace Online
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
void addParameter(const std::string &name, const T& value)
|
void addParameter(const std::string &name, const T& value)
|
||||||
{
|
{
|
||||||
|
#ifndef NO_CURL
|
||||||
assert(isPreparing());
|
assert(isPreparing());
|
||||||
std::string s = StringUtils::toString(value);
|
std::string s = StringUtils::toString(value);
|
||||||
|
|
||||||
@ -152,6 +165,7 @@ namespace Online
|
|||||||
m_parameters.append(std::string(s1) + "=" + s2 + "&");
|
m_parameters.append(std::string(s1) + "=" + s2 + "&");
|
||||||
curl_free(s1);
|
curl_free(s1);
|
||||||
curl_free(s2);
|
curl_free(s2);
|
||||||
|
#endif
|
||||||
} // addParameter
|
} // addParameter
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
@ -29,7 +29,9 @@
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
#endif
|
#endif
|
||||||
#include <curl/curl.h>
|
#ifndef NO_CURL
|
||||||
|
# include <curl/curl.h>
|
||||||
|
#endif
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -72,7 +72,9 @@ namespace Online
|
|||||||
m_menu_polling_interval = 60; // Default polling: every 60 seconds.
|
m_menu_polling_interval = 60; // Default polling: every 60 seconds.
|
||||||
m_game_polling_interval = 60; // same for game polling
|
m_game_polling_interval = 60; // same for game polling
|
||||||
m_time_since_poll = m_menu_polling_interval;
|
m_time_since_poll = m_menu_polling_interval;
|
||||||
|
#ifndef NO_CURL
|
||||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||||
|
#endif
|
||||||
pthread_cond_init(&m_cond_request, NULL);
|
pthread_cond_init(&m_cond_request, NULL);
|
||||||
m_abort.setAtomic(false);
|
m_abort.setAtomic(false);
|
||||||
} // RequestManager
|
} // RequestManager
|
||||||
@ -85,7 +87,9 @@ namespace Online
|
|||||||
delete m_thread_id.getData();
|
delete m_thread_id.getData();
|
||||||
m_thread_id.unlock();
|
m_thread_id.unlock();
|
||||||
pthread_cond_destroy(&m_cond_request);
|
pthread_cond_destroy(&m_cond_request);
|
||||||
|
#ifndef NO_CURL
|
||||||
curl_global_cleanup();
|
curl_global_cleanup();
|
||||||
|
#endif
|
||||||
} // ~RequestManager
|
} // ~RequestManager
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
@ -35,7 +35,9 @@
|
|||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <curl/curl.h>
|
#ifndef NO_CURL
|
||||||
|
# include <curl/curl.h>
|
||||||
|
#endif
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
#endif
|
#endif
|
||||||
#include <curl/curl.h>
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
#endif
|
#endif
|
||||||
#include <curl/curl.h>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user