Merge branch 'master' into cmake
This commit is contained in:
+1
-1
@@ -84,7 +84,7 @@ OBJS = $(GENERIC_OBJS) $(LINUX_OBJS)
|
||||
TARGET_LIB = libjge.a
|
||||
TARGET_HGE = libhgetools.a
|
||||
INCDIR = $(shell freetype-config --cflags 2> /dev/null) -I/usr/X11/include -I/usr/include/boost -Isrc/zipFS -Iinclude/
|
||||
CXXFLAGS += -DLINUX $(FMOD)
|
||||
CXXFLAGS += -DLINUX -DNETWORK_SUPPORT $(FMOD)
|
||||
CXXFLAGS += $(INCDIR)
|
||||
LIBDIR = lib/linux
|
||||
endif
|
||||
|
||||
@@ -394,6 +394,7 @@ class JGE
|
||||
void SetJNIEnv(JNIEnv * env, jclass cls);
|
||||
void sendJNICommand(std::string command);
|
||||
std::string getFileSystemLocation();
|
||||
std::string getFileUserFolderPath();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
@@ -30,6 +30,7 @@ const int kInfoMenuID = -200;
|
||||
const int kRandomPlayerMenuID = -11;
|
||||
const int kRandomAIPlayerMenuID = -12;
|
||||
const int kEvilTwinMenuID = -14;
|
||||
const int kCommanderMenuID = -33;
|
||||
|
||||
class JGuiListener
|
||||
{
|
||||
|
||||
@@ -129,10 +129,11 @@ JFileSystem::JFileSystem(const string & _userPath, const string & _systemPath)
|
||||
DebugTrace("User path " << userPath);
|
||||
DebugTrace("System path " << systemPath);
|
||||
#elif defined (ANDROID)
|
||||
userPath = JGE::GetInstance()->getFileSystemLocation();
|
||||
systemPath = "";
|
||||
userPath = JGE::GetInstance()->getFileUserFolderPath();
|
||||
systemPath = JGE::GetInstance()->getFileSystemLocation();
|
||||
|
||||
DebugTrace("User path " << userPath);
|
||||
DebugTrace("User path " << userPath);
|
||||
DebugTrace("System path " << systemPath);
|
||||
#elif defined (QT_CONFIG)
|
||||
|
||||
QDir sysDir(RESDIR);
|
||||
@@ -257,6 +258,7 @@ void JFileSystem::clearZipCache()
|
||||
|
||||
bool JFileSystem::AttachZipFile(const string &zipfile, char *password /* = NULL */)
|
||||
{
|
||||
#ifndef WIN32
|
||||
if (mZipAvailable && mZipFile.is_open())
|
||||
{
|
||||
if (mZipFileName != zipfile)
|
||||
@@ -264,7 +266,7 @@ bool JFileSystem::AttachZipFile(const string &zipfile, char *password /* = NULL
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
mZipFileName = zipfile;
|
||||
mPassword = password;
|
||||
|
||||
|
||||
+31
-2
@@ -668,7 +668,7 @@ string JGE::getFileSystemLocation()
|
||||
if (env == NULL)
|
||||
{
|
||||
DebugTrace("An Error Occurred in getting the JNI Environment whie trying to get the system folder location. Defaulting to /mnt/sdcard/net.wagic.app/Wagic");
|
||||
return "/mnt/sdcard/Wagic";
|
||||
return "/mnt/sdcard/Wagic/Res";
|
||||
};
|
||||
|
||||
jclass jniClass = env->FindClass("org/libsdl/app/SDLActivity");
|
||||
@@ -677,7 +677,36 @@ string JGE::getFileSystemLocation()
|
||||
if (methodId == 0)
|
||||
{
|
||||
DebugTrace("An Error Occurred in getting the JNI methodID for getSystemFolderPath. Defaulting to /mnt/sdcard/Wagic");
|
||||
return "/mnt/sdcard/Wagic";
|
||||
return "/mnt/sdcard/Wagic/Res";
|
||||
};
|
||||
|
||||
jstring systemPath = (jstring) env->CallStaticObjectMethod(jniClass, methodId);
|
||||
|
||||
// Now convert the Java String to C++ char array
|
||||
const char* cstr = env->GetStringUTFChars(systemPath, 0);
|
||||
string retVal (cstr);
|
||||
env->ReleaseStringUTFChars(systemPath, cstr);
|
||||
env->DeleteLocalRef(systemPath);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
string JGE::getFileUserFolderPath()
|
||||
{
|
||||
JNIEnv * env = getJNIEnv();
|
||||
if (env == NULL)
|
||||
{
|
||||
DebugTrace("An Error Occurred in getting the JNI Environment whie trying to get the system folder location. Defaulting to /mnt/sdcard/net.wagic.app/Wagic");
|
||||
return "/mnt/sdcard/Wagic/User";
|
||||
};
|
||||
|
||||
jclass jniClass = env->FindClass("org/libsdl/app/SDLActivity");
|
||||
jmethodID methodId = env->GetStaticMethodID( jniClass, "getUserFolderPath", "()Ljava/lang/String;");
|
||||
|
||||
if (methodId == 0)
|
||||
{
|
||||
DebugTrace("An Error Occurred in getting the JNI methodID for getSystemFolderPath. Defaulting to /mnt/sdcard/Wagic");
|
||||
return "/mnt/sdcard/Wagic/User";
|
||||
};
|
||||
|
||||
jstring systemPath = (jstring) env->CallStaticObjectMethod(jniClass, methodId);
|
||||
|
||||
+1
-1
@@ -197,7 +197,7 @@ bool JGuiController::CheckUserInput(JButton key)
|
||||
mObjects[mCurr]->Entering();
|
||||
}
|
||||
mEngine->LeftClickedProcessed();
|
||||
mEngine->ResetInput();
|
||||
mEngine->ResetInput();
|
||||
return true;
|
||||
}
|
||||
mEngine->LeftClickedProcessed();
|
||||
|
||||
@@ -184,7 +184,13 @@ JMusic *JSoundSystem::LoadMusic(const char *fileName)
|
||||
const SLboolean req[2] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE};
|
||||
result = (*engineEngine)->CreateAudioPlayer(engineEngine, &music->playerObject, &audioSrc, &audioSnk, 2, ids, req);
|
||||
DebugTrace("result " << result);
|
||||
|
||||
|
||||
if(result == SL_RESULT_MEMORY_FAILURE){
|
||||
delete music;
|
||||
mCurrentMusic = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// realize the player
|
||||
result = (*music->playerObject)->Realize(music->playerObject, SL_BOOLEAN_FALSE);
|
||||
DebugTrace("result " << result);
|
||||
@@ -303,6 +309,12 @@ JSample *JSoundSystem::LoadSample(const char *fileName)
|
||||
1, ids, req);
|
||||
DebugTrace("result " << result);
|
||||
|
||||
if(result == SL_RESULT_MEMORY_FAILURE){
|
||||
delete sample;
|
||||
mCurrentSample = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// realize the player
|
||||
result = (*sample->playerObject)->Realize(sample->playerObject, SL_BOOLEAN_FALSE);
|
||||
DebugTrace("result " << result);
|
||||
|
||||
@@ -96,7 +96,8 @@ hgeParticleSystem::hgeParticleSystem(hgeParticleSystemInfo *psi)
|
||||
{
|
||||
//hge=hgeCreate(HGE_VERSION);
|
||||
|
||||
memcpy(&info, psi, sizeof(hgeParticleSystemInfo));
|
||||
if (psi)
|
||||
memcpy(&info, psi, sizeof(hgeParticleSystemInfo));
|
||||
|
||||
vecLocation.x=vecPrevLocation.x=0.0f;
|
||||
vecLocation.y=vecPrevLocation.y=0.0f;
|
||||
|
||||
@@ -48,7 +48,9 @@ JSocket::JSocket(string ipAddr)
|
||||
|
||||
#ifdef WIN32
|
||||
unsigned int addr_dest = inet_addr(ipAddr.c_str());
|
||||
hostentptr=gethostbyaddr((char*) &addr_dest, 4, AF_INET);
|
||||
hostentptr = gethostbyaddr((char*) &addr_dest, 4, AF_INET);
|
||||
if (hostentptr == NULL)
|
||||
hostentptr = gethostbyname(ipAddr.c_str()); // Fix for Windows if IP Address cannot be resolved.
|
||||
#elif LINUX
|
||||
hostentptr = gethostbyname(ipAddr.c_str());
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user